As request scoped providers and controllers are not supported, I added that.
In nest, request scoped instance wrappers uses their metatype when they instantiated, so modifying prototype of request scoped wrapper's metatype can modify the instantiated object's behavior.
I also changed applying aop wrapped function to original function by using ecma proxy, because wrapped function must bind request scoped wrapper's instance to original function' this object.. but when onModuleInit time, request did not arrived so aop executor can't access to instance of request scoped wrapper. Using proxy object can access the original function's this binding, and also proxy object deliver all of other stuffs(property access, other things..) to original function so it seems great for this usecase.
Overview
As request scoped providers and controllers are not supported, I added that. In nest, request scoped instance wrappers uses their metatype when they instantiated, so modifying prototype of request scoped wrapper's metatype can modify the instantiated object's behavior.
reference: https://github.com/nestjs/nest/blob/67d4656623c7dc50f2cfd8d5e963678bcbf77959/packages/core/injector/injector.ts#L745-L757
I also changed applying aop wrapped function to original function by using ecma proxy, because wrapped function must bind request scoped wrapper's instance to original function' this object.. but when
onModuleInit
time, request did not arrived so aop executor can't access to instance of request scoped wrapper. Using proxy object can access the original function's this binding, and also proxy object deliver all of other stuffs(property access, other things..) to original function so it seems great for this usecase.PR Checklist