@nestjs/platform-fastify 8.1.0 → 8.2.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/CHANGELOG.md +18 -0
- package/adapters/fastify-adapter.js +10 -3
- package/adapters/index.js +1 -1
- package/index.js +2 -2
- package/interfaces/external/index.js +2 -2
- package/interfaces/index.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
<a name="8.2.0"></a>
|
|
7
|
+
# [8.2.0](https://github.com/nestjs/nest/compare/v8.1.2...v8.2.0) (2021-11-08)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **deps:** update dependency fastify to v3.23.1 ([63113d8](https://github.com/nestjs/nest/commit/63113d8))
|
|
13
|
+
* **platform-fastify:** fix streamable file processing ([365c40b](https://github.com/nestjs/nest/commit/365c40b))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **common:** add the ability to set some extra metadata about returned files ([5100573](https://github.com/nestjs/nest/commit/5100573))
|
|
@@ -66,7 +66,7 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
66
66
|
};
|
|
67
67
|
const instance = instanceOrOptions && instanceOrOptions.server
|
|
68
68
|
? instanceOrOptions
|
|
69
|
-
:
|
|
69
|
+
: fastify_1.fastify(Object.assign({ constraints: {
|
|
70
70
|
version: this.versionConstraint,
|
|
71
71
|
} }, instanceOrOptions));
|
|
72
72
|
this.setInstance(instance);
|
|
@@ -128,6 +128,13 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
128
128
|
fastifyReply.status(statusCode);
|
|
129
129
|
}
|
|
130
130
|
if (body instanceof common_1.StreamableFile) {
|
|
131
|
+
const streamHeaders = body.getHeaders();
|
|
132
|
+
if (fastifyReply.getHeader('Content-Type') === undefined) {
|
|
133
|
+
fastifyReply.header('Content-Type', streamHeaders.type);
|
|
134
|
+
}
|
|
135
|
+
if (fastifyReply.getHeader('Content-Disposition') === undefined) {
|
|
136
|
+
fastifyReply.header('Content-Disposition', streamHeaders.disposition);
|
|
137
|
+
}
|
|
131
138
|
body = body.getStream();
|
|
132
139
|
}
|
|
133
140
|
return fastifyReply.send(body);
|
|
@@ -180,14 +187,14 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
180
187
|
this.httpServer = this.instance.server;
|
|
181
188
|
}
|
|
182
189
|
useStaticAssets(options) {
|
|
183
|
-
return this.register(
|
|
190
|
+
return this.register(load_package_util_1.loadPackage('fastify-static', 'FastifyAdapter.useStaticAssets()', () => require('fastify-static')), options);
|
|
184
191
|
}
|
|
185
192
|
setViewEngine(options) {
|
|
186
193
|
if (typeof options === 'string') {
|
|
187
194
|
new common_1.Logger('FastifyAdapter').error("setViewEngine() doesn't support a string argument.");
|
|
188
195
|
process.exit(1);
|
|
189
196
|
}
|
|
190
|
-
return this.register(
|
|
197
|
+
return this.register(load_package_util_1.loadPackage('point-of-view', 'FastifyAdapter.setViewEngine()', () => require('point-of-view')), options);
|
|
191
198
|
}
|
|
192
199
|
setHeader(response, name, value) {
|
|
193
200
|
return response.header(name, value);
|
package/adapters/index.js
CHANGED
package/index.js
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
const tslib_1 = require("tslib");
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
tslib_1.__exportStar(require("./adapters"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./interfaces"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./fastify-static-options.interface"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./point-of-view-options.interface"), exports);
|
package/interfaces/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
|
|
4
|
+
tslib_1.__exportStar(require("./nest-fastify-application.interface"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-fastify",
|
|
3
|
-
"version": "8.1
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"fastify": "3.
|
|
20
|
+
"fastify": "3.24.0",
|
|
21
21
|
"fastify-cors": "6.0.2",
|
|
22
|
-
"fastify-formbody": "5.
|
|
23
|
-
"light-my-request": "4.
|
|
22
|
+
"fastify-formbody": "5.2.0",
|
|
23
|
+
"light-my-request": "4.6.0",
|
|
24
24
|
"middie": "5.3.0",
|
|
25
25
|
"path-to-regexp": "3.2.0",
|
|
26
26
|
"tslib": "2.3.1"
|