/// /// /// import { BindingKey, Context } from '@loopback/core'; import { InvokeMiddleware } from '@loopback/express'; import { HttpProtocol } from '@loopback/http-server'; import { OpenApiSpec, OperationObject } from '@loopback/openapi-v3'; import https from 'https'; import { ErrorWriterOptions } from 'strong-error-handler'; import { BodyParser, RequestBodyParser } from './body-parsers'; import { HttpHandler } from './http-handler'; import { RestServer, RestServerConfig } from './rest.server'; import { ResolvedRoute, RestRouter, RestRouterOptions } from './router'; import { SequenceHandler } from './sequence'; import { AjvFactory, FindRoute, InvokeMethod, LogError, OperationArgs, ParseParams, Reject, Request, RequestBodyParserOptions, Response, Send } from './types'; /** * RestServer-specific bindings */ export declare namespace RestBindings { /** * Binding key for setting and injecting RestComponentConfig */ const CONFIG: BindingKey; /** * Binding key for setting and injecting the host name of RestServer */ const HOST: BindingKey; /** * Binding key for setting and injecting the port number of RestServer */ const PORT: BindingKey; /** * Binding key for setting and injecting the socket path of the RestServer */ const PATH: BindingKey; /** * Binding key for setting and injecting the URL of RestServer */ const URL: BindingKey; /** * Binding key for setting and injecting the protocol of RestServer */ const PROTOCOL: BindingKey; /** * Binding key for HTTPS options */ const HTTPS_OPTIONS: BindingKey>; /** * Binding key for the server itself */ const SERVER: BindingKey; /** * Internal binding key for basePath */ const BASE_PATH: BindingKey; /** * Internal binding key for http-handler */ const HANDLER: BindingKey; /** * Internal binding key for rest router */ const ROUTER: BindingKey; const ROUTER_OPTIONS: BindingKey; /** * Binding key for setting and injecting Reject action's error handling * options. * * See https://github.com/loopbackio/strong-error-handler#options for * the list of available options. Please note that the flag `log` is not used * by `@loopback/rest`. */ const ERROR_WRITER_OPTIONS: BindingKey; /** * Binding key for request body parser options */ const REQUEST_BODY_PARSER_OPTIONS: BindingKey; /** * Binding key for request body parser */ const REQUEST_BODY_PARSER: BindingKey; /** * Binding key for request json body parser */ const REQUEST_BODY_PARSER_JSON: BindingKey; /** * Binding key for request urlencoded body parser */ const REQUEST_BODY_PARSER_URLENCODED: BindingKey; /** * Binding key for request text body parser */ const REQUEST_BODY_PARSER_TEXT: BindingKey; /** * Binding key for request raw body parser */ const REQUEST_BODY_PARSER_RAW: BindingKey; /** * Binding key for request raw body parser */ const REQUEST_BODY_PARSER_STREAM: BindingKey; /** * Binding key for AJV */ const AJV_FACTORY: BindingKey; /** * Binding key for setting and injecting an OpenAPI spec */ const API_SPEC: BindingKey; /** * Binding key for setting and injecting an OpenAPI operation spec */ const OPERATION_SPEC_CURRENT: BindingKey; /** * Binding key for setting and injecting a Sequence */ const SEQUENCE: BindingKey; /** * Binding key for setting and injecting a `invokeMiddleware` function for * middleware based sequence */ const INVOKE_MIDDLEWARE_SERVICE: BindingKey; /** * Bindings for potential actions that could be used in a sequence */ namespace SequenceActions { /** * Binding key for setting and injecting `invokeMiddleware` function */ const INVOKE_MIDDLEWARE: BindingKey; /** * Binding key for setting and injecting a route finding function */ const FIND_ROUTE: BindingKey; /** * Binding key for setting and injecting a parameter parsing function */ const PARSE_PARAMS: BindingKey; /** * Binding key for setting and injecting a controller route invoking function */ const INVOKE_METHOD: BindingKey; /** * Binding key for setting and injecting an error logging function */ const LOG_ERROR: BindingKey; /** * Binding key for setting and injecting a response writing function */ const SEND: BindingKey; /** * Binding key for setting and injecting a bad response writing function */ const REJECT: BindingKey; } namespace Operation { const ROUTE: BindingKey; const PARAMS: BindingKey; const RETURN_VALUE: BindingKey; } /** * Request-specific bindings */ namespace Http { /** * Binding key for setting and injecting the http request */ const REQUEST: BindingKey; /** * Binding key for setting and injecting the http response */ const RESPONSE: BindingKey>>; /** * Binding key for setting and injecting the http request context */ const CONTEXT: BindingKey; } /** * Namespace for REST routes */ const ROUTES = "routes"; } /** * Binding tags for RestServer */ export declare namespace RestTags { /** * Binding tag to identify REST routes */ const REST_ROUTE = "restRoute"; /** * Binding tag for the REST route verb */ const ROUTE_VERB = "restRouteVerb"; /** * Binding tag for the REST route path */ const ROUTE_PATH = "restRoutePath"; /** * Binding tag to identify controller based REST routes */ const CONTROLLER_ROUTE = "controllerRoute"; /** * Binding tag for controller route bindings to represent the controller * binding key */ const CONTROLLER_BINDING = "controllerBinding"; const AJV_KEYWORD = "ajvKeyword"; const AJV_FORMAT = "ajvFormat"; const REST_MIDDLEWARE_CHAIN = "middlewareChain.default"; /** * Legacy middleware chain for action-based REST sequence */ const ACTION_MIDDLEWARE_CHAIN = "middlewareChain.rest.actions"; }