@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.
Files changed (414) hide show
  1. package/lib/cjs/builder/PlatformBuilder.js +281 -0
  2. package/lib/cjs/builder/PlatformBuilder.js.map +1 -0
  3. package/lib/cjs/builder/PlatformControllerBuilder.js +82 -0
  4. package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -0
  5. package/lib/cjs/config/interfaces/ConverterSettings.js +3 -0
  6. package/lib/cjs/config/interfaces/ConverterSettings.js.map +1 -0
  7. package/lib/cjs/config/interfaces/PlatformLoggerSettings.js +3 -0
  8. package/lib/cjs/config/interfaces/PlatformLoggerSettings.js.map +1 -0
  9. package/lib/cjs/config/interfaces/PlatformMulterSettings.js +3 -0
  10. package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -0
  11. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +3 -0
  12. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +1 -0
  13. package/lib/cjs/config/services/PlatformConfiguration.js +187 -0
  14. package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -0
  15. package/lib/cjs/constants/routerOptions.js +5 -0
  16. package/lib/cjs/constants/routerOptions.js.map +1 -0
  17. package/lib/cjs/decorators/multer/multerFileSize.js +35 -0
  18. package/lib/cjs/decorators/multer/multerFileSize.js.map +1 -0
  19. package/lib/cjs/decorators/multer/multerOptions.js +52 -0
  20. package/lib/cjs/decorators/multer/multerOptions.js.map +1 -0
  21. package/lib/cjs/decorators/multer/multipartFile.js +78 -0
  22. package/lib/cjs/decorators/multer/multipartFile.js.map +1 -0
  23. package/lib/cjs/decorators/params/error.js +20 -0
  24. package/lib/cjs/decorators/params/error.js.map +1 -0
  25. package/lib/cjs/decorators/params/next.js +21 -0
  26. package/lib/cjs/decorators/params/next.js.map +1 -0
  27. package/lib/cjs/decorators/params/request.js +39 -0
  28. package/lib/cjs/decorators/params/request.js.map +1 -0
  29. package/lib/cjs/decorators/params/response.js +33 -0
  30. package/lib/cjs/decorators/params/response.js.map +1 -0
  31. package/lib/cjs/domain/AnyToPromiseWithCtx.js +27 -0
  32. package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -0
  33. package/lib/cjs/domain/ControllerProvider.js +51 -0
  34. package/lib/cjs/domain/ControllerProvider.js.map +1 -0
  35. package/lib/cjs/domain/EndpointMetadata.js +6 -0
  36. package/lib/cjs/domain/EndpointMetadata.js.map +1 -0
  37. package/lib/cjs/domain/HandlerMetadata.js +57 -0
  38. package/lib/cjs/domain/HandlerMetadata.js.map +1 -0
  39. package/lib/cjs/domain/PlatformContext.js +92 -0
  40. package/lib/cjs/domain/PlatformContext.js.map +1 -0
  41. package/lib/cjs/domain/PlatformRouteDetails.js +24 -0
  42. package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -0
  43. package/lib/cjs/exports.js +31 -0
  44. package/lib/cjs/exports.js.map +1 -0
  45. package/lib/cjs/index.js +68 -0
  46. package/lib/cjs/index.js.map +1 -0
  47. package/lib/cjs/interfaces/AfterInit.js +3 -0
  48. package/lib/cjs/interfaces/AfterInit.js.map +1 -0
  49. package/lib/cjs/interfaces/AfterListen.js +3 -0
  50. package/lib/cjs/interfaces/AfterListen.js.map +1 -0
  51. package/lib/cjs/interfaces/AfterRoutesInit.js +3 -0
  52. package/lib/cjs/interfaces/AfterRoutesInit.js.map +1 -0
  53. package/lib/cjs/interfaces/BeforeInit.js +3 -0
  54. package/lib/cjs/interfaces/BeforeInit.js.map +1 -0
  55. package/lib/cjs/interfaces/BeforeListen.js +3 -0
  56. package/lib/cjs/interfaces/BeforeListen.js.map +1 -0
  57. package/lib/cjs/interfaces/BeforeRoutesInit.js +3 -0
  58. package/lib/cjs/interfaces/BeforeRoutesInit.js.map +1 -0
  59. package/lib/cjs/interfaces/HandlerType.js +17 -0
  60. package/lib/cjs/interfaces/HandlerType.js.map +1 -0
  61. package/lib/cjs/interfaces/IncomingEvent.js +3 -0
  62. package/lib/cjs/interfaces/IncomingEvent.js.map +1 -0
  63. package/lib/cjs/interfaces/OnReady.js +3 -0
  64. package/lib/cjs/interfaces/OnReady.js.map +1 -0
  65. package/lib/cjs/interfaces/OnRequest.js +3 -0
  66. package/lib/cjs/interfaces/OnRequest.js.map +1 -0
  67. package/lib/cjs/interfaces/OnResponse.js +3 -0
  68. package/lib/cjs/interfaces/OnResponse.js.map +1 -0
  69. package/lib/cjs/interfaces/OnRoutesInit.js +3 -0
  70. package/lib/cjs/interfaces/OnRoutesInit.js.map +1 -0
  71. package/lib/cjs/interfaces/PlatformRouteOptions.js +3 -0
  72. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -0
  73. package/lib/cjs/interfaces/ResponseErrorObject.js +3 -0
  74. package/lib/cjs/interfaces/ResponseErrorObject.js.map +1 -0
  75. package/lib/cjs/interfaces/Route.js +3 -0
  76. package/lib/cjs/interfaces/Route.js.map +1 -0
  77. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
  78. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  79. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +67 -0
  80. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -0
  81. package/lib/cjs/middlewares/__mock__/FakeCtrl.js +12 -0
  82. package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +1 -0
  83. package/lib/cjs/middlewares/bindEndpointMiddleware.js +13 -0
  84. package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -0
  85. package/lib/cjs/package.json +3 -0
  86. package/lib/cjs/services/FakeAdapter.js +55 -0
  87. package/lib/cjs/services/FakeAdapter.js.map +1 -0
  88. package/lib/cjs/services/Platform.js +128 -0
  89. package/lib/cjs/services/Platform.js.map +1 -0
  90. package/lib/cjs/services/PlatformAdapter.js +14 -0
  91. package/lib/cjs/services/PlatformAdapter.js.map +1 -0
  92. package/lib/cjs/services/PlatformApplication.js +32 -0
  93. package/lib/cjs/services/PlatformApplication.js.map +1 -0
  94. package/lib/cjs/services/PlatformHandler.js +235 -0
  95. package/lib/cjs/services/PlatformHandler.js.map +1 -0
  96. package/lib/cjs/services/PlatformMiddlewaresChain.js +75 -0
  97. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -0
  98. package/lib/cjs/services/PlatformRequest.js +138 -0
  99. package/lib/cjs/services/PlatformRequest.js.map +1 -0
  100. package/lib/cjs/services/PlatformResponse.js +271 -0
  101. package/lib/cjs/services/PlatformResponse.js.map +1 -0
  102. package/lib/cjs/services/PlatformRouter.js +108 -0
  103. package/lib/cjs/services/PlatformRouter.js.map +1 -0
  104. package/lib/cjs/services/PlatformTest.js +173 -0
  105. package/lib/cjs/services/PlatformTest.js.map +1 -0
  106. package/lib/cjs/utils/__mock__/Test1.js +8 -0
  107. package/lib/cjs/utils/__mock__/Test1.js.map +1 -0
  108. package/lib/cjs/utils/__mock__/Test2.js +8 -0
  109. package/lib/cjs/utils/__mock__/Test2.js.map +1 -0
  110. package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js +12 -0
  111. package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  112. package/lib/cjs/utils/__mock__/module1/Module1.js +19 -0
  113. package/lib/cjs/utils/__mock__/module1/Module1.js.map +1 -0
  114. package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js +17 -0
  115. package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  116. package/lib/cjs/utils/__mock__/module1/services/M1Service.js +17 -0
  117. package/lib/cjs/utils/__mock__/module1/services/M1Service.js.map +1 -0
  118. package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js +15 -0
  119. package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
  120. package/lib/cjs/utils/__mock__/module1/submodule/SubService.js +12 -0
  121. package/lib/cjs/utils/__mock__/module1/submodule/SubService.js.map +1 -0
  122. package/lib/cjs/utils/__mock__/module2/Module2.js +18 -0
  123. package/lib/cjs/utils/__mock__/module2/Module2.js.map +1 -0
  124. package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js +12 -0
  125. package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  126. package/lib/cjs/utils/createContext.js +38 -0
  127. package/lib/cjs/utils/createContext.js.map +1 -0
  128. package/lib/cjs/utils/createHandlerMetadata.js +49 -0
  129. package/lib/cjs/utils/createHandlerMetadata.js.map +1 -0
  130. package/lib/cjs/utils/createHttpServer.js +29 -0
  131. package/lib/cjs/utils/createHttpServer.js.map +1 -0
  132. package/lib/cjs/utils/createHttpsServer.js +29 -0
  133. package/lib/cjs/utils/createHttpsServer.js.map +1 -0
  134. package/lib/cjs/utils/createInjector.js +46 -0
  135. package/lib/cjs/utils/createInjector.js.map +1 -0
  136. package/lib/cjs/utils/getConfiguration.js +46 -0
  137. package/lib/cjs/utils/getConfiguration.js.map +1 -0
  138. package/lib/cjs/utils/getStaticsOptions.js +21 -0
  139. package/lib/cjs/utils/getStaticsOptions.js.map +1 -0
  140. package/lib/cjs/utils/listenServer.js +21 -0
  141. package/lib/cjs/utils/listenServer.js.map +1 -0
  142. package/lib/cjs/utils/mapReturnedResponse.js +15 -0
  143. package/lib/cjs/utils/mapReturnedResponse.js.map +1 -0
  144. package/lib/cjs/utils/printRoutes.js +36 -0
  145. package/lib/cjs/utils/printRoutes.js.map +1 -0
  146. package/lib/cjs/utils/setResponseHeaders.js +35 -0
  147. package/lib/cjs/utils/setResponseHeaders.js.map +1 -0
  148. package/lib/cjs/utils/useCtxHandler.js +15 -0
  149. package/lib/cjs/utils/useCtxHandler.js.map +1 -0
  150. package/lib/esm/builder/PlatformBuilder.js +277 -0
  151. package/lib/esm/builder/PlatformBuilder.js.map +1 -0
  152. package/lib/esm/builder/PlatformControllerBuilder.js +76 -0
  153. package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -0
  154. package/lib/esm/config/interfaces/ConverterSettings.js +2 -0
  155. package/lib/esm/config/interfaces/ConverterSettings.js.map +1 -0
  156. package/lib/esm/config/interfaces/PlatformLoggerSettings.js +2 -0
  157. package/lib/esm/config/interfaces/PlatformLoggerSettings.js.map +1 -0
  158. package/lib/esm/config/interfaces/PlatformMulterSettings.js +2 -0
  159. package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -0
  160. package/lib/esm/config/interfaces/PlatformStaticsSettings.js +2 -0
  161. package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +1 -0
  162. package/lib/esm/config/services/PlatformConfiguration.js +184 -0
  163. package/lib/esm/config/services/PlatformConfiguration.js.map +1 -0
  164. package/lib/esm/constants/routerOptions.js +2 -0
  165. package/lib/esm/constants/routerOptions.js.map +1 -0
  166. package/lib/esm/decorators/multer/multerFileSize.js +31 -0
  167. package/lib/esm/decorators/multer/multerFileSize.js.map +1 -0
  168. package/lib/esm/decorators/multer/multerOptions.js +48 -0
  169. package/lib/esm/decorators/multer/multerOptions.js.map +1 -0
  170. package/lib/esm/decorators/multer/multipartFile.js +74 -0
  171. package/lib/esm/decorators/multer/multipartFile.js.map +1 -0
  172. package/lib/esm/decorators/params/error.js +16 -0
  173. package/lib/esm/decorators/params/error.js.map +1 -0
  174. package/lib/esm/decorators/params/next.js +17 -0
  175. package/lib/esm/decorators/params/next.js.map +1 -0
  176. package/lib/esm/decorators/params/request.js +34 -0
  177. package/lib/esm/decorators/params/request.js.map +1 -0
  178. package/lib/esm/decorators/params/response.js +28 -0
  179. package/lib/esm/decorators/params/response.js.map +1 -0
  180. package/lib/esm/domain/AnyToPromiseWithCtx.js +23 -0
  181. package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -0
  182. package/lib/esm/domain/ControllerProvider.js +47 -0
  183. package/lib/esm/domain/ControllerProvider.js.map +1 -0
  184. package/lib/esm/domain/EndpointMetadata.js +2 -0
  185. package/lib/esm/domain/EndpointMetadata.js.map +1 -0
  186. package/lib/esm/domain/HandlerMetadata.js +53 -0
  187. package/lib/esm/domain/HandlerMetadata.js.map +1 -0
  188. package/lib/esm/domain/PlatformContext.js +88 -0
  189. package/lib/esm/domain/PlatformContext.js.map +1 -0
  190. package/lib/esm/domain/PlatformRouteDetails.js +20 -0
  191. package/lib/esm/domain/PlatformRouteDetails.js.map +1 -0
  192. package/lib/esm/exports.js +13 -0
  193. package/lib/esm/exports.js.map +1 -0
  194. package/lib/esm/index.js +65 -0
  195. package/lib/esm/index.js.map +1 -0
  196. package/lib/esm/interfaces/AfterInit.js +2 -0
  197. package/lib/esm/interfaces/AfterInit.js.map +1 -0
  198. package/lib/esm/interfaces/AfterListen.js +2 -0
  199. package/lib/esm/interfaces/AfterListen.js.map +1 -0
  200. package/lib/esm/interfaces/AfterRoutesInit.js +2 -0
  201. package/lib/esm/interfaces/AfterRoutesInit.js.map +1 -0
  202. package/lib/esm/interfaces/BeforeInit.js +2 -0
  203. package/lib/esm/interfaces/BeforeInit.js.map +1 -0
  204. package/lib/esm/interfaces/BeforeListen.js +2 -0
  205. package/lib/esm/interfaces/BeforeListen.js.map +1 -0
  206. package/lib/esm/interfaces/BeforeRoutesInit.js +2 -0
  207. package/lib/esm/interfaces/BeforeRoutesInit.js.map +1 -0
  208. package/lib/esm/interfaces/HandlerType.js +14 -0
  209. package/lib/esm/interfaces/HandlerType.js.map +1 -0
  210. package/lib/esm/interfaces/IncomingEvent.js +2 -0
  211. package/lib/esm/interfaces/IncomingEvent.js.map +1 -0
  212. package/lib/esm/interfaces/OnReady.js +2 -0
  213. package/lib/esm/interfaces/OnReady.js.map +1 -0
  214. package/lib/esm/interfaces/OnRequest.js +2 -0
  215. package/lib/esm/interfaces/OnRequest.js.map +1 -0
  216. package/lib/esm/interfaces/OnResponse.js +2 -0
  217. package/lib/esm/interfaces/OnResponse.js.map +1 -0
  218. package/lib/esm/interfaces/OnRoutesInit.js +2 -0
  219. package/lib/esm/interfaces/OnRoutesInit.js.map +1 -0
  220. package/lib/esm/interfaces/PlatformRouteOptions.js +2 -0
  221. package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -0
  222. package/lib/esm/interfaces/ResponseErrorObject.js +2 -0
  223. package/lib/esm/interfaces/ResponseErrorObject.js.map +1 -0
  224. package/lib/esm/interfaces/Route.js +2 -0
  225. package/lib/esm/interfaces/Route.js.map +1 -0
  226. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +34 -0
  227. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  228. package/lib/esm/middlewares/PlatformMulterMiddleware.js +63 -0
  229. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -0
  230. package/lib/esm/middlewares/__mock__/FakeCtrl.js +9 -0
  231. package/lib/esm/middlewares/__mock__/FakeCtrl.js.map +1 -0
  232. package/lib/esm/middlewares/bindEndpointMiddleware.js +9 -0
  233. package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -0
  234. package/lib/esm/package.json +3 -0
  235. package/lib/esm/services/FakeAdapter.js +51 -0
  236. package/lib/esm/services/FakeAdapter.js.map +1 -0
  237. package/lib/esm/services/Platform.js +125 -0
  238. package/lib/esm/services/Platform.js.map +1 -0
  239. package/lib/esm/services/PlatformAdapter.js +10 -0
  240. package/lib/esm/services/PlatformAdapter.js.map +1 -0
  241. package/lib/esm/services/PlatformApplication.js +29 -0
  242. package/lib/esm/services/PlatformApplication.js.map +1 -0
  243. package/lib/esm/services/PlatformHandler.js +232 -0
  244. package/lib/esm/services/PlatformHandler.js.map +1 -0
  245. package/lib/esm/services/PlatformMiddlewaresChain.js +72 -0
  246. package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -0
  247. package/lib/esm/services/PlatformRequest.js +135 -0
  248. package/lib/esm/services/PlatformRequest.js.map +1 -0
  249. package/lib/esm/services/PlatformResponse.js +268 -0
  250. package/lib/esm/services/PlatformResponse.js.map +1 -0
  251. package/lib/esm/services/PlatformRouter.js +105 -0
  252. package/lib/esm/services/PlatformRouter.js.map +1 -0
  253. package/lib/esm/services/PlatformTest.js +168 -0
  254. package/lib/esm/services/PlatformTest.js.map +1 -0
  255. package/lib/esm/utils/__mock__/Test1.js +4 -0
  256. package/lib/esm/utils/__mock__/Test1.js.map +1 -0
  257. package/lib/esm/utils/__mock__/Test2.js +4 -0
  258. package/lib/esm/utils/__mock__/Test2.js.map +1 -0
  259. package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js +9 -0
  260. package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  261. package/lib/esm/utils/__mock__/module1/Module1.js +16 -0
  262. package/lib/esm/utils/__mock__/module1/Module1.js.map +1 -0
  263. package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js +14 -0
  264. package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  265. package/lib/esm/utils/__mock__/module1/services/M1Service.js +14 -0
  266. package/lib/esm/utils/__mock__/module1/services/M1Service.js.map +1 -0
  267. package/lib/esm/utils/__mock__/module1/submodule/SubModule.js +12 -0
  268. package/lib/esm/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
  269. package/lib/esm/utils/__mock__/module1/submodule/SubService.js +9 -0
  270. package/lib/esm/utils/__mock__/module1/submodule/SubService.js.map +1 -0
  271. package/lib/esm/utils/__mock__/module2/Module2.js +15 -0
  272. package/lib/esm/utils/__mock__/module2/Module2.js.map +1 -0
  273. package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js +9 -0
  274. package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  275. package/lib/esm/utils/createContext.js +34 -0
  276. package/lib/esm/utils/createContext.js.map +1 -0
  277. package/lib/esm/utils/createHandlerMetadata.js +45 -0
  278. package/lib/esm/utils/createHandlerMetadata.js.map +1 -0
  279. package/lib/esm/utils/createHttpServer.js +24 -0
  280. package/lib/esm/utils/createHttpServer.js.map +1 -0
  281. package/lib/esm/utils/createHttpsServer.js +24 -0
  282. package/lib/esm/utils/createHttpsServer.js.map +1 -0
  283. package/lib/esm/utils/createInjector.js +42 -0
  284. package/lib/esm/utils/createInjector.js.map +1 -0
  285. package/lib/esm/utils/getConfiguration.js +42 -0
  286. package/lib/esm/utils/getConfiguration.js.map +1 -0
  287. package/lib/esm/utils/getStaticsOptions.js +17 -0
  288. package/lib/esm/utils/getStaticsOptions.js.map +1 -0
  289. package/lib/esm/utils/listenServer.js +17 -0
  290. package/lib/esm/utils/listenServer.js.map +1 -0
  291. package/lib/esm/utils/mapReturnedResponse.js +11 -0
  292. package/lib/esm/utils/mapReturnedResponse.js.map +1 -0
  293. package/lib/esm/utils/printRoutes.js +32 -0
  294. package/lib/esm/utils/printRoutes.js.map +1 -0
  295. package/lib/esm/utils/setResponseHeaders.js +31 -0
  296. package/lib/esm/utils/setResponseHeaders.js.map +1 -0
  297. package/lib/esm/utils/useCtxHandler.js +11 -0
  298. package/lib/esm/utils/useCtxHandler.js.map +1 -0
  299. package/lib/{builder → types/builder}/PlatformBuilder.d.ts +30 -34
  300. package/lib/types/builder/PlatformControllerBuilder.d.ts +18 -0
  301. package/lib/{config → types/config}/interfaces/ConverterSettings.d.ts +0 -0
  302. package/lib/{config → types/config}/interfaces/PlatformLoggerSettings.d.ts +0 -0
  303. package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +14 -0
  304. package/lib/{config → types/config}/interfaces/PlatformStaticsSettings.d.ts +1 -0
  305. package/lib/{config → types/config}/services/PlatformConfiguration.d.ts +24 -17
  306. package/lib/{constants → types/constants}/routerOptions.d.ts +0 -0
  307. package/lib/{decorators → types/decorators}/multer/multerFileSize.d.ts +0 -0
  308. package/lib/{decorators → types/decorators}/multer/multerOptions.d.ts +0 -0
  309. package/lib/{decorators → types/decorators}/multer/multipartFile.d.ts +0 -0
  310. package/lib/{decorators → types/decorators}/params/error.d.ts +0 -0
  311. package/lib/{decorators → types/decorators}/params/next.d.ts +0 -0
  312. package/lib/{decorators → types/decorators}/params/request.d.ts +0 -0
  313. package/lib/{decorators → types/decorators}/params/response.d.ts +0 -0
  314. package/lib/{domain → types/domain}/AnyToPromiseWithCtx.d.ts +0 -0
  315. package/lib/types/domain/ControllerProvider.d.ts +24 -0
  316. package/lib/types/domain/EndpointMetadata.d.ts +1 -0
  317. package/lib/{domain → types/domain}/HandlerMetadata.d.ts +2 -2
  318. package/lib/{domain → types/domain}/PlatformContext.d.ts +1 -1
  319. package/lib/types/domain/PlatformRouteDetails.d.ts +22 -0
  320. package/lib/types/exports.d.ts +12 -0
  321. package/lib/types/index.d.ts +64 -0
  322. package/lib/{interfaces → types/interfaces}/AfterInit.d.ts +0 -0
  323. package/lib/{interfaces → types/interfaces}/AfterListen.d.ts +0 -0
  324. package/lib/{interfaces → types/interfaces}/AfterRoutesInit.d.ts +0 -0
  325. package/lib/{interfaces → types/interfaces}/BeforeInit.d.ts +0 -0
  326. package/lib/{interfaces → types/interfaces}/BeforeListen.d.ts +0 -0
  327. package/lib/{interfaces → types/interfaces}/BeforeRoutesInit.d.ts +0 -0
  328. package/lib/{interfaces → types/interfaces}/HandlerType.d.ts +0 -0
  329. package/lib/{interfaces → types/interfaces}/IncomingEvent.d.ts +0 -0
  330. package/lib/{interfaces → types/interfaces}/OnReady.d.ts +0 -0
  331. package/lib/{interfaces → types/interfaces}/OnRequest.d.ts +0 -0
  332. package/lib/{interfaces → types/interfaces}/OnResponse.d.ts +0 -0
  333. package/lib/{interfaces → types/interfaces}/OnRoutesInit.d.ts +0 -0
  334. package/lib/{interfaces → types/interfaces}/PlatformRouteOptions.d.ts +5 -3
  335. package/lib/{interfaces → types/interfaces}/ResponseErrorObject.d.ts +0 -0
  336. package/lib/{interfaces → types/interfaces}/Route.d.ts +0 -0
  337. package/lib/{middlewares → types/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
  338. package/lib/{middlewares → types/middlewares}/PlatformMulterMiddleware.d.ts +8 -3
  339. package/lib/{middlewares/data → types/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
  340. package/lib/types/middlewares/bindEndpointMiddleware.d.ts +6 -0
  341. package/lib/types/services/FakeAdapter.d.ts +30 -0
  342. package/lib/{services → types/services}/Platform.d.ts +22 -7
  343. package/lib/types/services/PlatformAdapter.d.ts +47 -0
  344. package/lib/{services → types/services}/PlatformApplication.d.ts +3 -3
  345. package/lib/{services → types/services}/PlatformHandler.d.ts +1 -1
  346. package/lib/types/services/PlatformMiddlewaresChain.d.ts +10 -0
  347. package/lib/{services → types/services}/PlatformRequest.d.ts +2 -1
  348. package/lib/{services → types/services}/PlatformResponse.d.ts +10 -10
  349. package/lib/{services → types/services}/PlatformRouter.d.ts +12 -8
  350. package/lib/{services → types/services}/PlatformTest.d.ts +6 -5
  351. package/lib/types/utils/__mock__/Test1.d.ts +3 -0
  352. package/lib/types/utils/__mock__/Test2.d.ts +3 -0
  353. package/lib/types/utils/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
  354. package/lib/types/utils/__mock__/module1/Module1.d.ts +2 -0
  355. package/lib/types/utils/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
  356. package/lib/types/utils/__mock__/module1/services/M1Service.d.ts +5 -0
  357. package/lib/types/utils/__mock__/module1/submodule/SubModule.d.ts +2 -0
  358. package/lib/types/utils/__mock__/module1/submodule/SubService.d.ts +2 -0
  359. package/lib/types/utils/__mock__/module2/Module2.d.ts +2 -0
  360. package/lib/types/utils/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
  361. package/lib/{utils → types/utils}/createContext.d.ts +0 -0
  362. package/lib/{utils → types/utils}/createHandlerMetadata.d.ts +1 -1
  363. package/lib/types/utils/createHttpServer.d.ts +4 -0
  364. package/lib/types/utils/createHttpsServer.d.ts +5 -0
  365. package/lib/types/utils/createInjector.d.ts +9 -0
  366. package/lib/types/utils/getConfiguration.d.ts +2 -0
  367. package/lib/types/utils/getStaticsOptions.d.ts +5 -0
  368. package/lib/types/utils/listenServer.d.ts +7 -0
  369. package/lib/{utils → types/utils}/mapReturnedResponse.d.ts +0 -0
  370. package/lib/{utils → types/utils}/printRoutes.d.ts +0 -0
  371. package/lib/{utils → types/utils}/setResponseHeaders.d.ts +0 -0
  372. package/lib/{utils → types/utils}/useCtxHandler.d.ts +0 -0
  373. package/package.json +47 -34
  374. package/readme.md +50 -57
  375. package/tsconfig.compile.esm.json +13 -0
  376. package/lib/PlatformModule.d.ts +0 -15
  377. package/lib/builder/PlatformControllerBuilder.d.ts +0 -19
  378. package/lib/config/index.d.ts +0 -3
  379. package/lib/config/interfaces/EndpointDirectoriesSettings.d.ts +0 -3
  380. package/lib/config/interfaces/PlatformMulterSettings.d.ts +0 -138
  381. package/lib/config/interfaces/index.d.ts +0 -84
  382. package/lib/decorators/httpServer.d.ts +0 -27
  383. package/lib/decorators/httpsServer.d.ts +0 -27
  384. package/lib/decorators/index.d.ts +0 -13
  385. package/lib/decorators/method/acceptMime.d.ts +0 -19
  386. package/lib/decorators/method/endpointFn.d.ts +0 -8
  387. package/lib/decorators/method/location.d.ts +0 -1
  388. package/lib/decorators/method/redirect.d.ts +0 -1
  389. package/lib/decorators/method/route.d.ts +0 -1
  390. package/lib/decorators/multer/index.d.ts +0 -3
  391. package/lib/domain/ControllerProvider.d.ts +0 -53
  392. package/lib/domain/EndpointMetadata.d.ts +0 -88
  393. package/lib/domain/PlatformRouteDetails.d.ts +0 -29
  394. package/lib/domain/index.d.ts +0 -6
  395. package/lib/index.d.ts +0 -22
  396. package/lib/index.js +0 -3651
  397. package/lib/index.js.map +0 -1
  398. package/lib/index.modern.js +0 -3464
  399. package/lib/index.modern.js.map +0 -1
  400. package/lib/interfaces/PathType.d.ts +0 -1
  401. package/lib/interfaces/PlatformRouterMethods.d.ts +0 -10
  402. package/lib/interfaces/index.d.ts +0 -17
  403. package/lib/middlewares/bindEndpointMiddleware.d.ts +0 -5
  404. package/lib/middlewares/index.d.ts +0 -3
  405. package/lib/registries/ControllerRegistry.d.ts +0 -1
  406. package/lib/services/FakeRawDriver.d.ts +0 -15
  407. package/lib/services/index.d.ts +0 -7
  408. package/lib/utils/createHttpServer.d.ts +0 -3
  409. package/lib/utils/createHttpsServer.d.ts +0 -3
  410. package/lib/utils/createInjector.d.ts +0 -2
  411. package/lib/utils/createPlatformApplication.d.ts +0 -2
  412. package/lib/utils/getControllerPath.d.ts +0 -2
  413. package/lib/utils/index.d.ts +0 -8
  414. 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
- * 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.
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 * as Path from "path";
79
-
80
- export const rootDir = Path.resolve(__dirname);
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
- rootDir,
84
- port: 3000
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 {Returns, ReturnsArray, Controller, Get, QueryParams, PathParams, Delete, Post, Required, BodyParams, Status, Put} from "@tsed/common";
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
- return this.usersService.findById(id);
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 ): Promise<User> {
181
- await this.usersService.delete(user);
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
+ }
@@ -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
- }
@@ -1,3 +0,0 @@
1
- export * from "./interfaces";
2
- export * from "./services/PlatformConfiguration";
3
- export * from "./services/PlatformConfiguration";
@@ -1,3 +0,0 @@
1
- export interface EndpointDirectoriesSettings {
2
- [endpoint: string]: any | string | (any | string)[];
3
- }
@@ -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` &lt;string&gt; | &lt;string[]&gt; | [&lt;Buffer&gt;](https://nodejs.org/api/buffer.html#buffer_class_buffer) | &lt;Object[]&gt;: 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` &lt;string&gt; A string containing the passphrase for the private key or pfx.
38
- * - `cert` &lt;string&gt; | &lt;string[]&gt; | [&lt;Buffer&gt;](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [&lt;Buffer[]&gt;](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` &lt;string&gt; | &lt;string[]&gt; | [&lt;Buffer&gt;](https://nodejs.org/api/buffer.html#buffer_class_buffer) | [&lt;Buffer[]&gt;](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,3 +0,0 @@
1
- export * from "./multerFileSize";
2
- export * from "./multerOptions";
3
- export * from "./multipartFile";
@@ -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
- }