mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-06 14:46:47 +08:00
chore: update express to 5.1.0 (@fehmer) (#6691)
This commit is contained in:
parent
14d5a728d9
commit
9b26793a6d
7 changed files with 364 additions and 203 deletions
|
@ -28,9 +28,9 @@
|
|||
"@monkeytype/contracts": "workspace:*",
|
||||
"@monkeytype/funbox": "workspace:*",
|
||||
"@monkeytype/util": "workspace:*",
|
||||
"@ts-rest/core": "3.51.0",
|
||||
"@ts-rest/express": "3.51.0",
|
||||
"@ts-rest/open-api": "3.51.0",
|
||||
"@ts-rest/core": "3.52.1",
|
||||
"@ts-rest/express": "3.52.1",
|
||||
"@ts-rest/open-api": "3.52.1",
|
||||
"bcrypt": "5.1.1",
|
||||
"bullmq": "1.91.1",
|
||||
"chalk": "4.1.2",
|
||||
|
@ -39,8 +39,8 @@
|
|||
"date-fns": "3.6.0",
|
||||
"dotenv": "16.4.5",
|
||||
"etag": "1.8.1",
|
||||
"express": "4.21.1",
|
||||
"express-rate-limit": "7.4.0",
|
||||
"express": "5.1.0",
|
||||
"express-rate-limit": "7.5.1",
|
||||
"firebase-admin": "12.0.0",
|
||||
"helmet": "4.6.0",
|
||||
"ioredis": "4.28.5",
|
||||
|
@ -72,7 +72,7 @@
|
|||
"@types/bcrypt": "5.0.2",
|
||||
"@types/cors": "2.8.12",
|
||||
"@types/cron": "1.7.3",
|
||||
"@types/express": "4.17.21",
|
||||
"@types/express": "5.0.3",
|
||||
"@types/ioredis": "4.28.10",
|
||||
"@types/lodash": "4.14.178",
|
||||
"@types/mjml": "4.7.4",
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
import { compatibilityCheckMiddleware } from "./middlewares/compatibilityCheck";
|
||||
import { COMPATIBILITY_CHECK_HEADER } from "@monkeytype/contracts";
|
||||
import { createETagGenerator } from "./utils/etag";
|
||||
import { v4RequestBody } from "./middlewares/utility";
|
||||
|
||||
const etagFn = createETagGenerator({ weak: true });
|
||||
|
||||
|
@ -29,6 +30,7 @@ function buildApp(): express.Application {
|
|||
|
||||
app.use(badAuthRateLimiterHandler);
|
||||
app.use(rootRateLimiter);
|
||||
app.use(v4RequestBody);
|
||||
|
||||
app.set("etag", etagFn);
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ export function rateLimitRequest<
|
|||
)
|
||||
);
|
||||
} else {
|
||||
rateLimiter(req, res, next);
|
||||
await rateLimiter(req, res, next);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,3 +45,22 @@ export function getMetadata(req: TsRestRequestWithContext): EndpointMetadata {
|
|||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return (req.tsRestRoute["metadata"] ?? {}) as EndpointMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* The req.body property returns undefined when the body has not been parsed. In Express 4, it returns {} by default.
|
||||
* Restore the v4 behavior
|
||||
* @param req
|
||||
* @param _res
|
||||
* @param next
|
||||
*/
|
||||
export async function v4RequestBody(
|
||||
req: Request,
|
||||
_res: Response,
|
||||
next: NextFunction
|
||||
): Promise<void> {
|
||||
if (req.body === undefined) {
|
||||
req.body = {};
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
"@monkeytype/util": "workspace:*",
|
||||
"@sentry/browser": "9.14.0",
|
||||
"@sentry/vite-plugin": "3.3.1",
|
||||
"@ts-rest/core": "3.51.0",
|
||||
"@ts-rest/core": "3.52.1",
|
||||
"balloon-css": "1.2.0",
|
||||
"canvas-confetti": "1.5.1",
|
||||
"chart.js": "3.7.1",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"lint": "npm run oxlint && npm run eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ts-rest/core": "3.51.0",
|
||||
"@ts-rest/core": "3.52.1",
|
||||
"zod": "3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
528
pnpm-lock.yaml
generated
528
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue