@merkl/api 0.10.130 → 0.10.131

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/dist/node_modules/@elysiajs/eden/eden/LICENSE +0 -7
  3. package/dist/node_modules/@elysiajs/eden/eden/README.md +0 -46
  4. package/dist/node_modules/@elysiajs/eden/eden/bunfig.toml +0 -2
  5. package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-2IHGLN7W.mjs +0 -1
  6. package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-7WO4HTSU.mjs +0 -1
  7. package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-XYW4OUFN.mjs +0 -1
  8. package/dist/node_modules/@elysiajs/eden/eden/dist/chunk-YAG46HFR.mjs +0 -1
  9. package/dist/node_modules/@elysiajs/eden/eden/dist/errors.d.ts +0 -5
  10. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch/index.d.ts +0 -4
  11. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch/types.d.ts +0 -44
  12. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.d.mts +0 -48
  13. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.d.ts +0 -48
  14. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.global.js +0 -1
  15. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.js +0 -1
  16. package/dist/node_modules/@elysiajs/eden/eden/dist/fetch.mjs +0 -1
  17. package/dist/node_modules/@elysiajs/eden/eden/dist/index.d.mts +0 -5
  18. package/dist/node_modules/@elysiajs/eden/eden/dist/index.d.ts +0 -5
  19. package/dist/node_modules/@elysiajs/eden/eden/dist/index.global.js +0 -1
  20. package/dist/node_modules/@elysiajs/eden/eden/dist/index.js +0 -1
  21. package/dist/node_modules/@elysiajs/eden/eden/dist/index.mjs +0 -1
  22. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/index.d.ts +0 -17
  23. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/types.d.ts +0 -99
  24. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty/utils.d.ts +0 -1
  25. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.d.mts +0 -114
  26. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.d.ts +0 -114
  27. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.global.js +0 -1
  28. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.js +0 -1
  29. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty.mjs +0 -1
  30. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/index.d.ts +0 -5
  31. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/types.d.ts +0 -86
  32. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2/ws.d.ts +0 -14
  33. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.d.mts +0 -103
  34. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.d.ts +0 -103
  35. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.global.js +0 -1
  36. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.js +0 -1
  37. package/dist/node_modules/@elysiajs/eden/eden/dist/treaty2.mjs +0 -1
  38. package/dist/node_modules/@elysiajs/eden/eden/dist/types-C41kuZ-K.d.mts +0 -44
  39. package/dist/node_modules/@elysiajs/eden/eden/dist/types-C41kuZ-K.d.ts +0 -44
  40. package/dist/node_modules/@elysiajs/eden/eden/dist/types.d.ts +0 -39
  41. package/dist/node_modules/@elysiajs/eden/eden/dist/utils/parsingUtils.d.ts +0 -6
  42. package/dist/node_modules/@elysiajs/eden/eden/package.json +0 -85
  43. package/dist/package.json +0 -91
