better-auth 1.4.0-beta.13 → 1.4.0-beta.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/README.md +1 -1
- package/dist/{access-CMKBGgPM.cjs → access-BEhlHupZ.cjs} +1 -1
- package/dist/{access-C85goQpj.cjs → access-C7E6cTL4.cjs} +1 -1
- package/dist/{access-CiYP7qc2.js → access-CgamBNNQ.js} +1 -1
- package/dist/{access-DzjK1clY.js → access-DLZwpgWe.js} +1 -1
- package/dist/{adapter-factory-KQnbXzIu.js → adapter-factory-C4zrRt2K.js} +6 -7
- package/dist/{adapter-factory-CaEezC7-.cjs → adapter-factory-D7FKzFTi.cjs} +6 -7
- package/dist/adapters/drizzle-adapter/index.cjs +6 -5
- package/dist/adapters/drizzle-adapter/index.d.cts +5 -5
- package/dist/adapters/drizzle-adapter/index.d.ts +5 -5
- package/dist/adapters/drizzle-adapter/index.js +6 -5
- package/dist/adapters/index.cjs +6 -5
- package/dist/adapters/index.d.cts +7 -7
- package/dist/adapters/index.d.ts +9 -9
- package/dist/adapters/index.js +6 -5
- package/dist/adapters/kysely-adapter/index.cjs +7 -6
- package/dist/adapters/kysely-adapter/index.d.cts +5 -5
- package/dist/adapters/kysely-adapter/index.d.ts +6 -6
- package/dist/adapters/kysely-adapter/index.js +7 -6
- package/dist/adapters/memory-adapter/index.cjs +7 -6
- package/dist/adapters/memory-adapter/index.d.cts +3 -3
- package/dist/adapters/memory-adapter/index.d.ts +3 -3
- package/dist/adapters/memory-adapter/index.js +7 -6
- package/dist/adapters/mongodb-adapter/index.cjs +7 -6
- package/dist/adapters/mongodb-adapter/index.d.cts +5 -5
- package/dist/adapters/mongodb-adapter/index.d.ts +5 -5
- package/dist/adapters/mongodb-adapter/index.js +7 -6
- package/dist/adapters/prisma-adapter/index.cjs +6 -5
- package/dist/adapters/prisma-adapter/index.d.cts +3 -3
- package/dist/adapters/prisma-adapter/index.d.ts +3 -3
- package/dist/adapters/prisma-adapter/index.js +6 -5
- package/dist/adapters/test.cjs +4 -3
- package/dist/adapters/test.js +4 -3
- package/dist/{admin-Bm4YWSyK.cjs → admin-B0mwXWqU.cjs} +13 -11
- package/dist/{admin-DUGV_VcG.d.cts → admin-BF6OMdGy.d.cts} +76 -76
- package/dist/{admin-Bv_87xle.js → admin-BTzNtVei.js} +10 -8
- package/dist/{admin-CZqCaWVS.d.ts → admin-DYr8mGMK.d.ts} +47 -47
- package/dist/{anonymous-GeIs8dX-.js → anonymous-3gIFUdWE.js} +6 -6
- package/dist/{anonymous-CZt2hIgy.cjs → anonymous-CQSeTAsJ.cjs} +6 -6
- package/dist/api/index.cjs +15 -15
- package/dist/api/index.d.cts +3 -3
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.js +16 -15
- package/dist/{api-DxoCILgu.js → api-6Gh-v8xm.js} +1647 -1637
- package/dist/{api-D47Fl7g_.cjs → api-BGfXCsxG.cjs} +1649 -1639
- package/dist/{auth-nfiyF_s0.js → auth-CPdeGK4d.js} +24 -11
- package/dist/{auth-DOcOyyAO.cjs → auth-DQgaXk78.cjs} +25 -12
- package/dist/{bearer-Dbv3s-Ey.cjs → bearer-8fxr0Vrv.cjs} +1 -1
- package/dist/{bearer-yOkphqTA.js → bearer-CKwCx0Ys.js} +1 -1
- package/dist/{captcha-Cu5L5AI9.cjs → captcha-B6SAesoe.cjs} +31 -31
- package/dist/{captcha-DMvJpJ_i.js → captcha-Bi_qvqJM.js} +31 -31
- package/dist/client/index.cjs +8 -6
- package/dist/client/index.d.cts +67 -37
- package/dist/client/index.d.ts +53 -23
- package/dist/client/index.js +7 -7
- package/dist/client/lynx/index.cjs +3 -3
- package/dist/client/lynx/index.d.cts +24 -24
- package/dist/client/lynx/index.d.ts +26 -26
- package/dist/client/lynx/index.js +3 -3
- package/dist/client/plugins/index.cjs +351 -363
- package/dist/client/plugins/index.d.cts +1596 -1616
- package/dist/client/plugins/index.d.ts +475 -478
- package/dist/client/plugins/index.js +346 -358
- package/dist/client/react/index.cjs +3 -3
- package/dist/client/react/index.d.cts +24 -24
- package/dist/client/react/index.d.ts +26 -26
- package/dist/client/react/index.js +3 -3
- package/dist/client/solid/index.cjs +6 -6
- package/dist/client/solid/index.d.cts +17 -17
- package/dist/client/solid/index.d.ts +19 -19
- package/dist/client/solid/index.js +5 -5
- package/dist/client/svelte/index.cjs +4 -4
- package/dist/client/svelte/index.d.cts +20 -20
- package/dist/client/svelte/index.d.ts +20 -20
- package/dist/client/svelte/index.js +4 -4
- package/dist/client/vue/index.cjs +5 -5
- package/dist/client/vue/index.d.cts +21 -21
- package/dist/client/vue/index.d.ts +7 -7
- package/dist/client/vue/index.js +5 -5
- package/dist/{client-tn91AMhb.d.ts → client-D2fd_ySm.d.ts} +14 -14
- package/dist/{client-BuCPepf7.d.cts → client-Df4BjPAg.d.cts} +14 -14
- package/dist/{client-CHNR12_D.d.cts → client-Du0PAan5.d.cts} +70 -70
- package/dist/{client-CmCcVw0X.d.ts → client-P2tgFSW-.d.ts} +71 -71
- package/dist/cookies/index.cjs +7 -4
- package/dist/cookies/index.d.cts +4 -4
- package/dist/cookies/index.d.ts +6 -6
- package/dist/cookies/index.js +6 -5
- package/dist/{cookies-C0ukzamv.cjs → cookies-B6gl9E6Z.cjs} +297 -28
- package/dist/{cookies-YIhGFT3t.js → cookies-CBcV_aA7.js} +277 -27
- package/dist/crypto/index.cjs +6 -2
- package/dist/crypto/index.d.cts +4 -1
- package/dist/crypto/index.d.ts +4 -1
- package/dist/crypto/index.js +3 -2
- package/dist/{crypto-Cm1LKxZK.js → crypto-CGcj9N1E.js} +4 -11
- package/dist/{crypto-GB8E2Sqo.cjs → crypto-DgMl-YEg.cjs} +6 -20
- package/dist/{custom-session-mzjgl4I0.js → custom-session-4TJwa0ps.js} +2 -2
- package/dist/{custom-session-Dq7kJpay.cjs → custom-session-BN-427vp.cjs} +2 -2
- package/dist/{schema-DVD_DMGr.js → date-BPjINFle.js} +13 -11
- package/dist/{schema-CZyco4Bb.cjs → date-utEdG8L8.cjs} +12 -10
- package/dist/db/index.cjs +20 -19
- package/dist/db/index.d.cts +2 -2
- package/dist/db/index.d.ts +4 -4
- package/dist/db/index.js +11 -10
- package/dist/{db-BvFyxQ2U.js → db-BRTGwZsa.js} +1066 -1069
- package/dist/{db-Dn17omQ4.cjs → db-DmlJvzsY.cjs} +1067 -1070
- package/dist/{device-authorization-Cn96X1mD.js → device-authorization-BuueMGYZ.js} +4 -4
- package/dist/{device-authorization-EOq-p6gT.cjs → device-authorization-DHFsD2aH.cjs} +5 -5
- package/dist/{email-otp-BJc23Pox.js → email-otp-CQ_utv14.js} +28 -30
- package/dist/{email-otp-Duy-8LZZ.cjs → email-otp-Cd-74e0P.cjs} +34 -35
- package/dist/{generic-oauth-B3I2Gf44.js → generic-oauth-BB9EdG6w.js} +5 -5
- package/dist/{generic-oauth-DFnrwFvM.cjs → generic-oauth-BiVIdp_U.cjs} +6 -6
- package/dist/{has-permission-CAhU7MOW.cjs → has-permission-BXnfxm8t.cjs} +1 -1
- package/dist/{has-permission-CFehLg5L.js → has-permission-D4Cw2FMS.js} +1 -1
- package/dist/{haveibeenpwned-BIwNylxL.js → haveibeenpwned-DurqczXF.js} +1 -1
- package/dist/{index-DgpmIAjL.d.cts → index--81PBOoZ.d.cts} +1 -1
- package/dist/{index-D47evZgv.d.cts → index-4zGHsckJ.d.cts} +24 -24
- package/dist/index-7gHShZt3.d.ts +113 -0
- package/dist/{index-B6kMPMVt.d.ts → index-9hLkyMei.d.ts} +15 -15
- package/dist/{index-gFOnZNib.d.ts → index-B-SnFEKa.d.cts} +1992 -2271
- package/dist/{index-Cg1CVzvT.d.ts → index-B2Ny-3GE.d.ts} +59 -59
- package/dist/{index-CvRBCe6q.d.ts → index-B55U6Ak-.d.ts} +47 -47
- package/dist/{index-B54rcdu6.d.ts → index-B7htH85S.d.ts} +24 -24
- package/dist/{index-B7uT04qq.d.ts → index-B84pNnEA.d.ts} +7 -7
- package/dist/{index-B9S3H-6J.d.ts → index-B85DGXi3.d.cts} +81 -82
- package/dist/{index-j5Hnm9IK.d.cts → index-B9k29p-B.d.cts} +2 -2
- package/dist/index-BP1R5jM5.d.ts +36 -0
- package/dist/{index-DgP_W74p.d.cts → index-BY_Dn8rS.d.cts} +11 -11
- package/dist/{index-C0pFvDmG.d.cts → index-BaTFWF0T.d.ts} +2100 -2379
- package/dist/{index-AFECof_v.d.cts → index-BiC8Bpe_.d.cts} +26 -28
- package/dist/{index--btdjysb.d.cts → index-BiL6fcXL.d.cts} +15 -15
- package/dist/{index-CwUQdVct.d.ts → index-BkaxKbzZ.d.ts} +4 -4
- package/dist/{index-RWNGvtOw.d.cts → index-BrUz7QlW.d.cts} +7 -7
- package/dist/{index-BGjDkvdo.d.cts → index-BsEIAwi8.d.cts} +1526 -1713
- package/dist/{index-CpXg4Juh.d.ts → index-BxgY7t4k.d.ts} +32 -32
- package/dist/{index-Cpy42W_d.d.cts → index-Bxl_yLTd.d.cts} +16 -17
- package/dist/{index-CMe7EykX.d.ts → index-C73W2jG7.d.ts} +15 -15
- package/dist/{index-Ch8HkJZj.d.cts → index-CCnhllmu.d.cts} +24 -24
- package/dist/{index-D6BVJs-h.d.ts → index-CHRHRD8F.d.ts} +5 -5
- package/dist/{index-C-z9Otzw.d.ts → index-CLIUb8-A.d.ts} +8 -8
- package/dist/{index-BPfW0EE8.d.cts → index-CNKyl0Pp.d.cts} +50 -50
- package/dist/{index-Cqz6miMA.d.ts → index-CRr_-9Dg.d.ts} +32 -32
- package/dist/{index-BKs8lAg_.d.cts → index-CSzuGp7U.d.cts} +12 -12
- package/dist/{index-DjXaaott.d.ts → index-CWI7sdP7.d.ts} +16 -17
- package/dist/{index-Dd1ffzzA.d.ts → index-CnZd1YZ_.d.ts} +13 -13
- package/dist/{index-Bk5OXyUg.d.cts → index-CqFQMp7E.d.cts} +3 -3
- package/dist/{index-DT_dYqYt.d.ts → index-CqhKt6bv.d.ts} +12 -12
- package/dist/{index-7IFEqRAp.d.ts → index-DB5KbGvG.d.ts} +21 -21
- package/dist/{index-D_CyR6xm.d.cts → index-DBwtHgbM.d.cts} +15 -15
- package/dist/index-DJ-9T-mA.d.cts +112 -0
- package/dist/{index-D4Dckjj-.d.ts → index-DJAoqSe7.d.ts} +5 -5
- package/dist/{index-e0STHISZ.d.ts → index-DP-M7vHz.d.ts} +11 -11
- package/dist/{index-CntsO_8k.d.cts → index-DXlXcYS5.d.ts} +46 -47
- package/dist/{index-yic5OK6z.d.cts → index-D_dLOuVT.d.cts} +32 -32
- package/dist/{index-DUS1-CMU.d.cts → index-Dcf7jJ87.d.cts} +31 -31
- package/dist/{index-Bkyb84Ii.d.ts → index-Dd3eyVRJ.d.ts} +1 -1
- package/dist/index-DgN3-VmS.d.cts +36 -0
- package/dist/{index-DDaNGXa2.d.cts → index-DgTqMaSl.d.cts} +12 -12
- package/dist/{index-DHZ4drLn.d.ts → index-DggDHQNY.d.ts} +24 -24
- package/dist/{index-Cgi7uXuu.d.ts → index-DqjKAy1F.d.ts} +26 -28
- package/dist/{index-BBtdzPzk.d.ts → index-Dxex3mlh.d.ts} +1528 -1715
- package/dist/{index-H0wZ8DLw.d.cts → index-LNqDq1Hq.d.cts} +5 -5
- package/dist/{index-G-ankSM7.d.cts → index-Pqf6-jfF.d.cts} +21 -21
- package/dist/{index-BqfmtmEV.d.cts → index-fnYyOsr9.d.cts} +59 -59
- package/dist/{index-CKpTDvcE.d.cts → index-qTH_rN0R.d.cts} +8 -8
- package/dist/index.cjs +28 -27
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +20 -19
- package/dist/integrations/next-js.cjs +5 -4
- package/dist/integrations/next-js.d.cts +4 -4
- package/dist/integrations/next-js.d.ts +2 -2
- package/dist/integrations/next-js.js +5 -4
- package/dist/integrations/node.d.cts +2 -2
- package/dist/integrations/node.d.ts +4 -4
- package/dist/integrations/react-start.cjs +5 -4
- package/dist/integrations/react-start.d.cts +4 -4
- package/dist/integrations/react-start.d.ts +2 -2
- package/dist/integrations/react-start.js +5 -4
- package/dist/integrations/svelte-kit.cjs +5 -4
- package/dist/integrations/svelte-kit.d.cts +4 -4
- package/dist/integrations/svelte-kit.d.ts +6 -6
- package/dist/integrations/svelte-kit.js +5 -4
- package/dist/jwt-C3JWvMfo.js +94 -0
- package/dist/{jwt-2W7QW_0l.js → jwt-CDlbjYp2.js} +4 -4
- package/dist/jwt-DgRU65bf.cjs +121 -0
- package/dist/{jwt-DvuL40-q.cjs → jwt-nzKALWtQ.cjs} +4 -4
- package/dist/{kysely-adapter-CRd7C98k.cjs → kysely-adapter-D_pu-BzM.cjs} +3 -3
- package/dist/{kysely-adapter-Raw4YS5F.js → kysely-adapter-RP4FQnP-.js} +3 -3
- package/dist/{magic-link-sK6PyR1P.cjs → magic-link-B-TAuQox.cjs} +5 -5
- package/dist/{magic-link-DapoBSZo.js → magic-link-CxYBG-U8.js} +4 -4
- package/dist/{memory-adapter-DUlbdoJe.js → memory-adapter-5dOyXPKc.js} +1 -1
- package/dist/{memory-adapter-Cd7XB1KM.cjs → memory-adapter-yPDa0_of.cjs} +1 -1
- package/dist/{mongodb-adapter-Cplt9kk7.cjs → mongodb-adapter-DFQO1inP.cjs} +1 -1
- package/dist/{mongodb-adapter-BuGGSrtp.js → mongodb-adapter-U6gPYEBl.js} +1 -1
- package/dist/{multi-session-BNddUjFx.js → multi-session-DsOJfKSo.js} +3 -3
- package/dist/{multi-session-Bttq6Dk8.cjs → multi-session-i5i3oLst.cjs} +2 -2
- package/dist/{oauth-proxy-CYovlEOY.cjs → oauth-proxy-CJsdMW4Q.cjs} +3 -3
- package/dist/{oauth-proxy-B5aRoZkb.js → oauth-proxy-t3aWFzd5.js} +3 -3
- package/dist/oauth2/index.cjs +15 -14
- package/dist/oauth2/index.d.cts +9 -9
- package/dist/oauth2/index.d.ts +11 -11
- package/dist/oauth2/index.js +15 -14
- package/dist/{oidc-provider-DG6mR-lu.js → oidc-provider-C6iYtoIq.js} +114 -114
- package/dist/{oidc-provider-5sES_06H.cjs → oidc-provider-zLhXChrP.cjs} +115 -115
- package/dist/{one-tap-BIV-N3rL.cjs → one-tap-CT8Rr53G.cjs} +1 -1
- package/dist/{one-tap-C1q5Xvxq.js → one-tap-aKQMlpET.js} +2 -2
- package/dist/{open-api-CWzVb29I.cjs → open-api-CPDeQNsp.cjs} +2 -2
- package/dist/{open-api-DzIRvxPd.js → open-api-DaBBUfld.js} +2 -2
- package/dist/{organization-Dd25_EH3.cjs → organization-Cf4FevpV.cjs} +2476 -2492
- package/dist/{organization-Cz6DO2Gm.js → organization-DgOa6BVQ.js} +2438 -2448
- package/dist/permission-BErHURBU.js +15 -0
- package/dist/permission-CoOqrICL.cjs +27 -0
- package/dist/{phone-number-BuORpYMF.js → phone-number-BTiCUGPy.js} +4 -4
- package/dist/{phone-number-5snPnXW1.cjs → phone-number-BaCtIX8Y.cjs} +8 -8
- package/dist/plugins/access/index.cjs +1 -1
- package/dist/plugins/access/index.d.cts +1 -1
- package/dist/plugins/access/index.d.ts +2 -2
- package/dist/plugins/access/index.js +1 -1
- package/dist/plugins/admin/access/index.cjs +2 -2
- package/dist/plugins/admin/access/index.d.cts +1 -1
- package/dist/plugins/admin/access/index.d.ts +2 -2
- package/dist/plugins/admin/access/index.js +2 -2
- package/dist/plugins/admin/index.cjs +20 -19
- package/dist/plugins/admin/index.d.cts +5 -6
- package/dist/plugins/admin/index.d.ts +7 -8
- package/dist/plugins/admin/index.js +20 -19
- package/dist/plugins/anonymous/index.cjs +16 -15
- package/dist/plugins/anonymous/index.d.cts +3 -3
- package/dist/plugins/anonymous/index.d.ts +5 -5
- package/dist/plugins/anonymous/index.js +16 -15
- package/dist/plugins/bearer/index.cjs +6 -5
- package/dist/plugins/bearer/index.d.cts +1 -1
- package/dist/plugins/bearer/index.d.ts +1 -1
- package/dist/plugins/bearer/index.js +6 -5
- package/dist/plugins/captcha/index.cjs +1 -1
- package/dist/plugins/captcha/index.d.cts +1 -1
- package/dist/plugins/captcha/index.d.ts +1 -1
- package/dist/plugins/captcha/index.js +1 -1
- package/dist/plugins/custom-session/index.cjs +17 -16
- package/dist/plugins/custom-session/index.d.cts +3 -3
- package/dist/plugins/custom-session/index.d.ts +5 -5
- package/dist/plugins/custom-session/index.js +17 -16
- package/dist/plugins/device-authorization/index.cjs +16 -15
- package/dist/plugins/device-authorization/index.d.cts +2 -2
- package/dist/plugins/device-authorization/index.d.ts +3 -3
- package/dist/plugins/device-authorization/index.js +16 -15
- package/dist/plugins/email-otp/index.cjs +17 -16
- package/dist/plugins/email-otp/index.d.cts +1 -2
- package/dist/plugins/email-otp/index.d.ts +1 -2
- package/dist/plugins/email-otp/index.js +17 -16
- package/dist/plugins/generic-oauth/index.cjs +16 -15
- package/dist/plugins/generic-oauth/index.d.cts +3 -3
- package/dist/plugins/generic-oauth/index.d.ts +5 -5
- package/dist/plugins/generic-oauth/index.js +16 -15
- package/dist/plugins/haveibeenpwned/index.cjs +16 -15
- package/dist/plugins/haveibeenpwned/index.d.cts +1 -1
- package/dist/plugins/haveibeenpwned/index.d.ts +1 -1
- package/dist/plugins/haveibeenpwned/index.js +16 -15
- package/dist/plugins/index.cjs +51 -50
- package/dist/plugins/index.d.cts +147 -150
- package/dist/plugins/index.d.ts +139 -142
- package/dist/plugins/index.js +48 -47
- package/dist/plugins/jwt/index.cjs +18 -17
- package/dist/plugins/jwt/index.d.cts +3 -3
- package/dist/plugins/jwt/index.d.ts +5 -5
- package/dist/plugins/jwt/index.js +17 -16
- package/dist/plugins/magic-link/index.cjs +16 -15
- package/dist/plugins/magic-link/index.d.cts +1 -1
- package/dist/plugins/magic-link/index.d.ts +1 -1
- package/dist/plugins/magic-link/index.js +16 -15
- package/dist/plugins/multi-session/index.cjs +16 -15
- package/dist/plugins/multi-session/index.d.cts +1 -3
- package/dist/plugins/multi-session/index.d.ts +1 -3
- package/dist/plugins/multi-session/index.js +16 -15
- package/dist/plugins/oauth-proxy/index.cjs +16 -15
- package/dist/plugins/oauth-proxy/index.d.cts +1 -1
- package/dist/plugins/oauth-proxy/index.d.ts +1 -1
- package/dist/plugins/oauth-proxy/index.js +16 -15
- package/dist/plugins/oidc-provider/index.cjs +17 -16
- package/dist/plugins/oidc-provider/index.d.cts +3 -3
- package/dist/plugins/oidc-provider/index.d.ts +5 -5
- package/dist/plugins/oidc-provider/index.js +17 -16
- package/dist/plugins/one-tap/index.cjs +16 -15
- package/dist/plugins/one-tap/index.d.cts +1 -1
- package/dist/plugins/one-tap/index.d.ts +1 -1
- package/dist/plugins/one-tap/index.js +16 -15
- package/dist/plugins/one-time-token/index.cjs +48 -47
- package/dist/plugins/one-time-token/index.d.cts +3 -3
- package/dist/plugins/one-time-token/index.d.ts +5 -5
- package/dist/plugins/one-time-token/index.js +48 -47
- package/dist/plugins/open-api/index.cjs +16 -15
- package/dist/plugins/open-api/index.d.cts +1 -1
- package/dist/plugins/open-api/index.d.ts +2 -2
- package/dist/plugins/open-api/index.js +16 -15
- package/dist/plugins/organization/access/index.cjs +2 -2
- package/dist/plugins/organization/access/index.d.cts +2 -2
- package/dist/plugins/organization/access/index.d.ts +3 -3
- package/dist/plugins/organization/access/index.js +2 -2
- package/dist/plugins/organization/index.cjs +20 -19
- package/dist/plugins/organization/index.d.cts +5 -8
- package/dist/plugins/organization/index.d.ts +7 -10
- package/dist/plugins/organization/index.js +20 -19
- package/dist/plugins/passkey/index.cjs +16 -15
- package/dist/plugins/passkey/index.d.cts +2 -2
- package/dist/plugins/passkey/index.d.ts +3 -3
- package/dist/plugins/passkey/index.js +15 -14
- package/dist/plugins/phone-number/index.cjs +16 -15
- package/dist/plugins/phone-number/index.d.cts +3 -3
- package/dist/plugins/phone-number/index.d.ts +5 -5
- package/dist/plugins/phone-number/index.js +16 -15
- package/dist/plugins/siwe/index.cjs +16 -15
- package/dist/plugins/siwe/index.d.cts +3 -3
- package/dist/plugins/siwe/index.d.ts +5 -5
- package/dist/plugins/siwe/index.js +16 -15
- package/dist/plugins/two-factor/index.cjs +18 -17
- package/dist/plugins/two-factor/index.d.cts +3 -3
- package/dist/plugins/two-factor/index.d.ts +5 -5
- package/dist/plugins/two-factor/index.js +18 -17
- package/dist/plugins/username/index.cjs +16 -15
- package/dist/plugins/username/index.d.cts +2 -2
- package/dist/plugins/username/index.d.ts +3 -3
- package/dist/plugins/username/index.js +16 -15
- package/dist/{plugins-BvfmdVWp.cjs → plugins-CQPBhZ16.cjs} +308 -308
- package/dist/{plugins-C57Wvgvy.js → plugins-D4OWj_2x.js} +305 -305
- package/dist/{plugins-BbSF_Pek.d.ts → plugins-D_DW87jQ.d.ts} +3 -3
- package/dist/{plugins-Bda65QeL.d.cts → plugins-ivDhKYPY.d.cts} +2 -2
- package/dist/{proxy-Bur4Ci41.cjs → proxy-CrB-ATzF.cjs} +187 -25
- package/dist/{proxy-D4B6B6z4.js → proxy-DGoSvKdo.js} +176 -26
- package/dist/{session-BqpHJ0z-.js → session-1slmMotZ.js} +102 -25
- package/dist/{session-D5q1XDfx.cjs → session-BqrKkkSd.cjs} +104 -33
- package/dist/{sign-0t1-RJB5.js → sign-BIyc0J4i.js} +1 -1
- package/dist/{sign-KfLOKIQS.cjs → sign-C89ROO81.cjs} +1 -1
- package/dist/{siwe-CspaUlkq.js → siwe-DGF6ANXu.js} +20 -20
- package/dist/{siwe-BbVRRyiy.cjs → siwe-Da1cjQzQ.cjs} +20 -20
- package/dist/test-utils/index.cjs +8995 -8986
- package/dist/test-utils/index.d.cts +372 -373
- package/dist/test-utils/index.d.ts +83 -84
- package/dist/test-utils/index.js +8995 -8986
- package/dist/{two-factor-BiVGRW-E.js → two-factor-D2vx3jKv.js} +39 -39
- package/dist/{two-factor-1UxFwVuo.cjs → two-factor-FcwMt2ak.cjs} +41 -41
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +1 -1
- package/dist/{url-GPfV0MFh.cjs → url-CADm8geO.cjs} +1 -1
- package/dist/{url-B43v92M_.js → url-DqQShdt9.js} +1 -1
- package/dist/{username-DW7xzEDM.cjs → username-CpiM_orl.cjs} +17 -17
- package/dist/{username-QS3MZXwm.js → username-DNMQwdH8.js} +16 -16
- package/dist/{utils-CyWxqQlM.cjs → utils-BWorSjpq.cjs} +12 -12
- package/dist/{utils-C86NQnwF.js → utils-CrGREH-c.js} +13 -13
- package/dist/{vanilla-CjDGO-xN.cjs → vanilla-BEVvH8BS.cjs} +2 -2
- package/dist/{vanilla-io0ilbFf.js → vanilla-DGLnf-wi.js} +2 -2
- package/package.json +8 -7
- package/dist/index-A2P42rxH.d.ts +0 -36
- package/dist/index-DAM-D9Cw.d.ts +0 -71
- package/dist/index-DRiG_er6.d.cts +0 -71
- package/dist/index-DlDw_Wj7.d.cts +0 -36
- package/dist/init-options-VvQwsOfO.d.cts +0 -4881
- package/dist/init-options-bKXqGECK.d.ts +0 -4882
- package/dist/session-C4KIPzRe.d.ts +0 -21
- package/dist/session-FTqk_ucC.d.cts +0 -21
- package/dist/types-9O9RA1so.cjs +0 -0
- package/dist/types-Bkw-9vBe.js +0 -1
- package/dist/user-BckRO-VN.d.ts +0 -20
- package/dist/user-DcGEK64L.d.cts +0 -20
- /package/dist/{access-CvCBdssC.js → access-BEuU6R79.js} +0 -0
- /package/dist/{access-KlwyAJUG.cjs → access-BLwdGGDJ.cjs} +0 -0
- /package/dist/{bun-sqlite-dialect-Di0S2xW4.js → bun-sqlite-dialect-19FWyoCu.js} +0 -0
- /package/dist/{bun-sqlite-dialect-DWe97FcN.cjs → bun-sqlite-dialect-CDy1mm9D.cjs} +0 -0
- /package/dist/{client-BgeEbVdf.js → client-BDyugzk9.js} +0 -0
- /package/dist/{client-D9BvKRI6.cjs → client-BuXfVfp7.cjs} +0 -0
- /package/dist/{client-BgV-MZs1.cjs → client-CdgpGQaK.cjs} +0 -0
- /package/dist/{client-CPRUKMwz.js → client-D-TSCG4M.js} +0 -0
- /package/dist/{client-Cp9AJdg5.js → client-DvRBxKYL.js} +0 -0
- /package/dist/{client-Nf2zsTdY.cjs → client-PGwhle1j.cjs} +0 -0
- /package/dist/{haveibeenpwned-g1qbSmgu.cjs → haveibeenpwned-n7QeG9ZS.cjs} +0 -0
- /package/dist/{helper-DciwSp4h.d.ts → helper-DHVUEBjl.d.ts} +0 -0
- /package/dist/{index-CCggO_hw.d.ts → index-9e6p7TFv.d.ts} +0 -0
- /package/dist/{index-D2HUTZ-d.d.cts → index-_1bfRgi2.d.cts} +0 -0
- /package/dist/{json-Cao-wnuS.cjs → json-CSNVAYvC.cjs} +0 -0
- /package/dist/{json-C3L9IMZ_.js → json-rUsZ9vGt.js} +0 -0
- /package/dist/{misc-Qf_w3crA.cjs → misc-BRSAgnve.cjs} +0 -0
- /package/dist/{misc-iq1wY9b6.js → misc-C0Kg4w6i.js} +0 -0
- /package/dist/{node-sqlite-dialect-qAUNq0lI.js → node-sqlite-dialect-CmwmRgW4.js} +0 -0
- /package/dist/{node-sqlite-dialect-Bfd3-YTX.cjs → node-sqlite-dialect-Uo19ydNx.cjs} +0 -0
- /package/dist/{parser-B3VysIjg.cjs → parser-Cv8gMvb_.cjs} +0 -0
- /package/dist/{parser-CtHEE8Bt.js → parser-LnIuhyfR.js} +0 -0
- /package/dist/{password-yMNRDQKB.js → password-B8hrwTWa.js} +0 -0
- /package/dist/{password-C3iUi9QC.cjs → password-bcNraGUR.cjs} +0 -0
- /package/dist/{plugin-helper-Ew7TUVuj.cjs → plugin-helper-BTYwL00A.cjs} +0 -0
- /package/dist/{plugin-helper-CaHV6HPJ.js → plugin-helper-CGhaPhDN.js} +0 -0
- /package/dist/{types-DMBaPPuG.d.ts → types-4dCicFIY.d.ts} +0 -0
- /package/dist/{organization-DRrjcP8j.js → types-D97IFTaH.js} +0 -0
- /package/dist/{organization-CLBgwBBZ.cjs → types-DDfu9blO.cjs} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('../../chunk-DWy1uDak.cjs');
|
|
2
|
-
require('../../json-
|
|
3
|
-
require('../../crypto-
|
|
4
|
-
require('../../
|
|
5
|
-
require('../../utils-
|
|
6
|
-
|
|
2
|
+
require('../../json-CSNVAYvC.cjs');
|
|
3
|
+
require('../../crypto-DgMl-YEg.cjs');
|
|
4
|
+
require('../../jwt-DgRU65bf.cjs');
|
|
5
|
+
require('../../utils-BWorSjpq.cjs');
|
|
6
|
+
require('../../misc-BRSAgnve.cjs');
|
|
7
|
+
const require_adapter_factory = require('../../adapter-factory-D7FKzFTi.cjs');
|
|
7
8
|
let __better_auth_core_error = require("@better-auth/core/error");
|
|
8
9
|
__better_auth_core_error = require_chunk.__toESM(__better_auth_core_error);
|
|
9
10
|
|
|
@@ -12,13 +12,13 @@ interface PrismaConfig {
|
|
|
12
12
|
*
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
|
-
debugLogs?: DBAdapterDebugLogOption;
|
|
15
|
+
debugLogs?: DBAdapterDebugLogOption | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Use plural table names
|
|
18
18
|
*
|
|
19
19
|
* @default false
|
|
20
20
|
*/
|
|
21
|
-
usePlural?: boolean;
|
|
21
|
+
usePlural?: boolean | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* Whether to execute multiple operations in a transaction.
|
|
24
24
|
*
|
|
@@ -26,7 +26,7 @@ interface PrismaConfig {
|
|
|
26
26
|
* set this to `false` and operations will be executed sequentially.
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
|
-
transaction?: boolean;
|
|
29
|
+
transaction?: boolean | undefined;
|
|
30
30
|
}
|
|
31
31
|
interface PrismaClient {}
|
|
32
32
|
declare const prismaAdapter: (prisma: PrismaClient, config: PrismaConfig) => (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
|
|
@@ -12,13 +12,13 @@ interface PrismaConfig {
|
|
|
12
12
|
*
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
|
-
debugLogs?: DBAdapterDebugLogOption;
|
|
15
|
+
debugLogs?: DBAdapterDebugLogOption | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Use plural table names
|
|
18
18
|
*
|
|
19
19
|
* @default false
|
|
20
20
|
*/
|
|
21
|
-
usePlural?: boolean;
|
|
21
|
+
usePlural?: boolean | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* Whether to execute multiple operations in a transaction.
|
|
24
24
|
*
|
|
@@ -26,7 +26,7 @@ interface PrismaConfig {
|
|
|
26
26
|
* set this to `false` and operations will be executed sequentially.
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
|
-
transaction?: boolean;
|
|
29
|
+
transaction?: boolean | undefined;
|
|
30
30
|
}
|
|
31
31
|
interface PrismaClient {}
|
|
32
32
|
declare const prismaAdapter: (prisma: PrismaClient, config: PrismaConfig) => (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import "../../json-
|
|
2
|
-
import "../../crypto-
|
|
3
|
-
import "../../
|
|
4
|
-
import "../../utils-
|
|
5
|
-
import
|
|
1
|
+
import "../../json-rUsZ9vGt.js";
|
|
2
|
+
import "../../crypto-CGcj9N1E.js";
|
|
3
|
+
import "../../jwt-C3JWvMfo.js";
|
|
4
|
+
import "../../utils-CrGREH-c.js";
|
|
5
|
+
import "../../misc-C0Kg4w6i.js";
|
|
6
|
+
import { t as createAdapterFactory } from "../../adapter-factory-C4zrRt2K.js";
|
|
6
7
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
7
8
|
|
|
8
9
|
//#region src/adapters/prisma-adapter/prisma-adapter.ts
|
package/dist/adapters/test.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-DWy1uDak.cjs');
|
|
2
|
-
require('../crypto-
|
|
3
|
-
require('../
|
|
4
|
-
const require_utils = require('../utils-
|
|
2
|
+
require('../crypto-DgMl-YEg.cjs');
|
|
3
|
+
require('../jwt-DgRU65bf.cjs');
|
|
4
|
+
const require_utils = require('../utils-BWorSjpq.cjs');
|
|
5
|
+
require('../misc-BRSAgnve.cjs');
|
|
5
6
|
let vitest = require("vitest");
|
|
6
7
|
vitest = require_chunk.__toESM(vitest);
|
|
7
8
|
|
package/dist/adapters/test.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import "../crypto-
|
|
2
|
-
import "../
|
|
3
|
-
import {
|
|
1
|
+
import "../crypto-CGcj9N1E.js";
|
|
2
|
+
import "../jwt-C3JWvMfo.js";
|
|
3
|
+
import { t as generateId } from "../utils-CrGREH-c.js";
|
|
4
|
+
import "../misc-C0Kg4w6i.js";
|
|
4
5
|
import { beforeAll, describe, expect, test } from "vitest";
|
|
5
6
|
|
|
6
7
|
//#region src/adapters/test.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_session = require('./session-
|
|
5
|
-
const require_plugin_helper = require('./plugin-helper-
|
|
6
|
-
const require_has_permission = require('./has-permission-
|
|
2
|
+
const require_cookies = require('./cookies-B6gl9E6Z.cjs');
|
|
3
|
+
const require_date = require('./date-utEdG8L8.cjs');
|
|
4
|
+
const require_session = require('./session-BqrKkkSd.cjs');
|
|
5
|
+
const require_plugin_helper = require('./plugin-helper-BTYwL00A.cjs');
|
|
6
|
+
const require_has_permission = require('./has-permission-BXnfxm8t.cjs');
|
|
7
7
|
let __better_auth_core_error = require("@better-auth/core/error");
|
|
8
8
|
__better_auth_core_error = require_chunk.__toESM(__better_auth_core_error);
|
|
9
9
|
let __better_auth_core_utils = require("@better-auth/core/utils");
|
|
@@ -207,7 +207,7 @@ const admin = (options) => {
|
|
|
207
207
|
});
|
|
208
208
|
const user = await ctx.context.internalAdapter.findUserById(id);
|
|
209
209
|
if (!user) throw new better_call.APIError("NOT_FOUND", { message: __better_auth_core_error.BASE_ERROR_CODES.USER_NOT_FOUND });
|
|
210
|
-
return
|
|
210
|
+
return require_date.parseUserOutput(ctx.context.options, user);
|
|
211
211
|
}),
|
|
212
212
|
createUser: (0, __better_auth_core_api.createAuthEndpoint)("/admin/create-user", {
|
|
213
213
|
method: "POST",
|
|
@@ -244,9 +244,11 @@ const admin = (options) => {
|
|
|
244
244
|
permissions: { user: ["create"] }
|
|
245
245
|
})) throw new better_call.APIError("FORBIDDEN", { message: ADMIN_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS });
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
const email = ctx.body.email.toLowerCase();
|
|
248
|
+
if (!zod.string().email().safeParse(email).success) throw new better_call.APIError("BAD_REQUEST", { message: __better_auth_core_error.BASE_ERROR_CODES.INVALID_EMAIL });
|
|
249
|
+
if (await ctx.context.internalAdapter.findUserByEmail(email)) throw new better_call.APIError("BAD_REQUEST", { message: ADMIN_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL });
|
|
248
250
|
const user = await ctx.context.internalAdapter.createUser({
|
|
249
|
-
email
|
|
251
|
+
email,
|
|
250
252
|
name: ctx.body.name,
|
|
251
253
|
role: (ctx.body.role && parseRoles(ctx.body.role)) ?? options?.defaultRole ?? "user",
|
|
252
254
|
...ctx.body.data
|
|
@@ -475,7 +477,7 @@ const admin = (options) => {
|
|
|
475
477
|
const user = await ctx.context.internalAdapter.updateUser(ctx.body.userId, {
|
|
476
478
|
banned: true,
|
|
477
479
|
banReason: ctx.body.banReason || options?.defaultBanReason || "No reason",
|
|
478
|
-
banExpires: ctx.body.banExpiresIn ?
|
|
480
|
+
banExpires: ctx.body.banExpiresIn ? require_date.getDate(ctx.body.banExpiresIn, "sec") : options?.defaultBanExpiresIn ? require_date.getDate(options.defaultBanExpiresIn, "sec") : void 0,
|
|
479
481
|
updatedAt: /* @__PURE__ */ new Date()
|
|
480
482
|
});
|
|
481
483
|
await ctx.context.internalAdapter.deleteSessions(ctx.body.userId);
|
|
@@ -511,7 +513,7 @@ const admin = (options) => {
|
|
|
511
513
|
if (!targetUser) throw new better_call.APIError("NOT_FOUND", { message: "User not found" });
|
|
512
514
|
const session = await ctx.context.internalAdapter.createSession(targetUser.id, true, {
|
|
513
515
|
impersonatedBy: ctx.context.session.user.id,
|
|
514
|
-
expiresAt: options?.impersonationSessionDuration ?
|
|
516
|
+
expiresAt: options?.impersonationSessionDuration ? require_date.getDate(options.impersonationSessionDuration, "sec") : require_date.getDate(3600, "sec")
|
|
515
517
|
}, true);
|
|
516
518
|
if (!session) throw new better_call.APIError("INTERNAL_SERVER_ERROR", { message: ADMIN_ERROR_CODES.FAILED_TO_CREATE_USER });
|
|
517
519
|
const authCookies = ctx.context.authCookies;
|
|
@@ -738,7 +740,7 @@ const admin = (options) => {
|
|
|
738
740
|
})
|
|
739
741
|
},
|
|
740
742
|
$ERROR_CODES: ADMIN_ERROR_CODES,
|
|
741
|
-
schema:
|
|
743
|
+
schema: require_date.mergeSchema(schema, opts.schema),
|
|
742
744
|
options
|
|
743
745
|
};
|
|
744
746
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
1
|
+
import { g as User$1, h as Session$1 } from "./index-BsEIAwi8.cjs";
|
|
2
|
+
import { t as InferOptionSchema } from "./plugins-ivDhKYPY.cjs";
|
|
3
|
+
import { a as Role, i as AccessControl, o as Statements } from "./index-CqFQMp7E.cjs";
|
|
4
|
+
import * as _better_auth_core24 from "@better-auth/core";
|
|
5
|
+
import * as _better_auth_core_db6 from "@better-auth/core/db";
|
|
6
|
+
import * as better_call622 from "better-call";
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
|
|
9
9
|
//#region src/plugins/admin/schema.d.ts
|
|
@@ -45,14 +45,14 @@ declare const schema: {
|
|
|
45
45
|
type AdminSchema = typeof schema;
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region src/plugins/admin/types.d.ts
|
|
48
|
-
interface UserWithRole extends User {
|
|
49
|
-
role?: string;
|
|
50
|
-
banned?: boolean | null;
|
|
51
|
-
banReason?: string | null;
|
|
52
|
-
banExpires?: Date | null;
|
|
48
|
+
interface UserWithRole extends User$1 {
|
|
49
|
+
role?: string | undefined;
|
|
50
|
+
banned?: (boolean | null) | undefined;
|
|
51
|
+
banReason?: (string | null) | undefined;
|
|
52
|
+
banExpires?: (Date | null) | undefined;
|
|
53
53
|
}
|
|
54
|
-
interface SessionWithImpersonatedBy extends Session {
|
|
55
|
-
impersonatedBy?: string;
|
|
54
|
+
interface SessionWithImpersonatedBy extends Session$1 {
|
|
55
|
+
impersonatedBy?: string | undefined;
|
|
56
56
|
}
|
|
57
57
|
interface AdminOptions {
|
|
58
58
|
/**
|
|
@@ -60,7 +60,7 @@ interface AdminOptions {
|
|
|
60
60
|
*
|
|
61
61
|
* @default "user"
|
|
62
62
|
*/
|
|
63
|
-
defaultRole?: string;
|
|
63
|
+
defaultRole?: string | undefined;
|
|
64
64
|
/**
|
|
65
65
|
* Roles that are considered admin roles.
|
|
66
66
|
*
|
|
@@ -69,57 +69,57 @@ interface AdminOptions {
|
|
|
69
69
|
*
|
|
70
70
|
* @default ["admin"]
|
|
71
71
|
*/
|
|
72
|
-
adminRoles?: string | string[];
|
|
72
|
+
adminRoles?: (string | string[]) | undefined;
|
|
73
73
|
/**
|
|
74
74
|
* A default ban reason
|
|
75
75
|
*
|
|
76
76
|
* By default, no reason is provided
|
|
77
77
|
*/
|
|
78
|
-
defaultBanReason?: string;
|
|
78
|
+
defaultBanReason?: string | undefined;
|
|
79
79
|
/**
|
|
80
80
|
* Number of seconds until the ban expires
|
|
81
81
|
*
|
|
82
82
|
* By default, the ban never expires
|
|
83
83
|
*/
|
|
84
|
-
defaultBanExpiresIn?: number;
|
|
84
|
+
defaultBanExpiresIn?: number | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* Duration of the impersonation session in seconds
|
|
87
87
|
*
|
|
88
88
|
* By default, the impersonation session lasts 1 hour
|
|
89
89
|
*/
|
|
90
|
-
impersonationSessionDuration?: number;
|
|
90
|
+
impersonationSessionDuration?: number | undefined;
|
|
91
91
|
/**
|
|
92
92
|
* Custom schema for the admin plugin
|
|
93
93
|
*/
|
|
94
|
-
schema?: InferOptionSchema<AdminSchema
|
|
94
|
+
schema?: InferOptionSchema<AdminSchema> | undefined;
|
|
95
95
|
/**
|
|
96
96
|
* Configure the roles and permissions for the admin
|
|
97
97
|
* plugin.
|
|
98
98
|
*/
|
|
99
|
-
ac?: AccessControl;
|
|
99
|
+
ac?: AccessControl | undefined;
|
|
100
100
|
/**
|
|
101
101
|
* Custom permissions for roles.
|
|
102
102
|
*/
|
|
103
|
-
roles?: { [key in string]?: Role };
|
|
103
|
+
roles?: { [key in string]?: Role } | undefined;
|
|
104
104
|
/**
|
|
105
105
|
* List of user ids that should have admin access
|
|
106
106
|
*
|
|
107
107
|
* If this is set, the `adminRole` option is ignored
|
|
108
108
|
*/
|
|
109
|
-
adminUserIds?: string[];
|
|
109
|
+
adminUserIds?: string[] | undefined;
|
|
110
110
|
/**
|
|
111
111
|
* Message to show when a user is banned
|
|
112
112
|
*
|
|
113
113
|
* By default, the message is "You have been banned from this application"
|
|
114
114
|
*/
|
|
115
|
-
bannedUserMessage?: string;
|
|
115
|
+
bannedUserMessage?: string | undefined;
|
|
116
116
|
}
|
|
117
|
-
type InferAdminRolesFromOption<O
|
|
117
|
+
type InferAdminRolesFromOption<O extends AdminOptions | undefined> = O extends {
|
|
118
118
|
roles: Record<string, unknown>;
|
|
119
|
-
} ? keyof O
|
|
119
|
+
} ? keyof O["roles"] : "user" | "admin";
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/plugins/admin/admin.d.ts
|
|
122
|
-
declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
122
|
+
declare const admin: <O extends AdminOptions>(options?: O | undefined) => {
|
|
123
123
|
id: "admin";
|
|
124
124
|
init(): {
|
|
125
125
|
options: {
|
|
@@ -159,7 +159,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
159
159
|
token: string;
|
|
160
160
|
ipAddress?: string | null | undefined;
|
|
161
161
|
userAgent?: string | null | undefined;
|
|
162
|
-
} & Record<string, unknown>, ctx:
|
|
162
|
+
} & Record<string, unknown>, ctx: _better_auth_core24.GenericEndpointContext | undefined): Promise<void>;
|
|
163
163
|
};
|
|
164
164
|
};
|
|
165
165
|
};
|
|
@@ -167,8 +167,8 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
167
167
|
};
|
|
168
168
|
hooks: {
|
|
169
169
|
after: {
|
|
170
|
-
matcher(context:
|
|
171
|
-
handler: (inputContext:
|
|
170
|
+
matcher(context: _better_auth_core24.HookEndpointContext): boolean;
|
|
171
|
+
handler: (inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<SessionWithImpersonatedBy[] | undefined>;
|
|
172
172
|
}[];
|
|
173
173
|
};
|
|
174
174
|
endpoints: {
|
|
@@ -187,17 +187,17 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
187
187
|
*
|
|
188
188
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-set-role)
|
|
189
189
|
*/
|
|
190
|
-
setRole:
|
|
190
|
+
setRole: better_call622.StrictEndpoint<"/admin/set-role", {
|
|
191
191
|
method: "POST";
|
|
192
192
|
body: z.ZodObject<{
|
|
193
193
|
userId: z.ZodCoercedString<unknown>;
|
|
194
194
|
role: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
195
195
|
}, z.core.$strip>;
|
|
196
196
|
requireHeaders: true;
|
|
197
|
-
use: ((inputContext:
|
|
197
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
198
198
|
session: {
|
|
199
199
|
user: UserWithRole;
|
|
200
|
-
session: Session;
|
|
200
|
+
session: Session$1;
|
|
201
201
|
};
|
|
202
202
|
}>)[];
|
|
203
203
|
metadata: {
|
|
@@ -235,15 +235,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
235
235
|
}, {
|
|
236
236
|
user: UserWithRole;
|
|
237
237
|
}>;
|
|
238
|
-
getUser:
|
|
238
|
+
getUser: better_call622.StrictEndpoint<"/admin/get-user", {
|
|
239
239
|
method: "GET";
|
|
240
240
|
query: z.ZodObject<{
|
|
241
241
|
id: z.ZodString;
|
|
242
242
|
}, z.core.$strip>;
|
|
243
|
-
use: ((inputContext:
|
|
243
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
244
244
|
session: {
|
|
245
245
|
user: UserWithRole;
|
|
246
|
-
session: Session;
|
|
246
|
+
session: Session$1;
|
|
247
247
|
};
|
|
248
248
|
}>)[];
|
|
249
249
|
metadata: {
|
|
@@ -296,7 +296,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
296
296
|
*
|
|
297
297
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-create-user)
|
|
298
298
|
*/
|
|
299
|
-
createUser:
|
|
299
|
+
createUser: better_call622.StrictEndpoint<"/admin/create-user", {
|
|
300
300
|
method: "POST";
|
|
301
301
|
body: z.ZodObject<{
|
|
302
302
|
email: z.ZodString;
|
|
@@ -333,8 +333,8 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
333
333
|
email: string;
|
|
334
334
|
password: string;
|
|
335
335
|
name: string;
|
|
336
|
-
role?: InferAdminRolesFromOption<O> | InferAdminRolesFromOption<O>[];
|
|
337
|
-
data?: Record<string, any
|
|
336
|
+
role?: (InferAdminRolesFromOption<O> | InferAdminRolesFromOption<O>[]) | undefined;
|
|
337
|
+
data?: Record<string, any> | undefined;
|
|
338
338
|
};
|
|
339
339
|
};
|
|
340
340
|
};
|
|
@@ -358,16 +358,16 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
358
358
|
*
|
|
359
359
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-update-user)
|
|
360
360
|
*/
|
|
361
|
-
adminUpdateUser:
|
|
361
|
+
adminUpdateUser: better_call622.StrictEndpoint<"/admin/update-user", {
|
|
362
362
|
method: "POST";
|
|
363
363
|
body: z.ZodObject<{
|
|
364
364
|
userId: z.ZodCoercedString<unknown>;
|
|
365
365
|
data: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
366
366
|
}, z.core.$strip>;
|
|
367
|
-
use: ((inputContext:
|
|
367
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
368
368
|
session: {
|
|
369
369
|
user: UserWithRole;
|
|
370
|
-
session: Session;
|
|
370
|
+
session: Session$1;
|
|
371
371
|
};
|
|
372
372
|
}>)[];
|
|
373
373
|
metadata: {
|
|
@@ -397,12 +397,12 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
397
397
|
} & {
|
|
398
398
|
use: any[];
|
|
399
399
|
}, UserWithRole>;
|
|
400
|
-
listUsers:
|
|
400
|
+
listUsers: better_call622.StrictEndpoint<"/admin/list-users", {
|
|
401
401
|
method: "GET";
|
|
402
|
-
use: ((inputContext:
|
|
402
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
403
403
|
session: {
|
|
404
404
|
user: UserWithRole;
|
|
405
|
-
session: Session;
|
|
405
|
+
session: Session$1;
|
|
406
406
|
};
|
|
407
407
|
}>)[];
|
|
408
408
|
query: z.ZodObject<{
|
|
@@ -498,12 +498,12 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
498
498
|
*
|
|
499
499
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-list-user-sessions)
|
|
500
500
|
*/
|
|
501
|
-
listUserSessions:
|
|
501
|
+
listUserSessions: better_call622.StrictEndpoint<"/admin/list-user-sessions", {
|
|
502
502
|
method: "POST";
|
|
503
|
-
use: ((inputContext:
|
|
503
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
504
504
|
session: {
|
|
505
505
|
user: UserWithRole;
|
|
506
|
-
session: Session;
|
|
506
|
+
session: Session$1;
|
|
507
507
|
};
|
|
508
508
|
}>)[];
|
|
509
509
|
body: z.ZodObject<{
|
|
@@ -556,15 +556,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
556
556
|
*
|
|
557
557
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-unban-user)
|
|
558
558
|
*/
|
|
559
|
-
unbanUser:
|
|
559
|
+
unbanUser: better_call622.StrictEndpoint<"/admin/unban-user", {
|
|
560
560
|
method: "POST";
|
|
561
561
|
body: z.ZodObject<{
|
|
562
562
|
userId: z.ZodCoercedString<unknown>;
|
|
563
563
|
}, z.core.$strip>;
|
|
564
|
-
use: ((inputContext:
|
|
564
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
565
565
|
session: {
|
|
566
566
|
user: UserWithRole;
|
|
567
|
-
session: Session;
|
|
567
|
+
session: Session$1;
|
|
568
568
|
};
|
|
569
569
|
}>)[];
|
|
570
570
|
metadata: {
|
|
@@ -611,17 +611,17 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
611
611
|
*
|
|
612
612
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-ban-user)
|
|
613
613
|
*/
|
|
614
|
-
banUser:
|
|
614
|
+
banUser: better_call622.StrictEndpoint<"/admin/ban-user", {
|
|
615
615
|
method: "POST";
|
|
616
616
|
body: z.ZodObject<{
|
|
617
617
|
userId: z.ZodCoercedString<unknown>;
|
|
618
618
|
banReason: z.ZodOptional<z.ZodString>;
|
|
619
619
|
banExpiresIn: z.ZodOptional<z.ZodNumber>;
|
|
620
620
|
}, z.core.$strip>;
|
|
621
|
-
use: ((inputContext:
|
|
621
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
622
622
|
session: {
|
|
623
623
|
user: UserWithRole;
|
|
624
|
-
session: Session;
|
|
624
|
+
session: Session$1;
|
|
625
625
|
};
|
|
626
626
|
}>)[];
|
|
627
627
|
metadata: {
|
|
@@ -668,15 +668,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
668
668
|
*
|
|
669
669
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-impersonate-user)
|
|
670
670
|
*/
|
|
671
|
-
impersonateUser:
|
|
671
|
+
impersonateUser: better_call622.StrictEndpoint<"/admin/impersonate-user", {
|
|
672
672
|
method: "POST";
|
|
673
673
|
body: z.ZodObject<{
|
|
674
674
|
userId: z.ZodCoercedString<unknown>;
|
|
675
675
|
}, z.core.$strip>;
|
|
676
|
-
use: ((inputContext:
|
|
676
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
677
677
|
session: {
|
|
678
678
|
user: UserWithRole;
|
|
679
|
-
session: Session;
|
|
679
|
+
session: Session$1;
|
|
680
680
|
};
|
|
681
681
|
}>)[];
|
|
682
682
|
metadata: {
|
|
@@ -744,14 +744,14 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
744
744
|
*
|
|
745
745
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-stop-impersonating)
|
|
746
746
|
*/
|
|
747
|
-
stopImpersonating:
|
|
747
|
+
stopImpersonating: better_call622.StrictEndpoint<"/admin/stop-impersonating", {
|
|
748
748
|
method: "POST";
|
|
749
749
|
requireHeaders: true;
|
|
750
750
|
} & {
|
|
751
751
|
use: any[];
|
|
752
752
|
}, {
|
|
753
|
-
session: Session & Record<string, any>;
|
|
754
|
-
user: User
|
|
753
|
+
session: Session$1 & Record<string, any>;
|
|
754
|
+
user: _better_auth_core_db6.User & Record<string, any>;
|
|
755
755
|
}>;
|
|
756
756
|
/**
|
|
757
757
|
* ### Endpoint
|
|
@@ -768,15 +768,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
768
768
|
*
|
|
769
769
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-revoke-user-session)
|
|
770
770
|
*/
|
|
771
|
-
revokeUserSession:
|
|
771
|
+
revokeUserSession: better_call622.StrictEndpoint<"/admin/revoke-user-session", {
|
|
772
772
|
method: "POST";
|
|
773
773
|
body: z.ZodObject<{
|
|
774
774
|
sessionToken: z.ZodString;
|
|
775
775
|
}, z.core.$strip>;
|
|
776
|
-
use: ((inputContext:
|
|
776
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
777
777
|
session: {
|
|
778
778
|
user: UserWithRole;
|
|
779
|
-
session: Session;
|
|
779
|
+
session: Session$1;
|
|
780
780
|
};
|
|
781
781
|
}>)[];
|
|
782
782
|
metadata: {
|
|
@@ -823,15 +823,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
823
823
|
*
|
|
824
824
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-revoke-user-sessions)
|
|
825
825
|
*/
|
|
826
|
-
revokeUserSessions:
|
|
826
|
+
revokeUserSessions: better_call622.StrictEndpoint<"/admin/revoke-user-sessions", {
|
|
827
827
|
method: "POST";
|
|
828
828
|
body: z.ZodObject<{
|
|
829
829
|
userId: z.ZodCoercedString<unknown>;
|
|
830
830
|
}, z.core.$strip>;
|
|
831
|
-
use: ((inputContext:
|
|
831
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
832
832
|
session: {
|
|
833
833
|
user: UserWithRole;
|
|
834
|
-
session: Session;
|
|
834
|
+
session: Session$1;
|
|
835
835
|
};
|
|
836
836
|
}>)[];
|
|
837
837
|
metadata: {
|
|
@@ -878,15 +878,15 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
878
878
|
*
|
|
879
879
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-remove-user)
|
|
880
880
|
*/
|
|
881
|
-
removeUser:
|
|
881
|
+
removeUser: better_call622.StrictEndpoint<"/admin/remove-user", {
|
|
882
882
|
method: "POST";
|
|
883
883
|
body: z.ZodObject<{
|
|
884
884
|
userId: z.ZodCoercedString<unknown>;
|
|
885
885
|
}, z.core.$strip>;
|
|
886
|
-
use: ((inputContext:
|
|
886
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
887
887
|
session: {
|
|
888
888
|
user: UserWithRole;
|
|
889
|
-
session: Session;
|
|
889
|
+
session: Session$1;
|
|
890
890
|
};
|
|
891
891
|
}>)[];
|
|
892
892
|
metadata: {
|
|
@@ -933,16 +933,16 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
933
933
|
*
|
|
934
934
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-set-user-password)
|
|
935
935
|
*/
|
|
936
|
-
setUserPassword:
|
|
936
|
+
setUserPassword: better_call622.StrictEndpoint<"/admin/set-user-password", {
|
|
937
937
|
method: "POST";
|
|
938
938
|
body: z.ZodObject<{
|
|
939
939
|
newPassword: z.ZodString;
|
|
940
940
|
userId: z.ZodCoercedString<unknown>;
|
|
941
941
|
}, z.core.$strip>;
|
|
942
|
-
use: ((inputContext:
|
|
942
|
+
use: ((inputContext: better_call622.MiddlewareInputContext<better_call622.MiddlewareOptions>) => Promise<{
|
|
943
943
|
session: {
|
|
944
944
|
user: UserWithRole;
|
|
945
|
-
session: Session;
|
|
945
|
+
session: Session$1;
|
|
946
946
|
};
|
|
947
947
|
}>)[];
|
|
948
948
|
metadata: {
|
|
@@ -989,7 +989,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
989
989
|
*
|
|
990
990
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-has-permission)
|
|
991
991
|
*/
|
|
992
|
-
userHasPermission:
|
|
992
|
+
userHasPermission: better_call622.StrictEndpoint<"/admin/has-permission", {
|
|
993
993
|
method: "POST";
|
|
994
994
|
body: z.ZodIntersection<z.ZodObject<{
|
|
995
995
|
userId: z.ZodOptional<z.ZodCoercedString<unknown>>;
|
|
@@ -1062,7 +1062,7 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
1062
1062
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password", "get", "update"];
|
|
1063
1063
|
readonly session: readonly ["list", "revoke", "delete"];
|
|
1064
1064
|
})[key][number] : never)[] | undefined };
|
|
1065
|
-
permissions?: never;
|
|
1065
|
+
permissions?: never | undefined;
|
|
1066
1066
|
} | {
|
|
1067
1067
|
permissions: { [key in keyof (O["ac"] extends AccessControl<infer S extends Statements> ? S : {
|
|
1068
1068
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password", "get", "update"];
|
|
@@ -1074,10 +1074,10 @@ declare const admin: <O extends AdminOptions>(options?: O) => {
|
|
|
1074
1074
|
readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "delete", "set-password", "get", "update"];
|
|
1075
1075
|
readonly session: readonly ["list", "revoke", "delete"];
|
|
1076
1076
|
})[key][number] : never)[] | undefined };
|
|
1077
|
-
permission?: never;
|
|
1077
|
+
permission?: never | undefined;
|
|
1078
1078
|
}) & {
|
|
1079
|
-
userId?: string;
|
|
1080
|
-
role?: InferAdminRolesFromOption<O
|
|
1079
|
+
userId?: string | undefined;
|
|
1080
|
+
role?: InferAdminRolesFromOption<O> | undefined;
|
|
1081
1081
|
};
|
|
1082
1082
|
};
|
|
1083
1083
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as APIError } from "./api-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as getSessionFromCtx } from "./session-
|
|
5
|
-
import { t as getEndpointResponse } from "./plugin-helper-
|
|
6
|
-
import { t as hasPermission } from "./has-permission-
|
|
1
|
+
import { t as APIError } from "./api-6Gh-v8xm.js";
|
|
2
|
+
import { c as setSessionCookie, n as deleteSessionCookie } from "./cookies-CBcV_aA7.js";
|
|
3
|
+
import { n as mergeSchema, t as getDate, u as parseUserOutput } from "./date-BPjINFle.js";
|
|
4
|
+
import { r as getSessionFromCtx } from "./session-1slmMotZ.js";
|
|
5
|
+
import { t as getEndpointResponse } from "./plugin-helper-CGhaPhDN.js";
|
|
6
|
+
import { t as hasPermission } from "./has-permission-D4Cw2FMS.js";
|
|
7
7
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
8
8
|
import { defineErrorCodes } from "@better-auth/core/utils";
|
|
9
9
|
import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
|
|
@@ -238,9 +238,11 @@ const admin = (options) => {
|
|
|
238
238
|
permissions: { user: ["create"] }
|
|
239
239
|
})) throw new APIError("FORBIDDEN", { message: ADMIN_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS });
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
const email = ctx.body.email.toLowerCase();
|
|
242
|
+
if (!z$1.string().email().safeParse(email).success) throw new APIError("BAD_REQUEST", { message: BASE_ERROR_CODES.INVALID_EMAIL });
|
|
243
|
+
if (await ctx.context.internalAdapter.findUserByEmail(email)) throw new APIError("BAD_REQUEST", { message: ADMIN_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL });
|
|
242
244
|
const user = await ctx.context.internalAdapter.createUser({
|
|
243
|
-
email
|
|
245
|
+
email,
|
|
244
246
|
name: ctx.body.name,
|
|
245
247
|
role: (ctx.body.role && parseRoles(ctx.body.role)) ?? options?.defaultRole ?? "user",
|
|
246
248
|
...ctx.body.data
|