@elysiajs/eden 0.5.0 → 0.5.2
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/package.json +10 -6
- package/src/treaty/types.ts +96 -41
- package/dist/fetch.d.ts +0 -1
- package/dist/fn.d.ts +0 -1
- package/dist/treaty.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elysiajs/eden",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Fully type-safe Elysia client",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "saltyAom",
|
|
@@ -13,25 +13,29 @@
|
|
|
13
13
|
"require": "./dist/index.js",
|
|
14
14
|
"import": "./dist/index.mjs",
|
|
15
15
|
"node": "./dist/index.js",
|
|
16
|
-
"default": "./dist/index.js"
|
|
16
|
+
"default": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
17
18
|
},
|
|
18
19
|
"./treaty": {
|
|
19
20
|
"require": "./dist/treaty.js",
|
|
20
21
|
"import": "./dist/treaty.mjs",
|
|
21
22
|
"node": "./dist/treaty.js",
|
|
22
|
-
"default": "./dist/treaty.js"
|
|
23
|
+
"default": "./dist/treaty.js",
|
|
24
|
+
"types": "./dist/treaty/index.d.ts"
|
|
23
25
|
},
|
|
24
26
|
"./fetch": {
|
|
25
27
|
"require": "./dist/fetch.js",
|
|
26
28
|
"import": "./dist/fetch.mjs",
|
|
27
29
|
"node": "./dist/fetch.js",
|
|
28
|
-
"default": "./dist/fetch.js"
|
|
30
|
+
"default": "./dist/fetch.js",
|
|
31
|
+
"types": "./dist/fetch/index.d.ts"
|
|
29
32
|
},
|
|
30
33
|
"./fn": {
|
|
31
34
|
"require": "./dist/fn.js",
|
|
32
35
|
"import": "./dist/fn.mjs",
|
|
33
36
|
"node": "./dist/fn.js",
|
|
34
|
-
"default": "./dist/fn.js"
|
|
37
|
+
"default": "./dist/fn.js",
|
|
38
|
+
"types": "./dist/fn/index.d.ts"
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
"types": "./src/index.ts",
|
|
@@ -50,7 +54,7 @@
|
|
|
50
54
|
"scripts": {
|
|
51
55
|
"dev": "bun run --hot example/index.ts",
|
|
52
56
|
"test": "bun wiptest",
|
|
53
|
-
"build": "vite build",
|
|
57
|
+
"build": "vite build && tsc",
|
|
54
58
|
"release": "npm run build && npm run test && npm publish --access public"
|
|
55
59
|
},
|
|
56
60
|
"peerDependencies": {
|
package/src/treaty/types.ts
CHANGED
|
@@ -42,31 +42,57 @@ export namespace EdenTreaty {
|
|
|
42
42
|
$query: Route['query']
|
|
43
43
|
}) => EdenWS<Route>
|
|
44
44
|
: IsUnknown<Route['body']> extends true
|
|
45
|
-
?
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
?
|
|
45
|
+
? undefined extends Route['query']
|
|
46
|
+
? (params?: {
|
|
47
|
+
$query?: Record<string, string>
|
|
48
|
+
$fetch?: RequestInit
|
|
49
|
+
}) => Promise<
|
|
50
|
+
| {
|
|
51
|
+
data: Route['response']['200']
|
|
52
|
+
error: null
|
|
53
|
+
}
|
|
54
|
+
| {
|
|
55
|
+
data: null
|
|
56
|
+
error: MapError<
|
|
57
|
+
Route['response']
|
|
58
|
+
> extends infer Errors
|
|
59
|
+
? IsNever<Errors> extends true
|
|
60
|
+
? EdenFetchError<
|
|
61
|
+
number,
|
|
62
|
+
string
|
|
63
|
+
>
|
|
64
|
+
: Errors
|
|
65
|
+
: EdenFetchError<
|
|
60
66
|
number,
|
|
61
67
|
string
|
|
62
68
|
>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
}
|
|
70
|
+
>
|
|
71
|
+
: (params: {
|
|
72
|
+
$query: Route['query']
|
|
73
|
+
$fetch?: RequestInit
|
|
74
|
+
}) => Promise<
|
|
75
|
+
| {
|
|
76
|
+
data: Route['response']['200']
|
|
77
|
+
error: null
|
|
78
|
+
}
|
|
79
|
+
| {
|
|
80
|
+
data: null
|
|
81
|
+
error: MapError<
|
|
82
|
+
Route['response']
|
|
83
|
+
> extends infer Errors
|
|
84
|
+
? IsNever<Errors> extends true
|
|
85
|
+
? EdenFetchError<
|
|
86
|
+
number,
|
|
87
|
+
string
|
|
88
|
+
>
|
|
89
|
+
: Errors
|
|
90
|
+
: EdenFetchError<
|
|
91
|
+
number,
|
|
92
|
+
string
|
|
93
|
+
>
|
|
94
|
+
}
|
|
95
|
+
>
|
|
70
96
|
: (
|
|
71
97
|
params: Replace<
|
|
72
98
|
Route['body'],
|
|
@@ -116,28 +142,57 @@ export namespace EdenTreaty {
|
|
|
116
142
|
$query: Route['query']
|
|
117
143
|
}) => EdenWS<Route>
|
|
118
144
|
: IsUnknown<Route['body']> extends true
|
|
119
|
-
?
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
?
|
|
145
|
+
? undefined extends Route['query']
|
|
146
|
+
? (params?: {
|
|
147
|
+
$query?: Record<string, string>
|
|
148
|
+
$fetch?: RequestInit
|
|
149
|
+
}) => Promise<
|
|
150
|
+
| {
|
|
151
|
+
data: Route['response']['200']
|
|
152
|
+
error: null
|
|
153
|
+
}
|
|
154
|
+
| {
|
|
155
|
+
data: null
|
|
156
|
+
error: MapError<
|
|
157
|
+
Route['response']
|
|
158
|
+
> extends infer Errors
|
|
159
|
+
? IsNever<Errors> extends true
|
|
160
|
+
? EdenFetchError<
|
|
161
|
+
number,
|
|
162
|
+
string
|
|
163
|
+
>
|
|
164
|
+
: Errors
|
|
165
|
+
: EdenFetchError<
|
|
134
166
|
number,
|
|
135
167
|
string
|
|
136
168
|
>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
169
|
+
}
|
|
170
|
+
>
|
|
171
|
+
: (params: {
|
|
172
|
+
$query: Route['query']
|
|
173
|
+
$fetch?: RequestInit
|
|
174
|
+
}) => Promise<
|
|
175
|
+
| {
|
|
176
|
+
data: Route['response']['200']
|
|
177
|
+
error: null
|
|
178
|
+
}
|
|
179
|
+
| {
|
|
180
|
+
data: null
|
|
181
|
+
error: MapError<
|
|
182
|
+
Route['response']
|
|
183
|
+
> extends infer Errors
|
|
184
|
+
? IsNever<Errors> extends true
|
|
185
|
+
? EdenFetchError<
|
|
186
|
+
number,
|
|
187
|
+
string
|
|
188
|
+
>
|
|
189
|
+
: Errors
|
|
190
|
+
: EdenFetchError<
|
|
191
|
+
number,
|
|
192
|
+
string
|
|
193
|
+
>
|
|
194
|
+
}
|
|
195
|
+
>
|
|
141
196
|
: (
|
|
142
197
|
params: Replace<
|
|
143
198
|
Route['body'],
|
package/dist/fetch.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './fetch/index'
|
package/dist/fn.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './fn/index'
|
package/dist/treaty.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './treaty/index'
|