elysia 2.0.0-beta.13 → 2.0.0-beta.14
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/dist/base.d.ts +20 -0
- package/dist/base.js +3 -0
- package/dist/base.mjs +3 -0
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/type/constants.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/base.d.ts
CHANGED
|
@@ -826,6 +826,26 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
826
826
|
options<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
827
827
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
828
828
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'options', Path, Schema, {}, Handle>;
|
|
829
|
+
/**
|
|
830
|
+
* ### query
|
|
831
|
+
* Register handler for path with method [OPTIONS]
|
|
832
|
+
*
|
|
833
|
+
* ---
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* import { Elysia, t } from 'elysia'
|
|
837
|
+
*
|
|
838
|
+
* new Elysia()
|
|
839
|
+
* .query('/', () => 'hi')
|
|
840
|
+
* .query('/hook', { query: t.Object({ name: t.String() }) }, () => 'hi')
|
|
841
|
+
* ```
|
|
842
|
+
*/
|
|
843
|
+
query<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string>, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<Input, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', undefined extends Input['params'] ? true : false>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
844
|
+
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
845
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Omit<Input, NonResolvableMacroKey>, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>)>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, MacroContext, Handle>;
|
|
846
|
+
query<const Path extends string, const Schema extends IntersectIfObjectSchema<MergeSchema<UnwrapRoute<{}, Definitions['typebox'], JoinPath<BasePath, Path>>, MergeSchema<Volatile['schema'], MergeSchema<Ephemeral['schema'], Metadata['schema']>>, '', true>, MergeScopedSchemas<Metadata['schemas'], Ephemeral['schemas'], Volatile['schemas']>>, const Decorator extends Singleton & {
|
|
847
|
+
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
848
|
+
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, {}, Handle>;
|
|
829
849
|
/**
|
|
830
850
|
* ### head
|
|
831
851
|
* Register handler for path with method [HEAD]
|
package/dist/base.js
CHANGED
|
@@ -1234,6 +1234,9 @@ var Elysia = class Elysia {
|
|
|
1234
1234
|
options(path, hookOrFn, fn) {
|
|
1235
1235
|
return this.#add("OPTIONS", path, hookOrFn, fn);
|
|
1236
1236
|
}
|
|
1237
|
+
query(path, hookOrFn, fn) {
|
|
1238
|
+
return this.#add("QUERY", path, hookOrFn, fn);
|
|
1239
|
+
}
|
|
1237
1240
|
head(path, hookOrFn, fn) {
|
|
1238
1241
|
return this.#add("HEAD", path, hookOrFn, fn);
|
|
1239
1242
|
}
|
package/dist/base.mjs
CHANGED
|
@@ -1231,6 +1231,9 @@ var Elysia = class Elysia {
|
|
|
1231
1231
|
options(path, hookOrFn, fn) {
|
|
1232
1232
|
return this.#add("OPTIONS", path, hookOrFn, fn);
|
|
1233
1233
|
}
|
|
1234
|
+
query(path, hookOrFn, fn) {
|
|
1235
|
+
return this.#add("QUERY", path, hookOrFn, fn);
|
|
1236
|
+
}
|
|
1234
1237
|
head(path, hookOrFn, fn) {
|
|
1235
1238
|
return this.#add("HEAD", path, hookOrFn, fn);
|
|
1236
1239
|
}
|
package/dist/package.js
CHANGED
package/dist/package.mjs
CHANGED
package/dist/type/constants.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ELYSIA_TYPES: {
|
|
|
17
17
|
readonly NoValidate: 15;
|
|
18
18
|
};
|
|
19
19
|
type ELYSIA_TYPES = typeof ELYSIA_TYPES;
|
|
20
|
-
declare const primitiveElysiaTypes: Set<
|
|
20
|
+
declare const primitiveElysiaTypes: Set<6 | 1 | 2 | 3 | 10 | 11 | 13 | 14>;
|
|
21
21
|
declare const noEnumerable: {
|
|
22
22
|
readonly enumerable: false;
|
|
23
23
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ type ElysiaFormData<T extends Record<keyof any, unknown>> = FormData & {
|
|
|
193
193
|
['~ely-form']: Replace<T, Blob | ElysiaFile, File> extends infer A ? { [key in keyof A]: IsTuple<A[key]> extends true ? A[key][number] extends Blob | ElysiaFile ? File[] : A[key] : A[key] } : T;
|
|
194
194
|
};
|
|
195
195
|
type ContentType = MaybeArray<'none' | 'text' | 'json' | 'formdata' | 'urlencoded' | 'arrayBuffer' | 'text/plain' | 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded' | 'application/octet-stream'>;
|
|
196
|
-
type HTTPMethod = (string & {}) | 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' | 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' | 'PROPFIND' | 'PROPPATCH' | 'PURGE' | 'PUT' | 'REBIND' | 'REPORT' | 'SEARCH' | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' | 'UNSUBSCRIBE' | 'ALL';
|
|
196
|
+
type HTTPMethod = (string & {}) | 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' | 'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' | 'PROPFIND' | 'PROPPATCH' | 'PURGE' | 'PUT' | 'QUERY' | 'REBIND' | 'REPORT' | 'SEARCH' | 'SOURCE' | 'SUBSCRIBE' | 'TRACE' | 'UNBIND' | 'UNLINK' | 'UNLOCK' | 'UNSUBSCRIBE' | 'ALL';
|
|
197
197
|
type UnwrapArray<T> = T extends (infer U)[] ? U : T;
|
|
198
198
|
type AppEvent = 'start' | 'stop' | 'request' | 'parse' | 'transform' | 'beforeHandle' | 'afterHandle' | 'mapResponse' | 'afterResponse' | 'error' | 'trace';
|
|
199
199
|
interface AppHook {
|
|
@@ -447,7 +447,7 @@ type InlineHandler<Route extends RouteSchema = {}, Singleton extends SingletonBa
|
|
|
447
447
|
}> = InlineHandlerNonMacro<Route & MacroContext, Singleton & {
|
|
448
448
|
derive: MacroContext['resolve'];
|
|
449
449
|
}>;
|
|
450
|
-
type InlineHandlerNonMacro<Route extends RouteSchema = {}, Singleton extends SingletonBase = DefaultSingleton> =
|
|
450
|
+
type InlineHandlerNonMacro<Route extends RouteSchema = {}, Singleton extends SingletonBase = DefaultSingleton> = (Route['response'] extends infer ResponseSchema ? {} extends ResponseSchema ? MaybePromise<InlineResponse> : MaybePromise<ResponseSchema[keyof ResponseSchema] | InlineHandlerResponse<ResponseSchema>> : never) | ((context: Context<Route, Singleton>) => MaybePromise<Response> | MaybePromise<{} extends Route['response'] ? unknown : (Route['response'] extends {
|
|
451
451
|
200: any;
|
|
452
452
|
} ? Route['response'][200] | ElysiaStatus<200, Route['response'][200], 200> | Generator<Route['response'][200]> | AsyncGenerator<Route['response'][200]> : unknown) | Route['response'][keyof Route['response']] | InlineHandlerResponse<Route['response']>>);
|
|
453
453
|
type Handler = (context: Context) => unknown;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyLocalHook, AppHook, ElysiaFormData, EventFn, EventScope, GuardSchemaType, InputSchema, Macro, MaybeArray, Prettify, SSEPayload } from "./types.js";
|
|
2
2
|
import { Context } from "./context.js";
|
|
3
3
|
import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
|
|
4
|
+
|
|
4
5
|
//#region src/utils.d.ts
|
|
5
6
|
type DeriveEntry = Function | readonly [Function, 'mapDerive'];
|
|
6
7
|
declare const nullObject: () => any;
|