Edit: /tmp/tsx-0/17887-e794d5a68fff04db0110a8f0bdb008e8f5cbebe7 (3928B)
{"code":"__filename=\"/opt/canhelp/node_modules/better-auth/dist/plugins/test-utils/index.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 test_utils_exports={};__export(test_utils_exports,{testUtils:()=>testUtils});module.exports=__toCommonJS(test_utils_exports);var import_auth_helpers=require(\"./auth-helpers.mjs\");var import_db_helpers=require(\"./db-helpers.mjs\");var import_factories=require(\"./factories.mjs\");var import_otp_sink=require(\"./otp-sink.mjs\");const testUtils=__name((options={})=>{return{id:\"test-utils\",init(ctx){const hasOrgPlugin=ctx.hasPlugin(\"organization\");const helpers={createUser:(0,import_factories.createUserFactory)(ctx),saveUser:(0,import_db_helpers.createSaveUser)(ctx),deleteUser:(0,import_db_helpers.createDeleteUser)(ctx),login:(0,import_auth_helpers.createLogin)(ctx),getAuthHeaders:(0,import_auth_helpers.createGetAuthHeaders)(ctx),getCookies:(0,import_auth_helpers.createGetCookies)(ctx)};if(hasOrgPlugin){helpers.createOrganization=(0,import_factories.createOrganizationFactory)(ctx);helpers.saveOrganization=(0,import_db_helpers.createSaveOrganization)(ctx);helpers.deleteOrganization=(0,import_db_helpers.createDeleteOrganization)(ctx);helpers.addMember=(0,import_db_helpers.createAddMember)(ctx)}const otpStore=(0,import_otp_sink.createOTPStore)();if(options.captureOTP){helpers.getOTP=otpStore.get;helpers.clearOTPs=otpStore.clear}const databaseHooks=options.captureOTP?{verification:{create:{async after(verification){if(verification?.value&&verification?.identifier){const otpPart=verification.value.split(\":\")[0];if(otpPart){let identifier=verification.identifier;for(const prefix of[\"email-verification-otp-\",\"sign-in-otp-\",\"forget-password-otp-\",\"phone-verification-otp-\"])if(identifier.startsWith(prefix)){identifier=identifier.slice(prefix.length);break}otpStore.capture(identifier,otpPart)}}}}}}:null;return{context:{test:helpers},options:databaseHooks?{databaseHooks}:void 0}},options}},\"testUtils\");0&&(module.exports={testUtils});\n})()\n","warnings":[],"map":{"version":3,"mappings":";suBAAA,yJAAoE,8BACpE,sBAAoH,4BACpH,qBAA6D,2BAC7D,oBAA+B,0BAgC/B,MAAM,UAAY,QAAC,QAAU,CAAC,IAAM,CACnC,MAAO,CACN,GAAI,aACJ,KAAK,IAAK,CACT,MAAM,aAAe,IAAI,UAAU,cAAc,EACjD,MAAM,QAAU,CACf,cAAY,oCAAkB,GAAG,EACjC,YAAU,kCAAe,GAAG,EAC5B,cAAY,oCAAiB,GAAG,EAChC,SAAO,iCAAY,GAAG,EACtB,kBAAgB,0CAAqB,GAAG,EACxC,cAAY,sCAAiB,GAAG,CACjC,EACA,GAAI,aAAc,CACjB,QAAQ,sBAAqB,4CAA0B,GAAG,EAC1D,QAAQ,oBAAmB,0CAAuB,GAAG,EACrD,QAAQ,sBAAqB,4CAAyB,GAAG,EACzD,QAAQ,aAAY,mCAAgB,GAAG,CACxC,CACA,MAAM,YAAW,gCAAe,EAChC,GAAI,QAAQ,WAAY,CACvB,QAAQ,OAAS,SAAS,IAC1B,QAAQ,UAAY,SAAS,KAC9B,CACA,MAAM,cAAgB,QAAQ,WAAa,CAAE,aAAc,CAAE,OAAQ,CAAE,MAAM,MAAM,aAAc,CAChG,GAAI,cAAc,OAAS,cAAc,WAAY,CACpD,MAAM,QAAU,aAAa,MAAM,MAAM,GAAG,EAAE,CAAC,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