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

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 (409) 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 +26 -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/multer/index.js +7 -0
  32. package/lib/cjs/decorators/multer/index.js.map +1 -0
  33. package/lib/cjs/decorators/multer/multerFileSize.js +35 -0
  34. package/lib/cjs/decorators/multer/multerFileSize.js.map +1 -0
  35. package/lib/cjs/decorators/multer/multerOptions.js +52 -0
  36. package/lib/cjs/decorators/multer/multerOptions.js.map +1 -0
  37. package/lib/cjs/decorators/multer/multipartFile.js +78 -0
  38. package/lib/cjs/decorators/multer/multipartFile.js.map +1 -0
  39. package/lib/cjs/decorators/params/error.js +20 -0
  40. package/lib/cjs/decorators/params/error.js.map +1 -0
  41. package/lib/cjs/decorators/params/next.js +21 -0
  42. package/lib/cjs/decorators/params/next.js.map +1 -0
  43. package/lib/cjs/decorators/params/request.js +39 -0
  44. package/lib/cjs/decorators/params/request.js.map +1 -0
  45. package/lib/cjs/decorators/params/response.js +33 -0
  46. package/lib/cjs/decorators/params/response.js.map +1 -0
  47. package/lib/cjs/domain/AnyToPromiseWithCtx.js +27 -0
  48. package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +1 -0
  49. package/lib/cjs/domain/ControllerProvider.js +51 -0
  50. package/lib/cjs/domain/ControllerProvider.js.map +1 -0
  51. package/lib/cjs/domain/EndpointMetadata.js +70 -0
  52. package/lib/cjs/domain/EndpointMetadata.js.map +1 -0
  53. package/lib/cjs/domain/HandlerMetadata.js +57 -0
  54. package/lib/cjs/domain/HandlerMetadata.js.map +1 -0
  55. package/lib/cjs/domain/PlatformContext.js +92 -0
  56. package/lib/cjs/domain/PlatformContext.js.map +1 -0
  57. package/lib/cjs/domain/PlatformRouteDetails.js +24 -0
  58. package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -0
  59. package/lib/cjs/domain/index.js +10 -0
  60. package/lib/cjs/domain/index.js.map +1 -0
  61. package/lib/cjs/index.js +34 -0
  62. package/lib/cjs/index.js.map +1 -0
  63. package/lib/cjs/interfaces/AfterInit.js +3 -0
  64. package/lib/cjs/interfaces/AfterInit.js.map +1 -0
  65. package/lib/cjs/interfaces/AfterListen.js +3 -0
  66. package/lib/cjs/interfaces/AfterListen.js.map +1 -0
  67. package/lib/cjs/interfaces/AfterRoutesInit.js +3 -0
  68. package/lib/cjs/interfaces/AfterRoutesInit.js.map +1 -0
  69. package/lib/cjs/interfaces/BeforeInit.js +3 -0
  70. package/lib/cjs/interfaces/BeforeInit.js.map +1 -0
  71. package/lib/cjs/interfaces/BeforeListen.js +3 -0
  72. package/lib/cjs/interfaces/BeforeListen.js.map +1 -0
  73. package/lib/cjs/interfaces/BeforeRoutesInit.js +3 -0
  74. package/lib/cjs/interfaces/BeforeRoutesInit.js.map +1 -0
  75. package/lib/cjs/interfaces/HandlerType.js +17 -0
  76. package/lib/cjs/interfaces/HandlerType.js.map +1 -0
  77. package/lib/cjs/interfaces/IncomingEvent.js +3 -0
  78. package/lib/cjs/interfaces/IncomingEvent.js.map +1 -0
  79. package/lib/cjs/interfaces/OnReady.js +3 -0
  80. package/lib/cjs/interfaces/OnReady.js.map +1 -0
  81. package/lib/cjs/interfaces/OnRequest.js +3 -0
  82. package/lib/cjs/interfaces/OnRequest.js.map +1 -0
  83. package/lib/cjs/interfaces/OnResponse.js +3 -0
  84. package/lib/cjs/interfaces/OnResponse.js.map +1 -0
  85. package/lib/cjs/interfaces/OnRoutesInit.js +3 -0
  86. package/lib/cjs/interfaces/OnRoutesInit.js.map +1 -0
  87. package/lib/cjs/interfaces/PathType.js +3 -0
  88. package/lib/cjs/interfaces/PathType.js.map +1 -0
  89. package/lib/cjs/interfaces/PlatformAdapter.js +3 -0
  90. package/lib/cjs/interfaces/PlatformAdapter.js.map +1 -0
  91. package/lib/cjs/interfaces/PlatformRouteOptions.js +3 -0
  92. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -0
  93. package/lib/cjs/interfaces/ResponseErrorObject.js +3 -0
  94. package/lib/cjs/interfaces/ResponseErrorObject.js.map +1 -0
  95. package/lib/cjs/interfaces/Route.js +3 -0
  96. package/lib/cjs/interfaces/Route.js.map +1 -0
  97. package/lib/cjs/interfaces/index.js +21 -0
  98. package/lib/cjs/interfaces/index.js.map +1 -0
  99. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +37 -0
  100. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  101. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +55 -0
  102. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -0
  103. package/lib/cjs/middlewares/__mock__/FakeCtrl.js +12 -0
  104. package/lib/cjs/middlewares/__mock__/FakeCtrl.js.map +1 -0
  105. package/lib/cjs/middlewares/bindEndpointMiddleware.js +13 -0
  106. package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -0
  107. package/lib/cjs/middlewares/index.js +7 -0
  108. package/lib/cjs/middlewares/index.js.map +1 -0
  109. package/lib/cjs/services/FakeRawDriver.js +26 -0
  110. package/lib/cjs/services/FakeRawDriver.js.map +1 -0
  111. package/lib/cjs/services/Platform.js +107 -0
  112. package/lib/cjs/services/Platform.js.map +1 -0
  113. package/lib/cjs/services/PlatformApplication.js +34 -0
  114. package/lib/cjs/services/PlatformApplication.js.map +1 -0
  115. package/lib/cjs/services/PlatformHandler.js +233 -0
  116. package/lib/cjs/services/PlatformHandler.js.map +1 -0
  117. package/lib/cjs/services/PlatformMiddlewaresChain.js +34 -0
  118. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -0
  119. package/lib/cjs/services/PlatformRequest.js +138 -0
  120. package/lib/cjs/services/PlatformRequest.js.map +1 -0
  121. package/lib/cjs/services/PlatformResponse.js +271 -0
  122. package/lib/cjs/services/PlatformResponse.js.map +1 -0
  123. package/lib/cjs/services/PlatformRouter.js +126 -0
  124. package/lib/cjs/services/PlatformRouter.js.map +1 -0
  125. package/lib/cjs/services/PlatformTest.js +166 -0
  126. package/lib/cjs/services/PlatformTest.js.map +1 -0
  127. package/lib/cjs/services/index.js +12 -0
  128. package/lib/cjs/services/index.js.map +1 -0
  129. package/lib/cjs/utils/createContext.js +38 -0
  130. package/lib/cjs/utils/createContext.js.map +1 -0
  131. package/lib/cjs/utils/createHandlerMetadata.js +49 -0
  132. package/lib/cjs/utils/createHandlerMetadata.js.map +1 -0
  133. package/lib/cjs/utils/createHttpServer.js +34 -0
  134. package/lib/cjs/utils/createHttpServer.js.map +1 -0
  135. package/lib/cjs/utils/createHttpsServer.js +34 -0
  136. package/lib/cjs/utils/createHttpsServer.js.map +1 -0
  137. package/lib/cjs/utils/createInjector.js +38 -0
  138. package/lib/cjs/utils/createInjector.js.map +1 -0
  139. package/lib/cjs/utils/getConfiguration.js +42 -0
  140. package/lib/cjs/utils/getConfiguration.js.map +1 -0
  141. package/lib/cjs/utils/getStaticsOptions.js +21 -0
  142. package/lib/cjs/utils/getStaticsOptions.js.map +1 -0
  143. package/lib/cjs/utils/index.js +11 -0
  144. package/lib/cjs/utils/index.js.map +1 -0
  145. package/lib/cjs/utils/listenServer.js +21 -0
  146. package/lib/cjs/utils/listenServer.js.map +1 -0
  147. package/lib/cjs/utils/mapReturnedResponse.js +15 -0
  148. package/lib/cjs/utils/mapReturnedResponse.js.map +1 -0
  149. package/lib/cjs/utils/printRoutes.js +36 -0
  150. package/lib/cjs/utils/printRoutes.js.map +1 -0
  151. package/lib/cjs/utils/setResponseHeaders.js +35 -0
  152. package/lib/cjs/utils/setResponseHeaders.js.map +1 -0
  153. package/lib/cjs/utils/useCtxHandler.js +15 -0
  154. package/lib/cjs/utils/useCtxHandler.js.map +1 -0
  155. package/lib/esm/builder/PlatformBuilder.js +271 -0
  156. package/lib/esm/builder/PlatformBuilder.js.map +1 -0
  157. package/lib/esm/builder/PlatformControllerBuilder.js +79 -0
  158. package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -0
  159. package/lib/esm/config/index.js +4 -0
  160. package/lib/esm/config/index.js.map +1 -0
  161. package/lib/esm/config/interfaces/ConverterSettings.js +2 -0
  162. package/lib/esm/config/interfaces/ConverterSettings.js.map +1 -0
  163. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js +2 -0
  164. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js.map +1 -0
  165. package/lib/esm/config/interfaces/PlatformLoggerSettings.js +2 -0
  166. package/lib/esm/config/interfaces/PlatformLoggerSettings.js.map +1 -0
  167. package/lib/esm/config/interfaces/PlatformMulterSettings.js +2 -0
  168. package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -0
  169. package/lib/esm/config/interfaces/PlatformStaticsSettings.js +2 -0
  170. package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +1 -0
  171. package/lib/esm/config/interfaces/index.js +5 -0
  172. package/lib/esm/config/interfaces/index.js.map +1 -0
  173. package/lib/esm/config/services/PlatformConfiguration.js +178 -0
  174. package/lib/esm/config/services/PlatformConfiguration.js.map +1 -0
  175. package/lib/esm/constants/routerOptions.js +2 -0
  176. package/lib/esm/constants/routerOptions.js.map +1 -0
  177. package/lib/esm/decorators/httpServer.js +28 -0
  178. package/lib/esm/decorators/httpServer.js.map +1 -0
  179. package/lib/esm/decorators/httpsServer.js +28 -0
  180. package/lib/esm/decorators/httpsServer.js.map +1 -0
  181. package/lib/esm/decorators/index.js +14 -0
  182. package/lib/esm/decorators/index.js.map +1 -0
  183. package/lib/esm/decorators/method/acceptMime.js +24 -0
  184. package/lib/esm/decorators/method/acceptMime.js.map +1 -0
  185. package/lib/esm/decorators/multer/index.js +4 -0
  186. package/lib/esm/decorators/multer/index.js.map +1 -0
  187. package/lib/esm/decorators/multer/multerFileSize.js +31 -0
  188. package/lib/esm/decorators/multer/multerFileSize.js.map +1 -0
  189. package/lib/esm/decorators/multer/multerOptions.js +48 -0
  190. package/lib/esm/decorators/multer/multerOptions.js.map +1 -0
  191. package/lib/esm/decorators/multer/multipartFile.js +74 -0
  192. package/lib/esm/decorators/multer/multipartFile.js.map +1 -0
  193. package/lib/esm/decorators/params/error.js +16 -0
  194. package/lib/esm/decorators/params/error.js.map +1 -0
  195. package/lib/esm/decorators/params/next.js +17 -0
  196. package/lib/esm/decorators/params/next.js.map +1 -0
  197. package/lib/esm/decorators/params/request.js +34 -0
  198. package/lib/esm/decorators/params/request.js.map +1 -0
  199. package/lib/esm/decorators/params/response.js +28 -0
  200. package/lib/esm/decorators/params/response.js.map +1 -0
  201. package/lib/esm/domain/AnyToPromiseWithCtx.js +23 -0
  202. package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -0
  203. package/lib/esm/domain/ControllerProvider.js +47 -0
  204. package/lib/esm/domain/ControllerProvider.js.map +1 -0
  205. package/lib/esm/domain/EndpointMetadata.js +67 -0
  206. package/lib/esm/domain/EndpointMetadata.js.map +1 -0
  207. package/lib/esm/domain/HandlerMetadata.js +53 -0
  208. package/lib/esm/domain/HandlerMetadata.js.map +1 -0
  209. package/lib/esm/domain/PlatformContext.js +88 -0
  210. package/lib/esm/domain/PlatformContext.js.map +1 -0
  211. package/lib/esm/domain/PlatformRouteDetails.js +20 -0
  212. package/lib/esm/domain/PlatformRouteDetails.js.map +1 -0
  213. package/lib/esm/domain/index.js +7 -0
  214. package/lib/esm/domain/index.js.map +1 -0
  215. package/lib/esm/index.js +28 -0
  216. package/lib/esm/index.js.map +1 -0
  217. package/lib/esm/interfaces/AfterInit.js +2 -0
  218. package/lib/esm/interfaces/AfterInit.js.map +1 -0
  219. package/lib/esm/interfaces/AfterListen.js +2 -0
  220. package/lib/esm/interfaces/AfterListen.js.map +1 -0
  221. package/lib/esm/interfaces/AfterRoutesInit.js +2 -0
  222. package/lib/esm/interfaces/AfterRoutesInit.js.map +1 -0
  223. package/lib/esm/interfaces/BeforeInit.js +2 -0
  224. package/lib/esm/interfaces/BeforeInit.js.map +1 -0
  225. package/lib/esm/interfaces/BeforeListen.js +2 -0
  226. package/lib/esm/interfaces/BeforeListen.js.map +1 -0
  227. package/lib/esm/interfaces/BeforeRoutesInit.js +2 -0
  228. package/lib/esm/interfaces/BeforeRoutesInit.js.map +1 -0
  229. package/lib/esm/interfaces/HandlerType.js +14 -0
  230. package/lib/esm/interfaces/HandlerType.js.map +1 -0
  231. package/lib/esm/interfaces/IncomingEvent.js +2 -0
  232. package/lib/esm/interfaces/IncomingEvent.js.map +1 -0
  233. package/lib/esm/interfaces/OnReady.js +2 -0
  234. package/lib/esm/interfaces/OnReady.js.map +1 -0
  235. package/lib/esm/interfaces/OnRequest.js +2 -0
  236. package/lib/esm/interfaces/OnRequest.js.map +1 -0
  237. package/lib/esm/interfaces/OnResponse.js +2 -0
  238. package/lib/esm/interfaces/OnResponse.js.map +1 -0
  239. package/lib/esm/interfaces/OnRoutesInit.js +2 -0
  240. package/lib/esm/interfaces/OnRoutesInit.js.map +1 -0
  241. package/lib/esm/interfaces/PathType.js +2 -0
  242. package/lib/esm/interfaces/PathType.js.map +1 -0
  243. package/lib/esm/interfaces/PlatformAdapter.js +2 -0
  244. package/lib/esm/interfaces/PlatformAdapter.js.map +1 -0
  245. package/lib/esm/interfaces/PlatformRouteOptions.js +2 -0
  246. package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -0
  247. package/lib/esm/interfaces/ResponseErrorObject.js +2 -0
  248. package/lib/esm/interfaces/ResponseErrorObject.js.map +1 -0
  249. package/lib/esm/interfaces/Route.js +2 -0
  250. package/lib/esm/interfaces/Route.js.map +1 -0
  251. package/lib/esm/interfaces/index.js +18 -0
  252. package/lib/esm/interfaces/index.js.map +1 -0
  253. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +34 -0
  254. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -0
  255. package/lib/esm/middlewares/PlatformMulterMiddleware.js +52 -0
  256. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -0
  257. package/lib/esm/middlewares/__mock__/FakeCtrl.js +9 -0
  258. package/lib/esm/middlewares/__mock__/FakeCtrl.js.map +1 -0
  259. package/lib/esm/middlewares/bindEndpointMiddleware.js +9 -0
  260. package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -0
  261. package/lib/esm/middlewares/index.js +4 -0
  262. package/lib/esm/middlewares/index.js.map +1 -0
  263. package/lib/esm/services/FakeRawDriver.js +22 -0
  264. package/lib/esm/services/FakeRawDriver.js.map +1 -0
  265. package/lib/esm/services/Platform.js +104 -0
  266. package/lib/esm/services/Platform.js.map +1 -0
  267. package/lib/esm/services/PlatformApplication.js +31 -0
  268. package/lib/esm/services/PlatformApplication.js.map +1 -0
  269. package/lib/esm/services/PlatformHandler.js +230 -0
  270. package/lib/esm/services/PlatformHandler.js.map +1 -0
  271. package/lib/esm/services/PlatformMiddlewaresChain.js +31 -0
  272. package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -0
  273. package/lib/esm/services/PlatformRequest.js +135 -0
  274. package/lib/esm/services/PlatformRequest.js.map +1 -0
  275. package/lib/esm/services/PlatformResponse.js +268 -0
  276. package/lib/esm/services/PlatformResponse.js.map +1 -0
  277. package/lib/esm/services/PlatformRouter.js +123 -0
  278. package/lib/esm/services/PlatformRouter.js.map +1 -0
  279. package/lib/esm/services/PlatformTest.js +162 -0
  280. package/lib/esm/services/PlatformTest.js.map +1 -0
  281. package/lib/esm/services/index.js +9 -0
  282. package/lib/esm/services/index.js.map +1 -0
  283. package/lib/esm/utils/createContext.js +34 -0
  284. package/lib/esm/utils/createContext.js.map +1 -0
  285. package/lib/esm/utils/createHandlerMetadata.js +45 -0
  286. package/lib/esm/utils/createHandlerMetadata.js.map +1 -0
  287. package/lib/esm/utils/createHttpServer.js +29 -0
  288. package/lib/esm/utils/createHttpServer.js.map +1 -0
  289. package/lib/esm/utils/createHttpsServer.js +29 -0
  290. package/lib/esm/utils/createHttpsServer.js.map +1 -0
  291. package/lib/esm/utils/createInjector.js +34 -0
  292. package/lib/esm/utils/createInjector.js.map +1 -0
  293. package/lib/esm/utils/getConfiguration.js +38 -0
  294. package/lib/esm/utils/getConfiguration.js.map +1 -0
  295. package/lib/esm/utils/getStaticsOptions.js +17 -0
  296. package/lib/esm/utils/getStaticsOptions.js.map +1 -0
  297. package/lib/esm/utils/index.js +8 -0
  298. package/lib/esm/utils/index.js.map +1 -0
  299. package/lib/esm/utils/listenServer.js +17 -0
  300. package/lib/esm/utils/listenServer.js.map +1 -0
  301. package/lib/esm/utils/mapReturnedResponse.js +11 -0
  302. package/lib/esm/utils/mapReturnedResponse.js.map +1 -0
  303. package/lib/esm/utils/printRoutes.js +32 -0
  304. package/lib/esm/utils/printRoutes.js.map +1 -0
  305. package/lib/esm/utils/setResponseHeaders.js +31 -0
  306. package/lib/esm/utils/setResponseHeaders.js.map +1 -0
  307. package/lib/esm/utils/useCtxHandler.js +11 -0
  308. package/lib/esm/utils/useCtxHandler.js.map +1 -0
  309. package/lib/{builder → types/builder}/PlatformBuilder.d.ts +25 -30
  310. package/lib/types/builder/PlatformControllerBuilder.d.ts +17 -0
  311. package/lib/{config → types/config}/index.d.ts +0 -0
  312. package/lib/{config → types/config}/interfaces/ConverterSettings.d.ts +0 -0
  313. package/lib/{config → types/config}/interfaces/EndpointDirectoriesSettings.d.ts +0 -0
  314. package/lib/{config → types/config}/interfaces/PlatformLoggerSettings.d.ts +0 -16
  315. package/lib/{config → types/config}/interfaces/PlatformMulterSettings.d.ts +0 -0
  316. package/lib/{config → types/config}/interfaces/PlatformStaticsSettings.d.ts +1 -0
  317. package/lib/{config → types/config}/interfaces/index.d.ts +17 -2
  318. package/lib/{config → types/config}/services/PlatformConfiguration.d.ts +13 -11
  319. package/lib/{constants → types/constants}/routerOptions.d.ts +0 -0
  320. package/lib/{decorators → types/decorators}/httpServer.d.ts +1 -0
  321. package/lib/{decorators → types/decorators}/httpsServer.d.ts +1 -0
  322. package/lib/{decorators → types/decorators}/index.d.ts +1 -5
  323. package/lib/{decorators → types/decorators}/method/acceptMime.d.ts +0 -0
  324. package/lib/{decorators → types/decorators}/multer/index.d.ts +0 -0
  325. package/lib/{decorators → types/decorators}/multer/multerFileSize.d.ts +0 -0
  326. package/lib/{decorators → types/decorators}/multer/multerOptions.d.ts +0 -0
  327. package/lib/{decorators → types/decorators}/multer/multipartFile.d.ts +0 -0
  328. package/lib/{decorators → types/decorators}/params/error.d.ts +0 -0
  329. package/lib/{decorators → types/decorators}/params/next.d.ts +0 -0
  330. package/lib/{decorators → types/decorators}/params/request.d.ts +0 -0
  331. package/lib/{decorators → types/decorators}/params/response.d.ts +0 -0
  332. package/lib/{domain → types/domain}/AnyToPromiseWithCtx.d.ts +0 -0
  333. package/lib/types/domain/ControllerProvider.d.ts +24 -0
  334. package/lib/{domain → types/domain}/EndpointMetadata.d.ts +3 -42
  335. package/lib/{domain → types/domain}/HandlerMetadata.d.ts +2 -2
  336. package/lib/{domain → types/domain}/PlatformContext.d.ts +1 -1
  337. package/lib/{domain → types/domain}/PlatformRouteDetails.d.ts +4 -10
  338. package/lib/{domain → types/domain}/index.d.ts +0 -0
  339. package/lib/{index.d.ts → types/index.d.ts} +2 -3
  340. package/lib/{interfaces → types/interfaces}/AfterInit.d.ts +0 -0
  341. package/lib/{interfaces → types/interfaces}/AfterListen.d.ts +0 -0
  342. package/lib/{interfaces → types/interfaces}/AfterRoutesInit.d.ts +0 -0
  343. package/lib/{interfaces → types/interfaces}/BeforeInit.d.ts +0 -0
  344. package/lib/{interfaces → types/interfaces}/BeforeListen.d.ts +0 -0
  345. package/lib/{interfaces → types/interfaces}/BeforeRoutesInit.d.ts +0 -0
  346. package/lib/{interfaces → types/interfaces}/HandlerType.d.ts +0 -0
  347. package/lib/{interfaces → types/interfaces}/IncomingEvent.d.ts +0 -0
  348. package/lib/{interfaces → types/interfaces}/OnReady.d.ts +0 -0
  349. package/lib/{interfaces → types/interfaces}/OnRequest.d.ts +0 -0
  350. package/lib/{interfaces → types/interfaces}/OnResponse.d.ts +0 -0
  351. package/lib/{interfaces → types/interfaces}/OnRoutesInit.d.ts +0 -0
  352. package/lib/{interfaces → types/interfaces}/PathType.d.ts +0 -0
  353. package/lib/types/interfaces/PlatformAdapter.d.ts +19 -0
  354. package/lib/{interfaces → types/interfaces}/PlatformRouteOptions.d.ts +5 -3
  355. package/lib/{interfaces → types/interfaces}/ResponseErrorObject.d.ts +0 -0
  356. package/lib/{interfaces → types/interfaces}/Route.d.ts +0 -0
  357. package/lib/{interfaces → types/interfaces}/index.d.ts +1 -2
  358. package/lib/{middlewares → types/middlewares}/PlatformAcceptMimesMiddleware.d.ts +0 -0
  359. package/lib/{middlewares → types/middlewares}/PlatformMulterMiddleware.d.ts +0 -0
  360. package/lib/{middlewares/data → types/middlewares/__mock__}/FakeCtrl.d.ts +0 -0
  361. package/lib/{middlewares → types/middlewares}/bindEndpointMiddleware.d.ts +0 -0
  362. package/lib/{middlewares → types/middlewares}/index.d.ts +0 -1
  363. package/lib/{services → types/services}/FakeRawDriver.d.ts +0 -0
  364. package/lib/{services → types/services}/Platform.d.ts +12 -6
  365. package/lib/{services → types/services}/PlatformApplication.d.ts +0 -0
  366. package/lib/{services → types/services}/PlatformHandler.d.ts +3 -8
  367. package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -0
  368. package/lib/{services → types/services}/PlatformRequest.d.ts +2 -1
  369. package/lib/{services → types/services}/PlatformResponse.d.ts +4 -4
  370. package/lib/{services → types/services}/PlatformRouter.d.ts +4 -3
  371. package/lib/{services → types/services}/PlatformTest.d.ts +7 -6
  372. package/lib/{services → types/services}/index.d.ts +1 -1
  373. package/lib/{utils → types/utils}/createContext.d.ts +0 -0
  374. package/lib/{utils → types/utils}/createHandlerMetadata.d.ts +0 -0
  375. package/lib/types/utils/createHttpServer.d.ts +4 -0
  376. package/lib/types/utils/createHttpsServer.d.ts +4 -0
  377. package/lib/types/utils/createInjector.d.ts +7 -0
  378. package/lib/types/utils/getConfiguration.d.ts +2 -0
  379. package/lib/types/utils/getStaticsOptions.d.ts +5 -0
  380. package/lib/{utils → types/utils}/index.d.ts +0 -1
  381. package/lib/types/utils/listenServer.d.ts +7 -0
  382. package/lib/{utils → types/utils}/mapReturnedResponse.d.ts +0 -0
  383. package/lib/{utils → types/utils}/printRoutes.d.ts +0 -0
  384. package/lib/{utils → types/utils}/setResponseHeaders.d.ts +0 -0
  385. package/lib/{utils → types/utils}/useCtxHandler.d.ts +0 -0
  386. package/package.json +29 -24
  387. package/tsconfig.compile.esm.json +23 -0
  388. package/lib/PlatformModule.d.ts +0 -15
  389. package/lib/builder/PlatformControllerBuilder.d.ts +0 -19
  390. package/lib/decorators/class/controller.d.ts +0 -43
  391. package/lib/decorators/method/endpointFn.d.ts +0 -8
  392. package/lib/decorators/method/location.d.ts +0 -1
  393. package/lib/decorators/method/redirect.d.ts +0 -1
  394. package/lib/decorators/method/route.d.ts +0 -128
  395. package/lib/domain/ControllerProvider.d.ts +0 -54
  396. package/lib/index.js +0 -3990
  397. package/lib/index.js.map +0 -1
  398. package/lib/index.modern.js +0 -3870
  399. package/lib/index.modern.js.map +0 -1
  400. package/lib/interfaces/PlatformRouterMethods.d.ts +0 -10
  401. package/lib/middlewares/PlatformLogMiddleware.d.ts +0 -44
  402. package/lib/registries/ControllerRegistry.d.ts +0 -1
  403. package/lib/services/ConverterService.d.ts +0 -27
  404. package/lib/utils/createHttpServer.d.ts +0 -3
  405. package/lib/utils/createHttpsServer.d.ts +0 -3
  406. package/lib/utils/createInjector.d.ts +0 -2
  407. package/lib/utils/createPlatformApplication.d.ts +0 -2
  408. package/lib/utils/getControllerPath.d.ts +0 -2
  409. 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;IAED,IAAI,OAAO,CAAC,CAAS;QACnB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,CAAC,KAAa;QACvB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAI,IAAI,CAAC,KAA8B;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,YAAY,CAAC,KAA0B;QACzC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,C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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,14 @@
