Edit: /tmp/tsx-0/17887-c3f10a52e7cc27c1a55d293378d23cab0ac7c162 (4314B)
{"code":"__filename=\"/opt/canhelp/node_modules/better-auth/dist/api/routes/update-session.mjs\";(()=>{\nvar __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf;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 __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,\"default\",{value:mod,enumerable:true}):target,mod));var __toCommonJS=mod=>__copyProps(__defProp({},\"__esModule\",{value:true}),mod);var update_session_exports={};__export(update_session_exports,{updateSession:()=>updateSession});module.exports=__toCommonJS(update_session_exports);var import_schema=require(\"../../db/schema.mjs\");var import_cookies=require(\"../../cookies/index.mjs\");var import_session=require(\"./session.mjs\");var import_error=require(\"@better-auth/core/error\");var import_api=require(\"@better-auth/core/api\");var z=__toESM(require(\"zod\"));const updateSessionBodySchema=z.record(z.string().meta({description:\"Field name must be a string\"}),z.any());const updateSession=__name(()=>(0,import_api.createAuthEndpoint)(\"/update-session\",{method:\"POST\",operationId:\"updateSession\",body:updateSessionBodySchema,use:[import_session.sessionMiddleware],metadata:{$Infer:{body:{}},openapi:{operationId:\"updateSession\",description:\"Update the current session\",responses:{\"200\":{description:\"Success\",content:{\"application/json\":{schema:{type:\"object\",properties:{session:{type:\"object\",$ref:\"#/components/schemas/Session\"}}}}}}}}}},async ctx=>{const body=ctx.body;if(typeof body!==\"object\"||Array.isArray(body))throw import_error.APIError.from(\"BAD_REQUEST\",import_error.BASE_ERROR_CODES.BODY_MUST_BE_AN_OBJECT);const session=ctx.context.session;const additionalFields=(0,import_schema.parseSessionInput)(ctx.context.options,body,\"update\");if(Object.keys(additionalFields).length===0)throw import_error.APIError.fromStatus(\"BAD_REQUEST\",{message:\"No fields to update\"});const newSession=await ctx.context.internalAdapter.updateSession(session.session.token,{...additionalFields,updatedAt:new Date})??{...session.session,...additionalFields,updatedAt:new Date};await(0,import_cookies.setSessionCookie)(ctx,{session:newSession,user:session.user});return ctx.json({session:(0,import_schema.parseSessionOutput)(ctx.context.options,newSession)})}),\"updateSession\");0&&(module.exports={updateSession});\n})()\n","warnings":[],"map":{"version":3,"mappings":";i/BAAA,uKAAsD,+BACtD,mBAAiC,mCACjC,mBAAkC,yBAClC,iBAA2C,mCAC3C,eAAmC,iCACnC,MAAmB,wBAGnB,MAAM,wBAA0B,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAE,YAAa,6BAA8B,CAAC,EAAG,EAAE,IAAI,CAAC,EACjH,MAAM,cAAgB,cAAM,+BAAmB,kBAAmB,CACjE,OAAQ,OACR,YAAa,gBACb,KAAM,wBACN,IAAK,CAAC,gCAAiB,EACvB,SAAU,CACT,OAAQ,CAAE,KAAM,CAAC,CAAE,EACnB,QAAS,CACR,YAAa,gBACb,YAAa,6BACb,UAAW,CAAE,MAAO,CACnB,YAAa,UACb,QAAS,CAAE,mBAAoB,CAAE,OAAQ,CACxC,KAAM,SACN,WAAY,CAAE,QAAS,CACtB,KAAM,SACN,KAAM,8BACP,CAAE,CACH,CAAE,CAAE,CACL,CAAE,CACH,CACD,CACD,EAAG,MAAO,KAAQ,CACjB,MAAM,KAAO,IAAI,KACjB,GAAI,OAAO,OAAS,UAAY,MAAM,QAAQ,IAAI,EAAG,MAAM,sBAAS,KAAK,cAAe,8BAAiB,sBAAsB,EAC/H,MAAM,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