@nestjs/core 7.6.13 → 7.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +8 -4
- package/middleware/utils.d.ts +1 -1
- package/middleware/utils.js +13 -5
- package/nest-factory.js +10 -6
- package/package.json +3 -3
- package/router/router-execution-context.js +2 -0
- package/router/router-explorer.js +5 -4
package/Readme.md
CHANGED
|
@@ -37,6 +37,8 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
|
|
|
37
37
|
|
|
38
38
|
* To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
|
39
39
|
* 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
|
40
|
+
* [가이드](readme_kr.md)를 확인하려면, [docs.nestjs.com](https://docs.nestjs.com)를 방문하세요.:books:
|
|
41
|
+
* チェックするには [ガイド](readme_jp.md), 詳しくは [docs.nestjs.com](https://docs.nestjs.com). :books:
|
|
40
42
|
|
|
41
43
|
## Questions
|
|
42
44
|
|
|
@@ -64,6 +66,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
64
66
|
#### Gold Sponsors
|
|
65
67
|
|
|
66
68
|
<table style="text-align:center;"><tr><td>
|
|
69
|
+
<a href="https://careers.labster.com/departments/platform" target="_blank"><img src="https://nestjs.com/img/labster-logo.png" width="170" valign="middle" /></a></td><td>
|
|
67
70
|
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="170" valign="middle" /></a></td></tr></table>
|
|
68
71
|
|
|
69
72
|
#### Silver Sponsors
|
|
@@ -72,7 +75,8 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
72
75
|
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
|
|
73
76
|
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
|
|
74
77
|
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td><td>
|
|
75
|
-
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td
|
|
78
|
+
<a href="http://www.meetdandy.com" target="_blank"><img src="https://nestjs.com/img/dandy-wide-logo.png" width="150" valign="middle" /></td><td>
|
|
79
|
+
<a href="https://www.castlecraft.in" target="_blank"><img src="https://nestjs.com/img/castlecraft-logo.png" width="150" valign="middle" /></td></tr></table>
|
|
76
80
|
|
|
77
81
|
#### Sponsors
|
|
78
82
|
|
|
@@ -95,13 +99,13 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
95
99
|
<td align="center" valign="middle">
|
|
96
100
|
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td>
|
|
97
101
|
<td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td></tr><tr><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://lambda-it.ch/" target="_blank"><img src="https://nestjs.com/img/lambda-it-logo.svg" width="115" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://pickwriters.com/top-10-translation-services" target="_blank"><img src="https://nestjs.com/img/pickwriters-logo.png" width="40" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://thewordpoint.com/services/localization" target="_blank"><img src="https://nestjs.com/img/thewordpoint-logo.png" width="40" valign="middle" /></a></td>
|
|
98
|
-
<td align="center" valign="middle"><a href="https://streamat.se/" target="_blank"><img src="https://nestjs.com/img/streamat-logo.png" width="120" valign="middle" /></a></td>
|
|
99
|
-
<td align="center" valign="middle"><a href="https://filmen.nu/" target="_blank"><img src="https://nestjs.com/img/filmen-logo.png" width="120" valign="middle" /></a></td></tr><tr>
|
|
100
102
|
<td align="center" valign="middle"><a href="https://meercode.io/" target="_blank"><img src="https://nestjs.com/img/meercode-logo.png" width="60" valign="middle" /></a></td>
|
|
101
|
-
<td align="center" valign="middle"><a href="https://www.najlepszeplatformyforex.pl/blog/broker-xtb/" target="_blank"><img src="https://nestjs.com/img/npf-logo.jpg" width="200" valign="middle" /></a></td>
|
|
103
|
+
<td align="center" valign="middle"><a href="https://www.najlepszeplatformyforex.pl/blog/broker-xtb/" target="_blank"><img src="https://nestjs.com/img/npf-logo.jpg" width="200" valign="middle" /></a></td></tr><tr>
|
|
102
104
|
<td align="center" valign="middle"><a href="https://thestandarddaily.com/" target="_blank"><img src="https://nestjs.com/img/the-standard-daily-logo.png" width="180" valign="middle" /></a></td>
|
|
103
105
|
<td align="center" valign="middle"><a href="https://houseofangular.io/" target="_blank"><img src="https://nestjs.com/img/house-of-angular.png" width="100" valign="middle" /></a></td>
|
|
104
106
|
<td align="center" valign="middle"><a href="https://rocketech.it/cases/?utm_source=google&utm_medium=badge&utm_campaign=nestjs" target="_blank"><img src="https://nestjs.com/img/rocketech-logo.svg" width="110" valign="middle" /></a></td>
|
|
107
|
+
<td align="center" valign="middle"><a href="https://www.bystored.com/" target="_blank"><img src="https://nestjs.com/img/stored-logo.svg" width="110" valign="middle" /></a></td>
|
|
108
|
+
<td align="center" valign="middle"><a href="https://studyclerk.com/pay-for-research-paper" target="_blank"><img src="https://nestjs.com/img/studyclerk-logo.png" width="125" valign="middle" /></a></td>
|
|
105
109
|
</tr></table>
|
|
106
110
|
|
|
107
111
|
## Backers
|
package/middleware/utils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare type RouteInfoRegex = RouteInfo & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const filterMiddleware: <T extends Function | Type<any> = any>(middleware: T[], excludedRoutes: RouteInfo[], httpAdapter: HttpServer) => Type<any>[];
|
|
6
6
|
export declare const mapToClass: <T extends Function | Type<any>>(middleware: T, excludedRoutes: RouteInfoRegex[], httpAdapter: HttpServer) => Type<any>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function isMiddlewareClass(middleware: any): middleware is Type<any>;
|
|
8
8
|
export declare function assignToken(metatype: Type<any>, token?: any): Type<any>;
|
|
9
9
|
export declare function isRouteExcluded(req: Record<string, any>, excludedRoutes: RouteInfoRegex[], httpAdapter: HttpServer): boolean;
|
|
10
10
|
export {};
|
package/middleware/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRouteExcluded = exports.assignToken = exports.
|
|
3
|
+
exports.isRouteExcluded = exports.assignToken = exports.isMiddlewareClass = exports.mapToClass = exports.filterMiddleware = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
@@ -17,7 +17,7 @@ const filterMiddleware = (middleware, excludedRoutes, httpAdapter) => {
|
|
|
17
17
|
};
|
|
18
18
|
exports.filterMiddleware = filterMiddleware;
|
|
19
19
|
const mapToClass = (middleware, excludedRoutes, httpAdapter) => {
|
|
20
|
-
if (
|
|
20
|
+
if (isMiddlewareClass(middleware)) {
|
|
21
21
|
if (excludedRoutes.length <= 0) {
|
|
22
22
|
return middleware;
|
|
23
23
|
}
|
|
@@ -47,10 +47,18 @@ const mapToClass = (middleware, excludedRoutes, httpAdapter) => {
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
exports.mapToClass = mapToClass;
|
|
50
|
-
function
|
|
51
|
-
|
|
50
|
+
function isMiddlewareClass(middleware) {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const middlewareStr = middleware.toString();
|
|
53
|
+
if (middlewareStr.substring(0, 5) === 'class') {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const middlewareArr = middlewareStr.split(' ');
|
|
57
|
+
return (middlewareArr[0] === 'function' &&
|
|
58
|
+
/[A-Z]/.test((_a = middlewareArr[1]) === null || _a === void 0 ? void 0 : _a[0]) &&
|
|
59
|
+
typeof ((_b = middleware.prototype) === null || _b === void 0 ? void 0 : _b.use) === 'function');
|
|
52
60
|
}
|
|
53
|
-
exports.
|
|
61
|
+
exports.isMiddlewareClass = isMiddlewareClass;
|
|
54
62
|
function assignToken(metatype, token = uuid_1.v4()) {
|
|
55
63
|
Object.defineProperty(metatype, 'name', { value: token });
|
|
56
64
|
return metatype;
|
package/nest-factory.js
CHANGED
|
@@ -150,19 +150,23 @@ class NestFactoryStatic {
|
|
|
150
150
|
createAdapterProxy(app, adapter) {
|
|
151
151
|
const proxy = new Proxy(app, {
|
|
152
152
|
get: (receiver, prop) => {
|
|
153
|
+
const mapToProxy = (result) => {
|
|
154
|
+
return result instanceof Promise
|
|
155
|
+
? result.then(mapToProxy)
|
|
156
|
+
: result instanceof nest_application_1.NestApplication
|
|
157
|
+
? proxy
|
|
158
|
+
: result;
|
|
159
|
+
};
|
|
153
160
|
if (!(prop in receiver) && prop in adapter) {
|
|
154
161
|
return (...args) => {
|
|
155
|
-
this.createExceptionZone(adapter, prop)(...args);
|
|
156
|
-
return
|
|
162
|
+
const result = this.createExceptionZone(adapter, prop)(...args);
|
|
163
|
+
return mapToProxy(result);
|
|
157
164
|
};
|
|
158
165
|
}
|
|
159
166
|
if (shared_utils_1.isFunction(receiver[prop])) {
|
|
160
|
-
const mapToProxy = (result) => result instanceof nest_application_1.NestApplication ? proxy : result;
|
|
161
167
|
return (...args) => {
|
|
162
168
|
const result = receiver[prop](...args);
|
|
163
|
-
return result
|
|
164
|
-
? result.then(mapToProxy)
|
|
165
|
-
: mapToProxy(result);
|
|
169
|
+
return mapToProxy(result);
|
|
166
170
|
};
|
|
167
171
|
}
|
|
168
172
|
return receiver[prop];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.17",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"iterare": "1.2.1",
|
|
33
33
|
"object-hash": "2.1.1",
|
|
34
34
|
"path-to-regexp": "3.2.0",
|
|
35
|
-
"tslib": "2.
|
|
35
|
+
"tslib": "2.2.0",
|
|
36
36
|
"uuid": "8.3.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "7.6.
|
|
39
|
+
"@nestjs/common": "7.6.17"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@nestjs/common": "^7.0.0",
|
|
@@ -125,6 +125,8 @@ class RouterExecutionContext {
|
|
|
125
125
|
return (type === route_paramtypes_enum_1.RouteParamtypes.BODY ||
|
|
126
126
|
type === route_paramtypes_enum_1.RouteParamtypes.QUERY ||
|
|
127
127
|
type === route_paramtypes_enum_1.RouteParamtypes.PARAM ||
|
|
128
|
+
type === route_paramtypes_enum_1.RouteParamtypes.FILE ||
|
|
129
|
+
type === route_paramtypes_enum_1.RouteParamtypes.FILES ||
|
|
128
130
|
shared_utils_1.isString(type));
|
|
129
131
|
}
|
|
130
132
|
createGuardsFn(guards, instance, callback, contextType) {
|
|
@@ -58,19 +58,20 @@ class RouterExplorer {
|
|
|
58
58
|
return this.metadataScanner.scanFromPrototype(instance, instancePrototype, method => this.exploreMethodMetadata(instance, instancePrototype, method));
|
|
59
59
|
}
|
|
60
60
|
exploreMethodMetadata(instance, prototype, methodName) {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
61
|
+
const instanceCallback = instance[methodName];
|
|
62
|
+
const prototypeCallback = prototype[methodName];
|
|
63
|
+
const routePath = Reflect.getMetadata(constants_1.PATH_METADATA, prototypeCallback);
|
|
63
64
|
if (shared_utils_1.isUndefined(routePath)) {
|
|
64
65
|
return null;
|
|
65
66
|
}
|
|
66
|
-
const requestMethod = Reflect.getMetadata(constants_1.METHOD_METADATA,
|
|
67
|
+
const requestMethod = Reflect.getMetadata(constants_1.METHOD_METADATA, prototypeCallback);
|
|
67
68
|
const path = shared_utils_1.isString(routePath)
|
|
68
69
|
? [shared_utils_1.addLeadingSlash(routePath)]
|
|
69
70
|
: routePath.map(p => shared_utils_1.addLeadingSlash(p));
|
|
70
71
|
return {
|
|
71
72
|
path,
|
|
72
73
|
requestMethod,
|
|
73
|
-
targetCallback,
|
|
74
|
+
targetCallback: instanceCallback,
|
|
74
75
|
methodName,
|
|
75
76
|
};
|
|
76
77
|
}
|