1
+ export * from "./httpServer";
2
+ export * from "./httpsServer";
3
+ export * from "./multer";
4
+ // Method
5
+ export { Get, Post, Put, Patch, Delete, Head, Options, All } from "@tsed/schema";
6
+ export * from "./method/acceptMime";
7
+ // Params
8
+ export * from "./params/response";
9
+ export * from "./params/request";
10
+ export * from "./params/next";
11
+ export * from "./params/error";
12
+ // utils
13
+ export * from "../utils/mapReturnedResponse";
14
+ //# 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,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAC,MAAM,cAAc,CAAC;AAC/E,cAAc,qBAAqB,CAAC;AAEpC,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 {Get, Post, Put, Patch, Delete, Head, Options, All} from \"@tsed/schema\";\nexport * from \"./method/acceptMime\";\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,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,uBAAuB,CAAC;AAC3D,OAAO,EAAW,MAAM,EAAU,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAqB,wBAAwB,EAAC,MAAM,4CAA4C,CAAC;AAExG,SAAS,UAAU,CAAC,IAAY,EAAE,QAA4B;IAC5D,OAAO;QACL,MAAM,EAAE;YACN;gBACE,IAAI;gBACJ,QAAQ;aACT;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAAiB;IAC3D,OAAO,CAAC,GAAG,IAAyB,EAAQ,EAAE;QAC5C,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;QAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAe,CAAC,KAAK,KAAK,CAAC;QAExF,IAAI,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAE,CAAC;QAEtD,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEtE,MAAM,UAAU,GAAG,aAAa,CAC9B,MAAM,CAAC,IAAI,CAAC,EACZ,mBAAmB,CAAC,UAAU,CAAC,wBAAwB,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrF,QAAQ,CAAC;YACP,SAAS,EAAE,UAAU,CAAC,KAAK;YAC3B,QAAQ,EAAE,oBAAoB;YAC9B,UAAU;YACV,aAAa,EAAE,IAAI;SACpB,CAAC,CACH,CAAC;QAEF,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters, 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.js","sourceRoot":"","sources":["../../../../src/decorators/params/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,IAAI;IAClB,OAAO,QAAQ,CAAC;QACd,SAAS,EAAE,UAAU,CAAC,OAAO;QAC7B,QAAQ,EAAE,MAAM;QAChB,YAAY,EAAE,KAAK;QACnB,aAAa,EAAE,KAAK;KACrB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {ParamTypes, UseParam} from \"@tsed/platform-params\";\n\n/**\n * Get the Next function (for express application and middleware).\n *\n * @decorator\n * @operation\n * @input\n */\nexport function Next(): ParameterDecorator {\n return UseParam({\n paramType: ParamTypes.NEXT_FN,\n dataPath: \"next\",\n useConverter: false,\n useValidation: false\n });\n}\n\ndeclare global {\n namespace TsED {\n export interface NextFunction extends Function {}\n }\n}\n/**\n * Get the Next function (for express application and middleware).\n *\n * @decorator\n * @operation\n * @input\n */\nexport type Next = TsED.NextFunction;\n"]}
@@ -0,0 +1,34 @@
1
+ import { isClass, Metadata, nameOf } from "@tsed/core";
2
+ import { IncomingMessage } from "http";
3
+ import { mapParamsOptions, ParamTypes, UseParam } from "@tsed/platform-params";
4
+ function getParamType(target, propertyKey, parameterIndex) {
5
+ const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];
6
+ if (isClass(type)) {
7
+ if (nameOf(type) === "PlatformRequest") {
8
+ return { paramType: ParamTypes.PLATFORM_REQUEST, dataPath: "$ctx.request" };
9
+ }
10
+ if (type === IncomingMessage) {
11
+ return { paramType: ParamTypes.NODE_REQUEST, dataPath: "$ctx.request.req" };
12
+ }
13
+ }
14
+ return { paramType: ParamTypes.REQUEST, dataPath: "$ctx.request.request" };
15
+ }
16
+ export function Request(...args) {
17
+ // @ts-ignore
18
+ return Req(...args);
19
+ }
20
+ export function Req(...args) {
21
+ const { expression, useType, useConverter = false, useValidation = false } = mapParamsOptions(args);
22
+ return (target, propertyKey, parameterIndex) => {
23
+ const { paramType, dataPath } = getParamType(target, propertyKey, parameterIndex);
24
+ UseParam({
25
+ paramType,
26
+ dataPath,
27
+ expression,
28
+ useType,
29
+ useConverter,
30
+ useValidation
31
+ })(target, propertyKey, parameterIndex);
32
+ };
33
+ }
34
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sour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,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAEhF,QAAQ,CAAC;YACP,SAAS;YACT,QAAQ;YACR,UAAU;YACV,OAAO;YACP,YAAY;YACZ,aAAa;SACd,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {isClass, Metadata, nameOf, Type} from \"@tsed/core\";\nimport {IncomingMessage} from \"http\";\nimport {mapParamsOptions, ParamOptions, ParamTypes, UseParam} from \"@tsed/platform-params\";\n\nfunction getParamType(target: Object, propertyKey: string | symbol, parameterIndex: number) {\n const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];\n\n if (isClass(type)) {\n if (nameOf(type) === \"PlatformRequest\") {\n return {paramType: ParamTypes.PLATFORM_REQUEST, dataPath: \"$ctx.request\"};\n }\n\n if (type === IncomingMessage) {\n return {paramType: ParamTypes.NODE_REQUEST, dataPath: \"$ctx.request.req\"};\n }\n }\n\n return {paramType: ParamTypes.REQUEST, dataPath: \"$ctx.request.request\"};\n}\n\n/**\n * Request service.\n *\n * @decorator\n * @operation\n * @input\n */\nexport function Request(expression: string, useType: Type<any>): ParameterDecorator;\nexport function Request(expression: string): ParameterDecorator;\nexport function Request(useType: Type<any>): ParameterDecorator;\nexport function Request(options: ParamOptions<any>): ParameterDecorator;\nexport function Request(): ParameterDecorator;\nexport function Request(...args: any[]): ParameterDecorator {\n // @ts-ignore\n return Req(...args);\n}\n\n/**\n * Request service.\n *\n * @alias Request\n * @decorator\n * @operation\n * @input\n */\nexport function Req(expression: string, useType: Type<any>): ParameterDecorator;\nexport function Req(expression: string): ParameterDecorator;\nexport function Req(useType: Type<any>): ParameterDecorator;\nexport function Req(options: Partial<ParamOptions>): ParameterDecorator;\nexport function Req(): ParameterDecorator;\nexport function Req(...args: any[]): ParameterDecorator {\n const {expression, useType, useConverter = false, useValidation = false} = mapParamsOptions(args);\n\n return (target, propertyKey, parameterIndex) => {\n const {paramType, dataPath} = getParamType(target, propertyKey, parameterIndex);\n\n UseParam({\n paramType,\n dataPath,\n expression,\n useType,\n useConverter,\n useValidation\n })(target, propertyKey, parameterIndex);\n };\n}\n\n/**\n * Request service.\n *\n * @decorator\n * @operation\n * @input\n */\nexport interface Request extends TsED.Request {}\n\n/**\n * Request service.\n *\n * @alias Request\n * @decorator\n * @operation\n * @input\n */\nexport interface Req extends Request {}\n"]}
@@ -0,0 +1,28 @@
1
+ import { isClass, Metadata, nameOf } from "@tsed/core";
2
+ import { ParamTypes, UseParam } from "@tsed/platform-params";
3
+ import { ServerResponse } from "http";
4
+ function getParamType(target, propertyKey, parameterIndex) {
5
+ const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];
6
+ if (isClass(type)) {
7
+ if (nameOf(type) === "PlatformResponse") {
8
+ return { paramType: ParamTypes.PLATFORM_RESPONSE, dataPath: "$ctx.response" };
9
+ }
10
+ if (type === ServerResponse) {
11
+ return { paramType: ParamTypes.NODE_RESPONSE, dataPath: "$ctx.response.res" };
12
+ }
13
+ }
14
+ return { paramType: ParamTypes.RESPONSE, dataPath: "$ctx.response.response" };
15
+ }
16
+ export function Response() {
17
+ return Res();
18
+ }
19
+ export function Res() {
20
+ return (target, propertyKey, parameterIndex) => {
21
+ const { paramType, dataPath } = getParamType(target, propertyKey, parameterIndex);
22
+ UseParam({
23
+ paramType,
24
+ dataPath
25
+ })(target, propertyKey, parameterIndex);
26
+ };
27
+ }
28
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/decorators/params/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAC,MAAM,MAAM,CAAC;AAEpC,SAAS,YAAY,CAAC,MAAc,EAAE,WAA4B,EAAE,cAAsB;IACxF,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,cAAc,CAAC,CAAC;IAE5E,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,kBAAkB,EAAE;YACvC,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAC,CAAC;SAC7E;QAED,IAAI,IAAI,KAAK,cAAc,EAAE;YAC3B,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,aAAa,EAAE,QAAQ,EAAE,mBAAmB,EAAC,CAAC;SAC7E;KACF;IAED,OAAO,EAAC,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,EAAC,CAAC;AAC9E,CAAC;AAWD,MAAM,UAAU,QAAQ;IACtB,OAAO,GAAG,EAAE,CAAC;AACf,CAAC;AAYD,MAAM,UAAU,GAAG;IACjB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE;QAC7C,MAAM,EAAC,SAAS,EAAE,QAAQ,EAAC,GAAG,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QAChF,QAAQ,CAAC;YACP,SAAS;YACT,QAAQ;SACT,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {isClass, Metadata, nameOf} from \"@tsed/core\";\nimport {ParamTypes, UseParam} from \"@tsed/platform-params\";\nimport {ServerResponse} from \"http\";\n\nfunction getParamType(target: Object, propertyKey: string | symbol, parameterIndex: number) {\n const type = Metadata.getOwnParamTypes(target, propertyKey)[parameterIndex];\n\n if (isClass(type)) {\n if (nameOf(type) === \"PlatformResponse\") {\n return {paramType: ParamTypes.PLATFORM_RESPONSE, dataPath: \"$ctx.response\"};\n }\n\n if (type === ServerResponse) {\n return {paramType: ParamTypes.NODE_RESPONSE, dataPath: \"$ctx.response.res\"};\n }\n }\n\n return {paramType: ParamTypes.RESPONSE, dataPath: \"$ctx.response.response\"};\n}\n\n/**\n * Response service.\n *\n * @decorator\n * @operation\n * @input\n * @response\n */\nexport function Response(): ParameterDecorator;\nexport function Response(): ParameterDecorator {\n return Res();\n}\n\n/**\n * Request service.\n *\n * @alias Response\n * @decorator\n * @operation\n * @input\n * @response\n */\nexport function Res(): ParameterDecorator;\nexport function Res(): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const {paramType, dataPath} = getParamType(target, propertyKey, parameterIndex);\n UseParam({\n paramType,\n dataPath\n })(target, propertyKey, parameterIndex);\n };\n}\n\n/**\n * Response service.\n *\n * @decorator\n * @operation\n * @input\n * @response\n */\nexport interface Response extends TsED.Response {}\n\n/**\n * Response service.\n *\n * @alias Response\n * @decorator\n * @operation\n * @input\n * @response\n */\nexport interface Res extends Response {}\n"]}