@tsed/common 7.0.0-alpha.2 → 7.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builder/PlatformBuilder.js +275 -0
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -0
- package/lib/cjs/builder/PlatformControllerBuilder.js +85 -0
- package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -0
- package/lib/cjs/config/index.js +7 -0
- package/lib/cjs/config/index.js.map +1 -0
- package/lib/cjs/config/interfaces/ConverterSettings.js +3 -0
- package/lib/cjs/config/interfaces/ConverterSettings.js.map +1 -0
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js +3 -0
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.js.map +1 -0
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -0
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +1 -0
- package/lib/cjs/config/interfaces/index.js +8 -0
- package/lib/cjs/config/interfaces/index.js.map +1 -0
- package/lib/cjs/config/services/PlatformConfiguration.js +181 -0
- package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -0
- package/lib/cjs/constants/routerOptions.js +5 -0
- package/lib/cjs/constants/routerOptions.js.map +1 -0
- package/lib/cjs/decorators/httpServer.js +32 -0
- package/lib/cjs/decorators/httpServer.js.map +1 -0
- package/lib/cjs/decorators/httpsServer.js +32 -0
- package/lib/cjs/decorators/httpsServer.js.map +1 -0
- package/lib/cjs/decorators/index.js +21 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/cjs/decorators/method/acceptMime.js +28 -0
- package/lib/cjs/decorators/method/acceptMime.js.map +1 -0
- package/lib/cjs/decorators/method/endpointFn.js +15 -0
- package/lib/cjs/decorators/method/endpointFn.js.map +1 -0
- package/lib/cjs/decorators/method/location.js +6 -0
- package/lib/cjs/decorators/method/location.js.map +1 -0
- package/lib/cjs/decorators/method/redirect.js +6 -0
- package/lib/cjs/decorators/method/redirect.js.map +1 -0
- package/lib/cjs/decorators/method/route.js +13 -0
- package/lib/cjs/decorators/method/route.js.map +1 -0
- package/lib/cjs/decorators/method/view.js +34 -0
- package/lib/cjs/decorators/method/view.js.map +1 -0
- package/lib/cjs/decorators/multer/index.js +7 -0
- package/lib/cjs/decorators/multer/index.js.map +1 -0
- package/lib/cjs/decorators/multer/multerFileSize.js +35 -0
- package/lib/cjs/decorators/multer/multerFileSize.js.map +1 -0
- package/lib/cjs/decorators/multer/multerOptions.js +52 -0
- package/lib/cjs/decorators/multer/multerOptions.js.map +1 -0
- package/lib/cjs/decorators/multer/multipartFile.js +78 -0
- package/lib/cjs/decorators/multer/multipartFile.js.map +1 -0
- package/lib/cjs/decorators/params/error.js +20 -0
- package/lib/cjs/decorators/params/error.js.map +1 -0
- package/lib/cjs/decorators/params/next.js +21 -0
- package/lib/cjs/decorators/params/next.js.map +1 -0
- package/lib/cjs/decorators/params/request.js +39 -0
- package/lib/cjs/decorators/params/request.js.map +1 -0
- package/lib/cjs/decorators/params/response.js +33 -0
- package/lib/cjs/decorators/params/response.js.map +1 -0
- package/lib/cjs/domain/AnyToPromiseWithCtx.js +27 -0
- package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -0
- package/lib/cjs/domain/ControllerProvider.js +51 -0
- package/lib/cjs/domain/ControllerProvider.js.map +1 -0
- package/lib/cjs/domain/EndpointMetadata.js +70 -0
- package/lib/cjs/domain/EndpointMetadata.js.map +1 -0
- package/lib/cjs/domain/HandlerMetadata.js +57 -0
- package/lib/cjs/domain/HandlerMetadata.js.map +1 -0
- package/lib/cjs/domain/PlatformContext.js +92 -0
- package/lib/cjs/domain/PlatformContext.js.map +1 -0
- package/lib/cjs/domain/PlatformRouteDetails.js +24 -0
- package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -0
- package/lib/cjs/domain/index.js +10 -0
- package/lib/cjs/domain/index.js.map +1 -0
- package/lib/cjs/index.js +34 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/AfterInit.js +3 -0
- package/lib/cjs/interfaces/AfterInit.js.map +1 -0
- package/lib/cjs/interfaces/AfterListen.js +3 -0
- package/lib/cjs/interfaces/AfterListen.js.map +1 -0
- package/lib/cjs/interfaces/AfterRoutesInit.js +3 -0
- package/lib/cjs/interfaces/AfterRoutesInit.js.map +1 -0
- package/lib/cjs/interfaces/BeforeInit.js +3 -0
- package/lib/cjs/interfaces/BeforeInit.js.map +1 -0
- package/lib/cjs/interfaces/BeforeListen.js +3 -0
- package/lib/cjs/interfaces/BeforeListen.js.map +1 -0
- package/lib/cjs/interfaces/BeforeRoutesInit.js +3 -0
- package/lib/cjs/interfaces/BeforeRoutesInit.js.map +1 -0
- package/lib/cjs/interfaces/HandlerType.js +17 -0
- package/lib/cjs/interfaces/HandlerType.js.map +1 -0
- package/lib/cjs/interfaces/IncomingEvent.js +3 -0
- package/lib/cjs/interfaces/IncomingEvent.js.map +1 -0
- package/lib/cjs/interfaces/OnReady.js +3 -0
- package/lib/cjs/interfaces/OnReady.js.map +1 -0
- package/lib/cjs/interfaces/OnRequest.js +3 -0
- package/lib/cjs/interfaces/OnRequest.js.map +1 -0
- package/lib/cjs/interfaces/OnResponse.js +3 -0
- package/lib/cjs/interfaces/OnResponse.js.map +1 -0
- package/lib/cjs/interfaces/OnRoutesInit.js +3 -0
- package/lib/cjs/interfaces/OnRoutesInit.js.map +1 -0
- package/lib/cjs/interfaces/PathType.js +3 -0
- package/lib/cjs/interfaces/PathType.js.map +1 -0
- package/lib/cjs/interfaces/PlatformAdapter.js +3 -0
- package/lib/cjs/interfaces/PlatformAdapter.js.map +1 -0
- package/lib/cjs/interfaces/PlatformRouteOptions.js +3 -0
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -0
- package/lib/cjs/interfaces/ResponseErrorObject.js +3 -0
- package/lib/cjs/interfaces/ResponseErrorObject.js.map +1 -0
- package/lib/cjs/interfaces/Route.js +3 -0
- package/lib/cjs/interfaces/Route.js.map +1 -0
- package/lib/cjs/interfaces/index.js +21 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +55 -0
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -0
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js +12 -0
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +1 -0
- package/lib/cjs/middlewares/bindEndpointMiddleware.js +13 -0
- package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -0
- package/lib/cjs/middlewares/index.js +7 -0
- package/lib/cjs/middlewares/index.js.map +1 -0
- package/lib/cjs/services/FakeRawDriver.js +26 -0
- package/lib/cjs/services/FakeRawDriver.js.map +1 -0
- package/lib/cjs/services/Platform.js +107 -0
- package/lib/cjs/services/Platform.js.map +1 -0
- package/lib/cjs/services/PlatformApplication.js +34 -0
- package/lib/cjs/services/PlatformApplication.js.map +1 -0
- package/lib/cjs/services/PlatformHandler.js +233 -0
- package/lib/cjs/services/PlatformHandler.js.map +1 -0
- package/lib/cjs/services/PlatformMiddlewaresChain.js +34 -0
- package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -0
- package/lib/cjs/services/PlatformRequest.js +138 -0
- package/lib/cjs/services/PlatformRequest.js.map +1 -0
- package/lib/cjs/services/PlatformResponse.js +271 -0
- package/lib/cjs/services/PlatformResponse.js.map +1 -0
- package/lib/cjs/services/PlatformRouter.js +126 -0
- package/lib/cjs/services/PlatformRouter.js.map +1 -0
- package/lib/cjs/services/PlatformTest.js +166 -0
- package/lib/cjs/services/PlatformTest.js.map +1 -0
- package/lib/cjs/services/index.js +12 -0
- package/lib/cjs/services/index.js.map +1 -0
- package/lib/cjs/utils/createContext.js +38 -0
- package/lib/cjs/utils/createContext.js.map +1 -0
- package/lib/cjs/utils/createHandlerMetadata.js +49 -0
- package/lib/cjs/utils/createHandlerMetadata.js.map +1 -0
- package/lib/cjs/utils/createHttpServer.js +34 -0
- package/lib/cjs/utils/createHttpServer.js.map +1 -0
- package/lib/cjs/utils/createHttpsServer.js +34 -0
- package/lib/cjs/utils/createHttpsServer.js.map +1 -0
- package/lib/cjs/utils/createInjector.js +38 -0
- package/lib/cjs/utils/createInjector.js.map +1 -0
- package/lib/cjs/utils/getConfiguration.js +42 -0
- package/lib/cjs/utils/getConfiguration.js.map +1 -0
- package/lib/cjs/utils/getStaticsOptions.js +21 -0
- package/lib/cjs/utils/getStaticsOptions.js.map +1 -0
- package/lib/cjs/utils/index.js +11 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/cjs/utils/listenServer.js +21 -0
- package/lib/cjs/utils/listenServer.js.map +1 -0
- package/lib/cjs/utils/mapReturnedResponse.js +15 -0
- package/lib/cjs/utils/mapReturnedResponse.js.map +1 -0
- package/lib/cjs/utils/printRoutes.js +36 -0
- package/lib/cjs/utils/printRoutes.js.map +1 -0
- package/lib/cjs/utils/setResponseHeaders.js +35 -0
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -0
- package/lib/cjs/utils/useCtxHandler.js +15 -0
- package/lib/cjs/utils/useCtxHandler.js.map +1 -0
- package/lib/esm/builder/PlatformBuilder.js +271 -0
- package/lib/esm/builder/PlatformBuilder.js.map +1 -0
- package/lib/esm/builder/PlatformControllerBuilder.js +79 -0
- package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -0
- package/lib/esm/config/index.js +4 -0
- package/lib/esm/config/index.js.map +1 -0
- package/lib/esm/config/interfaces/ConverterSettings.js +2 -0
- package/lib/esm/config/interfaces/ConverterSettings.js.map +1 -0
- package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js +2 -0
- package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
- package/lib/esm/config/interfaces/PlatformLoggerSettings.js +2 -0
- package/lib/esm/config/interfaces/PlatformLoggerSettings.js.map +1 -0
- package/lib/esm/config/interfaces/PlatformMulterSettings.js +2 -0
- package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -0
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js +2 -0
- package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +1 -0
- package/lib/esm/config/interfaces/index.js +5 -0
- package/lib/esm/config/interfaces/index.js.map +1 -0
- package/lib/esm/config/services/PlatformConfiguration.js +178 -0
- package/lib/esm/config/services/PlatformConfiguration.js.map +1 -0
- package/lib/esm/constants/routerOptions.js +2 -0
- package/lib/esm/constants/routerOptions.js.map +1 -0
- package/lib/esm/decorators/httpServer.js +28 -0
- package/lib/esm/decorators/httpServer.js.map +1 -0
- package/lib/esm/decorators/httpsServer.js +28 -0
- package/lib/esm/decorators/httpsServer.js.map +1 -0
- package/lib/esm/decorators/index.js +18 -0
- package/lib/esm/decorators/index.js.map +1 -0
- package/lib/esm/decorators/method/acceptMime.js +24 -0
- package/lib/esm/decorators/method/acceptMime.js.map +1 -0
- package/lib/esm/decorators/method/endpointFn.js +11 -0
- package/lib/esm/decorators/method/endpointFn.js.map +1 -0
- package/lib/esm/decorators/method/location.js +2 -0
- package/lib/esm/decorators/method/location.js.map +1 -0
- package/lib/esm/decorators/method/redirect.js +2 -0
- package/lib/esm/decorators/method/redirect.js.map +1 -0
- package/lib/esm/decorators/method/route.js +2 -0
- package/lib/esm/decorators/method/route.js.map +1 -0
- package/lib/esm/decorators/method/view.js +30 -0
- package/lib/esm/decorators/method/view.js.map +1 -0
- package/lib/esm/decorators/multer/index.js +4 -0
- package/lib/esm/decorators/multer/index.js.map +1 -0
- package/lib/esm/decorators/multer/multerFileSize.js +31 -0
- package/lib/esm/decorators/multer/multerFileSize.js.map +1 -0
- package/lib/esm/decorators/multer/multerOptions.js +48 -0
- package/lib/esm/decorators/multer/multerOptions.js.map +1 -0
- package/lib/esm/decorators/multer/multipartFile.js +74 -0
- package/lib/esm/decorators/multer/multipartFile.js.map +1 -0
- package/lib/esm/decorators/params/error.js +16 -0
- package/lib/esm/decorators/params/error.js.map +1 -0
- package/lib/esm/decorators/params/next.js +17 -0
- package/lib/esm/decorators/params/next.js.map +1 -0
- package/lib/esm/decorators/params/request.js +34 -0
- package/lib/esm/decorators/params/request.js.map +1 -0
- package/lib/esm/decorators/params/response.js +28 -0
- package/lib/esm/decorators/params/response.js.map +1 -0
- package/lib/esm/domain/AnyToPromiseWithCtx.js +23 -0
- package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -0
- package/lib/esm/domain/ControllerProvider.js +47 -0
- package/lib/esm/domain/ControllerProvider.js.map +1 -0
- package/lib/esm/domain/EndpointMetadata.js +67 -0
- package/lib/esm/domain/EndpointMetadata.js.map +1 -0
- package/lib/esm/domain/HandlerMetadata.js +53 -0
- package/lib/esm/domain/HandlerMetadata.js.map +1 -0
- package/lib/esm/domain/PlatformContext.js +88 -0
- package/lib/esm/domain/PlatformContext.js.map +1 -0
- package/lib/esm/domain/PlatformRouteDetails.js +20 -0
- package/lib/esm/domain/PlatformRouteDetails.js.map +1 -0
- package/lib/esm/domain/index.js +7 -0
- package/lib/esm/domain/index.js.map +1 -0
- package/lib/esm/index.js +28 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/AfterInit.js +2 -0
- package/lib/esm/interfaces/AfterInit.js.map +1 -0
- package/lib/esm/interfaces/AfterListen.js +2 -0
- package/lib/esm/interfaces/AfterListen.js.map +1 -0
- package/lib/esm/interfaces/AfterRoutesInit.js +2 -0
- package/lib/esm/interfaces/AfterRoutesInit.js.map +1 -0
- package/lib/esm/interfaces/BeforeInit.js +2 -0
- package/lib/esm/interfaces/BeforeInit.js.map +1 -0
- package/lib/esm/interfaces/BeforeListen.js +2 -0
- package/lib/esm/interfaces/BeforeListen.js.map +1 -0
- package/lib/esm/interfaces/BeforeRoutesInit.js +2 -0
- package/lib/esm/interfaces/BeforeRoutesInit.js.map +1 -0
- package/lib/esm/interfaces/HandlerType.js +14 -0
- package/lib/esm/interfaces/HandlerType.js.map +1 -0
- package/lib/esm/interfaces/IncomingEvent.js +2 -0
- package/lib/esm/interfaces/IncomingEvent.js.map +1 -0
- package/lib/esm/interfaces/OnReady.js +2 -0
- package/lib/esm/interfaces/OnReady.js.map +1 -0
- package/lib/esm/interfaces/OnRequest.js +2 -0
- package/lib/esm/interfaces/OnRequest.js.map +1 -0
- package/lib/esm/interfaces/OnResponse.js +2 -0
- package/lib/esm/interfaces/OnResponse.js.map +1 -0
- package/lib/esm/interfaces/OnRoutesInit.js +2 -0
- package/lib/esm/interfaces/OnRoutesInit.js.map +1 -0
- package/lib/esm/interfaces/PathType.js +2 -0
- package/lib/esm/interfaces/PathType.js.map +1 -0
- package/lib/esm/interfaces/PlatformAdapter.js +2 -0
- package/lib/esm/interfaces/PlatformAdapter.js.map +1 -0
- package/lib/esm/interfaces/PlatformRouteOptions.js +2 -0
- package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -0
- package/lib/esm/interfaces/ResponseErrorObject.js +2 -0
- package/lib/esm/interfaces/ResponseErrorObject.js.map +1 -0
- package/lib/esm/interfaces/Route.js +2 -0
- package/lib/esm/interfaces/Route.js.map +1 -0
- package/lib/esm/interfaces/index.js +18 -0
- package/lib/esm/interfaces/index.js.map +1 -0
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +34 -0
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +52 -0
- package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -0
- package/lib/esm/middlewares/__mock__/FakeCtrl.js +9 -0
- package/lib/esm/middlewares/__mock__/FakeCtrl.js.map +1 -0
- package/lib/esm/middlewares/bindEndpointMiddleware.js +9 -0
- package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -0
- package/lib/esm/middlewares/index.js +4 -0
- package/lib/esm/middlewares/index.js.map +1 -0
- package/lib/esm/services/FakeRawDriver.js +22 -0
- package/lib/esm/services/FakeRawDriver.js.map +1 -0
- package/lib/esm/services/Platform.js +104 -0
- package/lib/esm/services/Platform.js.map +1 -0
- package/lib/esm/services/PlatformApplication.js +31 -0
- package/lib/esm/services/PlatformApplication.js.map +1 -0
- package/lib/esm/services/PlatformHandler.js +230 -0
- package/lib/esm/services/PlatformHandler.js.map +1 -0
- package/lib/esm/services/PlatformMiddlewaresChain.js +31 -0
- package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -0
- package/lib/esm/services/PlatformRequest.js +135 -0
- package/lib/esm/services/PlatformRequest.js.map +1 -0
- package/lib/esm/services/PlatformResponse.js +268 -0
- package/lib/esm/services/PlatformResponse.js.map +1 -0
- package/lib/esm/services/PlatformRouter.js +123 -0
- package/lib/esm/services/PlatformRouter.js.map +1 -0
- package/lib/esm/services/PlatformTest.js +162 -0
- package/lib/esm/services/PlatformTest.js.map +1 -0
- package/lib/esm/services/index.js +9 -0
- package/lib/esm/services/index.js.map +1 -0
- package/lib/esm/utils/createContext.js +34 -0
- package/lib/esm/utils/createContext.js.map +1 -0
- package/lib/esm/utils/createHandlerMetadata.js +45 -0
- package/lib/esm/utils/createHandlerMetadata.js.map +1 -0
- package/lib/esm/utils/createHttpServer.js +29 -0
- package/lib/esm/utils/createHttpServer.js.map +1 -0
- package/lib/esm/utils/createHttpsServer.js +29 -0
- package/lib/esm/utils/createHttpsServer.js.map +1 -0
- package/lib/esm/utils/createInjector.js +34 -0
- package/lib/esm/utils/createInjector.js.map +1 -0
- package/lib/esm/utils/getConfiguration.js +38 -0
- package/lib/esm/utils/getConfiguration.js.map +1 -0
- package/lib/esm/utils/getStaticsOptions.js +17 -0
- package/lib/esm/utils/getStaticsOptions.js.map +1 -0
- package/lib/esm/utils/index.js +8 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/esm/utils/listenServer.js +17 -0
- package/lib/esm/utils/listenServer.js.map +1 -0
- package/lib/esm/utils/mapReturnedResponse.js +11 -0
- package/lib/esm/utils/mapReturnedResponse.js.map +1 -0
- package/lib/esm/utils/printRoutes.js +32 -0
- package/lib/esm/utils/printRoutes.js.map +1 -0
- package/lib/esm/utils/setResponseHeaders.js +31 -0
- package/lib/esm/utils/setResponseHeaders.js.map +1 -0
- package/lib/esm/utils/useCtxHandler.js +11 -0
- package/lib/esm/utils/useCtxHandler.js.map +1 -0
- package/lib/{builder → types/builder}/PlatformBuilder.d.ts +25 -30
- package/lib/types/builder/PlatformControllerBuilder.d.ts +17 -0
- package/lib/{config → types/config}/index.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/ConverterSettings.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/EndpointDirectoriesSettings.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/PlatformLoggerSettings.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/PlatformMulterSettings.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/PlatformStaticsSettings.d.ts +1 -0
- package/lib/{config → types/config}/interfaces/index.d.ts +14 -1
- package/lib/{config → types/config}/services/PlatformConfiguration.d.ts +12 -11
- package/lib/{constants → types/constants}/routerOptions.d.ts +0 -0
- package/lib/{decorators → types/decorators}/httpServer.d.ts +1 -0
- package/lib/{decorators → types/decorators}/httpsServer.d.ts +1 -0
- package/lib/{decorators → types/decorators}/index.d.ts +1 -0
- package/lib/{decorators → types/decorators}/method/acceptMime.d.ts +0 -0
- package/lib/{decorators → types/decorators}/method/endpointFn.d.ts +1 -0
- package/lib/{decorators → types/decorators}/method/location.d.ts +0 -0
- package/lib/{decorators → types/decorators}/method/redirect.d.ts +0 -0
- package/lib/{decorators → types/decorators}/method/route.d.ts +0 -0
- package/lib/types/decorators/method/view.d.ts +25 -0
- package/lib/{decorators → types/decorators}/multer/index.d.ts +0 -0
- package/lib/{decorators → types/decorators}/multer/multerFileSize.d.ts +0 -0
- package/lib/{decorators → types/decorators}/multer/multerOptions.d.ts +0 -0
- package/lib/{decorators → types/decorators}/multer/multipartFile.d.ts +0 -0
- package/lib/{decorators → types/decorators}/params/error.d.ts +0 -0
- package/lib/{decorators → types/decorators}/params/next.d.ts +0 -0
- package/lib/{decorators → types/decorators}/params/request.d.ts +0 -0
- package/lib/{decorators → types/decorators}/params/response.d.ts +0 -0
- package/lib/{domain → types/domain}/AnyToPromiseWithCtx.d.ts +0 -0
- package/lib/types/domain/ControllerProvider.d.ts +24 -0
- package/lib/{domain → types/domain}/EndpointMetadata.d.ts +3 -41
- package/lib/{domain → types/domain}/HandlerMetadata.d.ts +2 -2
- package/lib/{domain → types/domain}/PlatformContext.d.ts +0 -0
- package/lib/{domain → types/domain}/PlatformRouteDetails.d.ts +4 -10
- package/lib/{domain → types/domain}/index.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +1 -3
- package/lib/{interfaces → types/interfaces}/AfterInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/AfterListen.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/AfterRoutesInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/BeforeInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/BeforeListen.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/BeforeRoutesInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/HandlerType.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/IncomingEvent.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/OnReady.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/OnRequest.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/OnResponse.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/OnRoutesInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/PathType.d.ts +0 -0
- package/lib/types/interfaces/PlatformAdapter.d.ts +19 -0
- package/lib/{interfaces → types/interfaces}/PlatformRouteOptions.d.ts +6 -4
- package/lib/{interfaces → types/interfaces}/ResponseErrorObject.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/Route.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/index.d.ts +1 -1
- package/lib/{middlewares → types/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
- package/lib/{middlewares → types/middlewares}/PlatformMulterMiddleware.d.ts +0 -0
- package/lib/{middlewares/data → types/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
- package/lib/{middlewares → types/middlewares}/bindEndpointMiddleware.d.ts +0 -0
- package/lib/{middlewares → types/middlewares}/index.d.ts +0 -0
- package/lib/{services → types/services}/FakeRawDriver.d.ts +0 -0
- package/lib/{services → types/services}/Platform.d.ts +12 -6
- package/lib/{services → types/services}/PlatformApplication.d.ts +0 -0
- package/lib/{services → types/services}/PlatformHandler.d.ts +0 -0
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -0
- package/lib/{services → types/services}/PlatformRequest.d.ts +2 -1
- package/lib/{services → types/services}/PlatformResponse.d.ts +4 -4
- package/lib/{services → types/services}/PlatformRouter.d.ts +3 -2
- package/lib/{services → types/services}/PlatformTest.d.ts +7 -6
- package/lib/{services → types/services}/index.d.ts +1 -0
- package/lib/{utils → types/utils}/createContext.d.ts +0 -0
- package/lib/{utils → types/utils}/createHandlerMetadata.d.ts +0 -0
- package/lib/types/utils/createHttpServer.d.ts +4 -0
- package/lib/types/utils/createHttpsServer.d.ts +4 -0
- package/lib/types/utils/createInjector.d.ts +7 -0
- package/lib/types/utils/getConfiguration.d.ts +2 -0
- package/lib/types/utils/getStaticsOptions.d.ts +5 -0
- package/lib/{utils → types/utils}/index.d.ts +0 -1
- package/lib/types/utils/listenServer.d.ts +7 -0
- package/lib/{utils → types/utils}/mapReturnedResponse.d.ts +0 -0
- package/lib/{utils → types/utils}/printRoutes.d.ts +0 -0
- package/lib/{utils → types/utils}/setResponseHeaders.d.ts +0 -0
- package/lib/{utils → types/utils}/useCtxHandler.d.ts +0 -0
- package/package.json +29 -28
- package/tsconfig.compile.esm.json +23 -0
- package/lib/PlatformModule.d.ts +0 -15
- package/lib/builder/PlatformControllerBuilder.d.ts +0 -19
- package/lib/domain/ControllerProvider.d.ts +0 -53
- package/lib/index.js +0 -3651
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -3464
- package/lib/index.modern.js.map +0 -1
- package/lib/interfaces/PlatformRouterMethods.d.ts +0 -10
- package/lib/registries/ControllerRegistry.d.ts +0 -1
- package/lib/utils/createHttpServer.d.ts +0 -3
- package/lib/utils/createHttpsServer.d.ts +0 -3
- package/lib/utils/createInjector.d.ts +0 -2
- package/lib/utils/createPlatformApplication.d.ts +0 -2
- package/lib/utils/getControllerPath.d.ts +0 -2
- package/lib/utils/listenServer.d.ts +0 -10
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformConfiguration = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@tsed/core");
|
|
6
|
+
const di_1 = require("@tsed/di");
|
|
7
|
+
const logger_1 = require("@tsed/logger");
|
|
8
|
+
const rootDir = process.cwd();
|
|
9
|
+
/**
|
|
10
|
+
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
11
|
+
*/
|
|
12
|
+
let PlatformConfiguration = class PlatformConfiguration extends di_1.DIConfiguration {
|
|
13
|
+
constructor() {
|
|
14
|
+
super({ rootDir });
|
|
15
|
+
}
|
|
16
|
+
get version() {
|
|
17
|
+
return this.getRaw("version");
|
|
18
|
+
}
|
|
19
|
+
set version(v) {
|
|
20
|
+
this.setRaw("version", v);
|
|
21
|
+
}
|
|
22
|
+
get rootDir() {
|
|
23
|
+
return this.getRaw("rootDir");
|
|
24
|
+
}
|
|
25
|
+
set rootDir(value) {
|
|
26
|
+
this.setRaw("rootDir", value);
|
|
27
|
+
}
|
|
28
|
+
get port() {
|
|
29
|
+
return this.httpPort;
|
|
30
|
+
}
|
|
31
|
+
set port(value) {
|
|
32
|
+
this.httpPort = value;
|
|
33
|
+
}
|
|
34
|
+
get httpsOptions() {
|
|
35
|
+
return this.getRaw("httpsOptions");
|
|
36
|
+
}
|
|
37
|
+
set httpsOptions(value) {
|
|
38
|
+
this.setRaw("httpsOptions", value);
|
|
39
|
+
}
|
|
40
|
+
get httpPort() {
|
|
41
|
+
return this.getRaw("httpPort");
|
|
42
|
+
}
|
|
43
|
+
set httpPort(value) {
|
|
44
|
+
this.setRaw("httpPort", value);
|
|
45
|
+
}
|
|
46
|
+
get httpsPort() {
|
|
47
|
+
return this.getRaw("httpsPort");
|
|
48
|
+
}
|
|
49
|
+
set httpsPort(value) {
|
|
50
|
+
this.setRaw("httpsPort", value);
|
|
51
|
+
}
|
|
52
|
+
get env() {
|
|
53
|
+
return this.getRaw("env");
|
|
54
|
+
}
|
|
55
|
+
set env(value) {
|
|
56
|
+
this.setRaw("env", value);
|
|
57
|
+
}
|
|
58
|
+
get mount() {
|
|
59
|
+
return this.get("mount");
|
|
60
|
+
}
|
|
61
|
+
set mount(value) {
|
|
62
|
+
this.setRaw("mount", value);
|
|
63
|
+
}
|
|
64
|
+
get componentsScan() {
|
|
65
|
+
return this.resolve(this.getRaw("componentsScan"));
|
|
66
|
+
}
|
|
67
|
+
set componentsScan(value) {
|
|
68
|
+
this.setRaw("componentsScan", value);
|
|
69
|
+
}
|
|
70
|
+
get statics() {
|
|
71
|
+
return this.getRaw("statics") || this.getRaw("serveStatic") || {};
|
|
72
|
+
}
|
|
73
|
+
set statics(value) {
|
|
74
|
+
this.setRaw("statics", value);
|
|
75
|
+
}
|
|
76
|
+
get acceptMimes() {
|
|
77
|
+
return this.getRaw("acceptMimes");
|
|
78
|
+
}
|
|
79
|
+
set acceptMimes(value) {
|
|
80
|
+
this.setRaw("acceptMimes", value || []);
|
|
81
|
+
}
|
|
82
|
+
get debug() {
|
|
83
|
+
return this.logger.level === "debug";
|
|
84
|
+
}
|
|
85
|
+
set debug(debug) {
|
|
86
|
+
this.logger = { ...this.logger, level: debug ? "debug" : "info" };
|
|
87
|
+
}
|
|
88
|
+
get converter() {
|
|
89
|
+
return this.get("converter") || {};
|
|
90
|
+
}
|
|
91
|
+
set converter(options) {
|
|
92
|
+
this.setRaw("converter", options);
|
|
93
|
+
}
|
|
94
|
+
get logger() {
|
|
95
|
+
return this.get("logger");
|
|
96
|
+
}
|
|
97
|
+
set logger(value) {
|
|
98
|
+
const logger = { ...this.logger, ...value };
|
|
99
|
+
logger.debug = logger.level === "debug";
|
|
100
|
+
this.setRaw("logger", logger);
|
|
101
|
+
this.setRaw("debug", logger.debug);
|
|
102
|
+
if (logger.format) {
|
|
103
|
+
logger_1.$log.appenders.set("stdout", {
|
|
104
|
+
type: "stdout",
|
|
105
|
+
levels: ["info", "debug"],
|
|
106
|
+
layout: {
|
|
107
|
+
type: "pattern",
|
|
108
|
+
pattern: logger.format
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
logger_1.$log.appenders.set("stderr", {
|
|
112
|
+
levels: ["trace", "fatal", "error", "warn"],
|
|
113
|
+
type: "stderr",
|
|
114
|
+
layout: {
|
|
115
|
+
type: "pattern",
|
|
116
|
+
pattern: logger.format
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
get exclude() {
|
|
122
|
+
return this.get("exclude");
|
|
123
|
+
}
|
|
124
|
+
set exclude(exclude) {
|
|
125
|
+
this.setRaw("exclude", exclude);
|
|
126
|
+
}
|
|
127
|
+
get additionalProperties() {
|
|
128
|
+
return this.get("converter.additionalProperties") === "accept";
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @returns {string|number}
|
|
133
|
+
*/
|
|
134
|
+
getHttpPort() {
|
|
135
|
+
return (0, core_1.getHostInfoFromPort)("http", this.getRaw("httpPort"));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
*
|
|
139
|
+
* @param settings
|
|
140
|
+
*/
|
|
141
|
+
setHttpPort(settings) {
|
|
142
|
+
this.setRaw("httpPort", `${settings.address}:${settings.port}`);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* @returns {string|number}
|
|
147
|
+
*/
|
|
148
|
+
getHttpsPort() {
|
|
149
|
+
return (0, core_1.getHostInfoFromPort)("https", this.getRaw("httpsPort"));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @param settings
|
|
154
|
+
*/
|
|
155
|
+
setHttpsPort(settings) {
|
|
156
|
+
this.setRaw("httpsPort", `${settings.address}:${settings.port}`);
|
|
157
|
+
}
|
|
158
|
+
getBestHost() {
|
|
159
|
+
const { httpsPort, httpPort } = this;
|
|
160
|
+
if (httpsPort) {
|
|
161
|
+
return this.getHttpsPort();
|
|
162
|
+
}
|
|
163
|
+
if (httpPort) {
|
|
164
|
+
return this.getHttpPort();
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
toString() {
|
|
168
|
+
return "/";
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
PlatformConfiguration = (0, tslib_1.__decorate)([
|
|
174
|
+
(0, di_1.Injectable)({
|
|
175
|
+
scope: di_1.ProviderScope.SINGLETON,
|
|
176
|
+
global: true
|
|
177
|
+
}),
|
|
178
|
+
(0, tslib_1.__metadata)("design:paramtypes", [])
|
|
179
|
+
], PlatformConfiguration);
|
|
180
|
+
exports.PlatformConfiguration = PlatformConfiguration;
|
|
181
|
+
//# sourceMappingURL=PlatformConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";;;;AAAA,qCAAoD;AACp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IAJjC,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA0MjC;AA1MY,sDAAqB","sourcesContent":["import {Env, getHostInfoFromPort} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope} from \"@tsed/di\";\nimport {$log} from \"@tsed/logger\";\nimport Https from \"https\";\nimport {EndpointDirectoriesSettings, PlatformLoggerSettings} from \"../interfaces\";\nimport {ConverterSettings} from \"../interfaces/ConverterSettings\";\n\nconst rootDir = process.cwd();\n\n/**\n * `PlatformConfiguration` contains all information about your Server configuration.\n */\n@Injectable({\n scope: ProviderScope.SINGLETON,\n global: true\n})\nexport class PlatformConfiguration extends DIConfiguration {\n constructor() {\n super({rootDir});\n }\n\n get version() {\n return this.getRaw(\"version\");\n }\n\n set version(v: string) {\n this.setRaw(\"version\", v);\n }\n\n get rootDir() {\n return this.getRaw(\"rootDir\");\n }\n\n set rootDir(value: string) {\n this.setRaw(\"rootDir\", value);\n }\n\n get port(): string | number | false {\n return this.httpPort;\n }\n\n set port(value: string | number | false) {\n this.httpPort = value;\n }\n\n get httpsOptions(): Https.ServerOptions {\n return this.getRaw(\"httpsOptions\");\n }\n\n set httpsOptions(value: Https.ServerOptions) {\n this.setRaw(\"httpsOptions\", value);\n }\n\n get httpPort(): string | number | false {\n return this.getRaw(\"httpPort\");\n }\n\n set httpPort(value: string | number | false) {\n this.setRaw(\"httpPort\", value);\n }\n\n get httpsPort(): string | number | false {\n return this.getRaw(\"httpsPort\");\n }\n\n set httpsPort(value: string | number | false) {\n this.setRaw(\"httpsPort\", value);\n }\n\n get env(): Env {\n return this.getRaw(\"env\");\n }\n\n set env(value: Env) {\n this.setRaw(\"env\", value);\n }\n\n get mount(): EndpointDirectoriesSettings {\n return this.get(\"mount\");\n }\n\n set mount(value: EndpointDirectoriesSettings) {\n this.setRaw(\"mount\", value);\n }\n\n get componentsScan(): string[] {\n return this.resolve(this.getRaw(\"componentsScan\"));\n }\n\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", value);\n }\n\n get statics(): EndpointDirectoriesSettings {\n return this.getRaw(\"statics\") || this.getRaw(\"serveStatic\") || {};\n }\n\n set statics(value: EndpointDirectoriesSettings) {\n this.setRaw(\"statics\", value);\n }\n\n get acceptMimes(): string[] {\n return this.getRaw(\"acceptMimes\");\n }\n\n set acceptMimes(value: string[]) {\n this.setRaw(\"acceptMimes\", value || []);\n }\n\n get debug(): boolean {\n return this.logger.level === \"debug\";\n }\n\n set debug(debug: boolean) {\n this.logger = {...this.logger, level: debug ? \"debug\" : \"info\"};\n }\n\n get converter(): Partial<ConverterSettings> {\n return this.get(\"converter\") || {};\n }\n\n set converter(options: Partial<ConverterSettings>) {\n this.setRaw(\"converter\", options);\n }\n\n get logger(): Partial<PlatformLoggerSettings> {\n return this.get(\"logger\");\n }\n\n set logger(value: Partial<PlatformLoggerSettings>) {\n const logger = {...this.logger, ...value};\n logger.debug = logger.level === \"debug\";\n\n this.setRaw(\"logger\", logger);\n this.setRaw(\"debug\", logger.debug);\n\n if (logger.format) {\n $log.appenders.set(\"stdout\", {\n type: \"stdout\",\n levels: [\"info\", \"debug\"],\n layout: {\n type: \"pattern\",\n pattern: logger.format\n }\n });\n\n $log.appenders.set(\"stderr\", {\n levels: [\"trace\", \"fatal\", \"error\", \"warn\"],\n type: \"stderr\",\n layout: {\n type: \"pattern\",\n pattern: logger.format\n }\n });\n }\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\n }\n\n get additionalProperties() {\n return this.get(\"converter.additionalProperties\") === \"accept\";\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpPort(): ReturnType<typeof getHostInfoFromPort> {\n return getHostInfoFromPort(\"http\", this.getRaw(\"httpPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpPort\", `${settings.address}:${settings.port}`);\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpsPort() {\n return getHostInfoFromPort(\"https\", this.getRaw(\"httpsPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpsPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpsPort\", `${settings.address}:${settings.port}`);\n }\n\n getBestHost() {\n const {httpsPort, httpPort} = this;\n\n if (httpsPort) {\n return this.getHttpsPort();\n }\n\n if (httpPort) {\n return this.getHttpPort();\n }\n\n return {\n toString() {\n return \"/\";\n }\n };\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerOptions.js","sourceRoot":"","sources":["../../../src/constants/routerOptions.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["export const ROUTER_OPTIONS = Symbol.for(\"ROUTER_OPTIONS\");\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpServer = void 0;
|
|
4
|
+
const di_1 = require("@tsed/di");
|
|
5
|
+
/**
|
|
6
|
+
* Inject the Http.Server instance.
|
|
7
|
+
*
|
|
8
|
+
* ### Example
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {HttpServer, Service} from "@tsed/common";
|
|
12
|
+
*
|
|
13
|
+
* @Service()
|
|
14
|
+
* export default class OtherService {
|
|
15
|
+
* constructor(@HttpServer httpServer: HttpServer) {}
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
20
|
+
*
|
|
21
|
+
* @param {Type<any>} target
|
|
22
|
+
* @param {string} targetKey
|
|
23
|
+
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
24
|
+
* @returns {any}
|
|
25
|
+
* @decorator
|
|
26
|
+
* @deprecated Use Https.Server from "http"
|
|
27
|
+
*/
|
|
28
|
+
function HttpServer(target, targetKey, descriptor) {
|
|
29
|
+
return (0, di_1.Inject)(HttpServer)(target, targetKey, descriptor);
|
|
30
|
+
}
|
|
31
|
+
exports.HttpServer = HttpServer;
|
|
32
|
+
//# sourceMappingURL=httpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpServer.js","sourceRoot":"","sources":["../../../src/decorators/httpServer.ts"],"names":[],"mappings":";;;AACA,iCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,UAAU,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACrH,OAAO,IAAA,WAAM,EAAC,UAAU,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAFD,gCAEC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport Http from \"http\";\n\n/**\n * Inject the Http.Server instance.\n *\n * ### Example\n *\n * ```typescript\n * import {HttpServer, Service} from \"@tsed/common\";\n *\n * @Service()\n * export default class OtherService {\n * constructor(@HttpServer httpServer: HttpServer) {}\n * }\n * ```\n *\n * > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.\n *\n * @param {Type<any>} target\n * @param {string} targetKey\n * @param {TypedPropertyDescriptor<Function> | number} descriptor\n * @returns {any}\n * @decorator\n * @deprecated Use Https.Server from \"http\"\n */\nexport function HttpServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number) {\n return Inject(HttpServer)(target, targetKey, descriptor);\n}\n\nexport type HttpServer = Http.Server;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpsServer = void 0;
|
|
4
|
+
const di_1 = require("@tsed/di");
|
|
5
|
+
/**
|
|
6
|
+
* Inject the Https.Server instance.
|
|
7
|
+
*
|
|
8
|
+
* ### Example
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import {HttpsServer, Service} from "@tsed/common";
|
|
12
|
+
*
|
|
13
|
+
* @Service()
|
|
14
|
+
* export default class OtherService {
|
|
15
|
+
* constructor(@HttpsServer httpServer: HttpServer) {}
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
20
|
+
*
|
|
21
|
+
* @param {Type<any>} target
|
|
22
|
+
* @param {string} targetKey
|
|
23
|
+
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
24
|
+
* @returns {any}
|
|
25
|
+
* @decorator
|
|
26
|
+
* @deprecated Use Https.Server from "https"
|
|
27
|
+
*/
|
|
28
|
+
function HttpsServer(target, targetKey, descriptor) {
|
|
29
|
+
return (0, di_1.Inject)(HttpsServer)(target, targetKey, descriptor);
|
|
30
|
+
}
|
|
31
|
+
exports.HttpsServer = HttpsServer;
|
|
32
|
+
//# sourceMappingURL=httpsServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpsServer.js","sourceRoot":"","sources":["../../../src/decorators/httpsServer.ts"],"names":[],"mappings":";;;AACA,iCAAgC;AAGhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,WAAW,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACtH,OAAO,IAAA,WAAM,EAAC,WAAW,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC;AAFD,kCAEC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport Https from \"https\";\n\n/**\n * Inject the Https.Server instance.\n *\n * ### Example\n *\n * ```typescript\n * import {HttpsServer, Service} from \"@tsed/common\";\n *\n * @Service()\n * export default class OtherService {\n * constructor(@HttpsServer httpServer: HttpServer) {}\n * }\n * ```\n *\n * > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.\n *\n * @param {Type<any>} target\n * @param {string} targetKey\n * @param {TypedPropertyDescriptor<Function> | number} descriptor\n * @returns {any}\n * @decorator\n * @deprecated Use Https.Server from \"https\"\n */\nexport function HttpsServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number) {\n return Inject(HttpsServer)(target, targetKey, descriptor);\n}\n\nexport type HttpsServer = Https.Server;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./httpServer"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./httpsServer"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./multer"), exports);
|
|
7
|
+
// Method
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./method/route"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./method/acceptMime"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./method/location"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./method/redirect"), exports);
|
|
12
|
+
(0, tslib_1.__exportStar)(require("./method/endpointFn"), exports);
|
|
13
|
+
(0, tslib_1.__exportStar)(require("./method/view"), exports);
|
|
14
|
+
// Params
|
|
15
|
+
(0, tslib_1.__exportStar)(require("./params/response"), exports);
|
|
16
|
+
(0, tslib_1.__exportStar)(require("./params/request"), exports);
|
|
17
|
+
(0, tslib_1.__exportStar)(require("./params/next"), exports);
|
|
18
|
+
(0, tslib_1.__exportStar)(require("./params/error"), exports);
|
|
19
|
+
// utils
|
|
20
|
+
(0, tslib_1.__exportStar)(require("../utils/mapReturnedResponse"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B;AAC7B,6DAA8B;AAE9B,wDAAyB;AAEzB,SAAS;AACT,8DAA+B;AAC/B,mEAAoC;AACpC,iEAAkC;AAClC,iEAAkC;AAClC,mEAAoC;AACpC,6DAA8B;AAE9B,SAAS;AACT,iEAAkC;AAClC,gEAAiC;AACjC,6DAA8B;AAC9B,8DAA+B;AAE/B,QAAQ;AACR,4EAA6C","sourcesContent":["export * from \"./httpServer\";\nexport * from \"./httpsServer\";\n\nexport * from \"./multer\";\n\n// Method\nexport * from \"./method/route\";\nexport * from \"./method/acceptMime\";\nexport * from \"./method/location\";\nexport * from \"./method/redirect\";\nexport * from \"./method/endpointFn\";\nexport * from \"./method/view\";\n\n// Params\nexport * from \"./params/response\";\nexport * from \"./params/request\";\nexport * from \"./params/next\";\nexport * from \"./params/error\";\n\n// utils\nexport * from \"../utils/mapReturnedResponse\";\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AcceptMime = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const schema_1 = require("@tsed/schema");
|
|
6
|
+
/**
|
|
7
|
+
* Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* @Controller('/mypath')
|
|
11
|
+
* export class MyCtrl {
|
|
12
|
+
*
|
|
13
|
+
* @Get('/')
|
|
14
|
+
* @AcceptMime('application/json')
|
|
15
|
+
* public getResource(){}
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param mimes
|
|
20
|
+
* @decorator
|
|
21
|
+
* @operation
|
|
22
|
+
* @response
|
|
23
|
+
*/
|
|
24
|
+
function AcceptMime(...mimes) {
|
|
25
|
+
return (0, core_1.useDecorators)((0, schema_1.Produces)(...mimes), (0, core_1.StoreSet)("acceptMimes", mimes));
|
|
26
|
+
}
|
|
27
|
+
exports.AcceptMime = AcceptMime;
|
|
28
|
+
//# sourceMappingURL=acceptMime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptMime.js","sourceRoot":"","sources":["../../../../src/decorators/method/acceptMime.ts"],"names":[],"mappings":";;;AAAA,qCAAmD;AACnD,yCAAsC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,IAAA,oBAAa,EAAC,IAAA,iBAAQ,EAAC,GAAG,KAAK,CAAC,EAAE,IAAA,eAAQ,EAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,gCAEC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Produces} from \"@tsed/schema\";\n\n/**\n * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.\n *\n * ```typescript\n * @Controller('/mypath')\n * export class MyCtrl {\n *\n * @Get('/')\n * @AcceptMime('application/json')\n * public getResource(){}\n * }\n * ```\n *\n * @param mimes\n * @decorator\n * @operation\n * @response\n */\nexport function AcceptMime(...mimes: string[]): Function {\n return useDecorators(Produces(...mimes), StoreSet(\"acceptMimes\", mimes));\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EndpointFn = void 0;
|
|
4
|
+
const schema_1 = require("@tsed/schema");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param fn
|
|
8
|
+
* @decorator
|
|
9
|
+
* @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.
|
|
10
|
+
*/
|
|
11
|
+
function EndpointFn(fn) {
|
|
12
|
+
return (0, schema_1.JsonEntityFn)(fn);
|
|
13
|
+
}
|
|
14
|
+
exports.EndpointFn = EndpointFn;
|
|
15
|
+
//# sourceMappingURL=endpointFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpointFn.js","sourceRoot":"","sources":["../../../../src/decorators/method/endpointFn.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAG1C;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,EAAyE;IAClG,OAAO,IAAA,qBAAY,EAAmB,EAAE,CAAQ,CAAC;AACnD,CAAC;AAFD,gCAEC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\nimport {EndpointMetadata} from \"../../domain\";\n\n/**\n *\n * @param fn\n * @decorator\n * @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.\n */\nexport function EndpointFn(fn: (endpoint: EndpointMetadata, parameters: DecoratorParameters) => void): MethodDecorator {\n return JsonEntityFn<EndpointMetadata>(fn) as any;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Location = void 0;
|
|
4
|
+
var schema_1 = require("@tsed/schema");
|
|
5
|
+
Object.defineProperty(exports, "Location", { enumerable: true, get: function () { return schema_1.Location; } });
|
|
6
|
+
//# sourceMappingURL=location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../../src/decorators/method/location.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA9B,kGAAA,QAAQ,OAAA","sourcesContent":["export {Location} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Redirect = void 0;
|
|
4
|
+
var schema_1 = require("@tsed/schema");
|
|
5
|
+
Object.defineProperty(exports, "Redirect", { enumerable: true, get: function () { return schema_1.Redirect; } });
|
|
6
|
+
//# sourceMappingURL=redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/method/redirect.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAA9B,kGAAA,QAAQ,OAAA","sourcesContent":["export {Redirect} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.All = exports.Options = exports.Head = exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
|
|
4
|
+
var schema_1 = require("@tsed/schema");
|
|
5
|
+
Object.defineProperty(exports, "Get", { enumerable: true, get: function () { return schema_1.Get; } });
|
|
6
|
+
Object.defineProperty(exports, "Post", { enumerable: true, get: function () { return schema_1.Post; } });
|
|
7
|
+
Object.defineProperty(exports, "Put", { enumerable: true, get: function () { return schema_1.Put; } });
|
|
8
|
+
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return schema_1.Patch; } });
|
|
9
|
+
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return schema_1.Delete; } });
|
|
10
|
+
Object.defineProperty(exports, "Head", { enumerable: true, get: function () { return schema_1.Head; } });
|
|
11
|
+
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return schema_1.Options; } });
|
|
12
|
+
Object.defineProperty(exports, "All", { enumerable: true, get: function () { return schema_1.All; } });
|
|
13
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/decorators/method/route.ts"],"names":[],"mappings":";;;AAAA,uCAA+E;AAAvE,6FAAA,GAAG,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,6FAAA,GAAG,OAAA;AAAE,+FAAA,KAAK,OAAA;AAAE,gGAAA,MAAM,OAAA;AAAE,8FAAA,IAAI,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,6FAAA,GAAG,OAAA","sourcesContent":["export {Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.View = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
/**
|
|
6
|
+
* Use a view and sends the rendered HTML string to the client. Optional parameter:
|
|
7
|
+
*
|
|
8
|
+
* * viewOptions, an object whose properties define local variables for the view.
|
|
9
|
+
*
|
|
10
|
+
* The view argument is a string that is the file path of the view file to render.
|
|
11
|
+
* This can be an absolute path, or a path relative to the views setting.
|
|
12
|
+
* If the path does not contain a file extension, then the view engine setting determines the file extension.
|
|
13
|
+
* If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
|
|
14
|
+
* and render it using the loaded module’s __express function.
|
|
15
|
+
*
|
|
16
|
+
* For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
|
|
17
|
+
*
|
|
18
|
+
* > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
|
|
19
|
+
* and as so for security reasons should not contain input from the end-user.
|
|
20
|
+
*
|
|
21
|
+
* @param path Relative path to the view file.
|
|
22
|
+
* @param options Additional options
|
|
23
|
+
* @decorator
|
|
24
|
+
* @operation
|
|
25
|
+
* @response
|
|
26
|
+
* @ignores
|
|
27
|
+
* @deprecated Use View decorator from @tsed/platform-views instead.
|
|
28
|
+
*/
|
|
29
|
+
// istanbul ignore next
|
|
30
|
+
function View(path, options) {
|
|
31
|
+
return (0, core_1.StoreSet)("view", { path, options });
|
|
32
|
+
}
|
|
33
|
+
exports.View = View;
|
|
34
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/decorators/method/view.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uBAAuB;AACvB,SAAgB,IAAI,CAAC,IAAY,EAAE,OAAgB;IACjD,OAAO,IAAA,eAAQ,EAAC,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAQ,CAAC;AAClD,CAAC;AAFD,oBAEC","sourcesContent":["import {StoreSet} from \"@tsed/core\";\n\n/**\n * Use a view and sends the rendered HTML string to the client. Optional parameter:\n *\n * * viewOptions, an object whose properties define local variables for the view.\n *\n * The view argument is a string that is the file path of the view file to render.\n * This can be an absolute path, or a path relative to the views setting.\n * If the path does not contain a file extension, then the view engine setting determines the file extension.\n * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())\n * and render it using the loaded module’s __express function.\n *\n * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).\n *\n * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,\n * and as so for security reasons should not contain input from the end-user.\n *\n * @param path Relative path to the view file.\n * @param options Additional options\n * @decorator\n * @operation\n * @response\n * @ignores\n * @deprecated Use View decorator from @tsed/platform-views instead.\n */\n// istanbul ignore next\nexport function View(path: string, options?: Object): MethodDecorator {\n return StoreSet(\"view\", {path, options}) as any;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./multerFileSize"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./multerOptions"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./multipartFile"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/multer/index.ts"],"names":[],"mappings":";;;AAAA,gEAAiC;AACjC,+DAAgC;AAChC,+DAAgC","sourcesContent":["export * from \"./multerFileSize\";\nexport * from \"./multerOptions\";\nexport * from \"./multipartFile\";\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MulterFileSize = void 0;
|
|
4
|
+
const multerOptions_1 = require("./multerOptions");
|
|
5
|
+
/**
|
|
6
|
+
* Define file size limit.
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {Controller, Post} from "@tsed/common";
|
|
10
|
+
* import {MulterOptions, MultipartFile} from "@tsed/common";
|
|
11
|
+
* import {Multer} from "@types/multer";
|
|
12
|
+
*
|
|
13
|
+
* type MulterFile = Express.Multer.File;
|
|
14
|
+
*
|
|
15
|
+
* @Controller('/')
|
|
16
|
+
* class MyCtrl {
|
|
17
|
+
* @Post('/file2')
|
|
18
|
+
* @MulterFileSize(1024) // (Ko). Applied for all fields
|
|
19
|
+
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
20
|
+
*
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
26
|
+
* @param fileSize
|
|
27
|
+
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
28
|
+
* @decorator
|
|
29
|
+
* @multer
|
|
30
|
+
*/
|
|
31
|
+
function MulterFileSize(fileSize) {
|
|
32
|
+
return (0, multerOptions_1.MulterOptions)({ limits: { fileSize } });
|
|
33
|
+
}
|
|
34
|
+
exports.MulterFileSize = MulterFileSize;
|
|
35
|
+
//# sourceMappingURL=multerFileSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multerFileSize.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerFileSize.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,cAAc,CAAC,QAAgB;IAC7C,OAAO,IAAA,6BAAa,EAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,wCAEC","sourcesContent":["import {MulterOptions} from \"./multerOptions\";\n\n/**\n * Define file size limit.\n *\n * ```typescript\n * import {Controller, Post} from \"@tsed/common\";\n * import {MulterOptions, MultipartFile} from \"@tsed/common\";\n * import {Multer} from \"@types/multer\";\n *\n * type MulterFile = Express.Multer.File;\n *\n * @Controller('/')\n * class MyCtrl {\n * @Post('/file2')\n * @MulterFileSize(1024) // (Ko). Applied for all fields\n * private uploadFile(@MultipartFile(\"file1\") file: MulterFile, @MultipartFile(\"file2\") file2: MulterFile) {\n *\n * }\n * }\n * ```\n *\n * > See the tutorial on the [multer configuration](/tutorials/multer.md).\n * @param fileSize\n * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}\n * @decorator\n * @multer\n */\nexport function MulterFileSize(fileSize: number): MethodDecorator {\n return MulterOptions({limits: {fileSize}});\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MulterOptions = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const PlatformMulterMiddleware_1 = require("../../middlewares/PlatformMulterMiddleware");
|
|
6
|
+
/**
|
|
7
|
+
* Define multer option for all MultipartFile
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
|
|
11
|
+
*
|
|
12
|
+
* @Controller('/')
|
|
13
|
+
* class MyCtrl {
|
|
14
|
+
* @Post('/file')
|
|
15
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
16
|
+
*
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* @Post('/file')
|
|
20
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
21
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
22
|
+
*
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @Post('/file2')
|
|
26
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
27
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
|
|
28
|
+
*
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* @Post('/files')
|
|
32
|
+
* private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
|
|
33
|
+
*
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
39
|
+
*
|
|
40
|
+
* @param {multer.Options} options
|
|
41
|
+
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
42
|
+
* @decorator
|
|
43
|
+
* @multer
|
|
44
|
+
*/
|
|
45
|
+
function MulterOptions(options) {
|
|
46
|
+
return (target, propertyKey, descriptor) => {
|
|
47
|
+
(0, core_1.StoreMerge)(PlatformMulterMiddleware_1.PlatformMulterMiddleware, { options })(target, propertyKey, descriptor);
|
|
48
|
+
return descriptor;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.MulterOptions = MulterOptions;
|
|
52
|
+
//# sourceMappingURL=multerOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multerOptions.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAsC;AAEtC,yFAAoF;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,aAAa,CAAC,OAA+B;IAC3D,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,IAAA,iBAAU,EAAC,mDAAwB,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEjF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAND,sCAMC","sourcesContent":["import {StoreMerge} from \"@tsed/core\";\nimport {PlatformMulterSettings} from \"../../config/interfaces/PlatformMulterSettings\";\nimport {PlatformMulterMiddleware} from \"../../middlewares/PlatformMulterMiddleware\";\n\n/**\n * Define multer option for all MultipartFile\n *\n * ```typescript\n * import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from \"@tsed/common\";\n *\n * @Controller('/')\n * class MyCtrl {\n * @Post('/file')\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/file')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/file2')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile, @MultipartFile(\"file2\") file2: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/files')\n * private uploadFile(@MultipartFile(\"file1\") files: PlatformMulterFile[]) {\n *\n * }\n * }\n * ```\n *\n * See the tutorial on the [multer configuration](/tutorials/multer.md).\n *\n * @param {multer.Options} options\n * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}\n * @decorator\n * @multer\n */\nexport function MulterOptions(options: PlatformMulterSettings): MethodDecorator {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n StoreMerge(PlatformMulterMiddleware, {options})(target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultipartFile = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const platform_params_1 = require("@tsed/platform-params");
|
|
6
|
+
const schema_1 = require("@tsed/schema");
|
|
7
|
+
const PlatformMulterMiddleware_1 = require("../../middlewares/PlatformMulterMiddleware");
|
|
8
|
+
function mapOptions(name, maxCount) {
|
|
9
|
+
return {
|
|
10
|
+
fields: [
|
|
11
|
+
{
|
|
12
|
+
name,
|
|
13
|
+
maxCount
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Define a parameter as Multipart file.
|
|
20
|
+
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import {Controller, Post} from "@tsed/common";
|
|
23
|
+
* import {MulterOptions, MultipartFile} from "@tsed/common";
|
|
24
|
+
* import {Multer} from "@types/multer";
|
|
25
|
+
*
|
|
26
|
+
* type MulterFile = Express.Multer.File;
|
|
27
|
+
*
|
|
28
|
+
* @Controller('/')
|
|
29
|
+
* class MyCtrl {
|
|
30
|
+
* @Post('/file')
|
|
31
|
+
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
32
|
+
*
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* @Post('/file')
|
|
36
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
37
|
+
* private uploadFile(@MultipartFile("file1") file: MulterFile) {
|
|
38
|
+
*
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* @Post('/file2')
|
|
42
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
43
|
+
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
44
|
+
*
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* @Post('/files')
|
|
48
|
+
* private uploadFile(@MultipartFile("file1") files: MulterFile[]) {
|
|
49
|
+
*
|
|
50
|
+
* }
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
55
|
+
*
|
|
56
|
+
* @param name
|
|
57
|
+
* @param maxCount
|
|
58
|
+
* @returns Function
|
|
59
|
+
* @decorator
|
|
60
|
+
* @input
|
|
61
|
+
*/
|
|
62
|
+
function MultipartFile(name, maxCount) {
|
|
63
|
+
return (...args) => {
|
|
64
|
+
const [target, propertyKey, index] = args;
|
|
65
|
+
const multiple = core_1.Metadata.getParamTypes(target, propertyKey)[index] === Array;
|
|
66
|
+
name = (typeof name === "object" ? undefined : name);
|
|
67
|
+
const expression = [name, !multiple && "0"].filter(Boolean).join(".");
|
|
68
|
+
const decorators = (0, core_1.useDecorators)((0, schema_1.InFile)(name), (0, core_1.useMethodDecorators)((0, core_1.StoreMerge)(PlatformMulterMiddleware_1.PlatformMulterMiddleware, mapOptions(name, maxCount))), (0, platform_params_1.UseParam)({
|
|
69
|
+
paramType: platform_params_1.ParamTypes.FILES,
|
|
70
|
+
dataPath: "$ctx.request.files",
|
|
71
|
+
expression,
|
|
72
|
+
useValidation: true
|
|
73
|
+
}));
|
|
74
|
+
decorators(...args);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
exports.MultipartFile = MultipartFile;
|
|
78
|
+
//# sourceMappingURL=multipartFile.js.map
|