// Generated by dts-bundle-generator v9.5.1 import { NextFunction as ExpressNextFunction, Request as ExpressRequest, Response as ExpressResponse } from 'express'; import { WebSocket as WS } from 'ws'; export declare abstract class HttpHandler { protected abstract route: string | null; protected abstract action: (...any: any[]) => any; protected context: any; constructor(context: Record); setContext(context: Record): HttpHandler; getContext(): Record; getRoute(): string | null; getAction(): (...any: any[]) => any; } export declare enum HttpMethod { GET = 0, POST = 1 } export declare abstract class Middleware extends HttpHandler { protected abstract order: number; protected abstract action: (...any: any[]) => any; getOrder(): number; } interface Request$1 extends ExpressRequest { } interface Response$1 extends ExpressResponse { } export declare abstract class Route extends HttpHandler { protected abstract method: HttpMethod; protected abstract action: (req: Request$1, res: Response$1) => any; protected get documentation(): string; getMethod(): HttpMethod; getDocumentation(): string; } export declare enum StatusCodes { CONTINUE = 100, SWITCHING_PROTOCOLS = 101, OK = 200, CREATED = 201, ACCEPTED = 202, NON_AUTHORITATIVE_INFORMATION = 203, NO_CONTENT = 204, RESET_CONTENT = 205, PARTIAL_CONTENT = 206, MULTIPLE_CHOICES = 300, MOVED_PERMANENTLY = 301, MOVED_TEMPORARILY = 302, SEE_OTHER = 303, NOT_MODIFIED = 304, USE_PROXY = 305, TEMPORARY_REDIRECT = 307, BAD_REQUEST = 400, UNAUTHORIZED = 401, PAYMENT_REQUIRED = 402, FORBIDDEN = 403, NOT_FOUND = 404, METHOD_NOT_ALLOWED = 405, NOT_ACCEPTABLE = 406, PROXY_AUTHENTICATION_REQUIRED = 407, REQUEST_TIMEOUT = 408, CONFLICT = 409, GONE = 410, LENGTH_REQUIRED = 411, PRECONDITION_FAILED = 412, REQUEST_ENTITY_TOO_LARGE = 413, REQUEST_URI_TOO_LONG = 414, UNSUPPORTED_MEDIA_TYPE = 415, REQUESTED_RANGE_NOT_SATISFIABLE = 416, EXPECTATION_FAILED = 417, INTERNAL_SERVER_ERROR = 500, NOT_IMPLEMENTED = 501, BAD_GATEWAY = 502, SERVICE_UNAVAILABLE = 503, GATEWAY_TIMEOUT = 504, HTTP_VERSION_NOT_SUPPORTED = 505 } export interface NextFunction extends ExpressNextFunction { } export declare class Logger { private getTime; private log; info(message: string): void; error(message: string): void; warn(message: string): void; } export type Message = { type: string; text: string; }; export declare abstract class WebSocketHandler { static Event: { CONNECTION: string; MESSAGE: string; CLOSE: string; ERROR: string; }; abstract onConnect: (ws: WS) => any; abstract onMessage: (message: string) => any; abstract onError: () => any; abstract onClose: (code?: number, reason?: string) => any; } export type ServerProperties = { port: number; host?: string; middlewaresPath?: string; sessions?: boolean; routesPath?: string; json?: boolean; urlencoded?: boolean; locale?: string; i18nPath?: string; viewEngine?: string; viewsPath?: string; swagger?: { docsPath?: string; title?: string; version?: string; route?: string; description?: string; components?: object; security?: object; }; wsHandlers?: { [url: string]: WebSocketHandler; }; options?: { [key: string]: any; }; }; declare abstract class Registry { private static httpHandlers; private server; protected abstract registerRoutes(): Promise; protected abstract registerMiddlewares(): Promise; registerHttpHandlers(): Promise; protected registerHttpHandler(handler: HttpHandler): Registry; setServer(server: Server): Registry; getServer(): Server | null; static getHttpHandlers(): HttpHandler[]; } /** @sealed */ export declare class Server { private instance; private httpServer; private readonly port; private readonly host; private readonly logger; private i18n; private readonly wsHandlers; private readonly wsServers; private initialized; private readonly i18nPath?; private readonly middlewaresPath?; private readonly routesPath?; private readonly viewEngine?; private readonly viewsPath?; private readonly options?; private readonly swaggerComponents?; private readonly swaggerSecurity?; private readonly swaggerDocsPath?; private readonly swaggerTitle?; private readonly swaggerDescription?; private readonly swaggerApiVersion?; private readonly swaggerRoute?; static registry: Registry; private readonly systemRegistry; constructor(properties: ServerProperties); private init; private postInit; private processHttpHandlers; addMiddleware(middleware: Middleware): Server; addRoute(route: Route): Server; private registerRoutesDocumentation; registerWsServers(): Server; applyWsHandlers(): Server; getWsConnections(url: string): Set | null; logInfo(message: string): void; logError(message: string): void; logWarn(message: string): void; log(message: Message): void; private get; private post; getLogger(): Logger; i18nLoad(path: string): Server; getHost(): string; getOption(key: string): any; start(callback?: () => any): Promise; } export declare class IncorrectMethodException extends Error { constructor(); } export declare class InvalidMiddlewareException extends Error { constructor(file: string); } export declare class InvalidRouteException extends Error { constructor(file: string); } export declare class RouteNotSetException extends Error { constructor(); } export declare class ServerNotInitializedException extends Error { constructor(); } export declare class Guid { static new(): string; } export type i18nMap = { [key: string]: { [key: string]: string; }; }; export type KeyParams = { [key: string]: any; }; export declare class i18nLoader { private static instance; private readonly map; private locale; static defaultLocale: string; constructor(locale: string); static getInstance(locale?: string): i18nLoader; setLocale(locale: string): i18nLoader; load(...paths: string[]): i18nLoader; loadJson(obj: i18nMap): i18nLoader; get(key: string): string; } export declare const $: (key: string, params?: KeyParams) => string; export declare enum SwaggerParameterIn { PATH = "path", QUERY = "query", HEADER = "header", COOKIE = "cookie", BODY = "body", REQUEST_BODY = "requestBody" } export type SwaggerSchema = { type: string; description?: string; example?: string; items?: SwaggerSchema[]; properties?: { [name: string]: SwaggerSchema; }; }; export type SwaggerParameter = { in: SwaggerParameterIn; name: string; required: boolean; description: string; schema?: SwaggerSchema; }; export type SwaggerRequestBodyContent = { mediaType: string; schema: SwaggerSchema; }; export type SwaggerRequestBody = { required: boolean; description: string; content: SwaggerRequestBodyContent; }; export type SwaggerResponseContent = { mediaType: string; schema: SwaggerSchema; }; export type SwaggerResponse = { code: number; description: string; content?: SwaggerResponseContent; }; export declare class SwaggerDoc { private method; private route?; private summary?; private description?; private requestBody?; private parameters; private responses; private security; static get(route: string): SwaggerDoc; static post(route: string): SwaggerDoc; private constructor(); private setRoute; setSummary(summary: string): SwaggerDoc; setDescription(description: string): SwaggerDoc; setRequestBody(requestBody: SwaggerRequestBody): SwaggerDoc; addParameter(param: SwaggerParameter): SwaggerDoc; addResponse(res: SwaggerResponse): SwaggerDoc; addSecurityScheme(scheme: string): SwaggerDoc; toAnnotation(): string; private getMethod; private deserializeSchema; private repeatStr; } export { Request$1 as Request, Response$1 as Response, }; export {};