Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elysiajs/eden

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elysiajs/eden - npm Package Compare versions

Comparing version 1.0.0-rc.0 to 1.0.0-rc.1

31

dist/index.d.ts

@@ -35,7 +35,11 @@ import { InputSchema, Elysia } from 'elysia';

export type Sign<in out Route extends Record<string, any>> = {
[K in keyof Route as K extends '/' | '' ? 'index' : K extends `:${string}` ? never : K]: K extends 'subscribe' ? undefined extends Route['subscribe']['query'] ? (params?: {
query?: Record<string, string>;
}) => EdenWS<Route['subscribe']> : (params: {
[K in keyof Route as K extends '/' | '' ? 'index' : K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
headers?: Record<string, unknown>;
} : {
headers: Route['subscribe']['headers'];
}) & (undefined extends Route['subscribe']['query'] ? {
query?: Record<string, unknown>;
} : {
query: Route['subscribe']['query'];
}) => EdenWS<Route['subscribe']> : Route[K] extends {
}) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
body: infer Body;

@@ -56,3 +60,4 @@ headers: infer Headers;

};
export interface Config extends Omit<RequestInit, 'headers'> {
export interface Config {
fetch?: Omit<RequestInit, 'headers' | 'method'>;
fetcher?: typeof fetch;

@@ -63,13 +68,16 @@ headers?: RequestInit['headers'] | MaybeArray<(path: string, options: RequestInit) => RequestInit['headers'] | void>;

}
type TreatyResponse<Response extends Record<number, unknown>> = {
data: Response[200];
type TreatyResponse<Res extends Record<number, unknown>> = {
data: Res[200];
error: null;
response: Response;
status: number;
headers: FetchRequestInit['headers'];
} | {
data: null;
error: Response extends {
error: Res extends {
200: unknown;
} ? {
[Status in keyof Response as Status extends 200 ? never : Status]: {
[Status in keyof Res as Status extends 200 ? never : Status]: {
status: Status;
value: Response[Status];
value: Res[Status];
};

@@ -80,2 +88,5 @@ }[Exclude<keyof Response, 200>] : {

};
response: Response;
status: number;
headers: FetchRequestInit['headers'];
};

@@ -82,0 +93,0 @@ export interface OnMessage<Data = unknown> extends MessageEvent {

@@ -1,1 +0,1 @@

"use strict";var Eden=(()=>{var P=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ne=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ee(e))!te.call(t,f)&&f!==r&&P(t,f,{get:()=>e[f],enumerable:!(a=Z(e,f))||a.enumerable});return t};var se=t=>ne(P({},"__esModule",{value:!0}),t);var ce={};re(ce,{edenFetch:()=>Y,edenTreaty:()=>X,treaty:()=>V});var U=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let a="";for(let[f,n]of Object.entries(r))a+=`${f}=${n}&`;return`${t}${e}?${a.slice(0,-1)}`},x=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var A=class extends Error{constructor(r,a){super(a+"");this.status=r;this.value=a}};var N=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}};var ae=["get","post","put","delete","patch","options","head","connect","subscribe"],G=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",_=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ie=t=>{if(!t)return!1;for(let e in t)if(_(t[e])||Array.isArray(t[e])&&t[e].find(_))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),M=(t,e,r=[],a)=>new Proxy(()=>{},{get(f,n){return M(t,e,n==="index"?r:[...r,n],a)},apply(f,n,[i,p={}]){if(!i||p||typeof i=="object"&&Object.keys(i).length!==1||ae.includes(r.at(-1))){let k=r.pop(),w="/"+r.join("/"),{fetcher:T=fetch,headers:s,onRequest:h,onResponse:E,...K}=e,F=k==="get"||k==="head"||k==="subscribe";s={...typeof s=="object"&&!Array.isArray(s)?s:{},...F?i?.headers:p?.headers};let L=F?i?.query:p?.query,R="";if(L)for(let[c,u]of Object.entries(L))R+=(R?"&":"?")+`${c}=${u}`;if(typeof e.headers=="function"&&!(s instanceof Headers)){let c=e.headers(w,p);c&&(s={...s,...c})}else if(Array.isArray(e.headers)&&e.headers.every(c=>typeof c=="function"))for(let c of e.headers){let u=c(w,p);u&&(s={...s,...u})}else if(s instanceof Headers){s||(s={});for(let[c,u]of Object.entries(s))s[c]=u}if(k==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||G.find(u=>t.includes(u))?"ws://":"wss://")+w+R;return new N(c)}return(async()=>{let c=(s instanceof Headers?s.get("content-type"):Array.isArray(s)?s.find(o=>Array.isArray(o)&&o[0]==="headers"?o[1]:!1):typeof s=="function"?s(w,p):s?.contentType)||p?.headers?.contentType;if(!c)if(typeof i=="object")c="application/json",i=JSON.stringify(i);else if(ie(i)){let o=new FormData;for(let[d,m]of Object.entries(i)){if(J){o.append(d,m);continue}if(m instanceof File){o.append(d,await q(m));continue}if(m instanceof FileList){for(let l=0;l<m.length;l++)o.append(d,await q(m[l]));continue}if(Array.isArray(m)){for(let l=0;l<m.length;l++){let b=m[l];o.append(d,b instanceof File?await q(b):b)}continue}o.append(d,m)}i=o}else i!=null&&(c="text/plain");let u={method:k,body:i,...K,headers:{...s,"content-type":c}};if(F&&delete u.body,h){Array.isArray(h)||(h=[h]);for(let o of h){let d=await o(w,u);typeof d=="object"&&(u={...u,...d,headers:{...u.headers,...d.headers}})}}let C=t+w+R,g=await(a?.handle(new Request(C,u))??T(C,u)),y,O;if(E){Array.isArray(E)||(E=[E]);for(let o of E)try{if(y=await o(g.clone()),y!==void 0)break}catch(d){d instanceof A?O=d:O=new A(422,d);break}}if(y===void 0){switch(g.headers.get("Content-Type")?.split(";")[0]){case"application/json":y=await g.json();break;case"application/octet-stream":y=await g.arrayBuffer();break;default:y=await g.text().then(o=>x(o)?+o:o==="true"?!0:o==="false"?!1:o)}(g.status>=300||g.status<200)&&(O=new A(g.status,y),y=void 0)}return{data:y,error:O,response:g,status:g.status,headers:g.headers}})()}return typeof i=="object"?M(t,e,[...r,Object.values(i)[0]],a):M(t,e,r)}}),V=(t,e={})=>typeof t=="string"?(t.includes("://")||(t=(G.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1)),M(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."),M("http://e.ly",e,[],t));var B=typeof FileList>"u",z=t=>B?t instanceof Blob:t instanceof FileList||t instanceof File,oe=t=>{if(!t)return!1;for(let e in t){if(z(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>z(r)))return!0}return!1},D=t=>B?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),H=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}},Q=(t,e="",r)=>new Proxy(()=>{},{get(a,f,n){return Q(t,`${e}/${f.toString()}`,r)},apply(a,f,[n,i={}]=[{},{}]){let p=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:k,$fetch:w,$headers:T,$transform:s,getRaw:h,...E}=n??{};p??=E;let K=e.lastIndexOf("/"),F=e.slice(K+1).toUpperCase(),L=U(t,K===-1?"/":e.slice(0,K),Object.assign(i.query??{},k)),R=r.fetcher??fetch,c=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,u=s?Array.isArray(s)?s:[s]:void 0;return u&&(c?c=u.concat(c):c=u),F==="SUBSCRIBE"?new H(L.replace(/^([^]+):\/\//,L.startsWith("https://")?"wss://":"ws://")):(async g=>{let y,O={...r.$fetch?.headers,...w?.headers,...i.headers,...T};if(F!=="GET"&&F!=="HEAD"){y=Object.keys(p).length||Array.isArray(p)?p:void 0;let l=y&&(typeof y=="object"||Array.isArray(p));if(l&&oe(y)){let j=new FormData;for(let[$,v]of Object.entries(y))if(B)j.append($,v);else if(v instanceof File)j.append($,await D(v));else if(v instanceof FileList)for(let W=0;W<v.length;W++)j.append($,await D(v[W]));else if(Array.isArray(v))for(let W=0;W<v.length;W++){let I=v[W];j.append($,I instanceof File?await D(I):I)}else j.append($,v);y=j}else y!=null&&(O["content-type"]=l?"application/json":"text/plain",y=l?JSON.stringify(y):p)}let S=await R(L,{method:F,body:y,...r.$fetch,...i.fetch,...w,headers:O}),o;if(g.getRaw)return S;switch(S.headers.get("Content-Type")?.split(";")[0]){case"application/json":o=await S.json();break;default:o=await S.text().then(l=>x(l)?+l:l==="true"?!0:l==="false"?!1:l)}let d=S.status>=300||S.status<200?new A(S.status,o):null,m={data:o,error:d,response:S,status:S.status,headers:S.headers};if(c)for(let l of c){let b=l(m);b instanceof Promise&&(b=await b),b!=null&&(m=b)}return m})({getRaw:h})}}),X=(t,e={fetcher:fetch})=>new Proxy({},{get(r,a){return Q(t,a,e)}});var Y=(t,e)=>(r,{query:a,params:f,body:n,...i}={})=>{f&&Object.entries(f).forEach(([s,h])=>{r=r.replace(`:${s}`,h)});let p=i.headers?.["Content-Type"];if(!p||p==="application/json")try{n=JSON.stringify(n)}catch{}let k=e?.fetcher||globalThis.fetch,w=a?`?${new URLSearchParams(a).toString()}`:"",T=()=>k(t+r+w,{...i,method:i.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...i.headers}:i.headers,body:n}).then(async s=>{let h;switch(s.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await s.json();break;default:h=await s.text().then(E=>x(E)?parseInt(E):E==="true"?!0:E==="false"?!1:E);break}return s.status>300?{data:null,status:s.status,headers:s.headers,retry:T,error:new A(s.status,h)}:{data:h,error:null,status:s.status,headers:s.headers,retry:T}});return T()};return se(ce);})();
"use strict";var Eden=(()=>{var P=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ne=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ee(e))!te.call(t,f)&&f!==r&&P(t,f,{get:()=>e[f],enumerable:!(a=Z(e,f))||a.enumerable});return t};var se=t=>ne(P({},"__esModule",{value:!0}),t);var ce={};re(ce,{edenFetch:()=>Y,edenTreaty:()=>X,treaty:()=>V});var U=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let a="";for(let[f,n]of Object.entries(r))a+=`${f}=${n}&`;return`${t}${e}?${a.slice(0,-1)}`},x=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var A=class extends Error{constructor(r,a){super(a+"");this.status=r;this.value=a}};var N=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}};var ae=["get","post","put","delete","patch","options","head","connect","subscribe"],G=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",_=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ie=t=>{if(!t)return!1;for(let e in t)if(_(t[e])||Array.isArray(t[e])&&t[e].find(_))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),M=(t,e,r=[],a)=>new Proxy(()=>{},{get(f,n){return M(t,e,n==="index"?r:[...r,n],a)},apply(f,n,[i,p={}]){if(!i||p||typeof i=="object"&&Object.keys(i).length!==1||ae.includes(r.at(-1))){let k=r.pop(),w="/"+r.join("/"),{fetcher:T=fetch,headers:s,onRequest:h,onResponse:E,fetch:K}=e,F=k==="get"||k==="head"||k==="subscribe";s={...typeof s=="object"&&!Array.isArray(s)?s:{},...F?i?.headers:p?.headers};let L=F?i?.query:p?.query,R="";if(L)for(let[c,u]of Object.entries(L))R+=(R?"&":"?")+`${c}=${u}`;if(typeof e.headers=="function"&&!(s instanceof Headers)){let c=e.headers(w,p);c&&(s={...s,...c})}else if(Array.isArray(e.headers)&&e.headers.every(c=>typeof c=="function"))for(let c of e.headers){let u=c(w,p);u&&(s={...s,...u})}else if(s instanceof Headers){s||(s={});for(let[c,u]of Object.entries(s))s[c]=u}if(k==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||G.find(u=>t.includes(u))?"ws://":"wss://")+w+R;return new N(c)}return(async()=>{let c=(s instanceof Headers?s.get("content-type"):Array.isArray(s)?s.find(o=>Array.isArray(o)&&o[0]==="headers"?o[1]:!1):typeof s=="function"?s(w,p):s?.contentType)||p?.headers?.contentType;if(!c)if(typeof i=="object")c="application/json",i=JSON.stringify(i);else if(ie(i)){let o=new FormData;for(let[d,m]of Object.entries(i)){if(J){o.append(d,m);continue}if(m instanceof File){o.append(d,await q(m));continue}if(m instanceof FileList){for(let l=0;l<m.length;l++)o.append(d,await q(m[l]));continue}if(Array.isArray(m)){for(let l=0;l<m.length;l++){let b=m[l];o.append(d,b instanceof File?await q(b):b)}continue}o.append(d,m)}i=o}else i!=null&&(c="text/plain");let u={method:k,body:i,...K,headers:{...s,"content-type":c}};if(F&&delete u.body,h){Array.isArray(h)||(h=[h]);for(let o of h){let d=await o(w,u);typeof d=="object"&&(u={...u,...d,headers:{...u.headers,...d.headers}})}}let C=t+w+R,g=await(a?.handle(new Request(C,u))??T(C,u)),y,O;if(E){Array.isArray(E)||(E=[E]);for(let o of E)try{if(y=await o(g.clone()),y!==void 0)break}catch(d){d instanceof A?O=d:O=new A(422,d);break}}if(y===void 0){switch(g.headers.get("Content-Type")?.split(";")[0]){case"application/json":y=await g.json();break;case"application/octet-stream":y=await g.arrayBuffer();break;default:y=await g.text().then(o=>x(o)?+o:o==="true"?!0:o==="false"?!1:o)}(g.status>=300||g.status<200)&&(O=new A(g.status,y),y=void 0)}return{data:y,error:O,response:g,status:g.status,headers:g.headers}})()}return typeof i=="object"?M(t,e,[...r,Object.values(i)[0]],a):M(t,e,r)}}),V=(t,e={})=>typeof t=="string"?(t.includes("://")||(t=(G.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1)),M(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."),M("http://e.ly",e,[],t));var B=typeof FileList>"u",z=t=>B?t instanceof Blob:t instanceof FileList||t instanceof File,oe=t=>{if(!t)return!1;for(let e in t){if(z(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>z(r)))return!0}return!1},D=t=>B?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),H=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}},Q=(t,e="",r)=>new Proxy(()=>{},{get(a,f,n){return Q(t,`${e}/${f.toString()}`,r)},apply(a,f,[n,i={}]=[{},{}]){let p=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:k,$fetch:w,$headers:T,$transform:s,getRaw:h,...E}=n??{};p??=E;let K=e.lastIndexOf("/"),F=e.slice(K+1).toUpperCase(),L=U(t,K===-1?"/":e.slice(0,K),Object.assign(i.query??{},k)),R=r.fetcher??fetch,c=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,u=s?Array.isArray(s)?s:[s]:void 0;return u&&(c?c=u.concat(c):c=u),F==="SUBSCRIBE"?new H(L.replace(/^([^]+):\/\//,L.startsWith("https://")?"wss://":"ws://")):(async g=>{let y,O={...r.$fetch?.headers,...w?.headers,...i.headers,...T};if(F!=="GET"&&F!=="HEAD"){y=Object.keys(p).length||Array.isArray(p)?p:void 0;let l=y&&(typeof y=="object"||Array.isArray(p));if(l&&oe(y)){let j=new FormData;for(let[$,v]of Object.entries(y))if(B)j.append($,v);else if(v instanceof File)j.append($,await D(v));else if(v instanceof FileList)for(let W=0;W<v.length;W++)j.append($,await D(v[W]));else if(Array.isArray(v))for(let W=0;W<v.length;W++){let I=v[W];j.append($,I instanceof File?await D(I):I)}else j.append($,v);y=j}else y!=null&&(O["content-type"]=l?"application/json":"text/plain",y=l?JSON.stringify(y):p)}let S=await R(L,{method:F,body:y,...r.$fetch,...i.fetch,...w,headers:O}),o;if(g.getRaw)return S;switch(S.headers.get("Content-Type")?.split(";")[0]){case"application/json":o=await S.json();break;default:o=await S.text().then(l=>x(l)?+l:l==="true"?!0:l==="false"?!1:l)}let d=S.status>=300||S.status<200?new A(S.status,o):null,m={data:o,error:d,response:S,status:S.status,headers:S.headers};if(c)for(let l of c){let b=l(m);b instanceof Promise&&(b=await b),b!=null&&(m=b)}return m})({getRaw:h})}}),X=(t,e={fetcher:fetch})=>new Proxy({},{get(r,a){return Q(t,a,e)}});var Y=(t,e)=>(r,{query:a,params:f,body:n,...i}={})=>{f&&Object.entries(f).forEach(([s,h])=>{r=r.replace(`:${s}`,h)});let p=i.headers?.["Content-Type"];if(!p||p==="application/json")try{n=JSON.stringify(n)}catch{}let k=e?.fetcher||globalThis.fetch,w=a?`?${new URLSearchParams(a).toString()}`:"",T=()=>k(t+r+w,{...i,method:i.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...i.headers}:i.headers,body:n}).then(async s=>{let h;switch(s.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await s.json();break;default:h=await s.text().then(E=>x(E)?parseInt(E):E==="true"?!0:E==="false"?!1:E);break}return s.status>300?{data:null,status:s.status,headers:s.headers,retry:T,error:new A(s.status,h)}:{data:h,error:null,status:s.status,headers:s.headers,retry:T}});return T()};return se(ce);})();

