import { API } from "lambda-api"; import { Container } from "inversify"; import { LambdaApiRequest } from "../model/ApiRequest"; import { ApiResponse } from "../model/ApiResponse"; import { AppConfig } from "../model/AppConfig"; import { MiddlewareRegistry } from "./MiddlewareRegistry"; /** * Server that discovers routes using decorators on controller * classes and methods. Processing of requests is preformed by the * `lambda-api` package. */ export declare class Server { private appContainer; private autoInjectionEnabled; private appConfig; private readonly logFactory; private readonly logger; private readonly api; private readonly _middlewareRegistry; private readonly openApiGenerator?; get middlewareRegistry(): MiddlewareRegistry; /** * Create a new server. * * @param appContainer Application container to use to build containers. * @param autoInjectionEnabled Is autobind flag enabled on IOC container. * @param appConfig Application config to pass to `lambda-api`. */ constructor(appContainer: Container, autoInjectionEnabled: boolean, appConfig: AppConfig); /** * Configure the `API` instance from the `lambda-api` * package. * * @param handler Function that takes an `API` instance as a parameter. */ configure(handler: (this: void, api: API) => void): void; /** * Scans the specified path for javascript files and loads these into * the current runtime. Importing the files will invoke the decorators * declared within them. Note: this scans only the top level files. * * API decorators register controllers, endpoints, configuration and middleware. * A series of endpoints are built using the decorator components and registered * with the `lambda-api` package routing engine. * * Controllers and error interceptors registered by decorators are built using * an IOC container, which allows dependency injection. * * OpenAPI endpoints will be registered here, if they are enabled in the app * config by setting the `openApi.enabled` flag to true. * * This method must be called before invoking the `processEvent` method. * * @param controllersPath (Optional) Paths to the directories that contain controller `js` files. * Dynamic loading of `injectable` controllers is disabled if undefined * or the app `Container` instance has its `autobind` * flag disabled. */ discoverAndBuildRoutes(controllersPath?: string[]): Promise; private registerOpenApiEndpoints; private registerOpenApiEndpoint; private registerEndpoint; /** * Takes an API request passed in by AWS Lambda and processes * it using the `lambda-api` package. * * @param request API Gateway or ALB request. * @param context Request context. * @returns The response. */ processEvent(request: LambdaApiRequest, context: any): Promise; }