gemi 0.28.3 → 0.28.5

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.
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{f as q}from"../chunk-jdywh3jz.js";import{g as k,i as y,j as p,k as z,l as U,m as P,n as S,o as f,p as b}from"../facades/index.js";import{C as g,D as h,x as L}from"../http/index.js";import{E as I}from"../chunk-6ws1z2r2.js";import{F as A}from"../chunk-q55gxfvs.js";import"../chunk-16hvsdc0.js";import{H as E,I as C,J as M,K as V,L as $,M as J,N as W,O as N,P as B,Q as G}from"../services/index.js";import"../chunk-ghy46jx3.js";import"../chunk-xtc1ej4p.js";import"../chunk-9fw11v51.js";import"../chunk-yc5bcdc2.js";import"../chunk-p4drhdbp.js";import"../chunk-xfcxaexm.js";import"../chunk-xrwqssps.js";import"../chunk-n5xvg37g.js";import{Ga as R}from"../chunk-ptm665mz.js";import{La as F}from"../chunk-13sdtj3f.js";import{Ma as w,Na as D}from"../chunk-ss3g2czb.js";import"../chunk-79f3dyfm.js";import"../chunk-qfy6gp4k.js";var X=async(e)=>e instanceof Promise?await e:e,l=async(e)=>{try{if(e)await X(e())}catch(s){}},Y=class e{name;cron;callback;onTick;onComplete;interval=null;next=null;status="stopped";parser;constructor(s){if(this.name=s.name,this.cron=s.cron,this.callback=l.bind(this,s.callback),this.onTick=l.bind(this,s.onTick),this.onComplete=l.bind(this,s.onComplete),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.destroy=this.destroy.bind(this),this.getStatus=this.getStatus.bind(this),this.isRunning=this.isRunning.bind(this),this.lastExecution=this.lastExecution.bind(this),this.nextExecution=this.nextExecution.bind(this),this.remaining=this.remaining.bind(this),this.time=this.time.bind(this),this.parser=new o(this.cron),s.start)this.start()}start(){if(this.status==="running")return;this.status="running",this.next=this.parser.getNext(),this.interval=setInterval(()=>{if(this.next&&this.next.getTime()<=Date.now())this.callback(),this.onTick(),this.next=this.parser.getNext()},1000)}stop(){if(this.status==="stopped")return;if(this.status="stopped",this.interval)clearInterval(this.interval)}destroy(){this.stop(),this.onComplete()}getStatus(){return this.status}isRunning(){return this.status==="running"}lastExecution(){return this.parser.getPrevious()}nextExecution(){return this.next||new Date}remaining(){return this.next?this.next.getTime()-Date.now():0}time(){return Date.now()}static create(s){return new e(s)}static parse(s){return new o(s).parse()}static getNext(s){return new o(s).getNext()}static getPrevious(s){return new o(s).getPrevious()}static isCron(s){try{return new o(s).parse(),!0}catch(t){return!1}}static isValid(s){return e.isCron(s)}},Z=Y,K=class e{crons=new Map;constructor(s={}){if(s.autoStart)this.bakeAll()}add(s){let t=Z.create(s);return this.crons.set(t.name,t),t}remove(s){let t=this.crons.get(s);if(t)t.destroy(),this.crons.delete(s)}bake(s){let t=this.crons.get(s);if(t)t.start()}stop(s){let t=this.crons.get(s);if(t)t.stop()}destroy(s){let t=this.crons.get(s);if(t)t.destroy(),this.crons.delete(s)}getStatus(s){let t=this.crons.get(s);return t?t.getStatus():"stopped"}isRunning(s){let t=this.crons.get(s);return t?t.isRunning():!1}lastExecution(s){let t=this.crons.get(s);return t?t.lastExecution():new Date}nextExecution(s){let t=this.crons.get(s);return t?t.nextExecution():new Date}remaining(s){let t=this.crons.get(s);return t?t.remaining():0}time(s){let t=this.crons.get(s);return t?t.time():0}bakeAll(){this.crons.forEach((s)=>s.start())}stopAll(){this.crons.forEach((s)=>s.stop())}destroyAll(){this.crons.forEach((s)=>s.destroy()),this.crons.clear()}static create(s={}){return new e(s)}},O=K,x=class{constructor(e){this.cron=e}aliases=new Map([["@every_second","* * * * * *"],["@every_minute","0 * * * * *"],["@yearly","0 0 1 1 * *"],["@annually","0 0 1 1 * *"],["@monthly","0 0 1 * * *"],["@weekly","0 0 * * 0 *"],["@daily","0 0 * * * *"],["@hourly","0 * * * * *"]]);parseEveryStr(e){let[,s,t]=e.split("_");switch(t){case"seconds":return`*/${s} * * * * *`;case"minutes":return`0 */${s} * * * *`;case"hours":return`0 0 */${s} * * *`;case"dayOfMonth":return`0 0 0 */${s} * *`;case"months":return`0 0 0 0 */${s} *`;case"dayOfWeek":return`0 0 0 0 0 */${s}`;default:return"* * * * * *"}}parseAtHourStr(e){let[,s]=e.split("_"),[t,i]=s.split(":");return`0 ${i} ${t} * * *`}parseOnDayStr(e){let[,s,t]=e.split("_");return`0 0 0 * * ${new Map([["sunday",1],["monday",2],["tuesday",3],["wednesday",4],["thursday",5],["friday",6],["saturday",7]]).get(s)}`}parseBetweenStr(e){let[,s,t]=e.split("_");return`0 0 ${s}-${t} * * *`}parseStr(e){if(this.aliases.has(e))return this.aliases.get(e)||"";if(e.includes("@every_"))return this.parseEveryStr(e);if(e.includes("@at_"))return this.parseAtHourStr(e);if(e.includes("@on_"))return this.parseOnDayStr(e);if(e.includes("@between_"))return this.parseBetweenStr(e);return e}parse(){this.cron=this.parseStr(this.cron);let[e,s,t,i,r,a]=this.cron.split(" ");return{second:this.parseCronTime(e,0,59),minute:this.parseCronTime(s,0,59),hour:this.parseCronTime(t,0,23),dayOfMonth:this.parseCronTime(i,1,31),month:this.parseCronTime(r,1,12),dayOfWeek:this.parseCronTime(a,0,6)}}getNext(){let e=this.parse(),s=new Date,t=new Date(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds());t.setMilliseconds(0),t.setSeconds(t.getSeconds()+1);while(!this.checkCronTime(e,t))t.setSeconds(t.getSeconds()+1);return t}getPrevious(){let e=this.parse(),s=new Date,t=new Date(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds());t.setMilliseconds(0),t.setSeconds(t.getSeconds()-1);while(!this.checkCronTime(e,t))t.setSeconds(t.getSeconds()-1);return t}parseCronTime(e,s,t){let i=[];switch(!0){case e==="*":for(let r=s;r<=t;r++)i.push(r);break;case e.includes("-"):{let[r,a]=e.split("-"),d=this.getStep(e);for(let n=parseInt(r);n<=parseInt(a);n+=d)i.push(n);break}case e.includes("/"):{let[r,a]=e.split("/"),d=r==="*"?s:parseInt(r);for(let n=d;n<=t;n+=parseInt(a))i.push(n);break}case e.includes(","):{let r=e.split(",");for(let a=0;a<r.length;a++)i.push(parseInt(r[a]));break}default:i.push(parseInt(e));break}return i}getStep(e){let[,s]=e.split("/"),t=parseInt(s);return isNaN(t)?1:t}checkCronTime(e,s){if(e.second&&!e.second.includes(s.getSeconds()))return!1;if(e.minute&&!e.minute.includes(s.getMinutes()))return!1;if(e.hour&&!e.hour.includes(s.getHours()))return!1;if(e.dayOfMonth&&!e.dayOfMonth.includes(s.getDate()))return!1;if(e.month&&!e.month.includes(s.getMonth()+1))return!1;else if(e.dayOfWeek&&!e.dayOfWeek.includes(s.getDay()))return!1;return!0}},o=x,j=O;class u extends D{service;static _name="CronServiceContainer";constructor(e){super();this.service=e;if(this.service.jobs.length===0)return;let s=j.create({autoStart:!0}),t=async(i)=>{return await this.service.kernel.waitForBoot.call(this.service.kernel),await this.service.kernel.run.call(this.service.kernel,i)};for(let i of this.service.jobs){let r=new i;if(!r.name){console.error(`Cron job must have a name. Job: ${JSON.stringify(r)}`);continue}if(!r.cron){console.error(`Cron job must have an expression. Job: ${r.name}`);continue}s.add({name:r.name,cron:r.cron,callback:()=>t(async()=>{try{await r.callback.call(r)}catch(a){console.error(`Error in cron job ${r.name}:`,a)}}),onComplete:()=>t(async()=>{try{await r.onComplete.call(r)}catch(a){console.error(`Error completing cron job ${r.name}:`,a)}}),onTick:()=>t(async()=>{try{await r.onTick.call(r)}catch(a){console.error(`Error executing cron job ${r.name}:`,a)}})})}s.bakeAll()}}class c extends F{id=crypto.randomUUID();boot(){}}class H{emailServiceProvider=V;authenticationServiceProvider=z;middlewareServiceProvider=L;i18nServiceProvider=q;fileStorageServiceProvider=E;apiRouterServiceProvider=C;viewRouterServiceProvider=J;rateLimiterServiceProvider=M;broadcastingsServiceProvider=$;loggingServiceProvider=W;queueServiceProvider=N;imageServiceProvider=B;cronServiceProvider=G;kernelIdServiceProvider=c;services={};booted=!1;boot(){this.services={[I._name]:new I(new this.emailServiceProvider),[g._name]:new g(new this.authenticationServiceProvider),[P._name]:new P(new this.middlewareServiceProvider),[A._name]:new A(new this.i18nServiceProvider),[y._name]:new y(new this.fileStorageServiceProvider),[b._name]:new b(new this.apiRouterServiceProvider),[f._name]:new f(new this.viewRouterServiceProvider),[h._name]:new h(new this.rateLimiterServiceProvider),[k._name]:new k(new this.broadcastingsServiceProvider),[p._name]:new p(new this.loggingServiceProvider),[R._name]:new R(new this.queueServiceProvider),[U._name]:new U(new this.imageServiceProvider),[u._name]:new u(new this.cronServiceProvider(this)),[S._name]:new S(new this.kernelIdServiceProvider)},this.booted=!0}run(e){let s=this.services;return w.run(s,e)}destroy(){for(let e of Object.keys(this.services))delete this.services[e];w.disable()}async waitForBoot(){if(!this.booted)await new Promise((e)=>{while(!this.booted)setTimeout(()=>{if(this.booted)e()},10)})}}class Q{prisma;constructor(e){this.prisma=e}async findUserByVerificationToken(e){return await this.prisma.user.findFirst({where:{verificationToken:e}})}async verifyUser(e){return await this.prisma.user.update({where:{email:e},data:{emailVerifiedAt:new Date}})}async createSessionV2(e){return await this.prisma.session.create({data:e,include:{user:{select:{password:!1,id:!0,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}}}}}})}async createSession(e){return await this.prisma.session.create({data:e,include:{user:!0}})}async createUser(e){return await this.prisma.user.create({data:e,omit:{password:!0}})}async deleteSession(e){return await this.prisma.session.deleteMany({where:{token:e.token}})}async findUserByEmailAddress(e,s){if(s)return await this.prisma.user.findUnique({where:{email:e,emailVerifiedAt:{not:null}}});return await this.prisma.user.findUnique({where:{email:e}})}async findSession(e){if(!e.token)return null;try{return await this.prisma.session.findUnique({where:{token:e.token,userAgent:e.userAgent},include:{user:{select:{password:!1,id:!0,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}}}}}})}catch(s){return console.log(s),null}}async updateSession(e){return await this.prisma.session.update({where:{token:e.token},data:{expiresAt:e.expiresAt},include:{user:{select:{id:!0,password:!1,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}},organization:!0}}}})}async updateUserPassword(e){return await this.prisma.user.update({where:{id:e.id},data:{password:e.password}})}async createPasswordResetToken(e){return await this.prisma.passwordResetToken.create({data:{user:{connect:{id:e.user.id}},token:e.token}})}async findPasswordResetToken(e){let{token:s}=e;return await this.prisma.passwordResetToken.findUnique({where:{token:s},include:{user:!0}})}async deleteAllUserSessions(e){return await this.prisma.session.deleteMany({where:{userId:e}})}async deletePasswordResetToken(e){let{token:s}=e;return await this.prisma.passwordResetToken.delete({where:{token:s}})}async createAccount(e){return await this.prisma.account.create({data:{organizationId:e.organizationId,organizationRole:e.organizationRole,userId:e.userId}})}async deleteInvitationById(e){return await this.prisma.organizationInvitation.delete({where:{publicId:e}})}async findInvitation(e,s){return await this.prisma.organizationInvitation.findFirst({where:{publicId:e,email:s}})}async createMagicLinkToken(e){return await this.prisma.magicLinkToken.create({data:{email:e.email,token:e.token,pin:e.pin}})}async findUserMagicLinkToken(e){let{token:s,pin:t,email:i}=e;if(s)return this.prisma.magicLinkToken.findUnique({where:{token_email:{email:i,token:s}}});else return await this.prisma.magicLinkToken.findUnique({where:{pin_email:{email:i,pin:t}}})}async deleteMagicLinkToken(e){return await this.prisma.magicLinkToken.deleteMany({where:{email:e}})}async createSocialAccount(e){return await this.prisma.socialAccount.create({data:e})}}export{Q as PrismaAuthenticationAdapter,H as Kernel,z as AuthenticationServiceProvider};
2
+ import{f as q}from"../chunk-b083b4re.js";import{g as k,i as y,j as p,k as z,l as U,m as P,n as S,o as f,p as b}from"../facades/index.js";import{C as g,D as h,x as L}from"../http/index.js";import{E as I}from"../chunk-6ws1z2r2.js";import{F as A}from"../chunk-q55gxfvs.js";import"../chunk-16hvsdc0.js";import{H as E,I as C,J as M,K as V,L as $,M as J,N as W,O as N,P as B,Q as G}from"../services/index.js";import"../chunk-ghy46jx3.js";import"../chunk-xtc1ej4p.js";import"../chunk-9fw11v51.js";import"../chunk-yc5bcdc2.js";import"../chunk-p4drhdbp.js";import"../chunk-xfcxaexm.js";import"../chunk-xrwqssps.js";import"../chunk-n5xvg37g.js";import{Ga as R}from"../chunk-ptm665mz.js";import{La as F}from"../chunk-9wcw99j8.js";import{Ma as w,Na as D}from"../chunk-ss3g2czb.js";import"../chunk-79f3dyfm.js";import"../chunk-qfy6gp4k.js";var X=async(e)=>e instanceof Promise?await e:e,l=async(e)=>{try{if(e)await X(e())}catch(s){}},Y=class e{name;cron;callback;onTick;onComplete;interval=null;next=null;status="stopped";parser;constructor(s){if(this.name=s.name,this.cron=s.cron,this.callback=l.bind(this,s.callback),this.onTick=l.bind(this,s.onTick),this.onComplete=l.bind(this,s.onComplete),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.destroy=this.destroy.bind(this),this.getStatus=this.getStatus.bind(this),this.isRunning=this.isRunning.bind(this),this.lastExecution=this.lastExecution.bind(this),this.nextExecution=this.nextExecution.bind(this),this.remaining=this.remaining.bind(this),this.time=this.time.bind(this),this.parser=new o(this.cron),s.start)this.start()}start(){if(this.status==="running")return;this.status="running",this.next=this.parser.getNext(),this.interval=setInterval(()=>{if(this.next&&this.next.getTime()<=Date.now())this.callback(),this.onTick(),this.next=this.parser.getNext()},1000)}stop(){if(this.status==="stopped")return;if(this.status="stopped",this.interval)clearInterval(this.interval)}destroy(){this.stop(),this.onComplete()}getStatus(){return this.status}isRunning(){return this.status==="running"}lastExecution(){return this.parser.getPrevious()}nextExecution(){return this.next||new Date}remaining(){return this.next?this.next.getTime()-Date.now():0}time(){return Date.now()}static create(s){return new e(s)}static parse(s){return new o(s).parse()}static getNext(s){return new o(s).getNext()}static getPrevious(s){return new o(s).getPrevious()}static isCron(s){try{return new o(s).parse(),!0}catch(t){return!1}}static isValid(s){return e.isCron(s)}},Z=Y,K=class e{crons=new Map;constructor(s={}){if(s.autoStart)this.bakeAll()}add(s){let t=Z.create(s);return this.crons.set(t.name,t),t}remove(s){let t=this.crons.get(s);if(t)t.destroy(),this.crons.delete(s)}bake(s){let t=this.crons.get(s);if(t)t.start()}stop(s){let t=this.crons.get(s);if(t)t.stop()}destroy(s){let t=this.crons.get(s);if(t)t.destroy(),this.crons.delete(s)}getStatus(s){let t=this.crons.get(s);return t?t.getStatus():"stopped"}isRunning(s){let t=this.crons.get(s);return t?t.isRunning():!1}lastExecution(s){let t=this.crons.get(s);return t?t.lastExecution():new Date}nextExecution(s){let t=this.crons.get(s);return t?t.nextExecution():new Date}remaining(s){let t=this.crons.get(s);return t?t.remaining():0}time(s){let t=this.crons.get(s);return t?t.time():0}bakeAll(){this.crons.forEach((s)=>s.start())}stopAll(){this.crons.forEach((s)=>s.stop())}destroyAll(){this.crons.forEach((s)=>s.destroy()),this.crons.clear()}static create(s={}){return new e(s)}},O=K,x=class{constructor(e){this.cron=e}aliases=new Map([["@every_second","* * * * * *"],["@every_minute","0 * * * * *"],["@yearly","0 0 1 1 * *"],["@annually","0 0 1 1 * *"],["@monthly","0 0 1 * * *"],["@weekly","0 0 * * 0 *"],["@daily","0 0 * * * *"],["@hourly","0 * * * * *"]]);parseEveryStr(e){let[,s,t]=e.split("_");switch(t){case"seconds":return`*/${s} * * * * *`;case"minutes":return`0 */${s} * * * *`;case"hours":return`0 0 */${s} * * *`;case"dayOfMonth":return`0 0 0 */${s} * *`;case"months":return`0 0 0 0 */${s} *`;case"dayOfWeek":return`0 0 0 0 0 */${s}`;default:return"* * * * * *"}}parseAtHourStr(e){let[,s]=e.split("_"),[t,i]=s.split(":");return`0 ${i} ${t} * * *`}parseOnDayStr(e){let[,s,t]=e.split("_");return`0 0 0 * * ${new Map([["sunday",1],["monday",2],["tuesday",3],["wednesday",4],["thursday",5],["friday",6],["saturday",7]]).get(s)}`}parseBetweenStr(e){let[,s,t]=e.split("_");return`0 0 ${s}-${t} * * *`}parseStr(e){if(this.aliases.has(e))return this.aliases.get(e)||"";if(e.includes("@every_"))return this.parseEveryStr(e);if(e.includes("@at_"))return this.parseAtHourStr(e);if(e.includes("@on_"))return this.parseOnDayStr(e);if(e.includes("@between_"))return this.parseBetweenStr(e);return e}parse(){this.cron=this.parseStr(this.cron);let[e,s,t,i,r,a]=this.cron.split(" ");return{second:this.parseCronTime(e,0,59),minute:this.parseCronTime(s,0,59),hour:this.parseCronTime(t,0,23),dayOfMonth:this.parseCronTime(i,1,31),month:this.parseCronTime(r,1,12),dayOfWeek:this.parseCronTime(a,0,6)}}getNext(){let e=this.parse(),s=new Date,t=new Date(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds());t.setMilliseconds(0),t.setSeconds(t.getSeconds()+1);while(!this.checkCronTime(e,t))t.setSeconds(t.getSeconds()+1);return t}getPrevious(){let e=this.parse(),s=new Date,t=new Date(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds());t.setMilliseconds(0),t.setSeconds(t.getSeconds()-1);while(!this.checkCronTime(e,t))t.setSeconds(t.getSeconds()-1);return t}parseCronTime(e,s,t){let i=[];switch(!0){case e==="*":for(let r=s;r<=t;r++)i.push(r);break;case e.includes("-"):{let[r,a]=e.split("-"),d=this.getStep(e);for(let n=parseInt(r);n<=parseInt(a);n+=d)i.push(n);break}case e.includes("/"):{let[r,a]=e.split("/"),d=r==="*"?s:parseInt(r);for(let n=d;n<=t;n+=parseInt(a))i.push(n);break}case e.includes(","):{let r=e.split(",");for(let a=0;a<r.length;a++)i.push(parseInt(r[a]));break}default:i.push(parseInt(e));break}return i}getStep(e){let[,s]=e.split("/"),t=parseInt(s);return isNaN(t)?1:t}checkCronTime(e,s){if(e.second&&!e.second.includes(s.getSeconds()))return!1;if(e.minute&&!e.minute.includes(s.getMinutes()))return!1;if(e.hour&&!e.hour.includes(s.getHours()))return!1;if(e.dayOfMonth&&!e.dayOfMonth.includes(s.getDate()))return!1;if(e.month&&!e.month.includes(s.getMonth()+1))return!1;else if(e.dayOfWeek&&!e.dayOfWeek.includes(s.getDay()))return!1;return!0}},o=x,j=O;class u extends D{service;static _name="CronServiceContainer";constructor(e){super();this.service=e;if(this.service.jobs.length===0)return;let s=j.create({autoStart:!0}),t=async(i)=>{return await this.service.kernel.waitForBoot.call(this.service.kernel),await this.service.kernel.run.call(this.service.kernel,i)};for(let i of this.service.jobs){let r=new i;if(!r.name){console.error(`Cron job must have a name. Job: ${JSON.stringify(r)}`);continue}if(!r.cron){console.error(`Cron job must have an expression. Job: ${r.name}`);continue}s.add({name:r.name,cron:r.cron,callback:()=>t(async()=>{try{await r.callback.call(r)}catch(a){console.error(`Error in cron job ${r.name}:`,a)}}),onComplete:()=>t(async()=>{try{await r.onComplete.call(r)}catch(a){console.error(`Error completing cron job ${r.name}:`,a)}}),onTick:()=>t(async()=>{try{await r.onTick.call(r)}catch(a){console.error(`Error executing cron job ${r.name}:`,a)}})})}s.bakeAll()}}class c extends F{id=crypto.randomUUID();boot(){}}class H{emailServiceProvider=V;authenticationServiceProvider=z;middlewareServiceProvider=L;i18nServiceProvider=q;fileStorageServiceProvider=E;apiRouterServiceProvider=C;viewRouterServiceProvider=J;rateLimiterServiceProvider=M;broadcastingsServiceProvider=$;loggingServiceProvider=W;queueServiceProvider=N;imageServiceProvider=B;cronServiceProvider=G;kernelIdServiceProvider=c;services={};booted=!1;boot(){this.services={[I._name]:new I(new this.emailServiceProvider),[g._name]:new g(new this.authenticationServiceProvider),[P._name]:new P(new this.middlewareServiceProvider),[A._name]:new A(new this.i18nServiceProvider),[y._name]:new y(new this.fileStorageServiceProvider),[b._name]:new b(new this.apiRouterServiceProvider),[f._name]:new f(new this.viewRouterServiceProvider),[h._name]:new h(new this.rateLimiterServiceProvider),[k._name]:new k(new this.broadcastingsServiceProvider),[p._name]:new p(new this.loggingServiceProvider),[R._name]:new R(new this.queueServiceProvider),[U._name]:new U(new this.imageServiceProvider),[u._name]:new u(new this.cronServiceProvider(this)),[S._name]:new S(new this.kernelIdServiceProvider)},this.booted=!0}run(e){let s=this.services;return w.run(s,e)}destroy(){for(let e of Object.keys(this.services))delete this.services[e];w.disable()}async waitForBoot(){if(!this.booted)await new Promise((e)=>{while(!this.booted)setTimeout(()=>{if(this.booted)e()},10)})}}class Q{prisma;constructor(e){this.prisma=e}async findUserByVerificationToken(e){return await this.prisma.user.findFirst({where:{verificationToken:e}})}async verifyUser(e){return await this.prisma.user.update({where:{email:e},data:{emailVerifiedAt:new Date}})}async createSessionV2(e){return await this.prisma.session.create({data:e,include:{user:{select:{password:!1,id:!0,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}}}}}})}async createSession(e){return await this.prisma.session.create({data:e,include:{user:!0}})}async createUser(e){return await this.prisma.user.create({data:e,omit:{password:!0}})}async deleteSession(e){return await this.prisma.session.deleteMany({where:{token:e.token}})}async findUserByEmailAddress(e,s){if(s)return await this.prisma.user.findUnique({where:{email:e,emailVerifiedAt:{not:null}}});return await this.prisma.user.findUnique({where:{email:e}})}async findSession(e){if(!e.token)return null;try{return await this.prisma.session.findUnique({where:{token:e.token,userAgent:e.userAgent},include:{user:{select:{password:!1,id:!0,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}}}}}})}catch(s){return console.log(s),null}}async updateSession(e){return await this.prisma.session.update({where:{token:e.token},data:{expiresAt:e.expiresAt},include:{user:{select:{id:!0,password:!1,email:!0,globalRole:!0,name:!0,locale:!0,publicId:!0,accounts:{select:{id:!0,publicId:!0,organization:!0,organizationRole:!0}},organization:!0}}}})}async updateUserPassword(e){return await this.prisma.user.update({where:{id:e.id},data:{password:e.password}})}async createPasswordResetToken(e){return await this.prisma.passwordResetToken.create({data:{user:{connect:{id:e.user.id}},token:e.token}})}async findPasswordResetToken(e){let{token:s}=e;return await this.prisma.passwordResetToken.findUnique({where:{token:s},include:{user:!0}})}async deleteAllUserSessions(e){return await this.prisma.session.deleteMany({where:{userId:e}})}async deletePasswordResetToken(e){let{token:s}=e;return await this.prisma.passwordResetToken.delete({where:{token:s}})}async createAccount(e){return await this.prisma.account.create({data:{organizationId:e.organizationId,organizationRole:e.organizationRole,userId:e.userId}})}async deleteInvitationById(e){return await this.prisma.organizationInvitation.delete({where:{publicId:e}})}async findInvitation(e,s){return await this.prisma.organizationInvitation.findFirst({where:{publicId:e,email:s}})}async createMagicLinkToken(e){return await this.prisma.magicLinkToken.create({data:{email:e.email,token:e.token,pin:e.pin}})}async findUserMagicLinkToken(e){let{token:s,pin:t,email:i}=e;if(s)return this.prisma.magicLinkToken.findUnique({where:{token_email:{email:i,token:s}}});else return await this.prisma.magicLinkToken.findUnique({where:{pin_email:{email:i,pin:t}}})}async deleteMagicLinkToken(e){return await this.prisma.magicLinkToken.deleteMany({where:{email:e}})}async createSocialAccount(e){return await this.prisma.socialAccount.create({data:e})}}export{Q as PrismaAuthenticationAdapter,H as Kernel,z as AuthenticationServiceProvider};
3
3
 