@@ -1,1 +0,1 @@

"use strict";var P=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ne=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ee(e))!te.call(t,f)&&f!==r&&P(t,f,{get:()=>e[f],enumerable:!(a=Z(e,f))||a.enumerable});return t};var se=t=>ne(P({},"__esModule",{value:!0}),t);var ce={};re(ce,{edenFetch:()=>Y,edenTreaty:()=>X,treaty:()=>V});module.exports=se(ce);var U=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let a="";for(let[f,n]of Object.entries(r))a+=`${f}=${n}&`;return`${t}${e}?${a.slice(0,-1)}`},x=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var A=class extends Error{constructor(r,a){super(a+"");this.status=r;this.value=a}};var N=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}};var ae=["get","post","put","delete","patch","options","head","connect","subscribe"],G=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",_=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ie=t=>{if(!t)return!1;for(let e in t)if(_(t[e])||Array.isArray(t[e])&&t[e].find(_))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),M=(t,e,r=[],a)=>new Proxy(()=>{},{get(f,n){return M(t,e,n==="index"?r:[...r,n],a)},apply(f,n,[i,p={}]){if(!i||p||typeof i=="object"&&Object.keys(i).length!==1||ae.includes(r.at(-1))){let k=r.pop(),w="/"+r.join("/"),{fetcher:T=fetch,headers:s,onRequest:h,onResponse:E,...K}=e,F=k==="get"||k==="head"||k==="subscribe";s={...typeof s=="object"&&!Array.isArray(s)?s:{},...F?i?.headers:p?.headers};let L=F?i?.query:p?.query,R="";if(L)for(let[c,u]of Object.entries(L))R+=(R?"&":"?")+`${c}=${u}`;if(typeof e.headers=="function"&&!(s instanceof Headers)){let c=e.headers(w,p);c&&(s={...s,...c})}else if(Array.isArray(e.headers)&&e.headers.every(c=>typeof c=="function"))for(let c of e.headers){let u=c(w,p);u&&(s={...s,...u})}else if(s instanceof Headers){s||(s={});for(let[c,u]of Object.entries(s))s[c]=u}if(k==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||G.find(u=>t.includes(u))?"ws://":"wss://")+w+R;return new N(c)}return(async()=>{let c=(s instanceof Headers?s.get("content-type"):Array.isArray(s)?s.find(o=>Array.isArray(o)&&o[0]==="headers"?o[1]:!1):typeof s=="function"?s(w,p):s?.contentType)||p?.headers?.contentType;if(!c)if(typeof i=="object")c="application/json",i=JSON.stringify(i);else if(ie(i)){let o=new FormData;for(let[d,m]of Object.entries(i)){if(J){o.append(d,m);continue}if(m instanceof File){o.append(d,await q(m));continue}if(m instanceof FileList){for(let l=0;l<m.length;l++)o.append(d,await q(m[l]));continue}if(Array.isArray(m)){for(let l=0;l<m.length;l++){let b=m[l];o.append(d,b instanceof File?await q(b):b)}continue}o.append(d,m)}i=o}else i!=null&&(c="text/plain");let u={method:k,body:i,...K,headers:{...s,"content-type":c}};if(F&&delete u.body,h){Array.isArray(h)||(h=[h]);for(let o of h){let d=await o(w,u);typeof d=="object"&&(u={...u,...d,headers:{...u.headers,...d.headers}})}}let C=t+w+R,g=await(a?.handle(new Request(C,u))??T(C,u)),y,O;if(E){Array.isArray(E)||(E=[E]);for(let o of E)try{if(y=await o(g.clone()),y!==void 0)break}catch(d){d instanceof A?O=d:O=new A(422,d);break}}if(y===void 0){switch(g.headers.get("Content-Type")?.split(";")[0]){case"application/json":y=await g.json();break;case"application/octet-stream":y=await g.arrayBuffer();break;default:y=await g.text().then(o=>x(o)?+o:o==="true"?!0:o==="false"?!1:o)}(g.status>=300||g.status<200)&&(O=new A(g.status,y),y=void 0)}return{data:y,error:O,response:g,status:g.status,headers:g.headers}})()}return typeof i=="object"?M(t,e,[...r,Object.values(i)[0]],a):M(t,e,r)}}),V=(t,e={})=>typeof t=="string"?(t.includes("://")||(t=(G.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1)),M(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."),M("http://e.ly",e,[],t));var B=typeof FileList>"u",z=t=>B?t instanceof Blob:t instanceof FileList||t instanceof File,oe=t=>{if(!t)return!1;for(let e in t){if(z(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>z(r)))return!0}return!1},D=t=>B?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),H=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}},Q=(t,e="",r)=>new Proxy(()=>{},{get(a,f,n){return Q(t,`${e}/${f.toString()}`,r)},apply(a,f,[n,i={}]=[{},{}]){let p=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:k,$fetch:w,$headers:T,$transform:s,getRaw:h,...E}=n??{};p??=E;let K=e.lastIndexOf("/"),F=e.slice(K+1).toUpperCase(),L=U(t,K===-1?"/":e.slice(0,K),Object.assign(i.query??{},k)),R=r.fetcher??fetch,c=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,u=s?Array.isArray(s)?s:[s]:void 0;return u&&(c?c=u.concat(c):c=u),F==="SUBSCRIBE"?new H(L.replace(/^([^]+):\/\//,L.startsWith("https://")?"wss://":"ws://")):(async g=>{let y,O={...r.$fetch?.headers,...w?.headers,...i.headers,...T};if(F!=="GET"&&F!=="HEAD"){y=Object.keys(p).length||Array.isArray(p)?p:void 0;let l=y&&(typeof y=="object"||Array.isArray(p));if(l&&oe(y)){let j=new FormData;for(let[$,v]of Object.entries(y))if(B)j.append($,v);else if(v instanceof File)j.append($,await D(v));else if(v instanceof FileList)for(let W=0;W<v.length;W++)j.append($,await D(v[W]));else if(Array.isArray(v))for(let W=0;W<v.length;W++){let I=v[W];j.append($,I instanceof File?await D(I):I)}else j.append($,v);y=j}else y!=null&&(O["content-type"]=l?"application/json":"text/plain",y=l?JSON.stringify(y):p)}let S=await R(L,{method:F,body:y,...r.$fetch,...i.fetch,...w,headers:O}),o;if(g.getRaw)return S;switch(S.headers.get("Content-Type")?.split(";")[0]){case"application/json":o=await S.json();break;default:o=await S.text().then(l=>x(l)?+l:l==="true"?!0:l==="false"?!1:l)}let d=S.status>=300||S.status<200?new A(S.status,o):null,m={data:o,error:d,response:S,status:S.status,headers:S.headers};if(c)for(let l of c){let b=l(m);b instanceof Promise&&(b=await b),b!=null&&(m=b)}return m})({getRaw:h})}}),X=(t,e={fetcher:fetch})=>new Proxy({},{get(r,a){return Q(t,a,e)}});var Y=(t,e)=>(r,{query:a,params:f,body:n,...i}={})=>{f&&Object.entries(f).forEach(([s,h])=>{r=r.replace(`:${s}`,h)});let p=i.headers?.["Content-Type"];if(!p||p==="application/json")try{n=JSON.stringify(n)}catch{}let k=e?.fetcher||globalThis.fetch,w=a?`?${new URLSearchParams(a).toString()}`:"",T=()=>k(t+r+w,{...i,method:i.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...i.headers}:i.headers,body:n}).then(async s=>{let h;switch(s.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await s.json();break;default:h=await s.text().then(E=>x(E)?parseInt(E):E==="true"?!0:E==="false"?!1:E);break}return s.status>300?{data:null,status:s.status,headers:s.headers,retry:T,error:new A(s.status,h)}:{data:h,error:null,status:s.status,headers:s.headers,retry:T}});return T()};0&&(module.exports={edenFetch,edenTreaty,treaty});
"use strict";var P=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var re=(t,e)=>{for(var r in e)P(t,r,{get:e[r],enumerable:!0})},ne=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let f of ee(e))!te.call(t,f)&&f!==r&&P(t,f,{get:()=>e[f],enumerable:!(a=Z(e,f))||a.enumerable});return t};var se=t=>ne(P({},"__esModule",{value:!0}),t);var ce={};re(ce,{edenFetch:()=>Y,edenTreaty:()=>X,treaty:()=>V});module.exports=se(ce);var U=(t,e,r)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!r||!Object.keys(r).length)return`${t}${e}`;let a="";for(let[f,n]of Object.entries(r))a+=`${f}=${n}&`;return`${t}${e}?${a.slice(0,-1)}`},x=t=>t.trim().length!==0&&!Number.isNaN(Number(t));var A=class extends Error{constructor(r,a){super(a+"");this.status=r;this.value=a}};var N=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}};var ae=["get","post","put","delete","patch","options","head","connect","subscribe"],G=["localhost","127.0.0.1","0.0.0.0"],J=typeof FileList>"u",_=t=>J?t instanceof Blob:t instanceof FileList||t instanceof File,ie=t=>{if(!t)return!1;for(let e in t)if(_(t[e])||Array.isArray(t[e])&&t[e].find(_))return!0;return!1},q=t=>J?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),M=(t,e,r=[],a)=>new Proxy(()=>{},{get(f,n){return M(t,e,n==="index"?r:[...r,n],a)},apply(f,n,[i,p={}]){if(!i||p||typeof i=="object"&&Object.keys(i).length!==1||ae.includes(r.at(-1))){let k=r.pop(),w="/"+r.join("/"),{fetcher:T=fetch,headers:s,onRequest:h,onResponse:E,fetch:K}=e,F=k==="get"||k==="head"||k==="subscribe";s={...typeof s=="object"&&!Array.isArray(s)?s:{},...F?i?.headers:p?.headers};let L=F?i?.query:p?.query,R="";if(L)for(let[c,u]of Object.entries(L))R+=(R?"&":"?")+`${c}=${u}`;if(typeof e.headers=="function"&&!(s instanceof Headers)){let c=e.headers(w,p);c&&(s={...s,...c})}else if(Array.isArray(e.headers)&&e.headers.every(c=>typeof c=="function"))for(let c of e.headers){let u=c(w,p);u&&(s={...s,...u})}else if(s instanceof Headers){s||(s={});for(let[c,u]of Object.entries(s))s[c]=u}if(k==="subscribe"){let c=t.replace(/^([^]+):\/\//,t.startsWith("https://")?"wss://":t.startsWith("http://")||G.find(u=>t.includes(u))?"ws://":"wss://")+w+R;return new N(c)}return(async()=>{let c=(s instanceof Headers?s.get("content-type"):Array.isArray(s)?s.find(o=>Array.isArray(o)&&o[0]==="headers"?o[1]:!1):typeof s=="function"?s(w,p):s?.contentType)||p?.headers?.contentType;if(!c)if(typeof i=="object")c="application/json",i=JSON.stringify(i);else if(ie(i)){let o=new FormData;for(let[d,m]of Object.entries(i)){if(J){o.append(d,m);continue}if(m instanceof File){o.append(d,await q(m));continue}if(m instanceof FileList){for(let l=0;l<m.length;l++)o.append(d,await q(m[l]));continue}if(Array.isArray(m)){for(let l=0;l<m.length;l++){let b=m[l];o.append(d,b instanceof File?await q(b):b)}continue}o.append(d,m)}i=o}else i!=null&&(c="text/plain");let u={method:k,body:i,...K,headers:{...s,"content-type":c}};if(F&&delete u.body,h){Array.isArray(h)||(h=[h]);for(let o of h){let d=await o(w,u);typeof d=="object"&&(u={...u,...d,headers:{...u.headers,...d.headers}})}}let C=t+w+R,g=await(a?.handle(new Request(C,u))??T(C,u)),y,O;if(E){Array.isArray(E)||(E=[E]);for(let o of E)try{if(y=await o(g.clone()),y!==void 0)break}catch(d){d instanceof A?O=d:O=new A(422,d);break}}if(y===void 0){switch(g.headers.get("Content-Type")?.split(";")[0]){case"application/json":y=await g.json();break;case"application/octet-stream":y=await g.arrayBuffer();break;default:y=await g.text().then(o=>x(o)?+o:o==="true"?!0:o==="false"?!1:o)}(g.status>=300||g.status<200)&&(O=new A(g.status,y),y=void 0)}return{data:y,error:O,response:g,status:g.status,headers:g.headers}})()}return typeof i=="object"?M(t,e,[...r,Object.values(i)[0]],a):M(t,e,r)}}),V=(t,e={})=>typeof t=="string"?(t.includes("://")||(t=(G.find(r=>t.includes(r))?"http://":"https://")+t),t.endsWith("/")&&(t=t.slice(0,-1)),M(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."),M("http://e.ly",e,[],t));var B=typeof FileList>"u",z=t=>B?t instanceof Blob:t instanceof FileList||t instanceof File,oe=t=>{if(!t)return!1;for(let e in t){if(z(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(r=>z(r)))return!0}return!1},D=t=>B?t:new Promise(e=>{let r=new FileReader;r.onload=()=>{let a=new File([r.result],t.name,{lastModified:t.lastModified,type:t.type});e(a)},r.readAsArrayBuffer(t)}),H=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,a){return this.addEventListener(e,r,a)}off(e,r,a){return this.ws.removeEventListener(e,r,a),this}subscribe(e,r){return this.addEventListener("message",e,r)}addEventListener(e,r,a){return this.ws.addEventListener(e,f=>{if(e==="message"){let n=f.data.toString(),i=n.charCodeAt(0);if(i===47||i===123)try{n=JSON.parse(n)}catch{}else x(n)?n=+n:n==="true"?n=!0:n==="false"&&(n=!1);r({...f,data:n})}else r(f)},a),this}removeEventListener(e,r,a){return this.off(e,r,a),this}close(){return this.ws.close(),this}},Q=(t,e="",r)=>new Proxy(()=>{},{get(a,f,n){return Q(t,`${e}/${f.toString()}`,r)},apply(a,f,[n,i={}]=[{},{}]){let p=n!==void 0&&(typeof n!="object"||Array.isArray(n))?n:void 0,{$query:k,$fetch:w,$headers:T,$transform:s,getRaw:h,...E}=n??{};p??=E;let K=e.lastIndexOf("/"),F=e.slice(K+1).toUpperCase(),L=U(t,K===-1?"/":e.slice(0,K),Object.assign(i.query??{},k)),R=r.fetcher??fetch,c=r.transform?Array.isArray(r.transform)?r.transform:[r.transform]:void 0,u=s?Array.isArray(s)?s:[s]:void 0;return u&&(c?c=u.concat(c):c=u),F==="SUBSCRIBE"?new H(L.replace(/^([^]+):\/\//,L.startsWith("https://")?"wss://":"ws://")):(async g=>{let y,O={...r.$fetch?.headers,...w?.headers,...i.headers,...T};if(F!=="GET"&&F!=="HEAD"){y=Object.keys(p).length||Array.isArray(p)?p:void 0;let l=y&&(typeof y=="object"||Array.isArray(p));if(l&&oe(y)){let j=new FormData;for(let[$,v]of Object.entries(y))if(B)j.append($,v);else if(v instanceof File)j.append($,await D(v));else if(v instanceof FileList)for(let W=0;W<v.length;W++)j.append($,await D(v[W]));else if(Array.isArray(v))for(let W=0;W<v.length;W++){let I=v[W];j.append($,I instanceof File?await D(I):I)}else j.append($,v);y=j}else y!=null&&(O["content-type"]=l?"application/json":"text/plain",y=l?JSON.stringify(y):p)}let S=await R(L,{method:F,body:y,...r.$fetch,...i.fetch,...w,headers:O}),o;if(g.getRaw)return S;switch(S.headers.get("Content-Type")?.split(";")[0]){case"application/json":o=await S.json();break;default:o=await S.text().then(l=>x(l)?+l:l==="true"?!0:l==="false"?!1:l)}let d=S.status>=300||S.status<200?new A(S.status,o):null,m={data:o,error:d,response:S,status:S.status,headers:S.headers};if(c)for(let l of c){let b=l(m);b instanceof Promise&&(b=await b),b!=null&&(m=b)}return m})({getRaw:h})}}),X=(t,e={fetcher:fetch})=>new Proxy({},{get(r,a){return Q(t,a,e)}});var Y=(t,e)=>(r,{query:a,params:f,body:n,...i}={})=>{f&&Object.entries(f).forEach(([s,h])=>{r=r.replace(`:${s}`,h)});let p=i.headers?.["Content-Type"];if(!p||p==="application/json")try{n=JSON.stringify(n)}catch{}let k=e?.fetcher||globalThis.fetch,w=a?`?${new URLSearchParams(a).toString()}`:"",T=()=>k(t+r+w,{...i,method:i.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...i.headers}:i.headers,body:n}).then(async s=>{let h;switch(s.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await s.json();break;default:h=await s.text().then(E=>x(E)?parseInt(E):E==="true"?!0:E==="false"?!1:E);break}return s.status>300?{data:null,status:s.status,headers:s.headers,retry:T,error:new A(s.status,h)}:{data:h,error:null,status:s.status,headers:s.headers,retry:T}});return T()};0&&(module.exports={edenFetch,edenTreaty,treaty});

@@ -20,7 +20,11 @@ /// <reference types="bun-types" />

export type Sign<in out Route extends Record<string, any>> = {
[K in keyof Route as K extends '/' | '' ? 'index' : K extends `:${string}` ? never : K]: K extends 'subscribe' ? undefined extends Route['subscribe']['query'] ? (params?: {
query?: Record<string, string>;
}) => EdenWS<Route['subscribe']> : (params: {
[K in keyof Route as K extends '/' | '' ? 'index' : K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
headers?: Record<string, unknown>;
} : {
headers: Route['subscribe']['headers'];
}) & (undefined extends Route['subscribe']['query'] ? {
query?: Record<string, unknown>;
} : {
query: Route['subscribe']['query'];
}) => EdenWS<Route['subscribe']> : Route[K] extends {
}) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
body: infer Body;

@@ -41,3 +45,4 @@ headers: infer Headers;

};
export interface Config extends Omit<RequestInit, 'headers'> {
export interface Config {
fetch?: Omit<RequestInit, 'headers' | 'method'>;
fetcher?: typeof fetch;

@@ -48,13 +53,16 @@ headers?: RequestInit['headers'] | MaybeArray<(path: string, options: RequestInit) => RequestInit['headers'] | void>;

}
type TreatyResponse<Response extends Record<number, unknown>> = {
data: Response[200];
type TreatyResponse<Res extends Record<number, unknown>> = {
data: Res[200];
error: null;
response: Response;
status: number;
headers: FetchRequestInit['headers'];
} | {
data: null;
error: Response extends {
error: Res extends {
200: unknown;
} ? {
[Status in keyof Response as Status extends 200 ? never : Status]: {
[Status in keyof Res as Status extends 200 ? never : Status]: {
status: Status;
value: Response[Status];
value: Res[Status];
};

@@ -65,2 +73,5 @@ }[Exclude<keyof Response, 200>] : {

};
response: Response;
status: number;
headers: FetchRequestInit['headers'];
};

@@ -67,0 +78,0 @@ export interface OnMessage<Data = unknown> extends MessageEvent {

{
"name": "@elysiajs/eden",
"version": "1.0.0-rc.0",
"version": "1.0.0-rc.1",
"description": "Fully type-safe Elysia client",

@@ -5,0 +5,0 @@ "author": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc