@tsed/common 7.0.0-alpha.2 → 7.0.0-beta.11
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 +281 -0
- package/lib/cjs/builder/PlatformBuilder.js.map +1 -0
- package/lib/cjs/builder/PlatformControllerBuilder.js +82 -0
- package/lib/cjs/builder/PlatformControllerBuilder.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/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/services/PlatformConfiguration.js +187 -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/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 +6 -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/exports.js +31 -0
- package/lib/cjs/exports.js.map +1 -0
- package/lib/cjs/index.js +68 -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/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/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
- package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
- package/lib/cjs/middlewares/PlatformMulterMiddleware.js +67 -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/package.json +3 -0
- package/lib/cjs/services/FakeAdapter.js +55 -0
- package/lib/cjs/services/FakeAdapter.js.map +1 -0
- package/lib/cjs/services/Platform.js +128 -0
- package/lib/cjs/services/Platform.js.map +1 -0
- package/lib/cjs/services/PlatformAdapter.js +14 -0
- package/lib/cjs/services/PlatformAdapter.js.map +1 -0
- package/lib/cjs/services/PlatformApplication.js +32 -0
- package/lib/cjs/services/PlatformApplication.js.map +1 -0
- package/lib/cjs/services/PlatformHandler.js +235 -0
- package/lib/cjs/services/PlatformHandler.js.map +1 -0
- package/lib/cjs/services/PlatformMiddlewaresChain.js +75 -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 +108 -0
- package/lib/cjs/services/PlatformRouter.js.map +1 -0
- package/lib/cjs/services/PlatformTest.js +173 -0
- package/lib/cjs/services/PlatformTest.js.map +1 -0
- package/lib/cjs/utils/__mock__/Test1.js +8 -0
- package/lib/cjs/utils/__mock__/Test1.js.map +1 -0
- package/lib/cjs/utils/__mock__/Test2.js +8 -0
- package/lib/cjs/utils/__mock__/Test2.js.map +1 -0
- package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js +12 -0
- package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/Module1.js +19 -0
- package/lib/cjs/utils/__mock__/module1/Module1.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js +17 -0
- package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/services/M1Service.js +17 -0
- package/lib/cjs/utils/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js +15 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubService.js +12 -0
- package/lib/cjs/utils/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/cjs/utils/__mock__/module2/Module2.js +18 -0
- package/lib/cjs/utils/__mock__/module2/Module2.js.map +1 -0
- package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js +12 -0
- package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.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 +29 -0
- package/lib/cjs/utils/createHttpServer.js.map +1 -0
- package/lib/cjs/utils/createHttpsServer.js +29 -0
- package/lib/cjs/utils/createHttpsServer.js.map +1 -0
- package/lib/cjs/utils/createInjector.js +46 -0
- package/lib/cjs/utils/createInjector.js.map +1 -0
- package/lib/cjs/utils/getConfiguration.js +46 -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/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 +277 -0
- package/lib/esm/builder/PlatformBuilder.js.map +1 -0
- package/lib/esm/builder/PlatformControllerBuilder.js +76 -0
- package/lib/esm/builder/PlatformControllerBuilder.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/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/services/PlatformConfiguration.js +184 -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/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 +2 -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/exports.js +13 -0
- package/lib/esm/exports.js.map +1 -0
- package/lib/esm/index.js +65 -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/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/middlewares/PlatformAcceptMimesMiddleware.js +34 -0
- package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
- package/lib/esm/middlewares/PlatformMulterMiddleware.js +63 -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/package.json +3 -0
- package/lib/esm/services/FakeAdapter.js +51 -0
- package/lib/esm/services/FakeAdapter.js.map +1 -0
- package/lib/esm/services/Platform.js +125 -0
- package/lib/esm/services/Platform.js.map +1 -0
- package/lib/esm/services/PlatformAdapter.js +10 -0
- package/lib/esm/services/PlatformAdapter.js.map +1 -0
- package/lib/esm/services/PlatformApplication.js +29 -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 +72 -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 +105 -0
- package/lib/esm/services/PlatformRouter.js.map +1 -0
- package/lib/esm/services/PlatformTest.js +168 -0
- package/lib/esm/services/PlatformTest.js.map +1 -0
- package/lib/esm/utils/__mock__/Test1.js +4 -0
- package/lib/esm/utils/__mock__/Test1.js.map +1 -0
- package/lib/esm/utils/__mock__/Test2.js +4 -0
- package/lib/esm/utils/__mock__/Test2.js.map +1 -0
- package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js +9 -0
- package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/Module1.js +16 -0
- package/lib/esm/utils/__mock__/module1/Module1.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js +14 -0
- package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/services/M1Service.js +14 -0
- package/lib/esm/utils/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubModule.js +12 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubService.js +9 -0
- package/lib/esm/utils/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/esm/utils/__mock__/module2/Module2.js +15 -0
- package/lib/esm/utils/__mock__/module2/Module2.js.map +1 -0
- package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js +9 -0
- package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.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 +24 -0
- package/lib/esm/utils/createHttpServer.js.map +1 -0
- package/lib/esm/utils/createHttpsServer.js +24 -0
- package/lib/esm/utils/createHttpsServer.js.map +1 -0
- package/lib/esm/utils/createInjector.js +42 -0
- package/lib/esm/utils/createInjector.js.map +1 -0
- package/lib/esm/utils/getConfiguration.js +42 -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/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 +30 -34
- package/lib/types/builder/PlatformControllerBuilder.d.ts +18 -0
- package/lib/{config → types/config}/interfaces/ConverterSettings.d.ts +0 -0
- package/lib/{config → types/config}/interfaces/PlatformLoggerSettings.d.ts +0 -0
- package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +14 -0
- package/lib/{config → types/config}/interfaces/PlatformStaticsSettings.d.ts +1 -0
- package/lib/{config → types/config}/services/PlatformConfiguration.d.ts +24 -17
- package/lib/{constants → types/constants}/routerOptions.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/types/domain/EndpointMetadata.d.ts +1 -0
- package/lib/{domain → types/domain}/HandlerMetadata.d.ts +2 -2
- package/lib/{domain → types/domain}/PlatformContext.d.ts +1 -1
- package/lib/types/domain/PlatformRouteDetails.d.ts +22 -0
- package/lib/types/exports.d.ts +12 -0
- package/lib/types/index.d.ts +64 -0
- 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}/PlatformRouteOptions.d.ts +5 -3
- package/lib/{interfaces → types/interfaces}/ResponseErrorObject.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/Route.d.ts +0 -0
- package/lib/{middlewares → types/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
- package/lib/{middlewares → types/middlewares}/PlatformMulterMiddleware.d.ts +8 -3
- package/lib/{middlewares/data → types/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
- package/lib/types/middlewares/bindEndpointMiddleware.d.ts +6 -0
- package/lib/types/services/FakeAdapter.d.ts +30 -0
- package/lib/{services → types/services}/Platform.d.ts +22 -7
- package/lib/types/services/PlatformAdapter.d.ts +47 -0
- package/lib/{services → types/services}/PlatformApplication.d.ts +3 -3
- package/lib/{services → types/services}/PlatformHandler.d.ts +1 -1
- package/lib/types/services/PlatformMiddlewaresChain.d.ts +10 -0
- package/lib/{services → types/services}/PlatformRequest.d.ts +2 -1
- package/lib/{services → types/services}/PlatformResponse.d.ts +10 -10
- package/lib/{services → types/services}/PlatformRouter.d.ts +12 -8
- package/lib/{services → types/services}/PlatformTest.d.ts +6 -5
- package/lib/types/utils/__mock__/Test1.d.ts +3 -0
- package/lib/types/utils/__mock__/Test2.d.ts +3 -0
- package/lib/types/utils/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/Module1.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
- package/lib/types/utils/__mock__/module1/services/M1Service.d.ts +5 -0
- package/lib/types/utils/__mock__/module1/submodule/SubModule.d.ts +2 -0
- package/lib/types/utils/__mock__/module1/submodule/SubService.d.ts +2 -0
- package/lib/types/utils/__mock__/module2/Module2.d.ts +2 -0
- package/lib/types/utils/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
- package/lib/{utils → types/utils}/createContext.d.ts +0 -0
- package/lib/{utils → types/utils}/createHandlerMetadata.d.ts +1 -1
- package/lib/types/utils/createHttpServer.d.ts +4 -0
- package/lib/types/utils/createHttpsServer.d.ts +5 -0
- package/lib/types/utils/createInjector.d.ts +9 -0
- package/lib/types/utils/getConfiguration.d.ts +2 -0
- package/lib/types/utils/getStaticsOptions.d.ts +5 -0
- 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 +47 -34
- package/readme.md +50 -57
- package/tsconfig.compile.esm.json +13 -0
- package/lib/PlatformModule.d.ts +0 -15
- package/lib/builder/PlatformControllerBuilder.d.ts +0 -19
- package/lib/config/index.d.ts +0 -3
- package/lib/config/interfaces/EndpointDirectoriesSettings.d.ts +0 -3
- package/lib/config/interfaces/PlatformMulterSettings.d.ts +0 -138
- package/lib/config/interfaces/index.d.ts +0 -84
- package/lib/decorators/httpServer.d.ts +0 -27
- package/lib/decorators/httpsServer.d.ts +0 -27
- package/lib/decorators/index.d.ts +0 -13
- package/lib/decorators/method/acceptMime.d.ts +0 -19
- package/lib/decorators/method/endpointFn.d.ts +0 -8
- package/lib/decorators/method/location.d.ts +0 -1
- package/lib/decorators/method/redirect.d.ts +0 -1
- package/lib/decorators/method/route.d.ts +0 -1
- package/lib/decorators/multer/index.d.ts +0 -3
- package/lib/domain/ControllerProvider.d.ts +0 -53
- package/lib/domain/EndpointMetadata.d.ts +0 -88
- package/lib/domain/PlatformRouteDetails.d.ts +0 -29
- package/lib/domain/index.d.ts +0 -6
- package/lib/index.d.ts +0 -22
- 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/PathType.d.ts +0 -1
- package/lib/interfaces/PlatformRouterMethods.d.ts +0 -10
- package/lib/interfaces/index.d.ts +0 -17
- package/lib/middlewares/bindEndpointMiddleware.d.ts +0 -5
- package/lib/middlewares/index.d.ts +0 -3
- package/lib/registries/ControllerRegistry.d.ts +0 -1
- package/lib/services/FakeRawDriver.d.ts +0 -15
- package/lib/services/index.d.ts +0 -7
- 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/index.d.ts +0 -8
- package/lib/utils/listenServer.d.ts +0 -10
package/readme.md
CHANGED
|
@@ -31,32 +31,32 @@
|
|
|
31
31
|
|
|
32
32
|
## What it is
|
|
33
33
|
|
|
34
|
-
Ts.ED is a framework on top of Express that helps you to write your application in TypeScript (or in ES6). It provides a lot of decorators
|
|
34
|
+
Ts.ED is a framework on top of Express that helps you to write your application in TypeScript (or in ES6). It provides a lot of decorators
|
|
35
35
|
to make your code more readable and less error-prone.
|
|
36
36
|
|
|
37
37
|
## Features
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
- Use our CLI to create a new project https://cli.tsed.io
|
|
40
|
+
- Support TypeORM, Mongoose, GraphQL, Socket.io, Swagger-ui, Passport.js, etc...
|
|
41
|
+
- Define class as Controller,
|
|
42
|
+
- Define class as Service (IoC),
|
|
43
|
+
- Define class as Middleware and MiddlewareError,
|
|
44
|
+
- Define class as Converter (POJ to Model and Model to POJ),
|
|
45
|
+
- Define root path for an entire controller and versioning your Rest API,
|
|
46
|
+
- Define as sub-route path for a method,
|
|
47
|
+
- Define routes on GET, POST, PUT, DELETE and HEAD verbs,
|
|
48
|
+
- Define middlewares on routes,
|
|
49
|
+
- Define required parameters,
|
|
50
|
+
- Inject data from query string, path parameters, entire body, cookies, session or header,
|
|
51
|
+
- Inject Request, Response, Next object from Express request,
|
|
52
|
+
- Template (View),
|
|
53
|
+
- Testing.
|
|
54
54
|
|
|
55
55
|
## Documentation
|
|
56
56
|
|
|
57
57
|
Documentation is available on [https://tsed.io](https://tsed.io)
|
|
58
58
|
|
|
59
|
-
## Getting started
|
|
59
|
+
## Getting started
|
|
60
60
|
|
|
61
61
|
See our [getting started here](https://tsed.io/getting-started/) to create new Ts.ED project or use
|
|
62
62
|
our [CLI](https://cli.tsed.io)
|
|
@@ -65,8 +65,8 @@ our [CLI](https://cli.tsed.io)
|
|
|
65
65
|
|
|
66
66
|
Examples are available on [https://tsed.io/tutorials/](https://tsed.io/tutorials/)
|
|
67
67
|
|
|
68
|
-
|
|
69
68
|
## Overview
|
|
69
|
+
|
|
70
70
|
### Server example
|
|
71
71
|
|
|
72
72
|
Here an example to create a Server with Ts.ED:
|
|
@@ -75,37 +75,19 @@ Here an example to create a Server with Ts.ED:
|
|
|
75
75
|
import {Configuration, Inject} from "@tsed/di";
|
|
76
76
|
import {PlatformApplication} from "@tsed/common";
|
|
77
77
|
import "@tsed/platform-express";
|
|
78
|
-
import
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
import Path from "path";
|
|
79
|
+
import cookieParser from "cookie-parser";
|
|
80
|
+
import compress from "compression";
|
|
81
|
+
import methodOverride from "method-override";
|
|
81
82
|
|
|
82
83
|
@Configuration({
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
port: 3000,
|
|
85
|
+
middlewares: [cookieParser(), compress({}), methodOverride()]
|
|
85
86
|
})
|
|
86
|
-
export class Server {
|
|
87
|
-
@Inject()
|
|
88
|
-
app: PlatformApplication;
|
|
89
|
-
|
|
90
|
-
public $beforeRoutesInit() {
|
|
91
|
-
const cookieParser = require('cookie-parser'),
|
|
92
|
-
bodyParser = require('body-parser'),
|
|
93
|
-
compress = require('compression'),
|
|
94
|
-
methodOverride = require('method-override');
|
|
95
|
-
|
|
96
|
-
this.app
|
|
97
|
-
.use(cookieParser())
|
|
98
|
-
.use(compress({}))
|
|
99
|
-
.use(methodOverride())
|
|
100
|
-
.use(bodyParser.json())
|
|
101
|
-
.use(bodyParser.urlencoded({
|
|
102
|
-
extended: true
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
87
|
+
export class Server {}
|
|
106
88
|
```
|
|
107
89
|
|
|
108
|
-
To run your server, you have to use Platform API to bootstrap your application with the expected
|
|
90
|
+
To run your server, you have to use Platform API to bootstrap your application with the expected
|
|
109
91
|
platform like Express.
|
|
110
92
|
|
|
111
93
|
```typescript
|
|
@@ -137,21 +119,34 @@ This is a simple controller to expose user resource. It use decorators to build
|
|
|
137
119
|
```typescript
|
|
138
120
|
import {Inject} from "@tsed/di";
|
|
139
121
|
import {Summary} from "@tsed/swagger";
|
|
140
|
-
import {
|
|
122
|
+
import {
|
|
123
|
+
Returns,
|
|
124
|
+
ReturnsArray,
|
|
125
|
+
Controller,
|
|
126
|
+
Get,
|
|
127
|
+
QueryParams,
|
|
128
|
+
PathParams,
|
|
129
|
+
Delete,
|
|
130
|
+
Post,
|
|
131
|
+
Required,
|
|
132
|
+
BodyParams,
|
|
133
|
+
Status,
|
|
134
|
+
Put
|
|
135
|
+
} from "@tsed/common";
|
|
141
136
|
import {BadRequest} from "@tsed/exceptions";
|
|
142
137
|
import {UsersService} from "../services/UsersService";
|
|
143
|
-
import {User} from "../models/User";
|
|
138
|
+
import {User} from "../models/User";
|
|
144
139
|
|
|
145
140
|
@Controller("/users")
|
|
146
141
|
export class UsersCtrl {
|
|
147
142
|
@Inject()
|
|
148
|
-
usersService: UsersService;
|
|
143
|
+
protected usersService: UsersService;
|
|
149
144
|
|
|
150
145
|
@Get("/:id")
|
|
151
146
|
@Summary("Get a user from his Id")
|
|
152
147
|
@Returns(User)
|
|
153
148
|
async getUser(@PathParams("id") id: string): Promise<User> {
|
|
154
|
-
|
|
149
|
+
return this.usersService.findById(id);
|
|
155
150
|
}
|
|
156
151
|
|
|
157
152
|
@Post("/")
|
|
@@ -168,41 +163,40 @@ export class UsersCtrl {
|
|
|
168
163
|
@Returns(User)
|
|
169
164
|
async putUser(@PathParams("id") id: string, @Required() @BodyParams() user: User): Promise<User> {
|
|
170
165
|
if (user.id !== id) {
|
|
171
|
-
throw new BadRequest("ID mismatch with the given payload")
|
|
166
|
+
throw new BadRequest("ID mismatch with the given payload");
|
|
172
167
|
}
|
|
173
168
|
|
|
174
169
|
return this.usersService.save(user);
|
|
175
170
|
}
|
|
176
|
-
|
|
171
|
+
|
|
177
172
|
@Delete("/:id")
|
|
178
173
|
@Summary("Remove a user")
|
|
179
174
|
@Status(204)
|
|
180
|
-
async deleteUser(@PathParams("id") @Required() id: string
|
|
181
|
-
|
|
175
|
+
async deleteUser(@PathParams("id") @Required() id: string): Promise<User> {
|
|
176
|
+
await this.usersService.delete(user);
|
|
182
177
|
}
|
|
183
|
-
|
|
178
|
+
|
|
184
179
|
@Get("/")
|
|
185
180
|
@Summary("Get all users")
|
|
186
181
|
@ReturnsArray(User)
|
|
187
|
-
async findUser(@QueryParams("name") name: string){
|
|
182
|
+
async findUser(@QueryParams("name") name: string) {
|
|
188
183
|
return this.usersService.find({name});
|
|
189
184
|
}
|
|
190
185
|
}
|
|
191
186
|
```
|
|
192
187
|
|
|
193
188
|
## Contributors
|
|
189
|
+
|
|
194
190
|
Please read [contributing guidelines here](./CONTRIBUTING.md).
|
|
195
191
|
|
|
196
192
|
<a href="https://github.com/tsedio/tsed/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
197
193
|
|
|
198
|
-
|
|
199
194
|
## Backers
|
|
200
195
|
|
|
201
196
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
|
|
202
197
|
|
|
203
198
|
<a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/tiers/backer.svg?width=890"></a>
|
|
204
199
|
|
|
205
|
-
|
|
206
200
|
## Sponsors
|
|
207
201
|
|
|
208
202
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
|
|
@@ -220,4 +214,3 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
220
214
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
221
215
|
|
|
222
216
|
[travis]: https://travis-ci.org/
|
|
223
|
-
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"include": ["src"],
|
|
12
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
13
|
+
}
|
package/lib/PlatformModule.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
|
-
import { Platform } from "./services/Platform";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export declare class PlatformModule {
|
|
7
|
-
protected injector: InjectorService;
|
|
8
|
-
protected platform: Platform;
|
|
9
|
-
constructor(injector: InjectorService, platform: Platform);
|
|
10
|
-
/**
|
|
11
|
-
* Create routers from the collected controllers
|
|
12
|
-
*/
|
|
13
|
-
createRoutersFromControllers(): (import("./interfaces").PlatformRouterMethods<any> | undefined)[];
|
|
14
|
-
$$loadRoutes(): void;
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { InjectorService } from "@tsed/di";
|
|
2
|
-
import { ControllerProvider } from "../domain/ControllerProvider";
|
|
3
|
-
import { PlatformRouterMethods } from "../interfaces/PlatformRouterMethods";
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
export declare class PlatformControllerBuilder {
|
|
8
|
-
private provider;
|
|
9
|
-
constructor(provider: ControllerProvider);
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @returns {any}
|
|
13
|
-
*/
|
|
14
|
-
build(injector: InjectorService): PlatformRouterMethods;
|
|
15
|
-
private buildEndpoints;
|
|
16
|
-
private buildEndpoint;
|
|
17
|
-
private buildChildrenCtrls;
|
|
18
|
-
private buildMiddlewares;
|
|
19
|
-
}
|
package/lib/config/index.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { FileFilterCallback } from "multer";
|
|
3
|
-
import { Readable } from "stream";
|
|
4
|
-
declare global {
|
|
5
|
-
namespace TsED {
|
|
6
|
-
interface MulterFile {
|
|
7
|
-
/** Name of the form field associated with this file. */
|
|
8
|
-
fieldname: string;
|
|
9
|
-
/** Name of the file on the uploader's computer. */
|
|
10
|
-
originalname: string;
|
|
11
|
-
/** Value of the `Content-Type` header for this file. */
|
|
12
|
-
mimetype: string;
|
|
13
|
-
/** Size of the file in bytes. */
|
|
14
|
-
size: number;
|
|
15
|
-
/**
|
|
16
|
-
* A readable stream of this file. Only available to the `_handleFile`
|
|
17
|
-
* callback for custom `StorageEngine`s.
|
|
18
|
-
*/
|
|
19
|
-
stream: Readable;
|
|
20
|
-
/** `DiskStorage` only: Directory to which this file has been uploaded. */
|
|
21
|
-
destination: string;
|
|
22
|
-
/** `DiskStorage` only: Name of this file within `destination`. */
|
|
23
|
-
filename: string;
|
|
24
|
-
/** `DiskStorage` only: Full path to the uploaded file. */
|
|
25
|
-
path: string;
|
|
26
|
-
/** `MemoryStorage` only: A Buffer containing the entire file. */
|
|
27
|
-
buffer: Buffer;
|
|
28
|
-
}
|
|
29
|
-
interface MulterStorageEngine {
|
|
30
|
-
}
|
|
31
|
-
interface MulterOptions {
|
|
32
|
-
/**
|
|
33
|
-
* A `StorageEngine` responsible for processing files uploaded via Multer.
|
|
34
|
-
* Takes precedence over `dest`.
|
|
35
|
-
*/
|
|
36
|
-
storage?: MulterStorageEngine;
|
|
37
|
-
/**
|
|
38
|
-
* The destination directory for uploaded files. If `storage` is not set
|
|
39
|
-
* and `dest` is, Multer will create a `DiskStorage` instance configured
|
|
40
|
-
* to store files at `dest` with random filenames.
|
|
41
|
-
*
|
|
42
|
-
* Ignored if `storage` is set.
|
|
43
|
-
*/
|
|
44
|
-
dest?: string;
|
|
45
|
-
/**
|
|
46
|
-
* An object specifying various limits on incoming data. This object is
|
|
47
|
-
* passed to Busboy directly, and the details of properties can be found
|
|
48
|
-
* at https://github.com/mscdex/busboy#busboy-methods.
|
|
49
|
-
*/
|
|
50
|
-
limits?: {
|
|
51
|
-
/** Maximum size of each form field name in bytes. (Default: 100) */
|
|
52
|
-
fieldNameSize?: number;
|
|
53
|
-
/** Maximum size of each form field value in bytes. (Default: 1048576) */
|
|
54
|
-
fieldSize?: number;
|
|
55
|
-
/** Maximum number of non-file form fields. (Default: Infinity) */
|
|
56
|
-
fields?: number;
|
|
57
|
-
/** Maximum size of each file in bytes. (Default: Infinity) */
|
|
58
|
-
fileSize?: number;
|
|
59
|
-
/** Maximum number of file fields. (Default: Infinity) */
|
|
60
|
-
files?: number;
|
|
61
|
-
/** Maximum number of parts (non-file fields + files). (Default: Infinity) */
|
|
62
|
-
parts?: number;
|
|
63
|
-
/** Maximum number of headers. (Default: 2000) */
|
|
64
|
-
headerPairs?: number;
|
|
65
|
-
};
|
|
66
|
-
/** Preserve the full path of the original filename rather than the basename. (Default: false) */
|
|
67
|
-
preservePath?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Optional function to control which files are uploaded. This is called
|
|
70
|
-
* for every file that is processed.
|
|
71
|
-
*
|
|
72
|
-
* @param req The Express `Request` object.
|
|
73
|
-
* @param file Object containing information about the processed file.
|
|
74
|
-
* @param callback a function to control which files should be uploaded and which should be skipped.
|
|
75
|
-
*/
|
|
76
|
-
fileFilter?(req: Request, file: MulterFile, callback: FileFilterCallback): void;
|
|
77
|
-
}
|
|
78
|
-
interface MulterField {
|
|
79
|
-
name: string;
|
|
80
|
-
maxCount?: number;
|
|
81
|
-
}
|
|
82
|
-
type MulterHandler = (req: any, res: any) => Promise<any>;
|
|
83
|
-
interface Multer {
|
|
84
|
-
/**
|
|
85
|
-
* Returns middleware that processes a single file associated with the
|
|
86
|
-
* given form field.
|
|
87
|
-
*
|
|
88
|
-
* The `Request` object will be populated with a `file` object containing
|
|
89
|
-
* information about the processed file.
|
|
90
|
-
*
|
|
91
|
-
* @param fieldName Name of the multipart form field to process.
|
|
92
|
-
*/
|
|
93
|
-
single(fieldName: string): MulterHandler;
|
|
94
|
-
/**
|
|
95
|
-
* Returns middleware that processes multiple files sharing the same field
|
|
96
|
-
* name.
|
|
97
|
-
*
|
|
98
|
-
* The `Request` object will be populated with a `files` array containing
|
|
99
|
-
* an information object for each processed file.
|
|
100
|
-
*
|
|
101
|
-
* @param fieldName Shared name of the multipart form fields to process.
|
|
102
|
-
* @param maxCount Optional. Maximum number of files to process. (default: Infinity)
|
|
103
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`
|
|
104
|
-
*/
|
|
105
|
-
array(fieldName: string, maxCount?: number): MulterHandler;
|
|
106
|
-
/**
|
|
107
|
-
* Returns middleware that processes multiple files associated with the
|
|
108
|
-
* given form fields.
|
|
109
|
-
*
|
|
110
|
-
* The `Request` object will be populated with a `files` object which
|
|
111
|
-
* maps each field name to an array of the associated file information
|
|
112
|
-
* objects.
|
|
113
|
-
*
|
|
114
|
-
* @param fields Array of `Field` objects describing multipart form fields to process.
|
|
115
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.
|
|
116
|
-
*/
|
|
117
|
-
fields(fields: MulterField[]): MulterHandler;
|
|
118
|
-
/**
|
|
119
|
-
* Returns middleware that processes all files contained in the multipart
|
|
120
|
-
* request.
|
|
121
|
-
*
|
|
122
|
-
* The `Request` object will be populated with a `files` array containing
|
|
123
|
-
* an information object for each processed file.
|
|
124
|
-
*/
|
|
125
|
-
any(): MulterHandler;
|
|
126
|
-
/**
|
|
127
|
-
* Returns middleware that accepts only non-file multipart form fields.
|
|
128
|
-
*
|
|
129
|
-
* @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.
|
|
130
|
-
*/
|
|
131
|
-
none(): MulterHandler;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export declare type PlatformMulter = TsED.Multer;
|
|
136
|
-
export declare type PlatformMulterSettings = TsED.MulterOptions;
|
|
137
|
-
export declare type PlatformMulterFile = TsED.MulterFile;
|
|
138
|
-
export declare type PlatformMulterField = TsED.MulterField;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Env } from "@tsed/core";
|
|
3
|
-
import Https from "https";
|
|
4
|
-
import { ConverterSettings } from "./ConverterSettings";
|
|
5
|
-
import { EndpointDirectoriesSettings } from "./EndpointDirectoriesSettings";
|
|
6
|
-
import { PlatformLoggerSettings } from "./PlatformLoggerSettings";
|
|
7
|
-
import { PlatformMulterSettings } from "./PlatformMulterSettings";
|
|
8
|
-
import { PlatformStaticsSettings } from "./PlatformStaticsSettings";
|
|
9
|
-
declare global {
|
|
10
|
-
namespace TsED {
|
|
11
|
-
interface LoggerConfiguration extends Partial<PlatformLoggerSettings> {
|
|
12
|
-
}
|
|
13
|
-
interface Configuration {
|
|
14
|
-
/**
|
|
15
|
-
* The root directory where you build run project. By default, it's equal to `process.cwd().
|
|
16
|
-
*/
|
|
17
|
-
rootDir: string;
|
|
18
|
-
/**
|
|
19
|
-
* The environment profile. By default the environment profile is equals to `NODE_ENV`.
|
|
20
|
-
*/
|
|
21
|
-
env: Env;
|
|
22
|
-
/**
|
|
23
|
-
* Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).
|
|
24
|
-
*/
|
|
25
|
-
port: string | number;
|
|
26
|
-
/**
|
|
27
|
-
* Port number for the [HTTP.Server](https://nodejs.org/api/http.html#http_class_http_server).
|
|
28
|
-
*/
|
|
29
|
-
httpPort: string | number | boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Port number for the [HTTPs.Server](https://nodejs.org/api/https.html#https_class_https_server).
|
|
32
|
-
*/
|
|
33
|
-
httpsPort: string | number | boolean;
|
|
34
|
-
/**
|
|
35
|
-
* [Https.ServerOptions](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)):
|
|
36
|
-
* - `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.
|
|
37
|
-
* - `passphrase` <string> A string containing the passphrase for the private key or pfx.
|
|
38
|
-
* - `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)
|
|
39
|
-
* - `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.
|
|
40
|
-
*/
|
|
41
|
-
httpsOptions: Https.ServerOptions;
|
|
42
|
-
/**
|
|
43
|
-
* Mount all controllers under a directories to an endpoint.
|
|
44
|
-
*/
|
|
45
|
-
mount: EndpointDirectoriesSettings;
|
|
46
|
-
/**
|
|
47
|
-
* List of directories to scan [Services](/docs/services.md), [Middlewares](/docs/middlewares.md) or [Converters](/docs/converters.md).
|
|
48
|
-
*/
|
|
49
|
-
componentsScan: (string | RegExp)[];
|
|
50
|
-
/**
|
|
51
|
-
* List of glob patterns. Exclude all files which matching with this list when Server scan all components with the `mount` or `scanComponents` options.
|
|
52
|
-
*/
|
|
53
|
-
exclude: string[];
|
|
54
|
-
/**
|
|
55
|
-
* Configure the mimes accepted by default by the server.
|
|
56
|
-
*/
|
|
57
|
-
acceptMimes: string[];
|
|
58
|
-
/**
|
|
59
|
-
* Enable debug mode. By default debug is false.
|
|
60
|
-
*/
|
|
61
|
-
debug: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Converter configuration.
|
|
64
|
-
*/
|
|
65
|
-
converter: Partial<ConverterSettings>;
|
|
66
|
-
/**
|
|
67
|
-
* Logger configuration.
|
|
68
|
-
*/
|
|
69
|
-
logger?: LoggerConfiguration;
|
|
70
|
-
/**
|
|
71
|
-
* Object to mount all directories under to his endpoints. See more on [Serve Static](/tutorials/serve-static-files.md).
|
|
72
|
-
*/
|
|
73
|
-
statics: PlatformStaticsSettings;
|
|
74
|
-
/**
|
|
75
|
-
* Object configure Multer. See more on [Upload file](/tutorials/serve-static-files.md).
|
|
76
|
-
*/
|
|
77
|
-
multer: PlatformMulterSettings;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export * from "./PlatformLoggerSettings";
|
|
82
|
-
export * from "./EndpointDirectoriesSettings";
|
|
83
|
-
export * from "./PlatformStaticsSettings";
|
|
84
|
-
export * from "./PlatformMulterSettings";
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import Http from "http";
|
|
4
|
-
/**
|
|
5
|
-
* Inject the Http.Server instance.
|
|
6
|
-
*
|
|
7
|
-
* ### Example
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import {HttpServer, Service} from "@tsed/common";
|
|
11
|
-
*
|
|
12
|
-
* @Service()
|
|
13
|
-
* export default class OtherService {
|
|
14
|
-
* constructor(@HttpServer httpServer: HttpServer) {}
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
19
|
-
*
|
|
20
|
-
* @param {Type<any>} target
|
|
21
|
-
* @param {string} targetKey
|
|
22
|
-
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
23
|
-
* @returns {any}
|
|
24
|
-
* @decorator
|
|
25
|
-
*/
|
|
26
|
-
export declare function HttpServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;
|
|
27
|
-
export declare type HttpServer = Http.Server;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Type } from "@tsed/core";
|
|
3
|
-
import Https from "https";
|
|
4
|
-
/**
|
|
5
|
-
* Inject the Https.Server instance.
|
|
6
|
-
*
|
|
7
|
-
* ### Example
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import {HttpsServer, Service} from "@tsed/common";
|
|
11
|
-
*
|
|
12
|
-
* @Service()
|
|
13
|
-
* export default class OtherService {
|
|
14
|
-
* constructor(@HttpsServer httpServer: HttpServer) {}
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
|
|
19
|
-
*
|
|
20
|
-
* @param {Type<any>} target
|
|
21
|
-
* @param {string} targetKey
|
|
22
|
-
* @param {TypedPropertyDescriptor<Function> | number} descriptor
|
|
23
|
-
* @returns {any}
|
|
24
|
-
* @decorator
|
|
25
|
-
*/
|
|
26
|
-
export declare function HttpsServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number): any;
|
|
27
|
-
export declare type HttpsServer = Https.Server;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./httpServer";
|
|
2
|
-
export * from "./httpsServer";
|
|
3
|
-
export * from "./multer";
|
|
4
|
-
export * from "./method/route";
|
|
5
|
-
export * from "./method/acceptMime";
|
|
6
|
-
export * from "./method/location";
|
|
7
|
-
export * from "./method/redirect";
|
|
8
|
-
export * from "./method/endpointFn";
|
|
9
|
-
export * from "./params/response";
|
|
10
|
-
export * from "./params/request";
|
|
11
|
-
export * from "./params/next";
|
|
12
|
-
export * from "./params/error";
|
|
13
|
-
export * from "../utils/mapReturnedResponse";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 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.
|
|
3
|
-
*
|
|
4
|
-
* ```typescript
|
|
5
|
-
* @Controller('/mypath')
|
|
6
|
-
* export class MyCtrl {
|
|
7
|
-
*
|
|
8
|
-
* @Get('/')
|
|
9
|
-
* @AcceptMime('application/json')
|
|
10
|
-
* public getResource(){}
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @param mimes
|
|
15
|
-
* @decorator
|
|
16
|
-
* @operation
|
|
17
|
-
* @response
|
|
18
|
-
*/
|
|
19
|
-
export declare function AcceptMime(...mimes: string[]): Function;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DecoratorParameters } from "@tsed/core";
|
|
2
|
-
import { EndpointMetadata } from "../../domain";
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param fn
|
|
6
|
-
* @decorator
|
|
7
|
-
*/
|
|
8
|
-
export declare function EndpointFn(fn: (endpoint: EndpointMetadata, parameters: DecoratorParameters) => void): MethodDecorator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Location } from "@tsed/schema";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Redirect } from "@tsed/schema";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Get, Post, Put, Patch, Delete, Head, Options, All } from "@tsed/schema";
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ControllerMiddlewares, Provider, TokenProvider } from "@tsed/di";
|
|
2
|
-
import { JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
import { PlatformRouterMethods } from "../interfaces/PlatformRouterMethods";
|
|
4
|
-
import { EndpointMetadata } from "./EndpointMetadata";
|
|
5
|
-
export declare class ControllerProvider<T = any> extends Provider<T> {
|
|
6
|
-
readonly entity: JsonEntityStore;
|
|
7
|
-
private router;
|
|
8
|
-
constructor(provide: TokenProvider, options?: Partial<Provider>);
|
|
9
|
-
get path(): string;
|
|
10
|
-
set path(path: string);
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @returns {EndpointMetadata[]}
|
|
14
|
-
*/
|
|
15
|
-
get endpoints(): EndpointMetadata[];
|
|
16
|
-
get children(): TokenProvider[];
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @returns {ControllerProvider}
|
|
20
|
-
*/
|
|
21
|
-
get parent(): TokenProvider | undefined;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
get routerOptions(): any;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param value
|
|
29
|
-
*/
|
|
30
|
-
set routerOptions(value: any);
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @returns {any[]}
|
|
34
|
-
*/
|
|
35
|
-
get middlewares(): ControllerMiddlewares;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @param middlewares
|
|
39
|
-
*/
|
|
40
|
-
set middlewares(middlewares: ControllerMiddlewares);
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @returns {boolean}
|
|
44
|
-
*/
|
|
45
|
-
hasChildren(): boolean;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @returns {boolean}
|
|
49
|
-
*/
|
|
50
|
-
hasParent(): boolean;
|
|
51
|
-
getRouter<T extends PlatformRouterMethods = any>(): T;
|
|
52
|
-
setRouter(router: PlatformRouterMethods): this;
|
|
53
|
-
}
|