@elysiajs/eden 0.8.0 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yaml +1 -0
- package/.github/workflows/ci.yml +28 -0
- package/README.md +1 -1
- package/dist/chunk-R27QELXO.mjs +1 -0
- package/dist/chunk-VMCNRAXS.mjs +1 -0
- package/dist/chunk-YTAZNCPF.mjs +1 -0
- package/dist/fetch/index.d.ts +1 -1
- package/dist/fetch/types.d.ts +11 -13
- package/dist/fetch.d.mts +12 -13
- package/dist/fetch.d.ts +12 -13
- package/dist/fetch.global.js +1 -1
- package/dist/fetch.js +1 -1
- package/dist/fetch.mjs +1 -1
- package/dist/index.d.mts +68 -2
- package/dist/index.d.ts +68 -2
- package/dist/index.global.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/treaty/index.d.ts +1 -1
- package/dist/treaty/types.d.ts +58 -61
- package/dist/treaty/utils.d.ts +1 -0
- package/dist/treaty.d.mts +59 -62
- package/dist/treaty.d.ts +59 -62
- package/dist/treaty.global.js +1 -1
- package/dist/treaty.js +1 -1
- package/dist/treaty.mjs +1 -1
- package/dist/treaty2/index.d.ts +4 -0
- package/dist/treaty2/types.d.ts +64 -0
- package/dist/treaty2/ws.d.ts +14 -0
- package/dist/{types-d1b334ad.d.ts → types-BQi-Ff9p.d.ts} +22 -1
- package/dist/types.d.ts +19 -7
- package/package.json +69 -77
- package/dist/chunk-3KYW6H6M.mjs +0 -1
- package/dist/chunk-NZCTJ6S3.mjs +0 -1
- package/dist/chunk-Y6SMVGJX.mjs +0 -1
- package/src/errors.ts +0 -16
- package/src/fetch/index.ts +0 -82
- package/src/fetch/types.ts +0 -81
- package/src/index.ts +0 -7
- package/src/treaty/index.ts +0 -376
- package/src/treaty/types.ts +0 -219
- package/src/treaty/utils.ts +0 -15
- package/src/types.ts +0 -58
package/dist/types.d.ts
CHANGED
|
@@ -15,12 +15,24 @@ export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
|
15
15
|
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
16
16
|
export type IsUnknown<T> = IsAny<T> extends true ? false : unknown extends T ? true : false;
|
|
17
17
|
export type AnyTypedRoute = {
|
|
18
|
-
body
|
|
19
|
-
headers
|
|
20
|
-
query
|
|
21
|
-
params
|
|
22
|
-
response: Record<
|
|
23
|
-
'200': unknown;
|
|
24
|
-
};
|
|
18
|
+
body?: unknown;
|
|
19
|
+
headers?: unknown;
|
|
20
|
+
query?: unknown;
|
|
21
|
+
params?: unknown;
|
|
22
|
+
response: Record<number, unknown>;
|
|
25
23
|
};
|
|
24
|
+
export type Prettify<T> = {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} & {};
|
|
27
|
+
export type TreatyToPath<T, Path extends string = ''> = UnionToIntersect<T extends Record<string, unknown> ? {
|
|
28
|
+
[K in keyof T]: T[K] extends AnyTypedRoute ? {
|
|
29
|
+
[path in Path]: {
|
|
30
|
+
[method in K]: T[K];
|
|
31
|
+
};
|
|
32
|
+
} : unknown extends T[K] ? {
|
|
33
|
+
[path in Path]: {
|
|
34
|
+
[method in K]: T[K];
|
|
35
|
+
};
|
|
36
|
+
} : TreatyToPath<T[K], `${Path}/${K & string}`>;
|
|
37
|
+
}[keyof T] : {}>;
|
|
26
38
|
export {};
|
package/package.json
CHANGED
|
@@ -1,82 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"name": "@elysiajs/eden",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"description": "Fully type-safe Elysia client",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "saltyAom",
|
|
7
|
+
"url": "https://github.com/SaltyAom",
|
|
8
|
+
"email": "saltyaom@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.mjs",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"import": "./dist/index.mjs",
|
|
16
|
+
"node": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
9
19
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"default": "./dist/index.js",
|
|
17
|
-
"types": "./dist/index.d.ts"
|
|
18
|
-
},
|
|
19
|
-
"./treaty": {
|
|
20
|
-
"require": "./dist/treaty.js",
|
|
21
|
-
"import": "./dist/treaty.mjs",
|
|
22
|
-
"node": "./dist/treaty.js",
|
|
23
|
-
"default": "./dist/treaty.js",
|
|
24
|
-
"types": "./dist/treaty/index.d.ts"
|
|
25
|
-
},
|
|
26
|
-
"./fetch": {
|
|
27
|
-
"require": "./dist/fetch.js",
|
|
28
|
-
"import": "./dist/fetch.mjs",
|
|
29
|
-
"node": "./dist/fetch.js",
|
|
30
|
-
"default": "./dist/fetch.js",
|
|
31
|
-
"types": "./dist/fetch/index.d.ts"
|
|
32
|
-
}
|
|
20
|
+
"./treaty": {
|
|
21
|
+
"require": "./dist/treaty.js",
|
|
22
|
+
"import": "./dist/treaty.mjs",
|
|
23
|
+
"node": "./dist/treaty.js",
|
|
24
|
+
"default": "./dist/treaty.js",
|
|
25
|
+
"types": "./dist/treaty/index.d.ts"
|
|
33
26
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"homepage": "https://github.com/elysiajs/eden",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/elysiajs/eden"
|
|
44
|
-
},
|
|
45
|
-
"bugs": "https://github.com/elysiajs/eden/issues",
|
|
46
|
-
"license": "MIT",
|
|
47
|
-
"scripts": {
|
|
48
|
-
"dev": "bun run --watch example/index.ts",
|
|
49
|
-
"test": "bun test",
|
|
50
|
-
"build": "rimraf dist && tsup",
|
|
51
|
-
"release": "npm run build && npm run test && npm publish --access public"
|
|
52
|
-
},
|
|
53
|
-
"peerDependencies": {
|
|
54
|
-
"elysia": ">= 0.8.0"
|
|
55
|
-
},
|
|
56
|
-
"peerDependenciesMeta": {
|
|
57
|
-
"@sinclair/typebox": {
|
|
58
|
-
"optional": true
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@elysiajs/cors": "0.7.0",
|
|
63
|
-
"@sinclair/typebox": "^0.31.6",
|
|
64
|
-
"@types/node": "^18.15.5",
|
|
65
|
-
"bun-types": "^1.0.1",
|
|
66
|
-
"elysia": "0.8.0",
|
|
67
|
-
"esbuild": "^0.19.3",
|
|
68
|
-
"eslint": "^8.26.0",
|
|
69
|
-
"rimraf": "^4.4.1",
|
|
70
|
-
"tsup": "^7.2.0",
|
|
71
|
-
"typescript": "^5.2.2"
|
|
72
|
-
},
|
|
73
|
-
"prettier": {
|
|
74
|
-
"semi": false,
|
|
75
|
-
"tabWidth": 4,
|
|
76
|
-
"singleQuote": true,
|
|
77
|
-
"trailingComma": "none"
|
|
78
|
-
},
|
|
79
|
-
"dependencies": {
|
|
80
|
-
"superjson": "^2.2.1"
|
|
27
|
+
"./fetch": {
|
|
28
|
+
"require": "./dist/fetch.js",
|
|
29
|
+
"import": "./dist/fetch.mjs",
|
|
30
|
+
"node": "./dist/fetch.js",
|
|
31
|
+
"default": "./dist/fetch.js",
|
|
32
|
+
"types": "./dist/fetch/index.d.ts"
|
|
81
33
|
}
|
|
34
|
+
},
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"elysia",
|
|
38
|
+
"eden",
|
|
39
|
+
"connector"
|
|
40
|
+
],
|
|
41
|
+
"homepage": "https://github.com/elysiajs/eden",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/elysiajs/eden"
|
|
45
|
+
},
|
|
46
|
+
"bugs": "https://github.com/elysiajs/eden/issues",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"dev": "bun run --watch example/index.ts",
|
|
50
|
+
"test": "bun test",
|
|
51
|
+
"build": "rimraf dist && tsup",
|
|
52
|
+
"release": "npm run build && npm run test && npm publish --access public"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"elysia": ">= 1.0.0-beta.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@elysiajs/cors": "0.7.0",
|
|
59
|
+
"@types/bun": "^1.0.3",
|
|
60
|
+
"@types/node": "^18.15.5",
|
|
61
|
+
"elysia": "1.0.0-beta.0",
|
|
62
|
+
"esbuild": "^0.19.3",
|
|
63
|
+
"eslint": "^8.26.0",
|
|
64
|
+
"rimraf": "^4.4.1",
|
|
65
|
+
"tsup": "^7.2.0",
|
|
66
|
+
"typescript": "^5.3.2"
|
|
67
|
+
},
|
|
68
|
+
"prettier": {
|
|
69
|
+
"semi": false,
|
|
70
|
+
"tabWidth": 4,
|
|
71
|
+
"singleQuote": true,
|
|
72
|
+
"trailingComma": "none"
|
|
73
|
+
}
|
|
82
74
|
}
|
package/dist/chunk-3KYW6H6M.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-Y6SMVGJX.mjs";var m=(p,u)=>(s,{query:h,params:i,body:n,...r}={})=>{i&&Object.entries(i).forEach(([e,t])=>{s=s.replace(`:${e}`,t)});let o=r.headers?.["Content-Type"];if(!o||o==="application/json")try{n=JSON.stringify(n)}catch{}let f=u?.fetcher||globalThis.fetch,l=h?`?${new URLSearchParams(h).toString()}`:"",c=()=>f(p+s+l,{...r,method:r.method?.toUpperCase()||"GET",headers:n?{"content-type":"application/json",...r.headers}:r.headers,body:n}).then(async e=>{let t;switch(e.headers.get("Content-Type")?.split(";")[0]){case"application/json":t=await e.json();break;default:t=await e.text().then(a=>Number.isNaN(+a)?a==="true"?!0:a==="false"?!1:a:+a);break}return e.status>300?{data:null,status:e.status,headers:e.headers,retry:c,error:new y(e.status,t)}:{data:t,error:null,status:e.status,headers:e.headers,retry:c}});return c()};export{m as a};
|
package/dist/chunk-NZCTJ6S3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as R}from"./chunk-Y6SMVGJX.mjs";var L=(n,e,t)=>{if(n.endsWith("/")||(n+="/"),e==="index"&&(e=""),!t||!Object.keys(t).length)return`${n}${e}`;let r="";for(let[c,s]of Object.entries(t))r+=`${c}=${s}&`;return`${n}${e}?${r.slice(0,-1)}`};var T=typeof FileList>"u",W=n=>T?n instanceof Blob:n instanceof FileList||n instanceof File,q=n=>{if(!n)return!1;for(let e in n){if(W(n[e]))return!0;if(Array.isArray(n[e])&&n[e].find(t=>W(t)))return!0}return!1},k=n=>T?n:new Promise(e=>{let t=new FileReader;t.onload=()=>{let r=new File([t.result],n.name,{lastModified:n.lastModified,type:n.type});e(r)},t.readAsArrayBuffer(n)}),x=class{ws;url;constructor(e){this.ws=new WebSocket(e),this.url=e}send(e){return Array.isArray(e)?(e.forEach(t=>this.send(t)),this):(this.ws.send(typeof e=="object"?JSON.stringify(e):e.toString()),this)}on(e,t,r){return this.addEventListener(e,t,r)}off(e,t,r){return this.ws.removeEventListener(e,t,r),this}subscribe(e,t){return this.addEventListener("message",e,t)}addEventListener(e,t,r){return this.ws.addEventListener(e,c=>{if(e==="message"){let s=c.data.toString(),u=s.charCodeAt(0);if(u===47||u===123)try{s=JSON.parse(s)}catch{}else Number.isNaN(+s)?s==="true"?s=!0:s==="false"&&(s=!1):s=+s;t({...c,data:s})}else t(c)},r),this}removeEventListener(e,t,r){return this.off(e,t,r),this}close(){return this.ws.close(),this}},K=(n,e="",t)=>new Proxy(()=>{},{get(r,c,s){return K(n,`${e}/${c.toString()}`,t)},apply(r,c,[s,u={}]=[{},{}]){let y=s!==void 0&&(typeof s!="object"||Array.isArray(s))?s:void 0,{$query:N,$fetch:$,$headers:j,$transform:g,getRaw:M,...I}=s??{};y??=I;let w=e.lastIndexOf("/"),b=e.slice(w+1).toUpperCase(),S=L(n,w===-1?"/":e.slice(0,w),Object.assign(u.query??{},N)),P=t.fetcher??fetch,p=t.transform?Array.isArray(t.transform)?t.transform:[t.transform]:void 0,v=g?Array.isArray(g)?g:[g]:void 0;return v&&(p?p=v.concat(p):p=v),b==="SUBSCRIBE"?new x(S.replace(/^([^]+):\/\//,S.startsWith("https://")?"wss://":"ws://")):(async C=>{let f,F={...t.$fetch?.headers,...$?.headers,...u.headers,...j};if(b!=="GET"&&b!=="HEAD"){f=Object.keys(y).length||Array.isArray(y)?y:void 0;let i=typeof f=="object"||Array.isArray(y);if(i&&q(f)){let m=new FormData;for(let[E,o]of Object.entries(f))if(T)m.append(E,o);else if(o instanceof File)m.append(E,await k(o));else if(o instanceof FileList)for(let l=0;l<o.length;l++)m.append(E,await k(o[l]));else if(Array.isArray(o))for(let l=0;l<o.length;l++){let A=o[l];m.append(E,A instanceof File?await k(A):A)}else m.append(E,o);f=m}else F["content-type"]=i?"application/json":"text/plain",f=i?JSON.stringify(f):y}let a=await P(S,{method:b,body:f,...t.$fetch,...u.fetch,...$,headers:F}),h;if(C.getRaw)return a;switch(a.headers.get("Content-Type")?.split(";")[0]){case"application/json":h=await a.json();break;default:h=await a.text().then(i=>Number.isNaN(+i)?i==="true"?!0:i==="false"?!1:i:+i)}let O=a.status>=300||a.status<200?new R(a.status,h):null;if(p)for(let i of p){let d=i({data:h,status:a.status,headers:a.headers,response:a,error:O});d instanceof Promise&&(d=await d),d!=null&&(h=d)}return{data:h,error:O,response:a,status:a.status,headers:a.headers}})({getRaw:M})}}),U=(n,e={fetcher:fetch})=>new Proxy({},{get(t,r){return K(n,r,e)}});export{x as a,U as b};
|
package/dist/chunk-Y6SMVGJX.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=class extends Error{status;value;constructor(e,t){super(),this.status=e,this.value=t}};export{s as a};
|
package/src/errors.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { serialize, deserialize } from 'superjson'
|
|
2
|
-
|
|
3
|
-
export class EdenFetchError<
|
|
4
|
-
Status extends number = number,
|
|
5
|
-
Value = unknown
|
|
6
|
-
> extends Error {
|
|
7
|
-
status: Status
|
|
8
|
-
value: Value
|
|
9
|
-
|
|
10
|
-
constructor(status: Status, value: Value) {
|
|
11
|
-
super()
|
|
12
|
-
|
|
13
|
-
this.status = status
|
|
14
|
-
this.value = value
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/fetch/index.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { Elysia } from 'elysia'
|
|
2
|
-
|
|
3
|
-
import { EdenFetchError } from '../errors'
|
|
4
|
-
import type { EdenFetch } from './types'
|
|
5
|
-
export type { EdenFetch } from './types'
|
|
6
|
-
|
|
7
|
-
export const edenFetch =
|
|
8
|
-
<App extends Elysia<any, any, any, any, any, any>>(
|
|
9
|
-
server: string,
|
|
10
|
-
config?: EdenFetch.Config
|
|
11
|
-
): EdenFetch.Create<App> =>
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
(endpoint: string, { query, params, body, ...options } = {}) => {
|
|
14
|
-
if (params)
|
|
15
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
16
|
-
endpoint = endpoint.replace(`:${key}`, value as string)
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const contentType = options.headers?.['Content-Type']
|
|
20
|
-
|
|
21
|
-
if (!contentType || contentType === 'application/json')
|
|
22
|
-
try {
|
|
23
|
-
body = JSON.stringify(body)
|
|
24
|
-
} catch (error) {
|
|
25
|
-
//
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const fetch = config?.fetcher || globalThis.fetch
|
|
29
|
-
const queryStr = query
|
|
30
|
-
? `?${new URLSearchParams(query).toString()}`
|
|
31
|
-
: ''
|
|
32
|
-
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
const execute = () => fetch(server + endpoint + queryStr, {
|
|
35
|
-
...options,
|
|
36
|
-
method: options.method?.toUpperCase() || 'GET',
|
|
37
|
-
headers: body
|
|
38
|
-
? {
|
|
39
|
-
'content-type': 'application/json',
|
|
40
|
-
...options.headers
|
|
41
|
-
}
|
|
42
|
-
: options.headers,
|
|
43
|
-
body: body as any
|
|
44
|
-
}).then(async (res) => {
|
|
45
|
-
let data
|
|
46
|
-
|
|
47
|
-
switch (res.headers.get('Content-Type')?.split(';')[0]) {
|
|
48
|
-
case 'application/json':
|
|
49
|
-
data = await res.json()
|
|
50
|
-
break
|
|
51
|
-
|
|
52
|
-
default:
|
|
53
|
-
data = await res.text().then((d) => {
|
|
54
|
-
if (!Number.isNaN(+d)) return +d
|
|
55
|
-
if (d === 'true') return true
|
|
56
|
-
if (d === 'false') return false
|
|
57
|
-
|
|
58
|
-
return d
|
|
59
|
-
})
|
|
60
|
-
break
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (res.status > 300)
|
|
64
|
-
return {
|
|
65
|
-
data: null,
|
|
66
|
-
status: res.status,
|
|
67
|
-
headers: res.headers,
|
|
68
|
-
retry: execute,
|
|
69
|
-
error: new EdenFetchError(res.status, data)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
data,
|
|
74
|
-
error: null,
|
|
75
|
-
status: res.status,
|
|
76
|
-
headers: res.headers,
|
|
77
|
-
retry: execute
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
return execute()
|
|
82
|
-
}
|
package/src/fetch/types.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { Elysia } from 'elysia'
|
|
2
|
-
import type { EdenFetchError } from '../errors'
|
|
3
|
-
import type { MapError, IsUnknown, IsNever } from '../types'
|
|
4
|
-
|
|
5
|
-
type Prettify<T> = {
|
|
6
|
-
[K in keyof T]: T[K]
|
|
7
|
-
} & {}
|
|
8
|
-
|
|
9
|
-
export namespace EdenFetch {
|
|
10
|
-
export type Create<App extends Elysia<any, any, any, any, any, any>> =
|
|
11
|
-
App extends {
|
|
12
|
-
schema: infer Schema extends Record<string, any>
|
|
13
|
-
}
|
|
14
|
-
? EdenFetch.Fn<Schema>
|
|
15
|
-
: 'Please install Elysia before using Eden'
|
|
16
|
-
|
|
17
|
-
export interface Config {
|
|
18
|
-
fetcher?: typeof globalThis.fetch
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type Fn<Schema extends Record<string, any>> = <
|
|
22
|
-
Endpoint extends keyof Schema,
|
|
23
|
-
Method extends Uppercase<Extract<keyof Schema[Endpoint], string>>,
|
|
24
|
-
Route extends Schema[Endpoint][Lowercase<Method>]
|
|
25
|
-
>(
|
|
26
|
-
endpoint: Endpoint,
|
|
27
|
-
options: Omit<RequestInit, 'body' | 'method' | 'headers'> &
|
|
28
|
-
('GET' extends Method
|
|
29
|
-
? {
|
|
30
|
-
method?: Method
|
|
31
|
-
}
|
|
32
|
-
: {
|
|
33
|
-
method: Method
|
|
34
|
-
}) &
|
|
35
|
-
(IsNever<keyof Route['params']> extends true
|
|
36
|
-
? {
|
|
37
|
-
params?: Record<never, string>
|
|
38
|
-
}
|
|
39
|
-
: {
|
|
40
|
-
params: Route['params']
|
|
41
|
-
}) &
|
|
42
|
-
(IsNever<keyof Route['query']> extends true
|
|
43
|
-
? {
|
|
44
|
-
query?: Record<never, string>
|
|
45
|
-
}
|
|
46
|
-
: {
|
|
47
|
-
query: Route['query']
|
|
48
|
-
}) &
|
|
49
|
-
(undefined extends Route['headers']
|
|
50
|
-
? {
|
|
51
|
-
headers?: Record<string, string>
|
|
52
|
-
}
|
|
53
|
-
: {
|
|
54
|
-
headers: Route['headers']
|
|
55
|
-
}) &
|
|
56
|
-
(IsUnknown<Route['body']> extends false
|
|
57
|
-
? { body: Route['body'] }
|
|
58
|
-
: { body?: unknown })
|
|
59
|
-
) => Promise<
|
|
60
|
-
Prettify<
|
|
61
|
-
(
|
|
62
|
-
| {
|
|
63
|
-
data: Awaited<Route['response']['200']>
|
|
64
|
-
error: null
|
|
65
|
-
}
|
|
66
|
-
| {
|
|
67
|
-
data: null
|
|
68
|
-
error: MapError<Route['response']> extends infer Errors
|
|
69
|
-
? IsNever<Errors> extends true
|
|
70
|
-
? EdenFetchError<number, string>
|
|
71
|
-
: Errors
|
|
72
|
-
: EdenFetchError<number, string>
|
|
73
|
-
}
|
|
74
|
-
) & {
|
|
75
|
-
status: number
|
|
76
|
-
response: Response
|
|
77
|
-
headers: Record<string, string>
|
|
78
|
-
}
|
|
79
|
-
>
|
|
80
|
-
>
|
|
81
|
-
}
|