better-auth 1.0.3 → 1.0.4
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.cjs +1 -1
- package/dist/adapters/drizzle.d.cts +1 -1
- package/dist/adapters/drizzle.d.ts +1 -1
- package/dist/adapters/drizzle.js +1 -1
- package/dist/adapters/kysely.d.cts +1 -1
- package/dist/adapters/kysely.d.ts +1 -1
- package/dist/adapters/memory.d.cts +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/adapters/mongodb.d.cts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/prisma.d.cts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/{auth-DF-f5DGM.d.ts → auth-BXAJa4bS.d.ts} +12 -0
- package/dist/{auth-BubrmklB.d.cts → auth-JcgLy3mH.d.cts} +12 -0
- package/dist/client/plugins.d.cts +3 -3
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/cookies.d.cts +1 -1
- package/dist/cookies.d.ts +1 -1
- package/dist/db.d.cts +2 -2
- package/dist/db.d.ts +2 -2
- package/dist/{index-CwnHFdnT.d.cts → index-B3tboD6m.d.cts} +1 -1
- package/dist/{index-aMRluDla.d.ts → index-Bn2pZ0pb.d.ts} +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/next-js.d.cts +1 -1
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/oauth2.d.cts +2 -2
- package/dist/oauth2.d.ts +2 -2
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +3 -3
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/solid-start.d.cts +1 -1
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.cts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/{state-CQJXHclh.d.cts → state-CMDbIivR.d.cts} +1 -1
- package/dist/{state-C_runTlH.d.ts → state-MOcw4xXw.d.ts} +1 -1
- package/dist/svelte-kit.d.cts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.cts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.cts +1 -1
- package/dist/vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var F=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var P=(e,i)=>{for(var u in i)F(e,u,{get:i[u],enumerable:!0})},_=(e,i,u,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of V(i))!E.call(e,l)&&l!==u&&F(e,l,{get:()=>i[l],enumerable:!(f=M(i,l))||f.enumerable});return e};var C=e=>_(F({},"__esModule",{value:!0}),e);var te={};P(te,{drizzleAdapter:()=>ee});module.exports=C(te);var p=require("drizzle-orm");var s=require("zod"),ae=s.z.object({id:s.z.string(),providerId:s.z.string(),accountId:s.z.string(),userId:s.z.string(),accessToken:s.z.string().nullish(),refreshToken:s.z.string().nullish(),idToken:s.z.string().nullish(),accessTokenExpiresAt:s.z.date().nullish(),refreshTokenExpiresAt:s.z.date().nullish(),scope:s.z.string().nullish(),password:s.z.string().nullish(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date)}),oe=s.z.object({id:s.z.string(),email:s.z.string().transform(e=>e.toLowerCase()),emailVerified:s.z.boolean().default(!1),name:s.z.string(),image:s.z.string().nullish(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date)}),de=s.z.object({id:s.z.string(),userId:s.z.string(),expiresAt:s.z.date(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date),token:s.z.string(),ipAddress:s.z.string().nullish(),userAgent:s.z.string().nullish()}),ue=s.z.object({id:s.z.string(),value:s.z.string(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date),expiresAt:s.z.date(),identifier:s.z.string()});var R=Object.create(null),T=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?R:globalThis),D=new Proxy(R,{get(e,i){return T()[i]??R[i]},has(e,i){let u=T();return i in u||i in R},set(e,i,u){let f=T(!0);return f[i]=u,!0},deleteProperty(e,i){if(!i)return!1;let u=T(!0);return delete u[i],!0},ownKeys(){let e=T(!0);return Object.keys(e)}});function j(e){return e?e!=="false":!1}var $=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";var K=$==="test"||j(D.TEST);var N=require("nanoid"),k=e=>(0,N.nanoid)(e);var q=require("oslo/oauth2"),z=require("zod"),W=require("better-call");var w=class extends Error{constructor(i,u){super(i),this.name="BetterAuthError",this.message=i,this.cause=u,this.stack=""}};var S=require("consola"),O=["info","success","warn","error","debug"];function H(e,i){return O.indexOf(i)<=O.indexOf(e)}var J=(0,S.createConsola)({formatOptions:{date:!1,colors:!0,compact:!0},defaults:{tag:"Better Auth"}}),B=e=>{let i=e?.disabled!==!0,u=e?.level??"error",f=(l,g,y=[])=>{if(!(!i||!H(u,l))){if(!e||typeof e.log!="function"){J[l]("",g,...y);return}e.log(l==="success"?"info":l,g,y)}};return Object.fromEntries(O.map(l=>[l,(...[g,...y])=>f(l,g,y)]))},G=B();var v=e=>{let i=e.plugins?.reduce((a,c)=>{let n=c.schema;if(!n)return a;for(let[t,o]of Object.entries(n))a[t]={fields:{...a[t]?.fields,...o.fields},modelName:o.modelName||t};return a},{}),u=e.rateLimit?.storage==="database",f={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest"}}}},{user:l,session:g,account:y,...x}=i||{};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name"},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email"},emailVerified:{type:"boolean",defaultValue:()=>!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified"},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...l?.fields,...e.user?.additionalFields},order:1},session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt"},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0},...g?.fields,...e.session?.additionalFields},order:2},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId"},accessToken:{type:"string",required:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt"},...y?.fields},order:3},verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier"},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"}},order:4},...x,...u?f:{}}};var Q=require("zod");var U=require("kysely"),I=require("kysely");var X=(e,i,u)=>{let f=v(u);function l(a,c){return c==="id"?c:f[a].fields[c].fieldName||c}function g(a){let c=i.schema||e._.fullSchema;if(!c)throw new w("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");let n=y(a),t=c[n];if(!t)throw new w(`[# Drizzle Adapter]: The model "${n}" was not found in the schema object. Please pass the schema directly to the adapter options.`);return t}let y=a=>f[a].modelName!==a?f[a].modelName:i.usePlural?`${a}s`:a,x=u?.advanced?.generateId===!1;return{getSchema:g,transformInput(a,c,n){let t=x||n==="update"?{}:{id:a.id||(u.advanced?.generateId?u.advanced.generateId({model:c}):k())};for(let o in a){let d=f[c].fields[o];d&&(t[d.fieldName||o]=a[o])}return t},transformOutput(a,c,n=[]){if(!a)return null;let t=a.id||a._id?n.length===0||n.includes("id")?{id:a.id}:{}:{},o=f[c].fields;for(let d in o){if(n.length&&!n.includes(d))continue;let m=o[d];m&&(t[d]=a[m.fieldName||d])}return t},convertWhereClause(a,c){let n=g(c);if(!a)return[];if(a.length===1){let r=a[0];if(!r)return[];let h=l(c,r.field);if(!n[h])throw new w(`The field "${r.field}" does not exist in the schema for the model "${c}". Please update your schema.`);if(r.operator==="in"){if(!Array.isArray(r.value))throw new w(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return[(0,p.inArray)(n[h],r.value)]}return r.operator==="contains"?[(0,p.like)(n[h],`%${r.value}%`)]:r.operator==="starts_with"?[(0,p.like)(n[h],`${r.value}%`)]:r.operator==="ends_with"?[(0,p.like)(n[h],`%${r.value}`)]:[(0,p.eq)(n[h],r.value)]}let t=a.filter(r=>r.connector==="AND"||!r.connector),o=a.filter(r=>r.connector==="OR"),d=(0,p.and)(...t.map(r=>{let h=l(c,r.field);if(r.operator==="in"){if(!Array.isArray(r.value))throw new w(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return(0,p.inArray)(n[h],r.value)}return(0,p.eq)(n[h],r.value)})),m=(0,p.or)(...o.map(r=>{let h=l(c,r.field);return(0,p.eq)(n[h],r.value)})),A=[];return t.length&&A.push(d),o.length&&A.push(m),A},withReturning:async(a,c,n)=>{if(i.provider!=="mysql")return(await c.returning())[0];await c;let t=g(y(a));return(await e.select().from(t).where((0,p.eq)(t.id,n.id)))[0]},getField:l,getModelName:y}};function Y(e,i,u){if(!e)throw new w("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");for(let f in u)if(!e[f])throw new w(`The field "${f}" does not exist in the "${i}" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".`)}var ee=(e,i)=>u=>{let{transformInput:f,transformOutput:l,convertWhereClause:g,getSchema:y,withReturning:x,getField:a,getModelName:c}=X(e,i,u);return{id:"drizzle",async create(n){let{model:t,data:o}=n,d=f(o,t,"create"),m=y(t);Y(m,c(t),d);let A=e.insert(m).values(d),r=await x(t,A,d);return l(r,t)},async findOne(n){let{model:t,where:o,select:d}=n,m=y(t),A=g(o,t),r=await e.select().from(m).where(...A);return r.length?l(r[0],t,d):null},async findMany(n){let{model:t,where:o,sortBy:d,limit:m,offset:A}=n,r=y(t),h=o?g(o,t):[],b=d?.direction==="desc"?p.desc:p.asc;return(await e.select().from(r).limit(m||100).offset(A||0).orderBy(b(r[d?.field?a(t,d?.field):"id"])).where(...h)).map(L=>l(L,t))},async update(n){let{model:t,where:o,update:d}=n,m=y(t),A=g(o,t),r=f(d,t,"update"),h=e.update(m).set(r).where(...A),b=await x(t,h,r);return l(b,t)},async updateMany(n){let{model:t,where:o,update:d}=n,m=y(t),A=g(o,t),r=f(d,t,"update"),b=await e.update(m).set(r).where(...A);return b?b.changes:0},async delete(n){let{model:t,where:o}=n,d=y(t),m=g(o,t);await e.delete(d).where(...m)},async deleteMany(n){let{model:t,where:o}=n,d=y(t),m=g(o,t),r=await e.delete(d).where(...m);return r?r.length:0},options:i}};0&&(module.exports={drizzleAdapter});
|
|
1
|
+
"use strict";var F=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var _=(e,i)=>{for(var u in i)F(e,u,{get:i[u],enumerable:!0})},C=(e,i,u,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of E(i))!P.call(e,l)&&l!==u&&F(e,l,{get:()=>i[l],enumerable:!(f=V(i,l))||f.enumerable});return e};var j=e=>C(F({},"__esModule",{value:!0}),e);var re={};_(re,{drizzleAdapter:()=>te});module.exports=j(re);var p=require("drizzle-orm");var s=require("zod"),ae=s.z.object({id:s.z.string(),providerId:s.z.string(),accountId:s.z.string(),userId:s.z.string(),accessToken:s.z.string().nullish(),refreshToken:s.z.string().nullish(),idToken:s.z.string().nullish(),accessTokenExpiresAt:s.z.date().nullish(),refreshTokenExpiresAt:s.z.date().nullish(),scope:s.z.string().nullish(),password:s.z.string().nullish(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date)}),oe=s.z.object({id:s.z.string(),email:s.z.string().transform(e=>e.toLowerCase()),emailVerified:s.z.boolean().default(!1),name:s.z.string(),image:s.z.string().nullish(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date)}),de=s.z.object({id:s.z.string(),userId:s.z.string(),expiresAt:s.z.date(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date),token:s.z.string(),ipAddress:s.z.string().nullish(),userAgent:s.z.string().nullish()}),ue=s.z.object({id:s.z.string(),value:s.z.string(),createdAt:s.z.date().default(()=>new Date),updatedAt:s.z.date().default(()=>new Date),expiresAt:s.z.date(),identifier:s.z.string()});var R=Object.create(null),T=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?R:globalThis),N=new Proxy(R,{get(e,i){return T()[i]??R[i]},has(e,i){let u=T();return i in u||i in R},set(e,i,u){let f=T(!0);return f[i]=u,!0},deleteProperty(e,i){if(!i)return!1;let u=T(!0);return delete u[i],!0},ownKeys(){let e=T(!0);return Object.keys(e)}});function $(e){return e?e!=="false":!1}var K=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";var z=K==="test"||$(N.TEST);var q=require("nanoid"),k=e=>(0,q.nanoid)(e);var S=require("oslo/oauth2"),W=require("zod"),H=require("better-call");var w=class extends Error{constructor(i,u){super(i),this.name="BetterAuthError",this.message=i,this.cause=u,this.stack=""}};var B=require("consola"),O=["info","success","warn","error","debug"];function J(e,i){return O.indexOf(i)<=O.indexOf(e)}var G=(0,B.createConsola)({formatOptions:{date:!1,colors:!0,compact:!0},defaults:{tag:"Better Auth"}}),U=e=>{let i=e?.disabled!==!0,u=e?.level??"error",f=(l,g,y=[])=>{if(!(!i||!J(u,l))){if(!e||typeof e.log!="function"){G[l]("",g,...y);return}e.log(l==="success"?"info":l,g,y)}};return Object.fromEntries(O.map(l=>[l,(...[g,...y])=>f(l,g,y)]))},Q=U();var v=e=>{let i=e.plugins?.reduce((a,c)=>{let n=c.schema;if(!n)return a;for(let[t,o]of Object.entries(n))a[t]={fields:{...a[t]?.fields,...o.fields},modelName:o.modelName||t};return a},{}),u=e.rateLimit?.storage==="database",f={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest"}}}},{user:l,session:g,account:y,...x}=i||{};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name"},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email"},emailVerified:{type:"boolean",defaultValue:()=>!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified"},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...l?.fields,...e.user?.additionalFields},order:1},session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt"},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0},...g?.fields,...e.session?.additionalFields},order:2},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId"},accessToken:{type:"string",required:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt"},...y?.fields},order:3},verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier"},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"}},order:4},...x,...u?f:{}}};var Z=require("zod");var L=require("kysely"),I=require("kysely");var Y=(e,i,u)=>{let f=v(u);function l(a,c){return c==="id"?c:f[a].fields[c].fieldName||c}function g(a){let c=i.schema||e._.fullSchema;if(!c)throw new w("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");let n=y(a),t=c[n];if(!t)throw new w(`[# Drizzle Adapter]: The model "${n}" was not found in the schema object. Please pass the schema directly to the adapter options.`);return t}let y=a=>f[a].modelName!==a?f[a].modelName:i.usePlural?`${a}s`:a,x=u?.advanced?.generateId===!1;return{getSchema:g,transformInput(a,c,n){let t=x||n==="update"?{}:{id:a.id||(u.advanced?.generateId?u.advanced.generateId({model:c}):k())};for(let o in a){let d=f[c].fields[o];d&&(t[d.fieldName||o]=a[o])}return t},transformOutput(a,c,n=[]){if(!a)return null;let t=a.id||a._id?n.length===0||n.includes("id")?{id:a.id}:{}:{},o=f[c].fields;for(let d in o){if(n.length&&!n.includes(d))continue;let m=o[d];m&&(t[d]=a[m.fieldName||d])}return t},convertWhereClause(a,c){let n=g(c);if(!a)return[];if(a.length===1){let r=a[0];if(!r)return[];let h=l(c,r.field);if(!n[h])throw new w(`The field "${r.field}" does not exist in the schema for the model "${c}". Please update your schema.`);if(r.operator==="in"){if(!Array.isArray(r.value))throw new w(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return[(0,p.inArray)(n[h],r.value)]}return r.operator==="contains"?[(0,p.like)(n[h],`%${r.value}%`)]:r.operator==="starts_with"?[(0,p.like)(n[h],`${r.value}%`)]:r.operator==="ends_with"?[(0,p.like)(n[h],`%${r.value}`)]:[(0,p.eq)(n[h],r.value)]}let t=a.filter(r=>r.connector==="AND"||!r.connector),o=a.filter(r=>r.connector==="OR"),d=(0,p.and)(...t.map(r=>{let h=l(c,r.field);if(r.operator==="in"){if(!Array.isArray(r.value))throw new w(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return(0,p.inArray)(n[h],r.value)}return(0,p.eq)(n[h],r.value)})),m=(0,p.or)(...o.map(r=>{let h=l(c,r.field);return(0,p.eq)(n[h],r.value)})),A=[];return t.length&&A.push(d),o.length&&A.push(m),A},withReturning:async(a,c,n)=>{if(i.provider!=="mysql")return(await c.returning())[0];await c;let t=g(y(a));return(await e.select().from(t).where((0,p.eq)(t.id,n.id)))[0]},getField:l,getModelName:y}};function ee(e,i,u){if(!e)throw new w("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");for(let f in u)if(!e[f])throw new w(`The field "${f}" does not exist in the "${i}" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".`)}var te=(e,i)=>u=>{let{transformInput:f,transformOutput:l,convertWhereClause:g,getSchema:y,withReturning:x,getField:a,getModelName:c}=Y(e,i,u);return{id:"drizzle",async create(n){let{model:t,data:o}=n,d=f(o,t,"create"),m=y(t);ee(m,c(t),d);let A=e.insert(m).values(d),r=await x(t,A,d);return l(r,t)},async findOne(n){let{model:t,where:o,select:d}=n,m=y(t),A=g(o,t),r=await e.select().from(m).where(...A);return r.length?l(r[0],t,d):null},async findMany(n){let{model:t,where:o,sortBy:d,limit:m,offset:A}=n,r=y(t),h=o?g(o,t):[],b=d?.direction==="desc"?p.desc:p.asc,D=e.select().from(r).limit(m||100).offset(A||0);return d?.field&&D.orderBy(b(r[a(t,d?.field)])),(await D.where(...h)).map(M=>l(M,t))},async update(n){let{model:t,where:o,update:d}=n,m=y(t),A=g(o,t),r=f(d,t,"update"),h=e.update(m).set(r).where(...A),b=await x(t,h,r);return l(b,t)},async updateMany(n){let{model:t,where:o,update:d}=n,m=y(t),A=g(o,t),r=f(d,t,"update"),b=await e.update(m).set(r).where(...A);return b?b.changes:0},async delete(n){let{model:t,where:o}=n,d=y(t),m=g(o,t);await e.delete(d).where(...m)},async deleteMany(n){let{model:t,where:o}=n,d=y(t),m=g(o,t),r=await e.delete(d).where(...m);return r?r.length:0},options:i}};0&&(module.exports={drizzleAdapter});
|
package/dist/adapters/drizzle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{and as C,asc as j,desc as $,eq as R,inArray as N,like as O,or as K}from"drizzle-orm";import{z as s}from"zod";var Z=s.object({id:s.string(),providerId:s.string(),accountId:s.string(),userId:s.string(),accessToken:s.string().nullish(),refreshToken:s.string().nullish(),idToken:s.string().nullish(),accessTokenExpiresAt:s.date().nullish(),refreshTokenExpiresAt:s.date().nullish(),scope:s.string().nullish(),password:s.string().nullish(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date)}),X=s.object({id:s.string(),email:s.string().transform(e=>e.toLowerCase()),emailVerified:s.boolean().default(!1),name:s.string(),image:s.string().nullish(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date)}),Y=s.object({id:s.string(),userId:s.string(),expiresAt:s.date(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date),token:s.string(),ipAddress:s.string().nullish(),userAgent:s.string().nullish()}),ee=s.object({id:s.string(),value:s.string(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date),expiresAt:s.date(),identifier:s.string()});var k=Object.create(null),v=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?k:globalThis),I=new Proxy(k,{get(e,a){return v()[a]??k[a]},has(e,a){let l=v();return a in l||a in k},set(e,a,l){let p=v(!0);return p[a]=l,!0},deleteProperty(e,a){if(!a)return!1;let l=v(!0);return delete l[a],!0},ownKeys(){let e=v(!0);return Object.keys(e)}});function S(e){return e?e!=="false":!1}var B=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";var U=B==="test"||S(I.TEST);import{nanoid as L}from"nanoid";var T=e=>L(e);import{generateCodeVerifier as he,generateState as Ae}from"oslo/oauth2";import{z as xe}from"zod";import{APIError as ve}from"better-call";var A=class extends Error{constructor(a,l){super(a),this.name="BetterAuthError",this.message=a,this.cause=l,this.stack=""}};import{createConsola as M}from"consola";var F=["info","success","warn","error","debug"];function V(e,a){return F.indexOf(a)<=F.indexOf(e)}var E=M({formatOptions:{date:!1,colors:!0,compact:!0},defaults:{tag:"Better Auth"}}),D=e=>{let a=e?.disabled!==!0,l=e?.level??"error",p=(c,y,m=[])=>{if(!(!a||!V(l,c))){if(!e||typeof e.log!="function"){E[c]("",y,...m);return}e.log(c==="success"?"info":c,y,m)}};return Object.fromEntries(F.map(c=>[c,(...[y,...m])=>p(c,y,m)]))},P=D();var b=e=>{let a=e.plugins?.reduce((i,u)=>{let n=u.schema;if(!n)return i;for(let[t,o]of Object.entries(n))i[t]={fields:{...i[t]?.fields,...o.fields},modelName:o.modelName||t};return i},{}),l=e.rateLimit?.storage==="database",p={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest"}}}},{user:c,session:y,account:m,...w}=a||{};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name"},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email"},emailVerified:{type:"boolean",defaultValue:()=>!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified"},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...c?.fields,...e.user?.additionalFields},order:1},session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt"},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0},...y?.fields,...e.session?.additionalFields},order:2},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId"},accessToken:{type:"string",required:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt"},...m?.fields},order:3},verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier"},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"}},order:4},...w,...l?p:{}}};import{z as Qe}from"zod";import{Kysely as Ye,MssqlDialect as et}from"kysely";import{MysqlDialect as rt,PostgresDialect as nt,SqliteDialect as st}from"kysely";var z=(e,a,l)=>{let p=b(l);function c(i,u){return u==="id"?u:p[i].fields[u].fieldName||u}function y(i){let u=a.schema||e._.fullSchema;if(!u)throw new A("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");let n=m(i),t=u[n];if(!t)throw new A(`[# Drizzle Adapter]: The model "${n}" was not found in the schema object. Please pass the schema directly to the adapter options.`);return t}let m=i=>p[i].modelName!==i?p[i].modelName:a.usePlural?`${i}s`:i,w=l?.advanced?.generateId===!1;return{getSchema:y,transformInput(i,u,n){let t=w||n==="update"?{}:{id:i.id||(l.advanced?.generateId?l.advanced.generateId({model:u}):T())};for(let o in i){let d=p[u].fields[o];d&&(t[d.fieldName||o]=i[o])}return t},transformOutput(i,u,n=[]){if(!i)return null;let t=i.id||i._id?n.length===0||n.includes("id")?{id:i.id}:{}:{},o=p[u].fields;for(let d in o){if(n.length&&!n.includes(d))continue;let f=o[d];f&&(t[d]=i[f.fieldName||d])}return t},convertWhereClause(i,u){let n=y(u);if(!i)return[];if(i.length===1){let r=i[0];if(!r)return[];let g=c(u,r.field);if(!n[g])throw new A(`The field "${r.field}" does not exist in the schema for the model "${u}". Please update your schema.`);if(r.operator==="in"){if(!Array.isArray(r.value))throw new A(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return[N(n[g],r.value)]}return r.operator==="contains"?[O(n[g],`%${r.value}%`)]:r.operator==="starts_with"?[O(n[g],`${r.value}%`)]:r.operator==="ends_with"?[O(n[g],`%${r.value}`)]:[R(n[g],r.value)]}let t=i.filter(r=>r.connector==="AND"||!r.connector),o=i.filter(r=>r.connector==="OR"),d=C(...t.map(r=>{let g=c(u,r.field);if(r.operator==="in"){if(!Array.isArray(r.value))throw new A(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return N(n[g],r.value)}return R(n[g],r.value)})),f=K(...o.map(r=>{let g=c(u,r.field);return R(n[g],r.value)})),h=[];return t.length&&h.push(d),o.length&&h.push(f),h},withReturning:async(i,u,n)=>{if(a.provider!=="mysql")return(await u.returning())[0];await u;let t=y(m(i));return(await e.select().from(t).where(R(t.id,n.id)))[0]},getField:c,getModelName:m}};function W(e,a,l){if(!e)throw new A("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");for(let p in l)if(!e[p])throw new A(`The field "${p}" does not exist in the "${a}" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".`)}var Jt=(e,a)=>l=>{let{transformInput:p,transformOutput:c,convertWhereClause:y,getSchema:m,withReturning:w,getField:i,getModelName:u}=z(e,a,l);return{id:"drizzle",async create(n){let{model:t,data:o}=n,d=p(o,t,"create"),f=m(t);W(f,u(t),d);let h=e.insert(f).values(d),r=await w(t,h,d);return c(r,t)},async findOne(n){let{model:t,where:o,select:d}=n,f=m(t),h=y(o,t),r=await e.select().from(f).where(...h);return r.length?c(r[0],t,d):null},async findMany(n){let{model:t,where:o,sortBy:d,limit:f,offset:h}=n,r=m(t),g=o?y(o,t):[],x=d?.direction==="desc"?$:j;return(await e.select().from(r).limit(f||100).offset(h||0).orderBy(x(r[d?.field?i(t,d?.field):"id"])).where(...g)).map(q=>c(q,t))},async update(n){let{model:t,where:o,update:d}=n,f=m(t),h=y(o,t),r=p(d,t,"update"),g=e.update(f).set(r).where(...h),x=await w(t,g,r);return c(x,t)},async updateMany(n){let{model:t,where:o,update:d}=n,f=m(t),h=y(o,t),r=p(d,t,"update"),x=await e.update(f).set(r).where(...h);return x?x.changes:0},async delete(n){let{model:t,where:o}=n,d=m(t),f=y(o,t);await e.delete(d).where(...f)},async deleteMany(n){let{model:t,where:o}=n,d=m(t),f=y(o,t),r=await e.delete(d).where(...f);return r?r.length:0},options:a}};export{Jt as drizzleAdapter};
|
|
1
|
+
import{and as j,asc as $,desc as K,eq as R,inArray as q,like as O,or as z}from"drizzle-orm";import{z as s}from"zod";var Z=s.object({id:s.string(),providerId:s.string(),accountId:s.string(),userId:s.string(),accessToken:s.string().nullish(),refreshToken:s.string().nullish(),idToken:s.string().nullish(),accessTokenExpiresAt:s.date().nullish(),refreshTokenExpiresAt:s.date().nullish(),scope:s.string().nullish(),password:s.string().nullish(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date)}),X=s.object({id:s.string(),email:s.string().transform(e=>e.toLowerCase()),emailVerified:s.boolean().default(!1),name:s.string(),image:s.string().nullish(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date)}),Y=s.object({id:s.string(),userId:s.string(),expiresAt:s.date(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date),token:s.string(),ipAddress:s.string().nullish(),userAgent:s.string().nullish()}),ee=s.object({id:s.string(),value:s.string(),createdAt:s.date().default(()=>new Date),updatedAt:s.date().default(()=>new Date),expiresAt:s.date(),identifier:s.string()});var k=Object.create(null),v=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?k:globalThis),D=new Proxy(k,{get(e,a){return v()[a]??k[a]},has(e,a){let l=v();return a in l||a in k},set(e,a,l){let p=v(!0);return p[a]=l,!0},deleteProperty(e,a){if(!a)return!1;let l=v(!0);return delete l[a],!0},ownKeys(){let e=v(!0);return Object.keys(e)}});function B(e){return e?e!=="false":!1}var U=typeof process<"u"&&process.env&&process.env.NODE_ENV||"";var L=U==="test"||B(D.TEST);import{nanoid as M}from"nanoid";var T=e=>M(e);import{generateCodeVerifier as he,generateState as Ae}from"oslo/oauth2";import{z as xe}from"zod";import{APIError as ve}from"better-call";var A=class extends Error{constructor(a,l){super(a),this.name="BetterAuthError",this.message=a,this.cause=l,this.stack=""}};import{createConsola as V}from"consola";var F=["info","success","warn","error","debug"];function E(e,a){return F.indexOf(a)<=F.indexOf(e)}var P=V({formatOptions:{date:!1,colors:!0,compact:!0},defaults:{tag:"Better Auth"}}),N=e=>{let a=e?.disabled!==!0,l=e?.level??"error",p=(c,y,m=[])=>{if(!(!a||!E(l,c))){if(!e||typeof e.log!="function"){P[c]("",y,...m);return}e.log(c==="success"?"info":c,y,m)}};return Object.fromEntries(F.map(c=>[c,(...[y,...m])=>p(c,y,m)]))},_=N();var b=e=>{let a=e.plugins?.reduce((i,u)=>{let n=u.schema;if(!n)return i;for(let[t,o]of Object.entries(n))i[t]={fields:{...i[t]?.fields,...o.fields},modelName:o.modelName||t};return i},{}),l=e.rateLimit?.storage==="database",p={rateLimit:{modelName:e.rateLimit?.modelName||"rateLimit",fields:{key:{type:"string",fieldName:e.rateLimit?.fields?.key||"key"},count:{type:"number",fieldName:e.rateLimit?.fields?.count||"count"},lastRequest:{type:"number",fieldName:e.rateLimit?.fields?.lastRequest||"lastRequest"}}}},{user:c,session:y,account:m,...w}=a||{};return{user:{modelName:e.user?.modelName||"user",fields:{name:{type:"string",required:!0,fieldName:e.user?.fields?.name||"name"},email:{type:"string",unique:!0,required:!0,fieldName:e.user?.fields?.email||"email"},emailVerified:{type:"boolean",defaultValue:()=>!1,required:!0,fieldName:e.user?.fields?.emailVerified||"emailVerified"},image:{type:"string",required:!1,fieldName:e.user?.fields?.image||"image"},createdAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",defaultValue:()=>new Date,required:!0,fieldName:e.user?.fields?.updatedAt||"updatedAt"},...c?.fields,...e.user?.additionalFields},order:1},session:{modelName:e.session?.modelName||"session",fields:{expiresAt:{type:"date",required:!0,fieldName:e.session?.fields?.expiresAt||"expiresAt"},token:{type:"string",required:!0,fieldName:e.session?.fields?.token||"token",unique:!0},createdAt:{type:"date",required:!0,fieldName:e.session?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.session?.fields?.updatedAt||"updatedAt"},ipAddress:{type:"string",required:!1,fieldName:e.session?.fields?.ipAddress||"ipAddress"},userAgent:{type:"string",required:!1,fieldName:e.session?.fields?.userAgent||"userAgent"},userId:{type:"string",fieldName:e.session?.fields?.userId||"userId",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0},...y?.fields,...e.session?.additionalFields},order:2},account:{modelName:e.account?.modelName||"account",fields:{accountId:{type:"string",required:!0,fieldName:e.account?.fields?.accountId||"accountId"},providerId:{type:"string",required:!0,fieldName:e.account?.fields?.providerId||"providerId"},userId:{type:"string",references:{model:e.user?.modelName||"user",field:"id",onDelete:"cascade"},required:!0,fieldName:e.account?.fields?.userId||"userId"},accessToken:{type:"string",required:!1,fieldName:e.account?.fields?.accessToken||"accessToken"},refreshToken:{type:"string",required:!1,fieldName:e.account?.fields?.refreshToken||"refreshToken"},idToken:{type:"string",required:!1,fieldName:e.account?.fields?.idToken||"idToken"},accessTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"accessTokenExpiresAt"},refreshTokenExpiresAt:{type:"date",required:!1,fieldName:e.account?.fields?.accessTokenExpiresAt||"refreshTokenExpiresAt"},scope:{type:"string",required:!1,fieldName:e.account?.fields?.scope||"scope"},password:{type:"string",required:!1,fieldName:e.account?.fields?.password||"password"},createdAt:{type:"date",required:!0,fieldName:e.account?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!0,fieldName:e.account?.fields?.updatedAt||"updatedAt"},...m?.fields},order:3},verification:{modelName:e.verification?.modelName||"verification",fields:{identifier:{type:"string",required:!0,fieldName:e.verification?.fields?.identifier||"identifier"},value:{type:"string",required:!0,fieldName:e.verification?.fields?.value||"value"},expiresAt:{type:"date",required:!0,fieldName:e.verification?.fields?.expiresAt||"expiresAt"},createdAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.createdAt||"createdAt"},updatedAt:{type:"date",required:!1,defaultValue:()=>new Date,fieldName:e.verification?.fields?.updatedAt||"updatedAt"}},order:4},...w,...l?p:{}}};import{z as Qe}from"zod";import{Kysely as Ye,MssqlDialect as et}from"kysely";import{MysqlDialect as rt,PostgresDialect as nt,SqliteDialect as st}from"kysely";var W=(e,a,l)=>{let p=b(l);function c(i,u){return u==="id"?u:p[i].fields[u].fieldName||u}function y(i){let u=a.schema||e._.fullSchema;if(!u)throw new A("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");let n=m(i),t=u[n];if(!t)throw new A(`[# Drizzle Adapter]: The model "${n}" was not found in the schema object. Please pass the schema directly to the adapter options.`);return t}let m=i=>p[i].modelName!==i?p[i].modelName:a.usePlural?`${i}s`:i,w=l?.advanced?.generateId===!1;return{getSchema:y,transformInput(i,u,n){let t=w||n==="update"?{}:{id:i.id||(l.advanced?.generateId?l.advanced.generateId({model:u}):T())};for(let o in i){let d=p[u].fields[o];d&&(t[d.fieldName||o]=i[o])}return t},transformOutput(i,u,n=[]){if(!i)return null;let t=i.id||i._id?n.length===0||n.includes("id")?{id:i.id}:{}:{},o=p[u].fields;for(let d in o){if(n.length&&!n.includes(d))continue;let f=o[d];f&&(t[d]=i[f.fieldName||d])}return t},convertWhereClause(i,u){let n=y(u);if(!i)return[];if(i.length===1){let r=i[0];if(!r)return[];let g=c(u,r.field);if(!n[g])throw new A(`The field "${r.field}" does not exist in the schema for the model "${u}". Please update your schema.`);if(r.operator==="in"){if(!Array.isArray(r.value))throw new A(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return[q(n[g],r.value)]}return r.operator==="contains"?[O(n[g],`%${r.value}%`)]:r.operator==="starts_with"?[O(n[g],`${r.value}%`)]:r.operator==="ends_with"?[O(n[g],`%${r.value}`)]:[R(n[g],r.value)]}let t=i.filter(r=>r.connector==="AND"||!r.connector),o=i.filter(r=>r.connector==="OR"),d=j(...t.map(r=>{let g=c(u,r.field);if(r.operator==="in"){if(!Array.isArray(r.value))throw new A(`The value for the field "${r.field}" must be an array when using the "in" operator.`);return q(n[g],r.value)}return R(n[g],r.value)})),f=z(...o.map(r=>{let g=c(u,r.field);return R(n[g],r.value)})),h=[];return t.length&&h.push(d),o.length&&h.push(f),h},withReturning:async(i,u,n)=>{if(a.provider!=="mysql")return(await u.returning())[0];await u;let t=y(m(i));return(await e.select().from(t).where(R(t.id,n.id)))[0]},getField:c,getModelName:m}};function H(e,a,l){if(!e)throw new A("Drizzle adapter failed to initialize. Schema not found. Please provide a schema object in the adapter options object.");for(let p in l)if(!e[p])throw new A(`The field "${p}" does not exist in the "${a}" schema. Please update your drizzle schema or re-generate using "npx @better-auth/cli generate".`)}var Jt=(e,a)=>l=>{let{transformInput:p,transformOutput:c,convertWhereClause:y,getSchema:m,withReturning:w,getField:i,getModelName:u}=W(e,a,l);return{id:"drizzle",async create(n){let{model:t,data:o}=n,d=p(o,t,"create"),f=m(t);H(f,u(t),d);let h=e.insert(f).values(d),r=await w(t,h,d);return c(r,t)},async findOne(n){let{model:t,where:o,select:d}=n,f=m(t),h=y(o,t),r=await e.select().from(f).where(...h);return r.length?c(r[0],t,d):null},async findMany(n){let{model:t,where:o,sortBy:d,limit:f,offset:h}=n,r=m(t),g=o?y(o,t):[],x=d?.direction==="desc"?K:$,I=e.select().from(r).limit(f||100).offset(h||0);return d?.field&&I.orderBy(x(r[i(t,d?.field)])),(await I.where(...g)).map(S=>c(S,t))},async update(n){let{model:t,where:o,update:d}=n,f=m(t),h=y(o,t),r=p(d,t,"update"),g=e.update(f).set(r).where(...h),x=await w(t,g,r);return c(x,t)},async updateMany(n){let{model:t,where:o,update:d}=n,f=m(t),h=y(o,t),r=p(d,t,"update"),x=await e.update(f).set(r).where(...h);return x?x.changes:0},async delete(n){let{model:t,where:o}=n,d=m(t),f=y(o,t);await e.delete(d).where(...f)},async deleteMany(n){let{model:t,where:o}=n,d=m(t),f=y(o,t),r=await e.delete(d).where(...f);return r?r.length:0},options:a}};export{Jt as drizzleAdapter};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-JcgLy3mH.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-DxMBi7M2.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-BXAJa4bS.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-DxMBi7M2.js';
|
package/dist/api.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a5 as AuthEndpoint, a6 as AuthMiddleware, ab as callbackOAuth, aw as changeEmail, at as changePassword, a4 as createAuthEndpoint, a3 as createAuthMiddleware, ao as createEmailVerificationToken, av as deleteUser, ax as error, al as forgetPassword, am as forgetPasswordCallback, af as freshSessionMiddleware, a7 as getEndpoints, ac as getSession, ad as getSessionFromCtx, aB as linkSocialAccount, ag as listSessions, aA as listUserAccounts, ay as ok, a2 as optionsMiddleware, aC as originCheckMiddleware, an as resetPassword, aj as revokeOtherSessions, ah as revokeSession, ai as revokeSessions, a8 as router, aq as sendVerificationEmail, ap as sendVerificationEmailFn, ae as sessionMiddleware, au as setPassword, aa as signInEmail, a9 as signInSocial, ak as signOut, az as signUpEmail, as as updateUser, ar as verifyEmail } from './auth-
|
|
1
|
+
export { a5 as AuthEndpoint, a6 as AuthMiddleware, ab as callbackOAuth, aw as changeEmail, at as changePassword, a4 as createAuthEndpoint, a3 as createAuthMiddleware, ao as createEmailVerificationToken, av as deleteUser, ax as error, al as forgetPassword, am as forgetPasswordCallback, af as freshSessionMiddleware, a7 as getEndpoints, ac as getSession, ad as getSessionFromCtx, aB as linkSocialAccount, ag as listSessions, aA as listUserAccounts, ay as ok, a2 as optionsMiddleware, aC as originCheckMiddleware, an as resetPassword, aj as revokeOtherSessions, ah as revokeSession, ai as revokeSessions, a8 as router, aq as sendVerificationEmail, ap as sendVerificationEmailFn, ae as sessionMiddleware, au as setPassword, aa as signInEmail, a9 as signInSocial, ak as signOut, az as signUpEmail, as as updateUser, ar as verifyEmail } from './auth-JcgLy3mH.cjs';
|
|
2
2
|
import './helper-DxMBi7M2.cjs';
|
|
3
3
|
export { APIError } from 'better-call';
|
|
4
4
|
import 'zod';
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a5 as AuthEndpoint, a6 as AuthMiddleware, ab as callbackOAuth, aw as changeEmail, at as changePassword, a4 as createAuthEndpoint, a3 as createAuthMiddleware, ao as createEmailVerificationToken, av as deleteUser, ax as error, al as forgetPassword, am as forgetPasswordCallback, af as freshSessionMiddleware, a7 as getEndpoints, ac as getSession, ad as getSessionFromCtx, aB as linkSocialAccount, ag as listSessions, aA as listUserAccounts, ay as ok, a2 as optionsMiddleware, aC as originCheckMiddleware, an as resetPassword, aj as revokeOtherSessions, ah as revokeSession, ai as revokeSessions, a8 as router, aq as sendVerificationEmail, ap as sendVerificationEmailFn, ae as sessionMiddleware, au as setPassword, aa as signInEmail, a9 as signInSocial, ak as signOut, az as signUpEmail, as as updateUser, ar as verifyEmail } from './auth-
|
|
1
|
+
export { a5 as AuthEndpoint, a6 as AuthMiddleware, ab as callbackOAuth, aw as changeEmail, at as changePassword, a4 as createAuthEndpoint, a3 as createAuthMiddleware, ao as createEmailVerificationToken, av as deleteUser, ax as error, al as forgetPassword, am as forgetPasswordCallback, af as freshSessionMiddleware, a7 as getEndpoints, ac as getSession, ad as getSessionFromCtx, aB as linkSocialAccount, ag as listSessions, aA as listUserAccounts, ay as ok, a2 as optionsMiddleware, aC as originCheckMiddleware, an as resetPassword, aj as revokeOtherSessions, ah as revokeSession, ai as revokeSessions, a8 as router, aq as sendVerificationEmail, ap as sendVerificationEmailFn, ae as sessionMiddleware, au as setPassword, aa as signInEmail, a9 as signInSocial, ak as signOut, az as signUpEmail, as as updateUser, ar as verifyEmail } from './auth-BXAJa4bS.js';
|
|
2
2
|
import './helper-DxMBi7M2.js';
|
|
3
3
|
export { APIError } from 'better-call';
|
|
4
4
|
import 'zod';
|
|
@@ -733,6 +733,12 @@ interface BetterAuthOptions {
|
|
|
733
733
|
database?: PostgresPool | MysqlPool | Database | Dialect | AdapterInstance | {
|
|
734
734
|
dialect: Dialect;
|
|
735
735
|
type: KyselyDatabaseType;
|
|
736
|
+
/**
|
|
737
|
+
* casing for table names
|
|
738
|
+
*
|
|
739
|
+
* @default "camel"
|
|
740
|
+
*/
|
|
741
|
+
casing?: "snake" | "camel";
|
|
736
742
|
} | {
|
|
737
743
|
/**
|
|
738
744
|
* Kysely instance
|
|
@@ -742,6 +748,12 @@ interface BetterAuthOptions {
|
|
|
742
748
|
* Database type between postgres, mysql and sqlite
|
|
743
749
|
*/
|
|
744
750
|
type: KyselyDatabaseType;
|
|
751
|
+
/**
|
|
752
|
+
* casing for table names
|
|
753
|
+
*
|
|
754
|
+
* @default "camel"
|
|
755
|
+
*/
|
|
756
|
+
casing?: "snake" | "camel";
|
|
745
757
|
};
|
|
746
758
|
/**
|
|
747
759
|
* Secondary storage configuration
|
|
@@ -733,6 +733,12 @@ interface BetterAuthOptions {
|
|
|
733
733
|
database?: PostgresPool | MysqlPool | Database | Dialect | AdapterInstance | {
|
|
734
734
|
dialect: Dialect;
|
|
735
735
|
type: KyselyDatabaseType;
|
|
736
|
+
/**
|
|
737
|
+
* casing for table names
|
|
738
|
+
*
|
|
739
|
+
* @default "camel"
|
|
740
|
+
*/
|
|
741
|
+
casing?: "snake" | "camel";
|
|
736
742
|
} | {
|
|
737
743
|
/**
|
|
738
744
|
* Kysely instance
|
|
@@ -742,6 +748,12 @@ interface BetterAuthOptions {
|
|
|
742
748
|
* Database type between postgres, mysql and sqlite
|
|
743
749
|
*/
|
|
744
750
|
type: KyselyDatabaseType;
|
|
751
|
+
/**
|
|
752
|
+
* casing for table names
|
|
753
|
+
*
|
|
754
|
+
* @default "camel"
|
|
755
|
+
*/
|
|
756
|
+
casing?: "snake" | "camel";
|
|
745
757
|
};
|
|
746
758
|
/**
|
|
747
759
|
* Secondary storage configuration
|
|
@@ -2,10 +2,10 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { AccessControl, StatementsPrimitive, Role } from '../plugins/access.cjs';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-B3tboD6m.cjs';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-B3tboD6m.cjs';
|
|
7
7
|
import { P as Prettify } from '../helper-DxMBi7M2.cjs';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-JcgLy3mH.cjs';
|
|
9
9
|
import { Store } from '../types.cjs';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { AccessControl, StatementsPrimitive, Role } from '../plugins/access.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, q as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, f as anonymous, i as admin, j as genericOAuth, k as jwt, l as multiSession, n as emailOTP } from '../index-Bn2pZ0pb.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-Bn2pZ0pb.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DxMBi7M2.js';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, j as BetterAuthPlugin } from '../auth-BXAJa4bS.js';
|
|
9
9
|
import { Store } from '../types.js';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
package/dist/client.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as BetterAuthPlugin } from './auth-
|
|
1
|
+
import { j as BetterAuthPlugin } from './auth-JcgLy3mH.cjs';
|
|
2
2
|
import { ClientOptions, InferClientAPI, InferActions, BetterAuthClientPlugin, IsSignal } from './types.cjs';
|
|
3
3
|
export { AtomListener, InferAdditionalFromClient, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, Store } from './types.cjs';
|
|
4
4
|
import * as nanostores from 'nanostores';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as BetterAuthPlugin } from './auth-
|
|
1
|
+
import { j as BetterAuthPlugin } from './auth-BXAJa4bS.js';
|
|
2
2
|
import { ClientOptions, InferClientAPI, InferActions, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
3
3
|
export { AtomListener, InferAdditionalFromClient, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, Store } from './types.js';
|
|
4
4
|
import * as nanostores from 'nanostores';
|
package/dist/cookies.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'better-call';
|
|
2
|
-
export { q as BetterAuthCookies, E as EligibleCookies, o as createCookieGetter, r as deleteSessionCookie, p as getCookies, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie } from './auth-
|
|
2
|
+
export { q as BetterAuthCookies, E as EligibleCookies, o as createCookieGetter, r as deleteSessionCookie, p as getCookies, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie } from './auth-JcgLy3mH.cjs';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './helper-DxMBi7M2.cjs';
|
package/dist/cookies.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'better-call';
|
|
2
|
-
export { q as BetterAuthCookies, E as EligibleCookies, o as createCookieGetter, r as deleteSessionCookie, p as getCookies, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie } from './auth-
|
|
2
|
+
export { q as BetterAuthCookies, E as EligibleCookies, o as createCookieGetter, r as deleteSessionCookie, p as getCookies, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie } from './auth-BXAJa4bS.js';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import './helper-DxMBi7M2.js';
|
package/dist/db.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as Adapter, B as BetterAuthOptions, W as Where, F as FieldAttribute, D as FieldType, K as KyselyDatabaseType } from './auth-
|
|
2
|
-
export { a0 as BetterAuthDbSchema, O as FieldAttributeConfig, $ as InferFieldsFromOptions, _ as InferFieldsFromPlugins, X as InferFieldsInput, Y as InferFieldsInputClient, V as InferFieldsOutput, T as InferValueType, N as InternalAdapter, Z as PluginFieldAttribute, Q as createFieldAttribute, J as createInternalAdapter, a1 as getAuthTables } from './auth-
|
|
1
|
+
import { l as Adapter, B as BetterAuthOptions, W as Where, F as FieldAttribute, D as FieldType, K as KyselyDatabaseType } from './auth-JcgLy3mH.cjs';
|
|
2
|
+
export { a0 as BetterAuthDbSchema, O as FieldAttributeConfig, $ as InferFieldsFromOptions, _ as InferFieldsFromPlugins, X as InferFieldsInput, Y as InferFieldsInputClient, V as InferFieldsOutput, T as InferValueType, N as InternalAdapter, Z as PluginFieldAttribute, Q as createFieldAttribute, J as createInternalAdapter, a1 as getAuthTables } from './auth-JcgLy3mH.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
package/dist/db.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as Adapter, B as BetterAuthOptions, W as Where, F as FieldAttribute, D as FieldType, K as KyselyDatabaseType } from './auth-
|
|
2
|
-
export { a0 as BetterAuthDbSchema, O as FieldAttributeConfig, $ as InferFieldsFromOptions, _ as InferFieldsFromPlugins, X as InferFieldsInput, Y as InferFieldsInputClient, V as InferFieldsOutput, T as InferValueType, N as InternalAdapter, Z as PluginFieldAttribute, Q as createFieldAttribute, J as createInternalAdapter, a1 as getAuthTables } from './auth-
|
|
1
|
+
import { l as Adapter, B as BetterAuthOptions, W as Where, F as FieldAttribute, D as FieldType, K as KyselyDatabaseType } from './auth-BXAJa4bS.js';
|
|
2
|
+
export { a0 as BetterAuthDbSchema, O as FieldAttributeConfig, $ as InferFieldsFromOptions, _ as InferFieldsFromPlugins, X as InferFieldsInput, Y as InferFieldsInputClient, V as InferFieldsOutput, T as InferValueType, N as InternalAdapter, Z as PluginFieldAttribute, Q as createFieldAttribute, J as createInternalAdapter, a1 as getAuthTables } from './auth-BXAJa4bS.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodLiteral, ZodObject, ZodOptional, ZodArray } from 'zod';
|
|
2
|
-
import { U as User, S as Session, k as InferOptionSchema, H as HookEndpointContext, h as AuthContext } from './auth-
|
|
2
|
+
import { U as User, S as Session, k as InferOptionSchema, H as HookEndpointContext, h as AuthContext } from './auth-JcgLy3mH.cjs';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { APIError } from 'better-call';
|
|
5
5
|
import { P as Prettify } from './helper-DxMBi7M2.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodLiteral, ZodObject, ZodOptional, ZodArray } from 'zod';
|
|
2
|
-
import { U as User, S as Session, k as InferOptionSchema, H as HookEndpointContext, h as AuthContext } from './auth-
|
|
2
|
+
import { U as User, S as Session, k as InferOptionSchema, H as HookEndpointContext, h as AuthContext } from './auth-BXAJa4bS.js';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { APIError } from 'better-call';
|
|
5
5
|
import { P as Prettify } from './helper-DxMBi7M2.js';
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { l as Adapter, m as AdapterInstance, d as AdditionalSessionFieldsInput, e as AdditionalSessionFieldsOutput, a as AdditionalUserFieldsInput, c as AdditionalUserFieldsOutput, A as Auth, h as AuthContext, q as BetterAuthCookies, B as BetterAuthOptions, j as BetterAuthPlugin, E as EligibleCookies, G as GenericEndpointContext, H as HookEndpointContext, k as InferOptionSchema, g as InferPluginTypes, f as InferSession, I as InferUser, y as LogHandlerParams, L as LogLevel, x as Logger, M as Models, P as PluginSchema, R as RateLimit, n as SecondaryStorage, S as Session, U as User, W as Where, b as betterAuth, o as createCookieGetter, z as createLogger, r as deleteSessionCookie, p as getCookies, i as init, v as levels, C as logger, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie, w as shouldPublishLog } from './auth-
|
|
1
|
+
export { l as Adapter, m as AdapterInstance, d as AdditionalSessionFieldsInput, e as AdditionalSessionFieldsOutput, a as AdditionalUserFieldsInput, c as AdditionalUserFieldsOutput, A as Auth, h as AuthContext, q as BetterAuthCookies, B as BetterAuthOptions, j as BetterAuthPlugin, E as EligibleCookies, G as GenericEndpointContext, H as HookEndpointContext, k as InferOptionSchema, g as InferPluginTypes, f as InferSession, I as InferUser, y as LogHandlerParams, L as LogLevel, x as Logger, M as Models, P as PluginSchema, R as RateLimit, n as SecondaryStorage, S as Session, U as User, W as Where, b as betterAuth, o as createCookieGetter, z as createLogger, r as deleteSessionCookie, p as getCookies, i as init, v as levels, C as logger, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie, w as shouldPublishLog } from './auth-JcgLy3mH.cjs';
|
|
2
2
|
export { D as DeepPartial, H as HasRequiredKeys, L as LiteralString, b as LiteralUnion, O as OmitId, P as Prettify, a as PrettifyDeep, R as RequiredKeysOf, S as StripEmptyObjects, U as UnionToIntersection, W as WithoutEmpty } from './helper-DxMBi7M2.cjs';
|
|
3
3
|
export { AtomListener, BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, IsSignal, Store } from './types.cjs';
|
|
4
4
|
export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.cjs';
|
|
5
|
-
export { g as generateState, p as parseState } from './state-
|
|
5
|
+
export { g as generateState, p as parseState } from './state-CMDbIivR.cjs';
|
|
6
6
|
import 'kysely';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'better-call';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { l as Adapter, m as AdapterInstance, d as AdditionalSessionFieldsInput, e as AdditionalSessionFieldsOutput, a as AdditionalUserFieldsInput, c as AdditionalUserFieldsOutput, A as Auth, h as AuthContext, q as BetterAuthCookies, B as BetterAuthOptions, j as BetterAuthPlugin, E as EligibleCookies, G as GenericEndpointContext, H as HookEndpointContext, k as InferOptionSchema, g as InferPluginTypes, f as InferSession, I as InferUser, y as LogHandlerParams, L as LogLevel, x as Logger, M as Models, P as PluginSchema, R as RateLimit, n as SecondaryStorage, S as Session, U as User, W as Where, b as betterAuth, o as createCookieGetter, z as createLogger, r as deleteSessionCookie, p as getCookies, i as init, v as levels, C as logger, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie, w as shouldPublishLog } from './auth-
|
|
1
|
+
export { l as Adapter, m as AdapterInstance, d as AdditionalSessionFieldsInput, e as AdditionalSessionFieldsOutput, a as AdditionalUserFieldsInput, c as AdditionalUserFieldsOutput, A as Auth, h as AuthContext, q as BetterAuthCookies, B as BetterAuthOptions, j as BetterAuthPlugin, E as EligibleCookies, G as GenericEndpointContext, H as HookEndpointContext, k as InferOptionSchema, g as InferPluginTypes, f as InferSession, I as InferUser, y as LogHandlerParams, L as LogLevel, x as Logger, M as Models, P as PluginSchema, R as RateLimit, n as SecondaryStorage, S as Session, U as User, W as Where, b as betterAuth, o as createCookieGetter, z as createLogger, r as deleteSessionCookie, p as getCookies, i as init, v as levels, C as logger, t as parseCookies, u as parseSetCookieHeader, s as setSessionCookie, w as shouldPublishLog } from './auth-BXAJa4bS.js';
|
|
2
2
|
export { D as DeepPartial, H as HasRequiredKeys, L as LiteralString, b as LiteralUnion, O as OmitId, P as Prettify, a as PrettifyDeep, R as RequiredKeysOf, S as StripEmptyObjects, U as UnionToIntersection, W as WithoutEmpty } from './helper-DxMBi7M2.js';
|
|
3
3
|
export { AtomListener, BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, IsSignal, Store } from './types.js';
|
|
4
4
|
export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
|
|
5
|
-
export { g as generateState, p as parseState } from './state-
|
|
5
|
+
export { g as generateState, p as parseState } from './state-MOcw4xXw.js';
|
|
6
6
|
import 'kysely';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'better-call';
|
package/dist/next-js.d.cts
CHANGED
package/dist/next-js.d.ts
CHANGED
package/dist/node.d.cts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/oauth2.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { P as ProviderOptions, O as OAuth2Tokens } from './index-PzUmElyX.cjs';
|
|
2
2
|
export { a as OAuthProvider } from './index-PzUmElyX.cjs';
|
|
3
|
-
export { g as generateState, p as parseState } from './state-
|
|
3
|
+
export { g as generateState, p as parseState } from './state-CMDbIivR.cjs';
|
|
4
4
|
import './helper-DxMBi7M2.cjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'jose';
|
|
7
|
-
import './auth-
|
|
7
|
+
import './auth-JcgLy3mH.cjs';
|
|
8
8
|
import 'kysely';
|
|
9
9
|
import 'better-call';
|
|
10
10
|
import 'better-sqlite3';
|
package/dist/oauth2.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { P as ProviderOptions, O as OAuth2Tokens } from './index-CS8-YiCU.js';
|
|
2
2
|
export { a as OAuthProvider } from './index-CS8-YiCU.js';
|
|
3
|
-
export { g as generateState, p as parseState } from './state-
|
|
3
|
+
export { g as generateState, p as parseState } from './state-MOcw4xXw.js';
|
|
4
4
|
import './helper-DxMBi7M2.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import 'jose';
|
|
7
|
-
import './auth-
|
|
7
|
+
import './auth-BXAJa4bS.js';
|
|
8
8
|
import 'kysely';
|
|
9
9
|
import 'better-call';
|
|
10
10
|
import 'better-sqlite3';
|