@tsed/common 7.0.0-alpha.2 → 7.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/lib/cjs/builder/PlatformBuilder.js +275 -0
  2. package/lib/cjs/builder/PlatformBuilder.js.map +1 -0
  3. package/lib/cjs/builder/PlatformControllerBuilder.js +85 -0
  4. package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -0
  5. package/lib/cjs/config/index.js +7 -0
  6. package/lib/cjs/config/index.js.map +1 -0
  7. package/lib/cjs/config/interfaces/ConverterSettings.js +3 -0
  8. package/lib/cjs/config/interfaces/ConverterSettings.js.map +1 -0
  9. package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js +3 -0
  10. package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
  11. package/lib/cjs/config/interfaces/PlatformLoggerSettings.js +3 -0
  12. package/lib/cjs/config/interfaces/PlatformLoggerSettings.js.map +1 -0
  13. package/lib/cjs/config/interfaces/PlatformMulterSettings.js +3 -0
  14. package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -0
  15. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +3 -0
  16. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +1 -0
  17. package/lib/cjs/config/interfaces/index.js +8 -0
  18. package/lib/cjs/config/interfaces/index.js.map +1 -0
  19. package/lib/cjs/config/services/PlatformConfiguration.js +181 -0
  20. package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -0
  21. package/lib/cjs/constants/routerOptions.js +5 -0
  22. package/lib/cjs/constants/routerOptions.js.map +1 -0
  23. package/lib/cjs/decorators/httpServer.js +32 -0
  24. package/lib/cjs/decorators/httpServer.js.map +1 -0
  25. package/lib/cjs/decorators/httpsServer.js +32 -0
  26. package/lib/cjs/decorators/httpsServer.js.map +1 -0
  27. package/lib/cjs/decorators/index.js +21 -0
  28. package/lib/cjs/decorators/index.js.map +1 -0
  29. package/lib/cjs/decorators/method/acceptMime.js +28 -0
  30. package/lib/cjs/decorators/method/acceptMime.js.map +1 -0
  31. package/lib/cjs/decorators/method/endpointFn.js +15 -0
  32. package/lib/cjs/decorators/method/endpointFn.js.map +1 -0
  33. package/lib/cjs/decorators/method/location.js +6 -0
  34. package/lib/cjs/decorators/method/location.js.map +1 -0
  35. package/lib/cjs/decorators/method/redirect.js +6 -0
  36. package/lib/cjs/decorators/method/redirect.js.map +1 -0
  37. package/lib/cjs/decorators/method/route.js +13 -0
  38. package/lib/cjs/decorators/method/route.js.map +1 -0
  39. package/lib/cjs/decorators/method/view.js +34 -0
  40. package/lib/cjs/decorators/method/view.js.map +1 -0
  41. package/lib/cjs/decorators/multer/index.js +7 -0
  42. package/lib/cjs/decorators/multer/index.js.map +1 -0
  43. package/lib/cjs/decorators/multer/multerFileSize.js +35 -0
  44. package/lib/cjs/decorators/multer/multerFileSize.js.map +1 -0
  45. package/lib/cjs/decorators/multer/multerOptions.js +52 -0
  46. package/lib/cjs/decorators/multer/multerOptions.js.map +1 -0
  47. package/lib/cjs/decorators/multer/multipartFile.js +78 -0
  48. package/lib/cjs/decorators/multer/multipartFile.js.map +1 -0
  49. package/lib/cjs/decorators/params/error.js +20 -0
  50. package/lib/cjs/decorators/params/error.js.map +1 -0
  51. package/lib/cjs/decorators/params/next.js +21 -0
  52. package/lib/cjs/decorators/params/next.js.map +1 -0
  53. package/lib/cjs/decorators/params/request.js +39 -0
  54. package/lib/cjs/decorators/params/request.js.map +1 -0
  55. package/lib/cjs/decorators/params/response.js +33 -0
  56. package/lib/cjs/decorators/params/response.js.map +1 -0
  57. package/lib/cjs/domain/AnyToPromiseWithCtx.js +27 -0
  58. package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -0
  59. package/lib/cjs/domain/ControllerProvider.js +51 -0
  60. package/lib/cjs/domain/ControllerProvider.js.map +1 -0
  61. package/lib/cjs/domain/EndpointMetadata.js +70 -0
  62. package/lib/cjs/domain/EndpointMetadata.js.map +1 -0
  63. package/lib/cjs/domain/HandlerMetadata.js +57 -0
  64. package/lib/cjs/domain/HandlerMetadata.js.map +1 -0
  65. package/lib/cjs/domain/PlatformContext.js +92 -0
  66. package/lib/cjs/domain/PlatformContext.js.map +1 -0
  67. package/lib/cjs/domain/PlatformRouteDetails.js +24 -0
  68. package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -0
  69. package/lib/cjs/domain/index.js +10 -0
  70. package/lib/cjs/domain/index.js.map +1 -0
  71. package/lib/cjs/index.js +34 -0
  72. package/lib/cjs/index.js.map +1 -0
  73. package/lib/cjs/interfaces/AfterInit.js +3 -0
  74. package/lib/cjs/interfaces/AfterInit.js.map +1 -0
  75. package/lib/cjs/interfaces/AfterListen.js +3 -0
  76. package/lib/cjs/interfaces/AfterListen.js.map +1 -0
  77. package/lib/cjs/interfaces/AfterRoutesInit.js +3 -0
  78. package/lib/cjs/interfaces/AfterRoutesInit.js.map +1 -0
  79. package/lib/cjs/interfaces/BeforeInit.js +3 -0
  80. package/lib/cjs/interfaces/BeforeInit.js.map +1 -0
  81. package/lib/cjs/interfaces/BeforeListen.js +3 -0
  82. package/lib/cjs/interfaces/BeforeListen.js.map +1 -0
  83. package/lib/cjs/interfaces/BeforeRoutesInit.js +3 -0
  84. package/lib/cjs/interfaces/BeforeRoutesInit.js.map +1 -0
  85. package/lib/cjs/interfaces/HandlerType.js +17 -0
  86. package/lib/cjs/interfaces/HandlerType.js.map +1 -0
  87. package/lib/cjs/interfaces/IncomingEvent.js +3 -0
  88. package/lib/cjs/interfaces/IncomingEvent.js.map +1 -0
  89. package/lib/cjs/interfaces/OnReady.js +3 -0
  90. package/lib/cjs/interfaces/OnReady.js.map +1 -0
  91. package/lib/cjs/interfaces/OnRequest.js +3 -0
  92. package/lib/cjs/interfaces/OnRequest.js.map +1 -0
  93. package/lib/cjs/interfaces/OnResponse.js +3 -0
  94. package/lib/cjs/interfaces/OnResponse.js.map +1 -0
  95. package/lib/cjs/interfaces/OnRoutesInit.js +3 -0
  96. package/lib/cjs/interfaces/OnRoutesInit.js.map +1 -0
  97. package/lib/cjs/interfaces/PathType.js +3 -0
  98. package/lib/cjs/interfaces/PathType.js.map +1 -0
  99. package/lib/cjs/interfaces/PlatformAdapter.js +3 -0
  100. package/lib/cjs/interfaces/PlatformAdapter.js.map +1 -0
  101. package/lib/cjs/interfaces/PlatformRouteOptions.js +3 -0
  102. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -0
  103. package/lib/cjs/interfaces/ResponseErrorObject.js +3 -0
  104. package/lib/cjs/interfaces/ResponseErrorObject.js.map +1 -0
  105. package/lib/cjs/interfaces/Route.js +3 -0
  106. package/lib/cjs/interfaces/Route.js.map +1 -0
  107. package/lib/cjs/interfaces/index.js +21 -0
  108. package/lib/cjs/interfaces/index.js.map +1 -0
  109. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
  110. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  111. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +55 -0
  112. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -0
  113. package/lib/cjs/middlewares/__mock__/FakeCtrl.js +12 -0
  114. package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +1 -0
  115. package/lib/cjs/middlewares/bindEndpointMiddleware.js +13 -0
  116. package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -0
  117. package/lib/cjs/middlewares/index.js +7 -0
  118. package/lib/cjs/middlewares/index.js.map +1 -0
  119. package/lib/cjs/services/FakeRawDriver.js +26 -0
  120. package/lib/cjs/services/FakeRawDriver.js.map +1 -0
  121. package/lib/cjs/services/Platform.js +107 -0
  122. package/lib/cjs/services/Platform.js.map +1 -0
  123. package/lib/cjs/services/PlatformApplication.js +34 -0
  124. package/lib/cjs/services/PlatformApplication.js.map +1 -0
  125. package/lib/cjs/services/PlatformHandler.js +233 -0
  126. package/lib/cjs/services/PlatformHandler.js.map +1 -0
  127. package/lib/cjs/services/PlatformMiddlewaresChain.js +34 -0
  128. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -0
  129. package/lib/cjs/services/PlatformRequest.js +138 -0
  130. package/lib/cjs/services/PlatformRequest.js.map +1 -0
  131. package/lib/cjs/services/PlatformResponse.js +271 -0
  132. package/lib/cjs/services/PlatformResponse.js.map +1 -0
  133. package/lib/cjs/services/PlatformRouter.js +126 -0
  134. package/lib/cjs/services/PlatformRouter.js.map +1 -0
  135. package/lib/cjs/services/PlatformTest.js +166 -0
  136. package/lib/cjs/services/PlatformTest.js.map +1 -0
  137. package/lib/cjs/services/index.js +12 -0
  138. package/lib/cjs/services/index.js.map +1 -0
  139. package/lib/cjs/utils/createContext.js +38 -0
  140. package/lib/cjs/utils/createContext.js.map +1 -0
  141. package/lib/cjs/utils/createHandlerMetadata.js +49 -0
  142. package/lib/cjs/utils/createHandlerMetadata.js.map +1 -0
  143. package/lib/cjs/utils/createHttpServer.js +34 -0
  144. package/lib/cjs/utils/createHttpServer.js.map +1 -0
  145. package/lib/cjs/utils/createHttpsServer.js +34 -0
  146. package/lib/cjs/utils/createHttpsServer.js.map +1 -0
  147. package/lib/cjs/utils/createInjector.js +38 -0
  148. package/lib/cjs/utils/createInjector.js.map +1 -0
  149. package/lib/cjs/utils/getConfiguration.js +42 -0
  150. package/lib/cjs/utils/getConfiguration.js.map +1 -0
  151. package/lib/cjs/utils/getStaticsOptions.js +21 -0
  152. package/lib/cjs/utils/getStaticsOptions.js.map +1 -0
  153. package/lib/cjs/utils/index.js +11 -0
  154. package/lib/cjs/utils/index.js.map +1 -0
  155. package/lib/cjs/utils/listenServer.js +21 -0
  156. package/lib/cjs/utils/listenServer.js.map +1 -0
  157. package/lib/cjs/utils/mapReturnedResponse.js +15 -0
  158. package/lib/cjs/utils/mapReturnedResponse.js.map +1 -0
  159. package/lib/cjs/utils/printRoutes.js +36 -0
  160. package/lib/cjs/utils/printRoutes.js.map +1 -0
  161. package/lib/cjs/utils/setResponseHeaders.js +35 -0
  162. package/lib/cjs/utils/setResponseHeaders.js.map +1 -0
  163. package/lib/cjs/utils/useCtxHandler.js +15 -0
  164. package/lib/cjs/utils/useCtxHandler.js.map +1 -0
  165. package/lib/esm/builder/PlatformBuilder.js +271 -0
  166. package/lib/esm/builder/PlatformBuilder.js.map +1 -0
  167. package/lib/esm/builder/PlatformControllerBuilder.js +79 -0
  168. package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -0
  169. package/lib/esm/config/index.js +4 -0
  170. package/lib/esm/config/index.js.map +1 -0
  171. package/lib/esm/config/interfaces/ConverterSettings.js +2 -0
  172. package/lib/esm/config/interfaces/ConverterSettings.js.map +1 -0
  173. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js +2 -0
  174. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
  175. package/lib/esm/config/interfaces/PlatformLoggerSettings.js +2 -0
  176. package/lib/esm/config/interfaces/PlatformLoggerSettings.js.map +1 -0
  177. package/lib/esm/config/interfaces/PlatformMulterSettings.js +2 -0
  178. package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -0
  179. package/lib/esm/config/interfaces/PlatformStaticsSettings.js +2 -0
  180. package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +1 -0
  181. package/lib/esm/config/interfaces/index.js +5 -0
  182. package/lib/esm/config/interfaces/index.js.map +1 -0
  183. package/lib/esm/config/services/PlatformConfiguration.js +178 -0
  184. package/lib/esm/config/services/PlatformConfiguration.js.map +1 -0
  185. package/lib/esm/constants/routerOptions.js +2 -0
  186. package/lib/esm/constants/routerOptions.js.map +1 -0
  187. package/lib/esm/decorators/httpServer.js +28 -0
  188. package/lib/esm/decorators/httpServer.js.map +1 -0
  189. package/lib/esm/decorators/httpsServer.js +28 -0
  190. package/lib/esm/decorators/httpsServer.js.map +1 -0
  191. package/lib/esm/decorators/index.js +18 -0
  192. package/lib/esm/decorators/index.js.map +1 -0
  193. package/lib/esm/decorators/method/acceptMime.js +24 -0
  194. package/lib/esm/decorators/method/acceptMime.js.map +1 -0
  195. package/lib/esm/decorators/method/endpointFn.js +11 -0
  196. package/lib/esm/decorators/method/endpointFn.js.map +1 -0
  197. package/lib/esm/decorators/method/location.js +2 -0
  198. package/lib/esm/decorators/method/location.js.map +1 -0
  199. package/lib/esm/decorators/method/redirect.js +2 -0
  200. package/lib/esm/decorators/method/redirect.js.map +1 -0
  201. package/lib/esm/decorators/method/route.js +2 -0
  202. package/lib/esm/decorators/method/route.js.map +1 -0
  203. package/lib/esm/decorators/method/view.js +30 -0
  204. package/lib/esm/decorators/method/view.js.map +1 -0
  205. package/lib/esm/decorators/multer/index.js +4 -0
  206. package/lib/esm/decorators/multer/index.js.map +1 -0
  207. package/lib/esm/decorators/multer/multerFileSize.js +31 -0
  208. package/lib/esm/decorators/multer/multerFileSize.js.map +1 -0
  209. package/lib/esm/decorators/multer/multerOptions.js +48 -0
  210. package/lib/esm/decorators/multer/multerOptions.js.map +1 -0
  211. package/lib/esm/decorators/multer/multipartFile.js +74 -0
  212. package/lib/esm/decorators/multer/multipartFile.js.map +1 -0
  213. package/lib/esm/decorators/params/error.js +16 -0
  214. package/lib/esm/decorators/params/error.js.map +1 -0
  215. package/lib/esm/decorators/params/next.js +17 -0
  216. package/lib/esm/decorators/params/next.js.map +1 -0
  217. package/lib/esm/decorators/params/request.js +34 -0
  218. package/lib/esm/decorators/params/request.js.map +1 -0
  219. package/lib/esm/decorators/params/response.js +28 -0
  220. package/lib/esm/decorators/params/response.js.map +1 -0
  221. package/lib/esm/domain/AnyToPromiseWithCtx.js +23 -0
  222. package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -0
  223. package/lib/esm/domain/ControllerProvider.js +47 -0
  224. package/lib/esm/domain/ControllerProvider.js.map +1 -0
  225. package/lib/esm/domain/EndpointMetadata.js +67 -0
  226. package/lib/esm/domain/EndpointMetadata.js.map +1 -0
  227. package/lib/esm/domain/HandlerMetadata.js +53 -0
  228. package/lib/esm/domain/HandlerMetadata.js.map +1 -0
  229. package/lib/esm/domain/PlatformContext.js +88 -0
  230. package/lib/esm/domain/PlatformContext.js.map +1 -0
  231. package/lib/esm/domain/PlatformRouteDetails.js +20 -0
  232. package/lib/esm/domain/PlatformRouteDetails.js.map +1 -0
  233. package/lib/esm/domain/index.js +7 -0
  234. package/lib/esm/domain/index.js.map +1 -0
  235. package/lib/esm/index.js +28 -0
  236. package/lib/esm/index.js.map +1 -0
  237. package/lib/esm/interfaces/AfterInit.js +2 -0
  238. package/lib/esm/interfaces/AfterInit.js.map +1 -0
  239. package/lib/esm/interfaces/AfterListen.js +2 -0
  240. package/lib/esm/interfaces/AfterListen.js.map +1 -0
  241. package/lib/esm/interfaces/AfterRoutesInit.js +2 -0
  242. package/lib/esm/interfaces/AfterRoutesInit.js.map +1 -0
  243. package/lib/esm/interfaces/BeforeInit.js +2 -0
  244. package/lib/esm/interfaces/BeforeInit.js.map +1 -0
  245. package/lib/esm/interfaces/BeforeListen.js +2 -0
  246. package/lib/esm/interfaces/BeforeListen.js.map +1 -0
  247. package/lib/esm/interfaces/BeforeRoutesInit.js +2 -0
  248. package/lib/esm/interfaces/BeforeRoutesInit.js.map +1 -0
  249. package/lib/esm/interfaces/HandlerType.js +14 -0
  250. package/lib/esm/interfaces/HandlerType.js.map +1 -0
  251. package/lib/esm/interfaces/IncomingEvent.js +2 -0
  252. package/lib/esm/interfaces/IncomingEvent.js.map +1 -0
  253. package/lib/esm/interfaces/OnReady.js +2 -0
  254. package/lib/esm/interfaces/OnReady.js.map +1 -0
  255. package/lib/esm/interfaces/OnRequest.js +2 -0
  256. package/lib/esm/interfaces/OnRequest.js.map +1 -0
  257. package/lib/esm/interfaces/OnResponse.js +2 -0
  258. package/lib/esm/interfaces/OnResponse.js.map +1 -0
  259. package/lib/esm/interfaces/OnRoutesInit.js +2 -0
  260. package/lib/esm/interfaces/OnRoutesInit.js.map +1 -0
  261. package/lib/esm/interfaces/PathType.js +2 -0
  262. package/lib/esm/interfaces/PathType.js.map +1 -0
  263. package/lib/esm/interfaces/PlatformAdapter.js +2 -0
  264. package/lib/esm/interfaces/PlatformAdapter.js.map +1 -0
  265. package/lib/esm/interfaces/PlatformRouteOptions.js +2 -0
  266. package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -0
  267. package/lib/esm/interfaces/ResponseErrorObject.js +2 -0
  268. package/lib/esm/interfaces/ResponseErrorObject.js.map +1 -0
  269. package/lib/esm/interfaces/Route.js +2 -0
  270. package/lib/esm/interfaces/Route.js.map +1 -0
  271. package/lib/esm/interfaces/index.js +18 -0
  272. package/lib/esm/interfaces/index.js.map +1 -0
  273. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +34 -0
  274. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  275. package/lib/esm/middlewares/PlatformMulterMiddleware.js +52 -0
  276. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -0
  277. package/lib/esm/middlewares/__mock__/FakeCtrl.js +9 -0
  278. package/lib/esm/middlewares/__mock__/FakeCtrl.js.map +1 -0
  279. package/lib/esm/middlewares/bindEndpointMiddleware.js +9 -0
  280. package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -0
  281. package/lib/esm/middlewares/index.js +4 -0
  282. package/lib/esm/middlewares/index.js.map +1 -0
  283. package/lib/esm/services/FakeRawDriver.js +22 -0
  284. package/lib/esm/services/FakeRawDriver.js.map +1 -0
  285. package/lib/esm/services/Platform.js +104 -0
  286. package/lib/esm/services/Platform.js.map +1 -0
  287. package/lib/esm/services/PlatformApplication.js +31 -0
  288. package/lib/esm/services/PlatformApplication.js.map +1 -0
  289. package/lib/esm/services/PlatformHandler.js +230 -0
  290. package/lib/esm/services/PlatformHandler.js.map +1 -0
  291. package/lib/esm/services/PlatformMiddlewaresChain.js +31 -0
  292. package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -0
  293. package/lib/esm/services/PlatformRequest.js +135 -0
  294. package/lib/esm/services/PlatformRequest.js.map +1 -0
  295. package/lib/esm/services/PlatformResponse.js +268 -0
  296. package/lib/esm/services/PlatformResponse.js.map +1 -0
  297. package/lib/esm/services/PlatformRouter.js +123 -0
  298. package/lib/esm/services/PlatformRouter.js.map +1 -0
  299. package/lib/esm/services/PlatformTest.js +162 -0
  300. package/lib/esm/services/PlatformTest.js.map +1 -0
  301. package/lib/esm/services/index.js +9 -0
  302. package/lib/esm/services/index.js.map +1 -0
  303. package/lib/esm/utils/createContext.js +34 -0
  304. package/lib/esm/utils/createContext.js.map +1 -0
  305. package/lib/esm/utils/createHandlerMetadata.js +45 -0
  306. package/lib/esm/utils/createHandlerMetadata.js.map +1 -0
  307. package/lib/esm/utils/createHttpServer.js +29 -0
  308. package/lib/esm/utils/createHttpServer.js.map +1 -0
  309. package/lib/esm/utils/createHttpsServer.js +29 -0
  310. package/lib/esm/utils/createHttpsServer.js.map +1 -0
  311. package/lib/esm/utils/createInjector.js +34 -0
  312. package/lib/esm/utils/createInjector.js.map +1 -0
  313. package/lib/esm/utils/getConfiguration.js +38 -0
  314. package/lib/esm/utils/getConfiguration.js.map +1 -0
  315. package/lib/esm/utils/getStaticsOptions.js +17 -0
  316. package/lib/esm/utils/getStaticsOptions.js.map +1 -0
  317. package/lib/esm/utils/index.js +8 -0
  318. package/lib/esm/utils/index.js.map +1 -0
  319. package/lib/esm/utils/listenServer.js +17 -0
  320. package/lib/esm/utils/listenServer.js.map +1 -0
  321. package/lib/esm/utils/mapReturnedResponse.js +11 -0
  322. package/lib/esm/utils/mapReturnedResponse.js.map +1 -0
  323. package/lib/esm/utils/printRoutes.js +32 -0
  324. package/lib/esm/utils/printRoutes.js.map +1 -0
  325. package/lib/esm/utils/setResponseHeaders.js +31 -0
  326. package/lib/esm/utils/setResponseHeaders.js.map +1 -0
  327. package/lib/esm/utils/useCtxHandler.js +11 -0
  328. package/lib/esm/utils/useCtxHandler.js.map +1 -0
  329. package/lib/{builder → types/builder}/PlatformBuilder.d.ts +25 -30
  330. package/lib/types/builder/PlatformControllerBuilder.d.ts +17 -0
  331. package/lib/{config → types/config}/index.d.ts +0 -0
  332. package/lib/{config → types/config}/interfaces/ConverterSettings.d.ts +0 -0
  333. package/lib/{config → types/config}/interfaces/EndpointDirectoriesSettings.d.ts +0 -0
  334. package/lib/{config → types/config}/interfaces/PlatformLoggerSettings.d.ts +0 -0
  335. package/lib/{config → types/config}/interfaces/PlatformMulterSettings.d.ts +0 -0
  336. package/lib/{config → types/config}/interfaces/PlatformStaticsSettings.d.ts +1 -0
  337. package/lib/{config → types/config}/interfaces/index.d.ts +14 -1
  338. package/lib/{config → types/config}/services/PlatformConfiguration.d.ts +12 -11
  339. package/lib/{constants → types/constants}/routerOptions.d.ts +0 -0
  340. package/lib/{decorators → types/decorators}/httpServer.d.ts +1 -0
  341. package/lib/{decorators → types/decorators}/httpsServer.d.ts +1 -0
  342. package/lib/{decorators → types/decorators}/index.d.ts +1 -0
  343. package/lib/{decorators → types/decorators}/method/acceptMime.d.ts +0 -0
  344. package/lib/{decorators → types/decorators}/method/endpointFn.d.ts +1 -0
  345. package/lib/{decorators → types/decorators}/method/location.d.ts +0 -0
  346. package/lib/{decorators → types/decorators}/method/redirect.d.ts +0 -0
  347. package/lib/{decorators → types/decorators}/method/route.d.ts +0 -0
  348. package/lib/types/decorators/method/view.d.ts +25 -0
  349. package/lib/{decorators → types/decorators}/multer/index.d.ts +0 -0
  350. package/lib/{decorators → types/decorators}/multer/multerFileSize.d.ts +0 -0
  351. package/lib/{decorators → types/decorators}/multer/multerOptions.d.ts +0 -0
  352. package/lib/{decorators → types/decorators}/multer/multipartFile.d.ts +0 -0
  353. package/lib/{decorators → types/decorators}/params/error.d.ts +0 -0
  354. package/lib/{decorators → types/decorators}/params/next.d.ts +0 -0
  355. package/lib/{decorators → types/decorators}/params/request.d.ts +0 -0
  356. package/lib/{decorators → types/decorators}/params/response.d.ts +0 -0
  357. package/lib/{domain → types/domain}/AnyToPromiseWithCtx.d.ts +0 -0
  358. package/lib/types/domain/ControllerProvider.d.ts +24 -0
  359. package/lib/{domain → types/domain}/EndpointMetadata.d.ts +3 -41
  360. package/lib/{domain → types/domain}/HandlerMetadata.d.ts +2 -2
  361. package/lib/{domain → types/domain}/PlatformContext.d.ts +0 -0
  362. package/lib/{domain → types/domain}/PlatformRouteDetails.d.ts +4 -10
  363. package/lib/{domain → types/domain}/index.d.ts +0 -0
  364. package/lib/{index.d.ts → types/index.d.ts} +1 -3
  365. package/lib/{interfaces → types/interfaces}/AfterInit.d.ts +0 -0
  366. package/lib/{interfaces → types/interfaces}/AfterListen.d.ts +0 -0
  367. package/lib/{interfaces → types/interfaces}/AfterRoutesInit.d.ts +0 -0
  368. package/lib/{interfaces → types/interfaces}/BeforeInit.d.ts +0 -0
  369. package/lib/{interfaces → types/interfaces}/BeforeListen.d.ts +0 -0
  370. package/lib/{interfaces → types/interfaces}/BeforeRoutesInit.d.ts +0 -0
  371. package/lib/{interfaces → types/interfaces}/HandlerType.d.ts +0 -0
  372. package/lib/{interfaces → types/interfaces}/IncomingEvent.d.ts +0 -0
  373. package/lib/{interfaces → types/interfaces}/OnReady.d.ts +0 -0
  374. package/lib/{interfaces → types/interfaces}/OnRequest.d.ts +0 -0
  375. package/lib/{interfaces → types/interfaces}/OnResponse.d.ts +0 -0
  376. package/lib/{interfaces → types/interfaces}/OnRoutesInit.d.ts +0 -0
  377. package/lib/{interfaces → types/interfaces}/PathType.d.ts +0 -0
  378. package/lib/types/interfaces/PlatformAdapter.d.ts +19 -0
  379. package/lib/{interfaces → types/interfaces}/PlatformRouteOptions.d.ts +6 -4
  380. package/lib/{interfaces → types/interfaces}/ResponseErrorObject.d.ts +0 -0
  381. package/lib/{interfaces → types/interfaces}/Route.d.ts +0 -0
  382. package/lib/{interfaces → types/interfaces}/index.d.ts +1 -1
  383. package/lib/{middlewares → types/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
  384. package/lib/{middlewares → types/middlewares}/PlatformMulterMiddleware.d.ts +0 -0
  385. package/lib/{middlewares/data → types/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
  386. package/lib/{middlewares → types/middlewares}/bindEndpointMiddleware.d.ts +0 -0
  387. package/lib/{middlewares → types/middlewares}/index.d.ts +0 -0
  388. package/lib/{services → types/services}/FakeRawDriver.d.ts +0 -0
  389. package/lib/{services → types/services}/Platform.d.ts +12 -6
  390. package/lib/{services → types/services}/PlatformApplication.d.ts +0 -0
  391. package/lib/{services → types/services}/PlatformHandler.d.ts +0 -0
  392. package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -0
  393. package/lib/{services → types/services}/PlatformRequest.d.ts +2 -1
  394. package/lib/{services → types/services}/PlatformResponse.d.ts +4 -4
  395. package/lib/{services → types/services}/PlatformRouter.d.ts +3 -2
  396. package/lib/{services → types/services}/PlatformTest.d.ts +7 -6
  397. package/lib/{services → types/services}/index.d.ts +1 -0
  398. package/lib/{utils → types/utils}/createContext.d.ts +0 -0
  399. package/lib/{utils → types/utils}/createHandlerMetadata.d.ts +0 -0
  400. package/lib/types/utils/createHttpServer.d.ts +4 -0
  401. package/lib/types/utils/createHttpsServer.d.ts +4 -0
  402. package/lib/types/utils/createInjector.d.ts +7 -0
  403. package/lib/types/utils/getConfiguration.d.ts +2 -0
  404. package/lib/types/utils/getStaticsOptions.d.ts +5 -0
  405. package/lib/{utils → types/utils}/index.d.ts +0 -1
  406. package/lib/types/utils/listenServer.d.ts +7 -0
  407. package/lib/{utils → types/utils}/mapReturnedResponse.d.ts +0 -0
  408. package/lib/{utils → types/utils}/printRoutes.d.ts +0 -0
  409. package/lib/{utils → types/utils}/setResponseHeaders.d.ts +0 -0
  410. package/lib/{utils → types/utils}/useCtxHandler.d.ts +0 -0
  411. package/package.json +29 -28
  412. package/tsconfig.compile.esm.json +23 -0
  413. package/lib/PlatformModule.d.ts +0 -15
  414. package/lib/builder/PlatformControllerBuilder.d.ts +0 -19
  415. package/lib/domain/ControllerProvider.d.ts +0 -53
  416. package/lib/index.js +0 -3651
  417. package/lib/index.js.map +0 -1
  418. package/lib/index.modern.js +0 -3464
  419. package/lib/index.modern.js.map +0 -1
  420. package/lib/interfaces/PlatformRouterMethods.d.ts +0 -10
  421. package/lib/registries/ControllerRegistry.d.ts +0 -1
  422. package/lib/utils/createHttpServer.d.ts +0 -3
  423. package/lib/utils/createHttpsServer.d.ts +0 -3
  424. package/lib/utils/createInjector.d.ts +0 -2
  425. package/lib/utils/createPlatformApplication.d.ts +0 -2
  426. package/lib/utils/getControllerPath.d.ts +0 -2
  427. package/lib/utils/listenServer.d.ts +0 -10
@@ -0,0 +1,178 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { getHostInfoFromPort } from "@tsed/core";
3
+ import { DIConfiguration, Injectable, ProviderScope } from "@tsed/di";
4
+ import { $log } from "@tsed/logger";
5
+ const rootDir = process.cwd();
6
+ /**
7
+ * `PlatformConfiguration` contains all information about your Server configuration.
8
+ */
9
+ let PlatformConfiguration = class PlatformConfiguration extends DIConfiguration {
10
+ constructor() {
11
+ super({ rootDir });
12
+ }
13
+ get version() {
14
+ return this.getRaw("version");
15
+ }
16
+ set version(v) {
17
+ this.setRaw("version", v);
18
+ }
19
+ get rootDir() {
20
+ return this.getRaw("rootDir");
21
+ }
22
+ set rootDir(value) {
23
+ this.setRaw("rootDir", value);
24
+ }
25
+ get port() {
26
+ return this.httpPort;
27
+ }
28
+ set port(value) {
29
+ this.httpPort = value;
30
+ }
31
+ get httpsOptions() {
32
+ return this.getRaw("httpsOptions");
33
+ }
34
+ set httpsOptions(value) {
35
+ this.setRaw("httpsOptions", value);
36
+ }
37
+ get httpPort() {
38
+ return this.getRaw("httpPort");
39
+ }
40
+ set httpPort(value) {
41
+ this.setRaw("httpPort", value);
42
+ }
43
+ get httpsPort() {
44
+ return this.getRaw("httpsPort");
45
+ }
46
+ set httpsPort(value) {
47
+ this.setRaw("httpsPort", value);
48
+ }
49
+ get env() {
50
+ return this.getRaw("env");
51
+ }
52
+ set env(value) {
53
+ this.setRaw("env", value);
54
+ }
55
+ get mount() {
56
+ return this.get("mount");
57
+ }
58
+ set mount(value) {
59
+ this.setRaw("mount", value);
60
+ }
61
+ get componentsScan() {
62
+ return this.resolve(this.getRaw("componentsScan"));
63
+ }
64
+ set componentsScan(value) {
65
+ this.setRaw("componentsScan", value);
66
+ }
67
+ get statics() {
68
+ return this.getRaw("statics") || this.getRaw("serveStatic") || {};
69
+ }
70
+ set statics(value) {
71
+ this.setRaw("statics", value);
72
+ }
73
+ get acceptMimes() {
74
+ return this.getRaw("acceptMimes");
75
+ }
76
+ set acceptMimes(value) {
77
+ this.setRaw("acceptMimes", value || []);
78
+ }
79
+ get debug() {
80
+ return this.logger.level === "debug";
81
+ }
82
+ set debug(debug) {
83
+ this.logger = { ...this.logger, level: debug ? "debug" : "info" };
84
+ }
85
+ get converter() {
86
+ return this.get("converter") || {};
87
+ }
88
+ set converter(options) {
89
+ this.setRaw("converter", options);
90
+ }
91
+ get logger() {
92
+ return this.get("logger");
93
+ }
94
+ set logger(value) {
95
+ const logger = { ...this.logger, ...value };
96
+ logger.debug = logger.level === "debug";
97
+ this.setRaw("logger", logger);
98
+ this.setRaw("debug", logger.debug);
99
+ if (logger.format) {
100
+ $log.appenders.set("stdout", {
101
+ type: "stdout",
102
+ levels: ["info", "debug"],
103
+ layout: {
104
+ type: "pattern",
105
+ pattern: logger.format
106
+ }
107
+ });
108
+ $log.appenders.set("stderr", {
109
+ levels: ["trace", "fatal", "error", "warn"],
110
+ type: "stderr",
111
+ layout: {
112
+ type: "pattern",
113
+ pattern: logger.format
114
+ }
115
+ });
116
+ }
117
+ }
118
+ get exclude() {
119
+ return this.get("exclude");
120
+ }
121
+ set exclude(exclude) {
122
+ this.setRaw("exclude", exclude);
123
+ }
124
+ get additionalProperties() {
125
+ return this.get("converter.additionalProperties") === "accept";
126
+ }
127
+ /**
128
+ *
129
+ * @returns {string|number}
130
+ */
131
+ getHttpPort() {
132
+ return getHostInfoFromPort("http", this.getRaw("httpPort"));
133
+ }
134
+ /**
135
+ *
136
+ * @param settings
137
+ */
138
+ setHttpPort(settings) {
139
+ this.setRaw("httpPort", `${settings.address}:${settings.port}`);
140
+ }
141
+ /**
142
+ *
143
+ * @returns {string|number}
144
+ */
145
+ getHttpsPort() {
146
+ return getHostInfoFromPort("https", this.getRaw("httpsPort"));
147
+ }
148
+ /**
149
+ *
150
+ * @param settings
151
+ */
152
+ setHttpsPort(settings) {
153
+ this.setRaw("httpsPort", `${settings.address}:${settings.port}`);
154
+ }
155
+ getBestHost() {
156
+ const { httpsPort, httpPort } = this;
157
+ if (httpsPort) {
158
+ return this.getHttpsPort();
159
+ }
160
+ if (httpPort) {
161
+ return this.getHttpPort();
162
+ }
163
+ return {
164
+ toString() {
165
+ return "/";
166
+ }
167
+ };
168
+ }
169
+ };
170
+ PlatformConfiguration = __decorate([
171
+ Injectable({
172
+ scope: ProviderScope.SINGLETON,
173
+ global: true
174
+ }),
175
+ __metadata("design:paramtypes", [])
176
+ ], PlatformConfiguration);
177
+ export { PlatformConfiguration };
178
+ //# sourceMappingURL=PlatformConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlatformConfiguration.js","sourceRoot":"","sources":["../../../../src/config/services/PlatformConfiguration.ts"],"names":[],"mappings":";AAAA,OAAO,EAAM,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,eAAe,EAAE,UAAU,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAKlC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAE9B;;GAEG;AAKH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,eAAe;IACxD;QACE,KAAK,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC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C,KAAK,QAAQ,CAAC;IACjE,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,OAAO,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,QAAyC;QACnD,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACH,YAAY;QACV,OAAO,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,QAAyC;QACpD,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,WAAW;QACT,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;QAEnC,IAAI,SAAS,EAAE;YACb,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;SAC5B;QAED,IAAI,QAAQ,EAAE;YACZ,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;SAC3B;QAED,OAAO;YACL,QAAQ;gBACN,OAAO,GAAG,CAAC;YACb,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1MY,qBAAqB;IAJjC,UAAU,CAAC;QACV,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,MAAM,EAAE,IAAI;KACb,CAAC;;GACW,qBAAqB,CA0MjC;SA1MY,qBAAqB","sourcesContent":["import {Env, getHostInfoFromPort} from \"@tsed/core\";\nimport {DIConfiguration, Injectable, ProviderScope} from \"@tsed/di\";\nimport {$log} from \"@tsed/logger\";\nimport Https from \"https\";\nimport {EndpointDirectoriesSettings, PlatformLoggerSettings} from \"../interfaces\";\nimport {ConverterSettings} from \"../interfaces/ConverterSettings\";\n\nconst rootDir = process.cwd();\n\n/**\n * `PlatformConfiguration` contains all information about your Server configuration.\n */\n@Injectable({\n scope: ProviderScope.SINGLETON,\n global: true\n})\nexport class PlatformConfiguration extends DIConfiguration {\n constructor() {\n super({rootDir});\n }\n\n get version() {\n return this.getRaw(\"version\");\n }\n\n set version(v: string) {\n this.setRaw(\"version\", v);\n }\n\n get rootDir() {\n return this.getRaw(\"rootDir\");\n }\n\n set rootDir(value: string) {\n this.setRaw(\"rootDir\", value);\n }\n\n get port(): string | number | false {\n return this.httpPort;\n }\n\n set port(value: string | number | false) {\n this.httpPort = value;\n }\n\n get httpsOptions(): Https.ServerOptions {\n return this.getRaw(\"httpsOptions\");\n }\n\n set httpsOptions(value: Https.ServerOptions) {\n this.setRaw(\"httpsOptions\", value);\n }\n\n get httpPort(): string | number | false {\n return this.getRaw(\"httpPort\");\n }\n\n set httpPort(value: string | number | false) {\n this.setRaw(\"httpPort\", value);\n }\n\n get httpsPort(): string | number | false {\n return this.getRaw(\"httpsPort\");\n }\n\n set httpsPort(value: string | number | false) {\n this.setRaw(\"httpsPort\", value);\n }\n\n get env(): Env {\n return this.getRaw(\"env\");\n }\n\n set env(value: Env) {\n this.setRaw(\"env\", value);\n }\n\n get mount(): EndpointDirectoriesSettings {\n return this.get(\"mount\");\n }\n\n set mount(value: EndpointDirectoriesSettings) {\n this.setRaw(\"mount\", value);\n }\n\n get componentsScan(): string[] {\n return this.resolve(this.getRaw(\"componentsScan\"));\n }\n\n set componentsScan(value: string[]) {\n this.setRaw(\"componentsScan\", value);\n }\n\n get statics(): EndpointDirectoriesSettings {\n return this.getRaw(\"statics\") || this.getRaw(\"serveStatic\") || {};\n }\n\n set statics(value: EndpointDirectoriesSettings) {\n this.setRaw(\"statics\", value);\n }\n\n get acceptMimes(): string[] {\n return this.getRaw(\"acceptMimes\");\n }\n\n set acceptMimes(value: string[]) {\n this.setRaw(\"acceptMimes\", value || []);\n }\n\n get debug(): boolean {\n return this.logger.level === \"debug\";\n }\n\n set debug(debug: boolean) {\n this.logger = {...this.logger, level: debug ? \"debug\" : \"info\"};\n }\n\n get converter(): Partial<ConverterSettings> {\n return this.get(\"converter\") || {};\n }\n\n set converter(options: Partial<ConverterSettings>) {\n this.setRaw(\"converter\", options);\n }\n\n get logger(): Partial<PlatformLoggerSettings> {\n return this.get(\"logger\");\n }\n\n set logger(value: Partial<PlatformLoggerSettings>) {\n const logger = {...this.logger, ...value};\n logger.debug = logger.level === \"debug\";\n\n this.setRaw(\"logger\", logger);\n this.setRaw(\"debug\", logger.debug);\n\n if (logger.format) {\n $log.appenders.set(\"stdout\", {\n type: \"stdout\",\n levels: [\"info\", \"debug\"],\n layout: {\n type: \"pattern\",\n pattern: logger.format\n }\n });\n\n $log.appenders.set(\"stderr\", {\n levels: [\"trace\", \"fatal\", \"error\", \"warn\"],\n type: \"stderr\",\n layout: {\n type: \"pattern\",\n pattern: logger.format\n }\n });\n }\n }\n\n get exclude() {\n return this.get(\"exclude\");\n }\n\n set exclude(exclude: string[]) {\n this.setRaw(\"exclude\", exclude);\n }\n\n get additionalProperties() {\n return this.get(\"converter.additionalProperties\") === \"accept\";\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpPort(): ReturnType<typeof getHostInfoFromPort> {\n return getHostInfoFromPort(\"http\", this.getRaw(\"httpPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpPort\", `${settings.address}:${settings.port}`);\n }\n\n /**\n *\n * @returns {string|number}\n */\n getHttpsPort() {\n return getHostInfoFromPort(\"https\", this.getRaw(\"httpsPort\"));\n }\n\n /**\n *\n * @param settings\n */\n setHttpsPort(settings: {address: string; port: number}) {\n this.setRaw(\"httpsPort\", `${settings.address}:${settings.port}`);\n }\n\n getBestHost() {\n const {httpsPort, httpPort} = this;\n\n if (httpsPort) {\n return this.getHttpsPort();\n }\n\n if (httpPort) {\n return this.getHttpPort();\n }\n\n return {\n toString() {\n return \"/\";\n }\n };\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export const ROUTER_OPTIONS = Symbol.for("ROUTER_OPTIONS");
2
+ //# sourceMappingURL=routerOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routerOptions.js","sourceRoot":"","sources":["../../../src/constants/routerOptions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["export const ROUTER_OPTIONS = Symbol.for(\"ROUTER_OPTIONS\");\n"]}
@@ -0,0 +1,28 @@
1
+ import { Inject } from "@tsed/di";
2
+ /**
3
+ * Inject the Http.Server instance.
4
+ *
5
+ * ### Example
6
+ *
7
+ * ```typescript
8
+ * import {HttpServer, Service} from "@tsed/common";
9
+ *
10
+ * @Service()
11
+ * export default class OtherService {
12
+ * constructor(@HttpServer httpServer: HttpServer) {}
13
+ * }
14
+ * ```
15
+ *
16
+ * > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
17
+ *
18
+ * @param {Type<any>} target
19
+ * @param {string} targetKey
20
+ * @param {TypedPropertyDescriptor<Function> | number} descriptor
21
+ * @returns {any}
22
+ * @decorator
23
+ * @deprecated Use Https.Server from "http"
24
+ */
25
+ export function HttpServer(target, targetKey, descriptor) {
26
+ return Inject(HttpServer)(target, targetKey, descriptor);
27
+ }
28
+ //# sourceMappingURL=httpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServer.js","sourceRoot":"","sources":["../../../src/decorators/httpServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,UAAU,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACrH,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport Http from \"http\";\n\n/**\n * Inject the Http.Server instance.\n *\n * ### Example\n *\n * ```typescript\n * import {HttpServer, Service} from \"@tsed/common\";\n *\n * @Service()\n * export default class OtherService {\n * constructor(@HttpServer httpServer: HttpServer) {}\n * }\n * ```\n *\n * > Note: TypeScript transform and store `HttpServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.\n *\n * @param {Type<any>} target\n * @param {string} targetKey\n * @param {TypedPropertyDescriptor<Function> | number} descriptor\n * @returns {any}\n * @decorator\n * @deprecated Use Https.Server from \"http\"\n */\nexport function HttpServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number) {\n return Inject(HttpServer)(target, targetKey, descriptor);\n}\n\nexport type HttpServer = Http.Server;\n"]}
@@ -0,0 +1,28 @@
1
+ import { Inject } from "@tsed/di";
2
+ /**
3
+ * Inject the Https.Server instance.
4
+ *
5
+ * ### Example
6
+ *
7
+ * ```typescript
8
+ * import {HttpsServer, Service} from "@tsed/common";
9
+ *
10
+ * @Service()
11
+ * export default class OtherService {
12
+ * constructor(@HttpsServer httpServer: HttpServer) {}
13
+ * }
14
+ * ```
15
+ *
16
+ * > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.
17
+ *
18
+ * @param {Type<any>} target
19
+ * @param {string} targetKey
20
+ * @param {TypedPropertyDescriptor<Function> | number} descriptor
21
+ * @returns {any}
22
+ * @decorator
23
+ * @deprecated Use Https.Server from "https"
24
+ */
25
+ export function HttpsServer(target, targetKey, descriptor) {
26
+ return Inject(HttpsServer)(target, targetKey, descriptor);
27
+ }
28
+ //# sourceMappingURL=httpsServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpsServer.js","sourceRoot":"","sources":["../../../src/decorators/httpsServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,WAAW,CAAC,MAAiB,EAAE,SAAiB,EAAE,UAAsD;IACtH,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Inject} from \"@tsed/di\";\nimport Https from \"https\";\n\n/**\n * Inject the Https.Server instance.\n *\n * ### Example\n *\n * ```typescript\n * import {HttpsServer, Service} from \"@tsed/common\";\n *\n * @Service()\n * export default class OtherService {\n * constructor(@HttpsServer httpServer: HttpServer) {}\n * }\n * ```\n *\n * > Note: TypeScript transform and store `HttpsServer` as `Function` type in the metadata. So to inject a factory, you must use the `@Inject(type)` decorator.\n *\n * @param {Type<any>} target\n * @param {string} targetKey\n * @param {TypedPropertyDescriptor<Function> | number} descriptor\n * @returns {any}\n * @decorator\n * @deprecated Use Https.Server from \"https\"\n */\nexport function HttpsServer(target: Type<any>, targetKey: string, descriptor: TypedPropertyDescriptor<Function> | number) {\n return Inject(HttpsServer)(target, targetKey, descriptor);\n}\n\nexport type HttpsServer = Https.Server;\n"]}
@@ -0,0 +1,18 @@
1
+ export * from "./httpServer";
2
+ export * from "./httpsServer";
3
+ export * from "./multer";
4
+ // Method
5
+ export * from "./method/route";
6
+ export * from "./method/acceptMime";
7
+ export * from "./method/location";
8
+ export * from "./method/redirect";
9
+ export * from "./method/endpointFn";
10
+ export * from "./method/view";
11
+ // Params
12
+ export * from "./params/response";
13
+ export * from "./params/request";
14
+ export * from "./params/next";
15
+ export * from "./params/error";
16
+ // utils
17
+ export * from "../utils/mapReturnedResponse";
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,cAAc,UAAU,CAAC;AAEzB,SAAS;AACT,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAE9B,SAAS;AACT,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAE/B,QAAQ;AACR,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./httpServer\";\nexport * from \"./httpsServer\";\n\nexport * from \"./multer\";\n\n// Method\nexport * from \"./method/route\";\nexport * from \"./method/acceptMime\";\nexport * from \"./method/location\";\nexport * from \"./method/redirect\";\nexport * from \"./method/endpointFn\";\nexport * from \"./method/view\";\n\n// Params\nexport * from \"./params/response\";\nexport * from \"./params/request\";\nexport * from \"./params/next\";\nexport * from \"./params/error\";\n\n// utils\nexport * from \"../utils/mapReturnedResponse\";\n"]}
@@ -0,0 +1,24 @@
1
+ import { StoreSet, useDecorators } from "@tsed/core";
2
+ import { Produces } from "@tsed/schema";
3
+ /**
4
+ * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
5
+ *
6
+ * ```typescript
7
+ * @Controller('/mypath')
8
+ * export class MyCtrl {
9
+ *
10
+ * @Get('/')
11
+ * @AcceptMime('application/json')
12
+ * public getResource(){}
13
+ * }
14
+ * ```
15
+ *
16
+ * @param mimes
17
+ * @decorator
18
+ * @operation
19
+ * @response
20
+ */
21
+ export function AcceptMime(...mimes) {
22
+ return useDecorators(Produces(...mimes), StoreSet("acceptMimes", mimes));
23
+ }
24
+ //# sourceMappingURL=acceptMime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acceptMime.js","sourceRoot":"","sources":["../../../../src/decorators/method/acceptMime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Produces} from \"@tsed/schema\";\n\n/**\n * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.\n *\n * ```typescript\n * @Controller('/mypath')\n * export class MyCtrl {\n *\n * @Get('/')\n * @AcceptMime('application/json')\n * public getResource(){}\n * }\n * ```\n *\n * @param mimes\n * @decorator\n * @operation\n * @response\n */\nexport function AcceptMime(...mimes: string[]): Function {\n return useDecorators(Produces(...mimes), StoreSet(\"acceptMimes\", mimes));\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { JsonEntityFn } from "@tsed/schema";
2
+ /**
3
+ *
4
+ * @param fn
5
+ * @decorator
6
+ * @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.
7
+ */
8
+ export function EndpointFn(fn) {
9
+ return JsonEntityFn(fn);
10
+ }
11
+ //# sourceMappingURL=endpointFn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpointFn.js","sourceRoot":"","sources":["../../../../src/decorators/method/endpointFn.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAAyE;IAClG,OAAO,YAAY,CAAmB,EAAE,CAAQ,CAAC;AACnD,CAAC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\nimport {EndpointMetadata} from \"../../domain\";\n\n/**\n *\n * @param fn\n * @decorator\n * @deprecated Deprecated since 2021-10-05. Use JsonEntityFn instead.\n */\nexport function EndpointFn(fn: (endpoint: EndpointMetadata, parameters: DecoratorParameters) => void): MethodDecorator {\n return JsonEntityFn<EndpointMetadata>(fn) as any;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { Location } from "@tsed/schema";
2
+ //# sourceMappingURL=location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.js","sourceRoot":"","sources":["../../../../src/decorators/method/location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Location} from \"@tsed/schema\";\n"]}
@@ -0,0 +1,2 @@
1
+ export { Redirect } from "@tsed/schema";
2
+ //# sourceMappingURL=redirect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/method/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Redirect} from \"@tsed/schema\";\n"]}
@@ -0,0 +1,2 @@
1
+ export { Get, Post, Put, Patch, Delete, Head, Options, All } from "@tsed/schema";
2
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../src/decorators/method/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,cAAc,CAAC","sourcesContent":["export {Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\n"]}
@@ -0,0 +1,30 @@
1
+ import { StoreSet } from "@tsed/core";
2
+ /**
3
+ * Use a view and sends the rendered HTML string to the client. Optional parameter:
4
+ *
5
+ * * viewOptions, an object whose properties define local variables for the view.
6
+ *
7
+ * The view argument is a string that is the file path of the view file to render.
8
+ * This can be an absolute path, or a path relative to the views setting.
9
+ * If the path does not contain a file extension, then the view engine setting determines the file extension.
10
+ * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
11
+ * and render it using the loaded module’s __express function.
12
+ *
13
+ * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
14
+ *
15
+ * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
16
+ * and as so for security reasons should not contain input from the end-user.
17
+ *
18
+ * @param path Relative path to the view file.
19
+ * @param options Additional options
20
+ * @decorator
21
+ * @operation
22
+ * @response
23
+ * @ignores
24
+ * @deprecated Use View decorator from @tsed/platform-views instead.
25
+ */
26
+ // istanbul ignore next
27
+ export function View(path, options) {
28
+ return StoreSet("view", { path, options });
29
+ }
30
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/decorators/method/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uBAAuB;AACvB,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,OAAgB;IACjD,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAQ,CAAC;AAClD,CAAC","sourcesContent":["import {StoreSet} from \"@tsed/core\";\n\n/**\n * Use a view and sends the rendered HTML string to the client. Optional parameter:\n *\n * * viewOptions, an object whose properties define local variables for the view.\n *\n * The view argument is a string that is the file path of the view file to render.\n * This can be an absolute path, or a path relative to the views setting.\n * If the path does not contain a file extension, then the view engine setting determines the file extension.\n * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())\n * and render it using the loaded module’s __express function.\n *\n * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).\n *\n * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,\n * and as so for security reasons should not contain input from the end-user.\n *\n * @param path Relative path to the view file.\n * @param options Additional options\n * @decorator\n * @operation\n * @response\n * @ignores\n * @deprecated Use View decorator from @tsed/platform-views instead.\n */\n// istanbul ignore next\nexport function View(path: string, options?: Object): MethodDecorator {\n return StoreSet(\"view\", {path, options}) as any;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export * from "./multerFileSize";
2
+ export * from "./multerOptions";
3
+ export * from "./multipartFile";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/decorators/multer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./multerFileSize\";\nexport * from \"./multerOptions\";\nexport * from \"./multipartFile\";\n"]}
@@ -0,0 +1,31 @@
1
+ import { MulterOptions } from "./multerOptions";
2
+ /**
3
+ * Define file size limit.
4
+ *
5
+ * ```typescript
6
+ * import {Controller, Post} from "@tsed/common";
7
+ * import {MulterOptions, MultipartFile} from "@tsed/common";
8
+ * import {Multer} from "@types/multer";
9
+ *
10
+ * type MulterFile = Express.Multer.File;
11
+ *
12
+ * @Controller('/')
13
+ * class MyCtrl {
14
+ * @Post('/file2')
15
+ * @MulterFileSize(1024) // (Ko). Applied for all fields
16
+ * private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
17
+ *
18
+ * }
19
+ * }
20
+ * ```
21
+ *
22
+ * > See the tutorial on the [multer configuration](/tutorials/multer.md).
23
+ * @param fileSize
24
+ * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
25
+ * @decorator
26
+ * @multer
27
+ */
28
+ export function MulterFileSize(fileSize) {
29
+ return MulterOptions({ limits: { fileSize } });
30
+ }
31
+ //# sourceMappingURL=multerFileSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multerFileSize.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerFileSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,aAAa,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import {MulterOptions} from \"./multerOptions\";\n\n/**\n * Define file size limit.\n *\n * ```typescript\n * import {Controller, Post} from \"@tsed/common\";\n * import {MulterOptions, MultipartFile} from \"@tsed/common\";\n * import {Multer} from \"@types/multer\";\n *\n * type MulterFile = Express.Multer.File;\n *\n * @Controller('/')\n * class MyCtrl {\n * @Post('/file2')\n * @MulterFileSize(1024) // (Ko). Applied for all fields\n * private uploadFile(@MultipartFile(\"file1\") file: MulterFile, @MultipartFile(\"file2\") file2: MulterFile) {\n *\n * }\n * }\n * ```\n *\n * > See the tutorial on the [multer configuration](/tutorials/multer.md).\n * @param fileSize\n * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}\n * @decorator\n * @multer\n */\nexport function MulterFileSize(fileSize: number): MethodDecorator {\n return MulterOptions({limits: {fileSize}});\n}\n"]}
@@ -0,0 +1,48 @@
1
+ import { StoreMerge } from "@tsed/core";
2
+ import { PlatformMulterMiddleware } from "../../middlewares/PlatformMulterMiddleware";
3
+ /**
4
+ * Define multer option for all MultipartFile
5
+ *
6
+ * ```typescript
7
+ * import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
8
+ *
9
+ * @Controller('/')
10
+ * class MyCtrl {
11
+ * @Post('/file')
12
+ * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
13
+ *
14
+ * }
15
+ *
16
+ * @Post('/file')
17
+ * @MulterOptions({dest: "/other-dir"})
18
+ * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
19
+ *
20
+ * }
21
+ *
22
+ * @Post('/file2')
23
+ * @MulterOptions({dest: "/other-dir"})
24
+ * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
25
+ *
26
+ * }
27
+ *
28
+ * @Post('/files')
29
+ * private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
30
+ *
31
+ * }
32
+ * }
33
+ * ```
34
+ *
35
+ * See the tutorial on the [multer configuration](/tutorials/multer.md).
36
+ *
37
+ * @param {multer.Options} options
38
+ * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
39
+ * @decorator
40
+ * @multer
41
+ */
42
+ export function MulterOptions(options) {
43
+ return (target, propertyKey, descriptor) => {
44
+ StoreMerge(PlatformMulterMiddleware, { options })(target, propertyKey, descriptor);
45
+ return descriptor;
46
+ };
47
+ }
48
+ //# sourceMappingURL=multerOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multerOptions.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA+B;IAC3D,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,UAAU,CAAC,wBAAwB,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAEjF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {StoreMerge} from \"@tsed/core\";\nimport {PlatformMulterSettings} from \"../../config/interfaces/PlatformMulterSettings\";\nimport {PlatformMulterMiddleware} from \"../../middlewares/PlatformMulterMiddleware\";\n\n/**\n * Define multer option for all MultipartFile\n *\n * ```typescript\n * import {Controller, Post, PlatformMulterFile, MultipartFile, MulterOptions} from \"@tsed/common\";\n *\n * @Controller('/')\n * class MyCtrl {\n * @Post('/file')\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/file')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/file2')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: PlatformMulterFile, @MultipartFile(\"file2\") file2: PlatformMulterFile) {\n *\n * }\n *\n * @Post('/files')\n * private uploadFile(@MultipartFile(\"file1\") files: PlatformMulterFile[]) {\n *\n * }\n * }\n * ```\n *\n * See the tutorial on the [multer configuration](/tutorials/multer.md).\n *\n * @param {multer.Options} options\n * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}\n * @decorator\n * @multer\n */\nexport function MulterOptions(options: PlatformMulterSettings): MethodDecorator {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n StoreMerge(PlatformMulterMiddleware, {options})(target, propertyKey, descriptor);\n\n return descriptor;\n };\n}\n"]}
@@ -0,0 +1,74 @@
1
+ import { Metadata, StoreMerge, useDecorators, useMethodDecorators } from "@tsed/core";
2
+ import { ParamTypes, UseParam } from "@tsed/platform-params";
3
+ import { InFile } from "@tsed/schema";
4
+ import { PlatformMulterMiddleware } from "../../middlewares/PlatformMulterMiddleware";
5
+ function mapOptions(name, maxCount) {
6
+ return {
7
+ fields: [
8
+ {
9
+ name,
10
+ maxCount
11
+ }
12
+ ]
13
+ };
14
+ }
15
+ /**
16
+ * Define a parameter as Multipart file.
17
+ *
18
+ * ```typescript
19
+ * import {Controller, Post} from "@tsed/common";
20
+ * import {MulterOptions, MultipartFile} from "@tsed/common";
21
+ * import {Multer} from "@types/multer";
22
+ *
23
+ * type MulterFile = Express.Multer.File;
24
+ *
25
+ * @Controller('/')
26
+ * class MyCtrl {
27
+ * @Post('/file')
28
+ * private uploadFile(@MultipartFile("file1") file: MulterFile) {
29
+ *
30
+ * }
31
+ *
32
+ * @Post('/file')
33
+ * @MulterOptions({dest: "/other-dir"})
34
+ * private uploadFile(@MultipartFile("file1") file: MulterFile) {
35
+ *
36
+ * }
37
+ *
38
+ * @Post('/file2')
39
+ * @MulterOptions({dest: "/other-dir"})
40
+ * private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
41
+ *
42
+ * }
43
+ *
44
+ * @Post('/files')
45
+ * private uploadFile(@MultipartFile("file1") files: MulterFile[]) {
46
+ *
47
+ * }
48
+ * }
49
+ * ```
50
+ *
51
+ * > See the tutorial on the [multer configuration](/tutorials/multer.md).
52
+ *
53
+ * @param name
54
+ * @param maxCount
55
+ * @returns Function
56
+ * @decorator
57
+ * @input
58
+ */
59
+ export function MultipartFile(name, maxCount) {
60
+ return (...args) => {
61
+ const [target, propertyKey, index] = args;
62
+ const multiple = Metadata.getParamTypes(target, propertyKey)[index] === Array;
63
+ name = (typeof name === "object" ? undefined : name);
64
+ const expression = [name, !multiple && "0"].filter(Boolean).join(".");
65
+ const decorators = useDecorators(InFile(name), useMethodDecorators(StoreMerge(PlatformMulterMiddleware, mapOptions(name, maxCount))), UseParam({
66
+ paramType: ParamTypes.FILES,
67
+ dataPath: "$ctx.request.files",
68
+ expression,
69
+ useValidation: true
70
+ }));
71
+ decorators(...args);
72
+ };
73
+ }
74
+ //# sourceMappingURL=multipartFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multipartFile.js","sourceRoot":"","sources":["../../../../src/decorators/multer/multipartFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,YAAY,CAAC;AACzG,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAA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ratorParameters, Metadata, StoreMerge, useDecorators, useMethodDecorators} from \"@tsed/core\";\nimport {ParamTypes, UseParam} from \"@tsed/platform-params\";\nimport {Consumes, InFile, Returns} from \"@tsed/schema\";\nimport {PlatformMulterFile} from \"../../config/interfaces/PlatformMulterSettings\";\nimport {MulterInputOptions, PlatformMulterMiddleware} from \"../../middlewares/PlatformMulterMiddleware\";\n\nfunction mapOptions(name: string, maxCount: number | undefined): MulterInputOptions {\n return {\n fields: [\n {\n name,\n maxCount\n }\n ]\n };\n}\n\n/**\n * Define a parameter as Multipart file.\n *\n * ```typescript\n * import {Controller, Post} from \"@tsed/common\";\n * import {MulterOptions, MultipartFile} from \"@tsed/common\";\n * import {Multer} from \"@types/multer\";\n *\n * type MulterFile = Express.Multer.File;\n *\n * @Controller('/')\n * class MyCtrl {\n * @Post('/file')\n * private uploadFile(@MultipartFile(\"file1\") file: MulterFile) {\n *\n * }\n *\n * @Post('/file')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: MulterFile) {\n *\n * }\n *\n * @Post('/file2')\n * @MulterOptions({dest: \"/other-dir\"})\n * private uploadFile(@MultipartFile(\"file1\") file: MulterFile, @MultipartFile(\"file2\") file2: MulterFile) {\n *\n * }\n *\n * @Post('/files')\n * private uploadFile(@MultipartFile(\"file1\") files: MulterFile[]) {\n *\n * }\n * }\n * ```\n *\n * > See the tutorial on the [multer configuration](/tutorials/multer.md).\n *\n * @param name\n * @param maxCount\n * @returns Function\n * @decorator\n * @input\n */\nexport function MultipartFile(name: string, maxCount?: number): ParameterDecorator {\n return (...args: DecoratorParameters): void => {\n const [target, propertyKey, index] = args;\n const multiple = Metadata.getParamTypes(target, propertyKey)[index as number] === Array;\n\n name = (typeof name === \"object\" ? undefined : name)!;\n\n const expression = [name, !multiple && \"0\"].filter(Boolean).join(\".\");\n\n const decorators = useDecorators(\n InFile(name),\n useMethodDecorators(StoreMerge(PlatformMulterMiddleware, mapOptions(name, maxCount))),\n UseParam({\n paramType: ParamTypes.FILES,\n dataPath: \"$ctx.request.files\",\n expression,\n useValidation: true\n })\n );\n\n decorators(...args);\n };\n}\n\nexport type MultipartFile = PlatformMulterFile;\n"]}
@@ -0,0 +1,16 @@
1
+ import { ParamTypes, UseParam } from "@tsed/platform-params";
2
+ /**
3
+ * @returns {Function}
4
+ * @decorator
5
+ * @operation
6
+ * @input
7
+ */
8
+ export function Err() {
9
+ return UseParam({
10
+ paramType: ParamTypes.ERR,
11
+ dataPath: "err",
12
+ useValidation: false,
13
+ useConverter: false
14
+ });
15
+ }
16
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../src/decorators/params/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO,QAAQ,CAAC;QACd,SAAS,EAAE,UAAU,CAAC,GAAG;QACzB,QAAQ,EAAE,KAAK;QACf,aAAa,EAAE,KAAK;QACpB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {ParamTypes, UseParam} from \"@tsed/platform-params\";\n\n/**\n * @returns {Function}\n * @decorator\n * @operation\n * @input\n */\nexport function Err(): Function {\n return UseParam({\n paramType: ParamTypes.ERR,\n dataPath: \"err\",\n useValidation: false,\n useConverter: false\n });\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import { ParamTypes, UseParam } from "@tsed/platform-params";
2
+ /**
3
+ * Get the Next function (for express application and middleware).
4
+ *
5
+ * @decorator
6
+ * @operation
7
+ * @input
8
+ */
9
+ export function Next() {
10
+ return UseParam({
11
+ paramType: ParamTypes.NEXT_FN,
12
+ dataPath: "next",
13
+ useConverter: false,
14
+ useValidation: false
15
+ });
16
+ }
17
+ //# sourceMappingURL=next.js.map