elysia 2.0.0-rc.0 → 2.0.0-rc.1
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 +22 -22
- package/dist/base.js +130 -61
- package/dist/base.mjs +130 -61
- package/dist/compile/aot-capture.js +1 -1
- package/dist/compile/aot-capture.mjs +1 -1
- package/dist/compile/handler/frozen-validator.js +1 -1
- package/dist/compile/handler/frozen-validator.mjs +1 -1
- package/dist/compile/handler/index.js +12 -5
- package/dist/compile/handler/index.mjs +13 -6
- package/dist/compile/handler/jit.js +23 -3
- package/dist/compile/handler/jit.mjs +23 -3
- package/dist/cookie/config.d.ts +1 -0
- package/dist/cookie/config.js +28 -5
- package/dist/cookie/config.mjs +25 -2
- package/dist/cookie/cookie.d.ts +1 -1
- package/dist/cookie/cookie.js +13 -2
- package/dist/cookie/cookie.mjs +13 -2
- package/dist/cookie/crypto.js +6 -6
- package/dist/cookie/crypto.mjs +1 -1
- package/dist/cookie/error.d.ts +1 -15
- package/dist/cookie/error.js +1 -24
- package/dist/cookie/error.mjs +1 -24
- package/dist/cookie/lib.js +5 -5
- package/dist/cookie/lib.mjs +1 -1
- package/dist/cookie/serialize.d.ts +3 -1
- package/dist/cookie/serialize.js +15 -6
- package/dist/cookie/serialize.mjs +15 -7
- package/dist/cookie/utils.js +8 -8
- package/dist/cookie/utils.mjs +6 -6
- package/dist/error.d.ts +17 -2
- package/dist/error.js +27 -1
- package/dist/error.mjs +27 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -2
- package/dist/index.mjs +1 -2
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/type/bridge-live.d.ts +2 -2
- package/dist/type/bridge-live.js +2 -1
- package/dist/type/bridge-live.mjs +2 -2
- package/dist/type/bridge.d.ts +4 -2
- package/dist/type/bridge.js +8 -0
- package/dist/type/bridge.mjs +3 -1
- package/dist/type/coerce-plan.d.ts +8 -1
- package/dist/type/coerce-plan.js +46 -1
- package/dist/type/coerce-plan.mjs +43 -3
- package/dist/type/coerce.d.ts +6 -2
- package/dist/type/coerce.js +33 -13
- package/dist/type/coerce.mjs +34 -14
- package/dist/type/compat.js +1 -0
- package/dist/type/compat.mjs +2 -1
- package/dist/type/constants.d.ts +2 -1
- package/dist/type/constants.js +2 -1
- package/dist/type/constants.mjs +2 -1
- package/dist/type/elysia/array.js +2 -13
- package/dist/type/elysia/array.mjs +2 -14
- package/dist/type/elysia/maybe-empty.d.ts +7 -4
- package/dist/type/elysia/maybe-empty.js +3 -2
- package/dist/type/elysia/maybe-empty.mjs +3 -2
- package/dist/type/elysia/numeric.d.ts +1 -1
- package/dist/type/elysia/numeric.js +20 -9
- package/dist/type/elysia/numeric.mjs +20 -9
- package/dist/type/elysia/object.js +2 -14
- package/dist/type/elysia/object.mjs +2 -15
- package/dist/type/elysia/optional.d.ts +6 -1
- package/dist/type/elysia/optional.js +2 -1
- package/dist/type/elysia/optional.mjs +1 -1
- package/dist/type/exports.d.ts +3 -3
- package/dist/type/exports.js +1 -1
- package/dist/type/exports.mjs +1 -1
- package/dist/type/index.js +1 -1
- package/dist/type/index.mjs +1 -1
- package/dist/type/typebox-value-live.d.ts +2 -2
- package/dist/type/typebox-value-live.js +2 -2
- package/dist/type/typebox-value-live.mjs +2 -2
- package/dist/type/typebox-value-ops.d.ts +2 -2
- package/dist/type/typebox-value-ops.js +2 -2
- package/dist/type/typebox-value-ops.mjs +2 -2
- package/dist/type/typebox-value.d.ts +6 -6
- package/dist/type/validator/index.js +39 -7
- package/dist/type/validator/index.mjs +40 -8
- package/dist/type/validator/validator-cache.js +2 -1
- package/dist/type/validator/validator-cache.mjs +2 -1
- package/dist/types.d.ts +207 -39
- package/dist/utils.d.ts +15 -8
- package/dist/utils.js +71 -24
- package/dist/utils.mjs +71 -25
- package/dist/validator/route.js +1 -1
- package/dist/validator/route.mjs +1 -1
- package/dist/ws/context.d.ts +9 -7
- package/dist/ws/context.js +14 -2
- package/dist/ws/context.mjs +12 -2
- package/dist/ws/route.js +19 -5
- package/dist/ws/route.mjs +20 -6
- package/dist/ws/types.d.ts +23 -13
- package/package.json +1 -1
package/dist/base.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Context, ErrorContext, LifecycleContext } from "./context.js";
|
|
|
5
5
|
import { TraceCapability, TraceHandler } from "./trace.js";
|
|
6
6
|
import { AnySchema } from "./type/types.js";
|
|
7
7
|
import { AotFingerprint, CompilerSession, ProgramId } from "./compile/aot.js";
|
|
8
|
-
import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CatchAllEntries, CatchAllHookReturn, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, DeriveResponse, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, ErrorHookStatus, EventScope, ExcludeElysiaResponse, GlobalHookReturn, GracefulHandler, GuardHookSingleton, GuardLocalHook, HTTPMethod, HistoryEntry, HookContextSchema, HookContextSingleton, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InternalRoute, IntersectIfObjectSchema, JoinPath, LegacyScope, LocalHook, LocalHookReturn, Macro, MacroCatchAll, MacroOptionContext, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, ObjectMacroDefs, OptionalHandler, ParentResponse, PluginHookReturn, PreHandler, Prettify, PublicRoute, ResolveUsedRouteErrors, RouteBase, ScopedHookReturn, ScopedMapDeriveReturn, SingletonBase, StaticMapAliases,
|
|
8
|
+
import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CatchAllEntries, CatchAllHookReturn, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, DeriveResponse, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, ErrorHookStatus, EventScope, ExcludeElysiaResponse, GlobalHookReturn, GracefulHandler, GuardHookSingleton, GuardLocalHook, HTTPMethod, HeadersKeyCheck, HistoryEntry, HookContextSchema, HookContextSingleton, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InstanceHookReturn, InternalRoute, IntersectIfObjectSchema, JoinPath, LegacyScope, LocalHook, LocalHookReturn, Macro, MacroCatchAll, MacroOptionContext, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, ObjectMacroDefs, OptionalHandler, ParentInput, ParentResponse, PluginHookReturn, PreHandler, PreValidationTransform, Prettify, PublicRoute, ResolveUsedRouteErrors, RouteBase, ScopedHookReturn, ScopedMapDeriveReturn, SingletonBase, StaticMapAliases, UnionResponseStatus, UnwrapRoute, UnwrapSchema, UsedRoutesUnder, WithErrorEntries, WithoutMacroCatch, WrapFn } from "./types.js";
|
|
9
9
|
import { RouteErrorHooks } from "./handler/utils.js";
|
|
10
10
|
import { WSCapability, WSHandlerResponse, WSLocalHook, WSMessageHandler, WSOptions, WSOptionsEntry } from "./ws/types.js";
|
|
11
11
|
import { RouteTable } from "./route-table.js";
|
|
@@ -260,13 +260,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
260
260
|
* ```
|
|
261
261
|
*/
|
|
262
262
|
onStart(handler: MaybeArray<GracefulHandler<this>>): this;
|
|
263
|
-
onTransform(fn: MaybeArray<
|
|
263
|
+
onTransform(fn: MaybeArray<PreValidationTransform<MergeSchema<{}, {}, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>): this;
|
|
264
264
|
/** @deprecated 1.x syntax, use `.onTransform('plugin', fn)`, `'scoped'` is now `'plugin'` */
|
|
265
265
|
onTransform<const As extends 'local' | 'scoped' | 'global'>(options: {
|
|
266
266
|
as: As;
|
|
267
|
-
}, fn: MaybeArray<
|
|
268
|
-
onTransform<const HookScope extends EventScope>(scope: HookScope, fn: MaybeArray<
|
|
269
|
-
onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile
|
|
267
|
+
}, fn: MaybeArray<PreValidationTransform<MergeSchema<{}, {}, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>>): this;
|
|
268
|
+
onTransform<const HookScope extends EventScope>(scope: HookScope, fn: MaybeArray<PreValidationTransform<MergeSchema<{}, {}, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>>): this;
|
|
269
|
+
onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, Scope>>>(fn: Handler): InstanceHookReturn<Scope, BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
270
270
|
onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
271
271
|
onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
272
272
|
onBeforeHandle<const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>>>(scope: 'global', fn: Handler): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
@@ -275,7 +275,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
275
275
|
as: As;
|
|
276
276
|
}, fn: Handler): ScopedHookReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
277
277
|
onBeforeHandle<const HookScope extends EventScope, const Handler extends MaybeArray<OptionalHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>>>(scope: HookScope, fn: Handler): ScopedHookReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
278
|
-
derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>):
|
|
278
|
+
derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(transform: (context: [Scope] extends ['local'] ? Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>> : LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, Scope>) => MaybePromise<Derivative>): InstanceHookReturn<Scope, BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
279
279
|
derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'local', transform: (context: Context<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>) => MaybePromise<Derivative>): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
280
280
|
derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'plugin', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>) => MaybePromise<Derivative>): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
281
281
|
derive<const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: 'global', transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>) => MaybePromise<Derivative>): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
@@ -322,7 +322,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
322
322
|
as: As;
|
|
323
323
|
}, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<LegacyScope<As>, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
324
324
|
mapDerive<const HookScope extends EventScope, const Derivative extends Record<string, unknown> | ElysiaStatus<any, any, any> | Error | void>(scope: HookScope, transform: (context: LifecycleContext<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>) => MaybePromise<Derivative>): ScopedMapDeriveReturn<HookScope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, DeriveResponse<Derivative>, ExcludeElysiaResponse<Derivative>>;
|
|
325
|
-
onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile
|
|
325
|
+
onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, Scope>>>(fn: Handler): InstanceHookReturn<Scope, BasePath, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
326
326
|
onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>>>>(scope: 'local', fn: Handler): LocalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
327
327
|
onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'plugin'>>>(scope: 'plugin', fn: Handler): PluginHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
328
328
|
onAfterHandle<const Handler extends MaybeArray<AfterHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, 'global'>>>(scope: 'global', fn: Handler): GlobalHookReturn<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, ElysiaHandlerToResponseSchemaAmbiguous<Handler>>;
|
|
@@ -343,7 +343,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
343
343
|
as: As;
|
|
344
344
|
}, fn: AfterResponseHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, LegacyScope<As>>): this;
|
|
345
345
|
onAfterResponse<const HookScope extends EventScope>(scope: HookScope, fn: AfterResponseHandler<HookContextSchema<Metadata, Ephemeral, Volatile, BasePath>, HookContextSingleton<Singleton, Ephemeral, Volatile>, undefined, HookScope>): this;
|
|
346
|
-
onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton>>>(fn: Handler): CatchAllHookReturn<
|
|
346
|
+
onError<const Handler extends MaybeArray<ErrorHandler<[...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], {}, Singleton>>>(fn: Handler): CatchAllHookReturn<Scope, BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Handler>;
|
|
347
347
|
onError<const E extends AnyErrorConstructor & (abstract new (...args: any) => Error), const Fn extends (context: ErrorContext<{}, Singleton & {
|
|
348
348
|
derive: Scope extends 'local' ? Partial<Ephemeral['derive'] & Volatile['derive']> : Scope extends 'plugin' ? Ephemeral['derive'] & Partial<Volatile['derive']> : Ephemeral['derive'] & Volatile['derive'];
|
|
349
349
|
}> & {
|
|
@@ -695,7 +695,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
695
695
|
}, {
|
|
696
696
|
typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
|
|
697
697
|
error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
|
|
698
|
-
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes &
|
|
698
|
+
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>> : Routes & UsedRoutesUnder<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
|
|
699
699
|
derive: Volatile['derive'] & NewElysia['~Ephemeral']['derive'];
|
|
700
700
|
schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
|
|
701
701
|
schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
|
|
@@ -725,7 +725,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
725
725
|
}, {
|
|
726
726
|
typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
|
|
727
727
|
error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
|
|
728
|
-
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes &
|
|
728
|
+
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>> : Routes & UsedRoutesUnder<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
|
|
729
729
|
derive: Volatile['derive'] & NewElysia['~Ephemeral']['derive'];
|
|
730
730
|
schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
|
|
731
731
|
schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
|
|
@@ -771,7 +771,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
771
771
|
}, {
|
|
772
772
|
typebox: Definitions['typebox'] & NewElysia['~Definitions']['typebox'];
|
|
773
773
|
error: [...Definitions['error'], ...NewElysia['~Definitions']['error']];
|
|
774
|
-
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>> : Routes &
|
|
774
|
+
}, MergeMetadata<Metadata, NewElysia['~Metadata']>, BasePath extends `` ? Routes & ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>> : Routes & UsedRoutesUnder<BasePath, ResolveUsedRouteErrors<NewElysia['~Routes'], [...Definitions['error'], ...Ephemeral['error'], ...Volatile['error']], ParentResponse<Metadata, Ephemeral, Volatile>, ParentInput<Metadata, Ephemeral, Volatile>>>, Ephemeral, {
|
|
775
775
|
derive: Volatile['derive'] & Partial<NewElysia['~Ephemeral']['derive']>;
|
|
776
776
|
schema: Volatile['schema'] & NewElysia['~Ephemeral']['schema'];
|
|
777
777
|
schemas: Volatile['schemas'] & NewElysia['~Ephemeral']['schemas'];
|
|
@@ -845,7 +845,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
845
845
|
*/
|
|
846
846
|
get<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
847
847
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
848
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
848
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'get', Path, Schema, MacroContext, Handle, Input>;
|
|
849
849
|
get<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 & {
|
|
850
850
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
851
851
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'get', Path, Schema, {}, Handle>;
|
|
@@ -865,7 +865,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
865
865
|
*/
|
|
866
866
|
post<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
867
867
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
868
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
868
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'post', Path, Schema, MacroContext, Handle, Input>;
|
|
869
869
|
post<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 & {
|
|
870
870
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
871
871
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'post', Path, Schema, {}, Handle>;
|
|
@@ -885,7 +885,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
885
885
|
*/
|
|
886
886
|
put<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
887
887
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
888
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
888
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'put', Path, Schema, MacroContext, Handle, Input>;
|
|
889
889
|
put<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 & {
|
|
890
890
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
891
891
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'put', Path, Schema, {}, Handle>;
|
|
@@ -905,7 +905,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
905
905
|
*/
|
|
906
906
|
patch<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
907
907
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
908
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
908
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'patch', Path, Schema, MacroContext, Handle, Input>;
|
|
909
909
|
patch<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 & {
|
|
910
910
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
911
911
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'patch', Path, Schema, {}, Handle>;
|
|
@@ -925,7 +925,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
925
925
|
*/
|
|
926
926
|
delete<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
927
927
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
928
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
928
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'delete', Path, Schema, MacroContext, Handle, Input>;
|
|
929
929
|
delete<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 & {
|
|
930
930
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
931
931
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'delete', Path, Schema, {}, Handle>;
|
|
@@ -945,7 +945,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
945
945
|
*/
|
|
946
946
|
options<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
947
947
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
948
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
948
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'options', Path, Schema, MacroContext, Handle, Input>;
|
|
949
949
|
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 & {
|
|
950
950
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
951
951
|
}, 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>;
|
|
@@ -965,7 +965,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
965
965
|
*/
|
|
966
966
|
query<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
967
967
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
968
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
968
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'query', Path, Schema, MacroContext, Handle, Input>;
|
|
969
969
|
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 & {
|
|
970
970
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
971
971
|
}, 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>;
|
|
@@ -985,7 +985,7 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
985
985
|
*/
|
|
986
986
|
head<const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
987
987
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
988
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
988
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, MacroContext, Handle, Input>;
|
|
989
989
|
head<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 & {
|
|
990
990
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
991
991
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, 'head', Path, Schema, {}, Handle>;
|
|
@@ -1004,13 +1004,13 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
|
|
|
1004
1004
|
*/
|
|
1005
1005
|
route<const Method extends HTTPMethod, const Path extends string, const Input extends Metadata['macro'] & InputSchema<keyof Definitions['typebox'] & string> & RouteHookCapture, 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 & {
|
|
1006
1006
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1007
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(method: Method, path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
1007
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(method: Method, path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Lowercase<Method>, Path, Schema, MacroContext, Handle, Input>;
|
|
1008
1008
|
route<const Method extends HTTPMethod, 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 & {
|
|
1009
1009
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1010
|
-
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(method: Method, path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Method
|
|
1010
|
+
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(method: Method, path: Path, fn: Handle & Metadata['macro']): AddRoute<BasePath, Scope, Singleton, Definitions, Metadata, Routes, Ephemeral, Volatile, Lowercase<Method>, Path, Schema, {}, Handle>;
|
|
1011
1011
|
all<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 & {
|
|
1012
1012
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1013
|
-
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey
|
|
1013
|
+
}, const MacroContext extends ({} extends Metadata['macroFn'] ? {} : MacroToContext<Metadata['macroFn'], Input, Definitions['typebox']>), const Handle extends ({} extends MacroContext ? InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>> : InlineHandler<NoInfer<Schema>, NoInfer<Decorator>, MacroContext>), UnknownKey extends PropertyKey = Exclude<keyof Input, HookObjectKey | keyof Metadata['macro']>>(path: Path, hook: LocalHook<Input, Schema & MacroContext, Decorator, Definitions['error'], keyof Metadata['parser']> & MacroOptionContext<Metadata['macroFn'], Schema, Decorator> & UnknownHookKey<UnknownKey> & NoInfer<HeadersKeyCheck<Input, UnwrapSchema<Input['headers'], Definitions['typebox']>>>, fn: Handle): this;
|
|
1014
1014
|
all<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 & {
|
|
1015
1015
|
derive: Ephemeral['derive'] & Volatile['derive'];
|
|
1016
1016
|
}, const Handle extends InlineHandlerNonMacro<NoInfer<Schema>, NoInfer<Decorator>>>(path: Path, fn: Handle & Metadata['macro']): this;
|
package/dist/base.js
CHANGED
|
@@ -18,12 +18,34 @@ memoirist = require_runtime.__toESM(memoirist);
|
|
|
18
18
|
|
|
19
19
|
//#region src/base.ts
|
|
20
20
|
const useNodesBuffer = [];
|
|
21
|
-
const
|
|
22
|
-
const
|
|
21
|
+
const chainKeys = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
const keyCounters = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
const requestOrigins = /* @__PURE__ */ new WeakMap();
|
|
23
24
|
const hocOriginOf = (o) => typeof o === "object" ? o.origin : o;
|
|
24
25
|
const emptyHistory = Object.freeze([]);
|
|
25
26
|
let mutationEpoch = 0;
|
|
26
27
|
const extCallbackIndexes = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
const warnedVariants = /* @__PURE__ */ new Set();
|
|
29
|
+
const hookSource = (added) => {
|
|
30
|
+
let source = "";
|
|
31
|
+
for (const key in added) for (const v of [].concat(added[key])) source += key + (typeof v === "function" ? v : typeof v);
|
|
32
|
+
return source;
|
|
33
|
+
};
|
|
34
|
+
const warnVariant = (origin, a, b) => {
|
|
35
|
+
if (warnedVariants.has(origin) || hookSource(a.added) === hookSource(b.added)) return;
|
|
36
|
+
warnedVariants.add(origin);
|
|
37
|
+
console.warn("[Elysia] same-name plugin variants register different hooks, one is skipped: give each variant its own seed");
|
|
38
|
+
};
|
|
39
|
+
const hasHook = (v) => v != null && (!Array.isArray(v) || v.length > 0);
|
|
40
|
+
const hollow = (added) => {
|
|
41
|
+
for (const key in added) if (key !== "schema" && hasHook(added[key])) return false;
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
const assignTable = (target, source, append) => {
|
|
45
|
+
if (!target || !append) return Object.assign(target ?? require_utils.nullObject(), source);
|
|
46
|
+
for (const key in source) if (!(key in target)) target[key] = source[key];
|
|
47
|
+
return target;
|
|
48
|
+
};
|
|
27
49
|
const mergeExtCallbacks = (target, incoming) => {
|
|
28
50
|
if (!target) return incoming.slice();
|
|
29
51
|
let index = extCallbackIndexes.get(target);
|
|
@@ -296,10 +318,12 @@ var Elysia = class Elysia {
|
|
|
296
318
|
this.#pushChainNode(added, scope);
|
|
297
319
|
return this;
|
|
298
320
|
}
|
|
299
|
-
#pushChainNode(added, scope, registration, origin, owner) {
|
|
321
|
+
#pushChainNode(added, scope, registration, origin, owner, key, dup) {
|
|
300
322
|
const parent = this["~hookChain"];
|
|
301
323
|
const refs = parent !== void 0 && parent.refs || Elysia.#hookHasString(added);
|
|
302
|
-
|
|
324
|
+
if (!registration && (scope === "plugin" || scope === "global") && !hollow(added)) key = this.#nameRegistration();
|
|
325
|
+
if (parent?.dup) dup = true;
|
|
326
|
+
const node = registration ? {
|
|
303
327
|
added,
|
|
304
328
|
parent,
|
|
305
329
|
refs,
|
|
@@ -307,15 +331,46 @@ var Elysia = class Elysia {
|
|
|
307
331
|
propagated: true,
|
|
308
332
|
owner,
|
|
309
333
|
origin,
|
|
310
|
-
registration
|
|
334
|
+
registration,
|
|
335
|
+
key
|
|
311
336
|
} : {
|
|
312
337
|
added,
|
|
313
338
|
parent,
|
|
314
339
|
refs,
|
|
315
340
|
scope,
|
|
316
341
|
owner: this["~scopeChild"] ? this : void 0,
|
|
317
|
-
origin: this.hash
|
|
342
|
+
origin: this.hash,
|
|
343
|
+
key
|
|
318
344
|
};
|
|
345
|
+
if (dup || !registration && key !== void 0 && this.#holdKey(key, node)) node.dup = true;
|
|
346
|
+
this["~hookChain"] = node;
|
|
347
|
+
}
|
|
348
|
+
#holdKey(key, registration) {
|
|
349
|
+
const keys = chainKeys.get(this);
|
|
350
|
+
if (!keys) return;
|
|
351
|
+
if (keys.has(key)) return true;
|
|
352
|
+
keys.set(key, registration);
|
|
353
|
+
}
|
|
354
|
+
#keysOf() {
|
|
355
|
+
let keys = chainKeys.get(this);
|
|
356
|
+
if (keys) return keys;
|
|
357
|
+
chainKeys.set(this, keys = /* @__PURE__ */ new Map());
|
|
358
|
+
const held = [];
|
|
359
|
+
for (let n = this["~hookChain"]; n; n = n.parent) if (n.key !== void 0 && !(n.registration && n.owner)) held.push(n);
|
|
360
|
+
for (let i = held.length - 1; i >= 0; i--) {
|
|
361
|
+
const n = held[i];
|
|
362
|
+
if (!keys.has(n.key)) keys.set(n.key, n.registration ?? n);
|
|
363
|
+
}
|
|
364
|
+
return keys;
|
|
365
|
+
}
|
|
366
|
+
#nameRegistration() {
|
|
367
|
+
if (this.hash === void 0) return;
|
|
368
|
+
let counter = keyCounters.get(this);
|
|
369
|
+
if (!counter) keyCounters.set(this, counter = {
|
|
370
|
+
p: this.hash.toString(36) + ":",
|
|
371
|
+
n: 0
|
|
372
|
+
});
|
|
373
|
+
return [counter.p, counter.n++].join("");
|
|
319
374
|
}
|
|
320
375
|
#onBranch(type, scopeOrFn, fn) {
|
|
321
376
|
return fn ? this.#on(type, fn, scopeOrFn) : this.#on(type, scopeOrFn);
|
|
@@ -397,15 +452,22 @@ var Elysia = class Elysia {
|
|
|
397
452
|
return this;
|
|
398
453
|
}
|
|
399
454
|
#as(node, scope) {
|
|
455
|
+
const tail = node;
|
|
456
|
+
let collided = false;
|
|
400
457
|
while (node) {
|
|
401
458
|
node = node;
|
|
402
459
|
if (node.scope !== "global" && (node.scope !== scope || node.propagated)) {
|
|
403
460
|
node.scope = scope;
|
|
404
461
|
node.propagated = false;
|
|
462
|
+
if (node.key === void 0 && !hollow(node.added)) {
|
|
463
|
+
node.key = this.#nameRegistration();
|
|
464
|
+
if (node.key !== void 0 && this.#holdKey(node.key, node.registration ?? node)) collided = true;
|
|
465
|
+
}
|
|
405
466
|
require_utils.invalidateMacroEpoch();
|
|
406
467
|
}
|
|
407
468
|
node = node.parent;
|
|
408
469
|
}
|
|
470
|
+
if (collided) for (let n = tail; n; n = n.parent) n.dup = true;
|
|
409
471
|
}
|
|
410
472
|
guard() {
|
|
411
473
|
const maybeHook = typeof arguments[0] === "string" ? arguments[1] : arguments[0];
|
|
@@ -656,35 +718,42 @@ var Elysia = class Elysia {
|
|
|
656
718
|
}
|
|
657
719
|
#use(app) {
|
|
658
720
|
let addedByThisCall;
|
|
721
|
+
let below = false;
|
|
659
722
|
const name = app["~config"]?.name;
|
|
660
723
|
if (name) {
|
|
661
724
|
const hash = app.hash;
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
725
|
+
const installed = this.childrenHash?.get(hash);
|
|
726
|
+
if (installed) return;
|
|
727
|
+
if (installed === false) below = true;
|
|
728
|
+
else {
|
|
729
|
+
(this.childrenHash ??= /* @__PURE__ */ new Map()).set(hash, true);
|
|
730
|
+
(addedByThisCall ??= /* @__PURE__ */ new Set()).add(hash);
|
|
731
|
+
}
|
|
666
732
|
}
|
|
667
733
|
if (app.childrenHash && !app["~scopeChild"]) addedByThisCall = this.#absorbChildrenHash(app, addedByThisCall);
|
|
668
734
|
if (app["~ext"]) this.#assertMacroUnique(app, addedByThisCall);
|
|
735
|
+
if (below) this.childrenHash.set(app.hash, true);
|
|
669
736
|
if (app["~hasTrace"]) this["~hasTrace"] = true;
|
|
670
|
-
if (
|
|
671
|
-
|
|
672
|
-
if (app
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
737
|
+
if (!below) {
|
|
738
|
+
if (app.declaredRoutes === void 0 && app["~routeTable"]?.length) app.#materializeDeclaredRoutes();
|
|
739
|
+
if (app.declaredRoutes?.length) {
|
|
740
|
+
if (app["~hasWS"]) this["~hasWS"] = true;
|
|
741
|
+
this.#emitChildRoutes(app, this["~hookChain"], name);
|
|
742
|
+
}
|
|
743
|
+
if (app["~scopeChildren"]) {
|
|
744
|
+
const children = this["~scopeChildren"] ??= [];
|
|
745
|
+
for (const child of app["~scopeChildren"]) children.push(child);
|
|
746
|
+
}
|
|
678
747
|
}
|
|
679
748
|
const hookChain = app["~hookChain"];
|
|
680
|
-
if (app["~ext"]) this.#absorbExt(app, addedByThisCall);
|
|
681
|
-
if (hookChain) this.#propagateHooks(app, hookChain
|
|
749
|
+
if (app["~ext"]) this.#absorbExt(app, addedByThisCall, below);
|
|
750
|
+
if (hookChain) this.#propagateHooks(app, hookChain);
|
|
682
751
|
}
|
|
683
752
|
#absorbChildrenHash(app, addedByThisCall) {
|
|
684
|
-
const childrenHash = this.childrenHash ??= /* @__PURE__ */ new
|
|
685
|
-
for (const h of app.childrenHash) {
|
|
753
|
+
const childrenHash = this.childrenHash ??= /* @__PURE__ */ new Map();
|
|
754
|
+
for (const h of app.childrenHash.keys()) {
|
|
686
755
|
if (childrenHash.has(h)) continue;
|
|
687
|
-
childrenHash.
|
|
756
|
+
childrenHash.set(h, false);
|
|
688
757
|
(addedByThisCall ??= /* @__PURE__ */ new Set()).add(h);
|
|
689
758
|
}
|
|
690
759
|
return addedByThisCall;
|
|
@@ -703,7 +772,7 @@ var Elysia = class Elysia {
|
|
|
703
772
|
throw new Error(`[Elysia] Macro "${macroName}" can be only define once`);
|
|
704
773
|
}
|
|
705
774
|
}
|
|
706
|
-
#absorbExt(app, addedByThisCall) {
|
|
775
|
+
#absorbExt(app, addedByThisCall, append) {
|
|
707
776
|
const source = app["~ext"];
|
|
708
777
|
const { decorator, store, headers, models, parser, macro, hoc, setup, cleanup, capability } = source;
|
|
709
778
|
const ext = this["~ext"] ??= require_utils.nullObject();
|
|
@@ -711,17 +780,17 @@ var Elysia = class Elysia {
|
|
|
711
780
|
for (const field of sharedTables) if (source[field]) ext[field] ??= source[field];
|
|
712
781
|
}
|
|
713
782
|
if (decorator && decorator !== ext.decorator) {
|
|
714
|
-
if (ext.decorator) require_utils.mergeDeep(ext.decorator, decorator, void 0,
|
|
783
|
+
if (ext.decorator) require_utils.mergeDeep(ext.decorator, decorator, void 0, !append, false, void 0, { map: void 0 });
|
|
715
784
|
else ext.decorator = require_utils.clonePlainDecorators(decorator);
|
|
716
785
|
markStoredSingletons(ext.decorator, decorator);
|
|
717
786
|
}
|
|
718
|
-
if (store && store !== ext.store) if (ext.store) require_utils.mergeDeep(ext.store, store);
|
|
787
|
+
if (store && store !== ext.store) if (ext.store) require_utils.mergeDeep(ext.store, store, void 0, !append);
|
|
719
788
|
else ext.store = Object.assign(require_utils.nullObject(), store);
|
|
720
|
-
if (headers && headers !== ext.headers) ext.headers =
|
|
721
|
-
if (models && models !== ext.models) ext.models =
|
|
722
|
-
if (parser && parser !== ext.parser) ext.parser =
|
|
723
|
-
if (macro) if (app["~scopeChild"]) {
|
|
724
|
-
const pluginMacros = app.pluginMacros;
|
|
789
|
+
if (headers && headers !== ext.headers) ext.headers = assignTable(ext.headers, headers, append);
|
|
790
|
+
if (models && models !== ext.models) ext.models = assignTable(ext.models, models, append);
|
|
791
|
+
if (parser && parser !== ext.parser) ext.parser = assignTable(ext.parser, parser, append);
|
|
792
|
+
if (macro) if (app["~scopeChild"] || append) {
|
|
793
|
+
const pluginMacros = append ? new Map(Object.entries(macro)) : app.pluginMacros;
|
|
725
794
|
let changed = false;
|
|
726
795
|
if (pluginMacros?.size) {
|
|
727
796
|
const target = this.#ensureMacroTable();
|
|
@@ -780,7 +849,7 @@ var Elysia = class Elysia {
|
|
|
780
849
|
}
|
|
781
850
|
}
|
|
782
851
|
}
|
|
783
|
-
#propagateHooks(app, hookChain
|
|
852
|
+
#propagateHooks(app, hookChain) {
|
|
784
853
|
const nodes = useNodesBuffer;
|
|
785
854
|
nodes.length = 0;
|
|
786
855
|
let current = hookChain;
|
|
@@ -788,11 +857,12 @@ var Elysia = class Elysia {
|
|
|
788
857
|
nodes.push(current);
|
|
789
858
|
current = current.parent;
|
|
790
859
|
}
|
|
791
|
-
const childrenHash = this.childrenHash;
|
|
792
860
|
const scopeChild = app["~scopeChild"];
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
let
|
|
861
|
+
const requests = requestOrigins.get(this);
|
|
862
|
+
let installing;
|
|
863
|
+
let keys = chainKeys.get(this);
|
|
864
|
+
let admitted;
|
|
865
|
+
let admittedMore;
|
|
796
866
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
797
867
|
const node = nodes[i];
|
|
798
868
|
const scope = node.scope;
|
|
@@ -804,40 +874,39 @@ var Elysia = class Elysia {
|
|
|
804
874
|
source = require_utils.nullObject();
|
|
805
875
|
source.request = request;
|
|
806
876
|
}
|
|
877
|
+
if ((node.key === void 0 || scopeChild) && hollow(source)) continue;
|
|
807
878
|
const origin = node.origin ?? app.hash;
|
|
808
|
-
const registration = node.registration ?? node;
|
|
809
879
|
let added = source;
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
added = require_utils.nullObject();
|
|
826
|
-
for (const key in source) if (key !== "~deriveEntries" && !require_utils.eventProperties.has(key)) added[key] = source[key];
|
|
827
|
-
}
|
|
880
|
+
const registration = node.registration ?? node;
|
|
881
|
+
let key = node.key;
|
|
882
|
+
let dup;
|
|
883
|
+
const held = key === void 0 ? void 0 : (keys ??= this.#keysOf()).get(key);
|
|
884
|
+
if (held) {
|
|
885
|
+
if (held !== registration && !require_universal_is_production.isProduction()) warnVariant(origin, held, registration);
|
|
886
|
+
if (scopeChild || held !== registration || origin !== admitted && !admittedMore?.has(origin)) {
|
|
887
|
+
const schemas = source.schemas;
|
|
888
|
+
if (!schemas) continue;
|
|
889
|
+
added = require_utils.nullObject();
|
|
890
|
+
added.schemas = schemas;
|
|
891
|
+
key = void 0;
|
|
892
|
+
} else dup = true;
|
|
893
|
+
} else if (key !== void 0 && origin !== admitted) if (admitted === void 0) admitted = origin;
|
|
894
|
+
else (admittedMore ??= /* @__PURE__ */ new Set()).add(origin);
|
|
828
895
|
let dropRequest = false;
|
|
829
|
-
if (origin !== void 0 &&
|
|
830
|
-
|
|
831
|
-
else if (scopeChild) (lifting ??= new Set(lifted)).add(origin);
|
|
832
|
-
}
|
|
896
|
+
if (origin !== void 0 && hasHook(added.request)) if (requests?.has(origin) && !installing?.has(origin)) dropRequest = true;
|
|
897
|
+
else (installing ??= /* @__PURE__ */ new Set()).add(origin);
|
|
833
898
|
if ("schema" in added || dropRequest) {
|
|
834
899
|
if (added === source) added = Object.assign(require_utils.nullObject(), source);
|
|
835
900
|
delete added.schema;
|
|
836
901
|
if (dropRequest) delete added.request;
|
|
837
902
|
}
|
|
838
|
-
if (
|
|
903
|
+
if (added !== source && hollow(added)) continue;
|
|
904
|
+
if (key === void 0 && !held) key = this.#nameRegistration();
|
|
905
|
+
if (key !== void 0 && !dup && !scopeChild) (keys ??= this.#keysOf()).set(key, registration);
|
|
906
|
+
this.#pushChainNode(added, scope, registration, origin, scopeChild ? app : void 0, key, dup);
|
|
839
907
|
}
|
|
840
|
-
if (
|
|
908
|
+
if (installing) if (requests) for (const origin of installing) requests.add(origin);
|
|
909
|
+
else requestOrigins.set(this, installing);
|
|
841
910
|
nodes.length = 0;
|
|
842
911
|
}
|
|
843
912
|
#emitChildRoutes(app, preChain, name) {
|