@tsed/common 6.87.2 → 6.90.0
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/{PlatformModule.d.ts → cjs/PlatformModule.d.ts} +0 -0
- package/lib/cjs/PlatformModule.js +11 -0
- package/lib/cjs/PlatformModule.js.map +1 -0
- package/lib/{builder → cjs/builder}/PlatformBuilder.d.ts +13 -26
- package/lib/cjs/builder/PlatformBuilder.js +268 -0
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -0
- package/lib/{builder → cjs/builder}/PlatformControllerBuilder.d.ts +0 -0
- package/lib/cjs/builder/PlatformControllerBuilder.js +85 -0
- package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -0
- package/lib/{config → cjs/config}/index.d.ts +0 -0
- package/lib/cjs/config/index.js +7 -0
- package/lib/cjs/config/index.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/ConverterSettings.d.ts +0 -0
- package/lib/cjs/config/interfaces/ConverterSettings.js +3 -0
- package/lib/cjs/config/interfaces/ConverterSettings.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/EndpointDirectoriesSettings.d.ts +0 -0
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js +3 -0
- package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/PlatformLoggerSettings.d.ts +0 -0
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformLoggerSettings.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/PlatformMulterSettings.d.ts +0 -0
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/PlatformStaticsSettings.d.ts +0 -0
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +3 -0
- package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +1 -0
- package/lib/{config → cjs/config}/interfaces/index.d.ts +0 -0
- package/lib/cjs/config/interfaces/index.js +8 -0
- package/lib/cjs/config/interfaces/index.js.map +1 -0
- package/lib/{config → cjs/config}/services/PlatformConfiguration.d.ts +0 -0
- package/lib/cjs/config/services/PlatformConfiguration.js +195 -0
- package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -0
- package/lib/{constants → cjs/constants}/routerOptions.d.ts +0 -0
- package/lib/cjs/constants/routerOptions.js +5 -0
- package/lib/cjs/constants/routerOptions.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/httpServer.d.ts +0 -0
- package/lib/cjs/decorators/httpServer.js +31 -0
- package/lib/cjs/decorators/httpServer.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/httpsServer.d.ts +0 -0
- package/lib/cjs/decorators/httpsServer.js +31 -0
- package/lib/cjs/decorators/httpsServer.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/index.d.ts +1 -0
- package/lib/cjs/decorators/index.js +23 -0
- package/lib/cjs/decorators/index.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/method/acceptMime.d.ts +0 -0
- package/lib/cjs/decorators/method/acceptMime.js +28 -0
- package/lib/cjs/decorators/method/acceptMime.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/method/endpointFn.d.ts +0 -0
- package/lib/cjs/decorators/method/endpointFn.js +15 -0
- package/lib/cjs/decorators/method/endpointFn.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/method/location.d.ts +0 -0
- package/lib/cjs/decorators/method/location.js +6 -0
- package/lib/cjs/decorators/method/location.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/method/redirect.d.ts +0 -0
- package/lib/cjs/decorators/method/redirect.js +6 -0
- package/lib/cjs/decorators/method/redirect.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/method/route.d.ts +0 -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.d.ts +25 -0
- package/lib/cjs/decorators/method/view.js +34 -0
- package/lib/cjs/decorators/method/view.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/multer/index.d.ts +0 -0
- package/lib/cjs/decorators/multer/index.js +7 -0
- package/lib/cjs/decorators/multer/index.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/multer/multerFileSize.d.ts +0 -0
- package/lib/cjs/decorators/multer/multerFileSize.js +35 -0
- package/lib/cjs/decorators/multer/multerFileSize.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/multer/multerOptions.d.ts +0 -0
- package/lib/cjs/decorators/multer/multerOptions.js +52 -0
- package/lib/cjs/decorators/multer/multerOptions.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/multer/multipartFile.d.ts +0 -0
- package/lib/cjs/decorators/multer/multipartFile.js +78 -0
- package/lib/cjs/decorators/multer/multipartFile.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/endpointInfo.d.ts +0 -0
- package/lib/cjs/decorators/params/endpointInfo.js +21 -0
- package/lib/cjs/decorators/params/endpointInfo.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/error.d.ts +0 -0
- package/lib/cjs/decorators/params/error.js +20 -0
- package/lib/cjs/decorators/params/error.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/next.d.ts +0 -0
- package/lib/cjs/decorators/params/next.js +21 -0
- package/lib/cjs/decorators/params/next.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/request.d.ts +0 -0
- package/lib/cjs/decorators/params/request.js +39 -0
- package/lib/cjs/decorators/params/request.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/response.d.ts +0 -0
- package/lib/cjs/decorators/params/response.js +33 -0
- package/lib/cjs/decorators/params/response.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/params/responseData.d.ts +0 -0
- package/lib/cjs/decorators/params/responseData.js +21 -0
- package/lib/cjs/decorators/params/responseData.js.map +1 -0
- package/lib/{domain → cjs/domain}/AnyToPromiseWithCtx.d.ts +0 -0
- package/lib/cjs/domain/AnyToPromiseWithCtx.js +35 -0
- package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -0
- package/lib/{domain → cjs/domain}/ControllerProvider.d.ts +0 -0
- package/lib/cjs/domain/ControllerProvider.js +51 -0
- package/lib/cjs/domain/ControllerProvider.js.map +1 -0
- package/lib/{domain → cjs/domain}/EndpointMetadata.d.ts +0 -0
- package/lib/cjs/domain/EndpointMetadata.js +111 -0
- package/lib/cjs/domain/EndpointMetadata.js.map +1 -0
- package/lib/{domain → cjs/domain}/HandlerMetadata.d.ts +0 -0
- package/lib/cjs/domain/HandlerMetadata.js +57 -0
- package/lib/cjs/domain/HandlerMetadata.js.map +1 -0
- package/lib/{domain → cjs/domain}/PlatformContext.d.ts +0 -0
- package/lib/cjs/domain/PlatformContext.js +85 -0
- package/lib/cjs/domain/PlatformContext.js.map +1 -0
- package/lib/{domain → cjs/domain}/PlatformRouteDetails.d.ts +0 -0
- package/lib/cjs/domain/PlatformRouteDetails.js +24 -0
- package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -0
- package/lib/{domain → cjs/domain}/PropertyMetadata.d.ts +0 -0
- package/lib/cjs/domain/PropertyMetadata.js +28 -0
- package/lib/cjs/domain/PropertyMetadata.js.map +1 -0
- package/lib/{domain → cjs/domain}/index.d.ts +0 -0
- package/lib/cjs/domain/index.js +11 -0
- package/lib/cjs/domain/index.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -1
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/AfterInit.d.ts +0 -0
- package/lib/cjs/interfaces/AfterInit.js +3 -0
- package/lib/cjs/interfaces/AfterInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/AfterListen.d.ts +0 -0
- package/lib/cjs/interfaces/AfterListen.js +3 -0
- package/lib/cjs/interfaces/AfterListen.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/AfterRoutesInit.d.ts +0 -0
- package/lib/cjs/interfaces/AfterRoutesInit.js +3 -0
- package/lib/cjs/interfaces/AfterRoutesInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/BeforeInit.d.ts +0 -0
- package/lib/cjs/interfaces/BeforeInit.js +3 -0
- package/lib/cjs/interfaces/BeforeInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/BeforeListen.d.ts +0 -0
- package/lib/cjs/interfaces/BeforeListen.js +3 -0
- package/lib/cjs/interfaces/BeforeListen.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/BeforeRoutesInit.d.ts +0 -0
- package/lib/cjs/interfaces/BeforeRoutesInit.js +3 -0
- package/lib/cjs/interfaces/BeforeRoutesInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/HandlerType.d.ts +0 -0
- package/lib/cjs/interfaces/HandlerType.js +17 -0
- package/lib/cjs/interfaces/HandlerType.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/IncomingEvent.d.ts +0 -0
- package/lib/cjs/interfaces/IncomingEvent.js +3 -0
- package/lib/cjs/interfaces/IncomingEvent.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/OnReady.d.ts +0 -0
- package/lib/cjs/interfaces/OnReady.js +3 -0
- package/lib/cjs/interfaces/OnReady.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/OnRequest.d.ts +0 -0
- package/lib/cjs/interfaces/OnRequest.js +3 -0
- package/lib/cjs/interfaces/OnRequest.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/OnResponse.d.ts +0 -0
- package/lib/cjs/interfaces/OnResponse.js +3 -0
- package/lib/cjs/interfaces/OnResponse.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/OnRoutesInit.d.ts +0 -0
- package/lib/cjs/interfaces/OnRoutesInit.js +3 -0
- package/lib/cjs/interfaces/OnRoutesInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/PathType.d.ts +0 -0
- package/lib/cjs/interfaces/PathType.js +3 -0
- package/lib/cjs/interfaces/PathType.js.map +1 -0
- package/lib/cjs/interfaces/PlatformAdapter.d.ts +19 -0
- package/lib/cjs/interfaces/PlatformAdapter.js +3 -0
- package/lib/cjs/interfaces/PlatformAdapter.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/PlatformRouteOptions.d.ts +0 -0
- package/lib/cjs/interfaces/PlatformRouteOptions.js +3 -0
- package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/ResponseErrorObject.d.ts +0 -0
- package/lib/cjs/interfaces/ResponseErrorObject.js +3 -0
- package/lib/cjs/interfaces/ResponseErrorObject.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/Route.d.ts +0 -0
- package/lib/cjs/interfaces/Route.js +3 -0
- package/lib/cjs/interfaces/Route.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/index.d.ts +1 -0
- package/lib/cjs/interfaces/index.js +21 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/AcceptMimesMiddleware.d.ts +0 -0
- package/lib/cjs/middlewares/AcceptMimesMiddleware.js +27 -0
- package/lib/cjs/middlewares/AcceptMimesMiddleware.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/GlobalAcceptMimesMiddleware.d.ts +0 -0
- package/lib/cjs/middlewares/GlobalAcceptMimesMiddleware.js +26 -0
- package/lib/cjs/middlewares/GlobalAcceptMimesMiddleware.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/PlatformMulterMiddleware.d.ts +0 -0
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +55 -0
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -0
- package/lib/{middlewares/data → cjs/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js +12 -0
- package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/bindEndpointMiddleware.d.ts +0 -0
- package/lib/cjs/middlewares/bindEndpointMiddleware.js +13 -0
- package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -0
- package/lib/{middlewares → cjs/middlewares}/index.d.ts +0 -0
- package/lib/cjs/middlewares/index.js +9 -0
- package/lib/cjs/middlewares/index.js.map +1 -0
- package/lib/{services → cjs/services}/FakeRawDriver.d.ts +0 -0
- package/lib/cjs/services/FakeRawDriver.js +26 -0
- package/lib/cjs/services/FakeRawDriver.js.map +1 -0
- package/lib/{services → cjs/services}/Platform.d.ts +0 -0
- package/lib/cjs/services/Platform.js +107 -0
- package/lib/cjs/services/Platform.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformApplication.d.ts +0 -0
- package/lib/cjs/services/PlatformApplication.js +34 -0
- package/lib/cjs/services/PlatformApplication.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformHandler.d.ts +0 -0
- package/lib/cjs/services/PlatformHandler.js +235 -0
- package/lib/cjs/services/PlatformHandler.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformMiddlewaresChain.d.ts +0 -0
- package/lib/cjs/services/PlatformMiddlewaresChain.js +34 -0
- package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformRequest.d.ts +2 -1
- package/lib/cjs/services/PlatformRequest.js +138 -0
- package/lib/cjs/services/PlatformRequest.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformResponse.d.ts +4 -4
- package/lib/cjs/services/PlatformResponse.js +271 -0
- package/lib/cjs/services/PlatformResponse.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformRouter.d.ts +0 -0
- package/lib/cjs/services/PlatformRouter.js +126 -0
- package/lib/cjs/services/PlatformRouter.js.map +1 -0
- package/lib/{services → cjs/services}/PlatformTest.d.ts +5 -4
- package/lib/cjs/services/PlatformTest.js +174 -0
- package/lib/cjs/services/PlatformTest.js.map +1 -0
- package/lib/{services → cjs/services}/index.d.ts +0 -0
- package/lib/cjs/services/index.js +12 -0
- package/lib/cjs/services/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/createContext.d.ts +0 -0
- package/lib/cjs/utils/createContext.js +38 -0
- package/lib/cjs/utils/createContext.js.map +1 -0
- package/lib/{utils → cjs/utils}/createHandlerMetadata.d.ts +0 -0
- package/lib/cjs/utils/createHandlerMetadata.js +49 -0
- package/lib/cjs/utils/createHandlerMetadata.js.map +1 -0
- package/lib/{utils → cjs/utils}/createHttpServer.d.ts +0 -0
- package/lib/cjs/utils/createHttpServer.js +35 -0
- package/lib/cjs/utils/createHttpServer.js.map +1 -0
- package/lib/{utils → cjs/utils}/createHttpsServer.d.ts +0 -0
- package/lib/cjs/utils/createHttpsServer.js +36 -0
- package/lib/cjs/utils/createHttpsServer.js.map +1 -0
- package/lib/{utils → cjs/utils}/createInjector.d.ts +0 -0
- package/lib/cjs/utils/createInjector.js +42 -0
- package/lib/cjs/utils/createInjector.js.map +1 -0
- package/lib/{utils → cjs/utils}/getConfiguration.d.ts +0 -0
- package/lib/cjs/utils/getConfiguration.js +42 -0
- package/lib/cjs/utils/getConfiguration.js.map +1 -0
- package/lib/{utils → cjs/utils}/getStaticsOptions.d.ts +0 -0
- package/lib/cjs/utils/getStaticsOptions.js +21 -0
- package/lib/cjs/utils/getStaticsOptions.js.map +1 -0
- package/lib/{utils → cjs/utils}/index.d.ts +0 -0
- package/lib/cjs/utils/index.js +12 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/{utils → cjs/utils}/listenServer.d.ts +0 -0
- package/lib/cjs/utils/listenServer.js +17 -0
- package/lib/cjs/utils/listenServer.js.map +1 -0
- package/lib/{utils → cjs/utils}/loadInjector.d.ts +0 -0
- package/lib/cjs/utils/loadInjector.js +14 -0
- package/lib/cjs/utils/loadInjector.js.map +1 -0
- package/lib/{utils → cjs/utils}/mapReturnedResponse.d.ts +0 -0
- package/lib/cjs/utils/mapReturnedResponse.js +15 -0
- package/lib/cjs/utils/mapReturnedResponse.js.map +1 -0
- package/lib/{utils → cjs/utils}/printRoutes.d.ts +0 -0
- package/lib/cjs/utils/printRoutes.js +36 -0
- package/lib/cjs/utils/printRoutes.js.map +1 -0
- package/lib/{utils → cjs/utils}/setResponseHeaders.d.ts +0 -0
- package/lib/cjs/utils/setResponseHeaders.js +35 -0
- package/lib/cjs/utils/setResponseHeaders.js.map +1 -0
- package/lib/{utils → cjs/utils}/useCtxHandler.d.ts +0 -0
- package/lib/cjs/utils/useCtxHandler.js +15 -0
- package/lib/cjs/utils/useCtxHandler.js.map +1 -0
- package/lib/esm/PlatformModule.js +7 -0
- package/lib/esm/PlatformModule.js.map +1 -0
- package/lib/esm/builder/PlatformBuilder.js +264 -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 +192 -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 +27 -0
- package/lib/esm/decorators/httpServer.js.map +1 -0
- package/lib/esm/decorators/httpsServer.js +27 -0
- package/lib/esm/decorators/httpsServer.js.map +1 -0
- package/lib/esm/decorators/index.js +20 -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/endpointInfo.js +17 -0
- package/lib/esm/decorators/params/endpointInfo.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/decorators/params/responseData.js +17 -0
- package/lib/esm/decorators/params/responseData.js.map +1 -0
- package/lib/esm/domain/AnyToPromiseWithCtx.js +31 -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 +108 -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 +81 -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/PropertyMetadata.js +25 -0
- package/lib/esm/domain/PropertyMetadata.js.map +1 -0
- package/lib/esm/domain/index.js +8 -0
- package/lib/esm/domain/index.js.map +1 -0
- package/lib/esm/index.js +31 -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/AcceptMimesMiddleware.js +24 -0
- package/lib/esm/middlewares/AcceptMimesMiddleware.js.map +1 -0
- package/lib/esm/middlewares/GlobalAcceptMimesMiddleware.js +23 -0
- package/lib/esm/middlewares/GlobalAcceptMimesMiddleware.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 +6 -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 +232 -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 +170 -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 +30 -0
- package/lib/esm/utils/createHttpsServer.js.map +1 -0
- package/lib/esm/utils/createInjector.js +38 -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 +9 -0
- package/lib/esm/utils/index.js.map +1 -0
- package/lib/esm/utils/listenServer.js +13 -0
- package/lib/esm/utils/listenServer.js.map +1 -0
- package/lib/esm/utils/loadInjector.js +10 -0
- package/lib/esm/utils/loadInjector.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/types/PlatformModule.d.ts +6 -0
- package/lib/types/builder/PlatformBuilder.d.ts +103 -0
- package/lib/types/builder/PlatformControllerBuilder.d.ts +17 -0
- package/lib/types/config/index.d.ts +3 -0
- package/lib/types/config/interfaces/ConverterSettings.d.ts +6 -0
- package/lib/types/config/interfaces/EndpointDirectoriesSettings.d.ts +3 -0
- package/lib/types/config/interfaces/PlatformLoggerSettings.d.ts +44 -0
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +138 -0
- package/lib/types/config/interfaces/PlatformStaticsSettings.d.ts +17 -0
- package/lib/types/config/interfaces/index.d.ts +88 -0
- package/lib/types/config/services/PlatformConfiguration.d.ts +85 -0
- package/lib/types/constants/routerOptions.d.ts +1 -0
- package/lib/types/decorators/httpServer.d.ts +27 -0
- package/lib/types/decorators/httpsServer.d.ts +27 -0
- package/lib/types/decorators/index.d.ts +16 -0
- package/lib/types/decorators/method/acceptMime.d.ts +19 -0
- package/lib/types/decorators/method/endpointFn.d.ts +9 -0
- package/lib/types/decorators/method/location.d.ts +1 -0
- package/lib/types/decorators/method/redirect.d.ts +1 -0
- package/lib/types/decorators/method/route.d.ts +1 -0
- package/lib/types/decorators/method/view.d.ts +25 -0
- package/lib/types/decorators/multer/index.d.ts +3 -0
- package/lib/types/decorators/multer/multerFileSize.d.ts +27 -0
- package/lib/types/decorators/multer/multerOptions.d.ts +41 -0
- package/lib/types/decorators/multer/multipartFile.d.ts +47 -0
- package/lib/types/decorators/params/endpointInfo.d.ts +13 -0
- package/lib/types/decorators/params/error.d.ts +7 -0
- package/lib/types/decorators/params/next.d.ts +22 -0
- package/lib/types/decorators/params/request.d.ts +46 -0
- package/lib/types/decorators/params/response.d.ts +40 -0
- package/lib/types/decorators/params/responseData.d.ts +9 -0
- package/lib/types/domain/AnyToPromiseWithCtx.d.ts +18 -0
- package/lib/types/domain/ControllerProvider.d.ts +24 -0
- package/lib/types/domain/EndpointMetadata.d.ts +76 -0
- package/lib/types/domain/HandlerMetadata.d.ts +32 -0
- package/lib/types/domain/PlatformContext.d.ts +65 -0
- package/lib/types/domain/PlatformRouteDetails.d.ts +23 -0
- package/lib/types/domain/PropertyMetadata.d.ts +17 -0
- package/lib/types/domain/index.d.ts +7 -0
- package/lib/types/index.d.ts +22 -0
- package/lib/types/interfaces/AfterInit.d.ts +3 -0
- package/lib/types/interfaces/AfterListen.d.ts +3 -0
- package/lib/types/interfaces/AfterRoutesInit.d.ts +3 -0
- package/lib/types/interfaces/BeforeInit.d.ts +3 -0
- package/lib/types/interfaces/BeforeListen.d.ts +3 -0
- package/lib/types/interfaces/BeforeRoutesInit.d.ts +3 -0
- package/lib/types/interfaces/HandlerType.d.ts +12 -0
- package/lib/types/interfaces/IncomingEvent.d.ts +6 -0
- package/lib/types/interfaces/OnReady.d.ts +3 -0
- package/lib/types/interfaces/OnRequest.d.ts +4 -0
- package/lib/types/interfaces/OnResponse.d.ts +4 -0
- package/lib/types/interfaces/OnRoutesInit.d.ts +3 -0
- package/lib/types/interfaces/PathType.d.ts +1 -0
- package/lib/types/interfaces/PlatformAdapter.d.ts +19 -0
- package/lib/types/interfaces/PlatformRouteOptions.d.ts +16 -0
- package/lib/types/interfaces/ResponseErrorObject.d.ts +8 -0
- package/lib/types/interfaces/Route.d.ts +10 -0
- package/lib/types/interfaces/index.d.ts +17 -0
- package/lib/types/middlewares/AcceptMimesMiddleware.d.ts +10 -0
- package/lib/types/middlewares/GlobalAcceptMimesMiddleware.d.ts +9 -0
- package/lib/types/middlewares/PlatformAcceptMimesMiddleware.d.ts +10 -0
- package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +19 -0
- package/lib/types/middlewares/__mock__/FakeCtrl.d.ts +2 -0
- package/lib/types/middlewares/bindEndpointMiddleware.d.ts +5 -0
- package/lib/types/middlewares/index.d.ts +5 -0
- package/lib/types/services/FakeRawDriver.d.ts +15 -0
- package/lib/types/services/Platform.d.ts +37 -0
- package/lib/types/services/PlatformApplication.d.ts +21 -0
- package/lib/types/services/PlatformHandler.d.ts +80 -0
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -0
- package/lib/types/services/PlatformRequest.d.ts +112 -0
- package/lib/types/services/PlatformResponse.d.ts +161 -0
- package/lib/types/services/PlatformRouter.d.ts +48 -0
- package/lib/types/services/PlatformTest.d.ts +58 -0
- package/lib/types/services/index.d.ts +8 -0
- package/lib/types/utils/createContext.d.ts +9 -0
- package/lib/types/utils/createHandlerMetadata.d.ts +8 -0
- package/lib/types/utils/createHttpServer.d.ts +3 -0
- package/lib/types/utils/createHttpsServer.d.ts +3 -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/types/utils/index.d.ts +8 -0
- package/lib/types/utils/listenServer.d.ts +10 -0
- package/lib/types/utils/loadInjector.d.ts +6 -0
- package/lib/types/utils/mapReturnedResponse.d.ts +4 -0
- package/lib/types/utils/printRoutes.d.ts +2 -0
- package/lib/types/utils/setResponseHeaders.d.ts +5 -0
- package/lib/types/utils/useCtxHandler.d.ts +13 -0
- package/package.json +26 -23
- package/tsconfig.compile.esm.json +23 -0
- package/lib/index.js +0 -3603
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -3411
- package/lib/index.modern.js.map +0 -1
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/interfaces/index.ts"],"names":[],"mappings":"AAoFA,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC","sourcesContent":["import {Env} from \"@tsed/core\";\nimport Https from \"https\";\nimport {ConverterSettings} from \"./ConverterSettings\";\nimport {EndpointDirectoriesSettings} from \"./EndpointDirectoriesSettings\";\nimport {PlatformLoggerSettings} from \"./PlatformLoggerSettings\";\nimport {PlatformMulterSettings} from \"./PlatformMulterSettings\";\nimport {PlatformStaticsSettings} from \"./PlatformStaticsSettings\";\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 * 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"]}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var PlatformConfiguration_1;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { DIConfiguration, Injectable, ProviderScope } from "@tsed/di";
|
|
4
|
+
import { $log } from "@tsed/logger";
|
|
5
|
+
const rootDir = process.cwd();
|
|
6
|
+
/**
|
|
7
|
+
* `PlatformConfiguration` contains all information about your Server configuration.
|
|
8
|
+
*/
|
|
9
|
+
let PlatformConfiguration = PlatformConfiguration_1 = class PlatformConfiguration extends DIConfiguration {
|
|
10
|
+
constructor() {
|
|
11
|
+
super({ rootDir });
|
|
12
|
+
}
|
|
13
|
+
get version() {
|
|
14
|
+
return this.getRaw("version");
|
|
15
|
+
}
|
|
16
|
+
set version(v) {
|
|
17
|
+
this.setRaw("version", v);
|
|
18
|
+
}
|
|
19
|
+
get rootDir() {
|
|
20
|
+
return this.getRaw("rootDir");
|
|
21
|
+
}
|
|
22
|
+
set rootDir(value) {
|
|
23
|
+
this.setRaw("rootDir", value);
|
|
24
|
+
}
|
|
25
|
+
get port() {
|
|
26
|
+
return this.httpPort;
|
|
27
|
+
}
|
|
28
|
+
set port(value) {
|
|
29
|
+
this.httpPort = value;
|
|
30
|
+
}
|
|
31
|
+
get httpsOptions() {
|
|
32
|
+
return this.getRaw("httpsOptions");
|
|
33
|
+
}
|
|
34
|
+
set httpsOptions(value) {
|
|
35
|
+
this.setRaw("httpsOptions", value);
|
|
36
|
+
}
|
|
37
|
+
get httpPort() {
|
|
38
|
+
return this.getRaw("httpPort");
|
|
39
|
+
}
|
|
40
|
+
set httpPort(value) {
|
|
41
|
+
this.setRaw("httpPort", value);
|
|
42
|
+
}
|
|
43
|
+
get httpsPort() {
|
|
44
|
+
return this.getRaw("httpsPort");
|
|
45
|
+
}
|
|
46
|
+
set httpsPort(value) {
|
|
47
|
+
this.setRaw("httpsPort", value);
|
|
48
|
+
}
|
|
49
|
+
get env() {
|
|
50
|
+
return this.getRaw("env");
|
|
51
|
+
}
|
|
52
|
+
set env(value) {
|
|
53
|
+
this.setRaw("env", value);
|
|
54
|
+
}
|
|
55
|
+
get mount() {
|
|
56
|
+
return this.get("mount");
|
|
57
|
+
}
|
|
58
|
+
set mount(value) {
|
|
59
|
+
this.setRaw("mount", value);
|
|
60
|
+
}
|
|
61
|
+
get componentsScan() {
|
|
62
|
+
return this.resolve(this.getRaw("componentsScan"));
|
|
63
|
+
}
|
|
64
|
+
set componentsScan(value) {
|
|
65
|
+
this.setRaw("componentsScan", value);
|
|
66
|
+
}
|
|
67
|
+
get statics() {
|
|
68
|
+
return this.getRaw("statics") || this.getRaw("serveStatic") || {};
|
|
69
|
+
}
|
|
70
|
+
set statics(value) {
|
|
71
|
+
this.setRaw("statics", value);
|
|
72
|
+
}
|
|
73
|
+
get acceptMimes() {
|
|
74
|
+
return this.getRaw("acceptMimes");
|
|
75
|
+
}
|
|
76
|
+
set acceptMimes(value) {
|
|
77
|
+
this.setRaw("acceptMimes", value || []);
|
|
78
|
+
}
|
|
79
|
+
get debug() {
|
|
80
|
+
return this.logger.level === "debug";
|
|
81
|
+
}
|
|
82
|
+
set debug(debug) {
|
|
83
|
+
this.logger = { ...this.logger, level: debug ? "debug" : "info" };
|
|
84
|
+
}
|
|
85
|
+
get converter() {
|
|
86
|
+
return this.get("converter") || {};
|
|
87
|
+
}
|
|
88
|
+
set converter(options) {
|
|
89
|
+
this.setRaw("converter", options);
|
|
90
|
+
}
|
|
91
|
+
get logger() {
|
|
92
|
+
return this.get("logger");
|
|
93
|
+
}
|
|
94
|
+
set logger(value) {
|
|
95
|
+
const logger = { ...this.logger, ...value };
|
|
96
|
+
logger.debug = logger.level === "debug";
|
|
97
|
+
this.setRaw("logger", logger);
|
|
98
|
+
this.setRaw("debug", logger.debug);
|
|
99
|
+
if (logger.format) {
|
|
100
|
+
$log.appenders.set("stdout", {
|
|
101
|
+
type: "stdout",
|
|
102
|
+
levels: ["info", "debug"],
|
|
103
|
+
layout: {
|
|
104
|
+
type: "pattern",
|
|
105
|
+
pattern: logger.format
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
$log.appenders.set("stderr", {
|
|
109
|
+
levels: ["trace", "fatal", "error", "warn"],
|
|
110
|
+
type: "stderr",
|
|
111
|
+
layout: {
|
|
112
|
+
type: "pattern",
|
|
113
|
+
pattern: logger.format
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
get exclude() {
|
|
119
|
+
return this.get("exclude");
|
|
120
|
+
}
|
|
121
|
+
set exclude(exclude) {
|
|
122
|
+
this.setRaw("exclude", exclude);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @param addressPort
|
|
127
|
+
* @returns {{address: string, port: number}}
|
|
128
|
+
*/
|
|
129
|
+
static buildAddressAndPort(addressPort) {
|
|
130
|
+
let address = "0.0.0.0";
|
|
131
|
+
let port = addressPort;
|
|
132
|
+
if (typeof addressPort === "string" && addressPort.indexOf(":") > -1) {
|
|
133
|
+
[address, port] = addressPort.split(":");
|
|
134
|
+
port = +port;
|
|
135
|
+
}
|
|
136
|
+
return { address, port: port };
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @returns {string|number}
|
|
141
|
+
*/
|
|
142
|
+
getHttpPort() {
|
|
143
|
+
return PlatformConfiguration_1.buildAddressAndPort(this.getRaw("httpPort"));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* @param settings
|
|
148
|
+
*/
|
|
149
|
+
setHttpPort(settings) {
|
|
150
|
+
this.setRaw("httpPort", `${settings.address}:${settings.port}`);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @returns {string|number}
|
|
155
|
+
*/
|
|
156
|
+
getHttpsPort() {
|
|
157
|
+
return PlatformConfiguration_1.buildAddressAndPort(this.getRaw("httpsPort"));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* @param settings
|
|
162
|
+
*/
|
|
163
|
+
setHttpsPort(settings) {
|
|
164
|
+
this.setRaw("httpsPort", `${settings.address}:${settings.port}`);
|
|
165
|
+
}
|
|
166
|
+
getBestHost() {
|
|
167
|
+
const { httpsPort, httpPort } = this;
|
|
168
|
+
if (httpsPort) {
|
|
169
|
+
const host = this.getHttpsPort();
|
|
170
|
+
return {
|
|
171
|
+
protocol: "https",
|
|
172
|
+
...host
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (httpPort) {
|
|
176
|
+
const host = this.getHttpPort();
|
|
177
|
+
return {
|
|
178
|
+
protocol: "http",
|
|
179
|
+
...host
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
PlatformConfiguration = PlatformConfiguration_1 = __decorate([
|
|
185
|
+
Injectable({
|
|
186
|
+
scope: ProviderScope.SINGLETON,
|
|
187
|
+
global: true
|
|
188
|
+
}),
|
|
189
|
+
__metadata("design:paramtypes", [])
|
|
190
|
+
], PlatformConfiguration);
|
|
191
|
+
export { PlatformConfiguration };
|
|
192
|
+
//# sourceMappingURL=PlatformConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":"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","sourcesContent":["import {Env} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope, ProviderType} 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 /**\n *\n * @param addressPort\n * @returns {{address: string, port: number}}\n */\n private static buildAddressAndPort(addressPort: string | number): {address: string; port: number} {\n let address = \"0.0.0.0\";\n let port = addressPort;\n\n if (typeof addressPort === \"string\" && addressPort.indexOf(\":\") > -1) {\n [address, port] = addressPort.split(\":\");\n port = +port;\n }\n\n return {address, port: port as number};\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpPort(): {address: string; port: number} {\n return PlatformConfiguration.buildAddressAndPort(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(): {address: string; port: number} {\n return PlatformConfiguration.buildAddressAndPort(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 if (httpsPort) {\n const host = this.getHttpsPort();\n return {\n protocol: \"https\",\n ...host\n };\n }\n\n if (httpPort) {\n const host = this.getHttpPort();\n\n return {\n protocol: \"http\",\n ...host\n };\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerOptions.js","sourceRoot":"","sources":["../../../src/constants/routerOptions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["export const ROUTER_OPTIONS = Symbol.for(\"ROUTER_OPTIONS\");\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Inject } from "@tsed/di";
|
|
2
|
+
/**
|
|
3
|
+
* Inject the Http.Server instance.
|
|
4
|
+
*
|
|
5
|
+
* ### Example
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {HttpServer, Service} from "@tsed/common";
|
|
9
|
+
*
|
|
10
|
+
* @Service()
|
|
11
|
+
* export default class OtherService {
|
|
12
|
+
* constructor(@HttpServer httpServer: HttpServer) {}
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
17
|
+
*
|
|
18
|
+
* @param {Type<any>} target
|
|
19
|
+
* @param {string} targetKey
|
|
20
|
+
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
21
|
+
* @returns {any}
|
|
22
|
+
* @decorator
|
|
23
|
+
*/
|
|
24
|
+
export function HttpServer(target, targetKey, descriptor) {
|
|
25
|
+
return Inject(HttpServer)(target, targetKey, descriptor);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=httpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpServer.js","sourceRoot":"","sources":["../../../src/decorators/httpServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,UAAU,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACrH,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC","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 */\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,27 @@
|
|
|
1
|
+
import { Inject } from "@tsed/di";
|
|
2
|
+
/**
|
|
3
|
+
* Inject the Https.Server instance.
|
|
4
|
+
*
|
|
5
|
+
* ### Example
|
|
6
|
+
*
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import {HttpsServer, Service} from "@tsed/common";
|
|
9
|
+
*
|
|
10
|
+
* @Service()
|
|
11
|
+
* export default class OtherService {
|
|
12
|
+
* constructor(@HttpsServer httpServer: HttpServer) {}
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
17
|
+
*
|
|
18
|
+
* @param {Type<any>} target
|
|
19
|
+
* @param {string} targetKey
|
|
20
|
+
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
21
|
+
* @returns {any}
|
|
22
|
+
* @decorator
|
|
23
|
+
*/
|
|
24
|
+
export function HttpsServer(target, targetKey, descriptor) {
|
|
25
|
+
return Inject(HttpsServer)(target, targetKey, descriptor);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=httpsServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpsServer.js","sourceRoot":"","sources":["../../../src/decorators/httpsServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACtH,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC","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 */\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,20 @@
|
|
|
1
|
+
export * from "./httpServer";
|
|
2
|
+
export * from "./httpsServer";
|
|
3
|
+
export * from "./multer";
|
|
4
|
+
// Method
|
|
5
|
+
export * from "./method/route";
|
|
6
|
+
export * from "./method/acceptMime";
|
|
7
|
+
export * from "./method/location";
|
|
8
|
+
export * from "./method/redirect";
|
|
9
|
+
export * from "./method/endpointFn";
|
|
10
|
+
export * from "./method/view";
|
|
11
|
+
// Params
|
|
12
|
+
export * from "./params/responseData";
|
|
13
|
+
export * from "./params/response";
|
|
14
|
+
export * from "./params/request";
|
|
15
|
+
export * from "./params/next";
|
|
16
|
+
export * from "./params/error";
|
|
17
|
+
export * from "./params/endpointInfo";
|
|
18
|
+
// utils
|
|
19
|
+
export * from "../utils/mapReturnedResponse";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,cAAc,UAAU,CAAC;AAEzB,SAAS;AACT,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAE9B,SAAS;AACT,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AAEtC,QAAQ;AACR,cAAc,8BAA8B,CAAC","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/responseData\";\nexport * from \"./params/response\";\nexport * from \"./params/request\";\nexport * from \"./params/next\";\nexport * from \"./params/error\";\nexport * from \"./params/endpointInfo\";\n\n// utils\nexport * from \"../utils/mapReturnedResponse\";\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StoreSet, useDecorators } from "@tsed/core";
|
|
2
|
+
import { Produces } from "@tsed/schema";
|
|
3
|
+
/**
|
|
4
|
+
* 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.
|
|
5
|
+
*
|
|
6
|
+
* ```typescript
|
|
7
|
+
* @Controller('/mypath')
|
|
8
|
+
* export class MyCtrl {
|
|
9
|
+
*
|
|
10
|
+
* @Get('/')
|
|
11
|
+
* @AcceptMime('application/json')
|
|
12
|
+
* public getResource(){}
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param mimes
|
|
17
|
+
* @decorator
|
|
18
|
+
* @operation
|
|
19
|
+
* @response
|
|
20
|
+
*/
|
|
21
|
+
export function AcceptMime(...mimes) {
|
|
22
|
+
return useDecorators(Produces(...mimes), StoreSet("acceptMimes", mimes));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=acceptMime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acceptMime.js","sourceRoot":"","sources":["../../../../src/decorators/method/acceptMime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC","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,11 @@
|
|
|
1
|
+
import { JsonEntityFn } from "@tsed/schema";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param fn
|
|
5
|
+
* @decorator
|
|
6
|
+
* @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.
|
|
7
|
+
*/
|
|
8
|
+
export function EndpointFn(fn) {
|
|
9
|
+
return JsonEntityFn(fn);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=endpointFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpointFn.js","sourceRoot":"","sources":["../../../../src/decorators/method/endpointFn.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAAyE;IAClG,OAAO,YAAY,CAAmB,EAAE,CAAQ,CAAC;AACnD,CAAC","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 @@
|
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../../../../src/decorators/method/location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Location} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/method/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Redirect} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/decorators/method/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { StoreSet } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
* Use a view and sends the rendered HTML string to the client. Optional parameter:
|
|
4
|
+
*
|
|
5
|
+
* * viewOptions, an object whose properties define local variables for the view.
|
|
6
|
+
*
|
|
7
|
+
* The view argument is a string that is the file path of the view file to render.
|
|
8
|
+
* This can be an absolute path, or a path relative to the views setting.
|
|
9
|
+
* If the path does not contain a file extension, then the view engine setting determines the file extension.
|
|
10
|
+
* If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
|
|
11
|
+
* and render it using the loaded module’s __express function.
|
|
12
|
+
*
|
|
13
|
+
* For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
|
|
14
|
+
*
|
|
15
|
+
* > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
|
|
16
|
+
* and as so for security reasons should not contain input from the end-user.
|
|
17
|
+
*
|
|
18
|
+
* @param path Relative path to the view file.
|
|
19
|
+
* @param options Additional options
|
|
20
|
+
* @decorator
|
|
21
|
+
* @operation
|
|
22
|
+
* @response
|
|
23
|
+
* @ignores
|
|
24
|
+
* @deprecated Use View decorator from @tsed/platform-views instead.
|
|
25
|
+
*/
|
|
26
|
+
// istanbul ignore next
|
|
27
|
+
export function View(path, options) {
|
|
28
|
+
return StoreSet("view", { path, options });
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/decorators/method/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uBAAuB;AACvB,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,OAAgB;IACjD,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAQ,CAAC;AAClD,CAAC","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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/multer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./multerFileSize\";\nexport * from \"./multerOptions\";\nexport * from \"./multipartFile\";\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { MulterOptions } from "./multerOptions";
|
|
2
|
+
/**
|
|
3
|
+
* Define file size limit.
|
|
4
|
+
*
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import {Controller, Post} from "@tsed/common";
|
|
7
|
+
* import {MulterOptions, MultipartFile} from "@tsed/common";
|
|
8
|
+
* import {Multer} from "@types/multer";
|
|
9
|
+
*
|
|
10
|
+
* type MulterFile = Express.Multer.File;
|
|
11
|
+
*
|
|
12
|
+
* @Controller('/')
|
|
13
|
+
* class MyCtrl {
|
|
14
|
+
* @Post('/file2')
|
|
15
|
+
* @MulterFileSize(1024) // (Ko). Applied for all fields
|
|
16
|
+
* private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
|
|
17
|
+
*
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* > See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
23
|
+
* @param fileSize
|
|
24
|
+
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
25
|
+
* @decorator
|
|
26
|
+
* @multer
|
|
27
|
+
*/
|
|
28
|
+
export function MulterFileSize(fileSize) {
|
|
29
|
+
return MulterOptions({ limits: { fileSize } });
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=multerFileSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multerFileSize.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerFileSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,aAAa,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;AAC7C,CAAC","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,48 @@
|
|
|
1
|
+
import { StoreMerge } from "@tsed/core";
|
|
2
|
+
import { PlatformMulterMiddleware } from "../../middlewares/PlatformMulterMiddleware";
|
|
3
|
+
/**
|
|
4
|
+
* Define multer option for all MultipartFile
|
|
5
|
+
*
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
|
|
8
|
+
*
|
|
9
|
+
* @Controller('/')
|
|
10
|
+
* class MyCtrl {
|
|
11
|
+
* @Post('/file')
|
|
12
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
13
|
+
*
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* @Post('/file')
|
|
17
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
18
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
|
|
19
|
+
*
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @Post('/file2')
|
|
23
|
+
* @MulterOptions({dest: "/other-dir"})
|
|
24
|
+
* private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
|
|
25
|
+
*
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* @Post('/files')
|
|
29
|
+
* private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
|
|
30
|
+
*
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* See the tutorial on the [multer configuration](/tutorials/multer.md).
|
|
36
|
+
*
|
|
37
|
+
* @param {multer.Options} options
|
|
38
|
+
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
|
|
39
|
+
* @decorator
|
|
40
|
+
* @multer
|
|
41
|
+
*/
|
|
42
|
+
export function MulterOptions(options) {
|
|
43
|
+
return (target, propertyKey, descriptor) => {
|
|
44
|
+
StoreMerge(PlatformMulterMiddleware, { options })(target, propertyKey, descriptor);
|
|
45
|
+
return descriptor;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=multerOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multerOptions.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA+B;IAC3D,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,UAAU,CAAC,wBAAwB,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEjF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","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"]}
|