import { Annotation } from 'reflect-annotations'; import type { RouterContext } from '../router.js'; export type Func = (...args: any[]) => T; export declare const kInjectAnnotation: unique symbol; /** * @public */ export declare class RouteAnnotation { path: string; methods: string[]; ignoreParentPrefix: boolean; ignoreAllPrefix: boolean; constructor(path?: string, ...methods: Array); get isRouteAnnotation(): true; resolvePath(prefix: string, suffix?: RouteAnnotation): string; } /** * @public */ export interface PathFactoryAnnotation { (urlDefinition?: string, ...methods: Array): Annotation; } export interface ParamAnnotationFactory { (keyname?: string): Annotation; } /** * @public */ export interface ParamAnnotationBase { extractValue(context: RouterContext, type?: any): any; } export declare class InjectParamAnnotation implements ParamAnnotationBase { [kInjectAnnotation]: boolean; transient: boolean; token: any; constructor(token?: { transient: boolean; } | any, options?: { transient: boolean; }); extractValue(context: RouterContext, type: any): unknown; } /** * @public */ export declare class BodyParamAnnotation implements ParamAnnotationBase { private keyName?; constructor(keyName?: string | undefined); extractValue(context: RouterContext): any; } /** * @public */ export declare class PathParamAnnotation implements ParamAnnotationBase { private keyName?; constructor(keyName?: string | undefined); extractValue(context: RouterContext): any; } /** * @public */ export declare class QueryParamAnnotation implements ParamAnnotationBase { private searchParam; constructor(searchParam: string); extractValue(context: RouterContext): any; } /** * @public */ export declare class HeaderParamAnnotation implements ParamAnnotationBase { private paramName; constructor(paramName: string); extractValue(context: RouterContext): any; } /** * @public */ export declare class UpgradeRouteAnnotation extends RouteAnnotation { isBodyParser: boolean; middleware(context: RouterContext, next: Func>): any; constructor(path?: string); } declare const /** * @public */ Header: (paramName: string) => Annotation, /** * @public */ Upgrade: (path?: string | undefined) => Annotation, /** * @public */ Body: (keyName?: string | undefined) => Annotation, /** * @public */ Param: (keyName?: string | undefined) => Annotation, /** * @public */ Query: (searchParam: string) => Annotation, /** * @public */ Inject: (token?: any, options?: { transient: boolean; } | undefined) => Annotation; /** * @public */ export interface Route extends PathFactoryAnnotation { /** * Accept the HTTP GET Method */ Get: PathFactoryAnnotation; /** * Accept the HTTP POST Method */ Post: PathFactoryAnnotation; /** * Accept the HTTP PUT Method */ Put: PathFactoryAnnotation; /** * Accept the HTTP DELETE Method */ Delete: PathFactoryAnnotation; /** * Accept the HTTP HEAD Method */ Head: PathFactoryAnnotation; /** * Accept the HTTP PATCH Method */ Patch: PathFactoryAnnotation; /** * Extract the body, or body property to the decorated argument */ Body: ParamAnnotationFactory; /** * Extract the path parameters, or specific parameter to the decorated argument */ Param: ParamAnnotationFactory; /** * Extract the query parameters, or specific query parameter to the decorated argument */ Query: ParamAnnotationFactory; /** * Inject a provided item */ Inject: (...args: ConstructorParameters) => Annotation; /** * Extract the specific header to the decorated argument */ Header: typeof Header; /** * Accept HTTP UPGRADE Requests */ Upgrade: typeof Upgrade; } /** * @public */ export declare const Route: Route; export { Annotation, /** * @public */ Upgrade, /** * @public */ Header, /** * @public */ Query, /** * @public */ Param, /** * @public */ Body, /** * @public */ Inject, };