gemi 0.4.19 → 0.4.21

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 (37) hide show
  1. package/dist/app/index.d.ts +1 -0
  2. package/dist/app/index.d.ts.map +1 -1
  3. package/dist/app/index.js +141 -1
  4. package/dist/app/prismaExtension.d.ts +6 -0
  5. package/dist/app/prismaExtension.d.ts.map +1 -0
  6. package/dist/auth/AuthenticationServiceProvider.d.ts.map +1 -1
  7. package/dist/auth/adapters/prisma.d.ts.map +1 -1
  8. package/dist/chunk-06eebef7eb056baa.js +2 -0
  9. package/dist/chunk-9350baa090b5a424.js +2 -0
  10. package/dist/chunk-c8f1115d77efc1c0.js +2 -0
  11. package/dist/chunk-e86269d01f94404c.js +2 -0
  12. package/dist/client/QueryManager.d.ts.map +1 -1
  13. package/dist/client/QueryStore.d.ts +10 -0
  14. package/dist/client/QueryStore.d.ts.map +1 -0
  15. package/dist/client/auth/useUser.d.ts.map +1 -1
  16. package/dist/client/index.js +14 -8
  17. package/dist/email/index.js +1 -1
  18. package/dist/facades/index.js +1 -1
  19. package/dist/http/PoliciesServiceProvider.d.ts +7 -0
  20. package/dist/http/PoliciesServiceProvider.d.ts.map +1 -0
  21. package/dist/http/Policy.d.ts +4 -0
  22. package/dist/http/Policy.d.ts.map +1 -0
  23. package/dist/http/Router.d.ts +0 -18
  24. package/dist/http/Router.d.ts.map +1 -1
  25. package/dist/http/errors.d.ts +28 -0
  26. package/dist/http/errors.d.ts.map +1 -0
  27. package/dist/http/index.d.ts +4 -1
  28. package/dist/http/index.d.ts.map +1 -1
  29. package/dist/http/index.js +1 -1
  30. package/dist/kernel/Kernel.d.ts +4 -0
  31. package/dist/kernel/Kernel.d.ts.map +1 -1
  32. package/dist/kernel/context.d.ts +2 -0
  33. package/dist/kernel/context.d.ts.map +1 -1
  34. package/dist/kernel/index.js +2 -2
  35. package/dist/server/index.js +1 -1
  36. package/dist/vite/index.js +1 -1
  37. package/package.json +2 -1
