@nestjs/platform-express 9.3.12 → 9.4.1
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 +3 -3
- package/adapters/express-adapter.d.ts +2 -2
- package/adapters/express-adapter.js +4 -2
- package/adapters/utils/get-body-parser-options.util.d.ts +2 -2
- package/adapters/utils/get-body-parser-options.util.js +1 -1
- package/interfaces/index.d.ts +2 -1
- package/interfaces/index.js +1 -1
- package/interfaces/nest-express-application.interface.d.ts +2 -2
- package/interfaces/nest-express-body-parser-options.interface.d.ts +22 -2
- package/interfaces/nest-express-body-parser.interface.d.ts +4 -0
- package/interfaces/nest-express-body-parser.interface.js +2 -0
- package/package.json +5 -4
package/Readme.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="
|
|
2
|
+
<a href="https://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
|
6
6
|
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
7
7
|
|
|
8
|
-
<p align="center">A progressive <a href="
|
|
8
|
+
<p align="center">A progressive <a href="https://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
11
|
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
@@ -132,7 +132,7 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
132
132
|
<td align="center" valign="middle"><a href="https://klqc.de" target="_blank"><img src="https://nestjs.com/img/klcqcl-logo.png" width="120" valign="middle" /></a></td>
|
|
133
133
|
<td align="center" valign="middle"><a href="https://thecasinowizard.com/bonuses/no-deposit-bonuses/" target="_blank"><img src="https://nestjs.com/img/casinowizard-logo.png" width="120" valign="middle" /></a></td></tr><tr>
|
|
134
134
|
<td align="center" valign="middle"><a href="https://polygon-software.ch/" target="_blank"><img src="https://nestjs.com/img/polygon-logo.svg" width="120" valign="middle" /></a></td>
|
|
135
|
-
<td align="center" valign="middle"><a href="https://
|
|
135
|
+
<td align="center" valign="middle"><a href="https://themobilereality.com/" target="_blank"><img src="https://nestjs.com/img/mobile-reality-logo.png" width="45" valign="middle" /></a></td>
|
|
136
136
|
<td align="center" valign="middle"><a href="https://boringowl.io/" target="_blank"><img src="https://nestjs.com/img/boringowl-logo.svg" width="120" valign="middle" /></a></td>
|
|
137
137
|
<td align="center" valign="middle"><a href="https://www.mobilefactory.jp/" target="_blank"><img src="https://nestjs.com/img/mobilefactory-logo.png" width="100" valign="middle" /></a></td>
|
|
138
138
|
<td align="center" valign="middle"><a href="https://nordbot.app/" target="_blank"><img src="https://nestjs.com/img/nordbot-logo.png" width="120" valign="middle" /></a></td>
|
|
@@ -5,8 +5,8 @@ import { VersionValue } from '@nestjs/common/interfaces';
|
|
|
5
5
|
import { CorsOptions, CorsOptionsDelegate } from '@nestjs/common/interfaces/external/cors-options.interface';
|
|
6
6
|
import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
|
|
7
7
|
import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter';
|
|
8
|
-
import * as bodyparser from 'body-parser';
|
|
9
8
|
import { NestExpressBodyParserOptions } from '../interfaces/nest-express-body-parser-options.interface';
|
|
9
|
+
import { NestExpressBodyParserType } from '../interfaces/nest-express-body-parser.interface';
|
|
10
10
|
import { ServeStaticOptions } from '../interfaces/serve-static-options.interface';
|
|
11
11
|
type VersionedRoute = <TRequest extends Record<string, any> = any, TResponse = any>(req: TRequest, res: TResponse, next: () => void) => any;
|
|
12
12
|
/**
|
|
@@ -43,7 +43,7 @@ export declare class ExpressAdapter extends AbstractHttpAdapter {
|
|
|
43
43
|
createMiddlewareFactory(requestMethod: RequestMethod): (path: string, callback: Function) => any;
|
|
44
44
|
initHttpServer(options: NestApplicationOptions): void;
|
|
45
45
|
registerParserMiddleware(prefix?: string, rawBody?: boolean): void;
|
|
46
|
-
useBodyParser<Options
|
|
46
|
+
useBodyParser<Options = NestExpressBodyParserOptions>(type: NestExpressBodyParserType, rawBody: boolean, options?: Omit<Options, 'verify'>): this;
|
|
47
47
|
setLocal(key: string, value: any): this;
|
|
48
48
|
getType(): string;
|
|
49
49
|
applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): VersionedRoute;
|
|
@@ -149,7 +149,9 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
149
149
|
}
|
|
150
150
|
registerParserMiddleware(prefix, rawBody) {
|
|
151
151
|
const bodyParserJsonOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody);
|
|
152
|
-
const bodyParserUrlencodedOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody, {
|
|
152
|
+
const bodyParserUrlencodedOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody, {
|
|
153
|
+
extended: true,
|
|
154
|
+
});
|
|
153
155
|
const parserMiddleware = {
|
|
154
156
|
jsonParser: (0, body_parser_1.json)(bodyParserJsonOptions),
|
|
155
157
|
urlencodedParser: (0, body_parser_1.urlencoded)(bodyParserUrlencodedOptions),
|
|
@@ -159,7 +161,7 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
159
161
|
.forEach(parserKey => this.use(parserMiddleware[parserKey]));
|
|
160
162
|
}
|
|
161
163
|
useBodyParser(type, rawBody, options) {
|
|
162
|
-
const parserOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody, options
|
|
164
|
+
const parserOptions = (0, get_body_parser_options_util_1.getBodyParserOptions)(rawBody, options);
|
|
163
165
|
const parser = bodyparser[type](parserOptions);
|
|
164
166
|
this.use(parser);
|
|
165
167
|
return this;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function getBodyParserOptions<
|
|
1
|
+
import type { NestExpressBodyParserOptions } from '../../interfaces';
|
|
2
|
+
export declare function getBodyParserOptions<Options = NestExpressBodyParserOptions>(rawBody: boolean, options?: Omit<Options, 'verify'> | undefined): Options;
|
|
@@ -8,7 +8,7 @@ const rawBodyParser = (req, _res, buffer) => {
|
|
|
8
8
|
return true;
|
|
9
9
|
};
|
|
10
10
|
function getBodyParserOptions(rawBody, options) {
|
|
11
|
-
let parserOptions = options
|
|
11
|
+
let parserOptions = (options || {});
|
|
12
12
|
if (rawBody === true) {
|
|
13
13
|
parserOptions = Object.assign(Object.assign({}, parserOptions), { verify: rawBodyParser });
|
|
14
14
|
}
|
package/interfaces/index.d.ts
CHANGED
package/interfaces/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./nest-express-application.interface"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./nest-express-body-parser
|
|
5
|
+
tslib_1.__exportStar(require("./nest-express-body-parser.interface"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Server } from 'http';
|
|
3
3
|
import { INestApplication } from '@nestjs/common';
|
|
4
|
-
import * as bodyparser from 'body-parser';
|
|
5
4
|
import { NestExpressBodyParserOptions } from './nest-express-body-parser-options.interface';
|
|
6
5
|
import { ServeStaticOptions } from './serve-static-options.interface';
|
|
6
|
+
import { NestExpressBodyParserType } from './nest-express-body-parser.interface';
|
|
7
7
|
/**
|
|
8
8
|
* Interface describing methods on NestExpressApplication.
|
|
9
9
|
*
|
|
@@ -78,7 +78,7 @@ export interface NestExpressApplication extends INestApplication {
|
|
|
78
78
|
*
|
|
79
79
|
* @returns {this}
|
|
80
80
|
*/
|
|
81
|
-
useBodyParser<Options
|
|
81
|
+
useBodyParser<Options = NestExpressBodyParserOptions>(parser: NestExpressBodyParserType, options?: Omit<Options, 'verify'>): this;
|
|
82
82
|
/**
|
|
83
83
|
* Sets one or multiple base directories for templates (views).
|
|
84
84
|
*
|
|
@@ -1,2 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { IncomingMessage } from 'http';
|
|
3
|
+
/**
|
|
4
|
+
* Type alias to keep compatibility with @types/body-parser
|
|
5
|
+
* @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/dcd1673c4fa18a15ea8cd8ff8af7d563bb6dc8e6/types/body-parser/index.d.ts#L48-L66#L48-L66
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
export interface NestExpressBodyParserOptions {
|
|
9
|
+
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
|
|
10
|
+
inflate?: boolean | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Controls the maximum request body size. If this is a number,
|
|
13
|
+
* then the value specifies the number of bytes; if it is a string,
|
|
14
|
+
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
|
|
15
|
+
*/
|
|
16
|
+
limit?: number | string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The type option is used to determine what media type the middleware will parse
|
|
19
|
+
*/
|
|
20
|
+
type?: string | string[] | ((req: IncomingMessage) => any) | undefined;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-express",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://github.com/nestjs/nest"
|
|
14
|
+
"url": "https://github.com/nestjs/nest.git",
|
|
15
|
+
"directory": "packages/platform-express"
|
|
15
16
|
},
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
@@ -24,8 +25,8 @@
|
|
|
24
25
|
"tslib": "2.5.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@nestjs/common": "9.
|
|
28
|
-
"@nestjs/core": "9.
|
|
28
|
+
"@nestjs/common": "9.4.1",
|
|
29
|
+
"@nestjs/core": "9.4.1"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"@nestjs/common": "^9.0.0",
|