Skip to content

Commit

Permalink
chore: review
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Feb 1, 2025
1 parent 8291c5e commit dff9e46
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 379 deletions.
8 changes: 3 additions & 5 deletions packages/platform/platform-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
},
"keywords": [
"Koa",
"Fastify",
"TypeScript",
"typescript",
"Decorator",
"decorators",
"decorator",
"fastify",
"Controller",
"Inject",
Expand All @@ -38,7 +36,7 @@
"mvc",
"swagger",
"swagger ui",
"ES2015",
"ESM",
"ES6",
"server",
"rest",
Expand All @@ -58,13 +56,13 @@
"url": "git+https://github.com/tsedio/tsed.git"
},
"dependencies": {
"@fastify/accepts": ">=5.0.2",
"@fastify/middie": ">=9.0.2",
"@fastify/static": ">=8.0.4",
"content-disposition": ">=0.5.4",
"tslib": "2.6.1"
},
"devDependencies": {
"@fastify/accepts": "5.0.2",
"@fastify/cookie": "11.0.1",
"@fastify/formbody": "8.0.1",
"@fastify/session": "11.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/platform/platform-fastify/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<hr />

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

## Installation

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

The MIT License (MIT)

Copyright (c) 2016 - 2018 Romain Lenzotti
Copyright (c) 2016 - today Romain Lenzotti

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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Server {}
describe("PlatformFastify", () => {
describe("create()", () => {
beforeEach(() => {
vi.spyOn(PlatformBuilder, "create").mockReturnValue({});
vi.spyOn(PlatformBuilder, "create").mockReturnValue({} as never);
});
afterEach(() => vi.resetAllMocks());
it("should create platform", () => {
Expand All @@ -20,7 +20,7 @@ describe("PlatformFastify", () => {
});
describe("bootstrap()", () => {
beforeEach(() => {
vi.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({});
vi.spyOn(PlatformBuilder, "bootstrap").mockReturnValue({} as never);
});
afterEach(() => vi.resetAllMocks());
it("should create platform", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Http from "node:http";
import {IncomingMessage, ServerResponse} from "node:http";
import * as Https from "node:https";

import fastifyMiddie from "@fastify/middie";
Expand All @@ -23,7 +24,6 @@ import {
} from "@tsed/platform-http";
import {PlatformHandlerMetadata, PlatformHandlerType, PlatformLayer} from "@tsed/platform-router";
import Fastify, {FastifyInstance, FastifyReply, FastifyRequest} from "fastify";
import {IncomingMessage, ServerResponse} from "http";

import type {PlatformFastifyPluginLoadingOptions, PlatformFastifyPluginSettings} from "../interfaces/interfaces.js";
import type {PlatformFastifySettings} from "../interfaces/PlatformFastifySettings.js";
Expand Down Expand Up @@ -56,7 +56,7 @@ export class PlatformFastify extends PlatformAdapter<FastifyInstance> {
useClass: PlatformFastifyRequest
}
];
private decorated: boolean = false;
private staticsDecorated = false;

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

return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
// import type {RouterOptions} from "@koa/router";

import type {FastifyInstance} from "fastify";

export interface PlatformFastifySettings {
app?: FastifyInstance;
// /**
// * Koa router options
// */
// router?: RouterOptions;
// /**
// * Body parser options
// * @param opts
// */
// bodyParser?: (opts?: Options) => Middleware | Options;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "@fastify/accepts";

import type {IncomingMessage} from "node:http";

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

0 comments on commit dff9e46

Please # to comment.