@@ -0,0 +1,6 @@
1
+ export declare const prismaExtension: (client: any) => {
2
+ $extends: {
3
+ extArgs: import("@prisma/client/runtime/library").InternalArgs<unknown, unknown, {}, unknown>;
4
+ };
5
+ };
6
+ //# sourceMappingURL=prismaExtension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prismaExtension.d.ts","sourceRoot":"","sources":["../../app/prismaExtension.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe;;;;CAqB1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationServiceProvider.d.ts","sourceRoot":"","sources":["../../auth/AuthenticationServiceProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAyRrE,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM;;mBA9OG,MAAM;sBACH,MAAM;;;;;kBAkBV,MAAM;mBACL,MAAM;sBACH,MAAM;;;;;;;;;;MAgOhB;CACH;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC5C,MAAM;;;;;MAKJ;CACH;AAED,qBAAa,6BAA6B;IACxC,QAAQ,SAAW;IACnB,OAAO;;;MAGL;IAEF,qBAAqB,SAAM;IAC3B,6BAA6B,SAAc;IAG3C,OAAO,EAAE,sBAAsB,CAAsB;IAE/C,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIhE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C,2BAA2B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAM9D,QAAQ,CAAC,CAAC,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC,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IAAI,CAAC;IAKpD,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAiCnE,aAAa,CACjB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAmB5B,kBAAkB,CAAC,IAAI,EAAE;QAC7B,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOX,wBAAwB,CAAC,IAAI,EAAE,4BAA4B;IAS3D,sBAAsB,CAC1B,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAQ/B,qBAAqB,CAAC,MAAM,EAAE,MAAM;IAIpC,wBAAwB,CAAC,IAAI,EAAE,4BAA4B;CAIlE"}
@@ -0,0 +1,2 @@
1
+ var et=function(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)},F=function(t,e=!1){let s=[],i=0;for(;i<t.length;){let a=t[i],u=function(o){if(!e)throw new TypeError(o);s.push({type:"INVALID_CHAR",index:i,value:t[i++]})};if(a==="*"){s.push({type:"ASTERISK",index:i,value:t[i++]});continue}if(a==="+"||a==="?"){s.push({type:"OTHER_MODIFIER",index:i,value:t[i++]});continue}if(a==="\\"){s.push({type:"ESCAPED_CHAR",index:i++,value:t[i++]});continue}if(a==="{"){s.push({type:"OPEN",index:i,value:t[i++]});continue}if(a==="}"){s.push({type:"CLOSE",index:i,value:t[i++]});continue}if(a===":"){let o="",r=i+1;for(;r<t.length;){let h=t.substr(r,1);if(r===i+1&&Y.test(h)||r!==i+1&&tt.test(h)){o+=t[r++];continue}break}if(!o){u(`Missing parameter name at ${i}`);continue}s.push({type:"NAME",index:i,value:o}),i=r;continue}if(a==="("){let o=1,r="",h=i+1,n=!1;if(t[h]==="?"){u(`Pattern cannot start with "?" at ${h}`);continue}for(;h<t.length;){if(!et(t[h],!1)){u(`Invalid character '${t[h]}' at ${h}.`),n=!0;break}if(t[h]==="\\"){r+=t[h++]+t[h++];continue}if(t[h]===")"){if(o--,o===0){h++;break}}else if(t[h]==="("&&(o++,t[h+1]!=="?")){u(`Capturing groups are not allowed at ${h}`),n=!0;break}r+=t[h++]}if(n)continue;if(o){u(`Unbalanced pattern at ${i}`);continue}if(!r){u(`Missing pattern at ${i}`);continue}s.push({type:"REGEX",index:i,value:r}),i=h;continue}s.push({type:"CHAR",index:i,value:t[i++]})}return s.push({type:"END",index:i,value:""}),s},M=function(t,e={}){let s=F(t);e.delimiter??="/#?",e.prefixes??="./";let i=`[^${d(e.delimiter)}]+?`,a=[],u=0,o=0,r="",h=new Set,n=(p)=>{if(o<s.length&&s[o].type===p)return s[o++].value},f=()=>n("OTHER_MODIFIER")??n("ASTERISK"),w=(p)=>{let c=n(p);if(c!==void 0)return c;let{type:l,index:R}=s[o];throw new TypeError(`Unexpected ${l} at ${R}, expected ${p}`)},E=()=>{let p="",c;for(;c=n("CHAR")??n("ESCAPED_CHAR");)p+=c;return p},Q=(p)=>p,T=e.encodePart||Q,U="",O=(p)=>{U+=p},I=()=>{U.length&&(a.push(new P(3,"","",T(U),"",3)),U="")},_=(p,c,l,R,v)=>{let g=3;switch(v){case"?":g=1;break;case"*":g=0;break;case"+":g=2;break}if(!c&&!l&&g===3){O(p);return}if(I(),!c&&!l){if(!p)return;a.push(new P(3,"","",T(p),"",g));return}let m;l?l==="*"?m=D:m=l:m=i;let C=2;m===i?(C=1,m=""):m===D&&(C=0,m="");let b;if(c?b=c:l&&(b=u++),h.has(b))throw new TypeError(`Duplicate name '${b}'.`);h.add(b),a.push(new P(C,b,T(p),m,T(R),g))};for(;o<s.length;){let p=n("CHAR"),c=n("NAME"),l=n("REGEX");if(!c&&!l&&(l=n("ASTERISK")),c||l){let v=p??"";e.prefixes.indexOf(v)===-1&&(O(v),v=""),I();let g=f();_(v,c,l,"",g);continue}let R=p??n("ESCAPED_CHAR");if(R){O(R);continue}if(n("OPEN")){let v=E(),g=n("NAME"),m=n("REGEX");!g&&!m&&(m=n("ASTERISK"));let C=E();w("CLOSE");let b=f();_(v,g,m,C,b);continue}I(),w("END")}return a},d=function(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")},j=function(t){return t&&t.ignoreCase?"ui":"u"},st=function(t,e,s){return W(M(t,s),e,s)},k=function(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}},W=function(t,e,s={}){s.delimiter??="/#?",s.prefixes??="./",s.sensitive??=!1,s.strict??=!1,s.end??=!0,s.start??=!0,s.endsWith="";let i=s.start?"^":"";for(let r of t){if(r.type===3){r.modifier===3?i+=d(r.value):i+=`(?:${d(r.value)})${k(r.modifier)}`;continue}e&&e.push(r.name);let h=`[^${d(s.delimiter)}]+?`,n=r.value;if(r.type===1?n=h:r.type===0&&(n=D),!r.prefix.length&&!r.suffix.length){r.modifier===3||r.modifier===1?i+=`(${n})${k(r.modifier)}`:i+=`((?:${n})${k(r.modifier)})`;continue}if(r.modifier===3||r.modifier===1){i+=`(?:${d(r.prefix)}(${n})${d(r.suffix)})`,i+=k(r.modifier);continue}i+=`(?:${d(r.prefix)}`,i+=`((?:${n})(?:`,i+=d(r.suffix),i+=d(r.prefix),i+=`(?:${n}))*)${d(r.suffix)})`,r.modifier===0&&(i+="?")}let a=`[${d(s.endsWith)}]|\$`,u=`[${d(s.delimiter)}]`;if(s.end)return s.strict||(i+=`${u}?`),s.endsWith.length?i+=`(?=${a})`:i+="$",new RegExp(i,j(s));s.strict||(i+=`(?:${u}(?=${a}))?`);let o=!1;if(t.length){let r=t[t.length-1];r.type===3&&r.modifier===3&&(o=s.delimiter.indexOf(r)>-1)}return o||(i+=`(?=${u}|${a})`),new RegExp(i,j(s))},nt=function(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1},G=function(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t},ot=function(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t},K=function(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["},V=function(t){if(!t)return!0;for(let e of X)if(t.test(e))return!0;return!1},ht=function(t,e){if(t=G(t,"#"),e||t==="")return t;let s=new URL("https://example.com");return s.hash=t,s.hash?s.hash.substring(1,s.hash.length):""},at=function(t,e){if(t=G(t,"?"),e||t==="")return t;let s=new URL("https://example.com");return s.search=t,s.search?s.search.substring(1,s.search.length):""},ut=function(t,e){return e||t===""?t:K(t)?q(t):Z(t)},pt=function(t,e){if(e||t==="")return t;let s=new URL("https://example.com");return s.password=t,s.password},ct=function(t,e){if(e||t==="")return t;let s=new URL("https://example.com");return s.username=t,s.username},ft=function(t,e,s){if(s||t==="")return t;if(e&&!X.includes(e))return new URL(`${e}:${t}`).pathname;let i=t[0]=="/";return t=new URL(i?t:"/-"+t,"https://example.com").pathname,i||(t=t.substring(2,t.length)),t},lt=function(t,e,s){return z(e)===t&&(t=""),s||t===""?t:B(t)},mt=function(t,e){return t=ot(t,":"),e||t===""?t:N(t)},z=function(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}},N=function(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)},dt=function(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username},gt=function(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password},Z=function(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname},q=function(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()},B=function(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)},wt=function(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname},yt=function(t){return t===""?t:new URL(`data:${t}`).pathname},vt=function(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)},bt=function(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)},H=function(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let s=new URL(t,e);return{protocol:s.protocol.substring(0,s.protocol.length-1),username:s.username,password:s.password,hostname:s.hostname,port:s.port,pathname:s.pathname,search:s.search!==""?s.search.substring(1,s.search.length):void 0,hash:s.hash!==""?s.hash.substring(1,s.hash.length):void 0}},y=function(t,e){return e?A(t):t},L=function(t,e,s){let i;if(typeof e.baseURL=="string")try{i=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=y(i.protocol.substring(0,i.protocol.length-1),s)),!s&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=y(i.username,s)),!s&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=y(i.password,s)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=y(i.hostname,s)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=y(i.port,s)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=y(i.pathname,s)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=y(i.search.substring(1,i.search.length),s)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=y(i.hash.substring(1,i.hash.length),s))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=mt(e.protocol,s)),typeof e.username=="string"&&(t.username=ct(e.username,s)),typeof e.password=="string"&&(t.password=pt(e.password,s)),typeof e.hostname=="string"&&(t.hostname=ut(e.hostname,s)),typeof e.port=="string"&&(t.port=lt(e.port,t.protocol,s)),typeof e.pathname=="string"){if(t.pathname=e.pathname,i&&!nt(t.pathname,s)){let a=i.pathname.lastIndexOf("/");a>=0&&(t.pathname=y(i.pathname.substring(0,a+1),s)+t.pathname)}t.pathname=ft(t.pathname,t.protocol,s)}return typeof e.search=="string"&&(t.search=at(e.search,s)),typeof e.hash=="string"&&(t.hash=ht(e.hash,s)),t},A=function(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")},$t=function(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")},Et=function(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=!1,e.strict??=!1,e.end??=!0,e.start??=!0,e.endsWith="";let s=".*",i=`[^${$t(e.delimiter)}]+?`,a=/[$_\u200C\u200D\p{ID_Continue}]/u,u="";for(let o=0;o<t.length;++o){let r=t[o];if(r.type===3){if(r.modifier===3){u+=A(r.value);continue}u+=`{${A(r.value)}}${k(r.modifier)}`;continue}let h=r.hasCustomName(),n=!!r.suffix.length||!!r.prefix.length&&(r.prefix.length!==1||!e.prefixes.includes(r.prefix)),f=o>0?t[o-1]:null,w=o<t.length-1?t[o+1]:null;if(!n&&h&&r.type===1&&r.modifier===3&&w&&!w.prefix.length&&!w.suffix.length)if(w.type===3){let E=w.value.length>0?w.value[0]:"";n=a.test(E)}else n=!w.hasCustomName();if(!n&&!r.prefix.length&&f&&f.type===3){let E=f.value[f.value.length-1];n=e.prefixes.includes(E)}n&&(u+="{"),u+=A(r.prefix),h&&(u+=`:${r.name}`),r.type===2?u+=`(${r.value})`:r.type===1?h||(u+=`(${i})`):r.type===0&&(!h&&(!f||f.type===3||f.modifier!==3||n||r.prefix!=="")?u+="*":u+=`(${s})`),r.type===1&&h&&r.suffix.length&&a.test(r.suffix[0])&&(u+="\\"),u+=A(r.suffix),n&&(u+="}"),r.modifier!==3&&(u+=k(r.modifier))}return u},P=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,s,i,a,u){this.type=t,this.name=e,this.prefix=s,this.value=i,this.suffix=a,this.modifier=u}hasCustomName(){return this.name!==""&&typeof this.name!="number"}},Y=/[$_\p{ID_Start}]/u,tt=/[$_\u200C\u200D\p{ID_Continue}]/u,D=".*",$={delimiter:"",prefixes:"",sensitive:!0,strict:!0},rt={delimiter:".",prefixes:"",sensitive:!0,strict:!0},it={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0},X=["ftp","file","http","https","ws","wss"],xt=class{#n;#r=[];#e={};#t=0;#i=1;#u=0;#h=0;#l=0;#m=0;#d=!1;constructor(t){this.#n=t}get result(){return this.#e}parse(){for(this.#r=F(this.#n,!0);this.#t<this.#r.length;this.#t+=this.#i){if(this.#i=1,this.#r[this.#t].type==="END"){if(this.#h===0){this.#v(),this.#p()?this.#s(9,1):this.#c()?this.#s(8,1):this.#s(7,0);continue}else if(this.#h===2){this.#f(5);continue}this.#s(10,0);break}if(this.#l>0)if(this.#C())this.#l-=1;else continue;if(this.#k()){this.#l+=1;continue}switch(this.#h){case 0:this.#b()&&this.#f(1);break;case 1:if(this.#b()){this.#P();let t=7,e=1;this.#$()?(t=2,e=3):this.#d&&(t=2),this.#s(t,e)}break;case 2:this.#w()?this.#f(3):(this.#y()||this.#c()||this.#p())&&this.#f(5);break;case 3:this.#E()?this.#s(4,1):this.#w()&&this.#s(5,1);break;case 4:this.#w()&&this.#s(5,1);break;case 5:this.#L()?this.#m+=1:this.#A()&&(this.#m-=1),this.#R()&&!this.#m?this.#s(6,1):this.#y()?this.#s(7,0):this.#c()?this.#s(8,1):this.#p()&&this.#s(9,1);break;case 6:this.#y()?this.#s(7,0):this.#c()?this.#s(8,1):this.#p()&&this.#s(9,1);break;case 7:this.#c()?this.#s(8,1):this.#p()&&this.#s(9,1);break;case 8:this.#p()&&this.#s(9,1);break;case 9:break;case 10:break}}this.#e.hostname!==void 0&&this.#e.port===void 0&&(this.#e.port="")}#s(t,e){switch(this.#h){case 0:break;case 1:this.#e.protocol=this.#a();break;case 2:break;case 3:this.#e.username=this.#a();break;case 4:this.#e.password=this.#a();break;case 5:this.#e.hostname=this.#a();break;case 6:this.#e.port=this.#a();break;case 7:this.#e.pathname=this.#a();break;case 8:this.#e.search=this.#a();break;case 9:this.#e.hash=this.#a();break;case 10:break}this.#h!==0&&t!==10&&([1,2,3,4].includes(this.#h)&&[6,7,8,9].includes(t)&&(this.#e.hostname??=""),[1,2,3,4,5,6].includes(this.#h)&&[8,9].includes(t)&&(this.#e.pathname??=this.#d?"/":""),[1,2,3,4,5,6,7].includes(this.#h)&&t===9&&(this.#e.search??="")),this.#x(t,e)}#x(t,e){this.#h=t,this.#u=this.#t+e,this.#t+=e,this.#i=0}#v(){this.#t=this.#u,this.#i=0}#f(t){this.#v(),this.#h=t}#g(t){return t<0&&(t=this.#r.length-t),t<this.#r.length?this.#r[t]:this.#r[this.#r.length-1]}#o(t,e){let s=this.#g(t);return s.value===e&&(s.type==="CHAR"||s.type==="ESCAPED_CHAR"||s.type==="INVALID_CHAR")}#b(){return this.#o(this.#t,":")}#$(){return this.#o(this.#t+1,"/")&&this.#o(this.#t+2,"/")}#w(){return this.#o(this.#t,"@")}#E(){return this.#o(this.#t,":")}#R(){return this.#o(this.#t,":")}#y(){return this.#o(this.#t,"/")}#c(){if(this.#o(this.#t,"?"))return!0;if(this.#r[this.#t].value!=="?")return!1;let t=this.#g(this.#t-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#p(){return this.#o(this.#t,"#")}#k(){return this.#r[this.#t].type=="OPEN"}#C(){return this.#r[this.#t].type=="CLOSE"}#L(){return this.#o(this.#t,"[")}#A(){return this.#o(this.#t,"]")}#a(){let t=this.#r[this.#t],e=this.#g(this.#u).index;return this.#n.substring(e,t.index)}#P(){let t={};Object.assign(t,$),t.encodePart=N;let e=st(this.#a(),void 0,t);this.#d=V(e)}},S=["protocol","username","password","hostname","port","pathname","search","hash"],x="*",J=class{#n;#r={};#e={};#t={};#i={};#u=!1;constructor(t={},e,s){try{let i;if(typeof e=="string"?i=e:s=e,typeof t=="string"){let r=new xt(t);if(r.parse(),t=r.result,i===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=i}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(i)throw new TypeError("parameter 1 is not of type 'string'.")}typeof s>"u"&&(s={ignoreCase:!1});let a={ignoreCase:s.ignoreCase===!0},u={pathname:x,protocol:x,username:x,password:x,hostname:x,port:x,search:x,hash:x};this.#n=L(u,t,!0),z(this.#n.protocol)===this.#n.port&&(this.#n.port="");let o;for(o of S){if(!(o in this.#n))continue;let r={},h=this.#n[o];switch(this.#e[o]=[],o){case"protocol":Object.assign(r,$),r.encodePart=N;break;case"username":Object.assign(r,$),r.encodePart=dt;break;case"password":Object.assign(r,$),r.encodePart=gt;break;case"hostname":Object.assign(r,rt),K(h)?r.encodePart=q:r.encodePart=Z;break;case"port":Object.assign(r,$),r.encodePart=B;break;case"pathname":V(this.#r.protocol)?(Object.assign(r,it,a),r.encodePart=wt):(Object.assign(r,$,a),r.encodePart=yt);break;case"search":Object.assign(r,$,a),r.encodePart=vt;break;case"hash":Object.assign(r,$,a),r.encodePart=bt;break}try{this.#i[o]=M(h,r),this.#r[o]=W(this.#i[o],this.#e[o],r),this.#t[o]=Et(this.#i[o],r),this.#u=this.#u||this.#i[o].some((n)=>n.type===2)}catch{throw new TypeError(`invalid ${o} pattern '${this.#n[o]}'.`)}}}catch(i){throw new TypeError(`Failed to construct 'URLPattern': ${i.message}`)}}test(t={},e){let s={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?s=L(s,t,!1):s=L(s,H(t,e),!1)}catch{return!1}let i;for(i of S)if(!this.#r[i].exec(s[i]))return!1;return!0}exec(t={},e){let s={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?s=L(s,t,!1):s=L(s,H(t,e),!1)}catch{return null}let i={};e?i.inputs=[t,e]:i.inputs=[t];let a;for(a of S){let u=this.#r[a].exec(s[a]);if(!u)return null;let o={};for(let[r,h]of this.#e[a].entries())if(typeof h=="string"||typeof h=="number"){let n=u[r+1];o[h]=n}i[a]={input:s[a]??"",groups:o}}return i}static compareComponent(t,e,s){let i=(r,h)=>{for(let n of["type","modifier","prefix","value","suffix"]){if(r[n]<h[n])return-1;if(r[n]===h[n])continue;return 1}return 0},a=new P(3,"","","","",3),u=new P(0,"","","","",3),o=(r,h)=>{let n=0;for(;n<Math.min(r.length,h.length);++n){let f=i(r[n],h[n]);if(f)return f}return r.length===h.length?0:i(r[n]??a,h[n]??a)};return!e.#t[t]&&!s.#t[t]?0:e.#t[t]&&!s.#t[t]?o(e.#i[t],[u]):!e.#t[t]&&s.#t[t]?o([u],s.#i[t]):o(e.#i[t],s.#i[t])}get protocol(){return this.#t.protocol}get username(){return this.#t.username}get password(){return this.#t.password}get hostname(){return this.#t.hostname}get port(){return this.#t.port}get pathname(){return this.#t.pathname}get search(){return this.#t.search}get hash(){return this.#t.hash}get hasRegExpGroups(){return this.#u}};if(!globalThis.URLPattern)globalThis.URLPattern=J;function Tt(t){const e=t.toString(),s=new Bun.CryptoHasher("sha1");return s.update(e),s.digest("hex")}
2
+ export{J as r,Tt as s};
@@ -0,0 +1,2 @@
1
+ var g=Object.create;var{defineProperty:f,getPrototypeOf:h,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var k=(a,b,c)=>{c=a!=null?g(h(a)):{};const d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of i(a))if(!j.call(d,e))f(d,e,{get:()=>a[e],enumerable:!0});return d};var l=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);
2
+ export{k as p,l as q};
@@ -0,0 +1,2 @@
1
+ var l="GEMI_REQUEST_BREAKER_ERROR";class a extends Error{constructor(){super(...arguments)}kind="GEMI_REQUEST_BREAKER_ERROR";payload={api:{},view:{}}}import{AsyncLocalStorage as p} from"async_hooks";class e{t;i;s;constructor(t,i,s={}){this.name=t;this.value=i;this.options=s}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((t)=>t!=="").join("; ")}}var o=new p;class r{cookies=new Set;user=null;req=null;constructor(){}setCookie(t,i,s={}){this.cookies.add(new e(t,i,s))}setUser(t){this.user=t}setRequest(t){this.req=t}}class R{static getStore(){return o.getStore()}static setRequest(t){o.getStore().req=t}static async run(t){return o.run(new r,t)}}import{AsyncLocalStorage as u} from"async_hooks";var n=new u;class c{static getStore=()=>n.getStore()}
2
+ export{l as t,a as u,R as v,n as w,c as x};
@@ -0,0 +1,2 @@
1
+ import{u as l,v as P} from"./chunk-c8f1115d77efc1c0.js";class h{requests={};static kind="controller";constructor(){}}class R extends h{constructor(){super(...arguments)}}function w(e){return typeof e==="function"&&e.prototype!==void 0}var C=function(e){return w(e)};class d{e;t;n;middlewares=[];constructor(e,t,n){this.method=e;this.handler=t;this.methodName=n;this.handler=t,this.methodName=n,this.method=e}run(e){let t=e;if(C(this.handler)){const n=new this.handler,r=n[this.methodName].bind(n);return t=n.requests[this.methodName]?new n.requests[this.methodName](e.rawRequest,e.params):t,r(t)}else return this.handler(e)}middleware(e){return this.middlewares=e,this}}class m{routes={};middlewares=[];middleware(e){}get(e,t){return new d("GET",e,t)}post(e,t){return new d("POST",e,t)}put(e,t){return new d("PUT",e,t)}patch(e,t){return new d("PATCH",e,t)}delete(e,t){return new d("DELETE",e,t)}resource(e){class t extends m{constructor(){super(...arguments)}routes={"/":{list:this.get(e,"list"),create:this.post(e,"create")},"/:id":{show:this.get(e,"show"),update:this.put(e,"update"),delete:this.delete(e,"delete")}}}return t}}class f{routes={};middlewares=[];middleware(e){}layout(e,t,n){function r(o=[]){let s=n??{};if(t&&t.constructor===Object)s=t;return{exec:async(i)=>{let a=()=>Promise.resolve({data:{[e]:{}},headers:{},head:{}});if(typeof t==="function")a=t;if(Array.isArray(t)){const[T,y]=t,p=new T(app);a=p[y].bind(p)}const c=await a(i);return{[e]:c}},children:s,viewPath:e,middlewares:o,kind:"layout"}}return{prepare:r,middleware:(o)=>({prepare:()=>r(o)})}}view(e,t,n){function r(o=[]){let s=n??{};if(t&&t.constructor===Object)s=t;return{exec:async(i)=>{let a=()=>Promise.resolve({data:{[e]:{}},headers:{},head:{}});if(typeof t==="function")a=t;if(Array.isArray(t)){const[T,y]=t,p=new T(app);a=p[y].bind(p)}const c=await a(i);return{[e]:c}},children:s,viewPath:e,middlewares:o,kind:"view"}}return{prepare:r,middleware:(o)=>({prepare:()=>r(o)})}}}class u extends l{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}}}}class H extends l{error;constructor(e="Not authorized"){super("Authentication error");this.name="AuthenticationError",this.error=e,this.payload={api:{status:401,data:{error:this.error}},view:{}}}}class g extends l{error;constructor(e="Insufficient permissions"){super("Authentication error");this.name="AuthenticationError",this.error=e,this.payload={api:{status:401,data:{error:this.error}},view:{}}}}class K extends l{constructor(){super("Authentication error");this.name="AuthenticationError"}payload={api:{status:401,data:{error:"Authentication error"}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:"/auth/sign-in"}}}}var b=function(e){const[t,n]=e.split(":");switch(t){case"required":return(r)=>{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)};default:return()=>!0}};class x{e;constructor(e){this.data=e}get(e){return this.data[e]}set(e,t){this.data[e]=t}has(e){return this.data[e]!==void 0}toJSON(){return this.data}}class O{rawRequest;headers;cookies;schema={};params;ctx=P.getStore();constructor(e,t){this.params=t,this.rawRequest=e,this.headers=e.headers;const n=this.rawRequest.headers.get("Cookie"),r=new Map;if(n){const o=n.split(";");for(let s of o){const[i,a]=s.split("=");r.set(i.trim(),a.trim())}}this.cookies=r}async parseBody(){const e=new x({});if(this.rawRequest.headers.get("Content-Type")==="application/json"){const t=await this.rawRequest.json();for(let[n,r]of Object.entries(t))e.set(n,r)}if(this.rawRequest.headers.get("Content-Type")==="application/x-www-form-urlencoded"){const t=await this.rawRequest.formData();for(let[n,r]of t)e.set(n,r)}if(this.rawRequest.headers.get("Content-Type").startsWith("multipart/form-data")){const t=await this.rawRequest.formData();for(let[n,r]of t)if(e.has(n)){const o=e.get(n);if(Array.isArray(o))o.push(r),e.set(n,o);else e.set(n,[o,r])}else e.set(n,r)}return e}validateInput(e){const t={};for(let[n,r]of Object.entries(this.schema))for(let[o,s]of Object.entries(r))if(!b(o)(e.get(n))){if(!t[n])t[n]=[];if(o==="required"){t[n]=[String(s)];break}else t[n].push(String(s))}if(Object.keys(t).length>0)throw new u(t);else return e}async input(){return this.validateInput(await this.parseBody())}async safeInput(){const e=await this.parseBody();try{return this.validateInput(e),{isValid:!0,errors:{},input:e}}catch(t){if(!(t instanceof u))throw t;return{isValid:!1,errors:t.errors,input:e}}}async terminate(e){throw"not implemented"}}class M{aliases={}}class I{policiesList={};constructor(){const e=this.register();for(let t of e){const n=new t;this.policiesList[t.name]=n}}register(){return[]}}
2
+ export{h as d,R as e,w as f,m as g,f as h,u as i,H as j,g as k,K as l,O as m,M as n,I as o};
@@ -1 +1 @@
1
- {"version":3,"file":"QueryManager.d.ts","sourceRoot":"","sources":["../../client/QueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAe3C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,cAAM,QAAQ;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,KAAK,UAAQ;IACb,UAAU,EAAE,KAAK,GAAG,IAAI,CAAQ;gBAEpB,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,GAAU;IAYjD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;IAS5B,KAAK;IAwBL,OAAO;CAsCR;AAED,qBAAa,YAAY;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAa;;IAI7C,OAAO,CAAC,iBAAiB;IAIzB,KAAK,CACH,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;CAiBnC"}
1
+ {"version":3,"file":"QueryManager.d.ts","sourceRoot":"","sources":["../../client/QueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAe3C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,cAAM,QAAQ;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACtB,KAAK,UAAQ;IACb,UAAU,EAAE,KAAK,GAAG,IAAI,CAAQ;gBAEpB,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,GAAU;IAWjD,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;IAS5B,KAAK;IAuBL,OAAO;CA8CR;AAED,qBAAa,YAAY;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAa;;IAI7C,OAAO,CAAC,iBAAiB;IAIzB,KAAK,CACH,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;CAiBnC"}
@@ -0,0 +1,10 @@
1
+ type State = {
2
+ data: any;
3
+ createdAt: number;
4
+ };
5
+ export declare class QueryStore {
6
+ store: Map<string, State>;
7
+ resolve(url: string, fresh?: boolean): Promise<any>;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=QueryStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryStore.d.ts","sourceRoot":"","sources":["../../client/QueryStore.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,UAAU;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAEpB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,UAAQ;CA0BzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useUser.d.ts","sourceRoot":"","sources":["../../../client/auth/useUser.ts"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,6CAatB"}
1
+ {"version":3,"file":"useUser.d.ts","sourceRoot":"","sources":["../../../client/auth/useUser.ts"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,6CAgBtB"}
@@ -55,9 +55,7 @@ class Resource {
55
55
  error: null,
56
56
  loading: false
57
57
  });
58
- if (fallbackData) {
59
- this.stale = false;
60
- }
58
+ this.stale = !!fallbackData;
61
59
  }
62
60
  mutate(fn) {
63
61
  const data = fn(this.state.getValue().data);
@@ -82,7 +80,6 @@ class Resource {
82
80
  } else {
83
81
  if (this.stale) {
84
82
  this.resolve();
85
- return this.state;
86
83
  }
87
84
  }
88
85
  return this.state;
@@ -93,6 +90,12 @@ class Resource {
93
90
  const url = key.split("GET:")[1];
94
91
  const searchParams = new URLSearchParams(query);
95
92
  const finalUrl = [applyParams$1(url, params), searchParams.toString()].filter((s) => s.length > 0).join("?");
93
+ const { data, error } = this.state.getValue();
94
+ this.state.next({
95
+ data,
96
+ error,
97
+ loading: true
98
+ });
96
99
  fetch(`/api${finalUrl}`, {
97
100
  method: "GET",
98
101
  headers: {
@@ -104,9 +107,9 @@ class Resource {
104
107
  } else {
105
108
  throw new Error("Failed to fetch");
106
109
  }
107
- }).then((data) => {
110
+ }).then((data2) => {
108
111
  this.stale = false;
109
- this.mutate(() => data);
112
+ this.mutate(() => data2);
110
113
  clearTimeout(this.staleTimer);
111
114
  this.staleTimer = setTimeout(() => {
112
115
  this.stale = true;
@@ -30369,12 +30372,15 @@ function useUser() {
30369
30372
  const { data, loading } = useQuery(
30370
30373
  "GET:/me",
30371
30374
  { params: {}, query: {} },
30372
- { fallbackData: { user: auth.user }, pathPrefix: "/auth" }
30375
+ {
30376
+ pathPrefix: "/auth",
30377
+ fallbackData: auth.user ? { user: auth == null ? void 0 : auth.user } : null
30378
+ }
30373
30379
  );
30374
30380
  if (loading) {
30375
30381
  return null;
30376
30382
  }
30377
- return data.user;
30383
+ return data == null ? void 0 : data.user;
30378
30384
  }
30379
30385
  export {
30380
30386
  Form,
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"../http/index.js";import"../facades/index.js";import{h as w,i as c} from"../kernel/index.js";import"../chunk-847629c9a7550cc3.js";import"../chunk-0d0f764773c0f6b8.js";import{renderToStaticMarkup as u} from"react-dom/server";var x=(t)=>{return`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">${u(t)}`};class s{static async send(t,r){const e=new t,{to:a=e.to,from:l=e.from,subject:m=e.subject,cc:p=e.cc,bcc:T=e.bcc,attachments:d=e.attachments,data:E}=r,n=x(e.render(E));if(process.env.EMAIL_DEBUG){const o=`${process.env.ROOT_DIR}/.debug/emails/${(new Date()).toISOString()}${m}.html`;await Bun.write(o,n),Bun.spawnSync(["open",o]);return}await c.getContext().emailServiceProvider.send({bcc:T,cc:p,from:l,subject:m,to:a,attachments:d,html:n})}}import{createElement as f,Fragment as g} from"react";class i{from="doe@gemijs.dev";to=["hi@gemijs.dev"];subject="Welcome";cc=[];bcc=[];attachments=[];render(t){return console.log("EmailTemplate"),f(g,null,"EmailTemplate")}}export{i as EmailTemplate,w as EmailServiceProvider,s as Email};
2
+ import"../facades/index.js";import{b as w,c} from"../kernel/index.js";import"../chunk-e86269d01f94404c.js";import"../chunk-9350baa090b5a424.js";import"../chunk-c8f1115d77efc1c0.js";import{renderToStaticMarkup as u} from"react-dom/server";var x=(t)=>{return`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">${u(t)}`};class s{static async send(t,r){const e=new t,{to:a=e.to,from:l=e.from,subject:m=e.subject,cc:p=e.cc,bcc:T=e.bcc,attachments:d=e.attachments,data:E}=r,n=x(e.render(E));if(process.env.EMAIL_DEBUG){const o=`${process.env.ROOT_DIR}/.debug/emails/${(new Date()).toISOString()}${m}.html`;await Bun.write(o,n),Bun.spawnSync(["open",o]);return}await c.getContext().emailServiceProvider.send({bcc:T,cc:p,from:l,subject:m,to:a,attachments:d,html:n})}}import{createElement as f,Fragment as g} from"react";class i{from="doe@gemijs.dev";to=["hi@gemijs.dev"];subject="Welcome";cc=[];bcc=[];attachments=[];render(t){return console.log("EmailTemplate"),f(g,null,"EmailTemplate")}}export{i as EmailTemplate,w as EmailServiceProvider,s as Email};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{m as d,n as c,p as i} from"../chunk-847629c9a7550cc3.js";import"../chunk-0d0f764773c0f6b8.js";class o{static async user(){const r=c.getStore(),p=r.req.cookies.get("access_token");let a=r.user;if(!a)a=(await i.getStore().authenticationServiceProvider.adapter.findSession({token:p,userAgent:r.req.headers.get("User-Agent")}))?.user,r.setUser(a);if(a)return a;return null}}class m extends d{constructor(r){super("Redirect error");this.name="RedirectError",this.payload={api:{status:302,data:{error:"Redirect error"}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:r}}}}}class h{static to(r){throw new m(r)}}export{h as Redirect,o as Auth};export{o as g};
2
+ import"../chunk-9350baa090b5a424.js";import{u as d,v as c,x as i} from"../chunk-c8f1115d77efc1c0.js";class o{static async user(){const r=c.getStore(),p=r.req.cookies.get("access_token");let a=r.user;if(!a)a=(await i.getStore().authenticationServiceProvider.adapter.findSession({token:p,userAgent:r.req.headers.get("User-Agent")}))?.user,r.setUser(a);if(a)return a;return null}}class m extends d{constructor(r){super("Redirect error");this.name="RedirectError",this.payload={api:{status:302,data:{error:"Redirect error"}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:r}}}}}class h{static to(r){throw new m(r)}}export{h as Redirect,o as Auth};export{o as a};
@@ -0,0 +1,7 @@
1
+ import { Policies } from "./Policy";
2
+ export declare class PoliciesServiceProvider {
3
+ policiesList: Record<string, Policies>;
4
+ constructor();
5
+ protected register(): Array<new () => Policies>;
6
+ }
7
+ //# sourceMappingURL=PoliciesServiceProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoliciesServiceProvider.d.ts","sourceRoot":"","sources":["../../http/PoliciesServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,qBAAa,uBAAuB;IAClC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAM;;IAS5C,SAAS,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,QAAQ,CAAC;CAGhD"}
@@ -0,0 +1,4 @@
1
+ export declare class Policies {
2
+ all(_operation: string, _args: any): Promise<boolean> | boolean;
3
+ }
4
+ //# sourceMappingURL=Policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Policy.d.ts","sourceRoot":"","sources":["../../http/Policy.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO;CAGhE"}
@@ -6,24 +6,6 @@ type MiddlewareResult = Partial<{
6
6
  }>;
7
7
  export type MiddlewareReturnType = void | Promise<MiddlewareResult> | MiddlewareResult;
8
8
  export type RouterMiddleware = (req: HttpRequest, ctx: any) => MiddlewareReturnType;
9
- export declare class AuthenticationError extends RequestBreakerError {
10
- constructor();
11
- payload: {
12
- api: {
13
- status: number;
14
- data: {
15
- error: string;
16
- };
17
- };
18
- view: {
19
- status: number;
20
- headers: {
21
- "Cache-Control": string;
22
- Location: string;
23
- };
24
- };
25
- };
26
- }
27
9
  export declare class ValidationError extends RequestBreakerError {
28
10
  errors: Record<string, string[]>;
29
11
  constructor(errors: Record<string, string[]>);
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../http/Router.ts"],"names":[],"mappings":"AAAA,OAAO,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AAG,EAAE,GAAG,KACL,oBAAoB,CAAC;AAE1B,qBAAa,eAAgB,SAAQ,mBAAmB;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAM;gBAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;CAsB7C"}
@@ -0,0 +1,28 @@
1
+ import { RequestBreakerError } from "./Error";
2
+ export declare class AuthorizationError extends RequestBreakerError {
3
+ private error;
4
+ constructor(error?: string);
5
+ }
6
+ export declare class InsufficientPermissionsError extends RequestBreakerError {
7
+ private error;
8
+ constructor(error?: string);
9
+ }
10
+ export declare class AuthenticationError extends RequestBreakerError {
11
+ constructor();
12
+ payload: {
13
+ api: {
14
+ status: number;
15
+ data: {
16
+ error: string;
17
+ };
18
+ };
19
+ view: {
20
+ status: number;
21
+ headers: {
22
+ "Cache-Control": string;
23
+ Location: string;
24
+ };
25
+ };
26
+ };
27
+ }
28
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../http/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,OAAO,CAAC,KAAK,CAAS;gBACV,KAAK,GAAE,MAAyB;CAY7C;AAED,qBAAa,4BAA6B,SAAQ,mBAAmB;IACnE,OAAO,CAAC,KAAK,CAAS;gBACV,KAAK,GAAE,MAAmC;CAYvD;AAED,qBAAa,mBAAoB,SAAQ,mBAAmB;;IAM1D,OAAO;;;;;;;;;;;;;;MAaL;CACH"}
@@ -1,11 +1,14 @@
1
1
  export { Controller, ResourceController } from "./Controller";
2
2
  export { ApiRouter, type CreateRPC } from "./ApiRouter";
3
3
  export { ViewRouter } from "./ViewRouter";
4
- export { ValidationError, AuthenticationError } from "./Router";
4
+ export { ValidationError } from "./Router";
5
+ export { AuthenticationError } from "./errors";
5
6
  export { HttpRequest } from "./HttpRequest";
6
7
  export { Middleware } from "./Middleware";
7
8
  export { getCookies } from "./getCookies";
8
9
  export { RequestBreakerError } from "./Error";
9
10
  export { MiddlewareServiceProvider } from "./MiddlewareServiceProvider";
10
11
  export { AuthenticationMiddleware } from "./AuthenticationMiddlware";
12
+ export { PoliciesServiceProvider } from "./PoliciesServiceProvider";
13
+ export { Policies } from "./Policy";
11
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{m as c,n as T,p as M} from"../chunk-847629c9a7550cc3.js";import"../chunk-0d0f764773c0f6b8.js";class x{requests={};static kind="controller";constructor(){}}class C extends x{constructor(){super(...arguments)}}function P(e){return typeof e==="function"&&e.prototype!==void 0}var b=function(e){return P(e)};class d{e;t;n;middlewares=[];constructor(e,t,n){this.method=e;this.handler=t;this.methodName=n;this.handler=t,this.methodName=n,this.method=e}run(e){let t=e;if(b(this.handler)){const n=new this.handler,r=n[this.methodName].bind(n);return t=n.requests[this.methodName]?new n.requests[this.methodName](e.rawRequest,e.params):t,r(t)}else return this.handler(e)}middleware(e){return this.middlewares=e,this}}class R{routes={};middlewares=[];middleware(e){}get(e,t){return new d("GET",e,t)}post(e,t){return new d("POST",e,t)}put(e,t){return new d("PUT",e,t)}patch(e,t){return new d("PATCH",e,t)}delete(e,t){return new d("DELETE",e,t)}resource(e){class t extends R{constructor(){super(...arguments)}routes={"/":{list:this.get(e,"list"),create:this.post(e,"create")},"/:id":{show:this.get(e,"show"),update:this.put(e,"update"),delete:this.delete(e,"delete")}}}return t}}class f{routes={};middlewares=[];middleware(e){}layout(e,t,n){function r(o=[]){let s=n??{};if(t&&t.constructor===Object)s=t;return{exec:async(i)=>{let a=()=>Promise.resolve({data:{[e]:{}},headers:{},head:{}});if(typeof t==="function")a=t;if(Array.isArray(t)){const[h,m]=t,l=new h(app);a=l[m].bind(l)}const w=await a(i);return{[e]:w}},children:s,viewPath:e,middlewares:o,kind:"layout"}}return{prepare:r,middleware:(o)=>({prepare:()=>r(o)})}}view(e,t,n){function r(o=[]){let s=n??{};if(t&&t.constructor===Object)s=t;return{exec:async(i)=>{let a=()=>Promise.resolve({data:{[e]:{}},headers:{},head:{}});if(typeof t==="function")a=t;if(Array.isArray(t)){const[h,m]=t,l=new h(app);a=l[m].bind(l)}const w=await a(i);return{[e]:w}},children:s,viewPath:e,middlewares:o,kind:"view"}}return{prepare:r,middleware:(o)=>({prepare:()=>r(o)})}}}class p extends c{constructor(){super("Authentication error");this.name="AuthenticationError"}payload={api:{status:401,data:{error:"Authentication error"}},view:{status:302,headers:{"Cache-Control":"private, no-cache, no-store, max-age=0, must-revalidate",Location:"/auth/sign-in"}}}}class u extends c{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}}}}var O=function(e){const[t,n]=e.split(":");switch(t){case"required":return(r)=>{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)};default:return()=>!0}};class H{e;constructor(e){this.data=e}get(e){return this.data[e]}set(e,t){this.data[e]=t}has(e){return this.data[e]!==void 0}toJSON(){return this.data}}class g{rawRequest;headers;cookies;schema={};params;ctx=T.getStore();constructor(e,t){this.params=t,this.rawRequest=e,this.headers=e.headers;const n=this.rawRequest.headers.get("Cookie"),r=new Map;if(n){const o=n.split(";");for(let s of o){const[i,a]=s.split("=");r.set(i.trim(),a.trim())}}this.cookies=r}async parseBody(){const e=new H({});if(this.rawRequest.headers.get("Content-Type")==="application/json"){const t=await this.rawRequest.json();for(let[n,r]of Object.entries(t))e.set(n,r)}if(this.rawRequest.headers.get("Content-Type")==="application/x-www-form-urlencoded"){const t=await this.rawRequest.formData();for(let[n,r]of t)e.set(n,r)}if(this.rawRequest.headers.get("Content-Type").startsWith("multipart/form-data")){const t=await this.rawRequest.formData();for(let[n,r]of t)if(e.has(n)){const o=e.get(n);if(Array.isArray(o))o.push(r),e.set(n,o);else e.set(n,[o,r])}else e.set(n,r)}return e}validateInput(e){const t={};for(let[n,r]of Object.entries(this.schema))for(let[o,s]of Object.entries(r))if(!O(o)(e.get(n))){if(!t[n])t[n]=[];if(o==="required"){t[n]=[String(s)];break}else t[n].push(String(s))}if(Object.keys(t).length>0)throw new u(t);else return e}async input(){return this.validateInput(await this.parseBody())}async safeInput(){const e=await this.parseBody();try{return this.validateInput(e),{isValid:!0,errors:{},input:e}}catch(t){if(!(t instanceof u))throw t;return{isValid:!1,errors:t.errors,input:e}}}async terminate(e){throw"not implemented"}}class y{async run(e){return{}}}function I(e){const t=e.headers.get("cookie");if(!t)return new Map;const n=new Map,r=t.split(";");for(let o of r){const[s,i]=o.split("=");n.set(s.trim(),i)}return n}class K{aliases={}}class q extends y{constructor(){super(...arguments)}async run(e){const t=T.getStore(),n=t.req.cookies.get("access_token");if(!n)throw new p;let r=t.user;if(!r){const o=await M.getStore().authenticationServiceProvider.adapter.findSession({token:n,userAgent:t.req.headers.get("User-Agent")});if(!o)throw new p;r=o?.user,t.setUser(r)}return{}}}export{I as getCookies,f as ViewRouter,u as ValidationError,C as ResourceController,c as RequestBreakerError,K as MiddlewareServiceProvider,y as Middleware,g as HttpRequest,x as Controller,q as AuthenticationMiddleware,p as AuthenticationError,R as ApiRouter};export{x as a,P as b,R as c,f as d,g as e,K as f};
2
+ import{d,e as x,g,h as w,i as k,l as n,m as R,n as h,o as C} from"../chunk-e86269d01f94404c.js";import"../chunk-9350baa090b5a424.js";import{u as q,v as a,x as p} from"../chunk-c8f1115d77efc1c0.js";class s{async run(o){return{}}}function l(o){const e=o.headers.get("cookie");if(!e)return new Map;const r=new Map,t=e.split(";");for(let i of t){const[m,f]=i.split("=");r.set(m.trim(),f)}return r}class c extends s{constructor(){super(...arguments)}async run(o){const e=a.getStore(),r=e.req.cookies.get("access_token");if(!r)throw new n;let t=e.user;if(!t){const i=await p.getStore().authenticationServiceProvider.adapter.findSession({token:r,userAgent:e.req.headers.get("User-Agent")});if(!i)throw new n;t=i?.user,e.setUser(t)}return{}}}class u{all(o,e){return!0}}export{l as getCookies,w as ViewRouter,k as ValidationError,x as ResourceController,q as RequestBreakerError,C as PoliciesServiceProvider,u as Policies,h as MiddlewareServiceProvider,s as Middleware,R as HttpRequest,d as Controller,c as AuthenticationMiddleware,n as AuthenticationError,g as ApiRouter};
@@ -1,19 +1,23 @@
1
1
  import { EmailServiceProvider } from "../email/EmailServiceProvider";
2
2
  import { AuthenticationServiceProvider } from "../auth/AuthenticationServiceProvider";
3
3
  import { MiddlewareServiceProvider } from "../http/MiddlewareServiceProvider";
4
+ import { PoliciesServiceProvider } from "../http/PoliciesServiceProvider";
4
5
  export declare class Kernel {
5
6
  protected emailServiceProvider: typeof EmailServiceProvider;
6
7
  protected authenticationServiceProvider: typeof AuthenticationServiceProvider;
7
8
  protected middlewareServiceProvider: typeof MiddlewareServiceProvider;
9
+ protected policiesServiceProvider: typeof PoliciesServiceProvider;
8
10
  services: {
9
11
  emailServiceProvider: EmailServiceProvider;
10
12
  authenticationServiceProvider: AuthenticationServiceProvider;
11
13
  middlewareServiceProvider: MiddlewareServiceProvider;
14
+ policiesServiceProvider: PoliciesServiceProvider;
12
15
  };
13
16
  getServices: () => {
14
17
  emailServiceProvider: EmailServiceProvider;
15
18
  authenticationServiceProvider: AuthenticationServiceProvider;
16
19
  middlewareServiceProvider: MiddlewareServiceProvider;
20
+ policiesServiceProvider: PoliciesServiceProvider;
17
21
  };
18
22
  static getContext: () => import("./context").KernelContextValue;
19
23
  run<T>(cb: () => T): T;
@@ -1 +1 @@
1
- {"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../kernel/Kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,qBAAa,MAAM;IACjB,SAAS,CAAC,oBAAoB,8BAAwB;IACtD,SAAS,CAAC,6BAA6B,uCAAiC;IACxE,SAAS,CAAC,yBAAyB,mCAA6B;IAEhE,QAAQ,EAAE;QACR,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,6BAA6B,EAAE,6BAA6B,CAAC;QAC7D,yBAAyB,EAAE,yBAAyB,CAAC;KACtD,CAAC;IAEF,WAAW;8BALa,oBAAoB;uCACX,6BAA6B;mCACjC,yBAAyB;MAYpD;IAEF,MAAM,CAAC,UAAU,+CAAkC;IAEnD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC;CAInB"}
1
+ {"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../kernel/Kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,qBAAa,MAAM;IACjB,SAAS,CAAC,oBAAoB,8BAAwB;IACtD,SAAS,CAAC,6BAA6B,uCAAiC;IACxE,SAAS,CAAC,yBAAyB,mCAA6B;IAChE,SAAS,CAAC,uBAAuB,iCAA2B;IAE5D,QAAQ,EAAE;QACR,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,6BAA6B,EAAE,6BAA6B,CAAC;QAC7D,yBAAyB,EAAE,yBAAyB,CAAC;QACrD,uBAAuB,EAAE,uBAAuB,CAAC;KAClD,CAAC;IAEF,WAAW;8BANa,oBAAoB;uCACX,6BAA6B;mCACjC,yBAAyB;iCAC3B,uBAAuB;MAahD;IAEF,MAAM,CAAC,UAAU,+CAAkC;IAEnD,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC;CAInB"}
@@ -1,9 +1,11 @@
1
1
  import { AsyncLocalStorage } from "async_hooks";
2
2
  import { EmailServiceProvider } from "../email/EmailServiceProvider";
3
3
  import { AuthenticationServiceProvider } from "../auth/AuthenticationServiceProvider";
4
+ import { PoliciesServiceProvider } from "../http/PoliciesServiceProvider";
4
5
  export interface KernelContextValue {
5
6
  emailServiceProvider: EmailServiceProvider;
6
7
  authenticationServiceProvider?: AuthenticationServiceProvider;
8
+ policiesServiceProvider?: PoliciesServiceProvider;
7
9
  }
8
10
  export declare const kernelContext: AsyncLocalStorage<KernelContextValue>;
9
11
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../kernel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAEtF,MAAM,WAAW,kBAAkB;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;CAC/D;AAED,eAAO,MAAM,aAAa,uCAA8C,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../kernel/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,6BAA6B,CAAC,EAAE,6BAA6B,CAAC;IAC9D,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED,eAAO,MAAM,aAAa,uCAA8C,CAAC"}