@nestjs/platform-fastify 10.3.9 → 10.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 +10 -3
- package/adapters/fastify-adapter.d.ts +13 -4
- package/adapters/fastify-adapter.js +6 -0
- package/package.json +3 -3
package/Readme.md
CHANGED
|
@@ -60,7 +60,9 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
60
60
|
<table style="text-align:center;">
|
|
61
61
|
<tr>
|
|
62
62
|
<td><a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="200" valign="middle" /></a></td>
|
|
63
|
+
<td><a href="https://microsoft.com/" target="_blank"><img src="https://nestjs.com/img/logos/microsoft-logo.png" width="180" valign="middle" /></a></td>
|
|
63
64
|
<td><a href="https://mojam.co" target="_blank"><img src="https://nestjs.com/img/logos/mojam-logo.png" width="80" valign="middle" /></a></td>
|
|
65
|
+
<td><a href="https://marblism.com?utm_source=nest" target="_blank"><img src="https://nestjs.com/img/logos/marblism-logo.png" width="180" valign="middle" /></a></td>
|
|
64
66
|
<td><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>
|
|
65
67
|
<td><a href="https://amplication.com/" target="_blank"><img src="https://nestjs.com/img/logos/amplication-logo.svg" width="190" valign="middle" /></a></td>
|
|
66
68
|
</tr>
|
|
@@ -89,8 +91,10 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
89
91
|
|
|
90
92
|
<table style="text-align:center;">
|
|
91
93
|
<tr>
|
|
92
|
-
<td><a href="https://
|
|
93
|
-
<td><a href="https://
|
|
94
|
+
<td><a href="https://www.mercedes-benz.com/" target="_blank"><img src="https://nestjs.com/img/logos/mercedes-logo.png" width="100" valign="middle" /></a></td>
|
|
95
|
+
<td><a href="https://www.dinii.jp/" target="_blank"><img src="https://nestjs.com/img/logos/dinii-logo.png" width="65" valign="middle" /></a></td>
|
|
96
|
+
<td><a href="https://bloodycase.com/?promocode=NEST" target="_blank"><img src="https://nestjs.com/img/logos/bloodycase-logo.png" width="65" valign="middle" /></a></td>
|
|
97
|
+
<td><a href="https://handsontable.com/docs/react-data-grid/?utm_source=NestJS_GH&utm_medium=sponsorship&utm_campaign=library_sponsorship_2024" target="_blank"><img src="https://nestjs.com/img/logos/handsontable-logo.svg" width="150" valign="middle" /></a></td>
|
|
94
98
|
</tr>
|
|
95
99
|
</table>
|
|
96
100
|
|
|
@@ -122,9 +126,12 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
|
|
122
126
|
<td align="center" valign="middle"><a href="https://www.hingehealth.com/" target="_blank"><img src="https://nestjs.com/img/logos/hinge-health-logo.svg" width="100" valign="middle" /></a></td>
|
|
123
127
|
</tr>
|
|
124
128
|
<tr>
|
|
125
|
-
<td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/logos/julienferand-logo.jpeg" width="
|
|
129
|
+
<td align="center" valign="middle"><a href="https://julienferand.dev/" target="_blank"><img src="https://nestjs.com/img/logos/julienferand-logo.jpeg" width="55" valign="middle" /></a></td>
|
|
126
130
|
<td align="center" valign="middle"><a href="https://www.tripoffice.com/" target="_blank"><img src="https://nestjs.com/img/logos/tripoffice-logo.png" width="140" valign="middle" /></a></td>
|
|
127
131
|
<td align="center" valign="middle"><a href="https://solcellsforetag.se/" target="_blank"><img src="https://nestjs.com/img/logos/solcellsforetag-logo.svg" width="140" valign="middle" /></a></td>
|
|
132
|
+
<td align="center" valign="middle"><a href="https://www.itflashcards.com/" target="_blank"><img src="https://nestjs.com/img/logos/it_flashcards-logo.png" width="150" valign="middle" /></a></td>
|
|
133
|
+
<td align="center" valign="middle"><a href="https://www.route4me.com/" target="_blank"><img src="https://nestjs.com/img/logos/route4me-logo.svg" width="100" valign="middle" /></a></td>
|
|
134
|
+
<td align="center" valign="middle"><a href="https://www.slotsup.com/" target="_blank"><img src="https://nestjs.com/img/logos/slotsup-logo.png" width="60" valign="middle" /></a></td>
|
|
128
135
|
</tr>
|
|
129
136
|
</table>
|
|
130
137
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
4
5
|
import { RequestMethod, VersioningOptions } from '@nestjs/common';
|
|
5
6
|
import { VersionValue } from '@nestjs/common/interfaces';
|
|
6
7
|
import { CorsOptions, CorsOptionsDelegate } from '@nestjs/common/interfaces/external/cors-options.interface';
|
|
@@ -8,20 +9,27 @@ import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter';
|
|
|
8
9
|
import { FastifyBaseLogger, FastifyBodyParser, FastifyInstance, FastifyPluginAsync, FastifyPluginCallback, FastifyRegister, FastifyReply, FastifyRequest, FastifyServerOptions, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault, RequestGenericInterface } from 'fastify';
|
|
9
10
|
import * as http2 from 'http2';
|
|
10
11
|
import * as https from 'https';
|
|
12
|
+
import * as http from 'http';
|
|
11
13
|
import { InjectOptions, Chain as LightMyRequestChain, Response as LightMyRequestResponse } from 'light-my-request';
|
|
12
14
|
import { NestFastifyBodyParserOptions } from '../interfaces';
|
|
13
15
|
import { FastifyStaticOptions, FastifyViewOptions } from '../interfaces/external';
|
|
14
|
-
type
|
|
16
|
+
type FastifyAdapterBaseOptions<Server extends RawServerBase = RawServerDefault, Logger extends FastifyBaseLogger = FastifyBaseLogger> = FastifyServerOptions<Server, Logger> & {
|
|
17
|
+
skipMiddie?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type FastifyHttp2SecureOptions<Server extends http2.Http2SecureServer, Logger extends FastifyBaseLogger = FastifyBaseLogger> = FastifyAdapterBaseOptions<Server, Logger> & {
|
|
15
20
|
http2: true;
|
|
16
21
|
https: http2.SecureServerOptions;
|
|
17
22
|
};
|
|
18
|
-
type FastifyHttp2Options<Server extends http2.Http2Server, Logger extends FastifyBaseLogger = FastifyBaseLogger> =
|
|
23
|
+
type FastifyHttp2Options<Server extends http2.Http2Server, Logger extends FastifyBaseLogger = FastifyBaseLogger> = FastifyAdapterBaseOptions<Server, Logger> & {
|
|
19
24
|
http2: true;
|
|
20
25
|
http2SessionTimeout?: number;
|
|
21
26
|
};
|
|
22
|
-
type FastifyHttpsOptions<Server extends https.Server, Logger extends FastifyBaseLogger = FastifyBaseLogger> =
|
|
27
|
+
type FastifyHttpsOptions<Server extends https.Server, Logger extends FastifyBaseLogger = FastifyBaseLogger> = FastifyAdapterBaseOptions<Server, Logger> & {
|
|
23
28
|
https: https.ServerOptions;
|
|
24
29
|
};
|
|
30
|
+
type FastifyHttpOptions<Server extends http.Server, Logger extends FastifyBaseLogger = FastifyBaseLogger> = FastifyAdapterBaseOptions<Server, Logger> & {
|
|
31
|
+
http: http.ServerOptions;
|
|
32
|
+
};
|
|
25
33
|
type VersionedRoute<TRequest, TResponse> = ((req: TRequest, res: TResponse, next: Function) => Function) & {
|
|
26
34
|
version: VersionValue;
|
|
27
35
|
versioningOptions: VersioningOptions;
|
|
@@ -45,7 +53,7 @@ export declare class FastifyAdapter<TServer extends RawServerBase = RawServerDef
|
|
|
45
53
|
private versioningOptions?;
|
|
46
54
|
private readonly versionConstraint;
|
|
47
55
|
get isParserRegistered(): boolean;
|
|
48
|
-
constructor(instanceOrOptions?: TInstance | FastifyHttp2Options<any> | FastifyHttp2SecureOptions<any> | FastifyHttpsOptions<any> |
|
|
56
|
+
constructor(instanceOrOptions?: TInstance | FastifyHttp2Options<any> | FastifyHttp2SecureOptions<any> | FastifyHttpsOptions<any> | FastifyHttpOptions<any> | FastifyAdapterBaseOptions<TServer>);
|
|
49
57
|
init(): Promise<void>;
|
|
50
58
|
listen(port: string | number, callback?: () => void): void;
|
|
51
59
|
listen(port: string | number, hostname: string, callback?: () => void): void;
|
|
@@ -56,6 +64,7 @@ export declare class FastifyAdapter<TServer extends RawServerBase = RawServerDef
|
|
|
56
64
|
put(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
|
|
57
65
|
patch(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
|
|
58
66
|
options(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
|
|
67
|
+
search(...args: any[]): FastifyInstance<TServer, TRawRequest, TRawResponse, FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>;
|
|
59
68
|
applyVersionFilter(handler: Function, version: VersionValue, versioningOptions: VersioningOptions): VersionedRoute<TRequest, TReply>;
|
|
60
69
|
reply(response: TRawResponse | TReply, body: any, statusCode?: number): FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
61
70
|
status(response: TRawResponse | TReply, statusCode: number): TRawResponse | FastifyReply<TServer, TRawRequest, TRawResponse, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
|
|
@@ -94,6 +94,9 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
94
94
|
...instanceOrOptions,
|
|
95
95
|
});
|
|
96
96
|
this.setInstance(instance);
|
|
97
|
+
if (instanceOrOptions?.skipMiddie) {
|
|
98
|
+
this.isMiddieRegistered = true;
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
101
|
async init() {
|
|
99
102
|
if (this.isMiddieRegistered) {
|
|
@@ -143,6 +146,9 @@ class FastifyAdapter extends http_adapter_1.AbstractHttpAdapter {
|
|
|
143
146
|
options(...args) {
|
|
144
147
|
return this.injectRouteOptions('options', ...args);
|
|
145
148
|
}
|
|
149
|
+
search(...args) {
|
|
150
|
+
return this.injectRouteOptions('search', ...args);
|
|
151
|
+
}
|
|
146
152
|
applyVersionFilter(handler, version, versioningOptions) {
|
|
147
153
|
if (!this.versioningOptions) {
|
|
148
154
|
this.versioningOptions = versioningOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/platform-fastify",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@fastify/cors": "9.0.1",
|
|
22
22
|
"@fastify/formbody": "7.4.0",
|
|
23
23
|
"@fastify/middie": "8.3.1",
|
|
24
|
-
"fastify": "4.
|
|
24
|
+
"fastify": "4.28.1",
|
|
25
25
|
"light-my-request": "5.13.0",
|
|
26
26
|
"path-to-regexp": "3.2.0",
|
|
27
|
-
"tslib": "2.6.
|
|
27
|
+
"tslib": "2.6.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@fastify/static": "^6.0.0 || ^7.0.0",
|