import { KoaContext, KoaMiddleware } from './types'; import { AuthResult, HttpErrorResponse } from '../common'; import { IncomingMessage, Server, ServerResponse } from 'node:http'; import { WebSocket } from 'ws'; import { Logger } from '@contember/logger'; import { ServerConfig } from '../config/config'; import { ProjectGroupResolver } from '../projectGroup/ProjectGroupResolver'; import { ProjectGroupContainer } from '../projectGroup/ProjectGroupContainer'; import { URL } from 'node:url'; export declare class Application { private readonly projectGroupResolver; private readonly serverConfig; private readonly debugMode; private readonly version; private readonly logger; private middlewares; private routes; private internalRoutes; private websocketRoutes; private suppressAccessLog; constructor(projectGroupResolver: ProjectGroupResolver, serverConfig: ServerConfig, debugMode: boolean, version: string | undefined, logger: Logger); addMiddleware(middleware: KoaMiddleware): void; addRoute(module: string, mask: string, controller: HttpController): void; addInternalRoute(module: string, mask: string, controller: InternalHttpController): void; addWebsocketRoute(module: string, mask: string, controller: WebSocketController): void; listen(): Promise; private handleWebsocketRequest; private handleHttpRequest; private handleInternalRequest; private sendHttpResponse; private sendRawHttpResponse; private createRequestLogger; private createTimer; private matchRequest; } export type Timer = (event: string, cb: () => T) => T; export type MatchedRequest = { params: Params; controller: C; module: string; }; export type BaseRequestContext = { logger: Logger; request: IncomingMessage; url: URL; params: Params; }; export type ApplicationContext = BaseRequestContext & { projectGroup: ProjectGroupContainer; authResult: AuthResult | null; timer: Timer; }; export type BaseHttpRequestContext = { koa: KoaContext<{}>; body: unknown; response: ServerResponse; }; export type HttpContext = ApplicationContext & BaseHttpRequestContext & { requestDebugMode: boolean; }; export type InternalHttpContext = BaseRequestContext & BaseHttpRequestContext; export type WebSocketContext = ApplicationContext & { ws: WebSocket; abortSignal: AbortSignal; }; export type HttpControllerResponse = Promise | HttpErrorResponse | undefined | void; export type HttpController = (context: HttpContext) => HttpControllerResponse; export type InternalHttpController = (context: InternalHttpContext) => HttpControllerResponse; export type WebSocketController = (context: WebSocketContext) => void; type Params = { [param: string]: string; }; export declare const LoggerRequestBody: unique symbol; export interface RunningApplication { close(): Promise; readonly server: Server; } export {}; //# sourceMappingURL=application.d.ts.map