@elysiajs/eden
Advanced tools
Comparing version 1.0.14 to 1.1.0-exp.1
@@ -1,1 +0,1 @@ | ||
"use strict";var Eden=(()=>{var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},F=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var N=t=>F(p({},"__esModule",{value:!0}),t);var j={};T(j,{edenFetch:()=>O});var y=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",d=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(y(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:d,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:d}});return d()};return N(j);})(); | ||
"use strict";var Eden=(()=>{var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},N=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var F=t=>N(p({},"__esModule",{value:!0}),t);var C={};T(C,{edenFetch:()=>O});var d=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",y=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(d(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:y,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:y}});return y()};return F(C);})(); |
@@ -1,1 +0,1 @@ | ||
"use strict";var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},F=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var N=t=>F(p({},"__esModule",{value:!0}),t);var j={};T(j,{edenFetch:()=>O});module.exports=N(j);var y=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",d=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(y(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:d,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:d}});return d()};0&&(module.exports={edenFetch}); | ||
"use strict";var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(t,r)=>{for(var s in r)p(t,s,{get:r[s],enumerable:!0})},N=(t,r,s,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of A(r))!x.call(t,a)&&a!==s&&p(t,a,{get:()=>r[a],enumerable:!(o=k(r,a))||o.enumerable});return t};var F=t=>N(p({},"__esModule",{value:!0}),t);var C={};T(C,{edenFetch:()=>O});module.exports=F(C);var d=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var u=class extends Error{constructor(s,o){super(o+"");this.status=s;this.value=o}};var m=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,w=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,b=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/;var O=(t,r)=>(s,{query:o,params:a,body:l,...f}={})=>{a&&Object.entries(a).forEach(([e,i])=>{s=s.replace(`:${e}`,i)});let h=f.headers?.["Content-Type"];if(!h||h==="application/json")try{l=JSON.stringify(l)}catch{}let S=r?.fetcher||globalThis.fetch,E=o?`?${new URLSearchParams(o).toString()}`:"",y=()=>S(t+s+E,{...f,method:f.method?.toUpperCase()||"GET",headers:l?{"content-type":"application/json",...f.headers}:f.headers,body:l}).then(async e=>{let i;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":i=await e.json();break;case"application/octet-stream":i=await e.arrayBuffer();break;case"multipart/form-data":let v=await e.formData();i={},v.forEach((n,c)=>{i[c]=n});break;default:i=await e.text().then(n=>{if(d(n))return+n;if(n==="true")return!0;if(n==="false")return!1;if(!n)return n;let c=n.replace(/"/g,"");if(m.test(c)||w.test(c)||b.test(c)){let g=new Date(c);if(!Number.isNaN(g.getTime()))return g}return n})}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:y,error:new u(e.status,i)}:{data:i,error:null,status:e.status,headers:e.headers,retry:y}});return y()};0&&(module.exports={edenFetch}); |
@@ -25,2 +25,5 @@ import { InputSchema, Elysia } from 'elysia'; | ||
} & {}; | ||
type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = { | ||
[K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? AsyncGenerator<A, B, C> : RecordType[K]; | ||
} & {}; | ||
type MaybeArray<T> = T | T[]; | ||
@@ -72,3 +75,3 @@ type MaybePromise<T> = T | Promise<T>; | ||
} | ||
type TreatyResponse<Res extends Record<number, unknown>> = { | ||
type TreatyResponse<_Res extends Record<number, unknown>, Res extends Record<number, unknown> = ReplaceGeneratorWithAsyncGenerator<_Res>> = { | ||
data: Res[200]; | ||
@@ -75,0 +78,0 @@ error: null; |
@@ -1,1 +0,1 @@ | ||
"use strict";var Eden=(()=>{var P=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of ae(e))!ie.call(t,c)&&c!==r&&P(t,c,{get:()=>e[c],enumerable:!(s=se(e,c))||s.enumerable});return t};var fe=t=>ce(P({},"__esModule",{value:!0}),t);var de={};oe(de,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[c,n]of Object.entries(r))s+=`${c}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var O=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,c=>{if(e==="message"){let n=c.data.toString(),a=n.charCodeAt(0),d=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(W,w)=>{if(typeof w=="string"&&z.test(w)){let m=new Date(w);if(!Number.isNaN(m.getTime()))return m}return w})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&d===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...c,data:n})}else r(c)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",U=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,B=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,H=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),M=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let c of t)if(!Array.isArray(c))s=M(c,e,r,s);else{let n=c[0];if(typeof n=="string")s[n.toLowerCase()]=c[1];else for(let[a,d]of n)s[a.toLowerCase()]=d}return s}if(!t)return s;switch(typeof t){case"function":let c=t(e,r);return c?M(c,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}},$=(t,e,r=[],s)=>new Proxy(()=>{},{get(c,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(c,n,[a,d]){if(!a||d||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let W=[...r],w=W.pop(),m="/"+W.join("/"),{fetcher:u=fetch,headers:g,onRequest:b,onResponse:p,fetch:S}=e,v=w==="get"||w==="head"||w==="subscribe";g=M(g,m,d);let K=v?a?.query:d?.query,k="";if(K){let o=(L,T)=>{k+=(k?"&":"?")+`${encodeURIComponent(L)}=${encodeURIComponent(T)}`};for(let[L,T]of Object.entries(K)){if(Array.isArray(T)){for(let f of T)o(L,f);continue}o(L,`${T}`)}}if(w==="subscribe"){let o=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(L=>t.includes(L))?"ws://":"wss://")+m+k;return new D(o)}return(async()=>{let o={method:w?.toUpperCase(),body:a,...S,headers:g};o.headers={...g,...M(v?a?.headers:d?.headers,m,o)};let L=v&&typeof a=="object"?a.fetch:d?.fetch;if(o={...o,...L},v&&delete o.body,b){Array.isArray(b)||(b=[b]);for(let h of b){let i=await h(m,o);typeof i=="object"&&(o={...o,...i,headers:{...o.headers,...M(i.headers,m,o)}})}}if(v&&delete o.body,ue(a)){let h=new FormData;for(let[i,l]of Object.entries(o.body)){if(J){h.append(i,l);continue}if(l instanceof File){h.append(i,await q(l));continue}if(l instanceof FileList){for(let y=0;y<l.length;y++)h.append(i,await q(l[y]));continue}if(Array.isArray(l)){for(let y=0;y<l.length;y++){let x=l[y];h.append(i,x instanceof File?await q(x):x)}continue}h.append(i,l)}o.body=h}else typeof a=="object"?(o.headers["content-type"]="application/json",o.body=JSON.stringify(a)):a!=null&&(o.headers["content-type"]="text/plain");if(v&&delete o.body,b){Array.isArray(b)||(b=[b]);for(let h of b){let i=await h(m,o);typeof i=="object"&&(o={...o,...i,headers:{...o.headers,...i.headers}})}}let T=t+m+k,f=await(s?.handle(new Request(T,o))??u(T,o)),A=null,E=null;if(p){Array.isArray(p)||(p=[p]);for(let h of p)try{let i=await h(f.clone());if(i!=null){A=i;break}}catch(i){i instanceof O?E=i:E=new O(422,i);break}}if(A===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"application/json":A=await f.json();break;case"application/octet-stream":A=await f.arrayBuffer();break;case"multipart/form-data":let h=await f.formData();A={},h.forEach((i,l)=>{A[l]=i});break;default:A=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let l=i.replace(/"/g,"");if(U.test(l)||B.test(l)||H.test(l)){let y=new Date(l);if(!Number.isNaN(y.getTime()))return y}return i})}(f.status>=300||f.status<200)&&(E=new O(f.status,A),A=null)}return{data:A,error:E,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,le=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,c=>{if(e==="message"){let n=c.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...c,data:n})}else r(c)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,c,n){return te(t,`${e}/${c.toString()}`,r)},apply(s,c,[n,a={}]=[{},{}]){let d=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:W,$fetch:w,$headers:m,$transform:u,getRaw:g,...b}=n??{};d??=b;let p=e.lastIndexOf("/"),S=e.slice(p+1).toUpperCase(),v=V(t,p===-1?"/":e.slice(0,p),Object.assign(a.query??{},W)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,o=u?Array.isArray(u)?u:[u]:void 0;return o&&(k?k=o.concat(k):k=o),S==="SUBSCRIBE"?new G(v.replace(/^([^]+):\/\//,v.startsWith("https://")?"wss://":"ws://")):(async T=>{let f,A={...r.$fetch?.headers,...w?.headers,...a.headers,...m};if(S!=="GET"&&S!=="HEAD"){f=Object.keys(d).length||Array.isArray(d)?d:void 0;let y=f&&(typeof f=="object"||Array.isArray(d));if(y&&le(f)){let j=new FormData;for(let[C,F]of Object.entries(f))if(Z)j.append(C,F);else if(F instanceof File)j.append(C,await _(F));else if(F instanceof FileList)for(let N=0;N<F.length;N++)j.append(C,await _(F[N]));else if(Array.isArray(F))for(let N=0;N<F.length;N++){let I=F[N];j.append(C,I instanceof File?await _(I):I)}else j.append(C,F);f=j}else f!=null&&(A["content-type"]=y?"application/json":"text/plain",f=y?JSON.stringify(f):d)}let E=await K(v,{method:S,body:f,...r.$fetch,...a.fetch,...w,headers:A}),h;if(T.getRaw)return E;switch(E.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await E.json();break;default:h=await E.text().then(y=>R(y)?+y:y==="true"?!0:y==="false"?!1:y)}let i=E.status>=300||E.status<200?new O(E.status,h):null,l={data:h,error:i,response:E,status:E.status,headers:E.headers};if(k)for(let y of k){let x=y(l);x instanceof Promise&&(x=await x),x!=null&&(l=x)}return l})({getRaw:g})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:c,body:n,...a}={})=>{c&&Object.entries(c).forEach(([u,g])=>{r=r.replace(`:${u}`,g)});let d=a.headers?.["Content-Type"];if(!d||d==="application/json")try{n=JSON.stringify(n)}catch{}let W=e?.fetcher||globalThis.fetch,w=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>W(t+r+w,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async u=>{let g;switch(u.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await u.json();break;case"application/octet-stream":g=await u.arrayBuffer();break;case"multipart/form-data":let b=await u.formData();g={},b.forEach((p,S)=>{g[S]=p});break;default:g=await u.text().then(p=>{if(R(p))return+p;if(p==="true")return!0;if(p==="false")return!1;if(!p)return p;let S=p.replace(/"/g,"");if(U.test(S)||B.test(S)||H.test(S)){let v=new Date(S);if(!Number.isNaN(v.getTime()))return v}return p})}return u.status>300?{data:null,status:u.status,headers:u.headers,retry:m,error:new O(u.status,g)}:{data:g,error:null,status:u.status,headers:u.headers,retry:m}});return m()};return fe(de);})(); | ||
"use strict";var Eden=(()=>{var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ie.call(t,o)&&o!==r&&U(t,o,{get:()=>e[o],enumerable:!(s=se(e,o))||s.enumerable});return t};var fe=t=>ce(U({},"__esModule",{value:!0}),t);var pe={};oe(pe,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[o,n]of Object.entries(r))s+=`${o}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var L=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0),y=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(T,p)=>{if(typeof p=="string"&&z.test(p)){let m=new Date(p);if(!Number.isNaN(m.getTime()))return m}return p})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&y===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],H=typeof FileList>"u",I=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,P=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,q=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>H?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},B=t=>H?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),j=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let o of t)if(!Array.isArray(o))s=j(o,e,r,s);else{let n=o[0];if(typeof n=="string")s[n.toLowerCase()]=o[1];else for(let[a,y]of n)s[a.toLowerCase()]=y}return s}if(!t)return s;switch(typeof t){case"function":if(t instanceof Headers)return j(t,e,r,s);let o=t(e,r);return o?j(o,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}};async function*le(t){let e=t.body;if(!e)return;let r=e.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:n}=await r.read();if(o)break;let a=s.decode(n);if(R(a)){yield+a;continue}if(a==="true"){yield!0;continue}if(a==="false"){yield!1;continue}let y=a.charCodeAt(0),T=a.charCodeAt(a.length-1);if(y===123&&T===125||y===91&&T===93)try{yield JSON.parse(a);continue}catch{}let p=a.replace(/"/g,"");if(I.test(p)||P.test(p)||q.test(p)){let m=new Date(p);Number.isNaN(m.getTime())||(yield m);continue}yield a}}finally{r.releaseLock()}}var $=(t,e,r=[],s)=>new Proxy(()=>{},{get(o,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(o,n,[a,y]){if(!a||y||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let T=[...r],p=T.pop(),m="/"+T.join("/"),{fetcher:l=fetch,headers:w,onRequest:E,onResponse:h,fetch:v}=e,A=p==="get"||p==="head"||p==="subscribe";w=j(w,m,y);let K=A?a?.query:y?.query,k="";if(K){let c=(N,F)=>{k+=(k?"&":"?")+`${encodeURIComponent(N)}=${encodeURIComponent(F)}`};for(let[N,F]of Object.entries(K)){if(Array.isArray(F)){for(let f of F)c(N,f);continue}c(N,`${F}`)}}if(p==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(N=>t.includes(N))?"ws://":"wss://")+m+k;return new D(c)}return(async()=>{let c={method:p?.toUpperCase(),body:a,...v,headers:w};c.headers={...w,...j(A?a?.headers:y?.headers,m,c)};let N=A&&typeof a=="object"?a.fetch:y?.fetch;if(c={...c,...N},A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...j(i.headers,m,c)}})}}if(A&&delete c.body,ue(a)){let g=new FormData;for(let[i,d]of Object.entries(c.body)){if(H){g.append(i,d);continue}if(d instanceof File){g.append(i,await B(d));continue}if(d instanceof FileList){for(let u=0;u<d.length;u++)g.append(i,await B(d[u]));continue}if(Array.isArray(d)){for(let u=0;u<d.length;u++){let x=d[u];g.append(i,x instanceof File?await B(x):x)}continue}g.append(i,d)}c.body=g}else typeof a=="object"?(c.headers["content-type"]="application/json",c.body=JSON.stringify(a)):a!=null&&(c.headers["content-type"]="text/plain");if(A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...i.headers}})}}let F=t+m+k,f=await(s?.handle(new Request(F,c))??l(F,c)),S=null,b=null;if(h){Array.isArray(h)||(h=[h]);for(let g of h)try{let i=await g(f.clone());if(i!=null){S=i;break}}catch(i){i instanceof L?b=i:b=new L(422,i);break}}if(S===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":S=le(f);break;case"application/json":S=await f.json();break;case"application/octet-stream":S=await f.arrayBuffer();break;case"multipart/form-data":let g=await f.formData();S={},g.forEach((i,d)=>{S[d]=i});break;default:S=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let d=i.replace(/"/g,"");if(I.test(d)||P.test(d)||q.test(d)){let u=new Date(d);if(!Number.isNaN(u.getTime()))return u}return i})}(f.status>=300||f.status<200)&&(b=new L(f.status,S),S=null)}return{data:S,error:b,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,de=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,o,n){return te(t,`${e}/${o.toString()}`,r)},apply(s,o,[n,a={}]=[{},{}]){let y=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:T,$fetch:p,$headers:m,$transform:l,getRaw:w,...E}=n??{};y??=E;let h=e.lastIndexOf("/"),v=e.slice(h+1).toUpperCase(),A=V(t,h===-1?"/":e.slice(0,h),Object.assign(a.query??{},T)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,c=l?Array.isArray(l)?l:[l]:void 0;return c&&(k?k=c.concat(k):k=c),v==="SUBSCRIBE"?new G(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async F=>{let f,S={...r.$fetch?.headers,...p?.headers,...a.headers,...m};if(v!=="GET"&&v!=="HEAD"){f=Object.keys(y).length||Array.isArray(y)?y:void 0;let u=f&&(typeof f=="object"||Array.isArray(y));if(u&&de(f)){let C=new FormData;for(let[M,O]of Object.entries(f))if(Z)C.append(M,O);else if(O instanceof File)C.append(M,await _(O));else if(O instanceof FileList)for(let W=0;W<O.length;W++)C.append(M,await _(O[W]));else if(Array.isArray(O))for(let W=0;W<O.length;W++){let J=O[W];C.append(M,J instanceof File?await _(J):J)}else C.append(M,O);f=C}else f!=null&&(S["content-type"]=u?"application/json":"text/plain",f=u?JSON.stringify(f):y)}let b=await K(A,{method:v,body:f,...r.$fetch,...a.fetch,...p,headers:S}),g;if(F.getRaw)return b;switch(b.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await b.json();break;default:g=await b.text().then(u=>R(u)?+u:u==="true"?!0:u==="false"?!1:u)}let i=b.status>=300||b.status<200?new L(b.status,g):null,d={data:g,error:i,response:b,status:b.status,headers:b.headers};if(k)for(let u of k){let x=u(d);x instanceof Promise&&(x=await x),x!=null&&(d=x)}return d})({getRaw:w})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:o,body:n,...a}={})=>{o&&Object.entries(o).forEach(([l,w])=>{r=r.replace(`:${l}`,w)});let y=a.headers?.["Content-Type"];if(!y||y==="application/json")try{n=JSON.stringify(n)}catch{}let T=e?.fetcher||globalThis.fetch,p=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>T(t+r+p,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async l=>{let w;switch(l.headers.get("Content-Type")?.split(";")[0]){case"application/json":w=await l.json();break;case"application/octet-stream":w=await l.arrayBuffer();break;case"multipart/form-data":let E=await l.formData();w={},E.forEach((h,v)=>{w[v]=h});break;default:w=await l.text().then(h=>{if(R(h))return+h;if(h==="true")return!0;if(h==="false")return!1;if(!h)return h;let v=h.replace(/"/g,"");if(I.test(v)||P.test(v)||q.test(v)){let A=new Date(v);if(!Number.isNaN(A.getTime()))return A}return h})}return l.status>300?{data:null,status:l.status,headers:l.headers,retry:m,error:new L(l.status,w)}:{data:w,error:null,status:l.status,headers:l.headers,retry:m}});return m()};return fe(pe);})(); |
@@ -1,1 +0,1 @@ | ||
"use strict";var P=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of ae(e))!ie.call(t,c)&&c!==r&&P(t,c,{get:()=>e[c],enumerable:!(s=se(e,c))||s.enumerable});return t};var fe=t=>ce(P({},"__esModule",{value:!0}),t);var de={};oe(de,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});module.exports=fe(de);var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[c,n]of Object.entries(r))s+=`${c}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var O=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,c=>{if(e==="message"){let n=c.data.toString(),a=n.charCodeAt(0),d=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(W,w)=>{if(typeof w=="string"&&z.test(w)){let m=new Date(w);if(!Number.isNaN(m.getTime()))return m}return w})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&d===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...c,data:n})}else r(c)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",U=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,B=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,H=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),M=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let c of t)if(!Array.isArray(c))s=M(c,e,r,s);else{let n=c[0];if(typeof n=="string")s[n.toLowerCase()]=c[1];else for(let[a,d]of n)s[a.toLowerCase()]=d}return s}if(!t)return s;switch(typeof t){case"function":let c=t(e,r);return c?M(c,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}},$=(t,e,r=[],s)=>new Proxy(()=>{},{get(c,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(c,n,[a,d]){if(!a||d||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let W=[...r],w=W.pop(),m="/"+W.join("/"),{fetcher:u=fetch,headers:g,onRequest:b,onResponse:p,fetch:S}=e,v=w==="get"||w==="head"||w==="subscribe";g=M(g,m,d);let K=v?a?.query:d?.query,k="";if(K){let o=(L,T)=>{k+=(k?"&":"?")+`${encodeURIComponent(L)}=${encodeURIComponent(T)}`};for(let[L,T]of Object.entries(K)){if(Array.isArray(T)){for(let f of T)o(L,f);continue}o(L,`${T}`)}}if(w==="subscribe"){let o=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(L=>t.includes(L))?"ws://":"wss://")+m+k;return new D(o)}return(async()=>{let o={method:w?.toUpperCase(),body:a,...S,headers:g};o.headers={...g,...M(v?a?.headers:d?.headers,m,o)};let L=v&&typeof a=="object"?a.fetch:d?.fetch;if(o={...o,...L},v&&delete o.body,b){Array.isArray(b)||(b=[b]);for(let h of b){let i=await h(m,o);typeof i=="object"&&(o={...o,...i,headers:{...o.headers,...M(i.headers,m,o)}})}}if(v&&delete o.body,ue(a)){let h=new FormData;for(let[i,l]of Object.entries(o.body)){if(J){h.append(i,l);continue}if(l instanceof File){h.append(i,await q(l));continue}if(l instanceof FileList){for(let y=0;y<l.length;y++)h.append(i,await q(l[y]));continue}if(Array.isArray(l)){for(let y=0;y<l.length;y++){let x=l[y];h.append(i,x instanceof File?await q(x):x)}continue}h.append(i,l)}o.body=h}else typeof a=="object"?(o.headers["content-type"]="application/json",o.body=JSON.stringify(a)):a!=null&&(o.headers["content-type"]="text/plain");if(v&&delete o.body,b){Array.isArray(b)||(b=[b]);for(let h of b){let i=await h(m,o);typeof i=="object"&&(o={...o,...i,headers:{...o.headers,...i.headers}})}}let T=t+m+k,f=await(s?.handle(new Request(T,o))??u(T,o)),A=null,E=null;if(p){Array.isArray(p)||(p=[p]);for(let h of p)try{let i=await h(f.clone());if(i!=null){A=i;break}}catch(i){i instanceof O?E=i:E=new O(422,i);break}}if(A===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"application/json":A=await f.json();break;case"application/octet-stream":A=await f.arrayBuffer();break;case"multipart/form-data":let h=await f.formData();A={},h.forEach((i,l)=>{A[l]=i});break;default:A=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let l=i.replace(/"/g,"");if(U.test(l)||B.test(l)||H.test(l)){let y=new Date(l);if(!Number.isNaN(y.getTime()))return y}return i})}(f.status>=300||f.status<200)&&(E=new O(f.status,A),A=null)}return{data:A,error:E,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,le=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,c=>{if(e==="message"){let n=c.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...c,data:n})}else r(c)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,c,n){return te(t,`${e}/${c.toString()}`,r)},apply(s,c,[n,a={}]=[{},{}]){let d=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:W,$fetch:w,$headers:m,$transform:u,getRaw:g,...b}=n??{};d??=b;let p=e.lastIndexOf("/"),S=e.slice(p+1).toUpperCase(),v=V(t,p===-1?"/":e.slice(0,p),Object.assign(a.query??{},W)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,o=u?Array.isArray(u)?u:[u]:void 0;return o&&(k?k=o.concat(k):k=o),S==="SUBSCRIBE"?new G(v.replace(/^([^]+):\/\//,v.startsWith("https://")?"wss://":"ws://")):(async T=>{let f,A={...r.$fetch?.headers,...w?.headers,...a.headers,...m};if(S!=="GET"&&S!=="HEAD"){f=Object.keys(d).length||Array.isArray(d)?d:void 0;let y=f&&(typeof f=="object"||Array.isArray(d));if(y&&le(f)){let j=new FormData;for(let[C,F]of Object.entries(f))if(Z)j.append(C,F);else if(F instanceof File)j.append(C,await _(F));else if(F instanceof FileList)for(let N=0;N<F.length;N++)j.append(C,await _(F[N]));else if(Array.isArray(F))for(let N=0;N<F.length;N++){let I=F[N];j.append(C,I instanceof File?await _(I):I)}else j.append(C,F);f=j}else f!=null&&(A["content-type"]=y?"application/json":"text/plain",f=y?JSON.stringify(f):d)}let E=await K(v,{method:S,body:f,...r.$fetch,...a.fetch,...w,headers:A}),h;if(T.getRaw)return E;switch(E.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await E.json();break;default:h=await E.text().then(y=>R(y)?+y:y==="true"?!0:y==="false"?!1:y)}let i=E.status>=300||E.status<200?new O(E.status,h):null,l={data:h,error:i,response:E,status:E.status,headers:E.headers};if(k)for(let y of k){let x=y(l);x instanceof Promise&&(x=await x),x!=null&&(l=x)}return l})({getRaw:g})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:c,body:n,...a}={})=>{c&&Object.entries(c).forEach(([u,g])=>{r=r.replace(`:${u}`,g)});let d=a.headers?.["Content-Type"];if(!d||d==="application/json")try{n=JSON.stringify(n)}catch{}let W=e?.fetcher||globalThis.fetch,w=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>W(t+r+w,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async u=>{let g;switch(u.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await u.json();break;case"application/octet-stream":g=await u.arrayBuffer();break;case"multipart/form-data":let b=await u.formData();g={},b.forEach((p,S)=>{g[S]=p});break;default:g=await u.text().then(p=>{if(R(p))return+p;if(p==="true")return!0;if(p==="false")return!1;if(!p)return p;let S=p.replace(/"/g,"");if(U.test(S)||B.test(S)||H.test(S)){let v=new Date(S);if(!Number.isNaN(v.getTime()))return v}return p})}return u.status>300?{data:null,status:u.status,headers:u.headers,retry:m,error:new O(u.status,g)}:{data:g,error:null,status:u.status,headers:u.headers,retry:m}});return m()};0&&(module.exports={edenFetch,edenTreaty,treaty}); | ||
"use strict";var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},ce=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ae(e))!ie.call(t,o)&&o!==r&&U(t,o,{get:()=>e[o],enumerable:!(s=se(e,o))||s.enumerable});return t};var fe=t=>ce(U({},"__esModule",{value:!0}),t);var pe={};oe(pe,{edenFetch:()=>ne,edenTreaty:()=>re,treaty:()=>Y});module.exports=fe(pe);var V=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let s="";for(let[o,n]of Object.entries(r))s+=`${o}=${n}&`;return`${t}${e}?${s.slice(0,-1)}`},R=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var L=class extends Error{constructor(r,s){super(s+"");this.status=r;this.value=s}};var z=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,D=class{constructor(e){this.url=e;this.ws=new WebSocket(e)}ws;send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0),y=n.charCodeAt(n.length-1);if(a===91||a===123)try{n=JSON.parse(n,(T,p)=>{if(typeof p=="string"&&z.test(p)){let m=new Date(p);if(!Number.isNaN(m.getTime()))return m}return p})}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"?n=!1:n==="null"?n=null:a===34&&y===34&&z.test(n)&&(n=new Date(n.substring(1,n.length-1)));r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}};var ye=["get","post","put","delete","patch","options","head","connect","subscribe"],X=["localhost","127.0.0.1","0.0.0.0"],H=typeof FileList>"u",I=/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/,P=/(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT(?:\+|-)\d{4}\s\([^)]+\)/,q=/^(?:(?:(?:(?:0?[1-9]|[12][0-9]|3[01])[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:19|20)\d{2})|(?:(?:19|20)\d{2}[/\s-](?:0?[1-9]|1[0-2])[/\s-](?:0?[1-9]|[12][0-9]|3[01]))))(?:\s(?:1[012]|0?[1-9]):[0-5][0-9](?::[0-5][0-9])?(?:\s[AP]M)?)?$/,Q=t=>H?t instanceof Blob:t instanceof FileList||t instanceof File,ue=t=>{if(!t)return!1;for(let e in t)if(Q(t[e])||Array.isArray(t[e])&&t[e].find(Q))return!0;return!1},B=t=>H?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),j=(t,e,r={},s={})=>{if(Array.isArray(t)){for(let o of t)if(!Array.isArray(o))s=j(o,e,r,s);else{let n=o[0];if(typeof n=="string")s[n.toLowerCase()]=o[1];else for(let[a,y]of n)s[a.toLowerCase()]=y}return s}if(!t)return s;switch(typeof t){case"function":if(t instanceof Headers)return j(t,e,r,s);let o=t(e,r);return o?j(o,e,r,s):s;case"object":if(t instanceof Headers)return t.forEach((n,a)=>{s[a.toLowerCase()]=n}),s;for(let[n,a]of Object.entries(t))s[n.toLowerCase()]=a;default:return s}};async function*le(t){let e=t.body;if(!e)return;let r=e.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:n}=await r.read();if(o)break;let a=s.decode(n);if(R(a)){yield+a;continue}if(a==="true"){yield!0;continue}if(a==="false"){yield!1;continue}let y=a.charCodeAt(0),T=a.charCodeAt(a.length-1);if(y===123&&T===125||y===91&&T===93)try{yield JSON.parse(a);continue}catch{}let p=a.replace(/"/g,"");if(I.test(p)||P.test(p)||q.test(p)){let m=new Date(p);Number.isNaN(m.getTime())||(yield m);continue}yield a}}finally{r.releaseLock()}}var $=(t,e,r=[],s)=>new Proxy(()=>{},{get(o,n){return $(t,e,n==="index"?r:[...r,n],s)},apply(o,n,[a,y]){if(!a||y||typeof a=="object"&&Object.keys(a).length!==1||ye.includes(r.at(-1))){let T=[...r],p=T.pop(),m="/"+T.join("/"),{fetcher:l=fetch,headers:w,onRequest:E,onResponse:h,fetch:v}=e,A=p==="get"||p==="head"||p==="subscribe";w=j(w,m,y);let K=A?a?.query:y?.query,k="";if(K){let c=(N,F)=>{k+=(k?"&":"?")+`${encodeURIComponent(N)}=${encodeURIComponent(F)}`};for(let[N,F]of Object.entries(K)){if(Array.isArray(F)){for(let f of F)c(N,f);continue}c(N,`${F}`)}}if(p==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||X.find(N=>t.includes(N))?"ws://":"wss://")+m+k;return new D(c)}return(async()=>{let c={method:p?.toUpperCase(),body:a,...v,headers:w};c.headers={...w,...j(A?a?.headers:y?.headers,m,c)};let N=A&&typeof a=="object"?a.fetch:y?.fetch;if(c={...c,...N},A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...j(i.headers,m,c)}})}}if(A&&delete c.body,ue(a)){let g=new FormData;for(let[i,d]of Object.entries(c.body)){if(H){g.append(i,d);continue}if(d instanceof File){g.append(i,await B(d));continue}if(d instanceof FileList){for(let u=0;u<d.length;u++)g.append(i,await B(d[u]));continue}if(Array.isArray(d)){for(let u=0;u<d.length;u++){let x=d[u];g.append(i,x instanceof File?await B(x):x)}continue}g.append(i,d)}c.body=g}else typeof a=="object"?(c.headers["content-type"]="application/json",c.body=JSON.stringify(a)):a!=null&&(c.headers["content-type"]="text/plain");if(A&&delete c.body,E){Array.isArray(E)||(E=[E]);for(let g of E){let i=await g(m,c);typeof i=="object"&&(c={...c,...i,headers:{...c.headers,...i.headers}})}}let F=t+m+k,f=await(s?.handle(new Request(F,c))??l(F,c)),S=null,b=null;if(h){Array.isArray(h)||(h=[h]);for(let g of h)try{let i=await g(f.clone());if(i!=null){S=i;break}}catch(i){i instanceof L?b=i:b=new L(422,i);break}}if(S===null){switch(f.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":S=le(f);break;case"application/json":S=await f.json();break;case"application/octet-stream":S=await f.arrayBuffer();break;case"multipart/form-data":let g=await f.formData();S={},g.forEach((i,d)=>{S[d]=i});break;default:S=await f.text().then(i=>{if(R(i))return+i;if(i==="true")return!0;if(i==="false")return!1;if(!i)return i;let d=i.replace(/"/g,"");if(I.test(d)||P.test(d)||q.test(d)){let u=new Date(d);if(!Number.isNaN(u.getTime()))return u}return i})}(f.status>=300||f.status<200)&&(b=new L(f.status,S),S=null)}return{data:S,error:b,response:f,status:f.status,headers:f.headers}})()}return typeof a=="object"?$(t,e,[...r,Object.values(a)[0]],s):$(t,e,r)}}),Y=(t,e={})=>typeof t=="string"?(e.keepDomain||(t.includes("://")||(t=(X.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1))),$(t,e)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),$("http://e.ly",e,[],t));var Z=typeof FileList>"u",ee=t=>Z?t instanceof Blob:t instanceof FileList||t instanceof File,de=t=>{if(!t)return!1;for(let e in t){if(ee(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>ee(r)))return!0}return!1},_=t=>Z?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let s=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(s)},r.readAsArrayBuffer(t)}),G=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(r=>this.send(r)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,r,s){return this.addEventListener(e,r,s)}off(e,r,s){return this.ws.removeEventListener(e,r,s),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,s){return this.ws.addEventListener(e,o=>{if(e==="message"){let n=o.data.toString(),a=n.charCodeAt(0);if(a===47||a===123)try{n=JSON.parse(n)}catch{}else R(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...o,data:n})}else r(o)},s),this}removeEventListener(e,r,s){return this.off(e,r,s),this}close(){return this.ws.close(),this}},te=(t,e="",r)=>new Proxy(()=>{},{get(s,o,n){return te(t,`${e}/${o.toString()}`,r)},apply(s,o,[n,a={}]=[{},{}]){let y=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:T,$fetch:p,$headers:m,$transform:l,getRaw:w,...E}=n??{};y??=E;let h=e.lastIndexOf("/"),v=e.slice(h+1).toUpperCase(),A=V(t,h===-1?"/":e.slice(0,h),Object.assign(a.query??{},T)),K=r.fetcher??fetch,k=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,c=l?Array.isArray(l)?l:[l]:void 0;return c&&(k?k=c.concat(k):k=c),v==="SUBSCRIBE"?new G(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async F=>{let f,S={...r.$fetch?.headers,...p?.headers,...a.headers,...m};if(v!=="GET"&&v!=="HEAD"){f=Object.keys(y).length||Array.isArray(y)?y:void 0;let u=f&&(typeof f=="object"||Array.isArray(y));if(u&&de(f)){let C=new FormData;for(let[M,O]of Object.entries(f))if(Z)C.append(M,O);else if(O instanceof File)C.append(M,await _(O));else if(O instanceof FileList)for(let W=0;W<O.length;W++)C.append(M,await _(O[W]));else if(Array.isArray(O))for(let W=0;W<O.length;W++){let J=O[W];C.append(M,J instanceof File?await _(J):J)}else C.append(M,O);f=C}else f!=null&&(S["content-type"]=u?"application/json":"text/plain",f=u?JSON.stringify(f):y)}let b=await K(A,{method:v,body:f,...r.$fetch,...a.fetch,...p,headers:S}),g;if(F.getRaw)return b;switch(b.headers.get("Content-Type")?.split(";")[0]){case"application/json":g=await b.json();break;default:g=await b.text().then(u=>R(u)?+u:u==="true"?!0:u==="false"?!1:u)}let i=b.status>=300||b.status<200?new L(b.status,g):null,d={data:g,error:i,response:b,status:b.status,headers:b.headers};if(k)for(let u of k){let x=u(d);x instanceof Promise&&(x=await x),x!=null&&(d=x)}return d})({getRaw:w})}}),re=(t,e={fetcher:fetch})=>new Proxy({},{get(r,s){return te(t,s,e)}});var ne=(t,e)=>(r,{query:s,params:o,body:n,...a}={})=>{o&&Object.entries(o).forEach(([l,w])=>{r=r.replace(`:${l}`,w)});let y=a.headers?.["Content-Type"];if(!y||y==="application/json")try{n=JSON.stringify(n)}catch{}let T=e?.fetcher||globalThis.fetch,p=s?`?${new URLSearchParams(s).toString()}`:"",m=()=>T(t+r+p,{...a,method:a.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...a.headers}:a.headers,body:n}).then(async l=>{let w;switch(l.headers.get("Content-Type")?.split(";")[0]){case"application/json":w=await l.json();break;case"application/octet-stream":w=await l.arrayBuffer();break;case"multipart/form-data":let E=await l.formData();w={},E.forEach((h,v)=>{w[v]=h});break;default:w=await l.text().then(h=>{if(R(h))return+h;if(h==="true")return!0;if(h==="false")return!1;if(!h)return h;let v=h.replace(/"/g,"");if(I.test(v)||P.test(v)||q.test(v)){let A=new Date(v);if(!Number.isNaN(A.getTime()))return A}return h})}return l.status>300?{data:null,status:l.status,headers:l.headers,retry:m,error:new L(l.status,w)}:{data:w,error:null,status:l.status,headers:l.headers,retry:m}});return m()};0&&(module.exports={edenFetch,edenTreaty,treaty}); |
@@ -6,3 +6,4 @@ import type { Elysia } from 'elysia'; | ||
export declare const isShortenDate: RegExp; | ||
export declare function streamResponse(response: Response): AsyncGenerator<any, void, unknown>; | ||
export declare const treaty: <const App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string | App, config?: Treaty.Config) => Treaty.Create<App>; | ||
export type { Treaty }; |
@@ -10,2 +10,5 @@ /// <reference types="bun-types" /> | ||
} & {}; | ||
type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = { | ||
[K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? AsyncGenerator<A, B, C> : RecordType[K]; | ||
} & {}; | ||
type MaybeArray<T> = T | T[]; | ||
@@ -57,3 +60,3 @@ type MaybePromise<T> = T | Promise<T>; | ||
} | ||
type TreatyResponse<Res extends Record<number, unknown>> = { | ||
type TreatyResponse<_Res extends Record<number, unknown>, Res extends Record<number, unknown> = ReplaceGeneratorWithAsyncGenerator<_Res>> = { | ||
data: Res[200]; | ||
@@ -60,0 +63,0 @@ error: null; |
{ | ||
"name": "@elysiajs/eden", | ||
"version": "1.0.14", | ||
"version": "1.1.0-exp.1", | ||
"description": "Fully type-safe Elysia client", | ||
@@ -57,3 +57,3 @@ "author": { | ||
"peerDependencies": { | ||
"elysia": ">= 1.0.22" | ||
"elysia": ">= 1.1.0-exp.1" | ||
}, | ||
@@ -64,3 +64,3 @@ "devDependencies": { | ||
"@types/node": "^18.15.5", | ||
"elysia": "^1.0.22", | ||
"elysia": "^1.1.0-exp.1", | ||
"esbuild": "^0.19.3", | ||
@@ -67,0 +67,0 @@ "eslint": "^8.26.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94938
803
1