4
4
  //# debugId=8C24826F6939CE6F64756E2164756E21
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{R as J4,S as M4,T as X4}from"../chunk-ghy46jx3.js";import{$ as rJ,U as e$,V as Ih,W as h8,X as e7,Y as LR,Z as aJ,_ as iJ,aa as t$,ba as QY,ca as LY,da as pJ,ea as m4,fa as oJ,ga as rR,ha as xJ,ia as c4,ja as kJ,ka as lJ,la as sJ,ma as _J,na as dJ}from"../chunk-xtc1ej4p.js";import{oa as bJ,pa as mJ}from"../chunk-9fw11v51.js";import{ra as NJ}from"../chunk-yc5bcdc2.js";import{Aa as g1,Ca as Jf,sa as Vf,ta as C7,va as n$,wa as CJ,ya as cJ,za as I4}from"../chunk-p4drhdbp.js";import"../chunk-xfcxaexm.js";import{Ea as t7}from"../chunk-xrwqssps.js";import{Fa as H4}from"../chunk-n5xvg37g.js";import{Ga as rH}from"../chunk-ptm665mz.js";import{Ka as B$,La as r}from"../chunk-13sdtj3f.js";import"../chunk-ss3g2czb.js";import{Oa as m7}from"../chunk-79f3dyfm.js";import{Pa as M,Qa as s,Ra as BR}from"../chunk-qfy6gp4k.js";var YU=s((MB,HU)=>{var gM=function(R){return CM(R)&&!mM(R)};function CM(f){return!!f&&typeof f==="object"}function mM(f){var R=Object.prototype.toString.call(f);return R==="[object RegExp]"||R==="[object Date]"||xM(f)}var cM=typeof Symbol==="function"&&Symbol.for,bM=cM?Symbol.for("react.element"):60103;function xM(f){return f.$$typeof===bM}function kM(f){return Array.isArray(f)?[]:{}}function R1(f,R){return R.clone!==!1&&R.isMergeableObject(f)?W0(kM(f),f,R):f}function lM(f,R,h){return f.concat(R).map(function($){return R1($,h)})}function sM(f,R){if(!R.customMerge)return W0;var h=R.customMerge(f);return typeof h==="function"?h:W0}function _M(f){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(f).filter(function(R){return Object.propertyIsEnumerable.call(f,R)}):[]}function NU(f){return Object.keys(f).concat(_M(f))}function UU(f,R){try{return R in f}catch(h){return!1}}function dM(f,R){return UU(f,R)&&!(Object.hasOwnProperty.call(f,R)&&Object.propertyIsEnumerable.call(f,R))}function aM(f,R,h){var $={};if(h.isMergeableObject(f))NU(f).forEach(function(G){$[G]=R1(f[G],h)});return NU(R).forEach(function(G){if(dM(f,G))return;if(UU(f,G)&&h.isMergeableObject(R[G]))$[G]=sM(G,h)(f[G],R[G],h);else $[G]=R1(R[G],h)}),$}function W0(f,R,h){h=h||{},h.arrayMerge=h.arrayMerge||lM,h.isMergeableObject=h.isMergeableObject||gM,h.cloneUnlessOtherwiseSpecified=R1;var $=Array.isArray(R),G=Array.isArray(f),A=$===G;if(!A)return R1(R,h);else if($)return h.arrayMerge(f,R,h);else return aM(f,R,h)}W0.all=function(R,h){if(!Array.isArray(R))throw Error("first argument should be an array");return R.reduce(function($,G){return W0($,G,h)},{})};var iM=W0;HU.exports=iM});var H$=s((xX,jU)=>{function $f(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}$f.prototype.clone_empty=function(){var f=new $f(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f};$f.prototype.item=function(f){if(f<0)return this.__items[this.__items.length+f];else return this.__items[f]};$f.prototype.has_match=function(f){for(var R=this.__items.length-1;R>=0;R--)if(this.__items[R].match(f))return!0;return!1};$f.prototype.set_indent=function(f,R){if(this.is_empty())this.__indent_count=f||0,this.__alignment_count=R||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count)};$f.prototype._set_wrap_point=function(){if(this.__parent.wrap_line_length)this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count};$f.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};$f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;if(f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" ")f.__items.splice(0,1),f.__character_count-=1;return!0}return!1};$f.prototype.is_empty=function(){return this.__items.length===0};$f.prototype.last=function(){if(!this.is_empty())return this.__items[this.__items.length-1];else return null};$f.prototype.push=function(f){this.__items.push(f);var R=f.lastIndexOf(`
2
+ import{R as J4,S as M4,T as X4}from"../chunk-ghy46jx3.js";import{$ as rJ,U as e$,V as Ih,W as h8,X as e7,Y as LR,Z as aJ,_ as iJ,aa as t$,ba as QY,ca as LY,da as pJ,ea as m4,fa as oJ,ga as rR,ha as xJ,ia as c4,ja as kJ,ka as lJ,la as sJ,ma as _J,na as dJ}from"../chunk-xtc1ej4p.js";import{oa as bJ,pa as mJ}from"../chunk-9fw11v51.js";import{ra as NJ}from"../chunk-yc5bcdc2.js";import{Aa as g1,Ca as Jf,sa as Vf,ta as C7,va as n$,wa as CJ,ya as cJ,za as I4}from"../chunk-p4drhdbp.js";import"../chunk-xfcxaexm.js";import{Ea as t7}from"../chunk-xrwqssps.js";import{Fa as H4}from"../chunk-n5xvg37g.js";import{Ga as rH}from"../chunk-ptm665mz.js";import{Ka as B$,La as r}from"../chunk-9wcw99j8.js";import"../chunk-ss3g2czb.js";import{Oa as m7}from"../chunk-79f3dyfm.js";import{Pa as M,Qa as s,Ra as BR}from"../chunk-qfy6gp4k.js";var YU=s((MB,HU)=>{var gM=function(R){return CM(R)&&!mM(R)};function CM(f){return!!f&&typeof f==="object"}function mM(f){var R=Object.prototype.toString.call(f);return R==="[object RegExp]"||R==="[object Date]"||xM(f)}var cM=typeof Symbol==="function"&&Symbol.for,bM=cM?Symbol.for("react.element"):60103;function xM(f){return f.$$typeof===bM}function kM(f){return Array.isArray(f)?[]:{}}function R1(f,R){return R.clone!==!1&&R.isMergeableObject(f)?W0(kM(f),f,R):f}function lM(f,R,h){return f.concat(R).map(function($){return R1($,h)})}function sM(f,R){if(!R.customMerge)return W0;var h=R.customMerge(f);return typeof h==="function"?h:W0}function _M(f){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(f).filter(function(R){return Object.propertyIsEnumerable.call(f,R)}):[]}function NU(f){return Object.keys(f).concat(_M(f))}function UU(f,R){try{return R in f}catch(h){return!1}}function dM(f,R){return UU(f,R)&&!(Object.hasOwnProperty.call(f,R)&&Object.propertyIsEnumerable.call(f,R))}function aM(f,R,h){var $={};if(h.isMergeableObject(f))NU(f).forEach(function(G){$[G]=R1(f[G],h)});return NU(R).forEach(function(G){if(dM(f,G))return;if(UU(f,G)&&h.isMergeableObject(R[G]))$[G]=sM(G,h)(f[G],R[G],h);else $[G]=R1(R[G],h)}),$}function W0(f,R,h){h=h||{},h.arrayMerge=h.arrayMerge||lM,h.isMergeableObject=h.isMergeableObject||gM,h.cloneUnlessOtherwiseSpecified=R1;var $=Array.isArray(R),G=Array.isArray(f),A=$===G;if(!A)return R1(R,h);else if($)return h.arrayMerge(f,R,h);else return aM(f,R,h)}W0.all=function(R,h){if(!Array.isArray(R))throw Error("first argument should be an array");return R.reduce(function($,G){return W0($,G,h)},{})};var iM=W0;HU.exports=iM});var H$=s((xX,jU)=>{function $f(f){this.__parent=f,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}$f.prototype.clone_empty=function(){var f=new $f(this.__parent);return f.set_indent(this.__indent_count,this.__alignment_count),f};$f.prototype.item=function(f){if(f<0)return this.__items[this.__items.length+f];else return this.__items[f]};$f.prototype.has_match=function(f){for(var R=this.__items.length-1;R>=0;R--)if(this.__items[R].match(f))return!0;return!1};$f.prototype.set_indent=function(f,R){if(this.is_empty())this.__indent_count=f||0,this.__alignment_count=R||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count)};$f.prototype._set_wrap_point=function(){if(this.__parent.wrap_line_length)this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count};$f.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};$f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var f=this.__parent.current_line;if(f.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),f.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),f.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,f.__items[0]===" ")f.__items.splice(0,1),f.__character_count-=1;return!0}return!1};$f.prototype.is_empty=function(){return this.__items.length===0};$f.prototype.last=function(){if(!this.is_empty())return this.__items[this.__items.length-1];else return null};$f.prototype.push=function(f){this.__items.push(f);var R=f.lastIndexOf(`
3
3
  `);if(R!==-1)this.__character_count=f.length-R;else this.__character_count+=f.length};$f.prototype.pop=function(){var f=null;if(!this.is_empty())f=this.__items.pop(),this.__character_count-=f.length;return f};$f.prototype._remove_indent=function(){if(this.__indent_count>0)this.__indent_count-=1,this.__character_count-=this.__parent.indent_size};$f.prototype._remove_wrap_indent=function(){if(this.__wrap_point_indent_count>0)this.__wrap_point_indent_count-=1};$f.prototype.trim=function(){while(this.last()===" ")this.__items.pop(),this.__character_count-=1};$f.prototype.toString=function(){var f="";if(this.is_empty()){if(this.__parent.indent_empty_lines)f=this.__parent.get_indent_string(this.__indent_count)}else f=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),f+=this.__items.join("");return f};function h1(f,R){if(this.__cache=[""],this.__indent_size=f.indent_size,this.__indent_string=f.indent_char,!f.indent_with_tabs)this.__indent_string=Array(f.indent_size+1).join(f.indent_char);if(R=R||"",f.indent_level>0)R=Array(f.indent_level+1).join(this.__indent_string);this.__base_string=R,this.__base_string_length=R.length}h1.prototype.get_indent_size=function(f,R){var h=this.__base_string_length;if(R=R||0,f<0)h=0;return h+=f*this.__indent_size,h+=R,h};h1.prototype.get_indent_string=function(f,R){var h=this.__base_string;if(R=R||0,f<0)f=0,h="";return R+=f*this.__indent_size,this.__ensure_cache(R),h+=this.__cache[R],h};h1.prototype.__ensure_cache=function(f){while(f>=this.__cache.length)this.__add_column()};h1.prototype.__add_column=function(){var f=this.__cache.length,R=0,h="";if(this.__indent_size&&f>=this.__indent_size)R=Math.floor(f/this.__indent_size),f-=R*this.__indent_size,h=Array(R+1).join(this.__indent_string);if(f)h+=Array(f+1).join(" ");this.__cache.push(h)};function Gf(f,R){this.__indent_cache=new h1(f,R),this.raw=!1,this._end_with_newline=f.end_with_newline,this.indent_size=f.indent_size,this.wrap_line_length=f.wrap_line_length,this.indent_empty_lines=f.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new $f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}Gf.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)};Gf.prototype.get_line_number=function(){return this.__lines.length};Gf.prototype.get_indent_string=function(f,R){return this.__indent_cache.get_indent_string(f,R)};Gf.prototype.get_indent_size=function(f,R){return this.__indent_cache.get_indent_size(f,R)};Gf.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()};Gf.prototype.add_new_line=function(f){if(this.is_empty()||!f&&this.just_added_newline())return!1;if(!this.raw)this.__add_outputline();return!0};Gf.prototype.get_code=function(f){this.trim(!0);var R=this.current_line.pop();if(R){if(R[R.length-1]===`
4
4
  `)R=R.replace(/\n+$/g,"");this.current_line.push(R)}if(this._end_with_newline)this.__add_outputline();var h=this.__lines.join(`
5
5
  `);if(f!==`
@@ -1 +1 @@
1
- {"version":3,"file":"applyParams.d.ts","sourceRoot":"","sources":["../../utils/applyParams.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAClD,MAAM,CAqBR"}
1
+ {"version":3,"file":"applyParams.d.ts","sourceRoot":"","sources":["../../utils/applyParams.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAClD,MAAM,CA0BR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.28.3",
3
+ "version": "0.28.5",
4
4
  "author": "Enes Tufekci <enes@gemijs.dev>",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
@@ -1,5 +0,0 @@
1
- // @bun
2
- var l="GEMI_REQUEST_BREAKER_ERROR";class a extends Error{kind="GEMI_REQUEST_BREAKER_ERROR";payload={api:{},view:{}}}function c(r,t){return r.replace(/:([^/]+[*?]?)/g,(i,e)=>{let s=e.endsWith("?")||e.endsWith("*"),n=s?e.slice(0,-1):e,o=t[n];if(o===void 0){if(s)return"";if(import.meta.env.DEV)throw Error(`Missing parameter: ${n}`);console.error(`Missing parameter: ${n} in URL: ${r}`)}return String(o)}).replace(/\/\//g,"/")}class R extends a{constructor(r,t=307){super("Redirect error");this.name="RedirectError",this.payload={api:{status:200,data:{},directive:{kind:"Redirect",path:r}},view:{status:t,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:r}}}}}class p{static to(r,...t){let[i={}]=t,{search:e={},params:s={},permanent:n,status:o}={params:{},status:307,permanent:!1,...i},d=new URLSearchParams(e).toString();throw new R([c(r,s),d.toString()].filter(Boolean).join("?"),o??(n?301:307))}}class E{}
3
- export{l as Ha,a as Ia,c as Ja,p as Ka,E as La};
4
-
5
- //# debugId=83B04748E7F3853664756E2164756E21