Edit: /tmp/tsx-0/17887-c50a1c4e20ff844fd2ca40a41325529fbe16b808 (10832B)
{"code":"__filename=\"/opt/canhelp/node_modules/better-auth/node_modules/@better-auth/core/dist/db/get-tables.mjs\";(()=>{\nvar __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,\"name\",{value,configurable:true});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from===\"object\"||typeof from===\"function\"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},\"__esModule\",{value:true}),mod);var get_tables_exports={};__export(get_tables_exports,{getAuthTables:()=>getAuthTables});module.exports=__toCommonJS(get_tables_exports);const getAuthTables=__name(options=>{const pluginSchema=(options.plugins??[]).reduce((acc,plugin)=>{const schema=plugin.schema;if(!schema)return acc;for(const[key,value]of Object.entries(schema))acc[key]={fields:{...acc[key]?.fields,...value.fields},modelName:value.modelName||key};return acc},{});const shouldAddRateLimitTable=options.rateLimit?.storage===\"database\";const rateLimitTable={rateLimit:{modelName:options.rateLimit?.modelName||\"rateLimit\",fields:{key:{type:\"string\",unique:true,required:true,fieldName:options.rateLimit?.fields?.key||\"key\"},count:{type:\"number\",required:true,fieldName:options.rateLimit?.fields?.count||\"count\"},lastRequest:{type:\"number\",bigint:true,required:true,fieldName:options.rateLimit?.fields?.lastRequest||\"lastRequest\",defaultValue:__name(()=>Date.now(),\"defaultValue\")}}}};const{user,session,account,verification,...pluginTables}=pluginSchema;const verificationTable={verification:{modelName:options.verification?.modelName||\"verification\",fields:{identifier:{type:\"string\",required:true,fieldName:options.verification?.fields?.identifier||\"identifier\",index:true},value:{type:\"string\",required:true,fieldName:options.verification?.fields?.value||\"value\"},expiresAt:{type:\"date\",required:true,fieldName:options.verification?.fields?.expiresAt||\"expiresAt\"},createdAt:{type:\"date\",required:true,defaultValue:__name(()=>new Date,\"defaultValue\"),fieldName:options.verification?.fields?.createdAt||\"createdAt\"},updatedAt:{type:\"date\",required:true,defaultValue:__name(()=>new Date,\"defaultValue\"),onUpdate:__name(()=>new Date,\"onUpdate\"),fieldName:options.verification?.fields?.updatedAt||\"updatedAt\"},...verification?.fields,...options.verification?.additionalFields},order:4}};const sessionTable={session:{modelName:options.session?.modelName||\"session\",fields:{expiresAt:{type:\"date\",required:true,fieldName:options.session?.fields?.expiresAt||\"expiresAt\"},token:{type:\"string\",required:true,fieldName:options.session?.fields?.token||\"token\",unique:true},createdAt:{type:\"date\",required:true,fieldName:options.session?.fields?.createdAt||\"createdAt\",defaultValue:__name(()=>new Date,\"defaultValue\")},updatedAt:{type:\"date\",required:true,fieldName:options.session?.fields?.updatedAt||\"updatedAt\",onUpdate:__name(()=>new Date,\"onUpdate\")},ipAddress:{type:\"string\",required:false,fieldName:options.session?.fields?.ipAddress||\"ipAddress\"},userAgent:{type:\"string\",required:false,fieldName:options.session?.fields?.userAgent||\"userAgent\"},userId:{type:\"string\",fieldName:options.session?.fields?.userId||\"userId\",references:{model:options.user?.modelName||\"user\",field:\"id\",onDelete:\"cascade\"},required:true,index:true},...session?.fields,...options.session?.additionalFields},order:2}};return{user:{modelName:options.user?.modelName||\"user\",fields:{name:{type:\"string\",required:true,fieldName:options.user?.fields?.name||\"name\",sortable:true},email:{type:\"string\",unique:true,required:true,fieldName:options.user?.fields?.email||\"email\",sortable:true},emailVerified:{type:\"boolean\",defaultValue:false,required:true,fieldName:options.user?.fields?.emailVerified||\"emailVerified\",input:false},image:{type:\"string\",required:false,fieldName:options.user?.fields?.image||\"image\"},createdAt:{type:\"date\",defaultValue:__name(()=>new Date,\"defaultValue\"),required:true,fieldName:options.user?.fields?.createdAt||\"createdAt\"},updatedAt:{type:\"date\",defaultValue:__name(()=>new Date,\"defaultValue\"),onUpdate:__name(()=>new Date,\"onUpdate\"),required:true,fieldName:options.user?.fields?.updatedAt||\"updatedAt\"},...user?.fields,...options.user?.additionalFields},order:1},...!options.secondaryStorage||options.session?.storeSessionInDatabase?sessionTable:{},account:{modelName:options.account?.modelName||\"account\",fields:{accountId:{type:\"string\",required:true,fieldName:options.account?.fields?.accountId||\"accountId\"},providerId:{type:\"string\",required:true,fieldName:options.account?.fields?.providerId||\"providerId\"},userId:{type:\"string\",references:{model:options.user?.modelName||\"user\",field:\"id\",onDelete:\"cascade\"},required:true,fieldName:options.account?.fields?.userId||\"userId\",index:true},accessToken:{type:\"string\",required:false,returned:false,fieldName:options.account?.fields?.accessToken||\"accessToken\"},refreshToken:{type:\"string\",required:false,returned:false,fieldName:options.account?.fields?.refreshToken||\"refreshToken\"},idToken:{type:\"string\",required:false,returned:false,fieldName:options.account?.fields?.idToken||\"idToken\"},accessTokenExpiresAt:{type:\"date\",required:false,returned:false,fieldName:options.account?.fields?.accessTokenExpiresAt||\"accessTokenExpiresAt\"},refreshTokenExpiresAt:{type:\"date\",required:false,returned:false,fieldName:options.account?.fields?.refreshTokenExpiresAt||\"refreshTokenExpiresAt\"},scope:{type:\"string\",required:false,fieldName:options.account?.fields?.scope||\"scope\"},password:{type:\"string\",required:false,returned:false,fieldName:options.account?.fields?.password||\"password\"},createdAt:{type:\"date\",required:true,fieldName:options.account?.fields?.createdAt||\"createdAt\",defaultValue:__name(()=>new Date,\"defaultValue\")},updatedAt:{type:\"date\",required:true,fieldName:options.account?.fields?.updatedAt||\"updatedAt\",onUpdate:__name(()=>new Date,\"onUpdate\")},...account?.fields,...options.account?.additionalFields},order:3},...!options.secondaryStorage||options.verification?.storeInDatabase?verificationTable:{},...pluginTables,...shouldAddRateLimitTable?rateLimitTable:{}}},\"getAuthTables\");0&&(module.exports={getAuthTables});\n})()\n","warnings":[],"map":{"version":3,"mappings":";suBAAA,yIAC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ACV,SAAU,MACV,UAAW,QAAQ,SAAS,QAAQ,SAAW,SAChD,EACA,qBAAsB,CACrB,KAAM,OACN,SAAU,MACV,SAAU,MACV,UAAW,QAAQ,SAAS,QAAQ,sBAAwB,sBAC7D,EACA,sBAAuB,CACtB,KAAM,OACN,SAAU,MACV,SAAU,MACV,UAAW,QAAQ,SAAS,QAAQ,uBAAyB,uBAC9D,EACA,MAAO,CACN,KAAM,SACN,SAAU,MACV,UAAW,QAAQ,SAAS,QAAQ,OAAS,OAC9C,EACA,SAAU,CACT,KAAM,SACN,SAAU,MACV,SAAU,MACV,UAAW,QAAQ,SAAS,QAAQ,UAAY,UACjD,EACA,UAAW,CACV,KAAM,OACN,SAAU,KACV,UAAW,QAAQ,SAAS,QAAQ,WAAa,YACjD,aAAc,WAAsB,IAAI,KAA1B,eACf,EACA,UAAW,CACV,KAAM,OACN,SAAU,KACV,UAAW,QAAQ,SAAS,QAAQ,WAAa,YACjD,SAAU,WAAsB,IAAI,KAA1B,WACX,EACA,GAAG,SAAS,OACZ,GAAG,QAAQ,SAAS,gBACrB,EACA,MAAO,CACR,EACA,GAAG,CAAC,QAAQ,kBAAoB,QAAQ,cAAc,gBAAkB,kBAAoB,CAAC,EAC7F,GAAG,aACH,GAAG,wBAA0B,eAAiB,CAAC,CAChD,CACD,EArQsB","names":[],"ignoreList":[],"sources":["/opt/canhelp/node_modules/better-auth/node_modules/@better-auth/core/dist/db/get-tables.mjs"],"sourcesContent":[null]}}