-
Notifications
You must be signed in to change notification settings - Fork 1
feat(nestjs): add nestjs middleware support (#21) #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds middleware support for the NestJS adapter by integrating middleware resolution and execution logic into the RESTful scanning and handling processes.
- Introduces middleware resolution (resolveMiddlewares) and execution (executeMiddlewares) in the NestJSRestfulScanner class.
- Updates the NestJSRestfulHandler to execute middlewares before processing parameters and guards.
- Refactors middleware configuration and the related builders (MiddlewareCustomerBuilder and MiddlewareConfigProxyBuilder) and enhances module resolution checks.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
packages/adapter/adapter-nestjs/src/restful/restful-scanner.ts | Implements middleware resolution and execution via new methods. |
packages/adapter/adapter-nestjs/src/restful/restful-handler.ts | Adjusts handler logic to execute middlewares prior to other actions. |
packages/adapter/adapter-nestjs/src/plugin.ts | Instantiates the scanner with resolved modules, removing legacy code. |
packages/adapter/adapter-nestjs/src/nest-resolver.ts | Adds an isResolved flag and throws errors if resolution is missing. |
packages/adapter/adapter-nestjs/src/middleware/middleware-customer.ts | Refactors middleware consumer to a builder with an updated map. |
packages/adapter/adapter-nestjs/src/middleware/middleware-config-proxy.ts | Updates route configuration methods in middleware proxy. |
.changeset/53c35bd6c1dad04be84922fce98d039b81c5b5b7.md | Minor changeset noting version bump for middleware support. |
handler: instance.use, | ||
instance, | ||
routes: this._routes, | ||
for (const route of routes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The forRoutes method is adding routes to the excludedRoutes array instead of the intended includedRoutes. This likely causes middleware inclusion logic to fail; please update it to push routes into includedRoutes.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
No description provided.