import { ServiceIdentifier } from "inversify"; import { API } from "lambda-api"; import { EndpointInfo } from "../model/reflection/EndpointInfo"; import { LogFactory } from "../util/logging/LogFactory"; import { Controller } from "./Controller"; import { ErrorInterceptor } from "./error/ErrorInterceptor"; import { MiddlewareRegistry } from "./MiddlewareRegistry"; export type ControllerFactory = (constructor: Function) => Controller; export type ErrorInterceptorFactory = (type: ServiceIdentifier) => ErrorInterceptor; /** * Wrapper for endpoint method that proxies lamba-api requests. */ export declare class Endpoint { private readonly endpointInfo; private readonly controllerFactory; private readonly errorInteceptorFactory; private readonly middlewareRegistry; private readonly logFactory; private readonly logger; private readonly endpointSummary; /** * @param endpointInfo Endpoint to wrap. * @param controllerFactory Function used to build controllers, for use with InversifyJS. * @param errorInteceptorFactory Function used to build error interceptors, for use with InversifyJS. * @param middlewareRegistry Server middleware registry for authentication, authorisation and error interceptors. * @param logFactory Initialised log factory. */ constructor(endpointInfo: EndpointInfo, controllerFactory: ControllerFactory, errorInteceptorFactory: ErrorInterceptorFactory, middlewareRegistry: MiddlewareRegistry, logFactory: LogFactory); /** * Register this endpoint with a lambda-api instance. * * @param api Instance to register endpoint with. */ register(api: API): void; private log; private logError; private invoke; private authenticateAndAuthorizeRequest; private authenticateRequest; private sendStatusCodeResponse; private authorizeRequest; private responseSent; private buildControllerInstance; /** * If an endpoint is function only (has no controller bound to it), we * build a dynamic controller which simulates a controller instance. */ private buildDynamicControllerInstance; private setResponseContentType; private mapHttpMethodToCall; private invokeControllerMethod; private buildEndpointParameters; private getMatchingErrorInterceptor; }