diff --git a/.gitignore b/.gitignore index f05f5eada3c..5afd97782f1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ yarn-error.log # tests /test +/integration /coverage /.nyc_output diff --git a/examples/12-graphql-apollo/src/cats/cats.resolvers.ts b/examples/12-graphql-apollo/src/cats/cats.resolvers.ts index 1a965f52b6c..ad97b8840d3 100644 --- a/examples/12-graphql-apollo/src/cats/cats.resolvers.ts +++ b/examples/12-graphql-apollo/src/cats/cats.resolvers.ts @@ -1,5 +1,11 @@ import { Component, UseGuards } from '@nestjs/common'; -import { Query, Mutation, Resolver, DelegateProperty, Subscription } from '@nestjs/graphql'; +import { + Query, + Mutation, + Resolver, + DelegateProperty, + Subscription, +} from '@nestjs/graphql'; import { PubSub } from 'graphql-subscriptions'; import { Cat } from './interfaces/cat.interface'; diff --git a/examples/12-graphql-apollo/src/cats/cats.service.ts b/examples/12-graphql-apollo/src/cats/cats.service.ts index 9a3666b5447..0769e0706dd 100644 --- a/examples/12-graphql-apollo/src/cats/cats.service.ts +++ b/examples/12-graphql-apollo/src/cats/cats.service.ts @@ -5,7 +5,7 @@ import { Cat } from './interfaces/cat.interface'; export class CatsService { private readonly cats: Cat[] = [{ id: 1, name: 'Cat', age: 5 }]; - create(cat: Cat): Cat{ + create(cat: Cat): Cat { this.cats.push(cat); return cat; } diff --git a/examples/12-graphql-apollo/src/subscriptions/subscription.constants.ts b/examples/12-graphql-apollo/src/subscriptions/subscription.constants.ts index 3bb5fd4383f..5ee560f0691 100644 --- a/examples/12-graphql-apollo/src/subscriptions/subscription.constants.ts +++ b/examples/12-graphql-apollo/src/subscriptions/subscription.constants.ts @@ -1 +1 @@ -export const SUBSCRIPTION_SERVER = 'SUBSCRIPTION_SERVER'; \ No newline at end of file +export const SUBSCRIPTION_SERVER = 'SUBSCRIPTION_SERVER'; diff --git a/examples/12-graphql-apollo/src/subscriptions/subscription.providers.ts b/examples/12-graphql-apollo/src/subscriptions/subscription.providers.ts index 124d40a0224..aad2be922ba 100644 --- a/examples/12-graphql-apollo/src/subscriptions/subscription.providers.ts +++ b/examples/12-graphql-apollo/src/subscriptions/subscription.providers.ts @@ -7,9 +7,7 @@ export const createSubscriptionProviders = (port: number = 3001) => [ provide: SUBSCRIPTION_SERVER, useFactory: () => { const server = createServer(); - return new Promise(resolve => - server.listen(port, () => resolve(server)), - ); + return new Promise(resolve => server.listen(port, () => resolve(server))); }, }, ]; diff --git a/gulpfile.js b/gulpfile.js index 59fcb9899e6..f29df19f24e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,5 @@ +const fs = require('fs'); +const path = require('path'); const gulp = require('gulp'); const ts = require('gulp-typescript'); const gulpSequence = require('gulp-sequence'); @@ -5,11 +7,11 @@ const sourcemaps = require('gulp-sourcemaps'); const clean = require('gulp-clean'); const packages = { - common: ts.createProject('src/common/tsconfig.json'), - core: ts.createProject('src/core/tsconfig.json'), - microservices: ts.createProject('src/microservices/tsconfig.json'), - websockets: ts.createProject('src/websockets/tsconfig.json'), - testing: ts.createProject('src/testing/tsconfig.json'), + common: ts.createProject('src/common/tsconfig.json'), + core: ts.createProject('src/core/tsconfig.json'), + microservices: ts.createProject('src/microservices/tsconfig.json'), + websockets: ts.createProject('src/websockets/tsconfig.json'), + testing: ts.createProject('src/testing/tsconfig.json'), }; const modules = Object.keys(packages); const source = 'src'; @@ -17,85 +19,79 @@ const distId = process.argv.indexOf('--dist'); const dist = distId < 0 ? 'node_modules/@nestjs' : process.argv[distId + 1]; gulp.task('default', function() { - modules.forEach(module => { - gulp.watch( - [`${source}/${module}/**/*.ts`, `${source}/${module}/*.ts`], - [module] - ); - }); + modules.forEach(module => { + gulp.watch( + [`${source}/${module}/**/*.ts`, `${source}/${module}/*.ts`], + [module], + ); + }); }); -gulp.task('copy:ts', function(){ - return gulp.src(['src/**/*.ts']) - .pipe(gulp.dest('./lib')); +gulp.task('copy:ts', function() { + return gulp.src(['src/**/*.ts']).pipe(gulp.dest('./lib')); }); -gulp.task('clean:lib', function(){ - return gulp.src([ - 'lib/**/*.js.map', - 'lib/**/*.ts', - '!lib/**/*.d.ts' - ], {read: false}) - .pipe(clean()); +gulp.task('clean:lib', function() { + return gulp + .src(['lib/**/*.js.map', 'lib/**/*.ts', '!lib/**/*.d.ts'], { read: false }) + .pipe(clean()); }); modules.forEach(module => { - gulp.task(module, () => { - return packages[module] - .src() - .pipe(packages[module]()) - .pipe(gulp.dest(`${dist}/${module}`)); - }); + gulp.task(module, () => { + return packages[module] + .src() + .pipe(packages[module]()) + .pipe(gulp.dest(`${dist}/${module}`)); + }); }); modules.forEach(module => { - gulp.task(module + ':dev', () => { - return packages[module] - .src() - .pipe(sourcemaps.init()) - .pipe(packages[module]()) - .pipe(sourcemaps.mapSources(sourcePath => './' + sourcePath.split('/').pop())) - .pipe(sourcemaps.write('.')) - .pipe(gulp.dest(`${dist}/${module}`)); - }); + gulp.task(module + ':dev', () => { + return packages[module] + .src() + .pipe(sourcemaps.init()) + .pipe(packages[module]()) + .pipe( + sourcemaps.mapSources(sourcePath => './' + sourcePath.split('/').pop()), + ) + .pipe(sourcemaps.write('.')) + .pipe(gulp.dest(`${dist}/${module}`)); + }); }); gulp.task('build', function(cb) { - gulpSequence('common', modules.filter((module) => module !== 'common'), cb); + gulpSequence('common', modules.filter(module => module !== 'common'), cb); }); gulp.task('build:dev', function(cb) { - gulpSequence( - 'common:dev', - modules.filter((module) => module !== 'common').map((module) => module + ':dev'), - 'copy:ts', - cb); + gulpSequence( + 'common:dev', + modules + .filter(module => module !== 'common') + .map(module => module + ':dev'), + 'copy:ts', + cb, + ); }); +function getFolders(dir) { + return fs.readdirSync(dir).filter(function(file) { + return fs.statSync(path.join(dir, file)).isDirectory(); + }); +} gulp.task('move', function() { - gulp.src(['node_modules/@nestjs/**/*']).pipe( - gulp.dest('examples/01-cats-app/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/02-gateways/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/03-microservices/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/04-injector/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/05-sql-typeorm/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/06-mongoose/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/07-sequelize/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/08-passport/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/09-babel-example/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/11-swagger/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/12-graphql-apollo/node_modules/@nestjs') - ).pipe( - gulp.dest('examples/15-mvc/node_modules/@nestjs') - ); + const getDirs = (base) => getFolders(base) + .map((path) => `${base}/${path}`); + + const examplesDirs = getDirs('examples'); + const integrationDirs = getDirs('integration'); + const directories = examplesDirs.concat(integrationDirs); + + let stream = gulp + .src(['node_modules/@nestjs/**/*']); + + directories.forEach((dir) => { + stream = stream.pipe(gulp.dest(dir + '/node_modules/@nestjs')); + }); }); diff --git a/lib/common/constants.d.ts b/lib/common/constants.d.ts index d236cff7c14..0522f81a895 100644 --- a/lib/common/constants.d.ts +++ b/lib/common/constants.d.ts @@ -1,24 +1,24 @@ export declare const metadata: { - MODULES: string; - IMPORTS: string; - COMPONENTS: string; - CONTROLLERS: string; - EXPORTS: string; + MODULES: string; + IMPORTS: string; + COMPONENTS: string; + CONTROLLERS: string; + EXPORTS: string; }; -export declare const SHARED_MODULE_METADATA = "__sharedModule__"; -export declare const GLOBAL_MODULE_METADATA = "__globalModule__"; -export declare const PATH_METADATA = "path"; -export declare const PARAMTYPES_METADATA = "design:paramtypes"; -export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes"; -export declare const METHOD_METADATA = "method"; -export declare const ROUTE_ARGS_METADATA = "__routeArguments__"; -export declare const CUSTOM_ROUTE_AGRS_METADATA = "__customRouteArgs__"; -export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__"; -export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__"; -export declare const PIPES_METADATA = "__pipes__"; -export declare const GUARDS_METADATA = "__guards__"; -export declare const RENDER_METADATA = "__renderTemplate__"; -export declare const INTERCEPTORS_METADATA = "__interceptors__"; -export declare const HTTP_CODE_METADATA = "__httpCode__"; -export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddlewares"; -export declare const MODULE_PATH = "__module_path__"; +export declare const SHARED_MODULE_METADATA = '__sharedModule__'; +export declare const GLOBAL_MODULE_METADATA = '__globalModule__'; +export declare const PATH_METADATA = 'path'; +export declare const PARAMTYPES_METADATA = 'design:paramtypes'; +export declare const SELF_DECLARED_DEPS_METADATA = 'self:paramtypes'; +export declare const METHOD_METADATA = 'method'; +export declare const ROUTE_ARGS_METADATA = '__routeArguments__'; +export declare const CUSTOM_ROUTE_AGRS_METADATA = '__customRouteArgs__'; +export declare const EXCEPTION_FILTERS_METADATA = '__exceptionFilters__'; +export declare const FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__'; +export declare const PIPES_METADATA = '__pipes__'; +export declare const GUARDS_METADATA = '__guards__'; +export declare const RENDER_METADATA = '__renderTemplate__'; +export declare const INTERCEPTORS_METADATA = '__interceptors__'; +export declare const HTTP_CODE_METADATA = '__httpCode__'; +export declare const GATEWAY_MIDDLEWARES = '__gatewayMiddlewares'; +export declare const MODULE_PATH = '__module_path__'; diff --git a/lib/common/decorators/core/bind.decorator.d.ts b/lib/common/decorators/core/bind.decorator.d.ts index 0ef166a8ddb..972b73cfc5f 100644 --- a/lib/common/decorators/core/bind.decorator.d.ts +++ b/lib/common/decorators/core/bind.decorator.d.ts @@ -3,4 +3,6 @@ * Useful when the language doesn't provide a 'Parameter Decorators' feature * @param {} ...decorators */ -export declare function Bind(...decorators: any[]): (target: object, key: any, descriptor: any) => any; +export declare function Bind( + ...decorators: any[] +): (target: object, key: any, descriptor: any) => any; diff --git a/lib/common/decorators/core/exception-filters.decorator.d.ts b/lib/common/decorators/core/exception-filters.decorator.d.ts index 68f0c250bc1..10c89f1bbc8 100644 --- a/lib/common/decorators/core/exception-filters.decorator.d.ts +++ b/lib/common/decorators/core/exception-filters.decorator.d.ts @@ -10,4 +10,6 @@ import { ExceptionFilter } from '../../index'; * * @param {ExceptionFilter[]} ...filters (instances) */ -export declare const UseFilters: (...filters: ExceptionFilter[]) => (target: object, key?: any, descriptor?: any) => any; +export declare const UseFilters: ( + ...filters: ExceptionFilter[] +) => (target: object, key?: any, descriptor?: any) => any; diff --git a/lib/common/decorators/core/reflect-metadata.decorator.d.ts b/lib/common/decorators/core/reflect-metadata.decorator.d.ts index bd43ca76128..8de439ed0c6 100644 --- a/lib/common/decorators/core/reflect-metadata.decorator.d.ts +++ b/lib/common/decorators/core/reflect-metadata.decorator.d.ts @@ -2,4 +2,7 @@ * Assigns the metadata to the class / function under specified `key`. * This metadata can be reflected using `Reflector` class. */ -export declare const ReflectMetadata: (metadataKey: any, metadataValue: any) => (target: object, key?: any, descriptor?: any) => any; +export declare const ReflectMetadata: ( + metadataKey: any, + metadataValue: any, +) => (target: object, key?: any, descriptor?: any) => any; diff --git a/lib/common/decorators/core/use-guards.decorator.d.ts b/lib/common/decorators/core/use-guards.decorator.d.ts index 027fc210be4..db5b30a6165 100644 --- a/lib/common/decorators/core/use-guards.decorator.d.ts +++ b/lib/common/decorators/core/use-guards.decorator.d.ts @@ -8,4 +8,6 @@ * * @param {} ...guards (types) */ -export declare function UseGuards(...guards: any[]): (target: object, key?: any, descriptor?: any) => any; +export declare function UseGuards( + ...guards: any[] +): (target: object, key?: any, descriptor?: any) => any; diff --git a/lib/common/decorators/core/use-interceptors.decorator.d.ts b/lib/common/decorators/core/use-interceptors.decorator.d.ts index e9ced6e0de3..d0cb600249a 100644 --- a/lib/common/decorators/core/use-interceptors.decorator.d.ts +++ b/lib/common/decorators/core/use-interceptors.decorator.d.ts @@ -8,4 +8,6 @@ * * @param {} ...interceptors (types) */ -export declare function UseInterceptors(...interceptors: any[]): (target: object, key?: any, descriptor?: any) => any; +export declare function UseInterceptors( + ...interceptors: any[] +): (target: object, key?: any, descriptor?: any) => any; diff --git a/lib/common/decorators/core/use-pipes.decorator.d.ts b/lib/common/decorators/core/use-pipes.decorator.d.ts index f1d08216c45..f806c421181 100644 --- a/lib/common/decorators/core/use-pipes.decorator.d.ts +++ b/lib/common/decorators/core/use-pipes.decorator.d.ts @@ -9,4 +9,6 @@ import { PipeTransform } from '../../interfaces/index'; * * @param {PipeTransform[]} ...pipes (instances) */ -export declare function UsePipes(...pipes: PipeTransform[]): (target: object, key?: any, descriptor?: any) => any; +export declare function UsePipes( + ...pipes: PipeTransform[] +): (target: object, key?: any, descriptor?: any) => any; diff --git a/lib/common/decorators/http/create-route-param-metadata.decorator.d.ts b/lib/common/decorators/http/create-route-param-metadata.decorator.d.ts index 9867bcf2776..2d2a60a1770 100644 --- a/lib/common/decorators/http/create-route-param-metadata.decorator.d.ts +++ b/lib/common/decorators/http/create-route-param-metadata.decorator.d.ts @@ -4,4 +4,6 @@ import { PipeTransform } from '../../index'; * Create route params custom decorator * @param factory */ -export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform[]) => ParameterDecorator; +export declare function createRouteParamDecorator( + factory: CustomParamFactory, +): (data?: any, ...pipes: PipeTransform[]) => ParameterDecorator; diff --git a/lib/common/decorators/http/request-mapping.decorator.d.ts b/lib/common/decorators/http/request-mapping.decorator.d.ts index 988e1e34310..64f72ff8d75 100644 --- a/lib/common/decorators/http/request-mapping.decorator.d.ts +++ b/lib/common/decorators/http/request-mapping.decorator.d.ts @@ -1,6 +1,8 @@ import 'reflect-metadata'; import { RequestMappingMetadata } from '../../interfaces/request-mapping-metadata.interface'; -export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator; +export declare const RequestMapping: ( + metadata?: RequestMappingMetadata, +) => MethodDecorator; /** * Routes HTTP POST requests to the specified path. */ diff --git a/lib/common/decorators/http/route-params.decorator.d.ts b/lib/common/decorators/http/route-params.decorator.d.ts index d8169bb687c..b4d202b4ed4 100644 --- a/lib/common/decorators/http/route-params.decorator.d.ts +++ b/lib/common/decorators/http/route-params.decorator.d.ts @@ -2,10 +2,10 @@ import 'reflect-metadata'; import { PipeTransform } from '../../index'; export declare type ParamData = object | string | number; export interface RouteParamsMetadata { - [prop: number]: { - index: number; - data?: ParamData; - }; + [prop: number]: { + index: number; + data?: ParamData; + }; } export declare const Request: () => ParameterDecorator; export declare const Response: () => ParameterDecorator; @@ -16,12 +16,21 @@ export declare const UploadedFiles: () => ParameterDecorator; export declare const Headers: (property?: string) => ParameterDecorator; export declare function Query(): any; export declare function Query(...pipes: PipeTransform[]): any; -export declare function Query(property: string, ...pipes: PipeTransform[]): any; +export declare function Query( + property: string, + ...pipes: PipeTransform[] +): any; export declare function Body(): any; export declare function Body(...pipes: PipeTransform[]): any; -export declare function Body(property: string, ...pipes: PipeTransform[]): any; +export declare function Body( + property: string, + ...pipes: PipeTransform[] +): any; export declare function Param(): any; export declare function Param(...pipes: PipeTransform[]): any; -export declare function Param(property: string, ...pipes: PipeTransform[]): any; +export declare function Param( + property: string, + ...pipes: PipeTransform[] +): any; export declare const Req: () => ParameterDecorator; export declare const Res: () => ParameterDecorator; diff --git a/lib/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts b/lib/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts index 8d2a089ebf6..0d7dfbbf98c 100644 --- a/lib/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts +++ b/lib/common/decorators/modules/exceptions/invalid-module-config.exception.d.ts @@ -1,3 +1,3 @@ export declare class InvalidModuleConfigException extends Error { - constructor(property: string); + constructor(property: string); } diff --git a/lib/common/enums/http-status.enum.d.ts b/lib/common/enums/http-status.enum.d.ts index c286c22814c..1560387eca1 100644 --- a/lib/common/enums/http-status.enum.d.ts +++ b/lib/common/enums/http-status.enum.d.ts @@ -1,46 +1,46 @@ export declare enum HttpStatus { - CONTINUE = 100, - SWITCHING_PROTOCOLS = 101, - PROCESSING = 102, - OK = 200, - CREATED = 201, - ACCEPTED = 202, - NON_AUTHORITATIVE_INFORMATION = 203, - NO_CONTENT = 204, - RESET_CONTENT = 205, - PARTIAL_CONTENT = 206, - AMBIGUOUS = 300, - MOVED_PERMANENTLY = 301, - FOUND = 302, - SEE_OTHER = 303, - NOT_MODIFIED = 304, - 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, - PAYLOAD_TOO_LARGE = 413, - URI_TOO_LONG = 414, - UNSUPPORTED_MEDIA_TYPE = 415, - REQUESTED_RANGE_NOT_SATISFIABLE = 416, - EXPECTATION_FAILED = 417, - I_AM_A_TEAPOT = 418, - UNPROCESSABLE_ENTITY = 422, - TOO_MANY_REQUESTS = 429, - INTERNAL_SERVER_ERROR = 500, - NOT_IMPLEMENTED = 501, - BAD_GATEWAY = 502, - SERVICE_UNAVAILABLE = 503, - GATEWAY_TIMEOUT = 504, - HTTP_VERSION_NOT_SUPPORTED = 505, + CONTINUE = 100, + SWITCHING_PROTOCOLS = 101, + PROCESSING = 102, + OK = 200, + CREATED = 201, + ACCEPTED = 202, + NON_AUTHORITATIVE_INFORMATION = 203, + NO_CONTENT = 204, + RESET_CONTENT = 205, + PARTIAL_CONTENT = 206, + AMBIGUOUS = 300, + MOVED_PERMANENTLY = 301, + FOUND = 302, + SEE_OTHER = 303, + NOT_MODIFIED = 304, + 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, + PAYLOAD_TOO_LARGE = 413, + URI_TOO_LONG = 414, + UNSUPPORTED_MEDIA_TYPE = 415, + REQUESTED_RANGE_NOT_SATISFIABLE = 416, + EXPECTATION_FAILED = 417, + I_AM_A_TEAPOT = 418, + UNPROCESSABLE_ENTITY = 422, + TOO_MANY_REQUESTS = 429, + INTERNAL_SERVER_ERROR = 500, + NOT_IMPLEMENTED = 501, + BAD_GATEWAY = 502, + SERVICE_UNAVAILABLE = 503, + GATEWAY_TIMEOUT = 504, + HTTP_VERSION_NOT_SUPPORTED = 505, } diff --git a/lib/common/enums/nest-environment.enum.d.ts b/lib/common/enums/nest-environment.enum.d.ts index 8d006ea1a55..f708d7bdbca 100644 --- a/lib/common/enums/nest-environment.enum.d.ts +++ b/lib/common/enums/nest-environment.enum.d.ts @@ -1,4 +1,4 @@ export declare enum NestEnvironment { - RUN = 0, - TEST = 1, + RUN = 0, + TEST = 1, } diff --git a/lib/common/enums/request-method.enum.d.ts b/lib/common/enums/request-method.enum.d.ts index 476c9cb3f0a..3255181cd97 100644 --- a/lib/common/enums/request-method.enum.d.ts +++ b/lib/common/enums/request-method.enum.d.ts @@ -1,10 +1,10 @@ export declare enum RequestMethod { - GET = 0, - POST = 1, - PUT = 2, - DELETE = 3, - PATCH = 4, - ALL = 5, - OPTIONS = 6, - HEAD = 7, + GET = 0, + POST = 1, + PUT = 2, + DELETE = 3, + PATCH = 4, + ALL = 5, + OPTIONS = 6, + HEAD = 7, } diff --git a/lib/common/enums/route-paramtypes.enum.d.ts b/lib/common/enums/route-paramtypes.enum.d.ts index d63e3e25dfb..4a7f51b28bf 100644 --- a/lib/common/enums/route-paramtypes.enum.d.ts +++ b/lib/common/enums/route-paramtypes.enum.d.ts @@ -1,12 +1,12 @@ export declare enum RouteParamtypes { - REQUEST = 0, - RESPONSE = 1, - NEXT = 2, - BODY = 3, - QUERY = 4, - PARAM = 5, - HEADERS = 6, - SESSION = 7, - FILE = 8, - FILES = 9, + REQUEST = 0, + RESPONSE = 1, + NEXT = 2, + BODY = 3, + QUERY = 4, + PARAM = 5, + HEADERS = 6, + SESSION = 7, + FILE = 8, + FILES = 9, } diff --git a/lib/common/enums/transport.enum.d.ts b/lib/common/enums/transport.enum.d.ts index 5f116ab7c12..925f42dac96 100644 --- a/lib/common/enums/transport.enum.d.ts +++ b/lib/common/enums/transport.enum.d.ts @@ -1,4 +1,4 @@ export declare enum Transport { - TCP = 0, - REDIS = 1, + TCP = 0, + REDIS = 1, } diff --git a/lib/common/exceptions/bad-gateway.exception.d.ts b/lib/common/exceptions/bad-gateway.exception.d.ts index 9acc902803a..70ff89f17f2 100644 --- a/lib/common/exceptions/bad-gateway.exception.d.ts +++ b/lib/common/exceptions/bad-gateway.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class BadGatewayException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/bad-request.exception.d.ts b/lib/common/exceptions/bad-request.exception.d.ts index 0359c2836c4..4170e99270b 100644 --- a/lib/common/exceptions/bad-request.exception.d.ts +++ b/lib/common/exceptions/bad-request.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class BadRequestException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/conflict.exception.d.ts b/lib/common/exceptions/conflict.exception.d.ts index c9cf4bc6adc..33028a97345 100644 --- a/lib/common/exceptions/conflict.exception.d.ts +++ b/lib/common/exceptions/conflict.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class ConflictException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/forbidden.exception.d.ts b/lib/common/exceptions/forbidden.exception.d.ts index 88f6b75e958..900c1f7e7af 100644 --- a/lib/common/exceptions/forbidden.exception.d.ts +++ b/lib/common/exceptions/forbidden.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class ForbiddenException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/gateway-timeout.exception.d.ts b/lib/common/exceptions/gateway-timeout.exception.d.ts index 43bf13db9d3..876d6964830 100644 --- a/lib/common/exceptions/gateway-timeout.exception.d.ts +++ b/lib/common/exceptions/gateway-timeout.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class GatewayTimeoutException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/gone.exception.d.ts b/lib/common/exceptions/gone.exception.d.ts index bf163313a92..1b00919feba 100644 --- a/lib/common/exceptions/gone.exception.d.ts +++ b/lib/common/exceptions/gone.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class GoneException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/http.exception.d.ts b/lib/common/exceptions/http.exception.d.ts index 6bc3aee7352..dc17d6c0f25 100644 --- a/lib/common/exceptions/http.exception.d.ts +++ b/lib/common/exceptions/http.exception.d.ts @@ -1,22 +1,22 @@ export declare class HttpException extends Error { - private readonly response; - private readonly status; - readonly message: any; - /** - * The base Nest Application exception, which is handled by the default Exceptions Handler. - * If you throw an exception from your HTTP route handler, Nest will map them to the appropriate HTTP response and send to the client. - * - * When `response` is an object: - * - object will be stringified and returned to the user as a JSON response, - * - * When `response` is a string: - * - Nest will create a response with two properties: - * ``` - * message: response, - * statusCode: X - * ``` - */ - constructor(response: string | object, status: number); - getResponse(): string | object; - getStatus(): number; + private readonly response; + private readonly status; + readonly message: any; + /** + * The base Nest Application exception, which is handled by the default Exceptions Handler. + * If you throw an exception from your HTTP route handler, Nest will map them to the appropriate HTTP response and send to the client. + * + * When `response` is an object: + * - object will be stringified and returned to the user as a JSON response, + * + * When `response` is a string: + * - Nest will create a response with two properties: + * ``` + * message: response, + * statusCode: X + * ``` + */ + constructor(response: string | object, status: number); + getResponse(): string | object; + getStatus(): number; } diff --git a/lib/common/exceptions/internal-server-error.exception.d.ts b/lib/common/exceptions/internal-server-error.exception.d.ts index af854728daf..6ea1c207df5 100644 --- a/lib/common/exceptions/internal-server-error.exception.d.ts +++ b/lib/common/exceptions/internal-server-error.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class InternalServerErrorException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/method-not-allowed.exception.d.ts b/lib/common/exceptions/method-not-allowed.exception.d.ts index b53c4e3b7e5..3d9b3b78f0e 100644 --- a/lib/common/exceptions/method-not-allowed.exception.d.ts +++ b/lib/common/exceptions/method-not-allowed.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class MethodNotAllowedException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/not-acceptable.exception.d.ts b/lib/common/exceptions/not-acceptable.exception.d.ts index aedd756ea5c..4921c15e0b4 100644 --- a/lib/common/exceptions/not-acceptable.exception.d.ts +++ b/lib/common/exceptions/not-acceptable.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class NotAcceptableException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/not-found.exception.d.ts b/lib/common/exceptions/not-found.exception.d.ts index 45847ad6911..84ddc8e47fc 100644 --- a/lib/common/exceptions/not-found.exception.d.ts +++ b/lib/common/exceptions/not-found.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class NotFoundException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/not-implemented.exception.d.ts b/lib/common/exceptions/not-implemented.exception.d.ts index 8b1d49255b4..0d0c1f5e1b4 100644 --- a/lib/common/exceptions/not-implemented.exception.d.ts +++ b/lib/common/exceptions/not-implemented.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class NotImplementedException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/payload-too-large.exception.d.ts b/lib/common/exceptions/payload-too-large.exception.d.ts index 050c6776743..808b8d7e179 100644 --- a/lib/common/exceptions/payload-too-large.exception.d.ts +++ b/lib/common/exceptions/payload-too-large.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class PayloadTooLargeException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/request-timeout.exception.d.ts b/lib/common/exceptions/request-timeout.exception.d.ts index ae1bf4f1c79..e12fca810f5 100644 --- a/lib/common/exceptions/request-timeout.exception.d.ts +++ b/lib/common/exceptions/request-timeout.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class RequestTimeoutException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/service-unavailable.exception.d.ts b/lib/common/exceptions/service-unavailable.exception.d.ts index 43cae5f5a12..eef882d789a 100644 --- a/lib/common/exceptions/service-unavailable.exception.d.ts +++ b/lib/common/exceptions/service-unavailable.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class ServiceUnavailableException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/unauthorized.exception.d.ts b/lib/common/exceptions/unauthorized.exception.d.ts index 798da7f425b..a70bef07e4e 100644 --- a/lib/common/exceptions/unauthorized.exception.d.ts +++ b/lib/common/exceptions/unauthorized.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class UnauthorizedException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/unprocessable-entity.exception.d.ts b/lib/common/exceptions/unprocessable-entity.exception.d.ts index cf1a7d530c3..a5fd76711cb 100644 --- a/lib/common/exceptions/unprocessable-entity.exception.d.ts +++ b/lib/common/exceptions/unprocessable-entity.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class UnprocessableEntityException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/exceptions/unsupported-media-type.exception.d.ts b/lib/common/exceptions/unsupported-media-type.exception.d.ts index 5f777fdb7d9..5f0921b12be 100644 --- a/lib/common/exceptions/unsupported-media-type.exception.d.ts +++ b/lib/common/exceptions/unsupported-media-type.exception.d.ts @@ -1,4 +1,4 @@ import { HttpException } from './http.exception'; export declare class UnsupportedMediaTypeException extends HttpException { - constructor(message?: string | object | any, error?: string); + constructor(message?: string | object | any, error?: string); } diff --git a/lib/common/http/http.module.d.ts b/lib/common/http/http.module.d.ts index 4358c9dc838..b93acc45b35 100644 --- a/lib/common/http/http.module.d.ts +++ b/lib/common/http/http.module.d.ts @@ -1,2 +1 @@ -export declare class HttpModule { -} +export declare class HttpModule {} diff --git a/lib/common/http/http.service.d.ts b/lib/common/http/http.service.d.ts index 01ee36acb67..fe04526a904 100644 --- a/lib/common/http/http.service.d.ts +++ b/lib/common/http/http.service.d.ts @@ -1,12 +1,36 @@ import { Observable } from 'rxjs/Observable'; -import { AxiosRequestConfig, AxiosResponse } from './interfaces/axios.interfaces'; +import { + AxiosRequestConfig, + AxiosResponse, +} from './interfaces/axios.interfaces'; import 'rxjs/add/observable/fromPromise'; export declare class HttpService { - request(config: AxiosRequestConfig): Observable>; - get(url: string, config?: AxiosRequestConfig): Observable>; - delete(url: string, config?: AxiosRequestConfig): Observable>; - head(url: string, config?: AxiosRequestConfig): Observable>; - post(url: string, data?: any, config?: AxiosRequestConfig): Observable>; - put(url: string, data?: any, config?: AxiosRequestConfig): Observable>; - patch(url: string, data?: any, config?: AxiosRequestConfig): Observable>; + request(config: AxiosRequestConfig): Observable>; + get( + url: string, + config?: AxiosRequestConfig, + ): Observable>; + delete( + url: string, + config?: AxiosRequestConfig, + ): Observable>; + head( + url: string, + config?: AxiosRequestConfig, + ): Observable>; + post( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): Observable>; + put( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): Observable>; + patch( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): Observable>; } diff --git a/lib/common/http/interfaces/axios.interfaces.d.ts b/lib/common/http/interfaces/axios.interfaces.d.ts index 3cda8d39a17..28f3fc1d55d 100644 --- a/lib/common/http/interfaces/axios.interfaces.d.ts +++ b/lib/common/http/interfaces/axios.interfaces.d.ts @@ -1,109 +1,123 @@ export interface AxiosTransformer { - (data: any, headers?: any): any; + (data: any, headers?: any): any; } export interface AxiosAdapter { - (config: AxiosRequestConfig): AxiosPromise; + (config: AxiosRequestConfig): AxiosPromise; } export interface AxiosBasicCredentials { - username: string; - password: string; + username: string; + password: string; } export interface AxiosProxyConfig { - host: string; - port: number; + host: string; + port: number; } export interface AxiosRequestConfig { - url?: string; - method?: string; - baseURL?: string; - transformRequest?: AxiosTransformer | AxiosTransformer[]; - transformResponse?: AxiosTransformer | AxiosTransformer[]; - headers?: any; - params?: any; - paramsSerializer?: (params: any) => string; - data?: any; - timeout?: number; - withCredentials?: boolean; - adapter?: AxiosAdapter; - auth?: AxiosBasicCredentials; - responseType?: string; - xsrfCookieName?: string; - xsrfHeaderName?: string; - onUploadProgress?: (progressEvent: any) => void; - onDownloadProgress?: (progressEvent: any) => void; - maxContentLength?: number; - validateStatus?: (status: number) => boolean; - maxRedirects?: number; - httpAgent?: any; - httpsAgent?: any; - proxy?: AxiosProxyConfig; - cancelToken?: CancelToken; + url?: string; + method?: string; + baseURL?: string; + transformRequest?: AxiosTransformer | AxiosTransformer[]; + transformResponse?: AxiosTransformer | AxiosTransformer[]; + headers?: any; + params?: any; + paramsSerializer?: (params: any) => string; + data?: any; + timeout?: number; + withCredentials?: boolean; + adapter?: AxiosAdapter; + auth?: AxiosBasicCredentials; + responseType?: string; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: any) => void; + onDownloadProgress?: (progressEvent: any) => void; + maxContentLength?: number; + validateStatus?: (status: number) => boolean; + maxRedirects?: number; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig; + cancelToken?: CancelToken; } export interface AxiosResponse { - data: T; - status: number; - statusText: string; - headers: any; - config: AxiosRequestConfig; - request?: any; + data: T; + status: number; + statusText: string; + headers: any; + config: AxiosRequestConfig; + request?: any; } export interface AxiosError extends Error { - config: AxiosRequestConfig; - code?: string; - request?: any; - response?: AxiosResponse; -} -export interface AxiosPromise extends Promise> { + config: AxiosRequestConfig; + code?: string; + request?: any; + response?: AxiosResponse; } +export interface AxiosPromise extends Promise> {} export interface CancelStatic { - new (message?: string): Cancel; + new (message?: string): Cancel; } export interface Cancel { - message: string; + message: string; } export interface Canceler { - (message?: string): void; + (message?: string): void; } export interface CancelTokenStatic { - new (executor: (cancel: Canceler) => void): CancelToken; - source(): CancelTokenSource; + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; } export interface CancelToken { - promise: Promise; - reason?: Cancel; - throwIfRequested(): void; + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; } export interface CancelTokenSource { - token: CancelToken; - cancel: Canceler; + token: CancelToken; + cancel: Canceler; } export interface AxiosInterceptorManager { - use(onFulfilled?: (value: V) => V | Promise, onRejected?: (error: any) => any): number; - eject(id: number): void; + use( + onFulfilled?: (value: V) => V | Promise, + onRejected?: (error: any) => any, + ): number; + eject(id: number): void; } export interface AxiosInstance { - defaults: AxiosRequestConfig; - interceptors: { - request: AxiosInterceptorManager; - response: AxiosInterceptorManager; - }; - request(config: AxiosRequestConfig): AxiosPromise; - get(url: string, config?: AxiosRequestConfig): AxiosPromise; - delete(url: string, config?: AxiosRequestConfig): AxiosPromise; - head(url: string, config?: AxiosRequestConfig): AxiosPromise; - post(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; - put(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; - patch(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise; + defaults: AxiosRequestConfig; + interceptors: { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; + }; + request(config: AxiosRequestConfig): AxiosPromise; + get(url: string, config?: AxiosRequestConfig): AxiosPromise; + delete(url: string, config?: AxiosRequestConfig): AxiosPromise; + head(url: string, config?: AxiosRequestConfig): AxiosPromise; + post( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): AxiosPromise; + put( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): AxiosPromise; + patch( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): AxiosPromise; } export interface AxiosStatic extends AxiosInstance { - (config: AxiosRequestConfig): AxiosPromise; - (url: string, config?: AxiosRequestConfig): AxiosPromise; - create(config?: AxiosRequestConfig): AxiosInstance; - Cancel: CancelStatic; - CancelToken: CancelTokenStatic; - isCancel(value: any): boolean; - all(values: (T | Promise)[]): Promise; - spread(callback: (...args: T[]) => R): (array: T[]) => R; + (config: AxiosRequestConfig): AxiosPromise; + (url: string, config?: AxiosRequestConfig): AxiosPromise; + create(config?: AxiosRequestConfig): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + isCancel(value: any): boolean; + all(values: (T | Promise)[]): Promise; + spread(callback: (...args: T[]) => R): (array: T[]) => R; } declare const Axios: AxiosStatic; export default Axios; diff --git a/lib/common/index.d.ts b/lib/common/index.d.ts index 1c78da5cc2d..ff1998d16ef 100644 --- a/lib/common/index.d.ts +++ b/lib/common/index.d.ts @@ -1,6 +1,29 @@ export * from './decorators'; export * from './enums'; -export { NestModule, INestApplication, INestMicroservice, MiddlewareConfigProxy, MiddlewareConfiguration, NestMiddleware, ExpressMiddleware, MiddlewaresConsumer, OnModuleInit, ExceptionFilter, WebSocketAdapter, PipeTransform, Paramtype, ArgumentMetadata, OnModuleDestroy, ExecutionContext, CanActivate, RpcExceptionFilter, WsExceptionFilter, NestInterceptor, DynamicModule, INestApplicationContext } from './interfaces'; +export { + NestModule, + INestApplication, + INestMicroservice, + MiddlewareConfigProxy, + MiddlewareConfiguration, + NestMiddleware, + ExpressMiddleware, + MiddlewaresConsumer, + OnModuleInit, + ExceptionFilter, + WebSocketAdapter, + PipeTransform, + Paramtype, + ArgumentMetadata, + OnModuleDestroy, + ExecutionContext, + CanActivate, + RpcExceptionFilter, + WsExceptionFilter, + NestInterceptor, + DynamicModule, + INestApplicationContext, +} from './interfaces'; export * from './interceptors'; export * from './services/logger.service'; export * from './pipes'; diff --git a/lib/common/interceptors/file.interceptor.d.ts b/lib/common/interceptors/file.interceptor.d.ts index 7fd0122bb1c..2c19e14b3a2 100644 --- a/lib/common/interceptors/file.interceptor.d.ts +++ b/lib/common/interceptors/file.interceptor.d.ts @@ -1,2 +1,5 @@ import { MulterOptions } from '../interfaces/external/multer-options.interface'; -export declare function FileInterceptor(fieldName: string, options?: MulterOptions): any; +export declare function FileInterceptor( + fieldName: string, + options?: MulterOptions, +): any; diff --git a/lib/common/interceptors/files.interceptor.d.ts b/lib/common/interceptors/files.interceptor.d.ts index a49e4fb6022..82c68ce825f 100644 --- a/lib/common/interceptors/files.interceptor.d.ts +++ b/lib/common/interceptors/files.interceptor.d.ts @@ -1,8 +1,16 @@ import { Observable } from 'rxjs/Observable'; import { MulterOptions } from '../interfaces/external/multer-options.interface'; -export declare function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions): { - new (): { - readonly upload: any; - intercept(request: any, context: any, stream$: Observable): Promise>; - }; +export declare function FilesInterceptor( + fieldName: string, + maxCount?: number, + options?: MulterOptions, +): { + new (): { + readonly upload: any; + intercept( + request: any, + context: any, + stream$: Observable, + ): Promise>; + }; }; diff --git a/lib/common/interfaces/can-activate.interface.d.ts b/lib/common/interfaces/can-activate.interface.d.ts index bf4497a0ff3..c2ea225a57a 100644 --- a/lib/common/interfaces/can-activate.interface.d.ts +++ b/lib/common/interfaces/can-activate.interface.d.ts @@ -1,5 +1,8 @@ import { Observable } from 'rxjs/Observable'; import { ExecutionContext } from './execution-context.interface'; export interface CanActivate { - canActivate(request: any, context: ExecutionContext): boolean | Promise | Observable; + canActivate( + request: any, + context: ExecutionContext, + ): boolean | Promise | Observable; } diff --git a/lib/common/interfaces/configuration-provider.interface.d.ts b/lib/common/interfaces/configuration-provider.interface.d.ts index effec1ee21a..8b429118451 100644 --- a/lib/common/interfaces/configuration-provider.interface.d.ts +++ b/lib/common/interfaces/configuration-provider.interface.d.ts @@ -1,6 +1,6 @@ import { NestInterceptor } from './nest-interceptor.interface'; import { CanActivate } from './can-activate.interface'; export interface ConfigurationProvider { - getGlobalInterceptors(): NestInterceptor[]; - getGlobalGuards(): CanActivate[]; + getGlobalInterceptors(): NestInterceptor[]; + getGlobalGuards(): CanActivate[]; } diff --git a/lib/common/interfaces/controllers/controller-metadata.interface.d.ts b/lib/common/interfaces/controllers/controller-metadata.interface.d.ts index b816bf9aafb..593c4054e95 100644 --- a/lib/common/interfaces/controllers/controller-metadata.interface.d.ts +++ b/lib/common/interfaces/controllers/controller-metadata.interface.d.ts @@ -1,3 +1,3 @@ export interface ControllerMetadata { - path?: string; + path?: string; } diff --git a/lib/common/interfaces/controllers/controller.interface.d.ts b/lib/common/interfaces/controllers/controller.interface.d.ts index 9089f280240..30fb9c54b43 100644 --- a/lib/common/interfaces/controllers/controller.interface.d.ts +++ b/lib/common/interfaces/controllers/controller.interface.d.ts @@ -1,2 +1 @@ -export interface Controller { -} +export interface Controller {} diff --git a/lib/common/interfaces/exceptions/exception-filter-metadata.interface.d.ts b/lib/common/interfaces/exceptions/exception-filter-metadata.interface.d.ts index 664df291cae..9fdc4997882 100644 --- a/lib/common/interfaces/exceptions/exception-filter-metadata.interface.d.ts +++ b/lib/common/interfaces/exceptions/exception-filter-metadata.interface.d.ts @@ -1,6 +1,6 @@ import { ExceptionFilter } from './exception-filter.interface'; import { Metatype } from '../metatype.interface'; export interface ExceptionFilterMetadata { - func: ExceptionFilter['catch']; - exceptionMetatypes: Metatype[]; + func: ExceptionFilter['catch']; + exceptionMetatypes: Metatype[]; } diff --git a/lib/common/interfaces/exceptions/exception-filter.interface.d.ts b/lib/common/interfaces/exceptions/exception-filter.interface.d.ts index 1c3df01069c..c7dc768c2a3 100644 --- a/lib/common/interfaces/exceptions/exception-filter.interface.d.ts +++ b/lib/common/interfaces/exceptions/exception-filter.interface.d.ts @@ -1,3 +1,3 @@ export interface ExceptionFilter { - catch(exception: any, response: any): any; + catch(exception: any, response: any): any; } diff --git a/lib/common/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts b/lib/common/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts index 85679224e67..fd9c0a28464 100644 --- a/lib/common/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts +++ b/lib/common/interfaces/exceptions/rpc-exception-filter-metadata.interface.d.ts @@ -1,6 +1,6 @@ import { RpcExceptionFilter } from './rpc-exception-filter.interface'; import { Metatype } from '../metatype.interface'; export interface RpcExceptionFilterMetadata { - func: RpcExceptionFilter['catch']; - exceptionMetatypes: Metatype[]; + func: RpcExceptionFilter['catch']; + exceptionMetatypes: Metatype[]; } diff --git a/lib/common/interfaces/exceptions/rpc-exception-filter.interface.d.ts b/lib/common/interfaces/exceptions/rpc-exception-filter.interface.d.ts index e73474c1012..428ba34a1a5 100644 --- a/lib/common/interfaces/exceptions/rpc-exception-filter.interface.d.ts +++ b/lib/common/interfaces/exceptions/rpc-exception-filter.interface.d.ts @@ -1,4 +1,4 @@ import { Observable } from 'rxjs/Observable'; export interface RpcExceptionFilter { - catch(exception: any): Observable; + catch(exception: any): Observable; } diff --git a/lib/common/interfaces/exceptions/ws-exception-filter.interface.d.ts b/lib/common/interfaces/exceptions/ws-exception-filter.interface.d.ts index 1d1994d342b..75aecdf9f03 100644 --- a/lib/common/interfaces/exceptions/ws-exception-filter.interface.d.ts +++ b/lib/common/interfaces/exceptions/ws-exception-filter.interface.d.ts @@ -1,3 +1,3 @@ export interface WsExceptionFilter { - catch(exception: any, client: any): any; + catch(exception: any, client: any): any; } diff --git a/lib/common/interfaces/execution-context.interface.d.ts b/lib/common/interfaces/execution-context.interface.d.ts index c174b8d0861..2084f61e189 100644 --- a/lib/common/interfaces/execution-context.interface.d.ts +++ b/lib/common/interfaces/execution-context.interface.d.ts @@ -1,4 +1,4 @@ export interface ExecutionContext { - parent: Function; - handler: (...args) => any; + parent: Function; + handler: (...args) => any; } diff --git a/lib/common/interfaces/external/multer-options.interface.d.ts b/lib/common/interfaces/external/multer-options.interface.d.ts index 05a38675194..eec1c1eacc1 100644 --- a/lib/common/interfaces/external/multer-options.interface.d.ts +++ b/lib/common/interfaces/external/multer-options.interface.d.ts @@ -1,48 +1,52 @@ /// export interface MulterOptions { - dest?: string; - /** The storage engine to use for uploaded files. */ - storage?: any; - /** - * An object specifying the size limits of the following optional properties. This object is passed to busboy - * directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods - */ - limits?: { - /** Max field name size (Default: 100 bytes) */ - fieldNameSize?: number; - /** Max field value size (Default: 1MB) */ - fieldSize?: number; - /** Max number of non- file fields (Default: Infinity) */ - fields?: number; - /** For multipart forms, the max file size (in bytes)(Default: Infinity) */ - fileSize?: number; - /** For multipart forms, the max number of file fields (Default: Infinity) */ - files?: number; - /** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ - parts?: number; - /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ - headerPairs?: number; - /** Keep the full path of files instead of just the base name (Default: false) */ - preservePath?: boolean; - }; - fileFilter?(req: any, file: { - /** Field name specified in the form */ - fieldname: string; - /** Name of the file on the user's computer */ - originalname: string; - /** Encoding type of the file */ - encoding: string; - /** Mime type of the file */ - mimetype: string; - /** Size of the file in bytes */ - size: number; - /** The folder to which the file has been saved (DiskStorage) */ - destination: string; - /** The name of the file within the destination (DiskStorage) */ - filename: string; - /** Location of the uploaded file (DiskStorage) */ - path: string; - /** A Buffer of the entire file (MemoryStorage) */ - buffer: Buffer; - }, callback: (error: Error | null, acceptFile: boolean) => void): void; + dest?: string; + /** The storage engine to use for uploaded files. */ + storage?: any; + /** + * An object specifying the size limits of the following optional properties. This object is passed to busboy + * directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods + */ + limits?: { + /** Max field name size (Default: 100 bytes) */ + fieldNameSize?: number; + /** Max field value size (Default: 1MB) */ + fieldSize?: number; + /** Max number of non- file fields (Default: Infinity) */ + fields?: number; + /** For multipart forms, the max file size (in bytes)(Default: Infinity) */ + fileSize?: number; + /** For multipart forms, the max number of file fields (Default: Infinity) */ + files?: number; + /** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ + parts?: number; + /** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ + headerPairs?: number; + /** Keep the full path of files instead of just the base name (Default: false) */ + preservePath?: boolean; + }; + fileFilter?( + req: any, + file: { + /** Field name specified in the form */ + fieldname: string; + /** Name of the file on the user's computer */ + originalname: string; + /** Encoding type of the file */ + encoding: string; + /** Mime type of the file */ + mimetype: string; + /** Size of the file in bytes */ + size: number; + /** The folder to which the file has been saved (DiskStorage) */ + destination: string; + /** The name of the file within the destination (DiskStorage) */ + filename: string; + /** Location of the uploaded file (DiskStorage) */ + path: string; + /** A Buffer of the entire file (MemoryStorage) */ + buffer: Buffer; + }, + callback: (error: Error | null, acceptFile: boolean) => void, + ): void; } diff --git a/lib/common/interfaces/https-options.interface.d.ts b/lib/common/interfaces/https-options.interface.d.ts index 4dae80ad83a..2ad2b1cd94c 100644 --- a/lib/common/interfaces/https-options.interface.d.ts +++ b/lib/common/interfaces/https-options.interface.d.ts @@ -1,14 +1,14 @@ export interface HttpsOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error, ctx: any) => any) => any; + pfx?: any; + key?: any; + passphrase?: string; + cert?: any; + ca?: any; + crl?: any; + ciphers?: string; + honorCipherOrder?: boolean; + requestCert?: boolean; + rejectUnauthorized?: boolean; + NPNProtocols?: any; + SNICallback?: (servername: string, cb: (err: Error, ctx: any) => any) => any; } diff --git a/lib/common/interfaces/injectable.interface.d.ts b/lib/common/interfaces/injectable.interface.d.ts index 390800ab267..a9e2b48fa51 100644 --- a/lib/common/interfaces/injectable.interface.d.ts +++ b/lib/common/interfaces/injectable.interface.d.ts @@ -1,2 +1 @@ -export interface Injectable { -} +export interface Injectable {} diff --git a/lib/common/interfaces/metatype.interface.d.ts b/lib/common/interfaces/metatype.interface.d.ts index 957b2991608..e614c6c62af 100644 --- a/lib/common/interfaces/metatype.interface.d.ts +++ b/lib/common/interfaces/metatype.interface.d.ts @@ -1,3 +1,3 @@ export interface Metatype { - new (...args: any[]): T; + new (...args: any[]): T; } diff --git a/lib/common/interfaces/microservices/custom-transport-strategy.interface.d.ts b/lib/common/interfaces/microservices/custom-transport-strategy.interface.d.ts index b743506b902..15072dab2f7 100644 --- a/lib/common/interfaces/microservices/custom-transport-strategy.interface.d.ts +++ b/lib/common/interfaces/microservices/custom-transport-strategy.interface.d.ts @@ -1,4 +1,4 @@ export interface CustomTransportStrategy { - listen(callback: () => void): any; - close(): any; + listen(callback: () => void): any; + close(): any; } diff --git a/lib/common/interfaces/microservices/microservice-configuration.interface.d.ts b/lib/common/interfaces/microservices/microservice-configuration.interface.d.ts index 831a3208d78..fab9742a3e0 100644 --- a/lib/common/interfaces/microservices/microservice-configuration.interface.d.ts +++ b/lib/common/interfaces/microservices/microservice-configuration.interface.d.ts @@ -1,9 +1,9 @@ import { CustomTransportStrategy } from './custom-transport-strategy.interface'; import { Transport } from './../../enums/transport.enum'; export interface MicroserviceConfiguration { - transport?: Transport; - url?: string; - port?: number; - host?: string; - strategy?: CustomTransportStrategy; + transport?: Transport; + url?: string; + port?: number; + host?: string; + strategy?: CustomTransportStrategy; } diff --git a/lib/common/interfaces/microservices/nest-microservice-options.interface.d.ts b/lib/common/interfaces/microservices/nest-microservice-options.interface.d.ts index 69f3394fe1c..7f55fa58fed 100644 --- a/lib/common/interfaces/microservices/nest-microservice-options.interface.d.ts +++ b/lib/common/interfaces/microservices/nest-microservice-options.interface.d.ts @@ -1,4 +1,5 @@ import { MicroserviceConfiguration } from './microservice-configuration.interface'; import { NestApplicationContextOptions } from '../nest-application-context-options.interface'; -export interface NestMicroserviceOptions extends MicroserviceConfiguration, NestApplicationContextOptions { -} +export interface NestMicroserviceOptions + extends MicroserviceConfiguration, + NestApplicationContextOptions {} diff --git a/lib/common/interfaces/middlewares/express-middleware.interface.d.ts b/lib/common/interfaces/middlewares/express-middleware.interface.d.ts index e79f9ccec25..df15c941d17 100644 --- a/lib/common/interfaces/middlewares/express-middleware.interface.d.ts +++ b/lib/common/interfaces/middlewares/express-middleware.interface.d.ts @@ -1,3 +1,3 @@ export interface ExpressMiddleware { - (req?: any, res?: any, next?: any): void; + (req?: any, res?: any, next?: any): void; } diff --git a/lib/common/interfaces/middlewares/middleware-config-proxy.interface.d.ts b/lib/common/interfaces/middlewares/middleware-config-proxy.interface.d.ts index 71a0338caa9..9a4b0c1da3b 100644 --- a/lib/common/interfaces/middlewares/middleware-config-proxy.interface.d.ts +++ b/lib/common/interfaces/middlewares/middleware-config-proxy.interface.d.ts @@ -1,24 +1,24 @@ import { MiddlewaresConsumer } from './middlewares-consumer.interface'; export interface MiddlewareConfigProxy { - /** - * Passes custom arguments to `resolve()` method of the middleware - * - * @param {} ...data - * @returns MiddlewareConfigProxy - */ - with(...data: any[]): MiddlewareConfigProxy; - /** - * Attaches passed routes / controllers to the processed middleware(s). - * Single route can be defined as a literal object: - * ``` - * path: string; - * method: RequestMethod; - * ``` - * - * When you passed Controller class, Nest will attach middleware to every HTTP route handler inside this controller. - * - * @param {} ...routes - * @returns MiddlewaresConsumer - */ - forRoutes(...routes: any[]): MiddlewaresConsumer; + /** + * Passes custom arguments to `resolve()` method of the middleware + * + * @param {} ...data + * @returns MiddlewareConfigProxy + */ + with(...data: any[]): MiddlewareConfigProxy; + /** + * Attaches passed routes / controllers to the processed middleware(s). + * Single route can be defined as a literal object: + * ``` + * path: string; + * method: RequestMethod; + * ``` + * + * When you passed Controller class, Nest will attach middleware to every HTTP route handler inside this controller. + * + * @param {} ...routes + * @returns MiddlewaresConsumer + */ + forRoutes(...routes: any[]): MiddlewaresConsumer; } diff --git a/lib/common/interfaces/middlewares/middleware-configuration.interface.d.ts b/lib/common/interfaces/middlewares/middleware-configuration.interface.d.ts index fd0be7e0223..665f6092cfa 100644 --- a/lib/common/interfaces/middlewares/middleware-configuration.interface.d.ts +++ b/lib/common/interfaces/middlewares/middleware-configuration.interface.d.ts @@ -2,8 +2,10 @@ import { ControllerMetadata } from '../controllers/controller-metadata.interface import { Controller } from '../controllers/controller.interface'; import { RequestMethod } from '../../enums/request-method.enum'; export interface MiddlewareConfiguration { - middlewares: any; - forRoutes: (Controller | ControllerMetadata & { + middlewares: any; + forRoutes: ( + | Controller + | ControllerMetadata & { method?: RequestMethod; - })[]; + })[]; } diff --git a/lib/common/interfaces/middlewares/middlewares-consumer.interface.d.ts b/lib/common/interfaces/middlewares/middlewares-consumer.interface.d.ts index 149efde4e53..d3f3d1d4d7d 100644 --- a/lib/common/interfaces/middlewares/middlewares-consumer.interface.d.ts +++ b/lib/common/interfaces/middlewares/middlewares-consumer.interface.d.ts @@ -1,11 +1,11 @@ import { MiddlewareConfigProxy } from './middleware-config-proxy.interface'; export interface MiddlewaresConsumer { - /** - * Takes single middleware class or array of classes, - * which subsequently can be attached to the passed routes / controllers. - * - * @param {any|any[]} middlewares - * @returns MiddlewareConfigProxy - */ - apply(middlewares: any | any[]): MiddlewareConfigProxy; + /** + * Takes single middleware class or array of classes, + * which subsequently can be attached to the passed routes / controllers. + * + * @param {any|any[]} middlewares + * @returns MiddlewareConfigProxy + */ + apply(middlewares: any | any[]): MiddlewareConfigProxy; } diff --git a/lib/common/interfaces/middlewares/nest-middleware.interface.d.ts b/lib/common/interfaces/middlewares/nest-middleware.interface.d.ts index 4656c6b5ea5..2d76a9dc4a4 100644 --- a/lib/common/interfaces/middlewares/nest-middleware.interface.d.ts +++ b/lib/common/interfaces/middlewares/nest-middleware.interface.d.ts @@ -1,5 +1,10 @@ import { ExpressMiddleware } from './express-middleware.interface'; export declare type AsyncExpressMiddleware = Promise; export interface NestMiddleware { - resolve(...args: any[]): ExpressMiddleware | AsyncExpressMiddleware | Promise; + resolve( + ...args: any[] + ): + | ExpressMiddleware + | AsyncExpressMiddleware + | Promise; } diff --git a/lib/common/interfaces/modules/dynamic-module.interface.d.ts b/lib/common/interfaces/modules/dynamic-module.interface.d.ts index d8711251720..7f5b45ec0f8 100644 --- a/lib/common/interfaces/modules/dynamic-module.interface.d.ts +++ b/lib/common/interfaces/modules/dynamic-module.interface.d.ts @@ -1,4 +1,4 @@ import { ModuleMetadata } from './module-metadata.interface'; export interface DynamicModule extends ModuleMetadata { - module: any; + module: any; } diff --git a/lib/common/interfaces/modules/module-metadata.interface.d.ts b/lib/common/interfaces/modules/module-metadata.interface.d.ts index db9bb9434be..2131db080c7 100644 --- a/lib/common/interfaces/modules/module-metadata.interface.d.ts +++ b/lib/common/interfaces/modules/module-metadata.interface.d.ts @@ -1,7 +1,7 @@ export interface ModuleMetadata { - imports?: any[]; - components?: any[]; - controllers?: any[]; - exports?: any[]; - modules?: any[]; + imports?: any[]; + components?: any[]; + controllers?: any[]; + exports?: any[]; + modules?: any[]; } diff --git a/lib/common/interfaces/modules/module-metatype.interface.d.ts b/lib/common/interfaces/modules/module-metatype.interface.d.ts index 4ecb8cd0333..5fb08492244 100644 --- a/lib/common/interfaces/modules/module-metatype.interface.d.ts +++ b/lib/common/interfaces/modules/module-metatype.interface.d.ts @@ -1,4 +1,3 @@ import { NestModule } from './nest-module.interface'; import { Metatype } from '../metatype.interface'; -export interface NestModuleMetatype extends Metatype { -} +export interface NestModuleMetatype extends Metatype {} diff --git a/lib/common/interfaces/modules/nest-module.interface.d.ts b/lib/common/interfaces/modules/nest-module.interface.d.ts index a18f1212b13..13c0747ab43 100644 --- a/lib/common/interfaces/modules/nest-module.interface.d.ts +++ b/lib/common/interfaces/modules/nest-module.interface.d.ts @@ -1,4 +1,4 @@ import { MiddlewaresConsumer } from '../middlewares/middlewares-consumer.interface'; export interface NestModule { - configure(consumer: MiddlewaresConsumer): MiddlewaresConsumer | void; + configure(consumer: MiddlewaresConsumer): MiddlewaresConsumer | void; } diff --git a/lib/common/interfaces/modules/on-destroy.interface.d.ts b/lib/common/interfaces/modules/on-destroy.interface.d.ts index 1ac3e2cf665..d778b2b9c42 100644 --- a/lib/common/interfaces/modules/on-destroy.interface.d.ts +++ b/lib/common/interfaces/modules/on-destroy.interface.d.ts @@ -1,3 +1,3 @@ export interface OnModuleDestroy { - onModuleDestroy(): any; + onModuleDestroy(): any; } diff --git a/lib/common/interfaces/modules/on-init.interface.d.ts b/lib/common/interfaces/modules/on-init.interface.d.ts index 2647a33334b..a59b767e974 100644 --- a/lib/common/interfaces/modules/on-init.interface.d.ts +++ b/lib/common/interfaces/modules/on-init.interface.d.ts @@ -1,3 +1,3 @@ export interface OnModuleInit { - onModuleInit(): any; + onModuleInit(): any; } diff --git a/lib/common/interfaces/nest-application-context-options.interface.d.ts b/lib/common/interfaces/nest-application-context-options.interface.d.ts index 82cc8054387..a4d219bb88d 100644 --- a/lib/common/interfaces/nest-application-context-options.interface.d.ts +++ b/lib/common/interfaces/nest-application-context-options.interface.d.ts @@ -1,4 +1,4 @@ import { LoggerService } from '../services/logger.service'; export declare class NestApplicationContextOptions { - logger?: LoggerService; + logger?: LoggerService; } diff --git a/lib/common/interfaces/nest-application-context.interface.d.ts b/lib/common/interfaces/nest-application-context.interface.d.ts index 8d3c575dd91..86a41d6be21 100644 --- a/lib/common/interfaces/nest-application-context.interface.d.ts +++ b/lib/common/interfaces/nest-application-context.interface.d.ts @@ -1,13 +1,13 @@ import { Metatype } from './metatype.interface'; export interface INestApplicationContext { - /** - * Allows you to navigate through the modules tree, for example, to pull out a specific instance from the selected module. - * @returns INestApplicationContext - */ - select(module: Metatype): INestApplicationContext; - /** - * Makes possible to retrieve the instance of the component or controller available inside the processed module. - * @returns T - */ - get(metatypeOrToken: Metatype | string | symbol): T; + /** + * Allows you to navigate through the modules tree, for example, to pull out a specific instance from the selected module. + * @returns INestApplicationContext + */ + select(module: Metatype): INestApplicationContext; + /** + * Makes possible to retrieve the instance of the component or controller available inside the processed module. + * @returns T + */ + get(metatypeOrToken: Metatype | string | symbol): T; } diff --git a/lib/common/interfaces/nest-application-options.interface.d.ts b/lib/common/interfaces/nest-application-options.interface.d.ts index 70248f344c1..05d11f44463 100644 --- a/lib/common/interfaces/nest-application-options.interface.d.ts +++ b/lib/common/interfaces/nest-application-options.interface.d.ts @@ -1,7 +1,7 @@ import { HttpsOptions } from './https-options.interface'; import { NestApplicationContextOptions } from './nest-application-context-options.interface'; export interface NestApplicationOptions extends NestApplicationContextOptions { - cors?: boolean; - bodyParser?: boolean; - httpsOptions?: HttpsOptions; + cors?: boolean; + bodyParser?: boolean; + httpsOptions?: HttpsOptions; } diff --git a/lib/common/interfaces/nest-application.interface.d.ts b/lib/common/interfaces/nest-application.interface.d.ts index 4d1023f9eec..5d9b3af5b15 100644 --- a/lib/common/interfaces/nest-application.interface.d.ts +++ b/lib/common/interfaces/nest-application.interface.d.ts @@ -4,146 +4,150 @@ import { CanActivate } from './can-activate.interface'; import { NestInterceptor } from './nest-interceptor.interface'; import { INestApplicationContext } from './nest-application-context.interface'; export interface INestApplication extends INestApplicationContext { - /** - * Initializes application. It is not necessary to call this method directly. - * - * @returns Promise - */ - init(): Promise; - /** - * A wrapper function around native `express.use()` method. - * Example `app.use(cors())` - * - * @returns void - */ - use(...args: any[]): this; - /** - * A wrapper function around native `express.set()` method. - * Example `app.set('trust proxy', 'loopback')` - * - * @returns void - */ - set(...args: any[]): this; - /** - * A wrapper function around native `express.engine()` method. - * Example `app.engine('mustache', mustacheExpress())` - * - * @returns void - */ - engine(...args: any[]): this; - /** - * A wrapper function around native `express.enable()` method. - * Example `app.enable('x-powered-by')` - * - * @returns void - */ - enable(...args: any[]): this; - /** - * Enables CORS (Cross-Origin Resource Sharing) - * - * @returns void - */ - enableCors(): this; - /** - * A wrapper function around native `express.disable()` method. - * Example `app.disable('x-powered-by')` - * - * @returns void - */ - disable(...args: any[]): this; - /** - * Starts the application. - * - * @param {number} port - * @param {string} hostname - * @param {Function} callback Optional callback - * @returns Promise - */ - listen(port: number | string, callback?: () => void): Promise; - listen(port: number | string, hostname: string, callback?: () => void): Promise; - /** - * Starts the application and can be awaited. - * - * @param {number} port - * @param {string} hostname (optional) - * @returns Promise - */ - listenAsync(port: number | string, hostname?: string): Promise; - /** - * Setups the prefix for the every HTTP route path - * - * @param {string} prefix The prefix for the every HTTP route path (for example `/v1/api`) - * @returns void - */ - setGlobalPrefix(prefix: string): this; - /** - * Setup Web Sockets Adapter, which will be used inside Gateways. - * Use, when you want to override default `socket.io` library. - * - * @param {WebSocketAdapter} adapter - * @returns void - */ - useWebSocketAdapter(adapter: WebSocketAdapter): this; - /** - * Connects microservice to the NestApplication instance. It transforms application to the hybrid instance. - * - * @param {MicroserviceConfiguration} config Microservice configuration objet - * @returns INestMicroservice - */ - connectMicroservice(config: any): INestMicroservice; - /** - * Returns array of the connected microservices to the NestApplication. - * - * @returns INestMicroservice[] - */ - getMicroservices(): INestMicroservice[]; - /** - * Returns underlying, native HTTP server. - * - * @returns http.Server - */ - getHttpServer(): any; - /** - * Starts all the connected microservices asynchronously - * - * @param {Function} callback Optional callback function - * @returns void - */ - startAllMicroservices(callback?: () => void): this; - /** - * Starts all the connected microservices and can be awaited - * - * @returns Promise - */ - startAllMicroservicesAsync(): Promise; - /** - * Setups exception filters as a global filters (will be used within every HTTP route handler) - * - * @param {ExceptionFilter[]} ...filters - */ - useGlobalFilters(...filters: ExceptionFilter[]): this; - /** - * Setups pipes as a global pipes (will be used within every HTTP route handler) - * - * @param {PipeTransform[]} ...pipes - */ - useGlobalPipes(...pipes: PipeTransform[]): this; - /** - * Setups interceptors as a global interceptors (will be used within every HTTP route handler) - * - * @param {NestInterceptor[]} ...interceptors - */ - useGlobalInterceptors(...interceptors: NestInterceptor[]): this; - /** - * Setups guards as a global guards (will be used within every HTTP route handler) - * - * @param {CanActivate[]} ...guards - */ - useGlobalGuards(...guards: CanActivate[]): this; - /** - * Terminates the application (both NestApplication, Web Socket Gateways and every connected microservice) - * - * @returns void - */ - close(): void; + /** + * Initializes application. It is not necessary to call this method directly. + * + * @returns Promise + */ + init(): Promise; + /** + * A wrapper function around native `express.use()` method. + * Example `app.use(cors())` + * + * @returns void + */ + use(...args: any[]): this; + /** + * A wrapper function around native `express.set()` method. + * Example `app.set('trust proxy', 'loopback')` + * + * @returns void + */ + set(...args: any[]): this; + /** + * A wrapper function around native `express.engine()` method. + * Example `app.engine('mustache', mustacheExpress())` + * + * @returns void + */ + engine(...args: any[]): this; + /** + * A wrapper function around native `express.enable()` method. + * Example `app.enable('x-powered-by')` + * + * @returns void + */ + enable(...args: any[]): this; + /** + * Enables CORS (Cross-Origin Resource Sharing) + * + * @returns void + */ + enableCors(): this; + /** + * A wrapper function around native `express.disable()` method. + * Example `app.disable('x-powered-by')` + * + * @returns void + */ + disable(...args: any[]): this; + /** + * Starts the application. + * + * @param {number} port + * @param {string} hostname + * @param {Function} callback Optional callback + * @returns Promise + */ + listen(port: number | string, callback?: () => void): Promise; + listen( + port: number | string, + hostname: string, + callback?: () => void, + ): Promise; + /** + * Starts the application and can be awaited. + * + * @param {number} port + * @param {string} hostname (optional) + * @returns Promise + */ + listenAsync(port: number | string, hostname?: string): Promise; + /** + * Setups the prefix for the every HTTP route path + * + * @param {string} prefix The prefix for the every HTTP route path (for example `/v1/api`) + * @returns void + */ + setGlobalPrefix(prefix: string): this; + /** + * Setup Web Sockets Adapter, which will be used inside Gateways. + * Use, when you want to override default `socket.io` library. + * + * @param {WebSocketAdapter} adapter + * @returns void + */ + useWebSocketAdapter(adapter: WebSocketAdapter): this; + /** + * Connects microservice to the NestApplication instance. It transforms application to the hybrid instance. + * + * @param {MicroserviceConfiguration} config Microservice configuration objet + * @returns INestMicroservice + */ + connectMicroservice(config: any): INestMicroservice; + /** + * Returns array of the connected microservices to the NestApplication. + * + * @returns INestMicroservice[] + */ + getMicroservices(): INestMicroservice[]; + /** + * Returns underlying, native HTTP server. + * + * @returns http.Server + */ + getHttpServer(): any; + /** + * Starts all the connected microservices asynchronously + * + * @param {Function} callback Optional callback function + * @returns void + */ + startAllMicroservices(callback?: () => void): this; + /** + * Starts all the connected microservices and can be awaited + * + * @returns Promise + */ + startAllMicroservicesAsync(): Promise; + /** + * Setups exception filters as a global filters (will be used within every HTTP route handler) + * + * @param {ExceptionFilter[]} ...filters + */ + useGlobalFilters(...filters: ExceptionFilter[]): this; + /** + * Setups pipes as a global pipes (will be used within every HTTP route handler) + * + * @param {PipeTransform[]} ...pipes + */ + useGlobalPipes(...pipes: PipeTransform[]): this; + /** + * Setups interceptors as a global interceptors (will be used within every HTTP route handler) + * + * @param {NestInterceptor[]} ...interceptors + */ + useGlobalInterceptors(...interceptors: NestInterceptor[]): this; + /** + * Setups guards as a global guards (will be used within every HTTP route handler) + * + * @param {CanActivate[]} ...guards + */ + useGlobalGuards(...guards: CanActivate[]): this; + /** + * Terminates the application (both NestApplication, Web Socket Gateways and every connected microservice) + * + * @returns void + */ + close(): void; } diff --git a/lib/common/interfaces/nest-interceptor.interface.d.ts b/lib/common/interfaces/nest-interceptor.interface.d.ts index dc3cc95f815..a60d4b16804 100644 --- a/lib/common/interfaces/nest-interceptor.interface.d.ts +++ b/lib/common/interfaces/nest-interceptor.interface.d.ts @@ -1,5 +1,9 @@ import { Observable } from 'rxjs/Observable'; import { ExecutionContext } from './execution-context.interface'; export interface NestInterceptor { - intercept(dataOrRequest: any, context: ExecutionContext, stream$: Observable): Observable | Promise>; + intercept( + dataOrRequest: any, + context: ExecutionContext, + stream$: Observable, + ): Observable | Promise>; } diff --git a/lib/common/interfaces/nest-microservice.interface.d.ts b/lib/common/interfaces/nest-microservice.interface.d.ts index 20e9814c644..8e4fb7efb8a 100644 --- a/lib/common/interfaces/nest-microservice.interface.d.ts +++ b/lib/common/interfaces/nest-microservice.interface.d.ts @@ -5,55 +5,55 @@ import { NestInterceptor } from './nest-interceptor.interface'; import { CanActivate } from './can-activate.interface'; import { INestApplicationContext } from './nest-application-context.interface'; export interface INestMicroservice extends INestApplicationContext { - /** - * Starts the microservice. - * - * @param {Function} callback Callback called after instant - * @returns Promise - */ - listen(callback: () => void): any; - /** - * Starts the microservice and can be awaited. - * - * @returns Promise - */ - listenAsync(): Promise; - /** - * Setup Web Sockets Adapter, which will be used inside Gateways. - * Use, when you want to override default `socket.io` library. - * - * @param {WebSocketAdapter} adapter - * @returns void - */ - useWebSocketAdapter(adapter: WebSocketAdapter): this; - /** - * Setups exception filters as a global filters (will be used within every message pattern handler) - * - * @param {ExceptionFilter[]} ...filters - */ - useGlobalFilters(...filters: ExceptionFilter[]): this; - /** - * Setups pipes as a global pipes (will be used within every message pattern handler) - * - * @param {PipeTransform[]} ...pipes - */ - useGlobalPipes(...pipes: PipeTransform[]): this; - /** - * Setups interceptors as a global interceptors (will be used within every message pattern handler) - * - * @param {NestInterceptor[]} ...interceptors - */ - useGlobalInterceptors(...interceptors: NestInterceptor[]): this; - /** - * Setups guards as a global guards (will be used within every message pattern handler) - * - * @param {CanActivate[]} ...guards - */ - useGlobalGuards(...guards: CanActivate[]): this; - /** - * Terminates the application (both NestMicroservice and every Web Socket Gateway) - * - * @returns void - */ - close(): void; + /** + * Starts the microservice. + * + * @param {Function} callback Callback called after instant + * @returns Promise + */ + listen(callback: () => void): any; + /** + * Starts the microservice and can be awaited. + * + * @returns Promise + */ + listenAsync(): Promise; + /** + * Setup Web Sockets Adapter, which will be used inside Gateways. + * Use, when you want to override default `socket.io` library. + * + * @param {WebSocketAdapter} adapter + * @returns void + */ + useWebSocketAdapter(adapter: WebSocketAdapter): this; + /** + * Setups exception filters as a global filters (will be used within every message pattern handler) + * + * @param {ExceptionFilter[]} ...filters + */ + useGlobalFilters(...filters: ExceptionFilter[]): this; + /** + * Setups pipes as a global pipes (will be used within every message pattern handler) + * + * @param {PipeTransform[]} ...pipes + */ + useGlobalPipes(...pipes: PipeTransform[]): this; + /** + * Setups interceptors as a global interceptors (will be used within every message pattern handler) + * + * @param {NestInterceptor[]} ...interceptors + */ + useGlobalInterceptors(...interceptors: NestInterceptor[]): this; + /** + * Setups guards as a global guards (will be used within every message pattern handler) + * + * @param {CanActivate[]} ...guards + */ + useGlobalGuards(...guards: CanActivate[]): this; + /** + * Terminates the application (both NestMicroservice and every Web Socket Gateway) + * + * @returns void + */ + close(): void; } diff --git a/lib/common/interfaces/pipe-transform.interface.d.ts b/lib/common/interfaces/pipe-transform.interface.d.ts index dcd5d1141f6..2f10e49520e 100644 --- a/lib/common/interfaces/pipe-transform.interface.d.ts +++ b/lib/common/interfaces/pipe-transform.interface.d.ts @@ -1,10 +1,13 @@ import { Paramtype } from './paramtype.interface'; -export declare type Transform = (value: T, metadata: ArgumentMetadata) => any; +export declare type Transform = ( + value: T, + metadata: ArgumentMetadata, +) => any; export interface ArgumentMetadata { - type: Paramtype; - metatype?: new (...args) => any; - data?: string; + type: Paramtype; + metatype?: new (...args) => any; + data?: string; } export interface PipeTransform { - transform(value: T, metadata: ArgumentMetadata): any; + transform(value: T, metadata: ArgumentMetadata): any; } diff --git a/lib/common/interfaces/request-mapping-metadata.interface.d.ts b/lib/common/interfaces/request-mapping-metadata.interface.d.ts index 36a1950eaf8..ebf0ef32111 100644 --- a/lib/common/interfaces/request-mapping-metadata.interface.d.ts +++ b/lib/common/interfaces/request-mapping-metadata.interface.d.ts @@ -1,5 +1,5 @@ import { RequestMethod } from '../enums/request-method.enum'; export interface RequestMappingMetadata { - path?: string; - method?: RequestMethod; + path?: string; + method?: RequestMethod; } diff --git a/lib/common/interfaces/web-socket-adapter.interface.d.ts b/lib/common/interfaces/web-socket-adapter.interface.d.ts index a970782c776..08405d39d37 100644 --- a/lib/common/interfaces/web-socket-adapter.interface.d.ts +++ b/lib/common/interfaces/web-socket-adapter.interface.d.ts @@ -1,12 +1,16 @@ import { Observable } from 'rxjs/Observable'; export interface WebSocketAdapter { - create(port: number): any; - createWithNamespace?(port: number, namespace: string, server?: any): any; - bindClientConnect(server: any, callback: (...args) => void): any; - bindClientDisconnect?(client: any, callback: (...args) => void): any; - bindMessageHandlers(client: any, handler: { - message: string; - callback: (...args) => Observable | Promise | void; - }[], process: (data) => Observable): any; - bindMiddleware?(server: any, middleware: (socket, next) => void): any; + create(port: number): any; + createWithNamespace?(port: number, namespace: string, server?: any): any; + bindClientConnect(server: any, callback: (...args) => void): any; + bindClientDisconnect?(client: any, callback: (...args) => void): any; + bindMessageHandlers( + client: any, + handler: { + message: string; + callback: (...args) => Observable | Promise | void; + }[], + process: (data) => Observable, + ): any; + bindMiddleware?(server: any, middleware: (socket, next) => void): any; } diff --git a/lib/common/pipes/parse-int.pipe.d.ts b/lib/common/pipes/parse-int.pipe.d.ts index c6bb2904048..60c20269f42 100644 --- a/lib/common/pipes/parse-int.pipe.d.ts +++ b/lib/common/pipes/parse-int.pipe.d.ts @@ -1,5 +1,5 @@ import { PipeTransform } from '../interfaces/pipe-transform.interface'; import { ArgumentMetadata } from '../index'; export declare class ParseIntPipe implements PipeTransform { - transform(value: string, metadata: ArgumentMetadata): Promise; + transform(value: string, metadata: ArgumentMetadata): Promise; } diff --git a/lib/common/pipes/validation.pipe.d.ts b/lib/common/pipes/validation.pipe.d.ts index 0f66d56cd6e..96913482f46 100644 --- a/lib/common/pipes/validation.pipe.d.ts +++ b/lib/common/pipes/validation.pipe.d.ts @@ -2,12 +2,12 @@ import { ValidatorOptions } from 'class-validator'; import { PipeTransform } from '../interfaces/pipe-transform.interface'; import { ArgumentMetadata } from '../index'; export interface ValidationPipeOptions extends ValidatorOptions { - transform?: boolean; + transform?: boolean; } export declare class ValidationPipe implements PipeTransform { - private isTransformEnabled; - private validatorOptions; - constructor(options?: ValidationPipeOptions); - transform(value: any, metadata: ArgumentMetadata): Promise; - private toValidate(metadata); + private isTransformEnabled; + private validatorOptions; + constructor(options?: ValidationPipeOptions); + transform(value: any, metadata: ArgumentMetadata): Promise; + private toValidate(metadata); } diff --git a/lib/common/services/logger.service.d.ts b/lib/common/services/logger.service.d.ts index 7054ab894d2..3ce8df0fb0c 100644 --- a/lib/common/services/logger.service.d.ts +++ b/lib/common/services/logger.service.d.ts @@ -1,26 +1,39 @@ import { NestEnvironment } from '../enums/nest-environment.enum'; export interface LoggerService { - log(message: string): void; - error(message: string, trace: string): void; - warn(message: string): void; + log(message: string): void; + error(message: string, trace: string): void; + warn(message: string): void; } export declare class Logger implements LoggerService { - private readonly context; - private readonly isTimeDiffEnabled; - private static prevTimestamp; - private static contextEnv; - private static logger; - private static readonly yellow; - constructor(context: string, isTimeDiffEnabled?: boolean); - log(message: string): void; - error(message: string, trace?: string): void; - warn(message: string): void; - static overrideLogger(logger: LoggerService): void; - static setMode(mode: NestEnvironment): void; - static log(message: string, context?: string, isTimeDiffEnabled?: boolean): void; - static error(message: string, trace?: string, context?: string, isTimeDiffEnabled?: boolean): void; - static warn(message: string, context?: string, isTimeDiffEnabled?: boolean): void; - private static printMessage(message, color, context?, isTimeDiffEnabled?); - private static printTimestamp(isTimeDiffEnabled?); - private static printStackTrace(trace); + private readonly context; + private readonly isTimeDiffEnabled; + private static prevTimestamp; + private static contextEnv; + private static logger; + private static readonly yellow; + constructor(context: string, isTimeDiffEnabled?: boolean); + log(message: string): void; + error(message: string, trace?: string): void; + warn(message: string): void; + static overrideLogger(logger: LoggerService): void; + static setMode(mode: NestEnvironment): void; + static log( + message: string, + context?: string, + isTimeDiffEnabled?: boolean, + ): void; + static error( + message: string, + trace?: string, + context?: string, + isTimeDiffEnabled?: boolean, + ): void; + static warn( + message: string, + context?: string, + isTimeDiffEnabled?: boolean, + ): void; + private static printMessage(message, color, context?, isTimeDiffEnabled?); + private static printTimestamp(isTimeDiffEnabled?); + private static printStackTrace(trace); } diff --git a/lib/common/utils/bind-resolve-values.util.d.ts b/lib/common/utils/bind-resolve-values.util.d.ts index 0a42d3550ff..213f8b10b2a 100644 --- a/lib/common/utils/bind-resolve-values.util.d.ts +++ b/lib/common/utils/bind-resolve-values.util.d.ts @@ -1,3 +1,7 @@ import { Constructor } from './merge-with-values.util'; import { NestMiddleware } from '../interfaces/middlewares/nest-middleware.interface'; -export declare const BindResolveMiddlewareValues: >(data: any[]) => (Metatype: T) => any; +export declare const BindResolveMiddlewareValues: < + T extends Constructor +>( + data: any[], +) => (Metatype: T) => any; diff --git a/lib/common/utils/forward-ref.util.d.ts b/lib/common/utils/forward-ref.util.d.ts index 0b63b96bb58..be409388f15 100644 --- a/lib/common/utils/forward-ref.util.d.ts +++ b/lib/common/utils/forward-ref.util.d.ts @@ -1,3 +1,5 @@ -export declare const forwardRef: (fn: () => any) => { - forwardRef: () => any; +export declare const forwardRef: ( + fn: () => any, +) => { + forwardRef: () => any; }; diff --git a/lib/common/utils/http-exception-body.util.d.ts b/lib/common/utils/http-exception-body.util.d.ts index e1d00f98123..53a980d2d41 100644 --- a/lib/common/utils/http-exception-body.util.d.ts +++ b/lib/common/utils/http-exception-body.util.d.ts @@ -1,9 +1,15 @@ -export declare const createHttpExceptionBody: (message: any, error: string, statusCode: number) => { - statusCode: number; - error: string; - message: any; -} | { - statusCode: number; - error: string; - message?: undefined; -}; +export declare const createHttpExceptionBody: ( + message: any, + error: string, + statusCode: number, +) => + | { + statusCode: number; + error: string; + message: any; + } + | { + statusCode: number; + error: string; + message?: undefined; + }; diff --git a/lib/common/utils/merge-with-values.util.d.ts b/lib/common/utils/merge-with-values.util.d.ts index 49a2ea3e6e3..79fe2e97a4f 100644 --- a/lib/common/utils/merge-with-values.util.d.ts +++ b/lib/common/utils/merge-with-values.util.d.ts @@ -1,7 +1,9 @@ import 'reflect-metadata'; export interface Constructor { - new (...args: any[]): T; + new (...args: any[]): T; } -export declare const MergeWithValues: >(data: { +export declare const MergeWithValues: >( + data: { [param: string]: any; -}) => (Metatype: T) => any; + }, +) => (Metatype: T) => any; diff --git a/lib/core/adapters/express-adapter.d.ts b/lib/core/adapters/express-adapter.d.ts index 72b914eba11..164dade757e 100644 --- a/lib/core/adapters/express-adapter.d.ts +++ b/lib/core/adapters/express-adapter.d.ts @@ -1,4 +1,4 @@ export declare class ExpressAdapter { - static create(): any; - static createRouter(): any; + static create(): any; + static createRouter(): any; } diff --git a/lib/core/application-config.d.ts b/lib/core/application-config.d.ts index 49c6e23e592..c7a0d4f0f5a 100644 --- a/lib/core/application-config.d.ts +++ b/lib/core/application-config.d.ts @@ -1,27 +1,33 @@ -import { PipeTransform, WebSocketAdapter, ExceptionFilter, NestInterceptor, CanActivate } from '@nestjs/common'; +import { + PipeTransform, + WebSocketAdapter, + ExceptionFilter, + NestInterceptor, + CanActivate, +} from '@nestjs/common'; import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface'; export declare class ApplicationConfig implements ConfigurationProvider { - private ioAdapter; - private globalPipes; - private globalFilters; - private globalInterceptors; - private globalGuards; - private globalPrefix; - constructor(ioAdapter?: WebSocketAdapter | null); - setGlobalPrefix(prefix: string): void; - getGlobalPrefix(): string; - setIoAdapter(ioAdapter: WebSocketAdapter): void; - getIoAdapter(): WebSocketAdapter; - addGlobalPipe(pipe: PipeTransform): void; - useGlobalPipes(...pipes: PipeTransform[]): void; - getGlobalFilters(): ExceptionFilter[]; - addGlobalFilter(filter: ExceptionFilter): void; - useGlobalFilters(...filters: ExceptionFilter[]): void; - getGlobalPipes(): PipeTransform[]; - getGlobalInterceptors(): NestInterceptor[]; - addGlobalInterceptor(interceptor: NestInterceptor): void; - useGlobalInterceptors(...interceptors: NestInterceptor[]): void; - getGlobalGuards(): CanActivate[]; - addGlobalGuard(guard: CanActivate): void; - useGlobalGuards(...guards: CanActivate[]): void; + private ioAdapter; + private globalPipes; + private globalFilters; + private globalInterceptors; + private globalGuards; + private globalPrefix; + constructor(ioAdapter?: WebSocketAdapter | null); + setGlobalPrefix(prefix: string): void; + getGlobalPrefix(): string; + setIoAdapter(ioAdapter: WebSocketAdapter): void; + getIoAdapter(): WebSocketAdapter; + addGlobalPipe(pipe: PipeTransform): void; + useGlobalPipes(...pipes: PipeTransform[]): void; + getGlobalFilters(): ExceptionFilter[]; + addGlobalFilter(filter: ExceptionFilter): void; + useGlobalFilters(...filters: ExceptionFilter[]): void; + getGlobalPipes(): PipeTransform[]; + getGlobalInterceptors(): NestInterceptor[]; + addGlobalInterceptor(interceptor: NestInterceptor): void; + useGlobalInterceptors(...interceptors: NestInterceptor[]): void; + getGlobalGuards(): CanActivate[]; + addGlobalGuard(guard: CanActivate): void; + useGlobalGuards(...guards: CanActivate[]): void; } diff --git a/lib/core/constants.d.ts b/lib/core/constants.d.ts index ac2d9f1d1ac..74a93935355 100644 --- a/lib/core/constants.d.ts +++ b/lib/core/constants.d.ts @@ -1,10 +1,10 @@ export declare const messages: { - APPLICATION_START: string; - APPLICATION_READY: string; - MICROSERVICE_READY: string; - UNKNOWN_EXCEPTION_MESSAGE: string; + APPLICATION_START: string; + APPLICATION_READY: string; + MICROSERVICE_READY: string; + UNKNOWN_EXCEPTION_MESSAGE: string; }; -export declare const APP_INTERCEPTOR = "APP_INTERCEPTOR"; -export declare const APP_PIPE = "APP_PIPE"; -export declare const APP_GUARD = "APP_GUARD"; -export declare const APP_FILTER = "APP_FILTER"; +export declare const APP_INTERCEPTOR = 'APP_INTERCEPTOR'; +export declare const APP_PIPE = 'APP_PIPE'; +export declare const APP_GUARD = 'APP_GUARD'; +export declare const APP_FILTER = 'APP_FILTER'; diff --git a/lib/core/errors/exception-handler.d.ts b/lib/core/errors/exception-handler.d.ts index 25d8ab523a8..1dc7eb8ee15 100644 --- a/lib/core/errors/exception-handler.d.ts +++ b/lib/core/errors/exception-handler.d.ts @@ -1,5 +1,5 @@ import { RuntimeException } from './exceptions/runtime.exception'; export declare class ExceptionHandler { - private static readonly logger; - handle(exception: RuntimeException | Error): void; + private static readonly logger; + handle(exception: RuntimeException | Error): void; } diff --git a/lib/core/errors/exceptions-zone.d.ts b/lib/core/errors/exceptions-zone.d.ts index 06d4efeccee..b3beb201c7e 100644 --- a/lib/core/errors/exceptions-zone.d.ts +++ b/lib/core/errors/exceptions-zone.d.ts @@ -1,5 +1,5 @@ export declare class ExceptionsZone { - private static readonly exceptionHandler; - static run(fn: () => void): void; - static asyncRun(fn: () => Promise): Promise; + private static readonly exceptionHandler; + static run(fn: () => void): void; + static asyncRun(fn: () => Promise): Promise; } diff --git a/lib/core/errors/exceptions/invalid-exception-filter.exception.d.ts b/lib/core/errors/exceptions/invalid-exception-filter.exception.d.ts index a2ed936da89..6fe54055b75 100644 --- a/lib/core/errors/exceptions/invalid-exception-filter.exception.d.ts +++ b/lib/core/errors/exceptions/invalid-exception-filter.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class InvalidExceptionFilterException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/core/errors/exceptions/invalid-middleware-configuration.exception.d.ts b/lib/core/errors/exceptions/invalid-middleware-configuration.exception.d.ts index a4bbaaa03ea..dcc64b11599 100644 --- a/lib/core/errors/exceptions/invalid-middleware-configuration.exception.d.ts +++ b/lib/core/errors/exceptions/invalid-middleware-configuration.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class InvalidMiddlewareConfigurationException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/core/errors/exceptions/invalid-middleware.exception.d.ts b/lib/core/errors/exceptions/invalid-middleware.exception.d.ts index acb777c38ac..0ea67d77198 100644 --- a/lib/core/errors/exceptions/invalid-middleware.exception.d.ts +++ b/lib/core/errors/exceptions/invalid-middleware.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class InvalidMiddlewareException extends RuntimeException { - constructor(name: string); + constructor(name: string); } diff --git a/lib/core/errors/exceptions/invalid-module.exception.d.ts b/lib/core/errors/exceptions/invalid-module.exception.d.ts index 3cd8c0093f8..9bcbe8fa646 100644 --- a/lib/core/errors/exceptions/invalid-module.exception.d.ts +++ b/lib/core/errors/exceptions/invalid-module.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class InvalidModuleException extends RuntimeException { - constructor(trace: any[]); + constructor(trace: any[]); } diff --git a/lib/core/errors/exceptions/microservices-package-not-found.exception.d.ts b/lib/core/errors/exceptions/microservices-package-not-found.exception.d.ts index 97c847a0c18..cdc117e8f3b 100644 --- a/lib/core/errors/exceptions/microservices-package-not-found.exception.d.ts +++ b/lib/core/errors/exceptions/microservices-package-not-found.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class MicroservicesPackageNotFoundException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/core/errors/exceptions/runtime.exception.d.ts b/lib/core/errors/exceptions/runtime.exception.d.ts index 2e5b6489f54..9258ce67eb3 100644 --- a/lib/core/errors/exceptions/runtime.exception.d.ts +++ b/lib/core/errors/exceptions/runtime.exception.d.ts @@ -1,11 +1,11 @@ export declare class Error { - name: string; - message: string; - stack: string; - constructor(message?: string); + name: string; + message: string; + stack: string; + constructor(message?: string); } export declare class RuntimeException extends Error { - private msg; - constructor(msg?: string); - what(): string; + private msg; + constructor(msg?: string); + what(): string; } diff --git a/lib/core/errors/exceptions/undefined-dependency.exception.d.ts b/lib/core/errors/exceptions/undefined-dependency.exception.d.ts index 70e2ef7641e..967fde9fbf6 100644 --- a/lib/core/errors/exceptions/undefined-dependency.exception.d.ts +++ b/lib/core/errors/exceptions/undefined-dependency.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class UndefinedDependencyException extends RuntimeException { - constructor(type: string, index: number, length: number); + constructor(type: string, index: number, length: number); } diff --git a/lib/core/errors/exceptions/unknown-dependencies.exception.d.ts b/lib/core/errors/exceptions/unknown-dependencies.exception.d.ts index f1627c9ba3c..4c096594781 100644 --- a/lib/core/errors/exceptions/unknown-dependencies.exception.d.ts +++ b/lib/core/errors/exceptions/unknown-dependencies.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class UnknownDependenciesException extends RuntimeException { - constructor(type: string, index: number, length: number); + constructor(type: string, index: number, length: number); } diff --git a/lib/core/errors/exceptions/unknown-export.exception.d.ts b/lib/core/errors/exceptions/unknown-export.exception.d.ts index 5246b262f5d..8d61d96b9ca 100644 --- a/lib/core/errors/exceptions/unknown-export.exception.d.ts +++ b/lib/core/errors/exceptions/unknown-export.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class UnknownExportException extends RuntimeException { - constructor(name: string); + constructor(name: string); } diff --git a/lib/core/errors/exceptions/unknown-module.exception.d.ts b/lib/core/errors/exceptions/unknown-module.exception.d.ts index effb1a0e67f..02ad09d0b1d 100644 --- a/lib/core/errors/exceptions/unknown-module.exception.d.ts +++ b/lib/core/errors/exceptions/unknown-module.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class UnknownModuleException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/core/errors/exceptions/unknown-request-mapping.exception.d.ts b/lib/core/errors/exceptions/unknown-request-mapping.exception.d.ts index 283340c2bde..b7276d884d7 100644 --- a/lib/core/errors/exceptions/unknown-request-mapping.exception.d.ts +++ b/lib/core/errors/exceptions/unknown-request-mapping.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from './runtime.exception'; export declare class UnknownRequestMappingException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/core/errors/messages.d.ts b/lib/core/errors/messages.d.ts index a5d563270a7..03f3af02891 100644 --- a/lib/core/errors/messages.d.ts +++ b/lib/core/errors/messages.d.ts @@ -1,9 +1,18 @@ -export declare const UnknownDependenciesMessage: (type: string, index: number, length: number) => string; +export declare const UnknownDependenciesMessage: ( + type: string, + index: number, + length: number, +) => string; export declare const InvalidMiddlewareMessage: (name: string) => string; export declare const InvalidModuleMessage: (scope: string) => string; export declare const UnknownExportMessage: (name: string) => string; -export declare const INVALID_MIDDLEWARE_CONFIGURATION = "Invalid middleware configuration passed inside the module 'configure()' method."; -export declare const UNKNOWN_REQUEST_MAPPING = "Request mapping properties not defined in the @RequestMapping() annotation!"; -export declare const UNHANDLED_RUNTIME_EXCEPTION = "Unhandled Runtime Exception."; -export declare const INVALID_EXCEPTION_FILTER = "Invalid exception filters (@UseFilters())."; -export declare const MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION = "Unable to load @nestjs/microservices packages (please, make sure whether it's installed already)."; +export declare const INVALID_MIDDLEWARE_CONFIGURATION = + "Invalid middleware configuration passed inside the module 'configure()' method."; +export declare const UNKNOWN_REQUEST_MAPPING = + 'Request mapping properties not defined in the @RequestMapping() annotation!'; +export declare const UNHANDLED_RUNTIME_EXCEPTION = + 'Unhandled Runtime Exception.'; +export declare const INVALID_EXCEPTION_FILTER = + 'Invalid exception filters (@UseFilters()).'; +export declare const MICROSERVICES_PACKAGE_NOT_FOUND_EXCEPTION = + "Unable to load @nestjs/microservices packages (please, make sure whether it's installed already)."; diff --git a/lib/core/exceptions/base-exception-filter-context.d.ts b/lib/core/exceptions/base-exception-filter-context.d.ts index 9bf124e6835..87e9d646e03 100644 --- a/lib/core/exceptions/base-exception-filter-context.d.ts +++ b/lib/core/exceptions/base-exception-filter-context.d.ts @@ -3,6 +3,6 @@ import { Metatype } from '@nestjs/common/interfaces/index'; import { ExceptionFilter } from '@nestjs/common/interfaces/exceptions/exception-filter.interface'; import { ContextCreator } from './../helpers/context-creator'; export declare class BaseExceptionFilterContext extends ContextCreator { - createConcreteContext(metadata: T): R; - reflectCatchExceptions(instance: ExceptionFilter): Metatype[]; + createConcreteContext(metadata: T): R; + reflectCatchExceptions(instance: ExceptionFilter): Metatype[]; } diff --git a/lib/core/exceptions/exceptions-handler.d.ts b/lib/core/exceptions/exceptions-handler.d.ts index 477dbe85fbb..299bc3f8d0e 100644 --- a/lib/core/exceptions/exceptions-handler.d.ts +++ b/lib/core/exceptions/exceptions-handler.d.ts @@ -1,9 +1,9 @@ import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions/exception-filter-metadata.interface'; import { HttpException } from '@nestjs/common'; export declare class ExceptionsHandler { - private static readonly logger; - private filters; - next(exception: Error | HttpException | any, response: any): void; - setCustomFilters(filters: ExceptionFilterMetadata[]): void; - invokeCustomFilters(exception: any, response: any): boolean; + private static readonly logger; + private filters; + next(exception: Error | HttpException | any, response: any): void; + setCustomFilters(filters: ExceptionFilterMetadata[]): void; + invokeCustomFilters(exception: any, response: any): boolean; } diff --git a/lib/core/exceptions/http-exception.d.ts b/lib/core/exceptions/http-exception.d.ts index 99c459e6476..66ff927bbcb 100644 --- a/lib/core/exceptions/http-exception.d.ts +++ b/lib/core/exceptions/http-exception.d.ts @@ -1,23 +1,23 @@ export declare class HttpException { - private readonly response; - private readonly status; - private readonly logger; - /** - * The base Nest Application exception, which is handled by the default Exceptions Handler. - * If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client. - * - * When `response` is an object: - * - object will be stringified and returned to the user as a JSON response, - * - * When `response` is a string: - * - Nest will create a response with two properties: - * ``` - * message: response, - * statusCode: X - * ``` - * @deprecated - */ - constructor(response: string | object, status: number); - getResponse(): string | object; - getStatus(): number; + private readonly response; + private readonly status; + private readonly logger; + /** + * The base Nest Application exception, which is handled by the default Exceptions Handler. + * If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client. + * + * When `response` is an object: + * - object will be stringified and returned to the user as a JSON response, + * + * When `response` is a string: + * - Nest will create a response with two properties: + * ``` + * message: response, + * statusCode: X + * ``` + * @deprecated + */ + constructor(response: string | object, status: number); + getResponse(): string | object; + getStatus(): number; } diff --git a/lib/core/guards/constants.d.ts b/lib/core/guards/constants.d.ts index f4c98c0f485..a2f6cc39193 100644 --- a/lib/core/guards/constants.d.ts +++ b/lib/core/guards/constants.d.ts @@ -1 +1 @@ -export declare const FORBIDDEN_MESSAGE = "Forbidden resource"; +export declare const FORBIDDEN_MESSAGE = 'Forbidden resource'; diff --git a/lib/core/guards/guards-consumer.d.ts b/lib/core/guards/guards-consumer.d.ts index a165b68b249..3692a34bea2 100644 --- a/lib/core/guards/guards-consumer.d.ts +++ b/lib/core/guards/guards-consumer.d.ts @@ -3,7 +3,17 @@ import { CanActivate, ExecutionContext } from '@nestjs/common'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/toPromise'; export declare class GuardsConsumer { - tryActivate(guards: CanActivate[], data: any, instance: Controller, callback: (...args) => any): Promise; - createContext(instance: Controller, callback: (...args) => any): ExecutionContext; - pickResult(result: boolean | Promise | Observable): Promise; + tryActivate( + guards: CanActivate[], + data: any, + instance: Controller, + callback: (...args) => any, + ): Promise; + createContext( + instance: Controller, + callback: (...args) => any, + ): ExecutionContext; + pickResult( + result: boolean | Promise | Observable, + ): Promise; } diff --git a/lib/core/guards/guards-context-creator.d.ts b/lib/core/guards/guards-context-creator.d.ts index c8e643e8ccb..8dd217e53e6 100644 --- a/lib/core/guards/guards-context-creator.d.ts +++ b/lib/core/guards/guards-context-creator.d.ts @@ -5,15 +5,23 @@ import { NestContainer } from '../injector/container'; import { CanActivate } from '@nestjs/common'; import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface'; export declare class GuardsContextCreator extends ContextCreator { - private readonly container; - private readonly config; - private moduleContext; - constructor(container: NestContainer, config?: ConfigurationProvider); - create(instance: Controller, callback: (...args) => any, module: string): CanActivate[]; - createConcreteContext(metadata: T): R; - createGlobalMetadataContext(metadata: T): R; - getInstanceByMetatype(metatype: any): { + private readonly container; + private readonly config; + private moduleContext; + constructor(container: NestContainer, config?: ConfigurationProvider); + create( + instance: Controller, + callback: (...args) => any, + module: string, + ): CanActivate[]; + createConcreteContext(metadata: T): R; + createGlobalMetadataContext(metadata: T): R; + getInstanceByMetatype( + metatype: any, + ): + | { instance: any; - } | undefined; - getGlobalMetadata(): T; + } + | undefined; + getGlobalMetadata(): T; } diff --git a/lib/core/helpers/context-creator.d.ts b/lib/core/helpers/context-creator.d.ts index 118262b9a0c..bc308c8b191 100644 --- a/lib/core/helpers/context-creator.d.ts +++ b/lib/core/helpers/context-creator.d.ts @@ -1,9 +1,15 @@ import 'reflect-metadata'; import { Controller } from '@nestjs/common/interfaces'; -export declare abstract class ContextCreator { - abstract createConcreteContext(metadata: T): R; - getGlobalMetadata?(): T; - createContext(instance: Controller, callback: (...args) => any, metadataKey: string): R; - reflectClassMetadata(instance: Controller, metadataKey: string): T; - reflectMethodMetadata(callback: (...args) => any, metadataKey: string): T; +export abstract class ContextCreator { + abstract createConcreteContext( + metadata: T, + ): R; + getGlobalMetadata?(): T; + createContext( + instance: Controller, + callback: (...args) => any, + metadataKey: string, + ): R; + reflectClassMetadata(instance: Controller, metadataKey: string): T; + reflectMethodMetadata(callback: (...args) => any, metadataKey: string): T; } diff --git a/lib/core/helpers/external-context-creator.d.ts b/lib/core/helpers/external-context-creator.d.ts index b63eb0846a0..7403a051214 100644 --- a/lib/core/helpers/external-context-creator.d.ts +++ b/lib/core/helpers/external-context-creator.d.ts @@ -7,13 +7,23 @@ import { Controller } from '@nestjs/common/interfaces'; import { Module } from './../injector/module'; import { ModulesContainer } from './../injector/modules-container'; export declare class ExternalContextCreator { - private readonly guardsContextCreator; - private readonly guardsConsumer; - private readonly interceptorsContextCreator; - private readonly interceptorsConsumer; - private readonly modulesContainer; - constructor(guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer, modulesContainer: ModulesContainer); - create(instance: Controller, callback: (...args) => any, methodName: string): (...args: any[]) => Promise; - findContextModuleName(constructor: Function): string; - findComponentByClassName(module: Module, className: string): boolean; + private readonly guardsContextCreator; + private readonly guardsConsumer; + private readonly interceptorsContextCreator; + private readonly interceptorsConsumer; + private readonly modulesContainer; + constructor( + guardsContextCreator: GuardsContextCreator, + guardsConsumer: GuardsConsumer, + interceptorsContextCreator: InterceptorsContextCreator, + interceptorsConsumer: InterceptorsConsumer, + modulesContainer: ModulesContainer, + ); + create( + instance: Controller, + callback: (...args) => any, + methodName: string, + ): (...args: any[]) => Promise; + findContextModuleName(constructor: Function): string; + findComponentByClassName(module: Module, className: string): boolean; } diff --git a/lib/core/helpers/messages.d.ts b/lib/core/helpers/messages.d.ts index 4f0f5732314..187b7eecf37 100644 --- a/lib/core/helpers/messages.d.ts +++ b/lib/core/helpers/messages.d.ts @@ -1,3 +1,6 @@ export declare const ModuleInitMessage: (module: string) => string; export declare const RouteMappedMessage: (path: string, method: any) => string; -export declare const ControllerMappingMessage: (name: string, path: string) => string; +export declare const ControllerMappingMessage: ( + name: string, + path: string, +) => string; diff --git a/lib/core/helpers/router-method-factory.d.ts b/lib/core/helpers/router-method-factory.d.ts index f0f487eb0ee..26fa697789f 100644 --- a/lib/core/helpers/router-method-factory.d.ts +++ b/lib/core/helpers/router-method-factory.d.ts @@ -1,4 +1,4 @@ import { RequestMethod } from '@nestjs/common/enums/request-method.enum'; export declare class RouterMethodFactory { - get(target: any, requestMethod: RequestMethod): any; + get(target: any, requestMethod: RequestMethod): any; } diff --git a/lib/core/injector/container.d.ts b/lib/core/injector/container.d.ts index 151da89db57..be32eca46e0 100644 --- a/lib/core/injector/container.d.ts +++ b/lib/core/injector/container.d.ts @@ -7,50 +7,73 @@ import { DynamicModule } from '@nestjs/common'; import { ModulesContainer } from './modules-container'; import { ApplicationConfig } from './../application-config'; export declare class NestContainer { - private readonly _applicationConfig; - private readonly globalModules; - private readonly modules; - private readonly dynamicModulesMetadata; - private readonly moduleTokenFactory; - private applicationRef; - constructor(_applicationConfig?: ApplicationConfig); - readonly applicationConfig: ApplicationConfig | undefined; - setApplicationRef(applicationRef: any): void; - getApplicationRef(): any; - addModule(metatype: NestModuleMetatype | DynamicModule, scope: NestModuleMetatype[]): void; - extractMetadata(metatype: NestModuleMetatype | DynamicModule): { - type: NestModuleMetatype; - dynamicMetadata?: Partial | undefined; - }; - isDynamicModule(module: NestModuleMetatype | DynamicModule): module is DynamicModule; - addDynamicMetadata(token: string, dynamicModuleMetadata: Partial, scope: NestModuleMetatype[]): any; - addDynamicModules(modules: any[], scope: NestModuleMetatype[]): void; - isGlobalModule(metatype: NestModuleMetatype): boolean; - addGlobalModule(module: Module): void; - getModules(): ModulesContainer; - addRelatedModule(relatedModule: NestModuleMetatype | DynamicModule, token: string): void; - addComponent(component: Metatype, token: string): string; - addInjectable(injectable: Metatype, token: string): void; - addExportedComponent(exportedComponent: Metatype, token: string): void; - addController(controller: Metatype, token: string): void; - clear(): void; - replace(toReplace: any, options: any & { - scope: any[] | null; - }): void; - bindGlobalScope(): void; - bindGlobalsToRelatedModules(module: Module): void; - bindGlobalModuleToModule(module: Module, globalModule: Module): any; - getDynamicMetadataByToken(token: string, metadataKey: keyof DynamicModule): any[]; + private readonly _applicationConfig; + private readonly globalModules; + private readonly modules; + private readonly dynamicModulesMetadata; + private readonly moduleTokenFactory; + private applicationRef; + constructor(_applicationConfig?: ApplicationConfig); + readonly applicationConfig: ApplicationConfig | undefined; + setApplicationRef(applicationRef: any): void; + getApplicationRef(): any; + addModule( + metatype: NestModuleMetatype | DynamicModule, + scope: NestModuleMetatype[], + ): void; + extractMetadata( + metatype: NestModuleMetatype | DynamicModule, + ): { + type: NestModuleMetatype; + dynamicMetadata?: Partial | undefined; + }; + isDynamicModule( + module: NestModuleMetatype | DynamicModule, + ): module is DynamicModule; + addDynamicMetadata( + token: string, + dynamicModuleMetadata: Partial, + scope: NestModuleMetatype[], + ): any; + addDynamicModules(modules: any[], scope: NestModuleMetatype[]): void; + isGlobalModule(metatype: NestModuleMetatype): boolean; + addGlobalModule(module: Module): void; + getModules(): ModulesContainer; + addRelatedModule( + relatedModule: NestModuleMetatype | DynamicModule, + token: string, + ): void; + addComponent(component: Metatype, token: string): string; + addInjectable(injectable: Metatype, token: string): void; + addExportedComponent( + exportedComponent: Metatype, + token: string, + ): void; + addController(controller: Metatype, token: string): void; + clear(): void; + replace( + toReplace: any, + options: any & { + scope: any[] | null; + }, + ): void; + bindGlobalScope(): void; + bindGlobalsToRelatedModules(module: Module): void; + bindGlobalModuleToModule(module: Module, globalModule: Module): any; + getDynamicMetadataByToken( + token: string, + metadataKey: keyof DynamicModule, + ): any[]; } export interface InstanceWrapper { - name: any; - metatype: Metatype; - instance: T; - isResolved: boolean; - isPending?: boolean; - done$?: Promise; - inject?: Metatype[]; - isNotMetatype?: boolean; - forwardRef?: boolean; - async?: boolean; + name: any; + metatype: Metatype; + instance: T; + isResolved: boolean; + isPending?: boolean; + done$?: Promise; + inject?: Metatype[]; + isNotMetatype?: boolean; + forwardRef?: boolean; + async?: boolean; } diff --git a/lib/core/injector/injector.d.ts b/lib/core/injector/injector.d.ts index 792feb155bc..6f69a35913d 100644 --- a/lib/core/injector/injector.d.ts +++ b/lib/core/injector/injector.d.ts @@ -6,48 +6,139 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.int import { Injectable } from '@nestjs/common/interfaces/injectable.interface'; import { MiddlewareWrapper } from '../middlewares/container'; export declare class Injector { - loadInstanceOfMiddleware(wrapper: MiddlewareWrapper, collection: Map, module: Module): Promise; - loadInstanceOfRoute(wrapper: InstanceWrapper, module: Module): Promise; - loadInstanceOfInjectable(wrapper: InstanceWrapper, module: Module): Promise; - loadPrototypeOfInstance({metatype, name}: InstanceWrapper, collection: Map>): any; - loadInstanceOfComponent(wrapper: InstanceWrapper, module: Module, context?: Module[]): Promise; - applyDoneSubject(wrapper: InstanceWrapper): () => void; - loadInstance(wrapper: InstanceWrapper, collection: any, module: Module, context?: Module[]): Promise; - resolveConstructorParams(wrapper: InstanceWrapper, module: Module, inject: any[], context: Module[], callback: (args) => void): Promise; - reflectConstructorParams(type: Metatype): any[]; - reflectSelfParams(type: Metatype): any[]; - resolveSingleParam(wrapper: InstanceWrapper, param: Metatype | string | symbol | any, {index, length}: { - index: number; - length: number; - }, module: Module, context: Module[]): Promise; - resolveParamToken(wrapper: InstanceWrapper, param: Metatype | string | symbol | any): any; - resolveComponentInstance(module: Module, name: any, {index, length}: { - index: number; - length: number; - }, wrapper: InstanceWrapper, context: Module[]): Promise; - scanForComponent(components: Map, module: Module, {name, index, length}: { - name: any; - index: number; - length: number; - }, {metatype}: { - metatype: any; - }, context?: Module[]): any; - scanForComponentInExports(components: Map, {name, index, length}: { - name: any; - index: number; - length: number; - }, module: Module, metatype: any, context?: Module[]): Promise; - scanForComponentInScopes(context: Module[], {name, index, length}: { - name: any; - index: number; - length: number; - }, metatype: any): any; - scanForComponentInScope(context: Module, {name, index, length}: { - name: any; - index: number; - length: number; - }, metatype: any): any; - scanForComponentInRelatedModules(module: Module, name: any, context: Module[]): Promise; - resolveFactoryInstance(factoryResult: any): Promise; - flatMap(modules: Module[]): Module[]; + loadInstanceOfMiddleware( + wrapper: MiddlewareWrapper, + collection: Map, + module: Module, + ): Promise; + loadInstanceOfRoute( + wrapper: InstanceWrapper, + module: Module, + ): Promise; + loadInstanceOfInjectable( + wrapper: InstanceWrapper, + module: Module, + ): Promise; + loadPrototypeOfInstance( + { metatype, name }: InstanceWrapper, + collection: Map>, + ): any; + loadInstanceOfComponent( + wrapper: InstanceWrapper, + module: Module, + context?: Module[], + ): Promise; + applyDoneSubject(wrapper: InstanceWrapper): () => void; + loadInstance( + wrapper: InstanceWrapper, + collection: any, + module: Module, + context?: Module[], + ): Promise; + resolveConstructorParams( + wrapper: InstanceWrapper, + module: Module, + inject: any[], + context: Module[], + callback: (args) => void, + ): Promise; + reflectConstructorParams(type: Metatype): any[]; + reflectSelfParams(type: Metatype): any[]; + resolveSingleParam( + wrapper: InstanceWrapper, + param: Metatype | string | symbol | any, + { + index, + length, + }: { + index: number; + length: number; + }, + module: Module, + context: Module[], + ): Promise; + resolveParamToken( + wrapper: InstanceWrapper, + param: Metatype | string | symbol | any, + ): any; + resolveComponentInstance( + module: Module, + name: any, + { + index, + length, + }: { + index: number; + length: number; + }, + wrapper: InstanceWrapper, + context: Module[], + ): Promise; + scanForComponent( + components: Map, + module: Module, + { + name, + index, + length, + }: { + name: any; + index: number; + length: number; + }, + { + metatype, + }: { + metatype: any; + }, + context?: Module[], + ): any; + scanForComponentInExports( + components: Map, + { + name, + index, + length, + }: { + name: any; + index: number; + length: number; + }, + module: Module, + metatype: any, + context?: Module[], + ): Promise; + scanForComponentInScopes( + context: Module[], + { + name, + index, + length, + }: { + name: any; + index: number; + length: number; + }, + metatype: any, + ): any; + scanForComponentInScope( + context: Module, + { + name, + index, + length, + }: { + name: any; + index: number; + length: number; + }, + metatype: any, + ): any; + scanForComponentInRelatedModules( + module: Module, + name: any, + context: Module[], + ): Promise; + resolveFactoryInstance(factoryResult: any): Promise; + flatMap(modules: Module[]): Module[]; } diff --git a/lib/core/injector/instance-loader.d.ts b/lib/core/injector/instance-loader.d.ts index 71a0fea8d66..2494741b86c 100644 --- a/lib/core/injector/instance-loader.d.ts +++ b/lib/core/injector/instance-loader.d.ts @@ -1,16 +1,16 @@ import { NestContainer } from './container'; export declare class InstanceLoader { - private readonly container; - private readonly injector; - private readonly logger; - constructor(container: NestContainer); - createInstancesOfDependencies(): Promise; - private createPrototypes(modules); - private createInstances(modules); - private createPrototypesOfComponents(module); - private createInstancesOfComponents(module); - private createPrototypesOfRoutes(module); - private createInstancesOfRoutes(module); - private createPrototypesOfInjectables(module); - private createInstancesOfInjectables(module); + private readonly container; + private readonly injector; + private readonly logger; + constructor(container: NestContainer); + createInstancesOfDependencies(): Promise; + private createPrototypes(modules); + private createInstances(modules); + private createPrototypesOfComponents(module); + private createInstancesOfComponents(module); + private createPrototypesOfRoutes(module); + private createInstancesOfRoutes(module); + private createPrototypesOfInjectables(module); + private createInstancesOfInjectables(module); } diff --git a/lib/core/injector/module-ref.d.ts b/lib/core/injector/module-ref.d.ts index eefe16c7326..8c4ada880b8 100644 --- a/lib/core/injector/module-ref.d.ts +++ b/lib/core/injector/module-ref.d.ts @@ -1,4 +1,4 @@ import { OpaqueToken } from './module'; -export declare abstract class ModuleRef { - abstract get(type: OpaqueToken): T; +export abstract class ModuleRef { + abstract get(type: OpaqueToken): T; } diff --git a/lib/core/injector/module-token-factory.d.ts b/lib/core/injector/module-token-factory.d.ts index 6e4713d0d02..e158a276a27 100644 --- a/lib/core/injector/module-token-factory.d.ts +++ b/lib/core/injector/module-token-factory.d.ts @@ -1,9 +1,15 @@ import { NestModuleMetatype } from '@nestjs/common/interfaces/modules/module-metatype.interface'; import { DynamicModule } from '@nestjs/common'; export declare class ModuleTokenFactory { - create(metatype: NestModuleMetatype, scope: NestModuleMetatype[], dynamicModuleMetadata?: Partial | undefined): string; - getDynamicMetadataToken(dynamicModuleMetadata: Partial | undefined): string; - getModuleName(metatype: NestModuleMetatype): string; - getScopeStack(scope: NestModuleMetatype[]): string[]; - private reflectScope(metatype); + create( + metatype: NestModuleMetatype, + scope: NestModuleMetatype[], + dynamicModuleMetadata?: Partial | undefined, + ): string; + getDynamicMetadataToken( + dynamicModuleMetadata: Partial | undefined, + ): string; + getModuleName(metatype: NestModuleMetatype): string; + getScopeStack(scope: NestModuleMetatype[]): string[]; + private reflectScope(metatype); } diff --git a/lib/core/injector/module.d.ts b/lib/core/injector/module.d.ts index ca240410f6a..6e04c1a6dbe 100644 --- a/lib/core/injector/module.d.ts +++ b/lib/core/injector/module.d.ts @@ -1,67 +1,94 @@ import { InstanceWrapper, NestContainer } from './container'; -import { Injectable, Controller, NestModule, DynamicModule } from '@nestjs/common/interfaces'; +import { + Injectable, + Controller, + NestModule, + DynamicModule, +} from '@nestjs/common/interfaces'; import { NestModuleMetatype } from '@nestjs/common/interfaces/modules/module-metatype.interface'; import { Metatype } from '@nestjs/common/interfaces/metatype.interface'; export interface CustomComponent { - provide: any; - name: string; + provide: any; + name: string; } export declare type OpaqueToken = string | symbol | object | Metatype; export declare type CustomClass = CustomComponent & { - useClass: Metatype; + useClass: Metatype; }; export declare type CustomFactory = CustomComponent & { - useFactory: (...args) => any; - inject?: OpaqueToken[]; + useFactory: (...args) => any; + inject?: OpaqueToken[]; }; export declare type CustomValue = CustomComponent & { - useValue: any; + useValue: any; }; -export declare type ComponentMetatype = Metatype | CustomFactory | CustomValue | CustomClass; +export declare type ComponentMetatype = + | Metatype + | CustomFactory + | CustomValue + | CustomClass; export declare class Module { - private readonly _metatype; - private readonly _scope; - private _relatedModules; - private _components; - private _injectables; - private _routes; - private _exports; - constructor(_metatype: NestModuleMetatype, _scope: NestModuleMetatype[], container: NestContainer); - readonly scope: NestModuleMetatype[]; - readonly relatedModules: Set; - readonly components: Map>; - readonly injectables: Map>; - readonly routes: Map>; - readonly exports: Set; - readonly instance: NestModule; - readonly metatype: NestModuleMetatype; - addCoreInjectables(container: NestContainer): void; - addModuleRef(): void; - addModuleAsComponent(): void; - addReflector(): void; - addApplicationRef(applicationRef: any): void; - addExternalContextCreator(container: NestContainer): void; - addModulesContainer(container: NestContainer): void; - addInjectable(injectable: Metatype): string; - addComponent(component: ComponentMetatype): string; - isCustomProvider(component: ComponentMetatype): component is CustomClass | CustomFactory | CustomValue; - addCustomProvider(component: CustomFactory | CustomValue | CustomClass, collection: Map): string; - isCustomClass(component: any): component is CustomClass; - isCustomValue(component: any): component is CustomValue; - isCustomFactory(component: any): component is CustomFactory; - isDynamicModule(exported: any): exported is DynamicModule; - addCustomClass(component: CustomClass, collection: Map): void; - addCustomValue(component: CustomValue, collection: Map): void; - addCustomFactory(component: CustomFactory, collection: Map): void; - addExportedComponent(exportedComponent: ComponentMetatype | string | DynamicModule): Set; - addCustomExportedComponent(exportedComponent: CustomFactory | CustomValue | CustomClass): Set; - addRoute(route: Metatype): void; - addRelatedModule(relatedModule: any): void; - replace(toReplace: any, options: any): string; - createModuleRefMetatype(components: any): { - new (): { - readonly components: any; - get(type: OpaqueToken): T; - }; + private readonly _metatype; + private readonly _scope; + private _relatedModules; + private _components; + private _injectables; + private _routes; + private _exports; + constructor( + _metatype: NestModuleMetatype, + _scope: NestModuleMetatype[], + container: NestContainer, + ); + readonly scope: NestModuleMetatype[]; + readonly relatedModules: Set; + readonly components: Map>; + readonly injectables: Map>; + readonly routes: Map>; + readonly exports: Set; + readonly instance: NestModule; + readonly metatype: NestModuleMetatype; + addCoreInjectables(container: NestContainer): void; + addModuleRef(): void; + addModuleAsComponent(): void; + addReflector(): void; + addApplicationRef(applicationRef: any): void; + addExternalContextCreator(container: NestContainer): void; + addModulesContainer(container: NestContainer): void; + addInjectable(injectable: Metatype): string; + addComponent(component: ComponentMetatype): string; + isCustomProvider( + component: ComponentMetatype, + ): component is CustomClass | CustomFactory | CustomValue; + addCustomProvider( + component: CustomFactory | CustomValue | CustomClass, + collection: Map, + ): string; + isCustomClass(component: any): component is CustomClass; + isCustomValue(component: any): component is CustomValue; + isCustomFactory(component: any): component is CustomFactory; + isDynamicModule(exported: any): exported is DynamicModule; + addCustomClass(component: CustomClass, collection: Map): void; + addCustomValue(component: CustomValue, collection: Map): void; + addCustomFactory( + component: CustomFactory, + collection: Map, + ): void; + addExportedComponent( + exportedComponent: ComponentMetatype | string | DynamicModule, + ): Set; + addCustomExportedComponent( + exportedComponent: CustomFactory | CustomValue | CustomClass, + ): Set; + addRoute(route: Metatype): void; + addRelatedModule(relatedModule: any): void; + replace(toReplace: any, options: any): string; + createModuleRefMetatype( + components: any, + ): { + new (): { + readonly components: any; + get(type: OpaqueToken): T; }; + }; } diff --git a/lib/core/injector/modules-container.d.ts b/lib/core/injector/modules-container.d.ts index 2bf3c4c04e9..7eb90a23429 100644 --- a/lib/core/injector/modules-container.d.ts +++ b/lib/core/injector/modules-container.d.ts @@ -1,3 +1,2 @@ import { Module } from './module'; -export declare class ModulesContainer extends Map { -} +export declare class ModulesContainer extends Map {} diff --git a/lib/core/injector/tokens.d.ts b/lib/core/injector/tokens.d.ts index a0a30448b40..9257c1c4355 100644 --- a/lib/core/injector/tokens.d.ts +++ b/lib/core/injector/tokens.d.ts @@ -1 +1 @@ -export declare const EXPRESS_REF = "EXPRESS_REF"; +export declare const EXPRESS_REF = 'EXPRESS_REF'; diff --git a/lib/core/interceptors/interceptors-consumer.d.ts b/lib/core/interceptors/interceptors-consumer.d.ts index 293afc6e5db..98b3eb2709f 100644 --- a/lib/core/interceptors/interceptors-consumer.d.ts +++ b/lib/core/interceptors/interceptors-consumer.d.ts @@ -7,7 +7,16 @@ import 'rxjs/add/observable/fromPromise'; import 'rxjs/add/operator/take'; import 'rxjs/add/operator/switchMap'; export declare class InterceptorsConsumer { - intercept(interceptors: NestInterceptor[], dataOrRequest: any, instance: Controller, callback: (...args) => any, next: () => Promise): Promise; - createContext(instance: Controller, callback: (...args) => any): ExecutionContext; - transformDeffered(next: () => Promise): Observable; + intercept( + interceptors: NestInterceptor[], + dataOrRequest: any, + instance: Controller, + callback: (...args) => any, + next: () => Promise, + ): Promise; + createContext( + instance: Controller, + callback: (...args) => any, + ): ExecutionContext; + transformDeffered(next: () => Promise): Observable; } diff --git a/lib/core/interceptors/interceptors-context-creator.d.ts b/lib/core/interceptors/interceptors-context-creator.d.ts index f8e7acf5741..b6326f7adb5 100644 --- a/lib/core/interceptors/interceptors-context-creator.d.ts +++ b/lib/core/interceptors/interceptors-context-creator.d.ts @@ -4,15 +4,23 @@ import { ContextCreator } from './../helpers/context-creator'; import { NestContainer } from '../injector/container'; import { ConfigurationProvider } from '@nestjs/common/interfaces/configuration-provider.interface'; export declare class InterceptorsContextCreator extends ContextCreator { - private readonly container; - private readonly config; - private moduleContext; - constructor(container: NestContainer, config?: ConfigurationProvider); - create(instance: Controller, callback: (...args) => any, module: string): NestInterceptor[]; - createConcreteContext(metadata: T): R; - createGlobalMetadataContext(metadata: T): R; - getInstanceByMetatype(metatype: any): { + private readonly container; + private readonly config; + private moduleContext; + constructor(container: NestContainer, config?: ConfigurationProvider); + create( + instance: Controller, + callback: (...args) => any, + module: string, + ): NestInterceptor[]; + createConcreteContext(metadata: T): R; + createGlobalMetadataContext(metadata: T): R; + getInstanceByMetatype( + metatype: any, + ): + | { instance: any; - } | undefined; - getGlobalMetadata(): T; + } + | undefined; + getGlobalMetadata(): T; } diff --git a/lib/core/metadata-scanner.d.ts b/lib/core/metadata-scanner.d.ts index dd0dc340eb5..5e444a1a2a0 100644 --- a/lib/core/metadata-scanner.d.ts +++ b/lib/core/metadata-scanner.d.ts @@ -1,5 +1,9 @@ import { Injectable } from '@nestjs/common/interfaces/injectable.interface'; export declare class MetadataScanner { - scanFromPrototype(instance: T, prototype: any, callback: (name: string) => R): R[]; - getAllFilteredMethodNames(prototype: any): IterableIterator; + scanFromPrototype( + instance: T, + prototype: any, + callback: (name: string) => R, + ): R[]; + getAllFilteredMethodNames(prototype: any): IterableIterator; } diff --git a/lib/core/middlewares/builder.d.ts b/lib/core/middlewares/builder.d.ts index 69fd53603c5..ebe6760a50b 100644 --- a/lib/core/middlewares/builder.d.ts +++ b/lib/core/middlewares/builder.d.ts @@ -3,17 +3,17 @@ import { MiddlewaresConsumer } from '@nestjs/common/interfaces'; import { MiddlewareConfigProxy } from '@nestjs/common/interfaces/middlewares'; import { RoutesMapper } from './routes-mapper'; export declare class MiddlewareBuilder implements MiddlewaresConsumer { - private readonly routesMapper; - private readonly middlewaresCollection; - private readonly logger; - constructor(routesMapper: RoutesMapper); - apply(middlewares: any | any[]): MiddlewareConfigProxy; - /** - * @deprecated - * Since version RC.6 this method is deprecated. Use apply() instead. - */ - use(configuration: MiddlewareConfiguration): this; - build(): MiddlewareConfiguration[]; - private bindValuesToResolve(middlewares, resolveParams); - private static ConfigProxy; + private readonly routesMapper; + private readonly middlewaresCollection; + private readonly logger; + constructor(routesMapper: RoutesMapper); + apply(middlewares: any | any[]): MiddlewareConfigProxy; + /** + * @deprecated + * Since version RC.6 this method is deprecated. Use apply() instead. + */ + use(configuration: MiddlewareConfiguration): this; + build(): MiddlewareConfiguration[]; + private bindValuesToResolve(middlewares, resolveParams); + private static ConfigProxy; } diff --git a/lib/core/middlewares/container.d.ts b/lib/core/middlewares/container.d.ts index 849e47d0c7c..ef56f57897f 100644 --- a/lib/core/middlewares/container.d.ts +++ b/lib/core/middlewares/container.d.ts @@ -2,15 +2,15 @@ import { MiddlewareConfiguration } from '@nestjs/common/interfaces/middlewares/m import { NestMiddleware } from '@nestjs/common/interfaces/middlewares/nest-middleware.interface'; import { Metatype } from '@nestjs/common/interfaces/metatype.interface'; export declare class MiddlewaresContainer { - private readonly middlewares; - private readonly configs; - getMiddlewares(module: string): Map; - getConfigs(): Map>; - addConfig(configList: MiddlewareConfiguration[], module: string): void; - private getCurrentMiddlewares(module); - private getCurrentConfig(module); + private readonly middlewares; + private readonly configs; + getMiddlewares(module: string): Map; + getConfigs(): Map>; + addConfig(configList: MiddlewareConfiguration[], module: string): void; + private getCurrentMiddlewares(module); + private getCurrentConfig(module); } export interface MiddlewareWrapper { - instance: NestMiddleware; - metatype: Metatype; + instance: NestMiddleware; + metatype: Metatype; } diff --git a/lib/core/middlewares/middlewares-module.d.ts b/lib/core/middlewares/middlewares-module.d.ts index ba5e0ef4f8b..c0de70b6206 100644 --- a/lib/core/middlewares/middlewares-module.d.ts +++ b/lib/core/middlewares/middlewares-module.d.ts @@ -7,19 +7,44 @@ import { RequestMethod } from '@nestjs/common/enums/request-method.enum'; import { Module } from '../injector/module'; import { ApplicationConfig } from './../application-config'; export declare class MiddlewaresModule { - private readonly routesMapper; - private readonly routerProxy; - private readonly routerMethodFactory; - private routerExceptionFilter; - private resolver; - setup(middlewaresContainer: MiddlewaresContainer, container: NestContainer, config: ApplicationConfig): Promise; - resolveMiddlewares(middlewaresContainer: MiddlewaresContainer, modules: Map): Promise; - loadConfiguration(middlewaresContainer: MiddlewaresContainer, instance: NestModule, module: string): void; - setupMiddlewares(middlewaresContainer: MiddlewaresContainer, app: any): Promise; - setupMiddlewareConfig(middlewaresContainer: MiddlewaresContainer, config: MiddlewareConfiguration, module: string, app: any): Promise; - setupRouteMiddleware(middlewaresContainer: MiddlewaresContainer, route: ControllerMetadata & { - method: RequestMethod; - }, config: MiddlewareConfiguration, module: string, app: any): Promise; - private setupHandler(instance, metatype, app, method, path); - private setupHandlerWithProxy(exceptionsHandler, router, middleware, path); + private readonly routesMapper; + private readonly routerProxy; + private readonly routerMethodFactory; + private routerExceptionFilter; + private resolver; + setup( + middlewaresContainer: MiddlewaresContainer, + container: NestContainer, + config: ApplicationConfig, + ): Promise; + resolveMiddlewares( + middlewaresContainer: MiddlewaresContainer, + modules: Map, + ): Promise; + loadConfiguration( + middlewaresContainer: MiddlewaresContainer, + instance: NestModule, + module: string, + ): void; + setupMiddlewares( + middlewaresContainer: MiddlewaresContainer, + app: any, + ): Promise; + setupMiddlewareConfig( + middlewaresContainer: MiddlewaresContainer, + config: MiddlewareConfiguration, + module: string, + app: any, + ): Promise; + setupRouteMiddleware( + middlewaresContainer: MiddlewaresContainer, + route: ControllerMetadata & { + method: RequestMethod; + }, + config: MiddlewareConfiguration, + module: string, + app: any, + ): Promise; + private setupHandler(instance, metatype, app, method, path); + private setupHandlerWithProxy(exceptionsHandler, router, middleware, path); } diff --git a/lib/core/middlewares/resolver.d.ts b/lib/core/middlewares/resolver.d.ts index cd82405f852..4114bdbbbca 100644 --- a/lib/core/middlewares/resolver.d.ts +++ b/lib/core/middlewares/resolver.d.ts @@ -1,9 +1,9 @@ import { MiddlewaresContainer } from './container'; import { Module } from '../injector/module'; export declare class MiddlewaresResolver { - private readonly middlewaresContainer; - private readonly instanceLoader; - constructor(middlewaresContainer: MiddlewaresContainer); - resolveInstances(module: Module, moduleName: string): Promise; - private resolveMiddlewareInstance(wrapper, middlewares, module); + private readonly middlewaresContainer; + private readonly instanceLoader; + constructor(middlewaresContainer: MiddlewaresContainer); + resolveInstances(module: Module, moduleName: string): Promise; + private resolveMiddlewareInstance(wrapper, middlewares, module); } diff --git a/lib/core/middlewares/routes-mapper.d.ts b/lib/core/middlewares/routes-mapper.d.ts index 7edc27cf9a8..ac414667f6a 100644 --- a/lib/core/middlewares/routes-mapper.d.ts +++ b/lib/core/middlewares/routes-mapper.d.ts @@ -1,11 +1,13 @@ import 'reflect-metadata'; export declare class RoutesMapper { - private readonly routerExplorer; - mapRouteToRouteProps(routeMetatype: any): { - path: string; - method: any; - }[]; - private mapObjectToRouteProps(route); - private validateGlobalPath(path); - private validateRoutePath(path); + private readonly routerExplorer; + mapRouteToRouteProps( + routeMetatype: any, + ): { + path: string; + method: any; + }[]; + private mapObjectToRouteProps(route); + private validateGlobalPath(path); + private validateRoutePath(path); } diff --git a/lib/core/nest-application-context.d.ts b/lib/core/nest-application-context.d.ts index 110a74083fe..310867bd3a6 100644 --- a/lib/core/nest-application-context.d.ts +++ b/lib/core/nest-application-context.d.ts @@ -3,13 +3,17 @@ import { NestModuleMetatype } from '@nestjs/common/interfaces/modules/module-met import { Metatype } from '@nestjs/common/interfaces'; import { INestApplicationContext } from '@nestjs/common'; export declare class NestApplicationContext implements INestApplicationContext { - protected readonly container: NestContainer; - private readonly scope; - protected contextModule: any; - private readonly moduleTokenFactory; - constructor(container: NestContainer, scope: NestModuleMetatype[], contextModule: any); - selectContextModule(): void; - select(module: Metatype): INestApplicationContext; - get(metatypeOrToken: Metatype | string | symbol): T; - private findInstanceByPrototypeOrToken(metatypeOrToken); + protected readonly container: NestContainer; + private readonly scope; + protected contextModule: any; + private readonly moduleTokenFactory; + constructor( + container: NestContainer, + scope: NestModuleMetatype[], + contextModule: any, + ); + selectContextModule(): void; + select(module: Metatype): INestApplicationContext; + get(metatypeOrToken: Metatype | string | symbol): T; + private findInstanceByPrototypeOrToken(metatypeOrToken); } diff --git a/lib/core/nest-application.d.ts b/lib/core/nest-application.d.ts index bd4bf54c5e4..1fc3f7767ee 100644 --- a/lib/core/nest-application.d.ts +++ b/lib/core/nest-application.d.ts @@ -1,6 +1,12 @@ /// import * as http from 'http'; -import { CanActivate, ExceptionFilter, NestInterceptor, PipeTransform, WebSocketAdapter } from '@nestjs/common'; +import { + CanActivate, + ExceptionFilter, + NestInterceptor, + PipeTransform, + WebSocketAdapter, +} from '@nestjs/common'; import { INestApplication, INestMicroservice } from '@nestjs/common'; import { MicroserviceConfiguration } from '@nestjs/common/interfaces/microservices/microservice-configuration.interface'; import { ApplicationConfig } from './application-config'; @@ -8,54 +14,60 @@ import { NestContainer } from './injector/container'; import { NestApplicationContext } from './nest-application-context'; import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface'; import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface'; -export declare class NestApplication extends NestApplicationContext implements INestApplication { - private readonly express; - private readonly config; - private readonly appOptions; - private readonly logger; - private readonly middlewaresModule; - private readonly middlewaresContainer; - private readonly microservicesModule; - private readonly socketModule; - private readonly httpServer; - private readonly routesResolver; - private readonly microservices; - private isInitialized; - constructor(container: NestContainer, express: any, config: ApplicationConfig, appOptions?: NestApplicationOptions); - applyOptions(): this; - createServer(): any; - setupModules(): Promise; - init(): Promise; - setupParserMiddlewares(): void; - isMiddlewareApplied(app: any, name: string): boolean; - setupRouter(): Promise; - connectMicroservice(config: MicroserviceConfiguration): INestMicroservice; - getMicroservices(): INestMicroservice[]; - getHttpServer(): http.Server; - startAllMicroservices(callback?: () => void): this; - startAllMicroservicesAsync(): Promise; - use(...args: any[]): this; - engine(...args: any[]): this; - set(...args: any[]): this; - disable(...args: any[]): this; - enable(...args: any[]): this; - enableCors(options?: CorsOptions): this; - listen(port: number | string, callback?: () => void): any; - listen(port: number | string, hostname: string, callback?: () => void): any; - listenAsync(port: number | string, hostname?: string): Promise; - close(): void; - setGlobalPrefix(prefix: string): this; - useWebSocketAdapter(adapter: WebSocketAdapter): this; - useGlobalFilters(...filters: ExceptionFilter[]): this; - useGlobalPipes(...pipes: PipeTransform[]): this; - useGlobalInterceptors(...interceptors: NestInterceptor[]): this; - useGlobalGuards(...guards: CanActivate[]): this; - private setupMiddlewares(instance); - private listenToPromise(microservice); - private callInitHook(); - private callModuleInitHook(module); - private hasOnModuleInitHook(instance); - private callDestroyHook(); - private callModuleDestroyHook(module); - private hasOnModuleDestroyHook(instance); +export declare class NestApplication extends NestApplicationContext + implements INestApplication { + private readonly express; + private readonly config; + private readonly appOptions; + private readonly logger; + private readonly middlewaresModule; + private readonly middlewaresContainer; + private readonly microservicesModule; + private readonly socketModule; + private readonly httpServer; + private readonly routesResolver; + private readonly microservices; + private isInitialized; + constructor( + container: NestContainer, + express: any, + config: ApplicationConfig, + appOptions?: NestApplicationOptions, + ); + applyOptions(): this; + createServer(): any; + setupModules(): Promise; + init(): Promise; + setupParserMiddlewares(): void; + isMiddlewareApplied(app: any, name: string): boolean; + setupRouter(): Promise; + connectMicroservice(config: MicroserviceConfiguration): INestMicroservice; + getMicroservices(): INestMicroservice[]; + getHttpServer(): http.Server; + startAllMicroservices(callback?: () => void): this; + startAllMicroservicesAsync(): Promise; + use(...args: any[]): this; + engine(...args: any[]): this; + set(...args: any[]): this; + disable(...args: any[]): this; + enable(...args: any[]): this; + enableCors(options?: CorsOptions): this; + listen(port: number | string, callback?: () => void): any; + listen(port: number | string, hostname: string, callback?: () => void): any; + listenAsync(port: number | string, hostname?: string): Promise; + close(): void; + setGlobalPrefix(prefix: string): this; + useWebSocketAdapter(adapter: WebSocketAdapter): this; + useGlobalFilters(...filters: ExceptionFilter[]): this; + useGlobalPipes(...pipes: PipeTransform[]): this; + useGlobalInterceptors(...interceptors: NestInterceptor[]): this; + useGlobalGuards(...guards: CanActivate[]): this; + private setupMiddlewares(instance); + private listenToPromise(microservice); + private callInitHook(); + private callModuleInitHook(module); + private hasOnModuleInitHook(instance); + private callDestroyHook(); + private callModuleDestroyHook(module); + private hasOnModuleDestroyHook(instance); } diff --git a/lib/core/nest-factory.d.ts b/lib/core/nest-factory.d.ts index 8670e0f87f0..0318ead7cba 100644 --- a/lib/core/nest-factory.d.ts +++ b/lib/core/nest-factory.d.ts @@ -1,36 +1,53 @@ import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface'; -import { INestApplication, INestMicroservice, INestApplicationContext } from '@nestjs/common'; +import { + INestApplication, + INestMicroservice, + INestApplicationContext, +} from '@nestjs/common'; import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface'; import { NestMicroserviceOptions } from '@nestjs/common/interfaces/microservices/nest-microservice-options.interface'; export declare class NestFactoryStatic { - private readonly logger; - /** - * Creates an instance of the NestApplication (returns Promise) - * @returns an `Promise` of the INestApplication instance - */ - create(module: any): Promise; - create(module: any, options: NestApplicationOptions): Promise; - create(module: any, express: any, options: NestApplicationOptions): Promise; - /** - * Creates an instance of the NestMicroservice (returns Promise) - * - * @param {} module Entry (root) application module class - * @param {NestMicroserviceOptions} options Optional microservice configuration - * @returns an `Promise` of the INestMicroservice instance - */ - createMicroservice(module: any, options?: NestMicroserviceOptions): Promise; - /** - * Creates an instance of the NestApplicationContext (returns Promise) - * - * @param {} module Entry (root) application module class - * @param {NestApplicationContextOptions} options Optional Nest application configuration - * @returns an `Promise` of the INestApplicationContext instance - */ - createApplicationContext(module: any, options?: NestApplicationContextOptions): Promise; - private createNestInstance(instance); - private initialize(module, container, config?, express?); - private createProxy(target); - private createExceptionProxy(); - private applyLogger(options); + private readonly logger; + /** + * Creates an instance of the NestApplication (returns Promise) + * @returns an `Promise` of the INestApplication instance + */ + create(module: any): Promise; + create( + module: any, + options: NestApplicationOptions, + ): Promise; + create( + module: any, + express: any, + options: NestApplicationOptions, + ): Promise; + /** + * Creates an instance of the NestMicroservice (returns Promise) + * + * @param {} module Entry (root) application module class + * @param {NestMicroserviceOptions} options Optional microservice configuration + * @returns an `Promise` of the INestMicroservice instance + */ + createMicroservice( + module: any, + options?: NestMicroserviceOptions, + ): Promise; + /** + * Creates an instance of the NestApplicationContext (returns Promise) + * + * @param {} module Entry (root) application module class + * @param {NestApplicationContextOptions} options Optional Nest application configuration + * @returns an `Promise` of the INestApplicationContext instance + */ + createApplicationContext( + module: any, + options?: NestApplicationContextOptions, + ): Promise; + private createNestInstance(instance); + private initialize(module, container, config?, express?); + private createProxy(target); + private createExceptionProxy(); + private applyLogger(options); } export declare const NestFactory: NestFactoryStatic; diff --git a/lib/core/pipes/params-token-factory.d.ts b/lib/core/pipes/params-token-factory.d.ts index 221008b8935..0e44024ff54 100644 --- a/lib/core/pipes/params-token-factory.d.ts +++ b/lib/core/pipes/params-token-factory.d.ts @@ -1,5 +1,5 @@ import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum'; import { Paramtype } from '@nestjs/common'; export declare class ParamsTokenFactory { - exchangeEnumForString(type: RouteParamtypes): Paramtype; + exchangeEnumForString(type: RouteParamtypes): Paramtype; } diff --git a/lib/core/pipes/pipes-consumer.d.ts b/lib/core/pipes/pipes-consumer.d.ts index 0ab5d8f6d19..43ac986b80e 100644 --- a/lib/core/pipes/pipes-consumer.d.ts +++ b/lib/core/pipes/pipes-consumer.d.ts @@ -1,14 +1,30 @@ import { Transform } from '@nestjs/common/interfaces'; export declare class PipesConsumer { - private readonly paramsTokenFactory; - apply(value: any, {metatype, type, data}: { - metatype: any; - type: any; - data: any; - }, transforms: Transform[]): Promise; - applyPipes(value: any, {metatype, type, data}: { - metatype; - type?; - data?; - }, transforms: Transform[]): Promise; + private readonly paramsTokenFactory; + apply( + value: any, + { + metatype, + type, + data, + }: { + metatype: any; + type: any; + data: any; + }, + transforms: Transform[], + ): Promise; + applyPipes( + value: any, + { + metatype, + type, + data, + }: { + metatype; + type?; + data?; + }, + transforms: Transform[], + ): Promise; } diff --git a/lib/core/pipes/pipes-context-creator.d.ts b/lib/core/pipes/pipes-context-creator.d.ts index f627cb58425..e4c2a4a3e65 100644 --- a/lib/core/pipes/pipes-context-creator.d.ts +++ b/lib/core/pipes/pipes-context-creator.d.ts @@ -3,9 +3,9 @@ import { Controller, Transform } from '@nestjs/common/interfaces'; import { ApplicationConfig } from './../application-config'; import { ContextCreator } from './../helpers/context-creator'; export declare class PipesContextCreator extends ContextCreator { - private readonly config; - constructor(config?: ApplicationConfig); - create(instance: Controller, callback: (...args) => any): Transform[]; - createConcreteContext(metadata: T): R; - getGlobalMetadata(): T; + private readonly config; + constructor(config?: ApplicationConfig); + create(instance: Controller, callback: (...args) => any): Transform[]; + createConcreteContext(metadata: T): R; + getGlobalMetadata(): T; } diff --git a/lib/core/router/interfaces/exceptions-filter.interface.d.ts b/lib/core/router/interfaces/exceptions-filter.interface.d.ts index d2b0809070b..1d48ec311b4 100644 --- a/lib/core/router/interfaces/exceptions-filter.interface.d.ts +++ b/lib/core/router/interfaces/exceptions-filter.interface.d.ts @@ -1,5 +1,5 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface'; import { ExceptionsHandler } from '../../exceptions/exceptions-handler'; export interface ExceptionsFilter { - create(instance: Controller, callback: any): ExceptionsHandler; + create(instance: Controller, callback: any): ExceptionsHandler; } diff --git a/lib/core/router/interfaces/explorer.inteface.d.ts b/lib/core/router/interfaces/explorer.inteface.d.ts index 60d38221b15..465164c53a9 100644 --- a/lib/core/router/interfaces/explorer.inteface.d.ts +++ b/lib/core/router/interfaces/explorer.inteface.d.ts @@ -1,6 +1,10 @@ import { Controller } from '@nestjs/common/interfaces/index'; import { Metatype } from '@nestjs/common/interfaces/metatype.interface'; export interface RouterExplorer { - explore(instance: Controller, metatype: Metatype, module: string): any; - fetchRouterPath(metatype: Metatype, prefix?: string): string; + explore( + instance: Controller, + metatype: Metatype, + module: string, + ): any; + fetchRouterPath(metatype: Metatype, prefix?: string): string; } diff --git a/lib/core/router/interfaces/resolver.interface.d.ts b/lib/core/router/interfaces/resolver.interface.d.ts index 063bc4239dd..b30f0dc148d 100644 --- a/lib/core/router/interfaces/resolver.interface.d.ts +++ b/lib/core/router/interfaces/resolver.interface.d.ts @@ -1,3 +1,3 @@ export interface Resolver { - resolve(router: any, express: any): any; + resolve(router: any, express: any): any; } diff --git a/lib/core/router/interfaces/route-params-factory.interface.d.ts b/lib/core/router/interfaces/route-params-factory.interface.d.ts index 7136dfe54b5..158ca159a23 100644 --- a/lib/core/router/interfaces/route-params-factory.interface.d.ts +++ b/lib/core/router/interfaces/route-params-factory.interface.d.ts @@ -1,8 +1,16 @@ import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum'; export interface IRouteParamsFactory { - exchangeKeyForValue(key: RouteParamtypes | string, data: any, {req, res, next}: { - req: any; - res: any; - next: any; - }): any; + exchangeKeyForValue( + key: RouteParamtypes | string, + data: any, + { + req, + res, + next, + }: { + req: any; + res: any; + next: any; + }, + ): any; } diff --git a/lib/core/router/route-params-factory.d.ts b/lib/core/router/route-params-factory.d.ts index 0c0d4fcc32c..e0a54ffe397 100644 --- a/lib/core/router/route-params-factory.d.ts +++ b/lib/core/router/route-params-factory.d.ts @@ -1,9 +1,17 @@ import { RouteParamtypes } from '@nestjs/common/enums/route-paramtypes.enum'; import { IRouteParamsFactory } from './interfaces/route-params-factory.interface'; export declare class RouteParamsFactory implements IRouteParamsFactory { - exchangeKeyForValue(key: RouteParamtypes | string, data: any, {req, res, next}: { - req: any; - res: any; - next: any; - }): any; + exchangeKeyForValue( + key: RouteParamtypes | string, + data: any, + { + req, + res, + next, + }: { + req: any; + res: any; + next: any; + }, + ): any; } diff --git a/lib/core/router/router-exception-filters.d.ts b/lib/core/router/router-exception-filters.d.ts index 21387c4e346..09333ec36f8 100644 --- a/lib/core/router/router-exception-filters.d.ts +++ b/lib/core/router/router-exception-filters.d.ts @@ -5,8 +5,11 @@ import { RouterProxyCallback } from './../router/router-proxy'; import { ApplicationConfig } from './../application-config'; import { BaseExceptionFilterContext } from '../exceptions/base-exception-filter-context'; export declare class RouterExceptionFilters extends BaseExceptionFilterContext { - private readonly config; - constructor(config: ApplicationConfig); - create(instance: Controller, callback: RouterProxyCallback): ExceptionsHandler; - getGlobalMetadata(): T; + private readonly config; + constructor(config: ApplicationConfig); + create( + instance: Controller, + callback: RouterProxyCallback, + ): ExceptionsHandler; + getGlobalMetadata(): T; } diff --git a/lib/core/router/router-execution-context.d.ts b/lib/core/router/router-execution-context.d.ts index 5a876e3a8e1..2a80f43c812 100644 --- a/lib/core/router/router-execution-context.d.ts +++ b/lib/core/router/router-execution-context.d.ts @@ -11,43 +11,85 @@ import { GuardsConsumer } from '../guards/guards-consumer'; import { InterceptorsContextCreator } from '../interceptors/interceptors-context-creator'; import { InterceptorsConsumer } from '../interceptors/interceptors-consumer'; export interface ParamProperties { - index: number; - type: RouteParamtypes | string; - data: ParamData; - pipes: PipeTransform[]; - extractValue: (req, res, next) => any; + index: number; + type: RouteParamtypes | string; + data: ParamData; + pipes: PipeTransform[]; + extractValue: (req, res, next) => any; } export declare class RouterExecutionContext { - private readonly paramsFactory; - private readonly pipesContextCreator; - private readonly pipesConsumer; - private readonly guardsContextCreator; - private readonly guardsConsumer; - private readonly interceptorsContextCreator; - private readonly interceptorsConsumer; - private readonly responseController; - constructor(paramsFactory: IRouteParamsFactory, pipesContextCreator: PipesContextCreator, pipesConsumer: PipesConsumer, guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer); - create(instance: Controller, callback: (...args) => any, methodName: string, module: string, requestMethod: RequestMethod): (req: any, res: any, next: any) => Promise; - mapParamType(key: string): string; - reflectCallbackMetadata(instance: Controller, methodName: string): RouteParamsMetadata; - reflectCallbackParamtypes(instance: Controller, methodName: string): any[]; - reflectHttpStatusCode(callback: (...args) => any): number; - reflectRenderTemplate(callback: any): boolean; - getArgumentsLength(keys: string[], metadata: RouteParamsMetadata): number; - createNullArray(length: number): any[]; - exchangeKeysForValues(keys: string[], metadata: RouteParamsMetadata): ParamProperties[]; - getCustomFactory(factory: (...args) => void, data: any): (...args) => any; - mergeParamsMetatypes(paramsProperties: ParamProperties[], paramtypes: any[]): (ParamProperties & { - metatype?: any; - })[]; - getParamValue(value: T, {metatype, type, data}: { - metatype: any; - type: any; - data: any; - }, transforms: Transform[]): Promise; - createGuardsFn(guards: any[], instance: Controller, callback: (...args) => any): (req: any) => Promise; - createPipesFn(pipes: any[], paramsOptions: (ParamProperties & { - metatype?: any; - })[]): (args: any, req: any, res: any, next: any) => Promise; - createHandleResponseFn(callback: any, isResponseHandled: boolean, httpStatusCode: number): (result: any, res: any) => any; + private readonly paramsFactory; + private readonly pipesContextCreator; + private readonly pipesConsumer; + private readonly guardsContextCreator; + private readonly guardsConsumer; + private readonly interceptorsContextCreator; + private readonly interceptorsConsumer; + private readonly responseController; + constructor( + paramsFactory: IRouteParamsFactory, + pipesContextCreator: PipesContextCreator, + pipesConsumer: PipesConsumer, + guardsContextCreator: GuardsContextCreator, + guardsConsumer: GuardsConsumer, + interceptorsContextCreator: InterceptorsContextCreator, + interceptorsConsumer: InterceptorsConsumer, + ); + create( + instance: Controller, + callback: (...args) => any, + methodName: string, + module: string, + requestMethod: RequestMethod, + ): (req: any, res: any, next: any) => Promise; + mapParamType(key: string): string; + reflectCallbackMetadata( + instance: Controller, + methodName: string, + ): RouteParamsMetadata; + reflectCallbackParamtypes(instance: Controller, methodName: string): any[]; + reflectHttpStatusCode(callback: (...args) => any): number; + reflectRenderTemplate(callback: any): boolean; + getArgumentsLength(keys: string[], metadata: RouteParamsMetadata): number; + createNullArray(length: number): any[]; + exchangeKeysForValues( + keys: string[], + metadata: RouteParamsMetadata, + ): ParamProperties[]; + getCustomFactory(factory: (...args) => void, data: any): (...args) => any; + mergeParamsMetatypes( + paramsProperties: ParamProperties[], + paramtypes: any[], + ): (ParamProperties & { + metatype?: any; + })[]; + getParamValue( + value: T, + { + metatype, + type, + data, + }: { + metatype: any; + type: any; + data: any; + }, + transforms: Transform[], + ): Promise; + createGuardsFn( + guards: any[], + instance: Controller, + callback: (...args) => any, + ): (req: any) => Promise; + createPipesFn( + pipes: any[], + paramsOptions: (ParamProperties & { + metatype?: any; + })[], + ): (args: any, req: any, res: any, next: any) => Promise; + createHandleResponseFn( + callback: any, + isResponseHandled: boolean, + httpStatusCode: number, + ): (result: any, res: any) => any; } diff --git a/lib/core/router/router-explorer.d.ts b/lib/core/router/router-explorer.d.ts index 53ccd400c38..49e991c9e2c 100644 --- a/lib/core/router/router-explorer.d.ts +++ b/lib/core/router/router-explorer.d.ts @@ -10,27 +10,53 @@ import { MetadataScanner } from '../metadata-scanner'; import { ApplicationConfig } from './../application-config'; import { NestContainer } from '../injector/container'; export declare class ExpressRouterExplorer implements RouterExplorer { - private readonly metadataScanner; - private readonly routerProxy; - private readonly expressAdapter; - private readonly exceptionsFilter; - private readonly config; - private readonly executionContextCreator; - private readonly routerMethodFactory; - private readonly logger; - constructor(metadataScanner?: MetadataScanner, routerProxy?: RouterProxy, expressAdapter?: ExpressAdapter, exceptionsFilter?: ExceptionsFilter, config?: ApplicationConfig, container?: NestContainer); - explore(instance: Controller, metatype: Metatype, module: string): any; - fetchRouterPath(metatype: Metatype, prefix?: string): string; - validateRoutePath(path: string): string; - scanForPaths(instance: Controller, prototype?: any): RoutePathProperties[]; - exploreMethodMetadata(instance: Controller, instancePrototype: any, methodName: string): RoutePathProperties; - applyPathsToRouterProxy(router: any, routePaths: RoutePathProperties[], instance: Controller, module: string): void; - private applyCallbackToRouter(router, pathProperties, instance, module); - private createCallbackProxy(instance, callback, methodName, module, requestMethod); + private readonly metadataScanner; + private readonly routerProxy; + private readonly expressAdapter; + private readonly exceptionsFilter; + private readonly config; + private readonly executionContextCreator; + private readonly routerMethodFactory; + private readonly logger; + constructor( + metadataScanner?: MetadataScanner, + routerProxy?: RouterProxy, + expressAdapter?: ExpressAdapter, + exceptionsFilter?: ExceptionsFilter, + config?: ApplicationConfig, + container?: NestContainer, + ); + explore( + instance: Controller, + metatype: Metatype, + module: string, + ): any; + fetchRouterPath(metatype: Metatype, prefix?: string): string; + validateRoutePath(path: string): string; + scanForPaths(instance: Controller, prototype?: any): RoutePathProperties[]; + exploreMethodMetadata( + instance: Controller, + instancePrototype: any, + methodName: string, + ): RoutePathProperties; + applyPathsToRouterProxy( + router: any, + routePaths: RoutePathProperties[], + instance: Controller, + module: string, + ): void; + private applyCallbackToRouter(router, pathProperties, instance, module); + private createCallbackProxy( + instance, + callback, + methodName, + module, + requestMethod, + ); } export interface RoutePathProperties { - path: string; - requestMethod: RequestMethod; - targetCallback: RouterProxyCallback; - methodName: string; + path: string; + requestMethod: RequestMethod; + targetCallback: RouterProxyCallback; + methodName: string; } diff --git a/lib/core/router/router-proxy.d.ts b/lib/core/router/router-proxy.d.ts index e97414bb7e6..b5095277a93 100644 --- a/lib/core/router/router-proxy.d.ts +++ b/lib/core/router/router-proxy.d.ts @@ -1,6 +1,12 @@ import { ExceptionsHandler } from '../exceptions/exceptions-handler'; export declare type RouterProxyCallback = (req?, res?, next?) => void; export declare class RouterProxy { - createProxy(targetCallback: RouterProxyCallback, exceptionsHandler: ExceptionsHandler): (req: any, res: any, next: any) => void; - createExceptionLayerProxy(targetCallback: (err, req, res, next) => void, exceptionsHandler: ExceptionsHandler): (err: any, req: any, res: any, next: any) => void; + createProxy( + targetCallback: RouterProxyCallback, + exceptionsHandler: ExceptionsHandler, + ): (req: any, res: any, next: any) => void; + createExceptionLayerProxy( + targetCallback: (err, req, res, next) => void, + exceptionsHandler: ExceptionsHandler, + ): (err: any, req: any, res: any, next: any) => void; } diff --git a/lib/core/router/router-response-controller.d.ts b/lib/core/router/router-response-controller.d.ts index 772fbb7e063..53e0f8994a2 100644 --- a/lib/core/router/router-response-controller.d.ts +++ b/lib/core/router/router-response-controller.d.ts @@ -1,8 +1,12 @@ import { RequestMethod } from '@nestjs/common'; import 'rxjs/add/operator/toPromise'; export declare class RouterResponseController { - apply(resultOrDeffered: any, response: any, httpStatusCode: number): Promise; - render(resultOrDeffered: any, response: any, template: string): Promise; - transformToResult(resultOrDeffered: any): Promise; - getStatusByMethod(requestMethod: RequestMethod): number; + apply( + resultOrDeffered: any, + response: any, + httpStatusCode: number, + ): Promise; + render(resultOrDeffered: any, response: any, template: string): Promise; + transformToResult(resultOrDeffered: any): Promise; + getStatusByMethod(requestMethod: RequestMethod): number; } diff --git a/lib/core/router/routes-resolver.d.ts b/lib/core/router/routes-resolver.d.ts index b2e5de663ee..3dbd7f4e91d 100644 --- a/lib/core/router/routes-resolver.d.ts +++ b/lib/core/router/routes-resolver.d.ts @@ -5,17 +5,26 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.int import { Resolver } from './interfaces/resolver.interface'; import { ApplicationConfig } from './../application-config'; export declare class RoutesResolver implements Resolver { - private readonly container; - private readonly expressAdapter; - private readonly config; - private readonly logger; - private readonly routerProxy; - private readonly routerExceptionsFilter; - private readonly routerBuilder; - constructor(container: NestContainer, expressAdapter: any, config: ApplicationConfig); - resolve(router: any, express: Application): void; - setupRouters(routes: Map>, moduleName: string, modulePath: string, express: Application): void; - setupNotFoundHandler(express: Application): void; - setupExceptionHandler(express: Application): void; - mapExternalException(err: any): any; + private readonly container; + private readonly expressAdapter; + private readonly config; + private readonly logger; + private readonly routerProxy; + private readonly routerExceptionsFilter; + private readonly routerBuilder; + constructor( + container: NestContainer, + expressAdapter: any, + config: ApplicationConfig, + ); + resolve(router: any, express: Application): void; + setupRouters( + routes: Map>, + moduleName: string, + modulePath: string, + express: Application, + ): void; + setupNotFoundHandler(express: Application): void; + setupExceptionHandler(express: Application): void; + mapExternalException(err: any): any; } diff --git a/lib/core/scanner.d.ts b/lib/core/scanner.d.ts index 4df60c84c8a..8981b191470 100644 --- a/lib/core/scanner.d.ts +++ b/lib/core/scanner.d.ts @@ -8,33 +8,53 @@ import { MetadataScanner } from '../core/metadata-scanner'; import { DynamicModule } from '@nestjs/common'; import { ApplicationConfig } from './application-config'; export declare class DependenciesScanner { - private readonly container; - private readonly metadataScanner; - private readonly applicationConfig; - private readonly applicationProvidersApplyMap; - constructor(container: NestContainer, metadataScanner: MetadataScanner, applicationConfig?: ApplicationConfig); - scan(module: NestModuleMetatype): void; - scanForModules(module: NestModuleMetatype | DynamicModule, scope?: NestModuleMetatype[]): void; - storeModule(module: any, scope: NestModuleMetatype[]): void; - scanModulesForDependencies(): void; - reflectRelatedModules(module: NestModuleMetatype, token: string): void; - reflectComponents(module: NestModuleMetatype, token: string): void; - reflectComponentMetadata(component: Metatype, token: string): void; - reflectControllers(module: NestModuleMetatype, token: string): void; - reflectDynamicMetadata(obj: Metatype, token: string): void; - reflectExports(module: NestModuleMetatype, token: string): void; - reflectGatewaysMiddlewares(component: Metatype, token: string): void; - reflectGuards(component: Metatype, token: string): void; - reflectInterceptors(component: Metatype, token: string): void; - reflectKeyMetadata(component: Metatype, key: string, method: string): any; - storeRelatedModule(related: any, token: string): void; - storeComponent(component: any, token: string): string; - storeInjectable(component: Metatype, token: string): void; - storeExportedComponent(exportedComponent: Metatype, token: string): void; - storeRoute(route: Metatype, token: string): void; - reflectMetadata(metatype: any, metadata: string): any; - applyApplicationProviders(): void; - getApplyProvidersMap(): { - [type: string]: Function; - }; + private readonly container; + private readonly metadataScanner; + private readonly applicationConfig; + private readonly applicationProvidersApplyMap; + constructor( + container: NestContainer, + metadataScanner: MetadataScanner, + applicationConfig?: ApplicationConfig, + ); + scan(module: NestModuleMetatype): void; + scanForModules( + module: NestModuleMetatype | DynamicModule, + scope?: NestModuleMetatype[], + ): void; + storeModule(module: any, scope: NestModuleMetatype[]): void; + scanModulesForDependencies(): void; + reflectRelatedModules(module: NestModuleMetatype, token: string): void; + reflectComponents(module: NestModuleMetatype, token: string): void; + reflectComponentMetadata( + component: Metatype, + token: string, + ): void; + reflectControllers(module: NestModuleMetatype, token: string): void; + reflectDynamicMetadata(obj: Metatype, token: string): void; + reflectExports(module: NestModuleMetatype, token: string): void; + reflectGatewaysMiddlewares( + component: Metatype, + token: string, + ): void; + reflectGuards(component: Metatype, token: string): void; + reflectInterceptors(component: Metatype, token: string): void; + reflectKeyMetadata( + component: Metatype, + key: string, + method: string, + ): any; + storeRelatedModule(related: any, token: string): void; + storeComponent(component: any, token: string): string; + storeInjectable(component: Metatype, token: string): void; + storeExportedComponent( + exportedComponent: Metatype, + token: string, + ): void; + storeRoute(route: Metatype, token: string): void; + reflectMetadata(metatype: any, metadata: string): any; + applyApplicationProviders(): void; + getApplyProvidersMap(): { + [type: string]: Function; + }; } diff --git a/lib/core/services/reflector.service.d.ts b/lib/core/services/reflector.service.d.ts index 2a175378a8c..a6e96a6ce66 100644 --- a/lib/core/services/reflector.service.d.ts +++ b/lib/core/services/reflector.service.d.ts @@ -1,3 +1,3 @@ export declare class Reflector { - get(metadataKey: any, target: any): T; + get(metadataKey: any, target: any): T; } diff --git a/lib/microservices/client/client-proxy-factory.d.ts b/lib/microservices/client/client-proxy-factory.d.ts index 1afa50f4734..7b05797f02f 100644 --- a/lib/microservices/client/client-proxy-factory.d.ts +++ b/lib/microservices/client/client-proxy-factory.d.ts @@ -2,5 +2,5 @@ import { ClientMetadata } from '../interfaces/client-metadata.interface'; import { ClientProxy } from './client-proxy'; import { Closeable } from '../interfaces/closeable.interface'; export declare class ClientProxyFactory { - static create(metadata: ClientMetadata): ClientProxy & Closeable; + static create(metadata: ClientMetadata): ClientProxy & Closeable; } diff --git a/lib/microservices/client/client-proxy.d.ts b/lib/microservices/client/client-proxy.d.ts index 344d81ad736..7ba1bd07c91 100644 --- a/lib/microservices/client/client-proxy.d.ts +++ b/lib/microservices/client/client-proxy.d.ts @@ -1,7 +1,12 @@ import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; -export declare abstract class ClientProxy { - protected abstract sendSingleMessage(msg: any, callback: (err, result, disposed?: boolean) => void): any; - send(pattern: any, data: any): Observable; - protected createObserver(observer: Observer): (err, result, disposed?: boolean) => void; +export abstract class ClientProxy { + protected abstract sendSingleMessage( + msg: any, + callback: (err, result, disposed?: boolean) => void, + ): any; + send(pattern: any, data: any): Observable; + protected createObserver( + observer: Observer, + ): (err, result, disposed?: boolean) => void; } diff --git a/lib/microservices/client/client-redis.d.ts b/lib/microservices/client/client-redis.d.ts index 28a06506981..588a1d04590 100644 --- a/lib/microservices/client/client-redis.d.ts +++ b/lib/microservices/client/client-redis.d.ts @@ -2,16 +2,19 @@ import * as redis from 'redis'; import { ClientProxy } from './client-proxy'; import { ClientMetadata } from '../interfaces/client-metadata.interface'; export declare class ClientRedis extends ClientProxy { - private readonly logger; - private readonly url; - private pub; - private sub; - constructor(metadata: ClientMetadata); - protected sendSingleMessage(msg: any, callback: (...args) => any): (channel: any, message: any) => void; - getAckPatternName(pattern: string): string; - getResPatternName(pattern: string): string; - close(): void; - init(callback: (...args) => any): void; - createClient(): redis.RedisClient; - handleErrors(stream: any, callback: (...args) => any): void; + private readonly logger; + private readonly url; + private pub; + private sub; + constructor(metadata: ClientMetadata); + protected sendSingleMessage( + msg: any, + callback: (...args) => any, + ): (channel: any, message: any) => void; + getAckPatternName(pattern: string): string; + getResPatternName(pattern: string): string; + close(): void; + init(callback: (...args) => any): void; + createClient(): redis.RedisClient; + handleErrors(stream: any, callback: (...args) => any): void; } diff --git a/lib/microservices/client/client-tcp.d.ts b/lib/microservices/client/client-tcp.d.ts index 1c2d1231ae8..03257c69b19 100644 --- a/lib/microservices/client/client-tcp.d.ts +++ b/lib/microservices/client/client-tcp.d.ts @@ -1,16 +1,19 @@ import { ClientProxy } from './client-proxy'; import { ClientMetadata } from '../interfaces/client-metadata.interface'; export declare class ClientTCP extends ClientProxy { - private readonly logger; - private readonly port; - private readonly host; - private isConnected; - private socket; - constructor({port, host}: ClientMetadata); - init(callback: (...args) => any): Promise<{}>; - protected sendSingleMessage(msg: any, callback: (...args) => any): Promise; - handleResponse(socket: any, callback: (...args) => any, buffer: any): void; - createSocket(): any; - close(): void; - bindEvents(socket: any, callback: (...args) => any): void; + private readonly logger; + private readonly port; + private readonly host; + private isConnected; + private socket; + constructor({ port, host }: ClientMetadata); + init(callback: (...args) => any): Promise<{}>; + protected sendSingleMessage( + msg: any, + callback: (...args) => any, + ): Promise; + handleResponse(socket: any, callback: (...args) => any, buffer: any): void; + createSocket(): any; + close(): void; + bindEvents(socket: any, callback: (...args) => any): void; } diff --git a/lib/microservices/constants.d.ts b/lib/microservices/constants.d.ts index 1cb344595d8..290ccfb7851 100644 --- a/lib/microservices/constants.d.ts +++ b/lib/microservices/constants.d.ts @@ -1,5 +1,6 @@ -export declare const PATTERN_METADATA = "pattern"; -export declare const CLIENT_CONFIGURATION_METADATA = "client"; -export declare const CLIENT_METADATA = "__isClient"; -export declare const PATTERN_HANDLER_METADATA = "__isPattern"; -export declare const NO_PATTERN_MESSAGE = "There's no equivalent message pattern."; +export declare const PATTERN_METADATA = 'pattern'; +export declare const CLIENT_CONFIGURATION_METADATA = 'client'; +export declare const CLIENT_METADATA = '__isClient'; +export declare const PATTERN_HANDLER_METADATA = '__isPattern'; +export declare const NO_PATTERN_MESSAGE = + "There's no equivalent message pattern."; diff --git a/lib/microservices/container.d.ts b/lib/microservices/container.d.ts index 8760c769be6..53380b20171 100644 --- a/lib/microservices/container.d.ts +++ b/lib/microservices/container.d.ts @@ -2,8 +2,8 @@ import { ClientProxy } from './index'; import { Closeable } from './interfaces/closeable.interface'; export declare type CloseableClient = Closeable & ClientProxy; export declare class ClientsContainer { - private clients; - getAllClients(): CloseableClient[]; - addClient(client: CloseableClient): void; - clear(): void; + private clients; + getAllClients(): CloseableClient[]; + addClient(client: CloseableClient): void; + clear(): void; } diff --git a/lib/microservices/context/exception-filters-context.d.ts b/lib/microservices/context/exception-filters-context.d.ts index c626cb18891..d970cc8f85b 100644 --- a/lib/microservices/context/exception-filters-context.d.ts +++ b/lib/microservices/context/exception-filters-context.d.ts @@ -5,8 +5,11 @@ import { RpcExceptionsHandler } from '../exceptions/rpc-exceptions-handler'; import { BaseExceptionFilterContext } from '@nestjs/core/exceptions/base-exception-filter-context'; import { ApplicationConfig } from '@nestjs/core/application-config'; export declare class ExceptionFiltersContext extends BaseExceptionFilterContext { - private readonly config; - constructor(config: ApplicationConfig); - create(instance: Controller, callback: (data) => Observable): RpcExceptionsHandler; - getGlobalMetadata(): T; + private readonly config; + constructor(config: ApplicationConfig); + create( + instance: Controller, + callback: (data) => Observable, + ): RpcExceptionsHandler; + getGlobalMetadata(): T; } diff --git a/lib/microservices/context/rpc-context-creator.d.ts b/lib/microservices/context/rpc-context-creator.d.ts index e6126b3a65d..69383e3ad23 100644 --- a/lib/microservices/context/rpc-context-creator.d.ts +++ b/lib/microservices/context/rpc-context-creator.d.ts @@ -9,16 +9,32 @@ import { GuardsConsumer } from '@nestjs/core/guards/guards-consumer'; import { InterceptorsContextCreator } from '@nestjs/core/interceptors/interceptors-context-creator'; import { InterceptorsConsumer } from '@nestjs/core/interceptors/interceptors-consumer'; export declare class RpcContextCreator { - private readonly rpcProxy; - private readonly exceptionFiltersContext; - private readonly pipesCreator; - private readonly pipesConsumer; - private readonly guardsContextCreator; - private readonly guardsConsumer; - private readonly interceptorsContextCreator; - private readonly interceptorsConsumer; - constructor(rpcProxy: RpcProxy, exceptionFiltersContext: ExceptionFiltersContext, pipesCreator: PipesContextCreator, pipesConsumer: PipesConsumer, guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer); - create(instance: Controller, callback: (data) => Observable, module: any): (data) => Promise>; - reflectCallbackParamtypes(instance: Controller, callback: (...args) => any): any[]; - getDataMetatype(instance: any, callback: any): any; + private readonly rpcProxy; + private readonly exceptionFiltersContext; + private readonly pipesCreator; + private readonly pipesConsumer; + private readonly guardsContextCreator; + private readonly guardsConsumer; + private readonly interceptorsContextCreator; + private readonly interceptorsConsumer; + constructor( + rpcProxy: RpcProxy, + exceptionFiltersContext: ExceptionFiltersContext, + pipesCreator: PipesContextCreator, + pipesConsumer: PipesConsumer, + guardsContextCreator: GuardsContextCreator, + guardsConsumer: GuardsConsumer, + interceptorsContextCreator: InterceptorsContextCreator, + interceptorsConsumer: InterceptorsConsumer, + ); + create( + instance: Controller, + callback: (data) => Observable, + module: any, + ): (data) => Promise>; + reflectCallbackParamtypes( + instance: Controller, + callback: (...args) => any, + ): any[]; + getDataMetatype(instance: any, callback: any): any; } diff --git a/lib/microservices/context/rpc-proxy.d.ts b/lib/microservices/context/rpc-proxy.d.ts index 1865dd669e2..dd595764a63 100644 --- a/lib/microservices/context/rpc-proxy.d.ts +++ b/lib/microservices/context/rpc-proxy.d.ts @@ -1,5 +1,8 @@ import { Observable } from 'rxjs/Observable'; import { RpcExceptionsHandler } from '../exceptions/rpc-exceptions-handler'; export declare class RpcProxy { - create(targetCallback: (data) => Promise>, exceptionsHandler: RpcExceptionsHandler): (data) => Promise>; + create( + targetCallback: (data) => Promise>, + exceptionsHandler: RpcExceptionsHandler, + ): (data) => Promise>; } diff --git a/lib/microservices/enums/transport.enum.d.ts b/lib/microservices/enums/transport.enum.d.ts index 5f116ab7c12..925f42dac96 100644 --- a/lib/microservices/enums/transport.enum.d.ts +++ b/lib/microservices/enums/transport.enum.d.ts @@ -1,4 +1,4 @@ export declare enum Transport { - TCP = 0, - REDIS = 1, + TCP = 0, + REDIS = 1, } diff --git a/lib/microservices/exceptions/invalid-message.exception.d.ts b/lib/microservices/exceptions/invalid-message.exception.d.ts index 0bf90a240f5..c139da9e63e 100644 --- a/lib/microservices/exceptions/invalid-message.exception.d.ts +++ b/lib/microservices/exceptions/invalid-message.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from '@nestjs/core/errors/exceptions/runtime.exception'; export declare class InvalidMessageException extends RuntimeException { - constructor(); + constructor(); } diff --git a/lib/microservices/exceptions/rpc-exception.d.ts b/lib/microservices/exceptions/rpc-exception.d.ts index 7d20abcc3bd..015ecafdcc0 100644 --- a/lib/microservices/exceptions/rpc-exception.d.ts +++ b/lib/microservices/exceptions/rpc-exception.d.ts @@ -1,6 +1,6 @@ export declare class RpcException extends Error { - private readonly error; - readonly message: any; - constructor(error: string | object); - getError(): string | object; + private readonly error; + readonly message: any; + constructor(error: string | object); + getError(): string | object; } diff --git a/lib/microservices/exceptions/rpc-exceptions-handler.d.ts b/lib/microservices/exceptions/rpc-exceptions-handler.d.ts index fed9e6429e6..0dff40f86f8 100644 --- a/lib/microservices/exceptions/rpc-exceptions-handler.d.ts +++ b/lib/microservices/exceptions/rpc-exceptions-handler.d.ts @@ -3,9 +3,9 @@ import { RpcException } from './rpc-exception'; import { RpcExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions'; import 'rxjs/add/observable/throw'; export declare class RpcExceptionsHandler { - private static readonly logger; - private filters; - handle(exception: Error | RpcException | any): Observable; - setCustomFilters(filters: RpcExceptionFilterMetadata[]): void; - invokeCustomFilters(exception: any): Observable | null; + private static readonly logger; + private filters; + handle(exception: Error | RpcException | any): Observable; + setCustomFilters(filters: RpcExceptionFilterMetadata[]): void; + invokeCustomFilters(exception: any): Observable | null; } diff --git a/lib/microservices/interfaces/client-metadata.interface.d.ts b/lib/microservices/interfaces/client-metadata.interface.d.ts index 6a9ccb04755..5ae88508a06 100644 --- a/lib/microservices/interfaces/client-metadata.interface.d.ts +++ b/lib/microservices/interfaces/client-metadata.interface.d.ts @@ -1,7 +1,7 @@ import { Transport } from './../enums/transport.enum'; export interface ClientMetadata { - transport?: Transport; - url?: string; - port?: number; - host?: string; + transport?: Transport; + url?: string; + port?: number; + host?: string; } diff --git a/lib/microservices/interfaces/closeable.interface.d.ts b/lib/microservices/interfaces/closeable.interface.d.ts index 45097299a8a..a5cc2c694db 100644 --- a/lib/microservices/interfaces/closeable.interface.d.ts +++ b/lib/microservices/interfaces/closeable.interface.d.ts @@ -1,3 +1,3 @@ export interface Closeable { - close(): void; + close(): void; } diff --git a/lib/microservices/interfaces/custom-transport-strategy.interface.d.ts b/lib/microservices/interfaces/custom-transport-strategy.interface.d.ts index b743506b902..15072dab2f7 100644 --- a/lib/microservices/interfaces/custom-transport-strategy.interface.d.ts +++ b/lib/microservices/interfaces/custom-transport-strategy.interface.d.ts @@ -1,4 +1,4 @@ export interface CustomTransportStrategy { - listen(callback: () => void): any; - close(): any; + listen(callback: () => void): any; + close(): any; } diff --git a/lib/microservices/interfaces/message-handlers.interface.d.ts b/lib/microservices/interfaces/message-handlers.interface.d.ts index 9131cce636f..60b434f4eda 100644 --- a/lib/microservices/interfaces/message-handlers.interface.d.ts +++ b/lib/microservices/interfaces/message-handlers.interface.d.ts @@ -1,4 +1,4 @@ import { Observable } from 'rxjs/Observable'; export interface MessageHandlers { - [pattern: string]: (data) => Promise>; + [pattern: string]: (data) => Promise>; } diff --git a/lib/microservices/interfaces/microservice-configuration.interface.d.ts b/lib/microservices/interfaces/microservice-configuration.interface.d.ts index 0d515554d8f..2c31d991cb1 100644 --- a/lib/microservices/interfaces/microservice-configuration.interface.d.ts +++ b/lib/microservices/interfaces/microservice-configuration.interface.d.ts @@ -2,9 +2,9 @@ import { Transport } from '../enums/transport.enum'; import { CustomTransportStrategy } from './custom-transport-strategy.interface'; import { Server } from './../server/server'; export interface MicroserviceConfiguration { - transport?: Transport; - url?: string; - port?: number; - host?: string; - strategy?: Server & CustomTransportStrategy; + transport?: Transport; + url?: string; + port?: number; + host?: string; + strategy?: Server & CustomTransportStrategy; } diff --git a/lib/microservices/interfaces/microservice-response.interface.d.ts b/lib/microservices/interfaces/microservice-response.interface.d.ts index 9040f00b60f..6ea59c3b46d 100644 --- a/lib/microservices/interfaces/microservice-response.interface.d.ts +++ b/lib/microservices/interfaces/microservice-response.interface.d.ts @@ -1,5 +1,5 @@ export interface MicroserviceResponse { - response?: any; - err?: any; - disposed?: boolean; + response?: any; + err?: any; + disposed?: boolean; } diff --git a/lib/microservices/interfaces/pattern-metadata.interface.d.ts b/lib/microservices/interfaces/pattern-metadata.interface.d.ts index 817171de21d..7c440634542 100644 --- a/lib/microservices/interfaces/pattern-metadata.interface.d.ts +++ b/lib/microservices/interfaces/pattern-metadata.interface.d.ts @@ -1,3 +1,3 @@ export interface PatternMetadata { - [prop: string]: any; + [prop: string]: any; } diff --git a/lib/microservices/listener-metadata-explorer.d.ts b/lib/microservices/listener-metadata-explorer.d.ts index cf926686683..e620abffb32 100644 --- a/lib/microservices/listener-metadata-explorer.d.ts +++ b/lib/microservices/listener-metadata-explorer.d.ts @@ -3,17 +3,21 @@ import { PatternMetadata } from './interfaces/pattern-metadata.interface'; import { ClientMetadata } from './interfaces/client-metadata.interface'; import { MetadataScanner } from '@nestjs/core/metadata-scanner'; export declare class ListenerMetadataExplorer { - private readonly metadataScanner; - constructor(metadataScanner: MetadataScanner); - explore(instance: Controller): PatternProperties[]; - exploreMethodMetadata(instance: any, instancePrototype: any, methodName: string): PatternProperties; - scanForClientHooks(instance: Controller): IterableIterator; + private readonly metadataScanner; + constructor(metadataScanner: MetadataScanner); + explore(instance: Controller): PatternProperties[]; + exploreMethodMetadata( + instance: any, + instancePrototype: any, + methodName: string, + ): PatternProperties; + scanForClientHooks(instance: Controller): IterableIterator; } export interface ClientProperties { - property: string; - metadata: ClientMetadata; + property: string; + metadata: ClientMetadata; } export interface PatternProperties { - pattern: PatternMetadata; - targetCallback: (...args) => any; + pattern: PatternMetadata; + targetCallback: (...args) => any; } diff --git a/lib/microservices/listeners-controller.d.ts b/lib/microservices/listeners-controller.d.ts index 4e48632bb89..245e2794d27 100644 --- a/lib/microservices/listeners-controller.d.ts +++ b/lib/microservices/listeners-controller.d.ts @@ -5,10 +5,17 @@ import { CustomTransportStrategy } from './interfaces'; import { ClientsContainer } from './container'; import { RpcContextCreator } from './context/rpc-context-creator'; export declare class ListenersController { - private readonly clientsContainer; - private readonly contextCreator; - private readonly metadataExplorer; - constructor(clientsContainer: ClientsContainer, contextCreator: RpcContextCreator); - bindPatternHandlers(instance: Controller, server: Server & CustomTransportStrategy, module: string): void; - bindClientsToProperties(instance: Controller): void; + private readonly clientsContainer; + private readonly contextCreator; + private readonly metadataExplorer; + constructor( + clientsContainer: ClientsContainer, + contextCreator: RpcContextCreator, + ); + bindPatternHandlers( + instance: Controller, + server: Server & CustomTransportStrategy, + module: string, + ): void; + bindClientsToProperties(instance: Controller): void; } diff --git a/lib/microservices/microservices-module.d.ts b/lib/microservices/microservices-module.d.ts index 81cd8d6b5f5..3718eb6ef80 100644 --- a/lib/microservices/microservices-module.d.ts +++ b/lib/microservices/microservices-module.d.ts @@ -3,12 +3,19 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.int import { CustomTransportStrategy } from './interfaces'; import { Server } from './server/server'; export declare class MicroservicesModule { - private readonly clientsContainer; - private listenersController; - setup(container: any, config: any): void; - setupListeners(container: any, server: Server & CustomTransportStrategy): void; - setupClients(container: any): void; - bindListeners(controllers: Map>, server: Server & CustomTransportStrategy, module: string): void; - bindClients(controllers: Map>): void; - close(): void; + private readonly clientsContainer; + private listenersController; + setup(container: any, config: any): void; + setupListeners( + container: any, + server: Server & CustomTransportStrategy, + ): void; + setupClients(container: any): void; + bindListeners( + controllers: Map>, + server: Server & CustomTransportStrategy, + module: string, + ): void; + bindClients(controllers: Map>): void; + close(): void; } diff --git a/lib/microservices/nest-microservice.d.ts b/lib/microservices/nest-microservice.d.ts index c7aa4ed1c1d..9c5d6fc5c8c 100644 --- a/lib/microservices/nest-microservice.d.ts +++ b/lib/microservices/nest-microservice.d.ts @@ -1,37 +1,49 @@ import { NestContainer } from '@nestjs/core/injector/container'; import { MicroserviceConfiguration } from './interfaces/microservice-configuration.interface'; -import { INestMicroservice, WebSocketAdapter, CanActivate, PipeTransform, NestInterceptor, ExceptionFilter } from '@nestjs/common'; +import { + INestMicroservice, + WebSocketAdapter, + CanActivate, + PipeTransform, + NestInterceptor, + ExceptionFilter, +} from '@nestjs/common'; import { ApplicationConfig } from '@nestjs/core/application-config'; import { NestApplicationContext } from '@nestjs/core/nest-application-context'; -export declare class NestMicroservice extends NestApplicationContext implements INestMicroservice { - private readonly applicationConfig; - private readonly logger; - private readonly microservicesModule; - private readonly socketModule; - private readonly microserviceConfig; - private readonly server; - private isTerminated; - private isInitialized; - private isInitHookCalled; - constructor(container: NestContainer, config: MicroserviceConfiguration, applicationConfig: ApplicationConfig); - setupModules(): void; - setupListeners(): void; - useWebSocketAdapter(adapter: WebSocketAdapter): this; - useGlobalFilters(...filters: ExceptionFilter[]): this; - useGlobalPipes(...pipes: PipeTransform[]): this; - useGlobalInterceptors(...interceptors: NestInterceptor[]): this; - useGlobalGuards(...guards: CanActivate[]): this; - listen(callback: () => void): void; - listenAsync(): Promise; - close(): void; - setIsInitialized(isInitialized: boolean): void; - setIsTerminated(isTerminaed: boolean): void; - setIsInitHookCalled(isInitHookCalled: boolean): void; - private closeApplication(); - private callInitHook(); - private callModuleInitHook(module); - private hasOnModuleInitHook(instance); - private callDestroyHook(); - private callModuleDestroyHook(module); - private hasOnModuleDestroyHook(instance); +export declare class NestMicroservice extends NestApplicationContext + implements INestMicroservice { + private readonly applicationConfig; + private readonly logger; + private readonly microservicesModule; + private readonly socketModule; + private readonly microserviceConfig; + private readonly server; + private isTerminated; + private isInitialized; + private isInitHookCalled; + constructor( + container: NestContainer, + config: MicroserviceConfiguration, + applicationConfig: ApplicationConfig, + ); + setupModules(): void; + setupListeners(): void; + useWebSocketAdapter(adapter: WebSocketAdapter): this; + useGlobalFilters(...filters: ExceptionFilter[]): this; + useGlobalPipes(...pipes: PipeTransform[]): this; + useGlobalInterceptors(...interceptors: NestInterceptor[]): this; + useGlobalGuards(...guards: CanActivate[]): this; + listen(callback: () => void): void; + listenAsync(): Promise; + close(): void; + setIsInitialized(isInitialized: boolean): void; + setIsTerminated(isTerminaed: boolean): void; + setIsInitHookCalled(isInitHookCalled: boolean): void; + private closeApplication(); + private callInitHook(); + private callModuleInitHook(module); + private hasOnModuleInitHook(instance); + private callDestroyHook(); + private callModuleDestroyHook(module); + private hasOnModuleDestroyHook(instance); } diff --git a/lib/microservices/server/server-factory.d.ts b/lib/microservices/server/server-factory.d.ts index be4251a337f..2f5a2358a26 100644 --- a/lib/microservices/server/server-factory.d.ts +++ b/lib/microservices/server/server-factory.d.ts @@ -1,5 +1,10 @@ -import { MicroserviceConfiguration, CustomTransportStrategy } from '../interfaces'; +import { + MicroserviceConfiguration, + CustomTransportStrategy, +} from '../interfaces'; import { Server } from './server'; export declare class ServerFactory { - static create(config: MicroserviceConfiguration): Server & CustomTransportStrategy; + static create( + config: MicroserviceConfiguration, + ): Server & CustomTransportStrategy; } diff --git a/lib/microservices/server/server-redis.d.ts b/lib/microservices/server/server-redis.d.ts index 419d2e755c4..9fca204756d 100644 --- a/lib/microservices/server/server-redis.d.ts +++ b/lib/microservices/server/server-redis.d.ts @@ -5,21 +5,22 @@ import { CustomTransportStrategy } from './../interfaces'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/empty'; import 'rxjs/add/operator/finally'; -export declare class ServerRedis extends Server implements CustomTransportStrategy { - private readonly url; - private sub; - private pub; - constructor(config: MicroserviceConfiguration); - listen(callback: () => void): void; - start(callback?: () => void): void; - close(): void; - createRedisClient(): redis.RedisClient; - handleConnection(callback: any, sub: any, pub: any): void; - getMessageHandler(pub: any): (channel: any, buffer: any) => Promise; - handleMessage(channel: any, buffer: any, pub: any): Promise; - getPublisher(pub: any, pattern: any): (respond: any) => void; - tryParse(content: any): any; - getAckQueueName(pattern: any): string; - getResQueueName(pattern: any): string; - handleErrors(stream: any): void; +export declare class ServerRedis extends Server + implements CustomTransportStrategy { + private readonly url; + private sub; + private pub; + constructor(config: MicroserviceConfiguration); + listen(callback: () => void): void; + start(callback?: () => void): void; + close(): void; + createRedisClient(): redis.RedisClient; + handleConnection(callback: any, sub: any, pub: any): void; + getMessageHandler(pub: any): (channel: any, buffer: any) => Promise; + handleMessage(channel: any, buffer: any, pub: any): Promise; + getPublisher(pub: any, pattern: any): (respond: any) => void; + tryParse(content: any): any; + getAckQueueName(pattern: any): string; + getResQueueName(pattern: any): string; + handleErrors(stream: any): void; } diff --git a/lib/microservices/server/server-tcp.d.ts b/lib/microservices/server/server-tcp.d.ts index c94b29ad082..8df5008c599 100644 --- a/lib/microservices/server/server-tcp.d.ts +++ b/lib/microservices/server/server-tcp.d.ts @@ -3,17 +3,21 @@ import { CustomTransportStrategy } from './../interfaces'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/empty'; import 'rxjs/add/operator/finally'; -export declare class ServerTCP extends Server implements CustomTransportStrategy { - private readonly port; - private server; - constructor(config: any); - listen(callback: () => void): void; - close(): void; - bindHandler(socket: any): void; - handleMessage(socket: any, msg: { - pattern: any; - data: {}; - }): Promise; - private init(); - private getSocketInstance(socket); +export declare class ServerTCP extends Server + implements CustomTransportStrategy { + private readonly port; + private server; + constructor(config: any); + listen(callback: () => void): void; + close(): void; + bindHandler(socket: any): void; + handleMessage( + socket: any, + msg: { + pattern: any; + data: {}; + }, + ): Promise; + private init(); + private getSocketInstance(socket); } diff --git a/lib/microservices/server/server.d.ts b/lib/microservices/server/server.d.ts index 1ee3d5adb04..a6c9c4663ae 100644 --- a/lib/microservices/server/server.d.ts +++ b/lib/microservices/server/server.d.ts @@ -8,12 +8,15 @@ import 'rxjs/add/operator/finally'; import 'rxjs/add/observable/empty'; import 'rxjs/add/observable/of'; import 'rxjs/add/observable/fromPromise'; -export declare abstract class Server { - protected readonly messageHandlers: MessageHandlers; - protected readonly logger: Logger; - getHandlers(): MessageHandlers; - add(pattern: any, callback: (data) => Promise>): void; - send(stream$: Observable, respond: (data: MicroserviceResponse) => void): Subscription; - transformToObservable(resultOrDeffered: any): any; - protected handleError(error: string): void; +export abstract class Server { + protected readonly messageHandlers: MessageHandlers; + protected readonly logger: Logger; + getHandlers(): MessageHandlers; + add(pattern: any, callback: (data) => Promise>): void; + send( + stream$: Observable, + respond: (data: MicroserviceResponse) => void, + ): Subscription; + transformToObservable(resultOrDeffered: any): any; + protected handleError(error: string): void; } diff --git a/lib/microservices/utils/client.decorator.d.ts b/lib/microservices/utils/client.decorator.d.ts index 31ffc195a66..0cf311f4e53 100644 --- a/lib/microservices/utils/client.decorator.d.ts +++ b/lib/microservices/utils/client.decorator.d.ts @@ -10,4 +10,6 @@ import { ClientMetadata } from '../interfaces/client-metadata.interface'; * port?: number; * host?: string; */ -export declare const Client: (metadata?: ClientMetadata) => (target: object, propertyKey: string | symbol) => void; +export declare const Client: ( + metadata?: ClientMetadata, +) => (target: object, propertyKey: string | symbol) => void; diff --git a/lib/microservices/utils/pattern.decorator.d.ts b/lib/microservices/utils/pattern.decorator.d.ts index fb99bc2c0f1..a9c0554b0f2 100644 --- a/lib/microservices/utils/pattern.decorator.d.ts +++ b/lib/microservices/utils/pattern.decorator.d.ts @@ -3,4 +3,6 @@ import { PatternMetadata } from '../interfaces/pattern-metadata.interface'; /** * Subscribes to the messages, which fulfils chosen pattern. */ -export declare const MessagePattern: (metadata?: string | PatternMetadata) => MethodDecorator; +export declare const MessagePattern: ( + metadata?: string | PatternMetadata, +) => MethodDecorator; diff --git a/lib/testing/interfaces/override-by-factory-options.interface.d.ts b/lib/testing/interfaces/override-by-factory-options.interface.d.ts index 87bffb82d28..6de3261193c 100644 --- a/lib/testing/interfaces/override-by-factory-options.interface.d.ts +++ b/lib/testing/interfaces/override-by-factory-options.interface.d.ts @@ -1,4 +1,4 @@ export interface OverrideByFactoryOptions { - factory: (...args) => any; - inject?: any[]; + factory: (...args) => any; + inject?: any[]; } diff --git a/lib/testing/interfaces/override-by.interface.d.ts b/lib/testing/interfaces/override-by.interface.d.ts index 3e4447fdc80..c6620de87fa 100644 --- a/lib/testing/interfaces/override-by.interface.d.ts +++ b/lib/testing/interfaces/override-by.interface.d.ts @@ -1,7 +1,7 @@ import { OverrideByFactoryOptions } from './override-by-factory-options.interface'; import { TestingModuleBuilder } from '../testing-module.builder'; export interface OverrideBy { - useValue: (value) => TestingModuleBuilder; - useFactory: (options: OverrideByFactoryOptions) => TestingModuleBuilder; - useClass: (metatype) => TestingModuleBuilder; + useValue: (value) => TestingModuleBuilder; + useFactory: (options: OverrideByFactoryOptions) => TestingModuleBuilder; + useClass: (metatype) => TestingModuleBuilder; } diff --git a/lib/testing/test.d.ts b/lib/testing/test.d.ts index bebc805af2e..719b3e2a2a7 100644 --- a/lib/testing/test.d.ts +++ b/lib/testing/test.d.ts @@ -1,7 +1,7 @@ import { ModuleMetadata } from '@nestjs/common/interfaces/modules/module-metadata.interface'; import { TestingModuleBuilder } from './testing-module.builder'; export declare class Test { - private static metadataScanner; - static createTestingModule(metadata: ModuleMetadata): TestingModuleBuilder; - private static init(); + private static metadataScanner; + static createTestingModule(metadata: ModuleMetadata): TestingModuleBuilder; + private static init(); } diff --git a/lib/testing/testing-module.builder.d.ts b/lib/testing/testing-module.builder.d.ts index f6c85cb7b3d..0b57f3a692c 100644 --- a/lib/testing/testing-module.builder.d.ts +++ b/lib/testing/testing-module.builder.d.ts @@ -3,17 +3,17 @@ import { MetadataScanner } from '@nestjs/core/metadata-scanner'; import { ModuleMetadata } from '@nestjs/common/interfaces'; import { TestingModule } from './testing-module'; export declare class TestingModuleBuilder { - private readonly container; - private readonly overloadsMap; - private readonly scanner; - private readonly instanceLoader; - private readonly module; - constructor(metadataScanner: MetadataScanner, metadata: ModuleMetadata); - overrideGuard(typeOrToken: any): OverrideBy; - overrideInterceptor(typeOrToken: any): OverrideBy; - overrideComponent(typeOrToken: any): OverrideBy; - compile(): Promise; - private override(typeOrToken, isComponent); - private createOverrideByBuilder(add); - private createModule(metadata); + private readonly container; + private readonly overloadsMap; + private readonly scanner; + private readonly instanceLoader; + private readonly module; + constructor(metadataScanner: MetadataScanner, metadata: ModuleMetadata); + overrideGuard(typeOrToken: any): OverrideBy; + overrideInterceptor(typeOrToken: any): OverrideBy; + overrideComponent(typeOrToken: any): OverrideBy; + compile(): Promise; + private override(typeOrToken, isComponent); + private createOverrideByBuilder(add); + private createModule(metadata); } diff --git a/lib/testing/testing-module.d.ts b/lib/testing/testing-module.d.ts index 984763cd41b..8a2f6505389 100644 --- a/lib/testing/testing-module.d.ts +++ b/lib/testing/testing-module.d.ts @@ -4,7 +4,11 @@ import { NestApplicationContext } from '@nestjs/core'; import { INestApplication, INestMicroservice } from '@nestjs/common'; import { MicroserviceConfiguration } from '@nestjs/common/interfaces/microservices/microservice-configuration.interface'; export declare class TestingModule extends NestApplicationContext { - constructor(container: NestContainer, scope: NestModuleMetatype[], contextModule: any); - createNestApplication(expressInstance?: any): INestApplication; - createNestMicroservice(config: MicroserviceConfiguration): INestMicroservice; + constructor( + container: NestContainer, + scope: NestModuleMetatype[], + contextModule: any, + ); + createNestApplication(expressInstance?: any): INestApplication; + createNestMicroservice(config: MicroserviceConfiguration): INestMicroservice; } diff --git a/lib/websockets/adapters/io-adapter.d.ts b/lib/websockets/adapters/io-adapter.d.ts index 63db1abe51c..106d3ffc7e6 100644 --- a/lib/websockets/adapters/io-adapter.d.ts +++ b/lib/websockets/adapters/io-adapter.d.ts @@ -9,13 +9,17 @@ import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/filter'; import 'rxjs/add/operator/do'; export declare class IoAdapter implements WebSocketAdapter { - private readonly httpServer; - constructor(httpServer?: Server | null); - create(port: number): SocketIO.Server; - createWithNamespace(port: number, namespace: string, server?: any): any; - createIOServer(port: number): SocketIO.Server; - bindClientConnect(server: any, callback: (...args) => void): void; - bindClientDisconnect(client: any, callback: (...args) => void): void; - bindMessageHandlers(client: any, handlers: MessageMappingProperties[], process: (data: any) => Observable): void; - bindMiddleware(server: any, middleware: (socket, next) => void): void; + private readonly httpServer; + constructor(httpServer?: Server | null); + create(port: number): SocketIO.Server; + createWithNamespace(port: number, namespace: string, server?: any): any; + createIOServer(port: number): SocketIO.Server; + bindClientConnect(server: any, callback: (...args) => void): void; + bindClientDisconnect(client: any, callback: (...args) => void): void; + bindMessageHandlers( + client: any, + handlers: MessageMappingProperties[], + process: (data: any) => Observable, + ): void; + bindMiddleware(server: any, middleware: (socket, next) => void): void; } diff --git a/lib/websockets/constants.d.ts b/lib/websockets/constants.d.ts index 04528be1a90..248744ea715 100644 --- a/lib/websockets/constants.d.ts +++ b/lib/websockets/constants.d.ts @@ -1,9 +1,9 @@ -export declare const MESSAGE_MAPPING_METADATA = "__isMessageMapping"; -export declare const MESSAGE_METADATA = "message"; -export declare const GATEWAY_SERVER_METADATA = "__isSocketServer"; -export declare const GATEWAY_METADATA = "__isGateway"; -export declare const NAMESPACE_METADATA = "namespace"; -export declare const PORT_METADATA = "port"; -export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddlewares"; -export declare const CONNECTION_EVENT = "connection"; -export declare const DISCONNECT_EVENT = "disconnect"; +export declare const MESSAGE_MAPPING_METADATA = '__isMessageMapping'; +export declare const MESSAGE_METADATA = 'message'; +export declare const GATEWAY_SERVER_METADATA = '__isSocketServer'; +export declare const GATEWAY_METADATA = '__isGateway'; +export declare const NAMESPACE_METADATA = 'namespace'; +export declare const PORT_METADATA = 'port'; +export declare const GATEWAY_MIDDLEWARES = '__gatewayMiddlewares'; +export declare const CONNECTION_EVENT = 'connection'; +export declare const DISCONNECT_EVENT = 'disconnect'; diff --git a/lib/websockets/container.d.ts b/lib/websockets/container.d.ts index 2a2df557bc4..349468cae74 100644 --- a/lib/websockets/container.d.ts +++ b/lib/websockets/container.d.ts @@ -1,8 +1,12 @@ import { ObservableSocketServer } from './interfaces'; export declare class SocketsContainer { - private readonly observableServers; - getAllServers(): Map; - getServerByPort(port: number): ObservableSocketServer; - addServer(namespace: string, port: number, server: ObservableSocketServer): void; - clear(): void; + private readonly observableServers; + getAllServers(): Map; + getServerByPort(port: number): ObservableSocketServer; + addServer( + namespace: string, + port: number, + server: ObservableSocketServer, + ): void; + clear(): void; } diff --git a/lib/websockets/context/exception-filters-context.d.ts b/lib/websockets/context/exception-filters-context.d.ts index 77683487b9f..ce9b23c2315 100644 --- a/lib/websockets/context/exception-filters-context.d.ts +++ b/lib/websockets/context/exception-filters-context.d.ts @@ -3,6 +3,9 @@ import { Controller } from '@nestjs/common/interfaces/controllers/controller.int import { BaseExceptionFilterContext } from '@nestjs/core/exceptions/base-exception-filter-context'; import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler'; export declare class ExceptionFiltersContext extends BaseExceptionFilterContext { - create(instance: Controller, callback: (client, data) => any): WsExceptionsHandler; - getGlobalMetadata(): T; + create( + instance: Controller, + callback: (client, data) => any, + ): WsExceptionsHandler; + getGlobalMetadata(): T; } diff --git a/lib/websockets/context/ws-context-creator.d.ts b/lib/websockets/context/ws-context-creator.d.ts index f1737bcd975..c054eb1e00f 100644 --- a/lib/websockets/context/ws-context-creator.d.ts +++ b/lib/websockets/context/ws-context-creator.d.ts @@ -8,16 +8,32 @@ import { GuardsConsumer } from '@nestjs/core/guards/guards-consumer'; import { InterceptorsConsumer } from '@nestjs/core/interceptors/interceptors-consumer'; import { InterceptorsContextCreator } from '@nestjs/core/interceptors/interceptors-context-creator'; export declare class WsContextCreator { - private readonly wsProxy; - private readonly exceptionFiltersContext; - private readonly pipesCreator; - private readonly pipesConsumer; - private readonly guardsContextCreator; - private readonly guardsConsumer; - private readonly interceptorsContextCreator; - private readonly interceptorsConsumer; - constructor(wsProxy: WsProxy, exceptionFiltersContext: ExceptionFiltersContext, pipesCreator: PipesContextCreator, pipesConsumer: PipesConsumer, guardsContextCreator: GuardsContextCreator, guardsConsumer: GuardsConsumer, interceptorsContextCreator: InterceptorsContextCreator, interceptorsConsumer: InterceptorsConsumer); - create(instance: Controller, callback: (client, data) => void, module: any): (client, data) => Promise; - reflectCallbackParamtypes(instance: Controller, callback: (...args) => any): any[]; - getDataMetatype(instance: any, callback: any): any; + private readonly wsProxy; + private readonly exceptionFiltersContext; + private readonly pipesCreator; + private readonly pipesConsumer; + private readonly guardsContextCreator; + private readonly guardsConsumer; + private readonly interceptorsContextCreator; + private readonly interceptorsConsumer; + constructor( + wsProxy: WsProxy, + exceptionFiltersContext: ExceptionFiltersContext, + pipesCreator: PipesContextCreator, + pipesConsumer: PipesConsumer, + guardsContextCreator: GuardsContextCreator, + guardsConsumer: GuardsConsumer, + interceptorsContextCreator: InterceptorsContextCreator, + interceptorsConsumer: InterceptorsConsumer, + ); + create( + instance: Controller, + callback: (client, data) => void, + module: any, + ): (client, data) => Promise; + reflectCallbackParamtypes( + instance: Controller, + callback: (...args) => any, + ): any[]; + getDataMetatype(instance: any, callback: any): any; } diff --git a/lib/websockets/context/ws-proxy.d.ts b/lib/websockets/context/ws-proxy.d.ts index 1b1a63e6cb1..163fecafd6a 100644 --- a/lib/websockets/context/ws-proxy.d.ts +++ b/lib/websockets/context/ws-proxy.d.ts @@ -1,4 +1,7 @@ import { WsExceptionsHandler } from './../exceptions/ws-exceptions-handler'; export declare class WsProxy { - create(targetCallback: (client, data) => Promise, exceptionsHandler: WsExceptionsHandler): (client, data) => Promise; + create( + targetCallback: (client, data) => Promise, + exceptionsHandler: WsExceptionsHandler, + ): (client, data) => Promise; } diff --git a/lib/websockets/exceptions/invalid-socket-port.exception.d.ts b/lib/websockets/exceptions/invalid-socket-port.exception.d.ts index 0bccb046771..9cfacab3182 100644 --- a/lib/websockets/exceptions/invalid-socket-port.exception.d.ts +++ b/lib/websockets/exceptions/invalid-socket-port.exception.d.ts @@ -1,4 +1,4 @@ import { RuntimeException } from '@nestjs/core/errors/exceptions/runtime.exception'; export declare class InvalidSocketPortException extends RuntimeException { - constructor(port: any, type: any); + constructor(port: any, type: any); } diff --git a/lib/websockets/exceptions/ws-exception.d.ts b/lib/websockets/exceptions/ws-exception.d.ts index c51dcf3e2b2..d8a1a1667ff 100644 --- a/lib/websockets/exceptions/ws-exception.d.ts +++ b/lib/websockets/exceptions/ws-exception.d.ts @@ -1,6 +1,6 @@ export declare class WsException extends Error { - private readonly error; - readonly message: any; - constructor(error: string | object); - getError(): string | object; + private readonly error; + readonly message: any; + constructor(error: string | object); + getError(): string | object; } diff --git a/lib/websockets/exceptions/ws-exceptions-handler.d.ts b/lib/websockets/exceptions/ws-exceptions-handler.d.ts index fc5ed7416fb..446ab51c041 100644 --- a/lib/websockets/exceptions/ws-exceptions-handler.d.ts +++ b/lib/websockets/exceptions/ws-exceptions-handler.d.ts @@ -1,8 +1,8 @@ import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions/exception-filter-metadata.interface'; import { WsException } from '../exceptions/ws-exception'; export declare class WsExceptionsHandler { - private filters; - handle(exception: Error | WsException | any, client: any): any; - setCustomFilters(filters: ExceptionFilterMetadata[]): void; - invokeCustomFilters(exception: any, client: any): boolean; + private filters; + handle(exception: Error | WsException | any, client: any): any; + setCustomFilters(filters: ExceptionFilterMetadata[]): void; + invokeCustomFilters(exception: any, client: any): boolean; } diff --git a/lib/websockets/gateway-metadata-explorer.d.ts b/lib/websockets/gateway-metadata-explorer.d.ts index f3fbfe5d98f..15b2a9fefc8 100644 --- a/lib/websockets/gateway-metadata-explorer.d.ts +++ b/lib/websockets/gateway-metadata-explorer.d.ts @@ -2,13 +2,16 @@ import { NestGateway } from './interfaces/nest-gateway.interface'; import { MetadataScanner } from '@nestjs/core/metadata-scanner'; import { Observable } from 'rxjs/Observable'; export declare class GatewayMetadataExplorer { - private readonly metadataScanner; - constructor(metadataScanner: MetadataScanner); - explore(instance: NestGateway): MessageMappingProperties[]; - exploreMethodMetadata(instancePrototype: any, methodName: string): MessageMappingProperties; - scanForServerHooks(instance: NestGateway): IterableIterator; + private readonly metadataScanner; + constructor(metadataScanner: MetadataScanner); + explore(instance: NestGateway): MessageMappingProperties[]; + exploreMethodMetadata( + instancePrototype: any, + methodName: string, + ): MessageMappingProperties; + scanForServerHooks(instance: NestGateway): IterableIterator; } export interface MessageMappingProperties { - message: string; - callback: (...args) => Observable | Promise | void; + message: string; + callback: (...args) => Observable | Promise | void; } diff --git a/lib/websockets/interfaces/gateway-metadata.interface.d.ts b/lib/websockets/interfaces/gateway-metadata.interface.d.ts index dca57bb6116..cfb93c47e9e 100644 --- a/lib/websockets/interfaces/gateway-metadata.interface.d.ts +++ b/lib/websockets/interfaces/gateway-metadata.interface.d.ts @@ -1,7 +1,7 @@ import { Metatype } from '@nestjs/common/interfaces/metatype.interface'; import { GatewayMiddleware } from './gateway-middleware.interface'; export interface GatewayMetadata { - port?: number; - namespace?: string; - middlewares?: Metatype[]; + port?: number; + namespace?: string; + middlewares?: Metatype[]; } diff --git a/lib/websockets/interfaces/gateway-middleware.interface.d.ts b/lib/websockets/interfaces/gateway-middleware.interface.d.ts index e3cea273e1e..7cf923417cf 100644 --- a/lib/websockets/interfaces/gateway-middleware.interface.d.ts +++ b/lib/websockets/interfaces/gateway-middleware.interface.d.ts @@ -1,3 +1,3 @@ export interface GatewayMiddleware { - resolve(): (socket, next) => void; + resolve(): (socket, next) => void; } diff --git a/lib/websockets/interfaces/nest-gateway.interface.d.ts b/lib/websockets/interfaces/nest-gateway.interface.d.ts index 51b96ee1671..07c40bb32d0 100644 --- a/lib/websockets/interfaces/nest-gateway.interface.d.ts +++ b/lib/websockets/interfaces/nest-gateway.interface.d.ts @@ -1,5 +1,5 @@ export interface NestGateway { - afterInit?: (server: any) => void; - handleConnection?: (client: any) => void; - handleDisconnect?: (client: any) => void; + afterInit?: (server: any) => void; + handleConnection?: (client: any) => void; + handleDisconnect?: (client: any) => void; } diff --git a/lib/websockets/interfaces/observable-socket-server.interface.d.ts b/lib/websockets/interfaces/observable-socket-server.interface.d.ts index 4ee67465647..cd453280f14 100644 --- a/lib/websockets/interfaces/observable-socket-server.interface.d.ts +++ b/lib/websockets/interfaces/observable-socket-server.interface.d.ts @@ -1,8 +1,8 @@ import { ReplaySubject } from 'rxjs/ReplaySubject'; import { Subject } from 'rxjs/Subject'; export interface ObservableSocketServer { - server: any; - init: ReplaySubject; - connection: Subject; - disconnect: Subject; + server: any; + init: ReplaySubject; + connection: Subject; + disconnect: Subject; } diff --git a/lib/websockets/interfaces/on-gateway-connection.interface.d.ts b/lib/websockets/interfaces/on-gateway-connection.interface.d.ts index a7daeb395a5..d505e14d697 100644 --- a/lib/websockets/interfaces/on-gateway-connection.interface.d.ts +++ b/lib/websockets/interfaces/on-gateway-connection.interface.d.ts @@ -1,3 +1,3 @@ export interface OnGatewayConnection { - handleConnection(client: any): any; + handleConnection(client: any): any; } diff --git a/lib/websockets/interfaces/on-gateway-disconnect.interface.d.ts b/lib/websockets/interfaces/on-gateway-disconnect.interface.d.ts index f71c0cfae93..55eeaffa4d1 100644 --- a/lib/websockets/interfaces/on-gateway-disconnect.interface.d.ts +++ b/lib/websockets/interfaces/on-gateway-disconnect.interface.d.ts @@ -1,3 +1,3 @@ export interface OnGatewayDisconnect { - handleDisconnect(client: any): any; + handleDisconnect(client: any): any; } diff --git a/lib/websockets/interfaces/on-gateway-init.interface.d.ts b/lib/websockets/interfaces/on-gateway-init.interface.d.ts index 0e4521cddb8..392a2a6cc45 100644 --- a/lib/websockets/interfaces/on-gateway-init.interface.d.ts +++ b/lib/websockets/interfaces/on-gateway-init.interface.d.ts @@ -1,3 +1,3 @@ export interface OnGatewayInit { - afterInit(server: any): any; + afterInit(server: any): any; } diff --git a/lib/websockets/interfaces/web-socket-server.interface.d.ts b/lib/websockets/interfaces/web-socket-server.interface.d.ts index cfaa6414cbb..eacd80be493 100644 --- a/lib/websockets/interfaces/web-socket-server.interface.d.ts +++ b/lib/websockets/interfaces/web-socket-server.interface.d.ts @@ -1,4 +1,4 @@ export interface WebSocketServerData { - port: number; - namespace: string; + port: number; + namespace: string; } diff --git a/lib/websockets/interfaces/ws-response.interface.d.ts b/lib/websockets/interfaces/ws-response.interface.d.ts index 5c7710b08c2..2df913fbd9b 100644 --- a/lib/websockets/interfaces/ws-response.interface.d.ts +++ b/lib/websockets/interfaces/ws-response.interface.d.ts @@ -1,4 +1,4 @@ export interface WsResponse { - event: string; - data: T; + event: string; + data: T; } diff --git a/lib/websockets/middlewares-injector.d.ts b/lib/websockets/middlewares-injector.d.ts index e6b4f369300..fe54f6ecbec 100644 --- a/lib/websockets/middlewares-injector.d.ts +++ b/lib/websockets/middlewares-injector.d.ts @@ -1,16 +1,26 @@ import 'reflect-metadata'; -import { NestContainer, InstanceWrapper } from '@nestjs/core/injector/container'; +import { + NestContainer, + InstanceWrapper, +} from '@nestjs/core/injector/container'; import { NestGateway } from './index'; import { Injectable } from '@nestjs/common/interfaces/injectable.interface'; import { GatewayMiddleware } from './interfaces/gateway-middleware.interface'; import { ApplicationConfig } from '@nestjs/core/application-config'; export declare class MiddlewaresInjector { - private readonly container; - private readonly config; - constructor(container: NestContainer, config: ApplicationConfig); - inject(server: any, instance: NestGateway, module: string): void; - reflectMiddlewaresTokens(instance: NestGateway): any[]; - applyMiddlewares(server: any, components: Map>, tokens: any[]): void; - bindMiddleware(token: string, components: Map>): any; - isGatewayMiddleware(middleware: object): middleware is GatewayMiddleware; + private readonly container; + private readonly config; + constructor(container: NestContainer, config: ApplicationConfig); + inject(server: any, instance: NestGateway, module: string): void; + reflectMiddlewaresTokens(instance: NestGateway): any[]; + applyMiddlewares( + server: any, + components: Map>, + tokens: any[], + ): void; + bindMiddleware( + token: string, + components: Map>, + ): any; + isGatewayMiddleware(middleware: object): middleware is GatewayMiddleware; } diff --git a/lib/websockets/observable-socket.d.ts b/lib/websockets/observable-socket.d.ts index a0f335c39e6..5c674f01be7 100644 --- a/lib/websockets/observable-socket.d.ts +++ b/lib/websockets/observable-socket.d.ts @@ -1,4 +1,4 @@ import { ObservableSocketServer } from './interfaces/observable-socket-server.interface'; export declare class ObservableSocket { - static create(server: any): ObservableSocketServer; + static create(server: any): ObservableSocketServer; } diff --git a/lib/websockets/socket-module.d.ts b/lib/websockets/socket-module.d.ts index 6b30183e066..cdac8c5ebe3 100644 --- a/lib/websockets/socket-module.d.ts +++ b/lib/websockets/socket-module.d.ts @@ -2,11 +2,17 @@ import 'reflect-metadata'; import { InstanceWrapper } from '@nestjs/core/injector/container'; import { Injectable } from '@nestjs/common/interfaces/injectable.interface'; export declare class SocketModule { - private socketsContainer; - private webSocketsController; - setup(container: any, config: any): void; - hookGatewaysIntoServers(components: Map>, moduleName: string): void; - hookGatewayIntoServer(wrapper: InstanceWrapper, moduleName: string): void; - close(): void; - private getContextCreator(container); + private socketsContainer; + private webSocketsController; + setup(container: any, config: any): void; + hookGatewaysIntoServers( + components: Map>, + moduleName: string, + ): void; + hookGatewayIntoServer( + wrapper: InstanceWrapper, + moduleName: string, + ): void; + close(): void; + private getContextCreator(container); } diff --git a/lib/websockets/socket-server-provider.d.ts b/lib/websockets/socket-server-provider.d.ts index 85794b3cb0d..ba03f6be103 100644 --- a/lib/websockets/socket-server-provider.d.ts +++ b/lib/websockets/socket-server-provider.d.ts @@ -2,12 +2,15 @@ import { SocketsContainer } from './container'; import { ObservableSocketServer } from './interfaces/observable-socket-server.interface'; import { ApplicationConfig } from '@nestjs/core/application-config'; export declare class SocketServerProvider { - private readonly socketsContainer; - private readonly applicationConfig; - constructor(socketsContainer: SocketsContainer, applicationConfig: ApplicationConfig); - scanForSocketServer(namespace: string, port: number): ObservableSocketServer; - private createSocketServer(namespace, port); - private createWithNamespace(namespace, port, observableSocket); - private getServerOfNamespace(namespace, port, server); - private validateNamespace(namespace); + private readonly socketsContainer; + private readonly applicationConfig; + constructor( + socketsContainer: SocketsContainer, + applicationConfig: ApplicationConfig, + ); + scanForSocketServer(namespace: string, port: number): ObservableSocketServer; + private createSocketServer(namespace, port); + private createWithNamespace(namespace, port, observableSocket); + private getServerOfNamespace(namespace, port, server); + private validateNamespace(namespace); } diff --git a/lib/websockets/utils/socket-gateway.decorator.d.ts b/lib/websockets/utils/socket-gateway.decorator.d.ts index 5141700f35f..9e72bfd8b4a 100644 --- a/lib/websockets/utils/socket-gateway.decorator.d.ts +++ b/lib/websockets/utils/socket-gateway.decorator.d.ts @@ -4,4 +4,6 @@ import { GatewayMetadata } from '../interfaces'; * Defines the Gateway. The gateway can inject dependencies through constructor. * Those dependencies should belongs to the same module. Gateway is listening on the specified port. */ -export declare const WebSocketGateway: (metadataOrPort?: number | GatewayMetadata) => ClassDecorator; +export declare const WebSocketGateway: ( + metadataOrPort?: number | GatewayMetadata, +) => ClassDecorator; diff --git a/lib/websockets/utils/subscribe-message.decorator.d.ts b/lib/websockets/utils/subscribe-message.decorator.d.ts index fae2e1f519d..0c136110dd3 100644 --- a/lib/websockets/utils/subscribe-message.decorator.d.ts +++ b/lib/websockets/utils/subscribe-message.decorator.d.ts @@ -2,6 +2,10 @@ import 'reflect-metadata'; /** * Subscribes to the messages, which fulfils chosen pattern. */ -export declare const SubscribeMessage: (message?: string | { - value: string; -}) => MethodDecorator; +export declare const SubscribeMessage: ( + message?: + | string + | { + value: string; + }, +) => MethodDecorator; diff --git a/lib/websockets/web-sockets-controller.d.ts b/lib/websockets/web-sockets-controller.d.ts index f283f43b028..7a0d9e3b064 100644 --- a/lib/websockets/web-sockets-controller.d.ts +++ b/lib/websockets/web-sockets-controller.d.ts @@ -14,24 +14,58 @@ import 'rxjs/add/observable/fromPromise'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/switchMap'; export declare class WebSocketsController { - private readonly socketServerProvider; - private readonly container; - private readonly config; - private readonly contextCreator; - private readonly metadataExplorer; - private readonly middlewaresInjector; - constructor(socketServerProvider: SocketServerProvider, container: NestContainer, config: ApplicationConfig, contextCreator: WsContextCreator); - hookGatewayIntoServer(instance: NestGateway, metatype: Metatype, module: string): void; - subscribeObservableServer(instance: NestGateway, namespace: string, port: number, module: string): void; - injectMiddlewares({server}: { - server: any; - }, instance: NestGateway, module: string): void; - subscribeEvents(instance: NestGateway, messageHandlers: MessageMappingProperties[], observableServer: ObservableSocketServer): void; - getConnectionHandler(context: WebSocketsController, instance: NestGateway, messageHandlers: MessageMappingProperties[], disconnect: Subject, connection: Subject): (client: any) => void; - subscribeInitEvent(instance: NestGateway, event: Subject): void; - subscribeConnectionEvent(instance: NestGateway, event: Subject): void; - subscribeDisconnectEvent(instance: NestGateway, event: Subject): void; - subscribeMessages(messageHandlers: MessageMappingProperties[], client: any, instance: NestGateway): void; - pickResult(defferedResult: Promise): Promise>; - private hookServerToProperties(instance, server); + private readonly socketServerProvider; + private readonly container; + private readonly config; + private readonly contextCreator; + private readonly metadataExplorer; + private readonly middlewaresInjector; + constructor( + socketServerProvider: SocketServerProvider, + container: NestContainer, + config: ApplicationConfig, + contextCreator: WsContextCreator, + ); + hookGatewayIntoServer( + instance: NestGateway, + metatype: Metatype, + module: string, + ): void; + subscribeObservableServer( + instance: NestGateway, + namespace: string, + port: number, + module: string, + ): void; + injectMiddlewares( + { + server, + }: { + server: any; + }, + instance: NestGateway, + module: string, + ): void; + subscribeEvents( + instance: NestGateway, + messageHandlers: MessageMappingProperties[], + observableServer: ObservableSocketServer, + ): void; + getConnectionHandler( + context: WebSocketsController, + instance: NestGateway, + messageHandlers: MessageMappingProperties[], + disconnect: Subject, + connection: Subject, + ): (client: any) => void; + subscribeInitEvent(instance: NestGateway, event: Subject): void; + subscribeConnectionEvent(instance: NestGateway, event: Subject): void; + subscribeDisconnectEvent(instance: NestGateway, event: Subject): void; + subscribeMessages( + messageHandlers: MessageMappingProperties[], + client: any, + instance: NestGateway, + ): void; + pickResult(defferedResult: Promise): Promise>; + private hookServerToProperties(instance, server); } diff --git a/package-lock.json b/package-lock.json index cfb7b63466c..40c60dddc2f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nestjs", - "version": "4.6.5", + "version": "4.6.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1816,6 +1816,12 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, + "cookiejar": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.1.tgz", + "integrity": "sha1-Qa1XsbVVlR7BcUEqgZQrHoIA00o=", + "dev": true + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -3208,6 +3214,12 @@ "samsam": "1.3.0" } }, + "formidable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.0.tgz", + "integrity": "sha512-hr9aT30rAi7kf8Q2aaTpSP7xGMhlJ+MdrUDVZs3rxbD3L/K46A86s2VY7qC2D2kGYGBtiT/3j6wTx1eeUq5xAQ==", + "dev": true + }, "forwarded": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", @@ -3258,7 +3270,7 @@ }, "fsevents": { "version": "1.1.3", - "resolved": "http://192.168.228.42:5000/fsevents/-/fsevents-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", "dev": true, "optional": true, @@ -4657,13 +4669,13 @@ "dependencies": { "isarray": { "version": "0.0.1", - "resolved": "http://192.168.228.42:5000/isarray/-/isarray-0.0.1.tgz", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, "readable-stream": { "version": "1.0.34", - "resolved": "http://192.168.228.42:5000/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { @@ -4675,13 +4687,13 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://192.168.228.42:5000/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, "through2": { "version": "0.6.5", - "resolved": "http://192.168.228.42:5000/through2/-/through2-0.6.5.tgz", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", "dev": true, "requires": { @@ -4751,7 +4763,7 @@ }, "gulp-diff": { "version": "1.0.0", - "resolved": "http://192.168.228.42:5000/gulp-diff/-/gulp-diff-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/gulp-diff/-/gulp-diff-1.0.0.tgz", "integrity": "sha1-EBsjcS3WsQe9B9BauI6jrEhf7Xc=", "dev": true, "requires": { @@ -4764,7 +4776,7 @@ "dependencies": { "diff": { "version": "2.2.3", - "resolved": "http://192.168.228.42:5000/diff/-/diff-2.2.3.tgz", + "resolved": "https://registry.npmjs.org/diff/-/diff-2.2.3.tgz", "integrity": "sha1-YOr9DSjukG5Oj/ClLBIpUhAzv5k=", "dev": true } @@ -6987,7 +6999,7 @@ }, "nan": { "version": "2.8.0", - "resolved": "http://192.168.228.42:5000/nan/-/nan-2.8.0.tgz", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", "dev": true, "optional": true @@ -9007,7 +9019,7 @@ }, "pkginfo": { "version": "0.3.1", - "resolved": "http://192.168.228.42:5000/pkginfo/-/pkginfo-0.3.1.tgz", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", "dev": true }, @@ -10177,7 +10189,7 @@ }, "stream-combiner2": { "version": "1.1.1", - "resolved": "http://192.168.228.42:5000/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", "dev": true, "requires": { @@ -10187,7 +10199,7 @@ "dependencies": { "duplexer2": { "version": "0.1.4", - "resolved": "http://192.168.228.42:5000/duplexer2/-/duplexer2-0.1.4.tgz", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", "dev": true, "requires": { @@ -10204,7 +10216,7 @@ }, "stream-equal": { "version": "0.1.6", - "resolved": "http://192.168.228.42:5000/stream-equal/-/stream-equal-0.1.6.tgz", + "resolved": "https://registry.npmjs.org/stream-equal/-/stream-equal-0.1.6.tgz", "integrity": "sha1-zFIvqzhRYBLk1O5HUTsUe3I1kBk=", "dev": true }, @@ -10344,6 +10356,71 @@ } } }, + "superagent": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.2.tgz", + "integrity": "sha512-gVH4QfYHcY3P0f/BZzavLreHW3T1v7hG9B+hpMQotGQqurOvhv87GcMCd6LWySmBuf+BDR44TQd0aISjVHLeNQ==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "cookiejar": "2.1.1", + "debug": "3.1.0", + "extend": "3.0.1", + "form-data": "2.3.2", + "formidable": "1.2.0", + "methods": "1.1.2", + "mime": "1.4.1", + "qs": "6.5.1", + "readable-stream": "2.3.3" + }, + "dependencies": { + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.17" + } + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + } + } + }, + "supertest": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/supertest/-/supertest-3.0.0.tgz", + "integrity": "sha1-jUu2j9GDDuBwM7HFpamkAhyWUpY=", + "dev": true, + "requires": { + "methods": "1.1.2", + "superagent": "3.8.2" + } + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", diff --git a/package.json b/package.json index 22be0b77f5b..5a6ac8eca88 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "test": "nyc --require ts-node/register mocha src/**/*.spec.ts --reporter spec", + "integration-test": "mocha integration/**/*.spec.ts --reporter spec --require ts-node/register", "coverage": "nyc report --reporter=text-lcov | coveralls", "prettier": "prettier */**/*.ts --ignore-path ./.prettierignore --write && git status", "build": "gulp build && gulp move", @@ -16,6 +17,10 @@ "engines": { "node": ">=6.11.0" }, + "repository": { + "type": "git", + "url": "https://github.com/nestjs/nest" + }, "author": "Kamil Mysliwiec", "license": "MIT", "dependencies": { @@ -79,6 +84,7 @@ "prettier": "^1.9.2", "sinon": "^2.1.0", "sinon-chai": "^2.8.0", + "supertest": "^3.0.0", "ts-node": "^3.2.0" }, "collective": { diff --git a/src/common/decorators/http/index.ts b/src/common/decorators/http/index.ts index 30ee622c394..724410aca69 100644 --- a/src/common/decorators/http/index.ts +++ b/src/common/decorators/http/index.ts @@ -2,4 +2,4 @@ export * from './request-mapping.decorator'; export * from './route-params.decorator'; export * from './http-code.decorator'; export * from './create-route-param-metadata.decorator'; -export * from './render.decorator'; \ No newline at end of file +export * from './render.decorator'; diff --git a/src/common/enums/route-paramtypes.enum.ts b/src/common/enums/route-paramtypes.enum.ts index fc74aebf660..ccb2aa97e7c 100644 --- a/src/common/enums/route-paramtypes.enum.ts +++ b/src/common/enums/route-paramtypes.enum.ts @@ -8,5 +8,5 @@ export enum RouteParamtypes { HEADERS, SESSION, FILE, - FILES + FILES, } diff --git a/src/common/http/index.ts b/src/common/http/index.ts index abdf07854b1..c13030e8282 100644 --- a/src/common/http/index.ts +++ b/src/common/http/index.ts @@ -1,2 +1,2 @@ export * from './http.module'; -export * from './http.service'; \ No newline at end of file +export * from './http.service'; diff --git a/src/common/interceptors/files.interceptor.ts b/src/common/interceptors/files.interceptor.ts index e324e5427d9..5bcbcba18c7 100644 --- a/src/common/interceptors/files.interceptor.ts +++ b/src/common/interceptors/files.interceptor.ts @@ -4,7 +4,11 @@ import { Observable } from 'rxjs/Observable'; import { MulterOptions } from '../interfaces/external/multer-options.interface'; import { transformException } from './multer/multer.utils'; -export function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions) { +export function FilesInterceptor( + fieldName: string, + maxCount?: number, + options?: MulterOptions, +) { const Interceptor = class implements NestInterceptor { readonly upload = multer(options); diff --git a/src/common/interceptors/index.ts b/src/common/interceptors/index.ts index 9b985c53c82..73fb2b02f45 100644 --- a/src/common/interceptors/index.ts +++ b/src/common/interceptors/index.ts @@ -1,2 +1,2 @@ export * from './file.interceptor'; -export * from './files.interceptor'; \ No newline at end of file +export * from './files.interceptor'; diff --git a/src/common/interceptors/multer/multer.utils.ts b/src/common/interceptors/multer/multer.utils.ts index 914dbd76de2..1f9ccf0fd2c 100644 --- a/src/common/interceptors/multer/multer.utils.ts +++ b/src/common/interceptors/multer/multer.utils.ts @@ -1,4 +1,9 @@ -import { InternalServerErrorException, HttpException, PayloadTooLargeException, BadRequestException } from './../../exceptions'; +import { + InternalServerErrorException, + HttpException, + PayloadTooLargeException, + BadRequestException, +} from './../../exceptions'; import { multerExceptions } from './multer.constants'; export function transformException(error: Error | undefined) { @@ -6,15 +11,15 @@ export function transformException(error: Error | undefined) { return error; } switch (error.message) { - case multerExceptions.LIMIT_FILE_SIZE: + case multerExceptions.LIMIT_FILE_SIZE: return new PayloadTooLargeException(error.message); case multerExceptions.LIMIT_FILE_COUNT: - case multerExceptions.LIMIT_FIELD_KEY: - case multerExceptions.LIMIT_FIELD_VALUE: + case multerExceptions.LIMIT_FIELD_KEY: + case multerExceptions.LIMIT_FIELD_VALUE: case multerExceptions.LIMIT_FIELD_COUNT: case multerExceptions.LIMIT_UNEXPECTED_FILE: case multerExceptions.LIMIT_PART_COUNT: return new BadRequestException(error.message); } return error; -} \ No newline at end of file +} diff --git a/src/common/interfaces/nest-application.interface.ts b/src/common/interfaces/nest-application.interface.ts index 3d4befeb8ec..4c09317338e 100644 --- a/src/common/interfaces/nest-application.interface.ts +++ b/src/common/interfaces/nest-application.interface.ts @@ -69,7 +69,11 @@ export interface INestApplication extends INestApplicationContext { * @returns Promise */ listen(port: number | string, callback?: () => void): Promise; - listen(port: number | string, hostname: string, callback?: () => void): Promise; + listen( + port: number | string, + hostname: string, + callback?: () => void, + ): Promise; /** * Starts the application and can be awaited. diff --git a/src/common/pipes/validation.pipe.ts b/src/common/pipes/validation.pipe.ts index c67a4095e1d..aceb36df033 100644 --- a/src/common/pipes/validation.pipe.ts +++ b/src/common/pipes/validation.pipe.ts @@ -33,7 +33,9 @@ export class ValidationPipe implements PipeTransform { } return this.isTransformEnabled ? entity - : Object.keys(this.validatorOptions).length > 0 ? classToPlain(entity) : value; + : Object.keys(this.validatorOptions).length > 0 + ? classToPlain(entity) + : value; } private toValidate(metadata: ArgumentMetadata): boolean { diff --git a/src/common/test/decorators/route-params.decorator.spec.ts b/src/common/test/decorators/route-params.decorator.spec.ts index 251067df439..4737af4a5d6 100644 --- a/src/common/test/decorators/route-params.decorator.spec.ts +++ b/src/common/test/decorators/route-params.decorator.spec.ts @@ -183,7 +183,6 @@ describe('@Patch', () => { }); }); - describe('Inheritance', () => { const requestPath = 'test'; const requestProps = { diff --git a/src/common/test/interceptors/file.interceptor.spec.ts b/src/common/test/interceptors/file.interceptor.spec.ts index 95b877cf35b..fbe7946fc3e 100644 --- a/src/common/test/interceptors/file.interceptor.spec.ts +++ b/src/common/test/interceptors/file.interceptor.spec.ts @@ -16,9 +16,11 @@ describe('FileInterceptor', () => { }); it('should call single() with expected params', async () => { const fieldName = 'file'; - const target = new (FileInterceptor(fieldName)); + const target = new (FileInterceptor(fieldName))(); const callback = (req, res, next) => next(); - const singleSpy = sinon.stub((target as any).upload, 'single').returns(callback); + const singleSpy = sinon + .stub((target as any).upload, 'single') + .returns(callback); const req = {}; await target.intercept(req, null, stream$); diff --git a/src/common/test/interceptors/files.interceptor.spec.ts b/src/common/test/interceptors/files.interceptor.spec.ts index 07f783e423b..85bc4a89901 100644 --- a/src/common/test/interceptors/files.interceptor.spec.ts +++ b/src/common/test/interceptors/files.interceptor.spec.ts @@ -17,10 +17,12 @@ describe('FilesInterceptor', () => { it('should call array() with expected params', async () => { const fieldName = 'file'; const maxCount = 10; - const target = new (FilesInterceptor(fieldName, maxCount)); + const target = new (FilesInterceptor(fieldName, maxCount))(); const callback = (req, res, next) => next(); - const arraySpy = sinon.stub((target as any).upload, 'array').returns(callback); + const arraySpy = sinon + .stub((target as any).upload, 'array') + .returns(callback); await target.intercept({}, null, stream$); diff --git a/src/common/test/pipes/parse-int.pipe.spec.ts b/src/common/test/pipes/parse-int.pipe.spec.ts index 2c33edb9dd8..25d9f05c9b4 100644 --- a/src/common/test/pipes/parse-int.pipe.spec.ts +++ b/src/common/test/pipes/parse-int.pipe.spec.ts @@ -19,8 +19,7 @@ describe('ParseIntPipe', () => { }); describe('when validation fails', () => { it('should throw an error', async () => { - return expect(target.transform('123abc', {} as any)).to.be - .rejected; + return expect(target.transform('123abc', {} as any)).to.be.rejected; }); }); }); diff --git a/src/common/test/pipes/validation.pipe.spec.ts b/src/common/test/pipes/validation.pipe.spec.ts index 19c33fe7b5e..f59e7448ef7 100644 --- a/src/common/test/pipes/validation.pipe.spec.ts +++ b/src/common/test/pipes/validation.pipe.spec.ts @@ -27,9 +27,9 @@ describe('ValidationPipe', () => { it('should return the value unchanged', async () => { const testObj = { prop1: 'value1', prop2: 'value2' }; expect(await target.transform(testObj, {} as any)).to.equal(testObj); - expect(await target.transform(testObj, metadata as any)).to.not.be.instanceOf( - TestModel, - ); + expect( + await target.transform(testObj, metadata as any), + ).to.not.be.instanceOf(TestModel); }); }); describe('when validation fails', () => { @@ -43,43 +43,55 @@ describe('ValidationPipe', () => { }); describe('when validation transforms', () => { it('should return a TestModel instance', async () => { - target = new ValidationPipe({transform: true}); - const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3'}; - expect(await target.transform(testObj, metadata)).to.be.instanceOf(TestModel); + target = new ValidationPipe({ transform: true }); + const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3' }; + expect(await target.transform(testObj, metadata)).to.be.instanceOf( + TestModel, + ); }); describe('when validation strips', () => { it('should return a TestModel without extra properties', async () => { - target = new ValidationPipe({whitelist: true}); - const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3'}; - expect(await target.transform(testObj, metadata)).to.not.be.instanceOf(TestModel); - expect(await target.transform(testObj, metadata)).to.not.have.property('prop3'); + target = new ValidationPipe({ whitelist: true }); + const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3' }; + expect( + await target.transform(testObj, metadata), + ).to.not.be.instanceOf(TestModel); + expect( + await target.transform(testObj, metadata), + ).to.not.have.property('prop3'); }); }); describe('when validation rejects', () => { it('should throw an error', () => { - target = new ValidationPipe({forbidNonWhitelisted: true}); + target = new ValidationPipe({ forbidNonWhitelisted: true }); const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3' }; expect(target.transform(testObj, metadata)).to.be.rejected; }); }); }); - describe('when validation does\'t transform', () => { + describe("when validation does't transform", () => { describe('when validation strips', () => { it('should return a plain object without extra properties', async () => { - target = new ValidationPipe({transform: false, whitelist: true}); - const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3'}; - expect(await target.transform(testObj, metadata)).to.not.be.instanceOf(TestModel); - expect(await target.transform(testObj, metadata)).to.not.have.property('prop3'); + target = new ValidationPipe({ transform: false, whitelist: true }); + const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3' }; + expect( + await target.transform(testObj, metadata), + ).to.not.be.instanceOf(TestModel); + expect( + await target.transform(testObj, metadata), + ).to.not.have.property('prop3'); }); }); describe('when validation rejects', () => { it('should throw an error', () => { - target = new ValidationPipe({transform: false, forbidNonWhitelisted: true}); + target = new ValidationPipe({ + transform: false, + forbidNonWhitelisted: true, + }); const testObj = { prop1: 'value1', prop2: 'value2', prop3: 'value3' }; expect(target.transform(testObj, metadata)).to.be.rejected; }); }); }); }); - -}); \ No newline at end of file +}); diff --git a/src/common/utils/http-exception-body.util.ts b/src/common/utils/http-exception-body.util.ts index be9d206b108..bca0907d4d7 100644 --- a/src/common/utils/http-exception-body.util.ts +++ b/src/common/utils/http-exception-body.util.ts @@ -2,7 +2,4 @@ export const createHttpExceptionBody = ( message: any, error: string, statusCode: number, -) => - message - ? { statusCode, error, message } - : { statusCode, error }; +) => (message ? { statusCode, error, message } : { statusCode, error }); diff --git a/src/core/application-config.ts b/src/core/application-config.ts index 54cdd7092aa..4162e378b9d 100644 --- a/src/core/application-config.ts +++ b/src/core/application-config.ts @@ -36,7 +36,7 @@ export class ApplicationConfig implements ConfigurationProvider { public addGlobalPipe(pipe: PipeTransform) { this.globalPipes.push(pipe); } - + public useGlobalPipes(...pipes: PipeTransform[]) { this.globalPipes = this.globalPipes.concat(pipes); } diff --git a/src/core/constants.ts b/src/core/constants.ts index 2da8bff7f9d..9443d30f71f 100644 --- a/src/core/constants.ts +++ b/src/core/constants.ts @@ -8,4 +8,4 @@ export const messages = { export const APP_INTERCEPTOR = 'APP_INTERCEPTOR'; export const APP_PIPE = 'APP_PIPE'; export const APP_GUARD = 'APP_GUARD'; -export const APP_FILTER = 'APP_FILTER'; \ No newline at end of file +export const APP_FILTER = 'APP_FILTER'; diff --git a/src/core/injector/index.ts b/src/core/injector/index.ts index 15e35804160..d0377ada445 100644 --- a/src/core/injector/index.ts +++ b/src/core/injector/index.ts @@ -1,2 +1,2 @@ export * from './modules-container'; -export * from './tokens'; \ No newline at end of file +export * from './tokens'; diff --git a/src/core/injector/module.ts b/src/core/injector/module.ts index dfbf7da66aa..38f5a7ce943 100644 --- a/src/core/injector/module.ts +++ b/src/core/injector/module.ts @@ -301,9 +301,9 @@ export class Module { const relatedModules = [...this._relatedModules.values()]; const modulesTokens = relatedModules .map(({ metatype }) => metatype) - .filter((metatype) => !!metatype) + .filter(metatype => !!metatype) .map(({ name }) => name); - + if (modulesTokens.indexOf(token) < 0) { const { name } = this.metatype; throw new UnknownExportException(name); diff --git a/src/core/injector/tokens.ts b/src/core/injector/tokens.ts index a5e49a70600..959dd5323fd 100644 --- a/src/core/injector/tokens.ts +++ b/src/core/injector/tokens.ts @@ -1 +1 @@ -export const EXPRESS_REF = 'EXPRESS_REF'; \ No newline at end of file +export const EXPRESS_REF = 'EXPRESS_REF'; diff --git a/src/core/interceptors/interceptors-consumer.ts b/src/core/interceptors/interceptors-consumer.ts index d38781276e0..56ab7e1c49e 100644 --- a/src/core/interceptors/interceptors-consumer.ts +++ b/src/core/interceptors/interceptors-consumer.ts @@ -24,7 +24,7 @@ export class InterceptorsConsumer { next: () => Promise, ): Promise { if (!interceptors || isEmpty(interceptors)) { - return await (await next()); + return await await next(); } const context = this.createContext(instance, callback); const start$ = Observable.defer(() => this.transformDeffered(next)); @@ -47,10 +47,9 @@ export class InterceptorsConsumer { } public transformDeffered(next: () => Promise): Observable { - return Observable.fromPromise(next()) - .switchMap((res) => { - const isDeffered = res instanceof Promise || res instanceof Observable; - return isDeffered ? res : Promise.resolve(res); - }); + return Observable.fromPromise(next()).switchMap(res => { + const isDeffered = res instanceof Promise || res instanceof Observable; + return isDeffered ? res : Promise.resolve(res); + }); } } diff --git a/src/core/metadata-scanner.ts b/src/core/metadata-scanner.ts index 71d3ff6d4d9..237cc527d56 100644 --- a/src/core/metadata-scanner.ts +++ b/src/core/metadata-scanner.ts @@ -28,7 +28,7 @@ export class MetadataScanner { } return !isConstructor(prop) && isFunction(prototype[prop]); }) - .toArray() + .toArray(); } while ( (prototype = Reflect.getPrototypeOf(prototype)) && prototype != Object.prototype diff --git a/src/core/router/route-params-factory.ts b/src/core/router/route-params-factory.ts index d7137a5d447..c37fc8b25fb 100644 --- a/src/core/router/route-params-factory.ts +++ b/src/core/router/route-params-factory.ts @@ -27,7 +27,7 @@ export class RouteParamsFactory implements IRouteParamsFactory { case RouteParamtypes.FILE: return req.file; case RouteParamtypes.FILES: - return req.files; + return req.files; default: return null; } diff --git a/src/core/router/routes-resolver.ts b/src/core/router/routes-resolver.ts index b9e909b6bdb..01f8ff22dda 100644 --- a/src/core/router/routes-resolver.ts +++ b/src/core/router/routes-resolver.ts @@ -94,10 +94,10 @@ export class RoutesResolver implements Resolver { public mapExternalException(err: any) { switch (true) { - case (err instanceof SyntaxError): + case err instanceof SyntaxError: return new BadRequestException(err.message); - default: - return err; + default: + return err; } } } diff --git a/src/core/test/interceptors/interceptors-consumer.spec.ts b/src/core/test/interceptors/interceptors-consumer.spec.ts index aeb10fd9160..8c400c1bfd7 100644 --- a/src/core/test/interceptors/interceptors-consumer.spec.ts +++ b/src/core/test/interceptors/interceptors-consumer.spec.ts @@ -76,14 +76,18 @@ describe('InterceptorsConsumer', () => { it('should return Observable', async () => { const val = 3; const next = async () => val; - expect(await (await consumer.transformDeffered(next).toPromise())).to.be.eql(val); + expect( + await await consumer.transformDeffered(next).toPromise(), + ).to.be.eql(val); }); }); describe('when next() result is Promise', () => { it('should return Observable', async () => { const val = 3; const next = () => Promise.resolve(val); - expect(await (await consumer.transformDeffered(next).toPromise())).to.be.eql(val); + expect( + await await consumer.transformDeffered(next).toPromise(), + ).to.be.eql(val); }); }); describe('when next() result is Observable', () => { diff --git a/src/core/test/metadata-scanner.spec.ts b/src/core/test/metadata-scanner.spec.ts index f3e1b572f2f..f23e267f5a0 100644 --- a/src/core/test/metadata-scanner.spec.ts +++ b/src/core/test/metadata-scanner.spec.ts @@ -16,7 +16,7 @@ describe('MetadataScanner', () => { } set valParent(value) {} } - + class Test extends Parent { constructor() { super(); diff --git a/src/core/test/router/route-params-factory.spec.ts b/src/core/test/router/route-params-factory.spec.ts index 650cc47f95a..bdf02067f2e 100644 --- a/src/core/test/router/route-params-factory.spec.ts +++ b/src/core/test/router/route-params-factory.spec.ts @@ -106,10 +106,7 @@ describe('RouteParamsFactory', () => { describe(`RouteParamtypes.FILE`, () => { it('should returns file object', () => { expect( - (factory as any).exchangeKeyForValue( - RouteParamtypes.FILE, - ...args, - ), + (factory as any).exchangeKeyForValue(RouteParamtypes.FILE, ...args), ).to.be.eql(req.file); }); }); diff --git a/src/core/test/router/router-execution-context.spec.ts b/src/core/test/router/router-execution-context.spec.ts index 1f6721324bd..91e51a9d42c 100644 --- a/src/core/test/router/router-execution-context.spec.ts +++ b/src/core/test/router/router-execution-context.spec.ts @@ -334,7 +334,7 @@ describe('RouterExecutionContext', () => { const template = 'template'; const value = 'test'; const response = { render: sinon.spy() }; - + sinon.stub(contextCreator, 'reflectRenderTemplate').returns(template); const handler = contextCreator.createHandleResponseFn(null, true, 100); handler(value, response); @@ -346,7 +346,7 @@ describe('RouterExecutionContext', () => { it('should not call "res.render()"', () => { const result = Promise.resolve('test'); const response = { render: sinon.spy() }; - + sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined); const handler = contextCreator.createHandleResponseFn(null, true, 100); handler(result, response); diff --git a/src/core/test/router/routes-resolver.spec.ts b/src/core/test/router/routes-resolver.spec.ts index 9c859b276a0..c8c9eec8c84 100644 --- a/src/core/test/router/routes-resolver.spec.ts +++ b/src/core/test/router/routes-resolver.spec.ts @@ -70,7 +70,10 @@ describe('RoutesResolver', () => { const spy = sinon .stub(routesResolver, 'setupRouters') .callsFake(() => undefined); - routesResolver.resolve({ use: sinon.spy() } as any, { use: sinon.spy() } as any); + routesResolver.resolve( + { use: sinon.spy() } as any, + { use: sinon.spy() } as any, + ); expect(spy.calledTwice).to.be.true; }); }); diff --git a/src/core/test/scanner.spec.ts b/src/core/test/scanner.spec.ts index 98518bfadc7..031ab97f0b1 100644 --- a/src/core/test/scanner.spec.ts +++ b/src/core/test/scanner.spec.ts @@ -198,7 +198,7 @@ describe('DependenciesScanner', () => { mockContainer.expects('addComponent').callsFake(() => false); scanner.storeComponent(component, token); const applyMap = (scanner as any).applicationProvidersApplyMap; - + expect(applyMap).to.have.length(1); expect(applyMap[0].moduleToken).to.be.eql(token); }); @@ -219,28 +219,33 @@ describe('DependenciesScanner', () => { expectation.verify(); }); it('should not push new object to "applicationProvidersApplyMap" array', () => { - expect( - (scanner as any).applicationProvidersApplyMap - ).to.have.length(0); + expect((scanner as any).applicationProvidersApplyMap).to.have.length( + 0, + ); mockContainer.expects('addComponent').callsFake(() => false); scanner.storeComponent(component, token); - expect( - (scanner as any).applicationProvidersApplyMap - ).to.have.length(0); + expect((scanner as any).applicationProvidersApplyMap).to.have.length( + 0, + ); }); }); }); }); describe('applyApplicationProviders', () => { it('should apply each provider', () => { - const provider = { moduleToken: 'moduleToken', providerToken: 'providerToken' }; + const provider = { + moduleToken: 'moduleToken', + providerToken: 'providerToken', + }; (scanner as any).applicationProvidersApplyMap = [provider]; const expectedInstance = {}; - mockContainer.expects('getModules').callsFake(() => ({ get: () => ({ - components: { get: () => ({ instance: expectedInstance }) } - })})); + mockContainer.expects('getModules').callsFake(() => ({ + get: () => ({ + components: { get: () => ({ instance: expectedInstance }) }, + }), + })); const applySpy = sinon.spy(); sinon.stub(scanner, 'getApplyProvidersMap').callsFake(() => ({ [provider.providerToken]: applySpy, @@ -254,7 +259,8 @@ describe('DependenciesScanner', () => { describe(`when token is ${APP_INTERCEPTOR}`, () => { it('call "addGlobalInterceptor"', () => { const addSpy = sinon.spy( - (scanner as any).applicationConfig, 'addGlobalInterceptor' + (scanner as any).applicationConfig, + 'addGlobalInterceptor', ); scanner.getApplyProvidersMap()[APP_INTERCEPTOR](null); expect(addSpy.called).to.be.true; @@ -263,7 +269,8 @@ describe('DependenciesScanner', () => { describe(`when token is ${APP_GUARD}`, () => { it('call "addGlobalGuard"', () => { const addSpy = sinon.spy( - (scanner as any).applicationConfig, 'addGlobalGuard' + (scanner as any).applicationConfig, + 'addGlobalGuard', ); scanner.getApplyProvidersMap()[APP_GUARD](null); expect(addSpy.called).to.be.true; @@ -272,7 +279,8 @@ describe('DependenciesScanner', () => { describe(`when token is ${APP_PIPE}`, () => { it('call "addGlobalPipe"', () => { const addSpy = sinon.spy( - (scanner as any).applicationConfig, 'addGlobalPipe' + (scanner as any).applicationConfig, + 'addGlobalPipe', ); scanner.getApplyProvidersMap()[APP_PIPE](null); expect(addSpy.called).to.be.true; @@ -281,7 +289,8 @@ describe('DependenciesScanner', () => { describe(`when token is ${APP_FILTER}`, () => { it('call "addGlobalFilter"', () => { const addSpy = sinon.spy( - (scanner as any).applicationConfig, 'addGlobalFilter' + (scanner as any).applicationConfig, + 'addGlobalFilter', ); scanner.getApplyProvidersMap()[APP_FILTER](null); expect(addSpy.called).to.be.true; diff --git a/src/microservices/nest-microservice.ts b/src/microservices/nest-microservice.ts index 5affdc6cf46..82dcfed4487 100644 --- a/src/microservices/nest-microservice.ts +++ b/src/microservices/nest-microservice.ts @@ -46,7 +46,7 @@ export class NestMicroservice extends NestApplicationContext private readonly applicationConfig: ApplicationConfig, ) { super(container, [], null); - + const ioAdapter = IoAdapter ? new IoAdapter() : null; this.applicationConfig.setIoAdapter(ioAdapter); this.microservicesModule.setup(container, this.applicationConfig); @@ -58,12 +58,13 @@ export class NestMicroservice extends NestApplicationContext this.server = strategy ? strategy : ServerFactory.create(this.microserviceConfig); - + this.selectContextModule(); } public setupModules() { - this.socketModule && this.socketModule.setup(this.container, this.applicationConfig); + this.socketModule && + this.socketModule.setup(this.container, this.applicationConfig); this.microservicesModule.setupClients(this.container); this.setupListeners(); @@ -109,7 +110,7 @@ export class NestMicroservice extends NestApplicationContext } public async listenAsync(): Promise { - return await new Promise((resolve) => this.listen(resolve)); + return await new Promise(resolve => this.listen(resolve)); } public close() { diff --git a/src/microservices/test/client/client-redis.spec.ts b/src/microservices/test/client/client-redis.spec.ts index a4c1a4962c7..b8bea4a4a73 100644 --- a/src/microservices/test/client/client-redis.spec.ts +++ b/src/microservices/test/client/client-redis.spec.ts @@ -88,7 +88,8 @@ describe('ClientRedis', () => { subscription(null, JSON.stringify(responseMessage)); }); it('should call callback with expected arguments', () => { - expect(callback.calledWith(null, responseMessage.response)).to.be.true; + expect(callback.calledWith(null, responseMessage.response)).to.be + .true; }); it('should not unsubscribe to response pattern name', () => { expect(unsubscribeSpy.calledWith(`"${pattern}"_res`)).to.be.false; diff --git a/src/testing/index.ts b/src/testing/index.ts index f781172fd8b..6019887adad 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -7,3 +7,5 @@ export * from './interfaces'; export * from './test'; +export * from './testing-module.builder'; +export * from './testing-module'; diff --git a/tsconfig.json b/tsconfig.json index 6cc44bb15af..5c01b0b3ef1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,8 @@ }, "include": [ "src/**/*", - "example/**/*" + "example/**/*", + "integration/**/*" ], "exclude": [ "node_modules",