gemi 0.40.1 → 0.41.0

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.
Files changed (39) hide show
  1. package/dist/app/index.js +1 -1
  2. package/dist/app/prismaExtension.d.ts +1 -5
  3. package/dist/app/prismaExtension.d.ts.map +1 -1
  4. package/dist/bin/gemi.js +171 -6641
  5. package/dist/bin/gemi.js.map +7 -7
  6. package/dist/{chunk-fs8zhe24.js → chunk-1skcvfwy.js} +1 -1
  7. package/dist/{chunk-0xabjqdt.js → chunk-59dfj0a9.js} +1 -1
  8. package/dist/{chunk-34bhbqbh.js → chunk-5a4hvpbv.js} +1 -1
  9. package/dist/{chunk-he4nzstf.js → chunk-8egdqsbr.js} +1 -1
  10. package/dist/{chunk-pca557td.js → chunk-8spbzsaa.js} +1 -1
  11. package/dist/{chunk-71e1rmh4.js → chunk-9gj1htjp.js} +2 -2
  12. package/dist/chunk-j7harkz1.js +6 -0
  13. package/dist/{chunk-py00anah.js.map → chunk-j7harkz1.js.map} +2 -2
  14. package/dist/{chunk-b2f631nw.js → chunk-k5ddt5jb.js} +1 -1
  15. package/dist/chunk-th24m9jj.js +4 -0
  16. package/dist/chunk-th24m9jj.js.map +13 -0
  17. package/dist/{chunk-8zrzjvj8.js → chunk-w102mcq7.js} +2 -2
  18. package/dist/{chunk-8zrzjvj8.js.map → chunk-w102mcq7.js.map} +1 -1
  19. package/dist/{chunk-tgrnmmg5.js → chunk-w262fkzb.js} +1 -1
  20. package/dist/config/index.d.ts +15 -0
  21. package/dist/config/index.d.ts.map +1 -0
  22. package/dist/config/load.d.ts +3 -0
  23. package/dist/config/load.d.ts.map +1 -0
  24. package/dist/kernel/index.js +1 -1
  25. package/dist/server/httpDev.d.ts.map +1 -1
  26. package/dist/server/index.js +1 -1
  27. package/dist/services/index.js +1 -1
  28. package/package.json +6 -29
  29. package/dist/chunk-hq4yhfaq.js +0 -274
  30. package/dist/chunk-hq4yhfaq.js.map +0 -15
  31. package/dist/chunk-py00anah.js +0 -6
  32. /package/dist/{chunk-fs8zhe24.js.map → chunk-1skcvfwy.js.map} +0 -0
  33. /package/dist/{chunk-0xabjqdt.js.map → chunk-59dfj0a9.js.map} +0 -0
  34. /package/dist/{chunk-34bhbqbh.js.map → chunk-5a4hvpbv.js.map} +0 -0
  35. /package/dist/{chunk-he4nzstf.js.map → chunk-8egdqsbr.js.map} +0 -0
  36. /package/dist/{chunk-pca557td.js.map → chunk-8spbzsaa.js.map} +0 -0
  37. /package/dist/{chunk-71e1rmh4.js.map → chunk-9gj1htjp.js.map} +0 -0
  38. /package/dist/{chunk-b2f631nw.js.map → chunk-k5ddt5jb.js.map} +0 -0
  39. /package/dist/{chunk-tgrnmmg5.js.map → chunk-w262fkzb.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{sb as ue}from"./chunk-37qn44wf.js";import{ub as _}from"./chunk-e7wdb957.js";import"./chunk-7219pj06.js";import{wb as w}from"./chunk-xxdb06dz.js";import{xb as l}from"./chunk-e40j5tgj.js";import{Kb as o,Nb as d}from"./chunk-cy0yet3t.js";var g=o(_(),1);var ie=o(l(),1);var O=o(w(),1),R=o(l(),1),J=o(_(),1);var j=o(w(),1),E=o(l(),1),U=(e,s,t)=>{let n={EcsContainer:async(r)=>{let{fromHttp:a}=await import("./chunk-xdsym1c8.js"),{fromContainerMetadata:c}=await import("./chunk-ar3kj71m.js");return t?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>E.chain(a(r??{}),c(r))().then(L)},Ec2InstanceMetadata:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:a}=await import("./chunk-ar3kj71m.js");return async()=>a(r)().then(L)},Environment:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:a}=await import("./chunk-1wv2m67p.js");return async()=>a(r)().then(L)}};if(e in n)return n[e];else throw new E.CredentialsProviderError(`Unsupported credential source in profile ${s}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:t})},L=(e)=>j.setCredentialFeature(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");var N=(e,{profile:s="default",logger:t}={})=>{return Boolean(e)&&typeof e==="object"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(he(e,{profile:s,logger:t})||ye(e,{profile:s,logger:t}))},he=(e,{profile:s,logger:t})=>{let n=typeof e.source_profile==="string"&&typeof e.credential_source>"u";if(n)t?.debug?.(` ${s} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`);return n},ye=(e,{profile:s,logger:t})=>{let n=typeof e.credential_source==="string"&&typeof e.source_profile>"u";if(n)t?.debug?.(` ${s} isCredentialSourceProfile credential_source=${e.credential_source}`);return n},v=async(e,s,t,n,r={},a)=>{t.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let c=s[e],{source_profile:h,region:I}=c;if(!t.roleAssumer){let{getDefaultRoleAssumer:i}=await import("./chunk-0xabjqdt.js").then((m)=>o(m.default,1));t.roleAssumer=i({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...n,...t?.parentClientConfig,region:I??t?.parentClientConfig?.region??n?.region}},t.clientPlugins)}if(h&&h in r)throw new R.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${J.getProfileName(t)}. Profiles visited: `+Object.keys(r).join(", "),{logger:t.logger});t.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${h?`source_profile=[${h}]`:`profile=[${e}]`}`);let T=h?a(h,s,t,n,{...r,[h]:!0},G(s[h]??{})):(await U(c.credential_source,e,t.logger)(t))();if(G(c))return T.then((i)=>O.setCredentialFeature(i,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));else{let i={RoleArn:c.role_arn,RoleSessionName:c.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:c.external_id,DurationSeconds:parseInt(c.duration_seconds||"3600",10)},{mfa_serial:u}=c;if(u){if(!t.mfaCodeProvider)throw new R.CredentialsProviderError(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:t.logger,tryNextLink:!1});i.SerialNumber=u,i.TokenCode=await t.mfaCodeProvider(u)}let y=await T;return t.roleAssumer(y,i).then((m)=>O.setCredentialFeature(m,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},G=(e)=>{return!e.role_arn&&!!e.credential_source};var V=o(w(),1);var C=o(w(),1),X=o(l(),1),K=o(_(),1);var k=o(l(),1),W=o(ue(),1),z=o(_(),1);import{createHash as de,createPrivateKey as we,createPublicKey as ke,sign as me}from"crypto";import{promises as D}from"fs";import{homedir as fe}from"os";import{dirname as Ie,join as Y}from"path";class b{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,s,t){this.profileData=e,this.init=s,this.callerClientConfig=t}async loadCredentials(){let e=await this.loadToken();if(!e)throw new k.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let s=e.accessToken,t=Date.now();if(new Date(s.expiresAt).getTime()-t<=b.REFRESH_THRESHOLD)return this.refresh(e);return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,sessionToken:s.sessionToken,accountId:s.accountId,expiration:new Date(s.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(e){let{SigninClient:s,CreateOAuth2TokenCommand:t}=await import("./chunk-34bhbqbh.js").then((m)=>o(m.default,1)),{logger:n,userAgentAppId:r}=this.callerClientConfig??{},c=((i)=>{return i?.metadata?.handlerProtocol==="h2"})(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,h=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,I=new s({credentials:{accessKeyId:"",secretAccessKey:""},region:h,requestHandler:c,logger:n,userAgentAppId:r,...this.init?.clientConfig});this.createDPoPInterceptor(I.middlewareStack);let T={tokenInput:{clientId:e.clientId,refreshToken:e.refreshToken,grantType:"refresh_token"}};try{let i=await I.send(new t(T)),{accessKeyId:u,secretAccessKey:y,sessionToken:m}=i.tokenOutput?.accessToken??{},{refreshToken:x,expiresIn:H}=i.tokenOutput??{};if(!u||!y||!m||!x)throw new k.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let A=(H??900)*1000,f=new Date(Date.now()+A),q={...e,accessToken:{...e.accessToken,accessKeyId:u,secretAccessKey:y,sessionToken:m,expiresAt:f.toISOString()},refreshToken:x};await this.saveToken(q);let S=q.accessToken;return{accessKeyId:S.accessKeyId,secretAccessKey:S.secretAccessKey,sessionToken:S.sessionToken,accountId:S.accountId,expiration:f}}catch(i){if(i.name==="AccessDeniedException"){let u=i.error,y;switch(u){case"TOKEN_EXPIRED":y="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":y="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":y="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:y=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new k.CredentialsProviderError(y,{logger:this.logger,tryNextLink:!1})}throw new k.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let s;try{s=await z.readFile(e,{ignoreCache:this.init?.ignoreCache})}catch{s=await D.readFile(e,"utf8")}let t=JSON.parse(s),n=["accessToken","clientId","refreshToken","dpopKey"].filter((r)=>!t[r]);if(!t.accessToken?.accountId)n.push("accountId");if(n.length>0)throw new k.CredentialsProviderError(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return t}catch(s){throw new k.CredentialsProviderError(`Failed to load token from ${e}: ${String(s)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let s=this.getTokenFilePath(),t=Ie(s);try{await D.mkdir(t,{recursive:!0})}catch(n){}await D.writeFile(s,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??Y(fe(),".aws","login","cache"),s=Buffer.from(this.loginSession,"utf8"),t=de("sha256").update(s).digest("hex");return Y(e,`${t}.json`)}derToRawSignature(e){let s=2;if(e[s]!==2)throw Error("Invalid DER signature");s++;let t=e[s++],n=e.subarray(s,s+t);if(s+=t,e[s]!==2)throw Error("Invalid DER signature");s++;let r=e[s++],a=e.subarray(s,s+r);n=n[0]===0?n.subarray(1):n,a=a[0]===0?a.subarray(1):a;let c=Buffer.concat([Buffer.alloc(32-n.length),n]),h=Buffer.concat([Buffer.alloc(32-a.length),a]);return Buffer.concat([c,h])}createDPoPInterceptor(e){e.add((s)=>async(t)=>{if(W.HttpRequest.isInstance(t.request)){let n=t.request,r=`${n.protocol}//${n.hostname}${n.port?`:${n.port}`:""}${n.path}`,a=await this.generateDpop(n.method,r);n.headers={...n.headers,DPoP:a}}return s(t)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",s){let t=await this.loadToken();try{let n=we({key:t.dpopKey,format:"pem",type:"sec1"}),a=ke(n).export({format:"der",type:"spki"}),c=-1;for(let f=0;f<a.length;f++)if(a[f]===4){c=f;break}let h=a.slice(c+1,c+33),I=a.slice(c+33,c+65),T={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:h.toString("base64url"),y:I.toString("base64url")}},i={jti:crypto.randomUUID(),htm:e,htu:s,iat:Math.floor(Date.now()/1000)},u=Buffer.from(JSON.stringify(T)).toString("base64url"),y=Buffer.from(JSON.stringify(i)).toString("base64url"),m=`${u}.${y}`,x=me("sha256",Buffer.from(m),n),A=this.derToRawSignature(x).toString("base64url");return`${m}.${A}`}catch(n){throw new k.CredentialsProviderError(`Failed to generate Dpop proof: ${n instanceof Error?n.message:String(n)}`,{logger:this.logger,tryNextLink:!1})}}}var Q=(e)=>async({callerClientConfig:s}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let t=await K.parseKnownFiles(e||{}),n=K.getProfileName({profile:e?.profile??s?.profile}),r=t[n];if(!r?.login_session)throw new X.CredentialsProviderError(`Profile ${n} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let c=await new b(r,e,s).loadCredentials();return C.setCredentialFeature(c,"CREDENTIALS_LOGIN","AD")};var Z=(e)=>{return Boolean(e&&e.login_session)},M=async(e,s,t)=>{let n=await Q({...s,profile:e})({callerClientConfig:t});return V.setCredentialFeature(n,"CREDENTIALS_PROFILE_LOGIN","AC")};var p=o(w(),1),ee=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.credential_process==="string",te=async(e,s)=>import("./chunk-gky8x4rv.js").then(({fromProcess:t})=>t({...e,profile:s})().then((n)=>p.setCredentialFeature(n,"CREDENTIALS_PROFILE_PROCESS","v")));var $=o(w(),1),se=async(e,s,t={},n)=>{let{fromSSO:r}=await import("./chunk-b2f631nw.js");return r({profile:e,logger:t.logger,parentClientConfig:t.parentClientConfig,clientConfig:t.clientConfig})({callerClientConfig:n}).then((a)=>{if(s.sso_session)return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO","r");else return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO_LEGACY","t")})},ne=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var ce=o(w(),1),P=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.aws_access_key_id==="string"&&typeof e.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,F=async(e,s)=>{s?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let t={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return ce.setCredentialFeature(t,"CREDENTIALS_PROFILE","n")};var re=o(w(),1),ae=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.web_identity_token_file==="string"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,oe=async(e,s,t)=>import("./chunk-pca557td.js").then(({fromTokenFile:n})=>n({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:s.roleAssumerWithWebIdentity,logger:s.logger,parentClientConfig:s.parentClientConfig})({callerClientConfig:t}).then((r)=>re.setCredentialFeature(r,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")));var B=async(e,s,t,n,r={},a=!1)=>{let c=s[e];if(Object.keys(r).length>0&&P(c))return F(c,t);if(a||N(c,{profile:e,logger:t.logger}))return v(e,s,t,n,r,B);if(P(c))return F(c,t);if(ae(c))return oe(c,t,n);if(ee(c))return te(t,e);if(ne(c))return await se(e,c,t,n);if(Z(c))return M(e,t,n);throw new ie.CredentialsProviderError(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:t.logger})};var Ne=(e={})=>async({callerClientConfig:s}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let t=await g.parseKnownFiles(e);return B(g.getProfileName({profile:e.profile??s?.profile}),t,e,s)};export{Ne as fromIni};
