elysia 0.7.0-beta.1 → 0.7.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/README.md +1 -5
- package/dist/bun/index.d.ts +5 -145
- package/dist/bun/index.js +58 -58
- package/dist/bun/index.js.map +10 -9
- package/dist/cjs/compose.js +5 -4
- package/dist/cjs/context.d.ts +0 -1
- package/dist/cjs/cookie.d.ts +1 -1
- package/dist/cjs/cookie.js +3 -2
- package/dist/cjs/dynamic-handle.d.ts +1 -1
- package/dist/cjs/dynamic-handle.js +47 -13
- package/dist/cjs/error.d.ts +10 -4
- package/dist/cjs/error.js +17 -8
- package/dist/cjs/index.d.ts +5 -145
- package/dist/cjs/index.js +8 -7
- package/dist/cjs/types.d.ts +6 -2
- package/dist/compose.js +47 -14
- package/dist/context.d.ts +0 -1
- package/dist/cookie.d.ts +1 -1
- package/dist/cookie.js +20 -1
- package/dist/custom-types.js +71 -1
- package/dist/dynamic-handle.d.ts +1 -1
- package/dist/dynamic-handle.js +15 -1
- package/dist/error.d.ts +10 -4
- package/dist/error.js +11 -2
- package/dist/handler.js +10 -1
- package/dist/index.d.ts +5 -145
- package/dist/index.js +487 -2
- package/dist/trace.js +5 -1
- package/dist/types.d.ts +6 -2
- package/dist/utils.js +21 -1
- package/dist/ws/index.js +2 -1
- package/package.json +2 -2
- package/trace/trace.json +23894 -8590
package/README.md
CHANGED
|
@@ -3,16 +3,12 @@
|
|
|
3
3
|
<img width=480 src=https://user-images.githubusercontent.com/35027979/205498891-b75dc404-3232-4929-b216-823aa7373b71.png alt='Elysia label' />
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
|
-
<p align=center>
|
|
6
|
+
<p align=center>Ergonomic Framework for Human</p>
|
|
7
7
|
|
|
8
8
|
<p align=center>
|
|
9
9
|
<a href=https://elysiajs.com>Documentation</a> | <a href=https://discord.gg/eaFJ2KDJck>Discord</a>
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
|
-
<h6 align=center>
|
|
13
|
-
Formerly known as <a href="https://github.com/saltyaom/kingworld">KingWorld</a>
|
|
14
|
-
</h6>
|
|
15
|
-
|
|
16
12
|
## Philosophies
|
|
17
13
|
Building on top of 3 philosophies:
|
|
18
14
|
|
package/dist/bun/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Serve, Server } from 'bun';
|
|
|
3
3
|
import type { Static, TSchema } from '@sinclair/typebox';
|
|
4
4
|
import type { Context } from './context';
|
|
5
5
|
import type { WS } from './ws/types';
|
|
6
|
-
import type { ElysiaConfig, DecoratorBase, DefinitionBase, RouteBase, Handler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, VoidHandler, PreHandler, BodyHandler, OptionalHandler, AfterHandler, ErrorHandler, LifeCycleStore, MaybePromise, Prettify, ListenCallback, AddPrefix, AddSuffix, AddPrefixCapitalize, AddSuffixCapitalize, TraceReporter, TraceHandler, MaybeArray
|
|
6
|
+
import type { ElysiaConfig, DecoratorBase, DefinitionBase, RouteBase, Handler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, VoidHandler, PreHandler, BodyHandler, OptionalHandler, AfterHandler, ErrorHandler, LifeCycleStore, MaybePromise, Prettify, ListenCallback, AddPrefix, AddSuffix, AddPrefixCapitalize, AddSuffixCapitalize, TraceReporter, TraceHandler, MaybeArray } from './types';
|
|
7
7
|
export default class Elysia<BasePath extends string = '', Decorators extends DecoratorBase = {
|
|
8
8
|
request: {};
|
|
9
9
|
store: {};
|
|
@@ -95,7 +95,7 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
95
95
|
}, Prettify<ParentSchema & PluginSchema>, Prettify<Routes & NewElysia['schema']>> : this;
|
|
96
96
|
guard<const LocalSchema extends InputSchema, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>>(hook: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], BasePath>): Elysia<BasePath, Decorators, Definitions, Route, Routes, Scoped>;
|
|
97
97
|
guard<const LocalSchema extends InputSchema<Extract<keyof Definitions['type'], string>>, const NewElysia extends Elysia<any, any, any, any, any, any>, const Schema extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>>(schema: LocalHook<LocalSchema, Schema, Decorators, Definitions['error']>, run: (group: Elysia<BasePath, Decorators, Definitions, Schema, {}, Scoped>) => NewElysia): NewElysia extends Elysia<any, infer PluginDecorators, infer PluginDefinitions, infer PluginSchema, any> ? Elysia<BasePath, PluginDecorators, PluginDefinitions, PluginSchema, Prettify<Routes & NewElysia['schema']>> : this;
|
|
98
|
-
use<NewElysia extends Elysia<any, any, any, any, any, any
|
|
98
|
+
use<NewElysia extends Elysia<any, any, any, any, any, any> = this>(plugin: MaybePromise<(app: NewElysia) => MaybePromise<NewElysia>>): NewElysia extends Elysia<any, infer PluginDecorators, infer PluginDefinitions, infer PluginSchema, any> ? Elysia<BasePath, {
|
|
99
99
|
request: Prettify<Decorators['request'] & PluginDecorators['request']>;
|
|
100
100
|
store: Prettify<Decorators['store'] & PluginDecorators['store']>;
|
|
101
101
|
}, {
|
|
@@ -143,19 +143,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
143
143
|
};
|
|
144
144
|
};
|
|
145
145
|
}>, Scoped>;
|
|
146
|
-
get<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
147
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
148
|
-
get: {
|
|
149
|
-
body: Route['body'];
|
|
150
|
-
params: Route['params'];
|
|
151
|
-
query: Route['query'];
|
|
152
|
-
headers: Route['headers'];
|
|
153
|
-
response: unknown extends Route['response'] ? {
|
|
154
|
-
200: ReturnType<Function>;
|
|
155
|
-
} : Route['response'];
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
}>, Scoped>;
|
|
159
146
|
post<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
160
147
|
[path in `${BasePath}${Path}`]: {
|
|
161
148
|
post: {
|
|
@@ -169,19 +156,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
169
156
|
};
|
|
170
157
|
};
|
|
171
158
|
}>, Scoped>;
|
|
172
|
-
post<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
173
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
174
|
-
post: {
|
|
175
|
-
body: Route['body'];
|
|
176
|
-
params: Route['params'];
|
|
177
|
-
query: Route['query'];
|
|
178
|
-
headers: Route['headers'];
|
|
179
|
-
response: unknown extends Route['response'] ? {
|
|
180
|
-
200: ReturnType<Function>;
|
|
181
|
-
} : Route['response'];
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
}>, Scoped>;
|
|
185
159
|
put<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
186
160
|
[path in `${BasePath}${Path}`]: {
|
|
187
161
|
put: {
|
|
@@ -195,19 +169,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
195
169
|
};
|
|
196
170
|
};
|
|
197
171
|
}>, Scoped>;
|
|
198
|
-
put<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
199
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
200
|
-
put: {
|
|
201
|
-
body: Route['body'];
|
|
202
|
-
params: Route['params'];
|
|
203
|
-
query: Route['query'];
|
|
204
|
-
headers: Route['headers'];
|
|
205
|
-
response: unknown extends Route['response'] ? {
|
|
206
|
-
200: ReturnType<Function>;
|
|
207
|
-
} : Route['response'];
|
|
208
|
-
};
|
|
209
|
-
};
|
|
210
|
-
}>, Scoped>;
|
|
211
172
|
patch<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
212
173
|
[path in `${BasePath}${Path}`]: {
|
|
213
174
|
patch: {
|
|
@@ -221,19 +182,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
221
182
|
};
|
|
222
183
|
};
|
|
223
184
|
}>, Scoped>;
|
|
224
|
-
patch<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
225
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
226
|
-
patch: {
|
|
227
|
-
body: Route['body'];
|
|
228
|
-
params: Route['params'];
|
|
229
|
-
query: Route['query'];
|
|
230
|
-
headers: Route['headers'];
|
|
231
|
-
response: unknown extends Route['response'] ? {
|
|
232
|
-
200: ReturnType<Function>;
|
|
233
|
-
} : Route['response'];
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
}>, Scoped>;
|
|
237
185
|
delete<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
238
186
|
[path in `${BasePath}${Path}`]: {
|
|
239
187
|
delete: {
|
|
@@ -247,19 +195,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
247
195
|
};
|
|
248
196
|
};
|
|
249
197
|
}>, Scoped>;
|
|
250
|
-
delete<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
251
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
252
|
-
delete: {
|
|
253
|
-
body: Route['body'];
|
|
254
|
-
params: Route['params'];
|
|
255
|
-
query: Route['query'];
|
|
256
|
-
headers: Route['headers'];
|
|
257
|
-
response: unknown extends Route['response'] ? {
|
|
258
|
-
200: ReturnType<Function>;
|
|
259
|
-
} : Route['response'];
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
}>, Scoped>;
|
|
263
198
|
options<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
264
199
|
[path in `${BasePath}${Path}`]: {
|
|
265
200
|
options: {
|
|
@@ -273,19 +208,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
273
208
|
};
|
|
274
209
|
};
|
|
275
210
|
}>, Scoped>;
|
|
276
|
-
options<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
277
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
278
|
-
options: {
|
|
279
|
-
body: Route['body'];
|
|
280
|
-
params: Route['params'];
|
|
281
|
-
query: Route['query'];
|
|
282
|
-
headers: Route['headers'];
|
|
283
|
-
response: unknown extends Route['response'] ? {
|
|
284
|
-
200: ReturnType<Function>;
|
|
285
|
-
} : Route['response'];
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
}>, Scoped>;
|
|
289
211
|
all<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
290
212
|
[path in `${BasePath}${Path}`]: {
|
|
291
213
|
[method in string]: {
|
|
@@ -299,19 +221,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
299
221
|
};
|
|
300
222
|
};
|
|
301
223
|
}>, Scoped>;
|
|
302
|
-
all<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
303
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
304
|
-
[method in string]: {
|
|
305
|
-
body: Route['body'];
|
|
306
|
-
params: Route['params'];
|
|
307
|
-
query: Route['query'];
|
|
308
|
-
headers: Route['headers'];
|
|
309
|
-
response: unknown extends Route['response'] ? {
|
|
310
|
-
200: ReturnType<Function>;
|
|
311
|
-
} : Route['response'];
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
|
-
}>, Scoped>;
|
|
315
224
|
head<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
316
225
|
[path in `${BasePath}${Path}`]: {
|
|
317
226
|
head: {
|
|
@@ -325,19 +234,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
325
234
|
};
|
|
326
235
|
};
|
|
327
236
|
}>, Scoped>;
|
|
328
|
-
head<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
329
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
330
|
-
head: {
|
|
331
|
-
body: Route['body'];
|
|
332
|
-
params: Route['params'];
|
|
333
|
-
query: Route['query'];
|
|
334
|
-
headers: Route['headers'];
|
|
335
|
-
response: unknown extends Route['response'] ? {
|
|
336
|
-
200: ReturnType<Function>;
|
|
337
|
-
} : Route['response'];
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
}>, Scoped>;
|
|
341
237
|
connect<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Path}`>>(path: Path, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
342
238
|
[path in `${BasePath}${Path}`]: {
|
|
343
239
|
connect: {
|
|
@@ -351,19 +247,6 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
351
247
|
};
|
|
352
248
|
};
|
|
353
249
|
}>, Scoped>;
|
|
354
|
-
connect<const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>>(path: Paths, handler: Function, hook?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
355
|
-
[path in `${BasePath}${Paths[number]}`]: {
|
|
356
|
-
connect: {
|
|
357
|
-
body: Route['body'];
|
|
358
|
-
params: Route['params'];
|
|
359
|
-
query: Route['query'];
|
|
360
|
-
headers: Route['headers'];
|
|
361
|
-
response: unknown extends Route['response'] ? {
|
|
362
|
-
200: ReturnType<Function>;
|
|
363
|
-
} : Route['response'];
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
}>, Scoped>;
|
|
367
250
|
ws<const Path extends string, const LocalSchema extends InputSchema<keyof Definitions['type'] & string>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>>(path: Path, options: WS.LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Path}`>): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
368
251
|
[path in `${BasePath}${Path}`]: {
|
|
369
252
|
subscribe: {
|
|
@@ -375,30 +258,7 @@ export default class Elysia<BasePath extends string = '', Decorators extends Dec
|
|
|
375
258
|
};
|
|
376
259
|
};
|
|
377
260
|
}>, Scoped>;
|
|
378
|
-
route<const Method extends HTTPMethod, const
|
|
379
|
-
config: {
|
|
380
|
-
allowMeta?: boolean;
|
|
381
|
-
};
|
|
382
|
-
}): Elysia<BasePath, Decorators, Definitions, ParentSchema, Prettify<Routes & {
|
|
383
|
-
[path in `${BasePath}${Path}`]: {
|
|
384
|
-
[method in string]: Route extends {
|
|
385
|
-
body: infer Body;
|
|
386
|
-
params: infer Params;
|
|
387
|
-
query: infer Query;
|
|
388
|
-
headers: infer Headers;
|
|
389
|
-
response: infer Response;
|
|
390
|
-
} ? {
|
|
391
|
-
body: Body;
|
|
392
|
-
params: Params;
|
|
393
|
-
query: Query;
|
|
394
|
-
headers: Headers;
|
|
395
|
-
response: unknown extends Response ? {
|
|
396
|
-
200: ReturnType<Function>;
|
|
397
|
-
} : Response;
|
|
398
|
-
} : never;
|
|
399
|
-
};
|
|
400
|
-
}>, Scoped>;
|
|
401
|
-
route<const Method extends HTTPMethod, const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<Extract<keyof Definitions['type'], string>>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>>(method: Method, path: Paths, handler: Function, options: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`> & {
|
|
261
|
+
route<const Method extends HTTPMethod, const Paths extends Readonly<string[]>, const LocalSchema extends InputSchema<Extract<keyof Definitions['type'], string>>, const Function extends Handler<Route, Decorators, `${BasePath}${Paths[number]}`>, const Route extends MergeSchema<UnwrapRoute<LocalSchema, Definitions['type']>, ParentSchema>>(method: Method, path: Paths, handler: Function, { config, ...hook }?: LocalHook<LocalSchema, Route, Decorators, Definitions['error'], `${BasePath}${Paths[number]}`> & {
|
|
402
262
|
config: {
|
|
403
263
|
allowMeta?: boolean;
|
|
404
264
|
};
|
|
@@ -513,6 +373,6 @@ export { mapResponse, mapCompactResponse, mapEarlyResponse } from './handler';
|
|
|
513
373
|
export { t } from './custom-types';
|
|
514
374
|
export { Cookie } from './cookie';
|
|
515
375
|
export { getSchemaValidator, mergeDeep, mergeHook, mergeObjectArray, getResponseSchemaValidator } from './utils';
|
|
516
|
-
export { ParseError, NotFoundError, ValidationError, InternalServerError } from './error';
|
|
376
|
+
export { ParseError, NotFoundError, ValidationError, InternalServerError, InvalidCookieSignature } from './error';
|
|
517
377
|
export type { Context, PreContext } from './context';
|
|
518
|
-
export type { ElysiaConfig, DecoratorBase, DefinitionBase, RouteBase, Handler, ComposedHandler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, SchemaValidator, VoidHandler, PreHandler, BodyHandler, OptionalHandler, ErrorHandler, LifeCycleStore, MaybePromise, ListenCallback, UnwrapSchema } from './types';
|
|
378
|
+
export type { ElysiaConfig, DecoratorBase, DefinitionBase, RouteBase, Handler, ComposedHandler, InputSchema, LocalHook, MergeSchema, RouteSchema, UnwrapRoute, InternalRoute, HTTPMethod, SchemaValidator, VoidHandler, PreHandler, BodyHandler, OptionalHandler, ErrorHandler, AfterHandler, TraceHandler, TraceStream, LifeCycleEvent, TraceEvent, LifeCycleStore, MaybePromise, ListenCallback, UnwrapSchema } from './types';
|