@nestjs/platform-fastify 8.3.1 → 8.4.0
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 +1 -1
- package/adapters/fastify-adapter.js +22 -4
- package/package.json +4 -4
- package/CHANGELOG.md +0 -18
package/Readme.md
CHANGED
|
@@ -54,7 +54,7 @@ With official support, you can get expert help straight from Nest core team. We
|
|
|
54
54
|
|
|
55
55
|
## Support
|
|
56
56
|
|
|
57
|
-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support
|
|
57
|
+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
58
58
|
|
|
59
59
|
#### Principal Sponsors
|
|
60
60
|
<table style="text-align:center;"><tr>
|
|
@@ -22,17 +22,25 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
22
22
|
const versions = new Map();
|
|
23
23
|
return {
|
|
24
24
|
get(version) {
|
|
25
|
+
if (Array.isArray(version)) {
|
|
26
|
+
return versions.get(version.find(v => versions.has(v))) || null;
|
|
27
|
+
}
|
|
25
28
|
return versions.get(version) || null;
|
|
26
29
|
},
|
|
27
30
|
set(versionOrVersions, store) {
|
|
28
|
-
const storeVersionConstraint = version => versions.set(version, store);
|
|
31
|
+
const storeVersionConstraint = (version) => versions.set(version, store);
|
|
29
32
|
if (Array.isArray(versionOrVersions))
|
|
30
33
|
versionOrVersions.forEach(storeVersionConstraint);
|
|
31
34
|
else
|
|
32
35
|
storeVersionConstraint(versionOrVersions);
|
|
33
36
|
},
|
|
34
37
|
del(version) {
|
|
35
|
-
|
|
38
|
+
if (Array.isArray(version)) {
|
|
39
|
+
version.forEach(v => versions.delete(v));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
versions.delete(version);
|
|
43
|
+
}
|
|
36
44
|
},
|
|
37
45
|
empty() {
|
|
38
46
|
versions.clear();
|
|
@@ -61,6 +69,10 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
61
69
|
return customHeaderVersionParameter;
|
|
62
70
|
}
|
|
63
71
|
}
|
|
72
|
+
// Custom Versioning Handler
|
|
73
|
+
else if (this.versioningOptions.type === common_1.VersioningType.CUSTOM) {
|
|
74
|
+
return this.versioningOptions.extractor(req);
|
|
75
|
+
}
|
|
64
76
|
return undefined;
|
|
65
77
|
},
|
|
66
78
|
mustMatchWhenDerived: false,
|
|
@@ -130,12 +142,18 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
130
142
|
}
|
|
131
143
|
if (body instanceof common_1.StreamableFile) {
|
|
132
144
|
const streamHeaders = body.getHeaders();
|
|
133
|
-
if (fastifyReply.getHeader('Content-Type') === undefined
|
|
145
|
+
if (fastifyReply.getHeader('Content-Type') === undefined &&
|
|
146
|
+
streamHeaders.type !== undefined) {
|
|
134
147
|
fastifyReply.header('Content-Type', streamHeaders.type);
|
|
135
148
|
}
|
|
136
|
-
if (fastifyReply.getHeader('Content-Disposition') === undefined
|
|
149
|
+
if (fastifyReply.getHeader('Content-Disposition') === undefined &&
|
|
150
|
+
streamHeaders.disposition !== undefined) {
|
|
137
151
|
fastifyReply.header('Content-Disposition', streamHeaders.disposition);
|
|
138
152
|
}
|
|
153
|
+
if (fastifyReply.getHeader('Content-Length') === undefined &&
|
|
154
|
+
streamHeaders.length !== undefined) {
|
|
155
|
+
fastifyReply.header('Content-Length', streamHeaders.length);
|
|
156
|
+
}
|
|
139
157
|
body = body.getStream();
|
|
140
158
|
}
|
|
141
159
|
return fastifyReply.send(body);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-fastify",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
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.27.
|
|
21
|
-
"fastify-cors": "6.0.
|
|
20
|
+
"fastify": "3.27.2",
|
|
21
|
+
"fastify-cors": "6.0.3",
|
|
22
22
|
"fastify-formbody": "5.2.0",
|
|
23
|
-
"light-my-request": "4.
|
|
23
|
+
"light-my-request": "4.8.0",
|
|
24
24
|
"middie": "6.0.0",
|
|
25
25
|
"path-to-regexp": "3.2.0",
|
|
26
26
|
"tslib": "2.3.1"
|
package/CHANGELOG.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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))
|