yasui
Version:
Lightweight Express-based framework for REST and web APIs
730 lines (701 loc) • 28.3 kB
TypeScript
import * as http from 'http';
import { Server } from 'http';
import { RequestHandler, Request as Request$1, Application } from 'express';
export { Application, NextFunction, RequestHandler, Response } from 'express';
import kleur from 'kleur';
/** List of valid HTTP codes */
declare enum HttpCode {
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
OK = 200,
CREATED = 201,
ACCEPTED = 202,
NON_AUTHORITATIVE_INFORMATION = 203,
NO_CONTENT = 204,
RESET_CONTENT = 205,
PARTIAL_CONTENT = 206,
MULTI_STATUS = 207,
ALREADY_REPORTED = 208,
IM_USED = 226,
MULTIPLE_CHOICES = 300,
MOVED_PERMANENTLY = 301,
FOUND = 302,
SEE_OTHER = 303,
NOT_MODIFIED = 304,
USE_PROXY = 305,
SWITCH_PROXY = 306,
TEMPORARY_REDIRECT = 307,
PERMANENT_REDIRECT = 308,
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,
IM_A_TEAPOT = 418,
MISDIRECTED_REQUEST = 421,
UNPROCESSABLE_ENTITY = 422,
UPGRADE_REQUIRED = 426,
PRECONDITION_REQUIRED = 428,
LOCKED = 423,
FAILED_DEPENDENCY = 424,
TOO_MANY_REQUESTS = 429,
REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
UNAVAILABLE_FOR_LEGAL_REASONS = 451,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
GATEWAY_TIMEOUT = 504,
HTTP_VERSION_NOT_SUPPORTED = 505,
VARIANT_ALSO_NEGOTIATES = 506,
INSUFFICIENT_STORAGE = 507,
LOOP_DETECTED = 508,
NOT_EXTENDED = 510,
NETWORK_AUTHENTICATION_REQUIRED = 511
}
/** Retrieve the official message corresponding to an HTTP error code */
declare const HttpCodeMap: Record<number, string>;
/** Express route params */
declare enum RouteParamTypes {
REQ = "req",
RES = "res",
NEXT = "next"
}
/** Express Request object params */
declare enum RouteRequestParamTypes {
HEADER = "headers",
PARAM = "params",
QUERY = "query",
BODY = "body",
LOGGER = "logger"
}
/** HTTP verbs, lowercase, internal use */
declare enum RouteMethods {
GET = "get",
POST = "post",
PUT = "put",
DELETE = "delete",
PATCH = "patch"
}
/** Scopes for dependency injections - See `@Scope` */
declare enum Scopes {
LOCAL = "local",
DEEP_LOCAL = "deepLocal",
SHARED = "shared"
}
/** Utility type for an instantiable class */
type Constructible<T = Instance> = {
new (...args: any[]): T;
};
/** Generic type for a class instance */
type Instance = {
[index: string]: any;
};
/** Define a custom injection for the Yasui configuration - See `@Inject` and `@Injectable` */
type Injection<T = any> = {
token: string;
provide: T;
};
/** Middleware type */
type TMiddleware = Constructible<IMiddleware> | RequestHandler;
/** Middleware interface */
interface IMiddleware extends Instance {
use: (...args: any[]) => any;
}
/** Decorated middleware interface */
interface IDMiddleware extends IMiddleware {
run: (self: this) => RequestHandler;
}
/** Controller type */
type TController = Constructible<IController>;
/** Controller instance type */
type IController = Instance;
/** Route metadata for controller methods */
interface IControllerRoute {
method: RouteMethods;
path: string;
middlewares: TMiddleware[];
descriptor: PropertyDescriptor;
methodName: string;
defaultStatus?: HttpCode;
params: IRouteParam[];
}
/** Constructible type for array element validation */
type ArrayItem = Constructible<number | boolean | Date | string>;
/** Parameter metadata for route handlers */
interface IRouteParam {
index: number;
type: Function;
itemsType?: ArrayItem;
path: string[];
}
/** Metadata for route handler parameters */
interface IParamMetadata {
/** Source of the parameter (body, query, param, headers etc) */
readonly type: RouteRequestParamTypes;
/** Property name in the request source object */
readonly name?: string;
/** Underlying type of the parameter, based on the type definition in the route handler */
readonly metatype?: Function;
}
/** Pipe-transform interface */
interface IPipeTransform extends Instance {
/**
* @param value - Raw parameter value from request
* @param metadata - Parameter metadata (type, source, property name)
* @returns Transformed/validated value
*/
transform: (value: any, metadata: IParamMetadata) => Promise<any> | any;
}
/** OpenAPI 3.0 simplified schema with generic typing */
/** Base schema properties shared by all OpenAPI schema types */
interface BaseSchema<T = any> {
description?: string;
example?: T;
default?: T;
/** Allows null values in addition to the defined type */
nullable?: boolean;
/** Property is only returned in responses, never accepted in requests */
readOnly?: boolean;
/** Property is only accepted in requests, never returned in responses */
writeOnly?: boolean;
deprecated?: boolean;
}
/** OpenAPI schema for string values with validation constraints */
interface StringSchema extends BaseSchema<string> {
type: 'string';
/** Validates string format (e.g., 'email' enforces email pattern) */
format?: 'date' | 'date-time' | 'email' | 'uri' | 'uuid' | 'binary' | 'byte' | 'password';
/** Regular expression pattern for validation */
pattern?: string;
/** Restricts value to one of the specified strings */
enum?: string[];
minLength?: number;
maxLength?: number;
}
/** OpenAPI schema for floating-point numbers */
interface NumberSchema extends BaseSchema<number> {
type: 'number';
/** Precision hint for serialization */
format?: 'float' | 'double';
minimum?: number;
maximum?: number;
/** If true, value must be > minimum (not >= minimum) */
exclusiveMinimum?: boolean;
/** If true, value must be < maximum (not <= maximum) */
exclusiveMaximum?: boolean;
/** Value must be a multiple of this number */
multipleOf?: number;
enum?: number[];
}
/** OpenAPI schema for integer values */
interface IntegerSchema extends BaseSchema<number> {
type: 'integer';
/** Bit width constraint for serialization */
format?: 'int32' | 'int64';
minimum?: number;
maximum?: number;
/** If true, value must be > minimum (not >= minimum) */
exclusiveMinimum?: boolean;
/** If true, value must be < maximum (not <= maximum) */
exclusiveMaximum?: boolean;
/** Value must be a multiple of this number */
multipleOf?: number;
enum?: number[];
}
/** OpenAPI schema for boolean values */
interface BooleanSchema extends BaseSchema<boolean> {
type: 'boolean';
}
/** OpenAPI schema for object types with property validation */
interface ObjectSchema<T = Record<string, any>> extends BaseSchema<T> {
type: 'object';
/** Schema definitions for each object property */
properties?: Record<string, OpenAPISchema>;
/** Array of property names that must be present */
required?: string[];
/** If false, extra properties are forbidden; if schema, validates extra properties */
additionalProperties?: boolean | OpenAPISchema;
minProperties?: number;
maxProperties?: number;
}
/** OpenAPI schema for array types with element validation */
interface ArraySchema<T = any[]> extends BaseSchema<T> {
type: 'array';
/** Schema for validating each array element */
items: OpenAPISchema;
minItems?: number;
maxItems?: number;
/** If true, all array elements must be unique */
uniqueItems?: boolean;
}
/** Reference to another schema definition */
interface RefSchema {
/** Reference path to another schema (e.g., "#/components/schemas/User") */
$ref: string;
}
/** Union of all possible OpenAPI schema types */
type OpenAPISchema = StringSchema | NumberSchema | IntegerSchema | BooleanSchema | ObjectSchema | ArraySchema | RefSchema;
/** API metadata and documentation information */
interface OpenAPIInfo {
title: string;
version: string;
description?: string;
termsOfService?: string;
contact?: {
name?: string;
url?: string;
email?: string;
};
license?: {
name: string;
url?: string;
};
}
/** Server configuration for API endpoints */
interface OpenAPIServer {
url: string;
description?: string;
variables?: Record<string, {
enum?: string[];
default: string;
description?: string;
}>;
}
/** Available HTTP operations for a specific path */
interface OpenAPIPathItem {
get?: OpenAPIOperation;
post?: OpenAPIOperation;
put?: OpenAPIOperation;
delete?: OpenAPIOperation;
options?: OpenAPIOperation;
head?: OpenAPIOperation;
patch?: OpenAPIOperation;
trace?: OpenAPIOperation;
parameters?: OpenAPIParamater[];
summary?: string;
description?: string;
}
/** Reusable OpenAPI components and definitions */
interface OpenAPIComponents {
schemas?: Record<string, OpenAPISchema>;
responses?: Record<string, {
description: string;
headers?: Record<string, OpenAPIParamater>;
content?: Record<string, {
schema: OpenAPISchema;
}>;
}>;
parameters?: Record<string, OpenAPIParamater>;
examples?: Record<string, any>;
requestBodies?: Record<string, {
description?: string;
content: Record<string, {
schema: OpenAPISchema;
}>;
required?: boolean;
}>;
headers?: Record<string, OpenAPIParamater>;
securitySchemes?: Record<string, {
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
description?: string;
name?: string;
in?: 'query' | 'header' | 'cookie';
scheme?: string;
bearerFormat?: string;
flows?: any;
openIdConnectUrl?: string;
}>;
}
/** Parameter definition for OpenAPI operations */
interface OpenAPIParamater<T = any> {
name: string;
in: 'path' | 'query' | 'header' | 'cookie';
required?: boolean;
schema?: OpenAPISchema;
description?: string;
deprecated?: boolean;
allowEmptyValue?: boolean;
style?: 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
explode?: boolean;
allowReserved?: boolean;
example?: T;
examples?: Record<string, T>;
}
/** Complete OpenAPI operation specification */
interface OpenAPIOperation {
summary?: string;
description?: string;
tags?: string[];
operationId?: string;
deprecated?: boolean;
security?: Array<Record<string, string[]>>;
servers?: OpenAPIServer[];
responses?: OpenAPIResponses;
parameters?: OpenAPIParamater[];
requestBody?: {
description?: string;
content: Record<string, {
schema: OpenAPISchema;
}>;
required?: boolean;
};
callbacks?: Record<string, any>;
externalDocs?: {
description?: string;
url: string;
};
}
/** Possible HTTP response definitions for an operation */
type OpenAPIResponses = Partial<Record<number | 'default', {
description: string;
schema?: OpenAPISchema;
headers?: Record<string, OpenAPIParamater>;
content?: Record<string, {
schema: OpenAPISchema;
}>;
}>>;
/** Primitive OpenAPI schema type for API properties */
type ApiPropertyPrimitiveSchema = Exclude<OpenAPISchema, ObjectSchema | RefSchema> & {
required?: boolean;
};
/** Safe record type for nested API property definitions */
type SafeApiPropertyRecord = {
type?: never;
$ref?: never;
enum?: never;
} & {
[K in string]: (Constructible | [Constructible]) | SafeApiPropertyRecord;
};
/** Enum schema type for API properties */
type ApiPropertyEnumSchema = {
enum: (string | number)[] | Record<string, string | number>;
};
/** Swagger decorators usage */
type ApiPropertyDefinition = ApiPropertyPrimitiveSchema | ObjectSchema | RefSchema | ApiPropertyEnumSchema | Constructible | [Constructible] | SafeApiPropertyRecord;
/** Route metadata enhanced with Swagger/OpenAPI information */
interface ISwaggerRoute extends IControllerRoute {
controllerName: string;
controllerPrototype: TController['prototype'];
controllerPath: string;
fullPath: string;
swaggerMetadata?: OpenAPIOperation;
}
/** Complete Swagger/OpenAPI specification configuration */
interface ISwaggerConfig {
openapi: string;
info: OpenAPIInfo;
servers?: OpenAPIServer[];
paths: Record<string, OpenAPIPathItem>;
components?: OpenAPIComponents;
security?: Array<Record<string, string[]>>;
tags?: Array<{
name: string;
description?: string;
externalDocs?: {
description?: string;
url: string;
};
}>;
externalDocs?: {
description?: string;
url: string;
};
}
/** YasuiJS Swagger configuration */
interface YasuiSwaggerConfig extends Omit<ISwaggerConfig, 'openapi' | 'paths' | 'components'> {
/** Whether to generate swagger documentation
* @default false */
generate: boolean;
/** Output path for generated swagger documentation
* @default /api-docs */
path?: string;
}
/** YasuiJS configuration */
interface YasuiConfig {
controllers?: TController[];
middlewares?: TMiddleware[];
/** Global pipes applied to all route parameters in sequence */
globalPipes?: Constructible<IPipeTransform>[];
/** Pre-registered customs injections */
injections?: Injection[];
environment?: string;
/** Listening port of your server
* @default 3000 */
port?: number | string;
/** Used for logs only for now
* @default false */
protocol?: 'http' | 'https';
/** If true, display more logs and logs all incoming requests
* @default false */
debug?: boolean;
/** Optional required API key for all requests */
apiKey?: string;
/** If false, disables all validation checks on decorators (unsafe)
* @default true */
enableDecoratorValidation?: boolean;
swagger?: YasuiSwaggerConfig;
}
declare class DecoratorValidator {
private readonly appConfig;
private errors;
constructor(appConfig: YasuiConfig);
outputErrors(): void;
hasError(): boolean;
validateController(target: Constructible<IController>): void;
validateInjectable(target: Function, scope: Scopes, buildStack: Set<string>): void;
validateInjectionTokenRegistration(callerName: string, token: string): void;
validateSwaggerSchemaName(callerName: string, name: string): void;
private validateRouteMethod;
private getParameterNames;
private addError;
private throwError;
private isConstructible;
}
declare class SwaggerService {
private readonly decoratorValidator;
static schemas: Map<string, OpenAPISchema & {
className?: string;
}>;
/** <Class name, name> */
private static declaredSchemas;
private routesRegistry;
constructor(decoratorValidator: DecoratorValidator | null);
static resolveSchema(def: ApiPropertyDefinition): OpenAPISchema;
private static autoRegisterSchema;
private static generateSchemaFromClass;
registerControllerRoutes(ControllerClass: TController, controllerPath: string): void;
getSwaggerConfig(config?: Partial<YasuiSwaggerConfig>, hasApiKey?: boolean): ISwaggerConfig;
private normalizePath;
private buildOperation;
private generateDefaultSummary;
private generateParameters;
private extractPathParameters;
private parseRouteParam;
private mapToSwaggerParamType;
private generateResponses;
private shouldHaveRequestBody;
private hasBodyParameter;
}
/** Standardized logging utility service */
declare class LoggerService {
/** Timestamp when timer was started (milliseconds) */
startTime: number | undefined;
/** Timestamp of the last recorded time point */
lastTime: number | undefined;
/** Timestamp when timer was stopped */
endTime: number | undefined;
start(): this;
reset(): this;
/** Returns elapsed time in milliseconds */
stop(): number;
/** Returns current elapsed time without stopping the timer */
getTime(): number;
/** Logs message with optional source and custom color using kleur */
log(message: string, src?: string, color?: kleur.Color): void;
debug(message: string, src?: string): void;
success(message: string, src?: string): void;
error(message: string, src?: string): void;
warn(message: string, src?: string): void;
private getDate;
private getText;
}
/** Configuration utility service */
declare abstract class ConfigService {
/**
* Safe method to read an environment variable
* @param name environment variable name
* @param back optional default / fallback value
*/
static get(name: string, back?: string): string;
}
/** Define a Controller with optional middleware */
declare function Controller(path: string, ...middlewares: TMiddleware[]): ClassDecorator;
/** Sets default HTTP status code for the response (e.g., 201 for CREATED) */
declare function HttpStatus(status: HttpCode): MethodDecorator;
/** Define a Middleware */
declare function Middleware(): ClassDecorator;
/**
* Mark a class as injectable —
* Required to detect dependency injection through class constructor parameter types
*/
declare function Injectable(): ClassDecorator;
/**
* Injects a dependency by token or auto-inferred type —
* Usage:
* - Class constructor parameters: Only needed for custom token injection
* - Controller/middleware method parameters: Required for any dependency injection
*/
declare function Inject(token?: string): ParameterDecorator;
/**
* Define scope of dependency injection
* - SHARED (default): Use singleton instance shared across the application
* - LOCAL: New instance the injection context
* - DEEP_LOCAL: New instance, propagates locality to its own dependencies
*/
declare function Scope(scope: Scopes): ParameterDecorator;
/** Define a Pipe-transform */
declare const PipeTransform: typeof Injectable;
/** Applies pipes to all routes in the controller or a specific one (use to transform/validate route params) */
declare function UsePipes(...pipes: Constructible<IPipeTransform>[]): ClassDecorator & MethodDecorator;
declare function createPipeMiddleware(route: IControllerRoute, target: Function, pipes: IPipeTransform[]): RequestHandler;
type RouteDecorator = (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
/** Define a GET endpoint with optional middleware */
declare const Get: RouteDecorator;
/** Define a POST endpoint with optional middleware */
declare const Post: RouteDecorator;
/** Define a PUT endpoint with optional middleware */
declare const Put: RouteDecorator;
/** Define a DELETE endpoint with optional middleware */
declare const Delete: RouteDecorator;
/** Define a PATCH endpoint with optional middleware */
declare const Patch: RouteDecorator;
type RouteParamDecorator = (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
type RouteReqParamDecorator = (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
/** Factory function for creating parameter decorators that extract request data */
declare function routeRequestParamDecorator(reqProperty: string): RouteReqParamDecorator;
/** Injects Express Request object */
declare const Req: RouteParamDecorator;
/** Injects Express Response object */
declare const Res: RouteParamDecorator;
/** Injects Express Next object */
declare const Next: RouteParamDecorator;
/** Extracts specific header from `req.headers[name]`
* @param items If you are expecting an array, specify the type of items */
declare const Header: RouteReqParamDecorator;
/** Extracts specific path parameter from `req.params[name]`
* @param items If you are expecting an array, specify the type of items */
declare const Param: RouteReqParamDecorator;
/** Extracts specific query parameter from `req.query[name]`
* @param items If you are expecting an array, specify the type of items */
declare const Query: RouteReqParamDecorator;
/** Extracts specific body property or entire body if propertyName omitted */
declare const Body: RouteReqParamDecorator;
/** Injects timed logger instance dedicated to the current request */
declare const Logger: RouteReqParamDecorator;
/** Overload of the Express Request interface in Yasui's context */
interface Request extends Request$1 {
source?: string;
logger?: LoggerService;
}
declare class HttpError extends Error {
[index: string]: any;
/** HTTP status code associated with the error
* @default 500 */
status?: HttpCode;
constructor(status: HttpCode, message: string);
}
/** Returns a reference OpenAPI schema for a given resource */
declare const resolveSchema: typeof SwaggerService.resolveSchema;
/** Documents API endpoint */
declare function ApiOperation(summary: string, description?: string, tags?: string[]): MethodDecorator;
/**
* Defines custom name for a class API schema
* @default name Class.name // if non-decorated
*/
declare function ApiSchema(name: string): ClassDecorator;
/**
* Defines property for a class API schema
* @default schema.required true
*/
declare function ApiProperty(def?: ApiPropertyDefinition, isRequired?: boolean): PropertyDecorator;
/** Defines non-required property for a class API schema */
declare function ApiPropertyOptional(def?: ApiPropertyDefinition): PropertyDecorator;
/**
* Documents API response
* @param descArg can be used with class reference only (description will be the schema name)
*/
declare function ApiResponse(statusCode: number, descArg: string | Constructible, defArg?: ApiPropertyDefinition): MethodDecorator;
/**
* Documents API error response with base error schema and custom properties schema (record or class reference)
* @param descArg can be used with with class reference only (description will be the schema name)
*/
declare function ApiErrorResponse<T extends HttpError>(statusCode: number, descArg: string | Constructible<T>, ErrorDataClass?: Constructible<T>): MethodDecorator;
/**
* Documents request body schema and content type
* @param descArg can be used with class reference only (description will be the schema name)
* @default contentType "application/json"
*/
declare function ApiBody(descArg?: string | Constructible, defArg?: ApiPropertyDefinition, contentType?: string): MethodDecorator;
type SwaggerParamDecorator = (name: string, description?: string, required?: boolean, definition?: ApiPropertyDefinition) => MethodDecorator;
/** Documents path parameter with validation schema
* @default required false */
declare const ApiParam: SwaggerParamDecorator;
/** Documents query parameter with validation schema
* @default required false */
declare const ApiQuery: SwaggerParamDecorator;
/** Documents header parameter with validation schema
* @default required false */
declare const ApiHeader: SwaggerParamDecorator;
/** Alias for '@ApiProperty()` */
declare const AP: typeof ApiProperty;
/** Alias for `@ApiPropertyOptional()` */
declare const APO: typeof ApiPropertyOptional;
/** Create an HTTP server with Yasui's configuration and defined routes, and listening */
declare function createServer(conf: YasuiConfig): Server;
/** Create only an Express Application with Yasui's configuration and defined routes */
declare function createApp(conf: YasuiConfig): Application;
declare const _default: {
HttpError: typeof HttpError;
resolveSchema: typeof SwaggerService.resolveSchema;
HttpCode: typeof HttpCode;
HttpCodeMap: Record<number, string>;
RouteParamTypes: typeof RouteParamTypes;
RouteRequestParamTypes: typeof RouteRequestParamTypes;
RouteMethods: typeof RouteMethods;
Scopes: typeof Scopes;
Controller(path: string, ...middlewares: TMiddleware[]): ClassDecorator;
HttpStatus(status: HttpCode): MethodDecorator;
Middleware(): ClassDecorator;
UsePipes(...pipes: Constructible<IPipeTransform>[]): ClassDecorator & MethodDecorator;
createPipeMiddleware(route: IControllerRoute, target: Function, pipes: IPipeTransform[]): RequestHandler;
PipeTransform: typeof Injectable;
Get: (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
Post: (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
Put: (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
Delete: (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
Patch: (path: string, ...middlewares: TMiddleware[]) => MethodDecorator;
routeRequestParamDecorator(reqProperty: string): (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Req: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Res: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Next: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Header: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Param: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Query: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Body: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Logger: (varName?: string, items?: [ArrayItem]) => ParameterDecorator;
Injectable(): ClassDecorator;
Inject(token?: string): ParameterDecorator;
Scope(scope: Scopes): ParameterDecorator;
ApiOperation(summary: string, description?: string, tags?: string[]): MethodDecorator;
ApiSchema(name: string): ClassDecorator;
ApiProperty(def?: ApiPropertyDefinition, isRequired?: boolean): PropertyDecorator;
ApiPropertyOptional(def?: ApiPropertyDefinition): PropertyDecorator;
ApiResponse(statusCode: number, descArg: string | Constructible, defArg?: ApiPropertyDefinition): MethodDecorator;
ApiErrorResponse<T extends HttpError>(statusCode: number, descArg: string | Constructible<T>, ErrorDataClass?: Constructible<T>): MethodDecorator;
ApiBody(descArg?: string | Constructible, defArg?: ApiPropertyDefinition, contentType?: string): MethodDecorator;
ApiParam: (name: string, description?: string, required?: boolean, definition?: ApiPropertyDefinition) => MethodDecorator;
ApiQuery: (name: string, description?: string, required?: boolean, definition?: ApiPropertyDefinition) => MethodDecorator;
ApiHeader: (name: string, description?: string, required?: boolean, definition?: ApiPropertyDefinition) => MethodDecorator;
AP: typeof ApiProperty;
APO: typeof ApiPropertyOptional;
LoggerService: typeof LoggerService;
ConfigService: typeof ConfigService;
createServer(conf: YasuiConfig): http.Server;
createApp(conf: YasuiConfig): Application;
};
export { AP, APO, ApiBody, ApiErrorResponse, ApiHeader, ApiOperation, ApiParam, ApiProperty, ApiPropertyOptional, ApiQuery, ApiResponse, ApiSchema, Body, ConfigService, Controller, Delete, Get, Header, HttpCode, HttpCodeMap, HttpError, HttpStatus, Inject, Injectable, Logger, LoggerService, Middleware, Next, Param, Patch, PipeTransform, Post, Put, Query, Req, Res, RouteMethods, RouteParamTypes, RouteRequestParamTypes, Scope, Scopes, UsePipes, createApp, createPipeMiddleware, createServer, _default as default, resolveSchema, routeRequestParamDecorator };
export type { ApiPropertyDefinition, ApiPropertyEnumSchema, ApiPropertyPrimitiveSchema, ArrayItem, ArraySchema, BaseSchema, BooleanSchema, Constructible, IController, IControllerRoute, IDMiddleware, IMiddleware, IParamMetadata, IPipeTransform, IRouteParam, ISwaggerConfig, ISwaggerRoute, Injection, Instance, IntegerSchema, NumberSchema, ObjectSchema, OpenAPIComponents, OpenAPIInfo, OpenAPIOperation, OpenAPIParamater, OpenAPIPathItem, OpenAPIResponses, OpenAPISchema, OpenAPIServer, RefSchema, Request, SafeApiPropertyRecord, StringSchema, TController, TMiddleware, YasuiConfig, YasuiSwaggerConfig };