gemi 0.9.1 → 0.9.2
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.
- package/dist/app/index.js +1 -1
- package/dist/bin/index.js +3 -3
- package/dist/{chunk-21mvg3dx.js → chunk-crahc1t6.js} +1 -1
- package/dist/{chunk-papxj58y.js → chunk-hzfj9k0z.js} +1 -1
- package/dist/chunk-qbvhdtxt.js +4 -0
- package/dist/{chunk-0tsd6d6s.js.map → chunk-qbvhdtxt.js.map} +3 -3
- package/dist/{chunk-mhs8rp3d.js → chunk-vress81a.js} +1 -1
- package/dist/{chunk-98e4g3z6.js → chunk-w8eezrzs.js} +1 -1
- package/dist/email/index.js +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/ApiRouter.d.ts +2 -2
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/Controller.d.ts +1 -1
- package/dist/http/Controller.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/http/index.js.map +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0tsd6d6s.js +0 -4
- /package/dist/{chunk-21mvg3dx.js.map → chunk-crahc1t6.js.map} +0 -0
- /package/dist/{chunk-papxj58y.js.map → chunk-hzfj9k0z.js.map} +0 -0
- /package/dist/{chunk-mhs8rp3d.js.map → chunk-vress81a.js.map} +0 -0
- /package/dist/{chunk-98e4g3z6.js.map → chunk-w8eezrzs.js.map} +0 -0
package/package.json
CHANGED
package/dist/chunk-0tsd6d6s.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
function m(e){return typeof e==="function"&&e.prototype!==void 0}function w(e){return m(e)}class a{e;t;n;__internal_brand="RouteHandler";middlewares=[];constructor(e,t,n){this.method=e;this.handler=t;this.methodName=n;this.handler=t,this.methodName=n,this.method=e}__internal_use(){return{run:this.run.bind(this),middlewares:this.middlewares}}run(e){if(w(this.handler)){let t=new this.handler;return t[this.methodName].bind(t)()}else return this.handler()}middleware(e){return this.middlewares=e,this}}class C{constructor(...e){return new a(...e)}}class f{static __brand="ApiRouter";routes={};middlewares=[];middleware(e){}get(e,t){return new a("GET",e,t)}post(e,t){return new a("POST",e,t)}put(e,t){return new a("PUT",e,t)}patch(e,t){return new a("PATCH",e,t)}delete(e,t){return new a("DELETE",e,t)}resource(e){return(t)=>{return{"/":{list:new a("GET",e,"list"),create:new a("POST",e,"create")},[`/:${String(t)}`]:{show:new a("GET",e,"show"),update:new a("PUT",e,"update"),delete:new a("DELETE",e,"delete")}}}}file(e,t){return new C("GET",e,t)}}var q="GEMI_REQUEST_BREAKER_ERROR";class y extends Error{kind="GEMI_REQUEST_BREAKER_ERROR";payload={api:{},view:{}}}class R extends y{errors={};constructor(e){super("Validation error");this.name="ValidationError",this.errors=e,this.payload={api:{status:400,data:{error:{kind:"validation_error",messages:e}},headers:{"Content-Type":"application/json"}},view:{status:400}}}}import{AsyncLocalStorage as g}from"async_hooks";class x{e;t;n;constructor(e,t,n={}){this.name=e;this.value=t;this.options=n}toString(){return[`${this.name}=${this.value}`,this.options.maxAge?`Max-Age=${this.options.maxAge}`:"",this.options.httpOnly?"HttpOnly":"",this.options.secure?"Secure":"",this.options.sameSite?`SameSite=${this.options.sameSite}`:"SameSite=Strict",this.options.path?`Path=${this.options.path}`:"Path=/",this.options.domain?`Domain=${this.options.domain}`:"",this.options.expires?`Expires=${this.options.expires.toUTCString()}`:"",this.options.partitioned?"Partitioned":""].filter((e)=>e!=="").join("; ")}}var P=new g;class K{e;cookies=new Set;headers=new Headers;prefetchedResources=new Map;prefetchPromiseQueue=new Set;user=null;csrfHmac=null;constructor(e){this.req=e}setCSRFHmac(e){this.csrfHmac=e}setCookie(e,t,n={}){this.cookies.add(new x(e,t,n))}setHeaders(e,t){this.headers.set(e,t)}setUser(e){this.user=e}setRequest(e){this.req=e}destroy(){delete this.cookies,delete this.headers,delete this.prefetchedResources,delete this.prefetchPromiseQueue,delete this.user}}class c{static getStore(){return P.getStore()}static setRequest(e){P.getStore().req=e}static run(e,t){return P.run(new K(e),t)}}class u{e;constructor(e){this.data=e}get(e){return this.data[e]}has(e){return this.data[e]!==void 0}toJSON(){return this.data}}function E(e){let[t,n]=e.match(/\d+|\D+/g)??[];if(!t||!n)return 0;let r=parseInt(t);switch(n){case"B":return r;case"KB":return r*1024;case"MB":return r*1024*1024;case"GB":return r*1024*1024*1024;case"TB":return r*1024*1024*1024*1024;default:return 0}}function O(e){switch(e){case"image":return"image";case"png":return"image/png";case"jpg":return"image/jpeg";case"jpeg":return"image/jpeg";case"ttf":return"font/ttf";case"excel":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"csv":return"text/csv";case"word":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"pdf":return"application/pdf";case"json":return"application/json";default:return e}}function b(e){let[t,n]=e.split(":");switch(t){case"required":return(r)=>{if(r instanceof Blob)return r.size>0;return r!==null&&r!==void 0&&r?.length>0};case"password":return(r)=>{return/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9]).{8,}$/.test(r)};case"number":return(r)=>{if(typeof r!=="number")return!1;return!isNaN(r)};case"min":return(r)=>{return r?.length>=parseInt(n)};case"max":return(r)=>{return r?.length<=parseInt(n)};case"email":return(r)=>{return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)};case"file":return(r)=>{return r instanceof Blob};case"fileType":return(r)=>{if(r instanceof Blob){let s=O(n);return r.type.startsWith(s)}};case"fileSize":return(r)=>{if(r instanceof Blob){let s=E(n);return r.size<=s}};default:return()=>!0}}class A{kind;rawRequest;headers;cookies;search;schema={};routePath;params;constructor(e,t,n,r){if(!e){let i=c.getStore().req;this.params=i.params,this.rawRequest=i.rawRequest,this.kind=i.kind,this.routePath=i.routePath}else this.params=t,this.rawRequest=e,this.routePath=r,this.kind=n??"api";this.headers=this.rawRequest.headers;let s=this.rawRequest.headers.get("Cookie"),d=new Map;if(s){let i=s.split(";");for(let o of i){let[l,p]=o.split("=");d.set(l.trim(),p.trim())}}if(this.rawRequest.method==="GET"){let i=new URL(this.rawRequest.url),o=new Map;for(let[p,h]of i.searchParams)if(o.has(p)){let T=o.get(p);if(Array.isArray(T))T.push(h),o.set(p,T);else o.set(p,[T,h])}else o.set(p,h);let l=Object.fromEntries(o.entries());this.search=new u(l)}this.cookies=d}ctx(){return c.getStore()}refine(e){return{}}async parseBody(){let e=new u({});if(this.rawRequest.headers.get("Content-Type")==="application/json"){let t=await this.rawRequest.json();e=new u(t)}if(this.rawRequest.headers.get("Content-Type")==="application/x-www-form-urlencoded"){let t=await this.rawRequest.formData();e=new u(t)}if(this.rawRequest.headers.get("Content-Type")?.startsWith("multipart/form-data")){let t=await this.rawRequest.formData(),n=new Map;for(let[r,s]of t.entries())if(n.has(r)){let d=n.get(r);if(Array.isArray(d))d.push(s),n.set(r,d);else n.set(r,[d,s])}else n.set(r,s);e=new u(Object.fromEntries(n.entries()))}return e}validateInput(e){let t={};for(let[n,r]of Object.entries(this.schema))for(let[s,d]of Object.entries(r)){let i=b(s),o=d,l=!1;if(typeof d==="function")o=d(e.get(n)),l=typeof o==="undefined";else l=i(e.get(n));if(l)continue;if(!t[n])t[n]=[];if(s==="required"){t[n]=[String(o)];break}else t[n].push(String(o))}for(let[n,r]of Object.entries(this.refine(e.toJSON())??{})){if(!t[n])t[n]=[];t[n]=[...t[n]??[],r]}if(Object.keys(t).length>0)throw new R(t);else return e}async input(){return this.validateInput(await this.parseBody())}async safeInput(){let e=await this.parseBody();try{return this.validateInput(e),{isValid:!0,errors:{},input:e}}catch(t){if(!(t instanceof R))throw t;return{isValid:!1,errors:t.errors,input:e}}}}import{AsyncLocalStorage as M}from"async_hooks";var H=new M;class ${static _name;service;static use(){let e=H.getStore();if(!e)return;if(!e?.[this._name])console.log("Container is not registered",this._name),console.log("Available containers",Object.keys(e));return e[this._name]}}
|
|
2
|
-
export{m as Nb,f as Ob,q as Pb,y as Qb,R as Rb,c as Sb,A as Tb,H as Ub,$ as Vb};
|
|
3
|
-
|
|
4
|
-
//# debugId=EB67F6612C6BFEF364756E2164756E21
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|