import { FileList } from '../../common/file'; import { Session } from '../../sessions'; interface Readable { [name: string]: any; } interface IncomingMessage extends Readable { aborted: boolean; complete: boolean; headers: any; httpVersion: string; method?: string; rawHeaders: string[]; rawTrailers: string[]; socket: any; statusCode?: number; statusMessage?: number; trailers: any; url?: string; destroy(err?: any): void; setTimeout(msecs: number, callback: Function): this; } /** * Express Request interface. * * @export * @interface Request */ export interface Request extends IncomingMessage { app: any; baseUrl: string; body: any; cookies: any; fresh: boolean; hostname: string; ip: string; ips: string[]; method: string; originalUrl: string; params: any; path: string; procotol: 'http' | 'https'; query: any; route: any; secure: boolean; signedCookies: any; stale: boolean; subdomains: string[]; xhr: boolean; url: string; id: string; accepts(): string[]; accepts(types: string | string[]): string | false; accepts(...types: string[]): string | false; acceptsCharsets(): string[]; acceptsCharsets(charset: string | string[]): string | false; acceptsCharsets(...charset: string[]): string | false; acceptsEncodings(): string[]; acceptsEncodings(encoding: string | string[]): string | false; acceptsEncodings(...encoding: string[]): string | false; acceptsLanguages(): string[]; acceptsLanguages(lang: string | string[]): string | false; acceptsLanguages(...lang: string[]): string | false; get(field: 'set-cookie'): string[] | undefined; get(field: string): string | undefined; header(field: 'set-cookie'): string[] | undefined; header(field: string): string | undefined; is(type: string | string[]): string | false | null; /** * @deprecated */ param(name: string, defaultValue?: any): any; range(size: number, options?: { combine?: boolean; }): -1 | -2 | any[] | undefined; } /** * Class instantiated on each request. It includes: * - the express request object, * - the user object if available, * - the session object if available, * - a file list object, * - the name of the controller and the name of the method, * - and a `state` object that can be used to pass data across several hooks. * * @export * @class Context * @template User */ export declare class Context { readonly request: Request; session: Session | null; user: User; readonly state: ContextState; readonly files: FileList; readonly controllerName: string; readonly controllerMethodName: string; /** * Creates an instance of Context. * @param {*} request - Either the express request object or a mock (for testing). * @param {string} [controllerName=''] - The name of the controller. * @param {string} [controllerMethodName=''] - The name of the method. * @memberof Context */ constructor(request: any, controllerName?: string, controllerMethodName?: string); } export {};