2
+ import{sb as ue}from"./chunk-37qn44wf.js";import{ub as _}from"./chunk-e7wdb957.js";import"./chunk-7219pj06.js";import{wb as w}from"./chunk-xxdb06dz.js";import{xb as l}from"./chunk-e40j5tgj.js";import{Kb as o,Nb as d}from"./chunk-cy0yet3t.js";var g=o(_(),1);var ie=o(l(),1);var O=o(w(),1),R=o(l(),1),J=o(_(),1);var j=o(w(),1),E=o(l(),1),U=(e,s,t)=>{let n={EcsContainer:async(r)=>{let{fromHttp:a}=await import("./chunk-xdsym1c8.js"),{fromContainerMetadata:c}=await import("./chunk-ar3kj71m.js");return t?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>E.chain(a(r??{}),c(r))().then(L)},Ec2InstanceMetadata:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:a}=await import("./chunk-ar3kj71m.js");return async()=>a(r)().then(L)},Environment:async(r)=>{t?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:a}=await import("./chunk-1wv2m67p.js");return async()=>a(r)().then(L)}};if(e in n)return n[e];else throw new E.CredentialsProviderError(`Unsupported credential source in profile ${s}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:t})},L=(e)=>j.setCredentialFeature(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");var N=(e,{profile:s="default",logger:t}={})=>{return Boolean(e)&&typeof e==="object"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(he(e,{profile:s,logger:t})||ye(e,{profile:s,logger:t}))},he=(e,{profile:s,logger:t})=>{let n=typeof e.source_profile==="string"&&typeof e.credential_source>"u";if(n)t?.debug?.(` ${s} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`);return n},ye=(e,{profile:s,logger:t})=>{let n=typeof e.credential_source==="string"&&typeof e.source_profile>"u";if(n)t?.debug?.(` ${s} isCredentialSourceProfile credential_source=${e.credential_source}`);return n},v=async(e,s,t,n,r={},a)=>{t.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let c=s[e],{source_profile:h,region:I}=c;if(!t.roleAssumer){let{getDefaultRoleAssumer:i}=await import("./chunk-59dfj0a9.js").then((m)=>o(m.default,1));t.roleAssumer=i({...t.clientConfig,credentialProviderLogger:t.logger,parentClientConfig:{...n,...t?.parentClientConfig,region:I??t?.parentClientConfig?.region??n?.region}},t.clientPlugins)}if(h&&h in r)throw new R.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${J.getProfileName(t)}. Profiles visited: `+Object.keys(r).join(", "),{logger:t.logger});t.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${h?`source_profile=[${h}]`:`profile=[${e}]`}`);let T=h?a(h,s,t,n,{...r,[h]:!0},G(s[h]??{})):(await U(c.credential_source,e,t.logger)(t))();if(G(c))return T.then((i)=>O.setCredentialFeature(i,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));else{let i={RoleArn:c.role_arn,RoleSessionName:c.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:c.external_id,DurationSeconds:parseInt(c.duration_seconds||"3600",10)},{mfa_serial:u}=c;if(u){if(!t.mfaCodeProvider)throw new R.CredentialsProviderError(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:t.logger,tryNextLink:!1});i.SerialNumber=u,i.TokenCode=await t.mfaCodeProvider(u)}let y=await T;return t.roleAssumer(y,i).then((m)=>O.setCredentialFeature(m,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},G=(e)=>{return!e.role_arn&&!!e.credential_source};var V=o(w(),1);var C=o(w(),1),X=o(l(),1),K=o(_(),1);var k=o(l(),1),W=o(ue(),1),z=o(_(),1);import{createHash as de,createPrivateKey as we,createPublicKey as ke,sign as me}from"crypto";import{promises as D}from"fs";import{homedir as fe}from"os";import{dirname as Ie,join as Y}from"path";class b{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,s,t){this.profileData=e,this.init=s,this.callerClientConfig=t}async loadCredentials(){let e=await this.loadToken();if(!e)throw new k.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let s=e.accessToken,t=Date.now();if(new Date(s.expiresAt).getTime()-t<=b.REFRESH_THRESHOLD)return this.refresh(e);return{accessKeyId:s.accessKeyId,secretAccessKey:s.secretAccessKey,sessionToken:s.sessionToken,accountId:s.accountId,expiration:new Date(s.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(e){let{SigninClient:s,CreateOAuth2TokenCommand:t}=await import("./chunk-5a4hvpbv.js").then((m)=>o(m.default,1)),{logger:n,userAgentAppId:r}=this.callerClientConfig??{},c=((i)=>{return i?.metadata?.handlerProtocol==="h2"})(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,h=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,I=new s({credentials:{accessKeyId:"",secretAccessKey:""},region:h,requestHandler:c,logger:n,userAgentAppId:r,...this.init?.clientConfig});this.createDPoPInterceptor(I.middlewareStack);let T={tokenInput:{clientId:e.clientId,refreshToken:e.refreshToken,grantType:"refresh_token"}};try{let i=await I.send(new t(T)),{accessKeyId:u,secretAccessKey:y,sessionToken:m}=i.tokenOutput?.accessToken??{},{refreshToken:x,expiresIn:H}=i.tokenOutput??{};if(!u||!y||!m||!x)throw new k.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let A=(H??900)*1000,f=new Date(Date.now()+A),q={...e,accessToken:{...e.accessToken,accessKeyId:u,secretAccessKey:y,sessionToken:m,expiresAt:f.toISOString()},refreshToken:x};await this.saveToken(q);let S=q.accessToken;return{accessKeyId:S.accessKeyId,secretAccessKey:S.secretAccessKey,sessionToken:S.sessionToken,accountId:S.accountId,expiration:f}}catch(i){if(i.name==="AccessDeniedException"){let u=i.error,y;switch(u){case"TOKEN_EXPIRED":y="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":y="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":y="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:y=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new k.CredentialsProviderError(y,{logger:this.logger,tryNextLink:!1})}throw new k.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let s;try{s=await z.readFile(e,{ignoreCache:this.init?.ignoreCache})}catch{s=await D.readFile(e,"utf8")}let t=JSON.parse(s),n=["accessToken","clientId","refreshToken","dpopKey"].filter((r)=>!t[r]);if(!t.accessToken?.accountId)n.push("accountId");if(n.length>0)throw new k.CredentialsProviderError(`Token validation failed, missing fields: ${n.join(", ")}`,{logger:this.logger,tryNextLink:!1});return t}catch(s){throw new k.CredentialsProviderError(`Failed to load token from ${e}: ${String(s)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let s=this.getTokenFilePath(),t=Ie(s);try{await D.mkdir(t,{recursive:!0})}catch(n){}await D.writeFile(s,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??Y(fe(),".aws","login","cache"),s=Buffer.from(this.loginSession,"utf8"),t=de("sha256").update(s).digest("hex");return Y(e,`${t}.json`)}derToRawSignature(e){let s=2;if(e[s]!==2)throw Error("Invalid DER signature");s++;let t=e[s++],n=e.subarray(s,s+t);if(s+=t,e[s]!==2)throw Error("Invalid DER signature");s++;let r=e[s++],a=e.subarray(s,s+r);n=n[0]===0?n.subarray(1):n,a=a[0]===0?a.subarray(1):a;let c=Buffer.concat([Buffer.alloc(32-n.length),n]),h=Buffer.concat([Buffer.alloc(32-a.length),a]);return Buffer.concat([c,h])}createDPoPInterceptor(e){e.add((s)=>async(t)=>{if(W.HttpRequest.isInstance(t.request)){let n=t.request,r=`${n.protocol}//${n.hostname}${n.port?`:${n.port}`:""}${n.path}`,a=await this.generateDpop(n.method,r);n.headers={...n.headers,DPoP:a}}return s(t)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",s){let t=await this.loadToken();try{let n=we({key:t.dpopKey,format:"pem",type:"sec1"}),a=ke(n).export({format:"der",type:"spki"}),c=-1;for(let f=0;f<a.length;f++)if(a[f]===4){c=f;break}let h=a.slice(c+1,c+33),I=a.slice(c+33,c+65),T={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:h.toString("base64url"),y:I.toString("base64url")}},i={jti:crypto.randomUUID(),htm:e,htu:s,iat:Math.floor(Date.now()/1000)},u=Buffer.from(JSON.stringify(T)).toString("base64url"),y=Buffer.from(JSON.stringify(i)).toString("base64url"),m=`${u}.${y}`,x=me("sha256",Buffer.from(m),n),A=this.derToRawSignature(x).toString("base64url");return`${m}.${A}`}catch(n){throw new k.CredentialsProviderError(`Failed to generate Dpop proof: ${n instanceof Error?n.message:String(n)}`,{logger:this.logger,tryNextLink:!1})}}}var Q=(e)=>async({callerClientConfig:s}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let t=await K.parseKnownFiles(e||{}),n=K.getProfileName({profile:e?.profile??s?.profile}),r=t[n];if(!r?.login_session)throw new X.CredentialsProviderError(`Profile ${n} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let c=await new b(r,e,s).loadCredentials();return C.setCredentialFeature(c,"CREDENTIALS_LOGIN","AD")};var Z=(e)=>{return Boolean(e&&e.login_session)},M=async(e,s,t)=>{let n=await Q({...s,profile:e})({callerClientConfig:t});return V.setCredentialFeature(n,"CREDENTIALS_PROFILE_LOGIN","AC")};var p=o(w(),1),ee=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.credential_process==="string",te=async(e,s)=>import("./chunk-gky8x4rv.js").then(({fromProcess:t})=>t({...e,profile:s})().then((n)=>p.setCredentialFeature(n,"CREDENTIALS_PROFILE_PROCESS","v")));var $=o(w(),1),se=async(e,s,t={},n)=>{let{fromSSO:r}=await import("./chunk-k5ddt5jb.js");return r({profile:e,logger:t.logger,parentClientConfig:t.parentClientConfig,clientConfig:t.clientConfig})({callerClientConfig:n}).then((a)=>{if(s.sso_session)return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO","r");else return $.setCredentialFeature(a,"CREDENTIALS_PROFILE_SSO_LEGACY","t")})},ne=(e)=>e&&(typeof e.sso_start_url==="string"||typeof e.sso_account_id==="string"||typeof e.sso_session==="string"||typeof e.sso_region==="string"||typeof e.sso_role_name==="string");var ce=o(w(),1),P=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.aws_access_key_id==="string"&&typeof e.aws_secret_access_key==="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,F=async(e,s)=>{s?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let t={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return ce.setCredentialFeature(t,"CREDENTIALS_PROFILE","n")};var re=o(w(),1),ae=(e)=>Boolean(e)&&typeof e==="object"&&typeof e.web_identity_token_file==="string"&&typeof e.role_arn==="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,oe=async(e,s,t)=>import("./chunk-8spbzsaa.js").then(({fromTokenFile:n})=>n({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:s.roleAssumerWithWebIdentity,logger:s.logger,parentClientConfig:s.parentClientConfig})({callerClientConfig:t}).then((r)=>re.setCredentialFeature(r,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")));var B=async(e,s,t,n,r={},a=!1)=>{let c=s[e];if(Object.keys(r).length>0&&P(c))return F(c,t);if(a||N(c,{profile:e,logger:t.logger}))return v(e,s,t,n,r,B);if(P(c))return F(c,t);if(ae(c))return oe(c,t,n);if(ee(c))return te(t,e);if(ne(c))return await se(e,c,t,n);if(Z(c))return M(e,t,n);throw new ie.CredentialsProviderError(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:t.logger})};var Ne=(e={})=>async({callerClientConfig:s}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let t=await g.parseKnownFiles(e);return B(g.getProfileName({profile:e.profile??s?.profile}),t,e,s)};export{Ne as fromIni};
3
3
 
4
4
  //# debugId=3F2A8146B4E164F264756E2164756E21
@@ -0,0 +1,15 @@
1
+ import type { PluginOption } from "vite";
2
+ import type { BunPlugin } from "bun";
3
+ export interface GemiViteConfig {
4
+ plugins?: PluginOption[];
5
+ [key: string]: unknown;
6
+ }
7
+ export interface GemiBunConfig {
8
+ plugins?: BunPlugin[];
9
+ }
10
+ export interface GemiConfig {
11
+ vite?: GemiViteConfig;
12
+ bun?: GemiBunConfig;
13
+ }
14
+ export declare function defineConfig(config: GemiConfig): GemiConfig;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAMrC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAKD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB;AAOD,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAE3D"}
@@ -0,0 +1,3 @@
1
+ import type { GemiConfig } from "./index";
2
+ export declare function loadGemiConfig(rootDir?: string): Promise<GemiConfig>;
3
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../config/load.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAS1C,wBAAsB,cAAc,CAClC,OAAO,GAAE,MAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,CASrB"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{k as y}from"../chunk-ww5pp0rp.js";import{l as z}from"../chunk-k4kdssr3.js";import{A as N,B as Z,C as $,D as J,E as K,F as V,m as Q,p as W,u as X,y as Y}from"../chunk-e43m0sz9.js";import"../chunk-9x52jhc8.js";import{R as p,W as H,_ as L}from"../chunk-qksh8x1f.js";import{da as T}from"../chunk-wypjxj9v.js";import{Aa as C,Ca as c,Da as E,ga as A,ha as R,la as S,oa as d,pa as h,qa as k,ra as I,sa as u,wa as m}from"../chunk-71e1rmh4.js";import"../chunk-5jar30t5.js";import"../chunk-8zrzjvj8.js";import"../chunk-yhphtr31.js";import"../chunk-wss9zewk.js";import"../chunk-37qn44wf.js";import"../chunk-m5nxws92.js";import"../chunk-e7wdb957.js";import"../chunk-7219pj06.js";import"../chunk-xxdb06dz.js";import"../chunk-e40j5tgj.js";import"../chunk-46g7xzc3.js";import"../chunk-m1vjp86n.js";import{Cb as _}from"../chunk-jhp3h3kc.js";import{Hb as B}from"../chunk-z3tgcb5r.js";import{Ib as G,Jb as O}from"../chunk-xfeqd7as.js";import"../chunk-cy0yet3t.js";class q extends O{service;static _name="CronServiceContainer";constructor(x){super();this.service=x;if(this.service.jobs.length===0)return;let P=globalThis.__gemiCronJobs??=new Map,f=async(w)=>{return await this.service.kernel.waitForBoot.call(this.service.kernel),await this.service.kernel.run.call(this.service.kernel,w)};for(let w of this.service.jobs){let U=new w;if(!U.name){console.error(`Cron job must have a name. Job: ${JSON.stringify(U)}`);continue}if(!U.cron){console.error(`Cron job must have an expression. Job: ${U.name}`);continue}P.get(U.name)?.stop();let l=Bun.cron(U.cron,()=>f(async()=>{try{await U.onTick.call(U)}catch(M){console.error(`Error executing cron job ${U.name}:`,M)}try{await U.callback.call(U)}catch(M){console.error(`Error in cron job ${U.name}:`,M)}try{await U.onComplete.call(U)}catch(M){console.error(`Error completing cron job ${U.name}:`,M)}}));P.set(U.name,l)}}}class D extends B{id=crypto.randomUUID();boot(){}}class F extends B{services=new Map;boot(){}}class j{emailServiceProvider=d;authenticationServiceProvider=N;middlewareServiceProvider=p;i18nServiceProvider=y;fileStorageServiceProvider=A;apiRouterServiceProvider=R;viewRouterServiceProvider=k;rateLimiterServiceProvider=S;broadcastingsServiceProvider=h;loggingServiceProvider=I;queueServiceProvider=u;imageServiceProvider=m;cronServiceProvider=C;kernelIdServiceProvider=D;redisServiceProvider=c;services={};booted=!1;boot(){this.services={[z._name]:new z(new this.emailServiceProvider),[H._name]:new H(new this.authenticationServiceProvider),[$._name]:new $(new this.middlewareServiceProvider),[T._name]:new T(new this.i18nServiceProvider),[W._name]:new W(new this.fileStorageServiceProvider),[V._name]:new V(new this.apiRouterServiceProvider),[K._name]:new K(new this.viewRouterServiceProvider),[L._name]:new L(new this.rateLimiterServiceProvider),[Q._name]:new Q(new this.broadcastingsServiceProvider),[X._name]:new X(new this.loggingServiceProvider),[_._name]:new _(new this.queueServiceProvider),[Z._name]:new Z(new this.imageServiceProvider),[q._name]:new q(new this.cronServiceProvider(this)),[J._name]:new J(new this.kernelIdServiceProvider),[Y._name]:new Y(new this.redisServiceProvider),[E._name]:new E(new F)},this.booted=!0}run(x){let P=this.services;return G.run(P,x)}destroy(){for(let x of Object.keys(this.services))delete this.services[x];G.disable()}async waitForBoot(){if(!this.booted)await new Promise((x)=>{while(!this.booted)setTimeout(()=>{if(this.booted)x()},10)})}}class v{prisma;constructor(x){this.prisma=x}async findUserByVerificationToken(x){return await this.prisma.user.findFirst({where:{verificationToken:x}})}async verifyUser(x){return await this.prisma.user.update({where:{email:x},data:{emailVerifiedAt:new Date}})}async createSessionV2(x){return await this.prisma.session.create({data:x,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(x){return await this.prisma.session.create({data:x,include:{user:!0}})}async createUser(x){return await this.prisma.user.create({data:x,omit:{password:!0}})}async deleteSession(x){return await this.prisma.session.deleteMany({where:{token:x.token}})}async findUserByEmailAddress(x,P){if(P)return await this.prisma.user.findUnique({where:{email:x,emailVerifiedAt:{not:null}}});return await this.prisma.user.findUnique({where:{email:x}})}async findSession(x){if(!x.token)return null;try{return await this.prisma.session.findUnique({where:{token:x.token},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(P){return console.log(P),null}}async updateSession(x){return await this.prisma.session.update({where:{token:x.token},data:{expiresAt:x.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(x){return await this.prisma.user.update({where:{id:x.id},data:{password:x.password}})}async createPasswordResetToken(x){return await this.prisma.passwordResetToken.create({data:{user:{connect:{id:x.user.id}},token:x.token}})}async findPasswordResetToken(x){let{token:P}=x;return await this.prisma.passwordResetToken.findUnique({where:{token:P},include:{user:!0}})}async deleteAllUserSessions(x){return await this.prisma.session.deleteMany({where:{userId:x}})}async deletePasswordResetToken(x){let{token:P}=x;return await this.prisma.passwordResetToken.delete({where:{token:P}})}async createAccount(x){return await this.prisma.account.create({data:{organizationId:x.organizationId,organizationRole:x.organizationRole,userId:x.userId}})}async deleteInvitationById(x){return await this.prisma.organizationInvitation.delete({where:{publicId:x}})}async findInvitation(x,P){return await this.prisma.organizationInvitation.findFirst({where:{publicId:x,email:P}})}async createMagicLinkToken(x){return await this.prisma.magicLinkToken.create({data:{email:x.email,token:x.token,pin:x.pin}})}async findUserMagicLinkToken(x){let{token:P,pin:f,email:w}=x;if(P)return this.prisma.magicLinkToken.findUnique({where:{token_email:{email:w,token:P}}});else return await this.prisma.magicLinkToken.findUnique({where:{pin_email:{email:w,pin:f}}})}async deleteMagicLinkToken(x){return await this.prisma.magicLinkToken.deleteMany({where:{email:x}})}async createSocialAccount(x){return await this.prisma.socialAccount.create({data:x})}}export{v as PrismaAuthenticationAdapter,j as Kernel,N as AuthenticationServiceProvider};
2
+ import{k as y}from"../chunk-ww5pp0rp.js";import{l as z}from"../chunk-k4kdssr3.js";import{A as N,B as Z,C as $,D as J,E as K,F as V,m as Q,p as W,u as X,y as Y}from"../chunk-e43m0sz9.js";import"../chunk-9x52jhc8.js";import{R as p,W as H,_ as L}from"../chunk-qksh8x1f.js";import{da as T}from"../chunk-wypjxj9v.js";import{Aa as C,Ca as c,Da as E,ga as A,ha as R,la as S,oa as d,pa as h,qa as k,ra as I,sa as u,wa as m}from"../chunk-9gj1htjp.js";import"../chunk-5jar30t5.js";import"../chunk-w102mcq7.js";import"../chunk-yhphtr31.js";import"../chunk-wss9zewk.js";import"../chunk-37qn44wf.js";import"../chunk-m5nxws92.js";import"../chunk-e7wdb957.js";import"../chunk-7219pj06.js";import"../chunk-xxdb06dz.js";import"../chunk-e40j5tgj.js";import"../chunk-46g7xzc3.js";import"../chunk-m1vjp86n.js";import{Cb as _}from"../chunk-jhp3h3kc.js";import{Hb as B}from"../chunk-z3tgcb5r.js";import{Ib as G,Jb as O}from"../chunk-xfeqd7as.js";import"../chunk-cy0yet3t.js";class q extends O{service;static _name="CronServiceContainer";constructor(x){super();this.service=x;if(this.service.jobs.length===0)return;let P=globalThis.__gemiCronJobs??=new Map,f=async(w)=>{return await this.service.kernel.waitForBoot.call(this.service.kernel),await this.service.kernel.run.call(this.service.kernel,w)};for(let w of this.service.jobs){let U=new w;if(!U.name){console.error(`Cron job must have a name. Job: ${JSON.stringify(U)}`);continue}if(!U.cron){console.error(`Cron job must have an expression. Job: ${U.name}`);continue}P.get(U.name)?.stop();let l=Bun.cron(U.cron,()=>f(async()=>{try{await U.onTick.call(U)}catch(M){console.error(`Error executing cron job ${U.name}:`,M)}try{await U.callback.call(U)}catch(M){console.error(`Error in cron job ${U.name}:`,M)}try{await U.onComplete.call(U)}catch(M){console.error(`Error completing cron job ${U.name}:`,M)}}));P.set(U.name,l)}}}class D extends B{id=crypto.randomUUID();boot(){}}class F extends B{services=new Map;boot(){}}class j{emailServiceProvider=d;authenticationServiceProvider=N;middlewareServiceProvider=p;i18nServiceProvider=y;fileStorageServiceProvider=A;apiRouterServiceProvider=R;viewRouterServiceProvider=k;rateLimiterServiceProvider=S;broadcastingsServiceProvider=h;loggingServiceProvider=I;queueServiceProvider=u;imageServiceProvider=m;cronServiceProvider=C;kernelIdServiceProvider=D;redisServiceProvider=c;services={};booted=!1;boot(){this.services={[z._name]:new z(new this.emailServiceProvider),[H._name]:new H(new this.authenticationServiceProvider),[$._name]:new $(new this.middlewareServiceProvider),[T._name]:new T(new this.i18nServiceProvider),[W._name]:new W(new this.fileStorageServiceProvider),[V._name]:new V(new this.apiRouterServiceProvider),[K._name]:new K(new this.viewRouterServiceProvider),[L._name]:new L(new this.rateLimiterServiceProvider),[Q._name]:new Q(new this.broadcastingsServiceProvider),[X._name]:new X(new this.loggingServiceProvider),[_._name]:new _(new this.queueServiceProvider),[Z._name]:new Z(new this.imageServiceProvider),[q._name]:new q(new this.cronServiceProvider(this)),[J._name]:new J(new this.kernelIdServiceProvider),[Y._name]:new Y(new this.redisServiceProvider),[E._name]:new E(new F)},this.booted=!0}run(x){let P=this.services;return G.run(P,x)}destroy(){for(let x of Object.keys(this.services))delete this.services[x];G.disable()}async waitForBoot(){if(!this.booted)await new Promise((x)=>{while(!this.booted)setTimeout(()=>{if(this.booted)x()},10)})}}class v{prisma;constructor(x){this.prisma=x}async findUserByVerificationToken(x){return await this.prisma.user.findFirst({where:{verificationToken:x}})}async verifyUser(x){return await this.prisma.user.update({where:{email:x},data:{emailVerifiedAt:new Date}})}async createSessionV2(x){return await this.prisma.session.create({data:x,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(x){return await this.prisma.session.create({data:x,include:{user:!0}})}async createUser(x){return await this.prisma.user.create({data:x,omit:{password:!0}})}async deleteSession(x){return await this.prisma.session.deleteMany({where:{token:x.token}})}async findUserByEmailAddress(x,P){if(P)return await this.prisma.user.findUnique({where:{email:x,emailVerifiedAt:{not:null}}});return await this.prisma.user.findUnique({where:{email:x}})}async findSession(x){if(!x.token)return null;try{return await this.prisma.session.findUnique({where:{token:x.token},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(P){return console.log(P),null}}async updateSession(x){return await this.prisma.session.update({where:{token:x.token},data:{expiresAt:x.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(x){return await this.prisma.user.update({where:{id:x.id},data:{password:x.password}})}async createPasswordResetToken(x){return await this.prisma.passwordResetToken.create({data:{user:{connect:{id:x.user.id}},token:x.token}})}async findPasswordResetToken(x){let{token:P}=x;return await this.prisma.passwordResetToken.findUnique({where:{token:P},include:{user:!0}})}async deleteAllUserSessions(x){return await this.prisma.session.deleteMany({where:{userId:x}})}async deletePasswordResetToken(x){let{token:P}=x;return await this.prisma.passwordResetToken.delete({where:{token:P}})}async createAccount(x){return await this.prisma.account.create({data:{organizationId:x.organizationId,organizationRole:x.organizationRole,userId:x.userId}})}async deleteInvitationById(x){return await this.prisma.organizationInvitation.delete({where:{publicId:x}})}async findInvitation(x,P){return await this.prisma.organizationInvitation.findFirst({where:{publicId:x,email:P}})}async createMagicLinkToken(x){return await this.prisma.magicLinkToken.create({data:{email:x.email,token:x.token,pin:x.pin}})}async findUserMagicLinkToken(x){let{token:P,pin:f,email:w}=x;if(P)return this.prisma.magicLinkToken.findUnique({where:{token_email:{email:w,token:P}}});else return await this.prisma.magicLinkToken.findUnique({where:{pin_email:{email:w,pin:f}}})}async deleteMagicLinkToken(x){return await this.prisma.magicLinkToken.deleteMany({where:{email:x}})}async createSocialAccount(x){return await this.prisma.socialAccount.create({data:x})}}export{v as PrismaAuthenticationAdapter,j as Kernel,N as AuthenticationServiceProvider};
3
3
 
4
4
  //# debugId=68106C8511E4EDB164756E2164756E21
@@ -1 +1 @@
1
- {"version":3,"file":"httpDev.d.ts","sourceRoot":"","sources":["../../server/httpDev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAG7B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAoD1C,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;IAE1C,IAAI,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,IAAI,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IAG3C,IAAI,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;CAChD;AAoBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;;;;EAoBxC;AA+BD,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,eAAe,kCAqLvE"}
1
+ {"version":3,"file":"httpDev.d.ts","sourceRoot":"","sources":["../../server/httpDev.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAI7B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAoD1C,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,UAAU,EAAE,aAAa,GAAG,SAAS,CAAC;IAE1C,IAAI,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3C,IAAI,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAC;IAG3C,IAAI,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;CAChD;AAoBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;;;;EAoBxC;AA+BD,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,eAAe,kCA2LvE"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import"../chunk-zjxbe8tx.js";import{i as S}from"../chunk-hq4yhfaq.js";import"../chunk-e43m0sz9.js";import"../chunk-9x52jhc8.js";import"../chunk-qksh8x1f.js";import"../chunk-wypjxj9v.js";import"../chunk-jhp3h3kc.js";import"../chunk-z3tgcb5r.js";import"../chunk-xfeqd7as.js";import{Nb as z}from"../chunk-cy0yet3t.js";class b{app;instrumentation;constructor(f){this.app=new S({kernel:f.kernel}),this.instrumentation=f.instrumentation??((g,i)=>i(g))}async start(){{let{httpProd:f}=await import("../chunk-py00anah.js");await f(this.app,this.instrumentation.bind(this))}}}export{b as Server};
2
+ import"../chunk-zjxbe8tx.js";import{i as S}from"../chunk-th24m9jj.js";import"../chunk-e43m0sz9.js";import"../chunk-9x52jhc8.js";import"../chunk-qksh8x1f.js";import"../chunk-wypjxj9v.js";import"../chunk-jhp3h3kc.js";import"../chunk-z3tgcb5r.js";import"../chunk-xfeqd7as.js";import{Nb as z}from"../chunk-cy0yet3t.js";class b{app;instrumentation;constructor(f){this.app=new S({kernel:f.kernel}),this.instrumentation=f.instrumentation??((g,i)=>i(g))}async start(){{let{httpProd:f}=await import("../chunk-j7harkz1.js");await f(this.app,this.instrumentation.bind(this))}}}export{b as Server};
3
3
 
4
4
  //# debugId=229A28E52D20B9BB64756E2164756E21
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Aa as w,Ba as x,Ca as y,Ea as z,ea as a,fa as b,ga as c,ha as d,ia as e,ja as f,ka as g,la as h,ma as i,na as j,oa as k,pa as l,qa as m,ra as n,sa as o,ta as p,ua as q,va as r,wa as s,xa as t,ya as u,za as v}from"../chunk-71e1rmh4.js";import"../chunk-5jar30t5.js";import"../chunk-8zrzjvj8.js";import"../chunk-yhphtr31.js";import"../chunk-wss9zewk.js";import"../chunk-37qn44wf.js";import"../chunk-m5nxws92.js";import"../chunk-e7wdb957.js";import"../chunk-7219pj06.js";import"../chunk-xxdb06dz.js";import"../chunk-e40j5tgj.js";import"../chunk-46g7xzc3.js";import"../chunk-m1vjp86n.js";import"../chunk-jhp3h3kc.js";import"../chunk-z3tgcb5r.js";import"../chunk-xfeqd7as.js";import"../chunk-cy0yet3t.js";export{v as XOAuthProvider,m as ViewRouterServiceProvider,z as Singleton,r as Sharp,e as S3Driver,j as ResendDriver,y as RedisServiceProvider,h as RateLimiterServiceProvider,f as RateLimiterDriver,o as QueueServiceProvider,t as OAuthProvider,n as LoggingServiceProvider,p as Job,g as InMemoryRateLimiter,s as ImageOptimizationServiceProvider,q as ImageOptimizationDriver,u as GoogleOAuthProvider,b as FileSystemDriver,c as FileStorageServiceProvider,a as FileStorageDriver,k as EmailServiceProvider,i as EmailDriver,w as CronServiceProvider,x as CronJob,l as BroadcastingServiceProvider,d as ApiRouterServiceProvider};
2
+ import{Aa as w,Ba as x,Ca as y,Ea as z,ea as a,fa as b,ga as c,ha as d,ia as e,ja as f,ka as g,la as h,ma as i,na as j,oa as k,pa as l,qa as m,ra as n,sa as o,ta as p,ua as q,va as r,wa as s,xa as t,ya as u,za as v}from"../chunk-9gj1htjp.js";import"../chunk-5jar30t5.js";import"../chunk-w102mcq7.js";import"../chunk-yhphtr31.js";import"../chunk-wss9zewk.js";import"../chunk-37qn44wf.js";import"../chunk-m5nxws92.js";import"../chunk-e7wdb957.js";import"../chunk-7219pj06.js";import"../chunk-xxdb06dz.js";import"../chunk-e40j5tgj.js";import"../chunk-46g7xzc3.js";import"../chunk-m1vjp86n.js";import"../chunk-jhp3h3kc.js";import"../chunk-z3tgcb5r.js";import"../chunk-xfeqd7as.js";import"../chunk-cy0yet3t.js";export{v as XOAuthProvider,m as ViewRouterServiceProvider,z as Singleton,r as Sharp,e as S3Driver,j as ResendDriver,y as RedisServiceProvider,h as RateLimiterServiceProvider,f as RateLimiterDriver,o as QueueServiceProvider,t as OAuthProvider,n as LoggingServiceProvider,p as Job,g as InMemoryRateLimiter,s as ImageOptimizationServiceProvider,q as ImageOptimizationDriver,u as GoogleOAuthProvider,b as FileSystemDriver,c as FileStorageServiceProvider,a as FileStorageDriver,k as EmailServiceProvider,i as EmailDriver,w as CronServiceProvider,x as CronJob,l as BroadcastingServiceProvider,d as ApiRouterServiceProvider};
3
3
 
4
4
  //# debugId=CC6036AE62B6E81B64756E2164756E21
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.40.1",
3
+ "version": "0.41.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Enes Tufekci <enes@gemijs.dev>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/nstfkc/gemi.git",
10
+ "directory": "packages/gemi"
11
+ },
7
12
  "bin": {
8
13
  "gemi": "./dist/bin/gemi.js"
9
14
  },
@@ -28,19 +33,6 @@
28
33
  "./bun/preload": "./dist/bun/preload.js",
29
34
  "./bun/plugin": "./dist/bun/plugin.js"
30
35
  },
31
- "scripts": {
32
- "lint": "oxlint",
33
- "build": "NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:client-types",
34
- "build:core": "bun ./scripts/build.ts",
35
- "build:bin": "bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --sourcemap ./bin/gemi.ts && bun ./scripts/prepare-bin.ts",
36
- "build:client": "vite build -c vite.client.config.mts",
37
- "build:plugin": "vite build -c vite.plugin.config.mts",
38
- "build:types": "tsc",
39
- "build:client-types": "tsc -p tsconfig.browser.json",
40
- "test": "vitest",
41
- "prepublishOnly": "bun run build && bun scripts/setupExports.ts prod",
42
- "postpublish": "bun scripts/setupExports.ts dev"
43
- },
44
36
  "dependencies": {
45
37
  "@aws-sdk/client-s3": "^3.629.0",
46
38
  "@aws-sdk/s3-request-presigner": "^3.629.0",
@@ -59,21 +51,6 @@
59
51
  "urlpattern-polyfill": "^10.0.0",
60
52
  "uuid": "^9.0.1"
61
53
  },
62
- "devDependencies": {
63
- "@babel/parser": "^7.25.4",
64
- "@repo/typescript-config": "*",
65
- "@types/bun": "^1.3.14",
66
- "@types/eslint": "^8.56.5",
67
- "@types/node": "^20.11.24",
68
- "@types/react": "^19.0.2",
69
- "@types/react-dom": "^19.0.2",
70
- "eslint": "^8.57.0",
71
- "oxlint": "^1.39.0",
72
- "react": "19.2.3",
73
- "react-dom": "19.2.3",
74
- "typescript": "^5.7.3",
75
- "vitest": "^4.0.0"
76
- },
77
54
  "peerDependencies": {
78
55
  "react": ">=19",
79
56
  "react-dom": ">=19",