Skip to content

Commit 37711e4

Browse files
committed
chore: review
1 parent d77ab01 commit 37711e4

12 files changed

+29
-379
lines changed

packages/platform/platform-fastify/package.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
2525
},
2626
"keywords": [
27-
"Koa",
27+
"Fastify",
2828
"TypeScript",
29-
"typescript",
3029
"Decorator",
3130
"decorators",
32-
"decorator",
3331
"fastify",
3432
"Controller",
3533
"Inject",
@@ -38,7 +36,7 @@
3836
"mvc",
3937
"swagger",
4038
"swagger ui",
41-
"ES2015",
39+
"ESM",
4240
"ES6",
4341
"server",
4442
"rest",
@@ -58,13 +56,13 @@
5856
"url": "git+https://github.com/tsedio/tsed.git"
5957
},
6058
"dependencies": {
59+
"@fastify/accepts": ">=5.0.2",
6160
"@fastify/middie": ">=9.0.2",
6261
"@fastify/static": ">=8.0.4",
6362
"content-disposition": ">=0.5.4",
6463
"tslib": "2.6.1"
6564
},
6665
"devDependencies": {
67-
"@fastify/accepts": "5.0.2",
6866
"@fastify/cookie": "11.0.1",
6967
"@fastify/formbody": "8.0.1",
7068
"@fastify/session": "11.0.1",

packages/platform/platform-fastify/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<hr />
3030

31-
A package of Ts.ED framework. See website: https://tsed.io/getting-started/
31+
A package of the Ts.ED framework. See the [Getting Started Guide](https://tsed.io/getting-started/).
3232

3333
## Installation
3434

@@ -58,7 +58,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
5858

5959
The MIT License (MIT)
6060

61-
Copyright (c) 2016 - 2018 Romain Lenzotti
61+
Copyright (c) 2016 - today Romain Lenzotti
6262

6363
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6464

packages/platform/platform-fastify/src/components/PlatformFastify.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Server {}
77
describe("PlatformFastify", () => {
88
describe("create()", () => {
99
beforeEach(() => {
10-
vi.spyOn(PlatformBuilder, "create").mockReturnValue({});
10+
vi.spyOn(PlatformBuilder, "create").mockReturnValue({} as never);
1111
});
1212
afterEach(() => vi.resetAllMocks());
1313
it("should create platform", () => {
@@ -20,7 +20,7 @@ describe("PlatformFastify", () => {
2020
});
2121
describe("bootstrap()", () => {
2222
beforeEach(() => {
23-
vi.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({});
23+
vi.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({} as never);
2424
});
2525
afterEach(() => vi.resetAllMocks());
2626
it("should create platform", async () => {

packages/platform/platform-fastify/src/components/PlatformFastify.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as Http from "node:http";
2+
import {IncomingMessage, ServerResponse} from "node:http";
23
import * as Https from "node:https";
34

45
import fastifyMiddie from "@fastify/middie";
@@ -23,7 +24,6 @@ import {
2324
} from "@tsed/platform-http";
2425
import {PlatformHandlerMetadata, PlatformHandlerType, PlatformLayer} from "@tsed/platform-router";
2526
import Fastify, {FastifyInstance, FastifyReply, FastifyRequest} from "fastify";
26-
import {IncomingMessage, ServerResponse} from "http";
2727

2828
import type {PlatformFastifyPluginLoadingOptions, PlatformFastifyPluginSettings} from "../interfaces/interfaces.js";
2929
import type {PlatformFastifySettings} from "../interfaces/PlatformFastifySettings.js";
@@ -56,7 +56,7 @@ export class PlatformFastify extends PlatformAdapter<FastifyInstance> {
5656
useClass: PlatformFastifyRequest
5757
}
5858
];
59-
private decorated: boolean = false;
59+
private staticsDecorated = false;
6060

6161
/**
6262
* Create new serverless application. In this mode, the component scan are disabled.
@@ -286,9 +286,9 @@ export class PlatformFastify extends PlatformAdapter<FastifyInstance> {
286286
this.app.getApp().register(fastifyStatics, {
287287
root: options.root,
288288
prefix: endpoint,
289-
decorateReply: !this.decorated
289+
decorateReply: !this.staticsDecorated
290290
});
291-
this.decorated = true;
291+
this.staticsDecorated = true;
292292

293293
return null;
294294
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
1-
// import type {RouterOptions} from "@koa/router";
2-
31
import type {FastifyInstance} from "fastify";
42

53
export interface PlatformFastifySettings {
64
app?: FastifyInstance;
7-
// /**
8-
// * Koa router options
9-
// */
10-
// router?: RouterOptions;
11-
// /**
12-
// * Body parser options
13-
// * @param opts
14-
// */
15-
// bodyParser?: (opts?: Options) => Middleware | Options;
165
}

packages/platform/platform-fastify/src/services/PlatformFastifyRequest.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "@fastify/accepts";
2+
13
import type {IncomingMessage} from "node:http";
24

35
import {type PlatformContext, PlatformRequest} from "@tsed/platform-http";

0 commit comments

Comments
 (0)