@@ -1,114 +0,0 @@
1
- import { Elysia, InputSchema } from 'elysia';
2
- import { P as Prettify, I as IsUnknown, M as MapError, a as IsNever, E as EdenFetchError } from './types-C41kuZ-K.js';
3
-
4
- type Files = File | FileList;
5
- type Replace<RecordType, TargetType, GenericType> = {
6
- [K in keyof RecordType]: RecordType[K] extends TargetType ? GenericType : RecordType[K];
7
- };
8
- type MaybeArray$1<T> = T | T[];
9
- declare namespace EdenTreaty {
10
- export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> = App extends {
11
- _routes: infer Schema extends Record<string, unknown>;
12
- } ? Prettify<Sign<Schema>> : 'Please install Elysia before using Eden';
13
- export type Sign<Route extends Record<string, any>> = {
14
- [K in keyof Route as K extends `:${string}` ? (string & {}) | number | K : K extends '' | '/' ? 'index' : K]: Route[K] extends {
15
- body: infer Body;
16
- headers: infer Headers;
17
- query: infer Query;
18
- params: unknown;
19
- response: infer Response;
20
- } ? K extends 'subscribe' ? undefined extends Route['query'] ? (params?: {
21
- $query?: Record<string, string>;
22
- }) => EdenWS<Route> : (params: {
23
- $query: Route['query'];
24
- }) => EdenWS<Route['subscribe']> : ((params: Prettify<{
25
- $fetch?: RequestInit;
26
- getRaw?: boolean;
27
- $transform?: Transform;
28
- } & (IsUnknown<Body> extends false ? Replace<Body, Blob | Blob[], Files> : {}) & (undefined extends Query ? {
29
- $query?: Record<string, string>;
30
- } : {
31
- $query: Query;
32
- }) & (undefined extends Headers ? {
33
- $headers?: Record<string, unknown>;
34
- } : {
35
- $headers: Headers;
36
- })>) => Promise<({
37
- data: Response extends {
38
- 200: infer ReturnedType;
39
- } ? Awaited<ReturnedType> : unknown;
40
- error: null;
41
- } | {
42
- data: null;
43
- error: Response extends Record<number, unknown> ? MapError<Response> extends infer Errors ? IsNever<Errors> extends true ? EdenFetchError<number, string> : Errors : EdenFetchError<number, string> : EdenFetchError<number, unknown>;
44
- }) & {
45
- status: number;
46
- response: Response;
47
- headers: Record<string, string>;
48
- }>) extends (params: infer Params) => infer Response ? {
49
- $params: undefined;
50
- $headers: undefined;
51
- $query: undefined;
52
- } extends Params ? (params?: Params, options?: {
53
- fetch?: RequestInit;
54
- transform?: EdenTreaty.Transform<Response>;
55
- query?: Params['query'];
56
- headers?: Params['headers'];
57
- }) => Response : (params: Params, options?: {
58
- fetch?: RequestInit;
59
- transform?: EdenTreaty.Transform<Response>;
60
- query?: Params['query'];
61
- headers?: Params['headers'];
62
- }) => Response : never : Prettify<Sign<Route[K]>>;
63
- };
64
- type UnwrapPromise<T> = T extends Promise<infer A> ? A : T;
65
- export type Transform<T = unknown> = MaybeArray$1<(response: unknown extends T ? {
66
- data: any;
67
- error: any;
68
- response: Response;
69
- status: number;
70
- headers: Headers;
71
- } : UnwrapPromise<T>) => UnwrapPromise<T> | void>;
72
- export interface Config {
73
- /**
74
- * Default options to pass to fetch
75
- */
76
- $fetch?: RequestInit;
77
- fetcher?: typeof fetch;
78
- transform?: Transform;
79
- }
80
- export type DetailedResponse = {
81
- data: any;
82
- error: any;
83
- response: Response;
84
- status: number;
85
- headers: Headers;
86
- };
87
- export interface OnMessage<Data = unknown> extends MessageEvent {
88
- data: Data;
89
- rawData: MessageEvent['data'];
90
- }
91
- export type ExecuteOptions = {
92
- getRaw?: boolean;
93
- };
94
- export type ExecuteReturnType<T extends ExecuteOptions> = T['getRaw'] extends true ? Response : DetailedResponse;
95
- export type WSEvent<K extends keyof WebSocketEventMap, Data = unknown> = K extends 'message' ? OnMessage<Data> : WebSocketEventMap[K];
96
- export { };
97
- }
98
-
99
- type MaybeArray<T> = T | T[];
100
- declare class EdenWS<Schema extends InputSchema<any> = InputSchema> {
101
- ws: WebSocket;
102
- url: string;
103
- constructor(url: string);
104
- send(data: MaybeArray<Schema['body']>): this;
105
- on<K extends keyof WebSocketEventMap>(type: K, listener: (event: EdenTreaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
106
- off<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
107
- subscribe(onMessage: (event: EdenTreaty.WSEvent<'message', Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
108
- addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: EdenTreaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
109
- removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
110
- close(): this;
111
- }
112
- declare const edenTreaty: <App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string, config?: EdenTreaty.Config) => EdenTreaty.Create<App>;
113
-
114
- export { EdenTreaty, EdenWS, edenTreaty };
@@ -1 +0,0 @@
1
- "use strict";var Eden=(()=>{var v=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)v(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of G(e))!H.call(t,s)&&s!==n&&v(t,s,{get:()=>e[s],enumerable:!(r=B(e,s))||r.enumerable});return t};var z=t=>_(v({},"__esModule",{value:!0}),t);var ae={};U(ae,{EdenWS:()=>b,edenTreaty:()=>se});var S=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var L=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[s,i]of Object.entries(n))r+=`${s}=${i}&`;return`${t}${e}?${r.slice(0,-1)}`};var Q=/(\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))/,X=/(?: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\([^)]+\)/,Y=/^(?:(?:(?:(?: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)?)?$/,ee=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),N=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(Q.test(e)||X.test(e)||Y.test(e)){let n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return null},te=t=>{let e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===123&&n===125||e===91&&n===93},ne=t=>JSON.parse(t,(e,n)=>{let r=N(n);return r||n}),$=t=>{if(!t)return t;if(ee(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=N(t);if(e)return e;if(te(t))try{return ne(t)}catch{}return t},K=t=>{let e=t.data.toString();return e==="null"?null:$(e)};var M=typeof FileList>"u",j=t=>M?t instanceof Blob:t instanceof FileList||t instanceof File,re=t=>{if(!t)return!1;for(let e in t){if(j(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>j(n)))return!0}return!1},F=t=>M?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),b=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,s=>{if(e==="message"){let i=K(s);n({...s,data:i})}else n(s)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},D=(t,e="",n)=>new Proxy(()=>{},{get(r,s,i){return D(t,`${e}/${s.toString()}`,n)},apply(r,s,[i,w={}]=[{},{}]){let c=i!==void 0&&(typeof i!="object"||Array.isArray(i))?i:void 0,{$query:I,$fetch:R,$headers:P,$transform:g,getRaw:C,...J}=i??{};c??=J;let x=e.lastIndexOf("/"),m=e.slice(x+1).toUpperCase(),A=L(t,x===-1?"/":e.slice(0,x),Object.assign(w.query??{},I)),q=n.fetcher??fetch,u=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,T=g?Array.isArray(g)?g:[g]:void 0;return T&&(u?u=T.concat(u):u=T),m==="SUBSCRIBE"?new b(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async V=>{let a,W={...n.$fetch?.headers,...R?.headers,...w.headers,...P};if(m!=="GET"&&m!=="HEAD"){a=Object.keys(c).length||Array.isArray(c)?c:void 0;let l=a&&(typeof a=="object"||Array.isArray(c));if(l&&re(a)){let p=new FormData;for(let[h,d]of Object.entries(a))if(M)p.append(h,d);else if(d instanceof File)p.append(h,await F(d));else if(d instanceof FileList)for(let y=0;y<d.length;y++)p.append(h,await F(d[y]));else if(Array.isArray(d))for(let y=0;y<d.length;y++){let O=d[y];p.append(h,O instanceof File?await F(O):O)}else p.append(h,d);a=p}else a!=null&&(W["content-type"]=l?"application/json":"text/plain",a=l?JSON.stringify(a):c)}let o=await q(A,{method:m,body:a,...n.$fetch,...w.fetch,...R,headers:W}),E;if(V.getRaw)return o;switch(o.headers.get("Content-Type")?.split(";")[0]){case"application/json":E=await o.json();break;default:E=await o.text().then($)}let Z=o.status>=300||o.status<200?new S(o.status,E):null,k={data:E,error:Z,response:o,status:o.status,headers:o.headers};if(u)for(let l of u){let f=l(k);f instanceof Promise&&(f=await f),f!=null&&(k=f)}return k})({getRaw:C})}}),se=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return D(t,r,e)}});return z(ae);})();
@@ -1 +0,0 @@
1
- "use strict";var v=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var n in e)v(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of G(e))!H.call(t,s)&&s!==n&&v(t,s,{get:()=>e[s],enumerable:!(r=B(e,s))||r.enumerable});return t};var z=t=>_(v({},"__esModule",{value:!0}),t);var ae={};U(ae,{EdenWS:()=>b,edenTreaty:()=>se});module.exports=z(ae);var S=class extends Error{constructor(n,r){super(r+"");this.status=n;this.value=r}};var L=(t,e,n)=>{if(t.endsWith("/")||(t+="/"),e==="index"&&(e=""),!n||!Object.keys(n).length)return`${t}${e}`;let r="";for(let[s,i]of Object.entries(n))r+=`${s}=${i}&`;return`${t}${e}?${r.slice(0,-1)}`};var Q=/(\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))/,X=/(?: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\([^)]+\)/,Y=/^(?:(?:(?:(?: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)?)?$/,ee=t=>t.trim().length!==0&&!Number.isNaN(Number(t)),N=t=>{if(typeof t!="string")return null;let e=t.replace(/"/g,"");if(Q.test(e)||X.test(e)||Y.test(e)){let n=new Date(e);if(!Number.isNaN(n.getTime()))return n}return null},te=t=>{let e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===123&&n===125||e===91&&n===93},ne=t=>JSON.parse(t,(e,n)=>{let r=N(n);return r||n}),$=t=>{if(!t)return t;if(ee(t))return+t;if(t==="true")return!0;if(t==="false")return!1;let e=N(t);if(e)return e;if(te(t))try{return ne(t)}catch{}return t},K=t=>{let e=t.data.toString();return e==="null"?null:$(e)};var M=typeof FileList>"u",j=t=>M?t instanceof Blob:t instanceof FileList||t instanceof File,re=t=>{if(!t)return!1;for(let e in t){if(j(t[e]))return!0;if(Array.isArray(t[e])&&t[e].find(n=>j(n)))return!0}return!1},F=t=>M?t:new Promise(e=>{let n=new FileReader;n.onload=()=>{let r=new File([n.result],t.name,{lastModified:t.lastModified,type:t.type});e(r)},n.readAsArrayBuffer(t)}),b=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(n=>this.send(n)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,n,r){return this.addEventListener(e,n,r)}off(e,n,r){return this.ws.removeEventListener(e,n,r),this}subscribe(e,n){return this.addEventListener("message",e,n)}addEventListener(e,n,r){return this.ws.addEventListener(e,s=>{if(e==="message"){let i=K(s);n({...s,data:i})}else n(s)},r),this}removeEventListener(e,n,r){return this.off(e,n,r),this}close(){return this.ws.close(),this}},D=(t,e="",n)=>new Proxy(()=>{},{get(r,s,i){return D(t,`${e}/${s.toString()}`,n)},apply(r,s,[i,w={}]=[{},{}]){let c=i!==void 0&&(typeof i!="object"||Array.isArray(i))?i:void 0,{$query:I,$fetch:R,$headers:P,$transform:g,getRaw:C,...J}=i??{};c??=J;let x=e.lastIndexOf("/"),m=e.slice(x+1).toUpperCase(),A=L(t,x===-1?"/":e.slice(0,x),Object.assign(w.query??{},I)),q=n.fetcher??fetch,u=n.transform?Array.isArray(n.transform)?n.transform:[n.transform]:void 0,T=g?Array.isArray(g)?g:[g]:void 0;return T&&(u?u=T.concat(u):u=T),m==="SUBSCRIBE"?new b(A.replace(/^([^]+):\/\//,A.startsWith("https://")?"wss://":"ws://")):(async V=>{let a,W={...n.$fetch?.headers,...R?.headers,...w.headers,...P};if(m!=="GET"&&m!=="HEAD"){a=Object.keys(c).length||Array.isArray(c)?c:void 0;let l=a&&(typeof a=="object"||Array.isArray(c));if(l&&re(a)){let p=new FormData;for(let[h,d]of Object.entries(a))if(M)p.append(h,d);else if(d instanceof File)p.append(h,await F(d));else if(d instanceof FileList)for(let y=0;y<d.length;y++)p.append(h,await F(d[y]));else if(Array.isArray(d))for(let y=0;y<d.length;y++){let O=d[y];p.append(h,O instanceof File?await F(O):O)}else p.append(h,d);a=p}else a!=null&&(W["content-type"]=l?"application/json":"text/plain",a=l?JSON.stringify(a):c)}let o=await q(A,{method:m,body:a,...n.$fetch,...w.fetch,...R,headers:W}),E;if(V.getRaw)return o;switch(o.headers.get("Content-Type")?.split(";")[0]){case"application/json":E=await o.json();break;default:E=await o.text().then($)}let Z=o.status>=300||o.status<200?new S(o.status,E):null,k={data:E,error:Z,response:o,status:o.status,headers:o.headers};if(u)for(let l of u){let f=l(k);f instanceof Promise&&(f=await f),f!=null&&(k=f)}return k})({getRaw:C})}}),se=(t,e={fetcher:fetch})=>new Proxy({},{get(n,r){return D(t,r,e)}});0&&(module.exports={EdenWS,edenTreaty});
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-2IHGLN7W.mjs";import"./chunk-XYW4OUFN.mjs";export{a as EdenWS,b as edenTreaty};
@@ -1,5 +0,0 @@
1
- import type { Elysia } from 'elysia';
2
- import type { Treaty } from './types';
3
- export declare function streamResponse(response: Response): AsyncGenerator<any, void, unknown>;
4
- 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>;
5
- export type { Treaty };
@@ -1,86 +0,0 @@
1
- import type { Elysia } from 'elysia';
2
- import { EdenWS } from './ws';
3
- import type { IsNever, Not, Prettify } from '../types';
4
- type Files = File | FileList;
5
- type ReplaceBlobWithFiles<in out RecordType extends Record<string, unknown>> = {
6
- [K in keyof RecordType]: RecordType[K] extends Blob | Blob[] ? Files : RecordType[K];
7
- } & {};
8
- type And<A extends boolean, B extends boolean> = A extends true ? B extends true ? true : false : false;
9
- type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = {
10
- [K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K] extends AsyncGenerator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K];
11
- } & {};
12
- type MaybeArray<T> = T | T[];
13
- type MaybePromise<T> = T | Promise<T>;
14
- export declare namespace Treaty {
15
- interface TreatyParam {
16
- fetch?: RequestInit;
17
- }
18
- export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> = App extends {
19
- _routes: infer Schema extends Record<string, any>;
20
- } ? Prettify<Sign<Schema>> : 'Please install Elysia before using Eden';
21
- export type Sign<in out Route extends Record<string, any>> = {
22
- [K in keyof Route as K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
23
- headers?: Record<string, unknown>;
24
- } : {
25
- headers: Route['subscribe']['headers'];
26
- }) & (undefined extends Route['subscribe']['query'] ? {
27
- query?: Record<string, unknown>;
28
- } : {
29
- query: Route['subscribe']['query'];
30
- }) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
31
- body: infer Body;
32
- headers: infer Headers;
33
- params: any;
34
- query: infer Query;
35
- response: infer Response extends Record<number, unknown>;
36
- } ? (undefined extends Headers ? {
37
- headers?: Record<string, unknown>;
38
- } : {
39
- headers: Headers;
40
- }) & (undefined extends Query ? {
41
- query?: Record<string, unknown>;
42
- } : {
43
- query: Query;
44
- }) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : never : CreateParams<Route[K]>;
45
- };
46
- type CreateParams<Route extends Record<string, any>> = Extract<keyof Route, `:${string}`> extends infer Path extends string ? IsNever<Path> extends true ? Prettify<Sign<Route>> : // ! DO NOT USE PRETTIFY ON THIS LINE, OTHERWISE FUNCTION CALLING WILL BE OMITTED
47
- (((params: {
48
- [param in Path extends `:${infer Param}` ? Param extends `${infer Param}?` ? Param : Param : never]: string | number;
49
- }) => Prettify<Sign<Route[Path]>> & CreateParams<Route[Path]>) & Prettify<Sign<Route>>) & (Path extends `:${string}?` ? CreateParams<Route[Path]> : {}) : never;
50
- export interface Config {
51
- fetch?: Omit<RequestInit, 'headers' | 'method'>;
52
- fetcher?: typeof fetch;
53
- headers?: MaybeArray<RequestInit['headers'] | ((path: string, options: RequestInit) => RequestInit['headers'] | void)>;
54
- onRequest?: MaybeArray<(path: string, options: FetchRequestInit) => MaybePromise<FetchRequestInit | void>>;
55
- onResponse?: MaybeArray<(response: Response) => MaybePromise<unknown>>;
56
- keepDomain?: boolean;
57
- }
58
- export type TreatyResponse<Res extends Record<number, unknown>> = {
59
- data: Res[200];
60
- error: null;
61
- response: Response;
62
- status: number;
63
- headers: FetchRequestInit['headers'];
64
- } | {
65
- data: null;
66
- error: Exclude<keyof Res, 200> extends never ? {
67
- status: unknown;
68
- value: unknown;
69
- } : {
70
- [Status in keyof Res]: {
71
- status: Status;
72
- value: Res[Status];
73
- };
74
- }[Exclude<keyof Res, 200>];
75
- response: Response;
76
- status: number;
77
- headers: FetchRequestInit['headers'];
78
- };
79
- export interface OnMessage<Data = unknown> extends MessageEvent {
80
- data: Data;
81
- rawData: MessageEvent['data'];
82
- }
83
- export type WSEvent<K extends keyof WebSocketEventMap, Data = unknown> = K extends 'message' ? OnMessage<Data> : WebSocketEventMap[K];
84
- export {};
85
- }
86
- export {};
@@ -1,14 +0,0 @@
1
- import type { InputSchema } from 'elysia';
2
- import type { Treaty } from './types';
3
- export declare class EdenWS<in out Schema extends InputSchema<any> = {}> {
4
- url: string;
5
- ws: WebSocket;
6
- constructor(url: string);
7
- send(data: Schema['body'] | Schema['body'][]): this;
8
- on<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
9
- off<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
10
- subscribe(onMessage: (event: Treaty.WSEvent<'message', Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
11
- addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
12
- removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
13
- close(): this;
14
- }
@@ -1,103 +0,0 @@
1
- import { InputSchema, Elysia } from 'elysia';
2
- import { P as Prettify, a as IsNever, N as Not } from './types-C41kuZ-K.mjs';
3
-
4
- declare class EdenWS<in out Schema extends InputSchema<any> = {}> {
5
- url: string;
6
- ws: WebSocket;
7
- constructor(url: string);
8
- send(data: Schema['body'] | Schema['body'][]): this;
9
- on<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
10
- off<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
11
- subscribe(onMessage: (event: Treaty.WSEvent<'message', Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
12
- addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
13
- removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
14
- close(): this;
15
- }
16
-
17
- type Files = File | FileList;
18
- type ReplaceBlobWithFiles<in out RecordType extends Record<string, unknown>> = {
19
- [K in keyof RecordType]: RecordType[K] extends Blob | Blob[] ? Files : RecordType[K];
20
- } & {};
21
- type And<A extends boolean, B extends boolean> = A extends true ? B extends true ? true : false : false;
22
- type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = {
23
- [K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K] extends AsyncGenerator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K];
24
- } & {};
25
- type MaybeArray<T> = T | T[];
26
- type MaybePromise<T> = T | Promise<T>;
27
- declare namespace Treaty {
28
- interface TreatyParam {
29
- fetch?: RequestInit;
30
- }
31
- export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> = App extends {
32
- _routes: infer Schema extends Record<string, any>;
33
- } ? Prettify<Sign<Schema>> : 'Please install Elysia before using Eden';
34
- export type Sign<in out Route extends Record<string, any>> = {
35
- [K in keyof Route as K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
36
- headers?: Record<string, unknown>;
37
- } : {
38
- headers: Route['subscribe']['headers'];
39
- }) & (undefined extends Route['subscribe']['query'] ? {
40
- query?: Record<string, unknown>;
41
- } : {
42
- query: Route['subscribe']['query'];
43
- }) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
44
- body: infer Body;
45
- headers: infer Headers;
46
- params: any;
47
- query: infer Query;
48
- response: infer Response extends Record<number, unknown>;
49
- } ? (undefined extends Headers ? {
50
- headers?: Record<string, unknown>;
51
- } : {
52
- headers: Headers;
53
- }) & (undefined extends Query ? {
54
- query?: Record<string, unknown>;
55
- } : {
56
- query: Query;
57
- }) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : never : CreateParams<Route[K]>;
58
- };
59
- type CreateParams<Route extends Record<string, any>> = Extract<keyof Route, `:${string}`> extends infer Path extends string ? IsNever<Path> extends true ? Prettify<Sign<Route>> : // ! DO NOT USE PRETTIFY ON THIS LINE, OTHERWISE FUNCTION CALLING WILL BE OMITTED
60
- (((params: {
61
- [param in Path extends `:${infer Param}` ? Param extends `${infer Param}?` ? Param : Param : never]: string | number;
62
- }) => Prettify<Sign<Route[Path]>> & CreateParams<Route[Path]>) & Prettify<Sign<Route>>) & (Path extends `:${string}?` ? CreateParams<Route[Path]> : {}) : never;
63
- export interface Config {
64
- fetch?: Omit<RequestInit, 'headers' | 'method'>;
65
- fetcher?: typeof fetch;
66
- headers?: MaybeArray<RequestInit['headers'] | ((path: string, options: RequestInit) => RequestInit['headers'] | void)>;
67
- onRequest?: MaybeArray<(path: string, options: FetchRequestInit) => MaybePromise<FetchRequestInit | void>>;
68
- onResponse?: MaybeArray<(response: Response) => MaybePromise<unknown>>;
69
- keepDomain?: boolean;
70
- }
71
- export type TreatyResponse<Res extends Record<number, unknown>> = {
72
- data: Res[200];
73
- error: null;
74
- response: Response;
75
- status: number;
76
- headers: FetchRequestInit['headers'];
77
- } | {
78
- data: null;
79
- error: Exclude<keyof Res, 200> extends never ? {
80
- status: unknown;
81
- value: unknown;
82
- } : {
83
- [Status in keyof Res]: {
84
- status: Status;
85
- value: Res[Status];
86
- };
87
- }[Exclude<keyof Res, 200>];
88
- response: Response;
89
- status: number;
90
- headers: FetchRequestInit['headers'];
91
- };
92
- export interface OnMessage<Data = unknown> extends MessageEvent {
93
- data: Data;
94
- rawData: MessageEvent['data'];
95
- }
96
- export type WSEvent<K extends keyof WebSocketEventMap, Data = unknown> = K extends 'message' ? OnMessage<Data> : WebSocketEventMap[K];
97
- export { };
98
- }
99
-
100
- declare function streamResponse(response: Response): AsyncGenerator<any, void, unknown>;
101
- declare const treaty: <const App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string | App, config?: Treaty.Config) => Treaty.Create<App>;
102
-
103
- export { Treaty, streamResponse, treaty };
@@ -1,103 +0,0 @@
1
- import { InputSchema, Elysia } from 'elysia';
2
- import { P as Prettify, a as IsNever, N as Not } from './types-C41kuZ-K.js';
3
-
4
- declare class EdenWS<in out Schema extends InputSchema<any> = {}> {
5
- url: string;
6
- ws: WebSocket;
7
- constructor(url: string);
8
- send(data: Schema['body'] | Schema['body'][]): this;
9
- on<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
10
- off<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
11
- subscribe(onMessage: (event: Treaty.WSEvent<'message', Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
12
- addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (event: Treaty.WSEvent<K, Schema['response']>) => void, options?: boolean | AddEventListenerOptions): this;
13
- removeEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, options?: boolean | EventListenerOptions): this;
14
- close(): this;
15
- }
16
-
17
- type Files = File | FileList;
18
- type ReplaceBlobWithFiles<in out RecordType extends Record<string, unknown>> = {
19
- [K in keyof RecordType]: RecordType[K] extends Blob | Blob[] ? Files : RecordType[K];
20
- } & {};
21
- type And<A extends boolean, B extends boolean> = A extends true ? B extends true ? true : false : false;
22
- type ReplaceGeneratorWithAsyncGenerator<in out RecordType extends Record<string, unknown>> = {
23
- [K in keyof RecordType]: RecordType[K] extends Generator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K] extends AsyncGenerator<infer A, infer B, infer C> ? And<Not<IsNever<A>>, void extends B ? true : false> extends true ? AsyncGenerator<A, B, C> : And<IsNever<A>, void extends B ? false : true> extends true ? B : AsyncGenerator<A, B, C> | B : RecordType[K];
24
- } & {};
25
- type MaybeArray<T> = T | T[];
26
- type MaybePromise<T> = T | Promise<T>;
27
- declare namespace Treaty {
28
- interface TreatyParam {
29
- fetch?: RequestInit;
30
- }
31
- export type Create<App extends Elysia<any, any, any, any, any, any, any, any>> = App extends {
32
- _routes: infer Schema extends Record<string, any>;
33
- } ? Prettify<Sign<Schema>> : 'Please install Elysia before using Eden';
34
- export type Sign<in out Route extends Record<string, any>> = {
35
- [K in keyof Route as K extends `:${string}` ? never : K]: K extends 'subscribe' ? (undefined extends Route['subscribe']['headers'] ? {
36
- headers?: Record<string, unknown>;
37
- } : {
38
- headers: Route['subscribe']['headers'];
39
- }) & (undefined extends Route['subscribe']['query'] ? {
40
- query?: Record<string, unknown>;
41
- } : {
42
- query: Route['subscribe']['query'];
43
- }) extends infer Param ? {} extends Param ? (options?: Param) => EdenWS<Route['subscribe']> : (options?: Param) => EdenWS<Route['subscribe']> : never : Route[K] extends {
44
- body: infer Body;
45
- headers: infer Headers;
46
- params: any;
47
- query: infer Query;
48
- response: infer Response extends Record<number, unknown>;
49
- } ? (undefined extends Headers ? {
50
- headers?: Record<string, unknown>;
51
- } : {
52
- headers: Headers;
53
- }) & (undefined extends Query ? {
54
- query?: Record<string, unknown>;
55
- } : {
56
- query: Query;
57
- }) extends infer Param ? {} extends Param ? undefined extends Body ? K extends 'get' | 'head' ? (options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body?: Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options?: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : K extends 'get' | 'head' ? (options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : (body: Body extends Record<string, unknown> ? ReplaceBlobWithFiles<Body> : Body, options: Prettify<Param & TreatyParam>) => Promise<TreatyResponse<ReplaceGeneratorWithAsyncGenerator<Response>>> : never : CreateParams<Route[K]>;
58
- };
59
- type CreateParams<Route extends Record<string, any>> = Extract<keyof Route, `:${string}`> extends infer Path extends string ? IsNever<Path> extends true ? Prettify<Sign<Route>> : // ! DO NOT USE PRETTIFY ON THIS LINE, OTHERWISE FUNCTION CALLING WILL BE OMITTED
60
- (((params: {
61
- [param in Path extends `:${infer Param}` ? Param extends `${infer Param}?` ? Param : Param : never]: string | number;
62
- }) => Prettify<Sign<Route[Path]>> & CreateParams<Route[Path]>) & Prettify<Sign<Route>>) & (Path extends `:${string}?` ? CreateParams<Route[Path]> : {}) : never;
63
- export interface Config {
64
- fetch?: Omit<RequestInit, 'headers' | 'method'>;
65
- fetcher?: typeof fetch;
66
- headers?: MaybeArray<RequestInit['headers'] | ((path: string, options: RequestInit) => RequestInit['headers'] | void)>;
67
- onRequest?: MaybeArray<(path: string, options: FetchRequestInit) => MaybePromise<FetchRequestInit | void>>;
68
- onResponse?: MaybeArray<(response: Response) => MaybePromise<unknown>>;
69
- keepDomain?: boolean;
70
- }
71
- export type TreatyResponse<Res extends Record<number, unknown>> = {
72
- data: Res[200];
73
- error: null;
74
- response: Response;
75
- status: number;
76
- headers: FetchRequestInit['headers'];
77
- } | {
78
- data: null;
79
- error: Exclude<keyof Res, 200> extends never ? {
80
- status: unknown;
81
- value: unknown;
82
- } : {
83
- [Status in keyof Res]: {
84
- status: Status;
85
- value: Res[Status];
86
- };
87
- }[Exclude<keyof Res, 200>];
88
- response: Response;
89
- status: number;
90
- headers: FetchRequestInit['headers'];
91
- };
92
- export interface OnMessage<Data = unknown> extends MessageEvent {
93
- data: Data;
94
- rawData: MessageEvent['data'];
95
- }
96
- export type WSEvent<K extends keyof WebSocketEventMap, Data = unknown> = K extends 'message' ? OnMessage<Data> : WebSocketEventMap[K];
97
- export { };
98
- }
99
-
100
- declare function streamResponse(response: Response): AsyncGenerator<any, void, unknown>;
101
- declare const treaty: <const App extends Elysia<any, any, any, any, any, any, any, any>>(domain: string | App, config?: Treaty.Config) => Treaty.Create<App>;
102
-
103
- export { Treaty, streamResponse, treaty };
@@ -1 +0,0 @@
1
- "use strict";var Eden=(()=>{var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},B=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of U(t))!V.call(e,o)&&o!==n&&M(e,o,{get:()=>t[o],enumerable:!(s=H(t,o))||s.enumerable});return e};var Z=e=>B(M({},"__esModule",{value:!0}),e);var re={};$(re,{streamResponse:()=>J,treaty:()=>se});var k=class extends Error{constructor(n,s){super(s+"");this.status=n;this.value=s}};var G=/(\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))/,z=/(?: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)?)?$/,X=e=>e.trim().length!==0&&!Number.isNaN(Number(e)),K=e=>{if(typeof e!="string")return null;let t=e.replace(/"/g,"");if(G.test(t)||z.test(t)||Q.test(t)){let n=new Date(t);if(!Number.isNaN(n.getTime()))return n}return null},Y=e=>{let t=e.charCodeAt(0),n=e.charCodeAt(e.length-1);return t===123&&n===125||t===91&&n===93},ee=e=>JSON.parse(e,(t,n)=>{let s=K(n);return s||n}),T=e=>{if(!e)return e;if(X(e))return+e;if(e==="true")return!0;if(e==="false")return!1;let t=K(e);if(t)return t;if(Y(e))try{return ee(e)}catch{}return e},D=e=>{let t=e.data.toString();return t==="null"?null:T(t)};var F=class{constructor(t){this.url=t;this.ws=new WebSocket(t)}ws;send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,s){return this.addEventListener(t,n,s)}off(t,n,s){return this.ws.removeEventListener(t,n,s),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,s){return this.ws.addEventListener(t,o=>{if(t==="message"){let f=D(o);n({...o,data:f})}else n(o)},s),this}removeEventListener(t,n,s){return this.off(t,n,s),this}close(){return this.ws.close(),this}};var te=["get","post","put","delete","patch","options","head","connect","subscribe"],I=["localhost","127.0.0.1","0.0.0.0"],j=typeof FileList>"u",q=e=>j?e instanceof Blob:e instanceof FileList||e instanceof File,ne=e=>{if(!e)return!1;for(let t in e)if(q(e[t])||Array.isArray(e[t])&&e[t].find(q))return!0;return!1},W=e=>j?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let s=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(s)},n.readAsArrayBuffer(e)}),w=(e,t,n={},s={})=>{if(Array.isArray(e)){for(let o of e)if(!Array.isArray(o))s=w(o,t,n,s);else{let f=o[0];if(typeof f=="string")s[f.toLowerCase()]=o[1];else for(let[i,b]of f)s[i.toLowerCase()]=b}return s}if(!e)return s;switch(typeof e){case"function":if(e instanceof Headers)return w(e,t,n,s);let o=e(t,n);return o?w(o,t,n,s):s;case"object":if(e instanceof Headers)return e.forEach((f,i)=>{s[i.toLowerCase()]=f}),s;for(let[f,i]of Object.entries(e))s[f.toLowerCase()]=i;return s;default:return s}};async function*J(e){let t=e.body;if(!t)return;let n=t.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:f}=await n.read();if(o)break;let i=s.decode(f);yield T(i)}}finally{n.releaseLock()}}var x=(e,t,n=[],s)=>new Proxy(()=>{},{get(o,f){return x(e,t,f==="index"?n:[...n,f],s)},apply(o,f,[i,b]){if(!i||b||typeof i=="object"&&Object.keys(i).length!==1||te.includes(n.at(-1))){let C=[...n],E=C.pop(),h="/"+C.join("/"),{fetcher:P=fetch,headers:O,onRequest:p,onResponse:v,fetch:_}=t,S=E==="get"||E==="head"||E==="subscribe";O=w(O,h,b);let N=S?i?.query:b?.query,L="";if(N){let r=(g,l)=>{L+=(L?"&":"?")+`${encodeURIComponent(g)}=${encodeURIComponent(l)}`};for(let[g,l]of Object.entries(N)){if(Array.isArray(l)){for(let c of l)r(g,c);continue}if(typeof l=="object"){r(g,JSON.stringify(l));continue}r(g,`${l}`)}}if(E==="subscribe"){let r=e.replace(/^([^]+):\/\//,e.startsWith("https://")?"wss://":e.startsWith("http://")||I.find(g=>e.includes(g))?"ws://":"wss://")+h+L;return new F(r)}return(async()=>{let r={method:E?.toUpperCase(),body:i,..._,headers:O};r.headers={...O,...w(S?i?.headers:b?.headers,h,r)};let g=S&&typeof i=="object"?i.fetch:b?.fetch;if(r={...r,...g},S&&delete r.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let a=await d(h,r);typeof a=="object"&&(r={...r,...a,headers:{...r.headers,...w(a.headers,h,r)}})}}if(S&&delete r.body,ne(i)){let d=new FormData;for(let[a,y]of Object.entries(r.body)){if(j){d.append(a,y);continue}if(y instanceof File){d.append(a,await W(y));continue}if(y instanceof FileList){for(let m=0;m<y.length;m++)d.append(a,await W(y[m]));continue}if(Array.isArray(y)){for(let m=0;m<y.length;m++){let R=y[m];d.append(a,R instanceof File?await W(R):R)}continue}d.append(a,y)}r.body=d}else typeof i=="object"?(r.headers["content-type"]="application/json",r.body=JSON.stringify(i)):i!=null&&(r.headers["content-type"]="text/plain");if(S&&delete r.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let a=await d(h,r);typeof a=="object"&&(r={...r,...a,headers:{...r.headers,...w(a.headers,h,r)}})}}let l=e+h+L,c=await(s?.handle(new Request(l,r))??P(l,r)),u=null,A=null;if(v){Array.isArray(v)||(v=[v]);for(let d of v)try{let a=await d(c.clone());if(a!=null){u=a;break}}catch(a){a instanceof k?A=a:A=new k(422,a);break}}if(u!==null)return{data:u,error:A,response:c,status:c.status,headers:c.headers};switch(c.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":u=J(c);break;case"application/json":u=await c.json();break;case"application/octet-stream":u=await c.arrayBuffer();break;case"multipart/form-data":let d=await c.formData();u={},d.forEach((a,y)=>{u[y]=a});break;default:u=await c.text().then(T)}return(c.status>=300||c.status<200)&&(A=new k(c.status,u),u=null),{data:u,error:A,response:c,status:c.status,headers:c.headers}})()}return typeof i=="object"?x(e,t,[...n,Object.values(i)[0]],s):x(e,t,n)}}),se=(e,t={})=>typeof e=="string"?(t.keepDomain||(e.includes("://")||(e=(I.find(n=>e.includes(n))?"http://":"https://")+e),e.endsWith("/")&&(e=e.slice(0,-1))),x(e,t)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),x("http://e.ly",t,[],e));return Z(re);})();
@@ -1 +0,0 @@
1
- "use strict";var M=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var n in t)M(e,n,{get:t[n],enumerable:!0})},B=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of U(t))!V.call(e,o)&&o!==n&&M(e,o,{get:()=>t[o],enumerable:!(s=H(t,o))||s.enumerable});return e};var Z=e=>B(M({},"__esModule",{value:!0}),e);var re={};$(re,{streamResponse:()=>J,treaty:()=>se});module.exports=Z(re);var k=class extends Error{constructor(n,s){super(s+"");this.status=n;this.value=s}};var G=/(\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))/,z=/(?: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)?)?$/,X=e=>e.trim().length!==0&&!Number.isNaN(Number(e)),K=e=>{if(typeof e!="string")return null;let t=e.replace(/"/g,"");if(G.test(t)||z.test(t)||Q.test(t)){let n=new Date(t);if(!Number.isNaN(n.getTime()))return n}return null},Y=e=>{let t=e.charCodeAt(0),n=e.charCodeAt(e.length-1);return t===123&&n===125||t===91&&n===93},ee=e=>JSON.parse(e,(t,n)=>{let s=K(n);return s||n}),T=e=>{if(!e)return e;if(X(e))return+e;if(e==="true")return!0;if(e==="false")return!1;let t=K(e);if(t)return t;if(Y(e))try{return ee(e)}catch{}return e},D=e=>{let t=e.data.toString();return t==="null"?null:T(t)};var F=class{constructor(t){this.url=t;this.ws=new WebSocket(t)}ws;send(t){return Array.isArray(t)?(t.forEach(n=>this.send(n)),this):(this.ws.send(typeof t=="object"?JSON.stringify(t):t.toString()),this)}on(t,n,s){return this.addEventListener(t,n,s)}off(t,n,s){return this.ws.removeEventListener(t,n,s),this}subscribe(t,n){return this.addEventListener("message",t,n)}addEventListener(t,n,s){return this.ws.addEventListener(t,o=>{if(t==="message"){let f=D(o);n({...o,data:f})}else n(o)},s),this}removeEventListener(t,n,s){return this.off(t,n,s),this}close(){return this.ws.close(),this}};var te=["get","post","put","delete","patch","options","head","connect","subscribe"],I=["localhost","127.0.0.1","0.0.0.0"],j=typeof FileList>"u",q=e=>j?e instanceof Blob:e instanceof FileList||e instanceof File,ne=e=>{if(!e)return!1;for(let t in e)if(q(e[t])||Array.isArray(e[t])&&e[t].find(q))return!0;return!1},W=e=>j?e:new Promise(t=>{let n=new FileReader;n.onload=()=>{let s=new File([n.result],e.name,{lastModified:e.lastModified,type:e.type});t(s)},n.readAsArrayBuffer(e)}),w=(e,t,n={},s={})=>{if(Array.isArray(e)){for(let o of e)if(!Array.isArray(o))s=w(o,t,n,s);else{let f=o[0];if(typeof f=="string")s[f.toLowerCase()]=o[1];else for(let[i,b]of f)s[i.toLowerCase()]=b}return s}if(!e)return s;switch(typeof e){case"function":if(e instanceof Headers)return w(e,t,n,s);let o=e(t,n);return o?w(o,t,n,s):s;case"object":if(e instanceof Headers)return e.forEach((f,i)=>{s[i.toLowerCase()]=f}),s;for(let[f,i]of Object.entries(e))s[f.toLowerCase()]=i;return s;default:return s}};async function*J(e){let t=e.body;if(!t)return;let n=t.getReader(),s=new TextDecoder;try{for(;;){let{done:o,value:f}=await n.read();if(o)break;let i=s.decode(f);yield T(i)}}finally{n.releaseLock()}}var x=(e,t,n=[],s)=>new Proxy(()=>{},{get(o,f){return x(e,t,f==="index"?n:[...n,f],s)},apply(o,f,[i,b]){if(!i||b||typeof i=="object"&&Object.keys(i).length!==1||te.includes(n.at(-1))){let C=[...n],E=C.pop(),h="/"+C.join("/"),{fetcher:P=fetch,headers:O,onRequest:p,onResponse:v,fetch:_}=t,S=E==="get"||E==="head"||E==="subscribe";O=w(O,h,b);let N=S?i?.query:b?.query,L="";if(N){let r=(g,l)=>{L+=(L?"&":"?")+`${encodeURIComponent(g)}=${encodeURIComponent(l)}`};for(let[g,l]of Object.entries(N)){if(Array.isArray(l)){for(let c of l)r(g,c);continue}if(typeof l=="object"){r(g,JSON.stringify(l));continue}r(g,`${l}`)}}if(E==="subscribe"){let r=e.replace(/^([^]+):\/\//,e.startsWith("https://")?"wss://":e.startsWith("http://")||I.find(g=>e.includes(g))?"ws://":"wss://")+h+L;return new F(r)}return(async()=>{let r={method:E?.toUpperCase(),body:i,..._,headers:O};r.headers={...O,...w(S?i?.headers:b?.headers,h,r)};let g=S&&typeof i=="object"?i.fetch:b?.fetch;if(r={...r,...g},S&&delete r.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let a=await d(h,r);typeof a=="object"&&(r={...r,...a,headers:{...r.headers,...w(a.headers,h,r)}})}}if(S&&delete r.body,ne(i)){let d=new FormData;for(let[a,y]of Object.entries(r.body)){if(j){d.append(a,y);continue}if(y instanceof File){d.append(a,await W(y));continue}if(y instanceof FileList){for(let m=0;m<y.length;m++)d.append(a,await W(y[m]));continue}if(Array.isArray(y)){for(let m=0;m<y.length;m++){let R=y[m];d.append(a,R instanceof File?await W(R):R)}continue}d.append(a,y)}r.body=d}else typeof i=="object"?(r.headers["content-type"]="application/json",r.body=JSON.stringify(i)):i!=null&&(r.headers["content-type"]="text/plain");if(S&&delete r.body,p){Array.isArray(p)||(p=[p]);for(let d of p){let a=await d(h,r);typeof a=="object"&&(r={...r,...a,headers:{...r.headers,...w(a.headers,h,r)}})}}let l=e+h+L,c=await(s?.handle(new Request(l,r))??P(l,r)),u=null,A=null;if(v){Array.isArray(v)||(v=[v]);for(let d of v)try{let a=await d(c.clone());if(a!=null){u=a;break}}catch(a){a instanceof k?A=a:A=new k(422,a);break}}if(u!==null)return{data:u,error:A,response:c,status:c.status,headers:c.headers};switch(c.headers.get("Content-Type")?.split(";")[0]){case"text/event-stream":u=J(c);break;case"application/json":u=await c.json();break;case"application/octet-stream":u=await c.arrayBuffer();break;case"multipart/form-data":let d=await c.formData();u={},d.forEach((a,y)=>{u[y]=a});break;default:u=await c.text().then(T)}return(c.status>=300||c.status<200)&&(A=new k(c.status,u),u=null),{data:u,error:A,response:c,status:c.status,headers:c.headers}})()}return typeof i=="object"?x(e,t,[...n,Object.values(i)[0]],s):x(e,t,n)}}),se=(e,t={})=>typeof e=="string"?(t.keepDomain||(e.includes("://")||(e=(I.find(n=>e.includes(n))?"http://":"https://")+e),e.endsWith("/")&&(e=e.slice(0,-1))),x(e,t)):(typeof window<"u"&&console.warn("Elysia instance server found on client side, this is not recommended for security reason. Use generic type instead."),x("http://e.ly",t,[],e));0&&(module.exports={streamResponse,treaty});
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk-7WO4HTSU.mjs";import"./chunk-XYW4OUFN.mjs";export{a as streamResponse,b as treaty};
@@ -1,44 +0,0 @@
1
- declare class EdenFetchError<Status extends number = number, Value = unknown> extends Error {
2
- status: Status;
3
- value: Value;
4
- constructor(status: Status, value: Value);
5
- }
6
-
7
- type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
8
- type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
9
- type ErrorRange = Range<300, 599>;
10
- type MapError<T extends Record<number, unknown>> = [
11
- {
12
- [K in keyof T]-?: K extends ErrorRange ? K : never;
13
- }[keyof T]
14
- ] extends [infer A extends number] ? {
15
- [K in A]: EdenFetchError<K, T[K]>;
16
- }[A] : false;
17
- type UnionToIntersect<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never;
18
- type IsAny<T> = 0 extends 1 & T ? true : false;
19
- type IsNever<T> = [T] extends [never] ? true : false;
20
- type IsUnknown<T> = IsAny<T> extends true ? false : unknown extends T ? true : false;
21
- type AnyTypedRoute = {
22
- body?: unknown;
23
- headers?: unknown;
24
- query?: unknown;
25
- params?: unknown;
26
- response: Record<number, unknown>;
27
- };
28
- type Prettify<T> = {
29
- [K in keyof T]: T[K];
30
- } & {};
31
- type TreatyToPath<T, Path extends string = ''> = UnionToIntersect<T extends Record<string, unknown> ? {
32
- [K in keyof T]: T[K] extends AnyTypedRoute ? {
33
- [path in Path]: {
34
- [method in K]: T[K];
35
- };
36
- } : unknown extends T[K] ? {
37
- [path in Path]: {
38
- [method in K]: T[K];
39
- };
40
- } : TreatyToPath<T[K], `${Path}/${K & string}`>;
41
- }[keyof T] : {}>;
42
- type Not<T> = T extends true ? false : true;
43
-
44
- export { EdenFetchError as E, type IsUnknown as I, type MapError as M, type Not as N, type Prettify as P, type TreatyToPath as T, type IsNever as a };
@@ -1,44 +0,0 @@
1
- declare class EdenFetchError<Status extends number = number, Value = unknown> extends Error {
2
- status: Status;
3
- value: Value;
4
- constructor(status: Status, value: Value);
5
- }
6
-
7
- type Range<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
8
- type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
9
- type ErrorRange = Range<300, 599>;
10
- type MapError<T extends Record<number, unknown>> = [
11
- {
12
- [K in keyof T]-?: K extends ErrorRange ? K : never;
13
- }[keyof T]
14
- ] extends [infer A extends number] ? {
15
- [K in A]: EdenFetchError<K, T[K]>;
16
- }[A] : false;
17
- type UnionToIntersect<U> = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never;
18
- type IsAny<T> = 0 extends 1 & T ? true : false;
19
- type IsNever<T> = [T] extends [never] ? true : false;
20
- type IsUnknown<T> = IsAny<T> extends true ? false : unknown extends T ? true : false;
21
- type AnyTypedRoute = {
22
- body?: unknown;
23
- headers?: unknown;
24
- query?: unknown;
25
- params?: unknown;
26
- response: Record<number, unknown>;
27
- };
28
- type Prettify<T> = {
29
- [K in keyof T]: T[K];
30
- } & {};
31
- type TreatyToPath<T, Path extends string = ''> = UnionToIntersect<T extends Record<string, unknown> ? {
32
- [K in keyof T]: T[K] extends AnyTypedRoute ? {
33
- [path in Path]: {
34
- [method in K]: T[K];
35
- };
36
- } : unknown extends T[K] ? {
37
- [path in Path]: {
38
- [method in K]: T[K];
39
- };
40
- } : TreatyToPath<T[K], `${Path}/${K & string}`>;
41
- }[keyof T] : {}>;
42
- type Not<T> = T extends true ? false : true;
43
-
44
- export { EdenFetchError as E, type IsUnknown as I, type MapError as M, type Not as N, type Prettify as P, type TreatyToPath as T, type IsNever as a };