@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,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _PlatformBuilder_injector, _PlatformBuilder_rootModule, _PlatformBuilder_promise, _PlatformBuilder_adapter, _PlatformBuilder_servers;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PlatformBuilder = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const core_1 = require("@tsed/core");
|
|
7
|
+
const di_1 = require("@tsed/di");
|
|
8
|
+
const components_scan_1 = require("@tsed/components-scan");
|
|
9
|
+
const platform_middlewares_1 = require("@tsed/platform-middlewares");
|
|
10
|
+
const Platform_1 = require("../services/Platform");
|
|
11
|
+
const PlatformApplication_1 = require("../services/PlatformApplication");
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const getStaticsOptions_1 = require("../utils/getStaticsOptions");
|
|
14
|
+
const getConfiguration_1 = require("../utils/getConfiguration");
|
|
15
|
+
/**
|
|
16
|
+
* @platform
|
|
17
|
+
*/
|
|
18
|
+
class PlatformBuilder {
|
|
19
|
+
constructor(adapter, module, settings) {
|
|
20
|
+
this.name = "";
|
|
21
|
+
this.startedAt = new Date();
|
|
22
|
+
this.current = new Date();
|
|
23
|
+
_PlatformBuilder_injector.set(this, void 0);
|
|
24
|
+
_PlatformBuilder_rootModule.set(this, void 0);
|
|
25
|
+
_PlatformBuilder_promise.set(this, void 0);
|
|
26
|
+
_PlatformBuilder_adapter.set(this, void 0);
|
|
27
|
+
_PlatformBuilder_servers.set(this, void 0);
|
|
28
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_rootModule, module, "f");
|
|
29
|
+
const adapterKlass = adapter || PlatformBuilder.adapter;
|
|
30
|
+
const name = (0, core_1.nameOf)(adapterKlass).replace("Platform", "").toLowerCase();
|
|
31
|
+
const configuration = (0, getConfiguration_1.getConfiguration)(settings, module);
|
|
32
|
+
configuration.PLATFORM_NAME = name;
|
|
33
|
+
this.name = name;
|
|
34
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_adapter, new adapterKlass(this), "f");
|
|
35
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_injector, (0, utils_1.createInjector)({
|
|
36
|
+
settings: configuration,
|
|
37
|
+
providers: (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").providers
|
|
38
|
+
}), "f");
|
|
39
|
+
this.createHttpServers();
|
|
40
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").onInit && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").onInit();
|
|
41
|
+
this.log("Injector created...");
|
|
42
|
+
}
|
|
43
|
+
get injector() {
|
|
44
|
+
return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f");
|
|
45
|
+
}
|
|
46
|
+
get rootModule() {
|
|
47
|
+
return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f").get((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_rootModule, "f"));
|
|
48
|
+
}
|
|
49
|
+
get app() {
|
|
50
|
+
return this.injector.get(PlatformApplication_1.PlatformApplication);
|
|
51
|
+
}
|
|
52
|
+
get platform() {
|
|
53
|
+
return this.injector.get(Platform_1.Platform);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Return the settings configured by the decorator @@Configuration@@.
|
|
57
|
+
*
|
|
58
|
+
* ```typescript
|
|
59
|
+
* @Configuration({
|
|
60
|
+
* rootDir: Path.resolve(__dirname),
|
|
61
|
+
* port: 8000,
|
|
62
|
+
* httpsPort: 8080,
|
|
63
|
+
* mount: {
|
|
64
|
+
* "/rest": "${rootDir}/controllers/**\/*.js"
|
|
65
|
+
* }
|
|
66
|
+
* })
|
|
67
|
+
* export class Server {
|
|
68
|
+
* $onInit(){
|
|
69
|
+
* console.log(this.settings); // {rootDir, port, httpsPort,...}
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @returns {PlatformConfiguration}
|
|
75
|
+
*/
|
|
76
|
+
get settings() {
|
|
77
|
+
return this.injector.settings;
|
|
78
|
+
}
|
|
79
|
+
get logger() {
|
|
80
|
+
return this.injector.logger;
|
|
81
|
+
}
|
|
82
|
+
get disableBootstrapLog() {
|
|
83
|
+
var _a;
|
|
84
|
+
return (_a = this.settings.logger) === null || _a === void 0 ? void 0 : _a.disableBootstrapLog;
|
|
85
|
+
}
|
|
86
|
+
static create(module, settings) {
|
|
87
|
+
return this.build(module, {
|
|
88
|
+
httpsPort: false,
|
|
89
|
+
httpPort: false,
|
|
90
|
+
...settings,
|
|
91
|
+
disableComponentsScan: true
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
static build(module, { adapter, ...settings }) {
|
|
95
|
+
return new PlatformBuilder(adapter, module, settings);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Bootstrap a server application
|
|
99
|
+
* @param module
|
|
100
|
+
* @param settings
|
|
101
|
+
*/
|
|
102
|
+
static async bootstrap(module, settings) {
|
|
103
|
+
return this.build(module, settings).bootstrap();
|
|
104
|
+
}
|
|
105
|
+
callback(req, res) {
|
|
106
|
+
if (req && res) {
|
|
107
|
+
return this.app.callback()(req, res);
|
|
108
|
+
}
|
|
109
|
+
return this.app.callback();
|
|
110
|
+
}
|
|
111
|
+
log(...data) {
|
|
112
|
+
return !this.disableBootstrapLog && this.logger.info(...data, this.diff());
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add classes to the components list
|
|
116
|
+
* @param classes
|
|
117
|
+
*/
|
|
118
|
+
addComponents(classes) {
|
|
119
|
+
this.settings.componentsScan = this.settings.componentsScan.concat(classes);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Add classes decorated by @@Controller@@ to components container.
|
|
124
|
+
*
|
|
125
|
+
* ### Example
|
|
126
|
+
*
|
|
127
|
+
* ```typescript
|
|
128
|
+
* @Controller('/ctrl')
|
|
129
|
+
* class MyController{
|
|
130
|
+
* }
|
|
131
|
+
*
|
|
132
|
+
* platform.addControllers('/rest', [MyController])
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* ::: tip
|
|
136
|
+
* If the MyController class isn't decorated, the class will be ignored.
|
|
137
|
+
* :::
|
|
138
|
+
*
|
|
139
|
+
* @param {string} endpoint
|
|
140
|
+
* @param {any[]} controllers
|
|
141
|
+
*/
|
|
142
|
+
addControllers(endpoint, controllers) {
|
|
143
|
+
this.settings.mount[endpoint] = (this.settings.mount[endpoint] || []).concat(controllers);
|
|
144
|
+
}
|
|
145
|
+
async runLifecycle() {
|
|
146
|
+
(0, di_1.setLoggerLevel)(this.injector);
|
|
147
|
+
await this.importProviders();
|
|
148
|
+
await this.loadInjector();
|
|
149
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useContext && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useContext();
|
|
150
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useRouter && (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").useRouter();
|
|
151
|
+
await this.loadRoutes();
|
|
152
|
+
await this.logRoutes();
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
async loadInjector() {
|
|
156
|
+
const { injector } = this;
|
|
157
|
+
this.log("Build providers");
|
|
158
|
+
const container = (0, di_1.createContainer)();
|
|
159
|
+
container.addProvider((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_rootModule, "f"), {
|
|
160
|
+
type: "server:module",
|
|
161
|
+
scope: di_1.ProviderScope.SINGLETON
|
|
162
|
+
});
|
|
163
|
+
await injector.load(container);
|
|
164
|
+
this.log("Settings and injector loaded...");
|
|
165
|
+
await this.callHook("$afterInit");
|
|
166
|
+
}
|
|
167
|
+
async listen(network = true) {
|
|
168
|
+
if (!(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f")) {
|
|
169
|
+
await this.bootstrap();
|
|
170
|
+
}
|
|
171
|
+
await this.callHook("$beforeListen");
|
|
172
|
+
if (network) {
|
|
173
|
+
await this.listenServers();
|
|
174
|
+
}
|
|
175
|
+
await this.callHook("$afterListen");
|
|
176
|
+
await this.ready();
|
|
177
|
+
}
|
|
178
|
+
async stop() {
|
|
179
|
+
await this.callHook("$onDestroy");
|
|
180
|
+
return this.injector.destroy();
|
|
181
|
+
}
|
|
182
|
+
async ready() {
|
|
183
|
+
const { startedAt } = this;
|
|
184
|
+
await this.callHook("$onReady");
|
|
185
|
+
await this.injector.emit("$onServerReady");
|
|
186
|
+
this.log(`Started in ${new Date().getTime() - startedAt.getTime()} ms`);
|
|
187
|
+
}
|
|
188
|
+
async callHook(hook, ...args) {
|
|
189
|
+
const { injector } = this;
|
|
190
|
+
if (!this.disableBootstrapLog) {
|
|
191
|
+
injector.logger.debug(`\x1B[1mCall hook ${hook}\x1B[22m`);
|
|
192
|
+
}
|
|
193
|
+
// Load middlewares for the given hook
|
|
194
|
+
this.loadMiddlewaresFor(hook);
|
|
195
|
+
// call hooks added by providers
|
|
196
|
+
await injector.emit(hook, ...args);
|
|
197
|
+
}
|
|
198
|
+
async loadStatics(hook) {
|
|
199
|
+
const statics = this.settings.get("statics");
|
|
200
|
+
(0, getStaticsOptions_1.getStaticsOptions)(statics).forEach(({ path, options }) => {
|
|
201
|
+
if (options.hook === hook) {
|
|
202
|
+
this.platform.app.statics(path, options);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
useProvider(token, settings) {
|
|
207
|
+
this.injector.addProvider(token, settings);
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
async bootstrap() {
|
|
211
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_promise, (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f") || this.runLifecycle(), "f");
|
|
212
|
+
return (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_promise, "f");
|
|
213
|
+
}
|
|
214
|
+
async loadRoutes() {
|
|
215
|
+
var _a;
|
|
216
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes && (await (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").beforeLoadRoutes());
|
|
217
|
+
// istanbul ignore next
|
|
218
|
+
if (((_a = this.settings.logger) === null || _a === void 0 ? void 0 : _a.level) !== "off") {
|
|
219
|
+
const { PlatformLogMiddleware } = await Promise.resolve().then(() => (0, tslib_1.__importStar)(require("@tsed/platform-log-middleware")));
|
|
220
|
+
this.app.use(PlatformLogMiddleware);
|
|
221
|
+
}
|
|
222
|
+
this.log("Load routes");
|
|
223
|
+
if (this.rootModule.$beforeRoutesInit) {
|
|
224
|
+
await this.rootModule.$beforeRoutesInit();
|
|
225
|
+
this.rootModule.$beforeRoutesInit = () => { };
|
|
226
|
+
}
|
|
227
|
+
await this.loadStatics("$beforeRoutesInit");
|
|
228
|
+
await this.callHook("$beforeRoutesInit");
|
|
229
|
+
const routes = this.injector.settings.get("routes");
|
|
230
|
+
this.platform.addRoutes(routes);
|
|
231
|
+
await this.callHook("$onRoutesInit");
|
|
232
|
+
await this.loadStatics("$afterRoutesInit");
|
|
233
|
+
await this.callHook("$afterRoutesInit");
|
|
234
|
+
(0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").afterLoadRoutes && (await (0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_adapter, "f").afterLoadRoutes());
|
|
235
|
+
}
|
|
236
|
+
diff() {
|
|
237
|
+
const ms = di_1.colors.yellow(`+${new Date().getTime() - this.current.getTime()}ms`);
|
|
238
|
+
this.current = new Date();
|
|
239
|
+
return ms;
|
|
240
|
+
}
|
|
241
|
+
async importProviders() {
|
|
242
|
+
this.injector.logger.debug("Scan components");
|
|
243
|
+
const providers = await (0, components_scan_1.importProviders)(this.injector.settings, ["imports", "mount", "componentsScan"]);
|
|
244
|
+
const routes = providers.filter((provider) => !!provider.route).map(({ route, token }) => ({ route, token }));
|
|
245
|
+
this.settings.set("routes", routes);
|
|
246
|
+
this.log("Providers loaded...");
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Load middlewares from configuration for the given hook
|
|
250
|
+
* @param hook
|
|
251
|
+
* @protected
|
|
252
|
+
*/
|
|
253
|
+
loadMiddlewaresFor(hook) {
|
|
254
|
+
return (0, platform_middlewares_1.getMiddlewaresForHook)(hook, this.settings, "$beforeRoutesInit").forEach(({ use }) => {
|
|
255
|
+
this.app.use(use);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
createHttpServers() {
|
|
259
|
+
(0, tslib_1.__classPrivateFieldSet)(this, _PlatformBuilder_servers, [(0, utils_1.createHttpServer)((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f"), this.callback()), (0, utils_1.createHttpsServer)((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_injector, "f"), this.callback())].filter(Boolean), "f");
|
|
260
|
+
}
|
|
261
|
+
async listenServers() {
|
|
262
|
+
await Promise.all((0, tslib_1.__classPrivateFieldGet)(this, _PlatformBuilder_servers, "f").map((cb) => cb && cb()));
|
|
263
|
+
}
|
|
264
|
+
async logRoutes() {
|
|
265
|
+
var _a;
|
|
266
|
+
const { logger, platform } = this;
|
|
267
|
+
this.log("Routes mounted...");
|
|
268
|
+
if (!((_a = this.settings.logger) === null || _a === void 0 ? void 0 : _a.disableRoutesSummary) && !this.disableBootstrapLog) {
|
|
269
|
+
logger.info((0, utils_1.printRoutes)(await this.injector.alterAsync("$logRoutes", platform.getRoutes())));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.PlatformBuilder = PlatformBuilder;
|
|
274
|
+
_PlatformBuilder_injector = new WeakMap(), _PlatformBuilder_rootModule = new WeakMap(), _PlatformBuilder_promise = new WeakMap(), _PlatformBuilder_adapter = new WeakMap(), _PlatformBuilder_servers = new WeakMap();
|
|
275
|
+
//# sourceMappingURL=PlatformBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformBuilder.js","sourceRoot":"","sources":["../../../src/builder/PlatformBuilder.ts"],"names":[],"mappings":";;;;;AAAA,qCAAwC;AACxC,iCAA4G;AAC5G,2DAAsD;AACtD,qEAAiE;AACjE,mDAA8C;AAC9C,yEAAoE;AACpE,oCAA0F;AAE1F,kEAA6D;AAE7D,gEAA2D;AAI3D;;GAEG;AACH,MAAa,eAAe;IAa1B,YAAsB,OAAuD,EAAE,MAAY,EAAE,QAAqC;QAVzH,SAAI,GAAW,EAAE,CAAC;QACjB,cAAS,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,YAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAE/B,4CAA2B;QAC3B,8CAAuB;QACvB,2CAAwB;QACxB,2CAAuC;QACvC,2CAAkC;QAGhC,oC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Q,EAAC,GAAG,IAAI,CAAC;QAEhC,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAE9B,IAAI,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,0CAAE,oBAAoB,CAAA,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE;YAC5E,MAAM,CAAC,IAAI,CAAC,IAAA,mBAAW,EAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;SAC9F;IACH,CAAC;CACF;AA9UD,0CA8UC","sourcesContent":["import {nameOf, Type} from \"@tsed/core\";\nimport {colors, createContainer, InjectorService, IProvider, ProviderScope, setLoggerLevel} from \"@tsed/di\";\nimport {importProviders} from \"@tsed/components-scan\";\nimport {getMiddlewaresForHook} from \"@tsed/platform-middlewares\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {createHttpServer, createHttpsServer, createInjector, printRoutes} from \"../utils\";\nimport {PlatformStaticsSettings} from \"../config/interfaces/PlatformStaticsSettings\";\nimport {getStaticsOptions} from \"../utils/getStaticsOptions\";\nimport {Route} from \"../interfaces/Route\";\nimport {getConfiguration} from \"../utils/getConfiguration\";\nimport {IncomingMessage, ServerResponse} from \"http\";\nimport {PlatformAdapter, PlatformBuilderSettings} from \"../interfaces/PlatformAdapter\";\n\n/**\n * @platform\n */\nexport class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {\n public static adapter: Type<PlatformAdapter>;\n\n readonly name: string = \"\";\n protected startedAt = new Date();\n protected current = new Date();\n\n #injector: InjectorService;\n #rootModule: Type<any>;\n #promise: Promise<this>;\n #adapter: PlatformAdapter<App, Router>;\n #servers: (() => Promise<void>)[];\n\n protected constructor(adapter: Type<PlatformAdapter<App, Router>> | undefined, module: Type, settings: Partial<TsED.Configuration>) {\n this.#rootModule = module;\n const adapterKlass = adapter || PlatformBuilder.adapter;\n const name = nameOf(adapterKlass).replace(\"Platform\", \"\").toLowerCase();\n\n const configuration = getConfiguration(settings, module);\n configuration.PLATFORM_NAME = name;\n this.name = name;\n this.#adapter = new adapterKlass(this);\n\n this.#injector = createInjector({\n settings: configuration,\n providers: this.#adapter.providers\n });\n\n this.createHttpServers();\n\n this.#adapter.onInit && this.#adapter.onInit();\n\n this.log(\"Injector created...\");\n }\n\n get injector(): InjectorService {\n return this.#injector;\n }\n\n get rootModule(): any {\n return this.#injector.get(this.#rootModule);\n }\n\n get app(): PlatformApplication<App, Router> {\n return this.injector.get<PlatformApplication<App, Router>>(PlatformApplication)!;\n }\n\n get platform() {\n return this.injector.get<Platform>(Platform)!;\n }\n\n /**\n * Return the settings configured by the decorator @@Configuration@@.\n *\n * ```typescript\n * @Configuration({\n * rootDir: Path.resolve(__dirname),\n * port: 8000,\n * httpsPort: 8080,\n * mount: {\n * \"/rest\": \"${rootDir}/controllers/**\\/*.js\"\n * }\n * })\n * export class Server {\n * $onInit(){\n * console.log(this.settings); // {rootDir, port, httpsPort,...}\n * }\n * }\n * ```\n *\n * @returns {PlatformConfiguration}\n */\n get settings() {\n return this.injector.settings;\n }\n\n get logger() {\n return this.injector.logger;\n }\n\n get disableBootstrapLog() {\n return this.settings.logger?.disableBootstrapLog;\n }\n\n static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build(module, {\n httpsPort: false,\n httpPort: false,\n ...settings,\n disableComponentsScan: true\n });\n }\n\n static build<App = TsED.Application, Router = TsED.Router>(\n module: Type<any>,\n {adapter, ...settings}: PlatformBuilderSettings<App, Router>\n ) {\n return new PlatformBuilder(adapter, module, settings);\n }\n\n /**\n * Bootstrap a server application\n * @param module\n * @param settings\n */\n static async bootstrap<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>) {\n return this.build<App, Router>(module, settings).bootstrap();\n }\n\n callback(): (req: IncomingMessage, res: ServerResponse) => void;\n callback(req: IncomingMessage, res: ServerResponse): void;\n callback(req?: IncomingMessage, res?: ServerResponse) {\n if (req && res) {\n return this.app.callback()(req, res);\n }\n\n return this.app.callback();\n }\n\n log(...data: any[]) {\n return !this.disableBootstrapLog && this.logger.info(...data, this.diff());\n }\n\n /**\n * Add classes to the components list\n * @param classes\n */\n public addComponents(classes: any | any[]) {\n this.settings.componentsScan = this.settings.componentsScan.concat(classes);\n\n return this;\n }\n\n /**\n * Add classes decorated by @@Controller@@ to components container.\n *\n * ### Example\n *\n * ```typescript\n * @Controller('/ctrl')\n * class MyController{\n * }\n *\n * platform.addControllers('/rest', [MyController])\n * ```\n *\n * ::: tip\n * If the MyController class isn't decorated, the class will be ignored.\n * :::\n *\n * @param {string} endpoint\n * @param {any[]} controllers\n */\n public addControllers(endpoint: string, controllers: any | string | (any | string)[]) {\n this.settings.mount[endpoint] = (this.settings.mount[endpoint] || []).concat(controllers);\n }\n\n public async runLifecycle() {\n setLoggerLevel(this.injector);\n\n await this.importProviders();\n await this.loadInjector();\n\n this.#adapter.useContext && this.#adapter.useContext();\n this.#adapter.useRouter && this.#adapter.useRouter();\n\n await this.loadRoutes();\n await this.logRoutes();\n\n return this;\n }\n\n async loadInjector() {\n const {injector} = this;\n this.log(\"Build providers\");\n\n const container = createContainer();\n\n container.addProvider(this.#rootModule, {\n type: \"server:module\",\n scope: ProviderScope.SINGLETON\n });\n\n await injector.load(container);\n\n this.log(\"Settings and injector loaded...\");\n\n await this.callHook(\"$afterInit\");\n }\n\n async listen(network = true) {\n if (!this.#promise) {\n await this.bootstrap();\n }\n\n await this.callHook(\"$beforeListen\");\n\n if (network) {\n await this.listenServers();\n }\n\n await this.callHook(\"$afterListen\");\n\n await this.ready();\n }\n\n async stop() {\n await this.callHook(\"$onDestroy\");\n return this.injector.destroy();\n }\n\n public async ready() {\n const {startedAt} = this;\n\n await this.callHook(\"$onReady\");\n await this.injector.emit(\"$onServerReady\");\n\n this.log(`Started in ${new Date().getTime() - startedAt.getTime()} ms`);\n }\n\n async callHook(hook: string, ...args: any[]) {\n const {injector} = this;\n\n if (!this.disableBootstrapLog) {\n injector.logger.debug(`\\x1B[1mCall hook ${hook}\\x1B[22m`);\n }\n\n // Load middlewares for the given hook\n this.loadMiddlewaresFor(hook);\n\n // call hooks added by providers\n await injector.emit(hook, ...args);\n }\n\n async loadStatics(hook: string): Promise<void> {\n const statics = this.settings.get<PlatformStaticsSettings>(\"statics\");\n\n getStaticsOptions(statics).forEach(({path, options}) => {\n if (options.hook === hook) {\n this.platform.app.statics(path, options);\n }\n });\n }\n\n useProvider(token: Type<any>, settings?: Partial<IProvider>) {\n this.injector.addProvider(token, settings);\n\n return this;\n }\n\n async bootstrap() {\n this.#promise = this.#promise || this.runLifecycle();\n\n return this.#promise;\n }\n\n protected async loadRoutes() {\n this.#adapter.beforeLoadRoutes && (await this.#adapter.beforeLoadRoutes());\n\n // istanbul ignore next\n if (this.settings.logger?.level !== \"off\") {\n const {PlatformLogMiddleware} = await import(\"@tsed/platform-log-middleware\");\n this.app.use(PlatformLogMiddleware);\n }\n\n this.log(\"Load routes\");\n\n if (this.rootModule.$beforeRoutesInit) {\n await this.rootModule.$beforeRoutesInit();\n this.rootModule.$beforeRoutesInit = () => {};\n }\n\n await this.loadStatics(\"$beforeRoutesInit\");\n await this.callHook(\"$beforeRoutesInit\");\n\n const routes = this.injector.settings.get<Route[]>(\"routes\");\n\n this.platform.addRoutes(routes);\n\n await this.callHook(\"$onRoutesInit\");\n\n await this.loadStatics(\"$afterRoutesInit\");\n\n await this.callHook(\"$afterRoutesInit\");\n\n this.#adapter.afterLoadRoutes && (await this.#adapter.afterLoadRoutes());\n }\n\n protected diff() {\n const ms = colors.yellow(`+${new Date().getTime() - this.current.getTime()}ms`);\n this.current = new Date();\n return ms;\n }\n\n protected async importProviders() {\n this.injector.logger.debug(\"Scan components\");\n\n const providers = await importProviders(this.injector.settings, [\"imports\", \"mount\", \"componentsScan\"]);\n const routes = providers.filter((provider) => !!provider.route).map(({route, token}) => ({route, token}));\n\n this.settings.set(\"routes\", routes);\n this.log(\"Providers loaded...\");\n }\n\n /**\n * Load middlewares from configuration for the given hook\n * @param hook\n * @protected\n */\n protected loadMiddlewaresFor(hook: string): void {\n return getMiddlewaresForHook(hook, this.settings, \"$beforeRoutesInit\").forEach(({use}) => {\n this.app.use(use);\n });\n }\n\n protected createHttpServers() {\n this.#servers = [createHttpServer(this.#injector, this.callback()), createHttpsServer(this.#injector, this.callback())].filter(\n Boolean\n ) as any[];\n }\n\n protected async listenServers(): Promise<void> {\n await Promise.all(this.#servers.map((cb) => cb && cb()));\n }\n\n protected async logRoutes() {\n const {logger, platform} = this;\n\n this.log(\"Routes mounted...\");\n\n if (!this.settings.logger?.disableRoutesSummary && !this.disableBootstrapLog) {\n logger.info(printRoutes(await this.injector.alterAsync(\"$logRoutes\", platform.getRoutes())));\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRouter = exports.createRouter = exports.getRouter = void 0;
|
|
4
|
+
const di_1 = require("@tsed/di");
|
|
5
|
+
const schema_1 = require("@tsed/schema");
|
|
6
|
+
const ControllerProvider_1 = require("../domain/ControllerProvider");
|
|
7
|
+
const PlatformRouter_1 = require("../services/PlatformRouter");
|
|
8
|
+
const PlatformMiddlewaresChain_1 = require("../services/PlatformMiddlewaresChain");
|
|
9
|
+
di_1.GlobalProviders.createRegistry(di_1.ProviderType.CONTROLLER, ControllerProvider_1.ControllerProvider, {
|
|
10
|
+
onInvoke(provider, locals, { injector }) {
|
|
11
|
+
const router = createRouter(injector, provider);
|
|
12
|
+
locals.set(PlatformRouter_1.PlatformRouter, router);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* @ignore
|
|
17
|
+
*/
|
|
18
|
+
function formatMethod(method) {
|
|
19
|
+
return (method === schema_1.OperationMethods.CUSTOM ? "use" : method || "use").toLowerCase();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
function getRouter(injector, provider) {
|
|
25
|
+
return injector.get(provider.tokenRouter);
|
|
26
|
+
}
|
|
27
|
+
exports.getRouter = getRouter;
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
function createRouter(injector, provider) {
|
|
32
|
+
const token = provider.tokenRouter;
|
|
33
|
+
if (injector.has(token)) {
|
|
34
|
+
return getRouter(injector, provider);
|
|
35
|
+
}
|
|
36
|
+
const router = PlatformRouter_1.PlatformRouter.create(injector, provider.routerOptions);
|
|
37
|
+
return injector
|
|
38
|
+
.add(token, {
|
|
39
|
+
useValue: router
|
|
40
|
+
})
|
|
41
|
+
.invoke(token);
|
|
42
|
+
}
|
|
43
|
+
exports.createRouter = createRouter;
|
|
44
|
+
/**
|
|
45
|
+
* @ignore
|
|
46
|
+
* @param injector
|
|
47
|
+
* @param provider
|
|
48
|
+
*/
|
|
49
|
+
function buildRouter(injector, provider) {
|
|
50
|
+
const { middlewares: { useBefore }, children } = provider;
|
|
51
|
+
// Controller lifecycle
|
|
52
|
+
const router = createRouter(injector, provider);
|
|
53
|
+
if (!router.isBuilt) {
|
|
54
|
+
router.isBuilt = true;
|
|
55
|
+
const platformMiddlewaresChain = injector.get(PlatformMiddlewaresChain_1.PlatformMiddlewaresChain);
|
|
56
|
+
useBefore // Controller before-middleware
|
|
57
|
+
.filter((o) => typeof o === "function")
|
|
58
|
+
.forEach((middleware) => {
|
|
59
|
+
router.use(middleware);
|
|
60
|
+
});
|
|
61
|
+
// build all endpoints and his middlewares
|
|
62
|
+
(0, schema_1.getOperationsRoutes)(provider.token).forEach((operationRoute) => {
|
|
63
|
+
const handlers = platformMiddlewaresChain === null || platformMiddlewaresChain === void 0 ? void 0 : platformMiddlewaresChain.get(provider, operationRoute);
|
|
64
|
+
router.addRoute({
|
|
65
|
+
handlers,
|
|
66
|
+
token: operationRoute.token,
|
|
67
|
+
method: formatMethod(operationRoute.method),
|
|
68
|
+
path: operationRoute.path,
|
|
69
|
+
isFinal: operationRoute.isFinal
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
// build children controllers
|
|
73
|
+
children.forEach((child) => {
|
|
74
|
+
const childProvider = injector.getProvider(child);
|
|
75
|
+
/* istanbul ignore next */
|
|
76
|
+
if (!childProvider) {
|
|
77
|
+
throw new Error("Controller component not found in the ControllerRegistry");
|
|
78
|
+
}
|
|
79
|
+
router.use(childProvider.path, buildRouter(injector, childProvider));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return router;
|
|
83
|
+
}
|
|
84
|
+
exports.buildRouter = buildRouter;
|
|
85
|
+
//# sourceMappingURL=PlatformControllerBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformControllerBuilder.js","sourceRoot":"","sources":["../../../src/builder/PlatformControllerBuilder.ts"],"names":[],"mappings":";;;AACA,iCAAwE;AACxE,yCAAmE;AACnE,qEAAgE;AAChE,+DAA0D;AAE1D,mFAA8E;AAE9E,oBAAe,CAAC,cAAc,CAAC,iBAAY,CAAC,UAAU,EAAE,uCAAkB,EAAE;IAC1E,QAAQ,CAAC,QAA4B,EAAE,MAAW,EAAE,EAAC,QAAQ,EAAC;QAC5D,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,CAAC,+BAAc,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,YAAY,CAAC,MAA0B;IAC9C,OAAO,CAAC,MAAM,KAAK,yBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,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AAA,4BAAmB,EAAmB,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,cAAc,EAAE,EAAE;YAC/E,MAAM,QAAQ,GAAG,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAEzE,MAAM,CAAC,QAAQ,CAAC;gBACd,QAAQ;gBACR,KAAK,EAAE,cAAc,CAAC,KAAK;gBAC3B,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC;gBAC3C,IAAI,EAAE,cAAc,CAAC,IAAI;gBACzB,OAAO,EAAE,cAAc,CAAC,OAAO;aAChC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,6BAA6B;QAC7B,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAgB,EAAE,EAAE;YACpC,MAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAuB,CAAC;YAExE,0BAA0B;YAC1B,IAAI,CAAC,aAAa,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;aAC7E;YAED,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA/CD,kCA+CC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {GlobalProviders, InjectorService, ProviderType} from \"@tsed/di\";\nimport {getOperationsRoutes, OperationMethods} from \"@tsed/schema\";\nimport {ControllerProvider} from \"../domain/ControllerProvider\";\nimport {PlatformRouter} from \"../services/PlatformRouter\";\nimport {EndpointMetadata} from \"../domain/EndpointMetadata\";\nimport {PlatformMiddlewaresChain} from \"../services/PlatformMiddlewaresChain\";\n\nGlobalProviders.createRegistry(ProviderType.CONTROLLER, ControllerProvider, {\n onInvoke(provider: ControllerProvider, locals: any, {injector}) {\n const router = createRouter(injector, provider);\n locals.set(PlatformRouter, router);\n }\n});\n\n/**\n * @ignore\n */\nfunction formatMethod(method: string | undefined) {\n return (method === OperationMethods.CUSTOM ? \"use\" : method || \"use\").toLowerCase();\n}\n\n/**\n * @ignore\n */\nexport function getRouter(injector: InjectorService, provider: ControllerProvider) {\n return injector.get(provider.tokenRouter)!;\n}\n\n/**\n * @ignore\n */\nexport function createRouter(injector: InjectorService, provider: ControllerProvider): PlatformRouter {\n const token = provider.tokenRouter;\n\n if (injector.has(token)) {\n return getRouter(injector, provider);\n }\n\n const router = PlatformRouter.create(injector, provider.routerOptions);\n\n return injector\n .add(token, {\n useValue: router\n })\n .invoke<PlatformRouter>(token);\n}\n\n/**\n * @ignore\n * @param injector\n * @param provider\n */\nexport function buildRouter(injector: InjectorService, provider: ControllerProvider) {\n const {\n middlewares: {useBefore},\n children\n } = provider;\n\n // Controller lifecycle\n const router = createRouter(injector, provider);\n\n if (!router.isBuilt) {\n router.isBuilt = true;\n\n const platformMiddlewaresChain = injector.get<PlatformMiddlewaresChain>(PlatformMiddlewaresChain);\n\n useBefore // Controller before-middleware\n .filter((o) => typeof o === \"function\")\n .forEach((middleware: any) => {\n router.use(middleware);\n });\n\n // build all endpoints and his middlewares\n getOperationsRoutes<EndpointMetadata>(provider.token).forEach((operationRoute) => {\n const handlers = platformMiddlewaresChain?.get(provider, operationRoute);\n\n router.addRoute({\n handlers,\n token: operationRoute.token,\n method: formatMethod(operationRoute.method),\n path: operationRoute.path,\n isFinal: operationRoute.isFinal\n });\n });\n\n // build children controllers\n children.forEach((child: Type<any>) => {\n const childProvider = injector.getProvider(child) as ControllerProvider;\n\n /* istanbul ignore next */\n if (!childProvider) {\n throw new Error(\"Controller component not found in the ControllerRegistry\");\n }\n\n router.use(childProvider.path, buildRouter(injector, childProvider));\n });\n }\n\n return router;\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("./interfaces"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./services/PlatformConfiguration"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./services/PlatformConfiguration"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,4DAA6B;AAC7B,gFAAiD;AACjD,gFAAiD","sourcesContent":["export * from \"./interfaces\";\nexport * from \"./services/PlatformConfiguration\";\nexport * from \"./services/PlatformConfiguration\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConverterSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/ConverterSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface ConverterSettings {\n /**\n * Converter additional property policy. (see [Converters](/docs/converters.md))\n */\n additionalProperties?: \"error\" | \"accept\" | \"ignore\";\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointDirectoriesSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/EndpointDirectoriesSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface EndpointDirectoriesSettings {\n [endpoint: string]: any | string | (any | string)[];\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformLoggerSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/PlatformLoggerSettings.ts"],"names":[],"mappings":"","sourcesContent":["export interface PlatformLoggerSettings {\n /**\n * Enable debug mode. By default debug is false.\n */\n debug?: boolean;\n /**\n * Enable info mode. By default debug is false.\n */\n level?: \"debug\" | \"info\" | \"warn\" | \"error\" | \"off\";\n /**\n * Enable log performance tracker and disable log server.\n */\n perf?: boolean;\n /**\n * List of regexp to ignore log.\n */\n ignoreUrlPatterns?: string[];\n /**\n * The number of space characters to use as white space in JSON output. Default is 2 (0 in production).\n */\n jsonIndentation?: number;\n /**\n * A function called for each incoming request to create a request id.\n * @returns {number}\n */\n reqIdBuilder?: (req: TsED.Request) => string;\n /**\n * Disable routes table displayed in the logger. By default debug is `false`.\n */\n disableRoutesSummary?: boolean;\n /**\n * Disable bootstrap log displayed in the logger. By default debug is `false`.\n */\n disableBootstrapLog?: boolean;\n /**\n * Specify log format. Example: `%[%d{[yyyy-MM-dd hh:mm:ss,SSS}] %p%] %m`. See [@tsed/logger configuration](https://tsedio.github.io/logger/).\n */\n format?: string;\n /**\n * Specify the log stack size for the context.logger. When the stack.length is reach, the logger is flushed during the request.\n * Default size is set to 30.\n */\n maxStackSize?: number;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformMulterSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/PlatformMulterSettings.ts"],"names":[],"mappings":"","sourcesContent":["import {Request} from \"express\";\nimport {FileFilterCallback} from \"multer\";\nimport {Readable} from \"stream\";\n\ndeclare global {\n namespace TsED {\n export interface MulterFile {\n /** Name of the form field associated with this file. */\n fieldname: string;\n /** Name of the file on the uploader's computer. */\n originalname: string;\n /** Value of the `Content-Type` header for this file. */\n mimetype: string;\n /** Size of the file in bytes. */\n size: number;\n /**\n * A readable stream of this file. Only available to the `_handleFile`\n * callback for custom `StorageEngine`s.\n */\n stream: Readable;\n /** `DiskStorage` only: Directory to which this file has been uploaded. */\n destination: string;\n /** `DiskStorage` only: Name of this file within `destination`. */\n filename: string;\n /** `DiskStorage` only: Full path to the uploaded file. */\n path: string;\n /** `MemoryStorage` only: A Buffer containing the entire file. */\n buffer: Buffer;\n }\n\n export interface MulterStorageEngine {}\n\n export interface MulterOptions {\n /**\n * A `StorageEngine` responsible for processing files uploaded via Multer.\n * Takes precedence over `dest`.\n */\n storage?: MulterStorageEngine;\n /**\n * The destination directory for uploaded files. If `storage` is not set\n * and `dest` is, Multer will create a `DiskStorage` instance configured\n * to store files at `dest` with random filenames.\n *\n * Ignored if `storage` is set.\n */\n dest?: string;\n /**\n * An object specifying various limits on incoming data. This object is\n * passed to Busboy directly, and the details of properties can be found\n * at https://github.com/mscdex/busboy#busboy-methods.\n */\n limits?: {\n /** Maximum size of each form field name in bytes. (Default: 100) */\n fieldNameSize?: number;\n /** Maximum size of each form field value in bytes. (Default: 1048576) */\n fieldSize?: number;\n /** Maximum number of non-file form fields. (Default: Infinity) */\n fields?: number;\n /** Maximum size of each file in bytes. (Default: Infinity) */\n fileSize?: number;\n /** Maximum number of file fields. (Default: Infinity) */\n files?: number;\n /** Maximum number of parts (non-file fields + files). (Default: Infinity) */\n parts?: number;\n /** Maximum number of headers. (Default: 2000) */\n headerPairs?: number;\n };\n /** Preserve the full path of the original filename rather than the basename. (Default: false) */\n preservePath?: boolean;\n /**\n * Optional function to control which files are uploaded. This is called\n * for every file that is processed.\n *\n * @param req The Express `Request` object.\n * @param file Object containing information about the processed file.\n * @param callback a function to control which files should be uploaded and which should be skipped.\n */\n fileFilter?(req: Request, file: MulterFile, callback: FileFilterCallback): void;\n }\n\n export interface MulterField {\n name: string;\n maxCount?: number;\n }\n\n export type MulterHandler = (req: any, res: any) => Promise<any>;\n\n export interface Multer {\n /**\n * Returns middleware that processes a single file associated with the\n * given form field.\n *\n * The `Request` object will be populated with a `file` object containing\n * information about the processed file.\n *\n * @param fieldName Name of the multipart form field to process.\n */\n single(fieldName: string): MulterHandler;\n\n /**\n * Returns middleware that processes multiple files sharing the same field\n * name.\n *\n * The `Request` object will be populated with a `files` array containing\n * an information object for each processed file.\n *\n * @param fieldName Shared name of the multipart form fields to process.\n * @param maxCount Optional. Maximum number of files to process. (default: Infinity)\n * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`\n */\n array(fieldName: string, maxCount?: number): MulterHandler;\n\n /**\n * Returns middleware that processes multiple files associated with the\n * given form fields.\n *\n * The `Request` object will be populated with a `files` object which\n * maps each field name to an array of the associated file information\n * objects.\n *\n * @param fields Array of `Field` objects describing multipart form fields to process.\n * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.\n */\n fields(fields: MulterField[]): MulterHandler;\n\n /**\n * Returns middleware that processes all files contained in the multipart\n * request.\n *\n * The `Request` object will be populated with a `files` array containing\n * an information object for each processed file.\n */\n any(): MulterHandler;\n\n /**\n * Returns middleware that accepts only non-file multipart form fields.\n *\n * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.\n */\n none(): MulterHandler;\n }\n }\n}\n\nexport type PlatformMulter = TsED.Multer;\nexport type PlatformMulterSettings = TsED.MulterOptions;\nexport type PlatformMulterFile = TsED.MulterFile;\nexport type PlatformMulterField = TsED.MulterField;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformStaticsSettings.js","sourceRoot":"","sources":["../../../../src/config/interfaces/PlatformStaticsSettings.ts"],"names":[],"mappings":"","sourcesContent":["declare global {\n namespace TsED {\n // @ts-ignore\n export interface StaticsOptions {\n root: string;\n hook?: \"$beforeRoutesInit\" | \"$afterRoutesInit\";\n\n [key: string]: any;\n }\n }\n}\n\nexport interface PlatformStaticsOptions extends TsED.StaticsOptions {\n root: string;\n\n [key: string]: any;\n}\n\nexport type PathOrStaticsOptions = string | PlatformStaticsOptions;\n\nexport interface PlatformStaticsSettings {\n [endpoint: string]: PathOrStaticsOptions | PathOrStaticsOptions[];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./PlatformLoggerSettings"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./EndpointDirectoriesSettings"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./PlatformStaticsSettings"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./PlatformMulterSettings"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/interfaces/index.ts"],"names":[],"mappings":";;;AA6FA,wEAAyC;AACzC,6EAA8C;AAC9C,yEAA0C;AAC1C,wEAAyC","sourcesContent":["import {Env} from \"@tsed/core\";\nimport {ConverterSettings} from \"./ConverterSettings\";\nimport {EndpointDirectoriesSettings} from \"./EndpointDirectoriesSettings\";\nimport {PlatformLoggerSettings} from \"./PlatformLoggerSettings\";\nimport {PlatformMulterSettings} from \"./PlatformMulterSettings\";\nimport {PlatformStaticsSettings} from \"./PlatformStaticsSettings\";\nimport type Http from \"http\";\nimport type Https from \"https\";\n\ndeclare global {\n namespace TsED {\n interface LoggerConfiguration extends Partial<PlatformLoggerSettings> {}\n interface Configuration {\n /**\n * The root directory where you build run project. By default, it's equal to `process.cwd().\n */\n rootDir: string;\n /**\n * The environment profile. By default the environment profile is equals to `NODE_ENV`.\n */\n env: Env;\n /**\n * Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).\n */\n port: string | number;\n /**\n * Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).\n */\n httpPort: string | number | boolean;\n /**\n * [Https.ServerOptions](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)):\n * - `key` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | <Object[]>: The private key of the server in PEM format. To support multiple keys using different algorithms an array can be provided either as a plain array of key strings or an array of objects in the format `{pem: key, passphrase: passphrase}`. This option is required for ciphers that make use of private keys.\n * - `passphrase` <string> A string containing the passphrase for the private key or pfx.\n * - `cert` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers containing the certificate key of the server in PEM format. (Required)\n * - `ca` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known \"root\" CAs (like VeriSign) will be used. These are used to authorize connections.\n */\n httpOptions: Http.ServerOptions;\n /**\n * Port number for the [HTTPs.Server](https://nodejs.org/api/https.html#https_class_https_server).\n */\n httpsPort: string | number | boolean;\n /**\n * [Https.ServerOptions](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)):\n * - `key` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | <Object[]>: The private key of the server in PEM format. To support multiple keys using different algorithms an array can be provided either as a plain array of key strings or an array of objects in the format `{pem: key, passphrase: passphrase}`. This option is required for ciphers that make use of private keys.\n * - `passphrase` <string> A string containing the passphrase for the private key or pfx.\n * - `cert` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers containing the certificate key of the server in PEM format. (Required)\n * - `ca` <string> | <string[]> | [<Buffer>](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [<Buffer[]>](https://nodejs.org/api/buffer.html#buffer_class_buffer): A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known \"root\" CAs (like VeriSign) will be used. These are used to authorize connections.\n */\n httpsOptions: Https.ServerOptions;\n /**\n * Mount all controllers under a directories to an endpoint.\n */\n mount: EndpointDirectoriesSettings;\n /**\n * List of directories to scan [Services](/docs/services.md), [Middlewares](/docs/middlewares.md) or [Converters](/docs/converters.md).\n */\n componentsScan: (string | RegExp)[];\n /**\n * Disable the glob pattern. In v7 the componentsScan options will be removed in favor of external module loader.\n */\n disableComponentsScan: boolean;\n /**\n * List of glob patterns. Exclude all files which matching with this list when Server scan all components with the `mount` or `scanComponents` options.\n */\n exclude: string[];\n /**\n * Configure the mimes accepted by default by the server.\n */\n acceptMimes: string[];\n /**\n * Enable debug mode. By default debug is false.\n */\n debug: boolean;\n /**\n * Converter configuration.\n */\n converter: Partial<ConverterSettings>;\n /**\n * Logger configuration.\n */\n logger?: LoggerConfiguration;\n /**\n * Object to mount all directories under to his endpoints. See more on [Serve Static](/tutorials/serve-static-files.md).\n */\n statics: PlatformStaticsSettings;\n /**\n * Object configure Multer. See more on [Upload file](/tutorials/serve-static-files.md).\n */\n multer: PlatformMulterSettings;\n }\n }\n}\n\nexport * from \"./PlatformLoggerSettings\";\nexport * from \"./EndpointDirectoriesSettings\";\nexport * from \"./PlatformStaticsSettings\";\nexport * from \"./PlatformMulterSettings\";\n"]}
|