From 634c728321a88c87b5c8a172fa521d02a1ce7b32 Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Sun, 24 Mar 2024 09:58:56 +0100 Subject: [PATCH] feat(platform-router): add PlatformHandlerMetadata.isRawMiddleware --- packages/platform/platform-fastify/package.json | 1 + .../platform-router/src/domain/PlatformHandlerMetadata.ts | 4 ++++ yarn.lock | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/platform/platform-fastify/package.json b/packages/platform/platform-fastify/package.json index a1099ee8cc1..9722be9cc4b 100644 --- a/packages/platform/platform-fastify/package.json +++ b/packages/platform/platform-fastify/package.json @@ -70,6 +70,7 @@ "@tsed/di": "workspace:*", "@tsed/platform-test-sdk": "workspace:*", "@types/content-disposition": "^0.5.4", + "barrelsby": "2.8.1", "cross-env": "7.0.3", "fastify": "4.23.2", "fastify-raw-body": ">=4.3.0", diff --git a/packages/platform/platform-router/src/domain/PlatformHandlerMetadata.ts b/packages/platform/platform-router/src/domain/PlatformHandlerMetadata.ts index 28990248ebf..342673448fc 100644 --- a/packages/platform/platform-router/src/domain/PlatformHandlerMetadata.ts +++ b/packages/platform/platform-router/src/domain/PlatformHandlerMetadata.ts @@ -138,6 +138,10 @@ export class PlatformHandlerMetadata { return this.type === PlatformHandlerType.RESPONSE_FN; } + public isRawMiddleware() { + return !this.isInjectable() && (this.type === PlatformHandlerType.MIDDLEWARE || this.type === PlatformHandlerType.ERR_MIDDLEWARE); + } + toString() { return [nameOf(this.target), this.propertyKey].filter(Boolean).join("."); } diff --git a/yarn.lock b/yarn.lock index 52da7d1d309..e113b2a77d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7323,6 +7323,7 @@ __metadata: "@tsed/di": "workspace:*" "@tsed/platform-test-sdk": "workspace:*" "@types/content-disposition": "npm:^0.5.4" + barrelsby: "npm:2.8.1" content-disposition: "npm:>=0.5.4" cross-env: "npm:7.0.3" fastify: "npm:4.23.2" @@ -11274,7 +11275,7 @@ __metadata: languageName: node linkType: hard -"barrelsby@npm:^2.8.1": +"barrelsby@npm:2.8.1, barrelsby@npm:^2.8.1": version: 2.8.1 resolution: "barrelsby@npm:2.8.1" dependencies: