Skip to content

Commit 7fb1511

Browse files
Auto stash before merge of "master" and "origin/master"
1 parent d489788 commit 7fb1511

52 files changed

Lines changed: 731 additions & 305 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 4.6.1
2+
- **common**: [improvement] create `ModuleMetadata` interface
3+
- **common**: [bugfix] update `class-validator` #417
4+
- **core**: [feature] add `appOptions` property to `create[..]` methods of `NestFactory`
5+
- **core**: [improvement] majority of methods (`INestApplication`, `INestMicroservice`, and `INestApplicationContext`) return `this` instead of `void`
6+
- **core**: [refactor] remove static dependencies & relationships
7+
- **core**: [bugfix] catch error thrown by `body-parser` in exception filter #422
8+
19
## 4.6.0
210
- **common**: [feature] `ValidationPipe` improvements #388
311
- **common**: [feature] `ParseIntPipe` improvements #85
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import 'reflect-metadata';
2+
import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interface';
23
/**
34
* Defines the module
4-
* - `modules` - @deprecated the set of the 'imported' modules
55
* - `imports` - the set of the 'imported' modules
66
* - `controllers` - the list of controllers (e.g. HTTP controllers)
77
* - `components` - the list of components that belong to this module. They can be injected between themselves.
88
* - `exports` - the set of components, which should be available for modules, which imports this module
9+
* - `modules` - @deprecated the set of the 'imported' modules
910
* @param obj {ModuleMetadata} Module metadata
1011
*/
11-
export declare function Module(obj: {
12-
modules?: any[];
13-
imports?: any[];
14-
controllers?: any[];
15-
components?: any[];
16-
exports?: any[];
17-
}): ClassDecorator;
12+
export declare function Module(obj: ModuleMetadata): ClassDecorator;

lib/common/decorators/modules/module.decorator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const validateKeys = (keys) => {
2121
};
2222
/**
2323
* Defines the module
24-
* - `modules` - @deprecated the set of the 'imported' modules
2524
* - `imports` - the set of the 'imported' modules
2625
* - `controllers` - the list of controllers (e.g. HTTP controllers)
2726
* - `components` - the list of components that belong to this module. They can be injected between themselves.
2827
* - `exports` - the set of components, which should be available for modules, which imports this module
28+
* - `modules` - @deprecated the set of the 'imported' modules
2929
* @param obj {ModuleMetadata} Module metadata
3030
*/
3131
function Module(obj) {
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { NestModule } from './nest-module.interface';
2-
import { Controller } from '../controllers/controller.interface';
31
export interface ModuleMetadata {
4-
modules?: NestModule[] | any[];
5-
imports?: NestModule[] | any[];
2+
imports?: any[];
63
components?: any[];
7-
controllers?: Controller[] | any[];
4+
controllers?: any[];
85
exports?: any[];
6+
modules?: any[];
97
}

lib/common/interfaces/nest-application.interface.d.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,48 @@ export interface INestApplication extends INestApplicationContext {
99
*
1010
* @returns Promise
1111
*/
12-
init(): Promise<void>;
12+
init(): Promise<this>;
1313
/**
1414
* A wrapper function around native `express.use()` method.
1515
* Example `app.use(cors())`
1616
*
1717
* @returns void
1818
*/
19-
use(...args: any[]): void;
19+
use(...args: any[]): this;
2020
/**
2121
* A wrapper function around native `express.set()` method.
2222
* Example `app.set('trust proxy', 'loopback')`
2323
*
2424
* @returns void
2525
*/
26-
set(...args: any[]): void;
26+
set(...args: any[]): this;
2727
/**
2828
* A wrapper function around native `express.engine()` method.
2929
* Example `app.engine('mustache', mustacheExpress())`
3030
*
3131
* @returns void
3232
*/
33-
engine(...args: any[]): void;
33+
engine(...args: any[]): this;
3434
/**
3535
* A wrapper function around native `express.enable()` method.
3636
* Example `app.enable('x-powered-by')`
3737
*
3838
* @returns void
3939
*/
40-
enable(...args: any[]): void;
40+
enable(...args: any[]): this;
4141
/**
4242
* Enables CORS (Cross-Origin Resource Sharing)
4343
*
4444
* @returns void
4545
*/
46-
enableCors(): void;
46+
enableCors(): this;
4747
/**
4848
* A wrapper function around native `express.disable()` method.
4949
* Example `app.disable('x-powered-by')`
5050
*
5151
* @returns void
5252
*/
53-
disable(...args: any[]): void;
53+
disable(...args: any[]): this;
5454
/**
5555
* Starts the application.
5656
*
@@ -75,15 +75,15 @@ export interface INestApplication extends INestApplicationContext {
7575
* @param {string} prefix The prefix for the every HTTP route path (for example `/v1/api`)
7676
* @returns void
7777
*/
78-
setGlobalPrefix(prefix: string): void;
78+
setGlobalPrefix(prefix: string): this;
7979
/**
8080
* Setup Web Sockets Adapter, which will be used inside Gateways.
8181
* Use, when you want to override default `socket.io` library.
8282
*
8383
* @param {WebSocketAdapter} adapter
8484
* @returns void
8585
*/
86-
useWebSocketAdapter(adapter: WebSocketAdapter): void;
86+
useWebSocketAdapter(adapter: WebSocketAdapter): this;
8787
/**
8888
* Connects microservice to the NestApplication instance. It transforms application to the hybrid instance.
8989
*
@@ -109,7 +109,7 @@ export interface INestApplication extends INestApplicationContext {
109109
* @param {Function} callback Optional callback function
110110
* @returns void
111111
*/
112-
startAllMicroservices(callback?: () => void): void;
112+
startAllMicroservices(callback?: () => void): this;
113113
/**
114114
* Starts all the connected microservices and can be awaited
115115
*
@@ -121,25 +121,25 @@ export interface INestApplication extends INestApplicationContext {
121121
*
122122
* @param {ExceptionFilter[]} ...filters
123123
*/
124-
useGlobalFilters(...filters: ExceptionFilter[]): any;
124+
useGlobalFilters(...filters: ExceptionFilter[]): this;
125125
/**
126126
* Setups pipes as a global pipes (will be used within every HTTP route handler)
127127
*
128128
* @param {PipeTransform[]} ...pipes
129129
*/
130-
useGlobalPipes(...pipes: PipeTransform<any>[]): any;
130+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
131131
/**
132132
* Setups interceptors as a global interceptors (will be used within every HTTP route handler)
133133
*
134134
* @param {NestInterceptor[]} ...interceptors
135135
*/
136-
useGlobalInterceptors(...interceptors: NestInterceptor[]): any;
136+
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
137137
/**
138138
* Setups guards as a global guards (will be used within every HTTP route handler)
139139
*
140140
* @param {CanActivate[]} ...guards
141141
*/
142-
useGlobalGuards(...guards: CanActivate[]): any;
142+
useGlobalGuards(...guards: CanActivate[]): this;
143143
/**
144144
* Terminates the application (both NestApplication, Web Socket Gateways and every connected microservice)
145145
*

lib/common/interfaces/nest-microservice.interface.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,31 @@ export interface INestMicroservice extends INestApplicationContext {
2525
* @param {WebSocketAdapter} adapter
2626
* @returns void
2727
*/
28-
useWebSocketAdapter(adapter: WebSocketAdapter): void;
28+
useWebSocketAdapter(adapter: WebSocketAdapter): this;
2929
/**
3030
* Setups exception filters as a global filters (will be used within every message pattern handler)
3131
*
3232
* @param {ExceptionFilter[]} ...filters
3333
*/
34-
useGlobalFilters(...filters: ExceptionFilter[]): any;
34+
useGlobalFilters(...filters: ExceptionFilter[]): this;
3535
/**
3636
* Setups pipes as a global pipes (will be used within every message pattern handler)
3737
*
3838
* @param {PipeTransform[]} ...pipes
3939
*/
40-
useGlobalPipes(...pipes: PipeTransform<any>[]): any;
40+
useGlobalPipes(...pipes: PipeTransform<any>[]): this;
4141
/**
4242
* Setups interceptors as a global interceptors (will be used within every message pattern handler)
4343
*
4444
* @param {NestInterceptor[]} ...interceptors
4545
*/
46-
useGlobalInterceptors(...interceptors: NestInterceptor[]): any;
46+
useGlobalInterceptors(...interceptors: NestInterceptor[]): this;
4747
/**
4848
* Setups guards as a global guards (will be used within every message pattern handler)
4949
*
5050
* @param {CanActivate[]} ...guards
5151
*/
52-
useGlobalGuards(...guards: CanActivate[]): any;
52+
useGlobalGuards(...guards: CanActivate[]): this;
5353
/**
5454
* Terminates the application (both NestMicroservice and every Web Socket Gateway)
5555
*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export declare function forwardRef(fn: () => any): {
1+
export declare const forwardRef: (fn: () => any) => {
22
forwardRef: () => any;
33
};
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
function forwardRef(fn) {
4-
return { forwardRef: fn };
5-
}
6-
exports.forwardRef = forwardRef;
3+
exports.forwardRef = (fn) => ({ forwardRef: fn });
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
export declare const createHttpExceptionBody: (message: any, error: string, status: number) => {
1+
export declare const createHttpExceptionBody: (message: any, error: string, statusCode: number) => {
22
statusCode: number;
33
error: string;
44
message: any;
55
} | {
66
statusCode: number;
77
error: string;
8-
message?: undefined;
98
};
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.createHttpExceptionBody = (message, error, status) => message
4-
? { statusCode: status, error, message }
5-
: { statusCode: status, error };
3+
exports.createHttpExceptionBody = (message, error, statusCode) => message
4+
? { statusCode, error, message }
5+
: { statusCode, error };

0 commit comments

Comments
 (0)