@nestjs/core 10.3.0 → 10.3.2
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/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(The MIT License)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2017-
|
|
3
|
+
Copyright (c) 2017-2024 Kamil Mysliwiec <https://kamilmysliwiec.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -25,8 +25,8 @@ export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any,
|
|
|
25
25
|
patch(path: any, handler: RequestHandler): any;
|
|
26
26
|
all(handler: RequestHandler): any;
|
|
27
27
|
all(path: any, handler: RequestHandler): any;
|
|
28
|
-
search(
|
|
29
|
-
search(
|
|
28
|
+
search(handler: RequestHandler): any;
|
|
29
|
+
search(path: any, handler: RequestHandler): any;
|
|
30
30
|
options(handler: RequestHandler): any;
|
|
31
31
|
options(path: any, handler: RequestHandler): any;
|
|
32
32
|
listen(port: string | number, callback?: () => void): any;
|
|
@@ -50,7 +50,9 @@ export declare abstract class AbstractHttpAdapter<TServer = any, TRequest = any,
|
|
|
50
50
|
abstract setErrorHandler(handler: Function, prefix?: string): any;
|
|
51
51
|
abstract setNotFoundHandler(handler: Function, prefix?: string): any;
|
|
52
52
|
abstract isHeadersSent(response: any): any;
|
|
53
|
+
abstract getHeader?(response: any, name: string): any;
|
|
53
54
|
abstract setHeader(response: any, name: string, value: string): any;
|
|
55
|
+
abstract appendHeader?(response: any, name: string, value: string): any;
|
|
54
56
|
abstract registerParserMiddleware(prefix?: string, rawBody?: boolean): any;
|
|
55
57
|
abstract enableCors(options: CorsOptions | CorsOptionsDelegate<TRequest>, prefix?: string): any;
|
|
56
58
|
abstract createMiddlewareFactory(requestMethod: RequestMethod): ((path: string, callback: Function) => any) | Promise<(path: string, callback: Function) => any>;
|
package/adapters/http-adapter.js
CHANGED
|
@@ -34,8 +34,8 @@ class AbstractHttpAdapter {
|
|
|
34
34
|
all(...args) {
|
|
35
35
|
return this.instance.all(...args);
|
|
36
36
|
}
|
|
37
|
-
search(
|
|
38
|
-
return this.instance.search(
|
|
37
|
+
search(...args) {
|
|
38
|
+
return this.instance.search(...args);
|
|
39
39
|
}
|
|
40
40
|
options(...args) {
|
|
41
41
|
return this.instance.options(...args);
|
|
@@ -2,29 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RouterMethodFactory = void 0;
|
|
4
4
|
const request_method_enum_1 = require("@nestjs/common/enums/request-method.enum");
|
|
5
|
+
const REQUEST_METHOD_MAP = {
|
|
6
|
+
[request_method_enum_1.RequestMethod.GET]: 'get',
|
|
7
|
+
[request_method_enum_1.RequestMethod.POST]: 'post',
|
|
8
|
+
[request_method_enum_1.RequestMethod.PUT]: 'put',
|
|
9
|
+
[request_method_enum_1.RequestMethod.DELETE]: 'delete',
|
|
10
|
+
[request_method_enum_1.RequestMethod.PATCH]: 'patch',
|
|
11
|
+
[request_method_enum_1.RequestMethod.ALL]: 'all',
|
|
12
|
+
[request_method_enum_1.RequestMethod.OPTIONS]: 'options',
|
|
13
|
+
[request_method_enum_1.RequestMethod.HEAD]: 'head',
|
|
14
|
+
[request_method_enum_1.RequestMethod.SEARCH]: 'search',
|
|
15
|
+
};
|
|
5
16
|
class RouterMethodFactory {
|
|
6
17
|
get(target, requestMethod) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return target.all;
|
|
12
|
-
case request_method_enum_1.RequestMethod.DELETE:
|
|
13
|
-
return target.delete;
|
|
14
|
-
case request_method_enum_1.RequestMethod.PUT:
|
|
15
|
-
return target.put;
|
|
16
|
-
case request_method_enum_1.RequestMethod.PATCH:
|
|
17
|
-
return target.patch;
|
|
18
|
-
case request_method_enum_1.RequestMethod.OPTIONS:
|
|
19
|
-
return target.options;
|
|
20
|
-
case request_method_enum_1.RequestMethod.HEAD:
|
|
21
|
-
return target.head;
|
|
22
|
-
case request_method_enum_1.RequestMethod.GET:
|
|
23
|
-
return target.get;
|
|
24
|
-
default: {
|
|
25
|
-
return target.use;
|
|
26
|
-
}
|
|
18
|
+
const methodName = REQUEST_METHOD_MAP[requestMethod];
|
|
19
|
+
const method = target[methodName];
|
|
20
|
+
if (!method) {
|
|
21
|
+
return target.use;
|
|
27
22
|
}
|
|
23
|
+
return method;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
exports.RouterMethodFactory = RouterMethodFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"uid": "2.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "10.3.
|
|
39
|
+
"@nestjs/common": "10.3.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@nestjs/common": "^10.0.0",
|
|
43
43
|
"@nestjs/microservices": "^10.0.0",
|
|
44
44
|
"@nestjs/platform-express": "^10.0.0",
|
|
45
45
|
"@nestjs/websockets": "^10.0.0",
|
|
46
|
-
"reflect-metadata": "^0.1.12",
|
|
46
|
+
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
47
47
|
"rxjs": "^7.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
@@ -5,7 +5,7 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
import { AdditionalHeaders, WritableHeaderStream } from './sse-stream';
|
|
6
6
|
export interface CustomHeader {
|
|
7
7
|
name: string;
|
|
8
|
-
value: string;
|
|
8
|
+
value: string | (() => string);
|
|
9
9
|
}
|
|
10
10
|
export interface RedirectResponse {
|
|
11
11
|
url: string;
|
|
@@ -43,7 +43,7 @@ class RouterResponseController {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
setHeaders(response, headers) {
|
|
46
|
-
headers.forEach(({ name, value }) => this.applicationRef.setHeader(response, name, value));
|
|
46
|
+
headers.forEach(({ name, value }) => this.applicationRef.setHeader(response, name, typeof value === 'function' ? value() : value));
|
|
47
47
|
}
|
|
48
48
|
setStatus(response, statusCode) {
|
|
49
49
|
this.applicationRef.status(response, statusCode);
|