@tsed/common 7.0.0-beta.1 → 7.0.0-beta.12

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 (298) hide show
  1. package/lib/cjs/builder/PlatformBuilder.js +48 -42
  2. package/lib/cjs/builder/PlatformBuilder.js.map +1 -1
  3. package/lib/cjs/builder/PlatformControllerBuilder.js +5 -8
  4. package/lib/cjs/builder/PlatformControllerBuilder.js.map +1 -1
  5. package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +1 -1
  6. package/lib/cjs/config/services/PlatformConfiguration.js +8 -2
  7. package/lib/cjs/config/services/PlatformConfiguration.js.map +1 -1
  8. package/lib/cjs/decorators/multer/multipartFile.js.map +1 -1
  9. package/lib/cjs/domain/EndpointMetadata.js +2 -66
  10. package/lib/cjs/domain/EndpointMetadata.js.map +1 -1
  11. package/lib/cjs/domain/PlatformContext.js.map +1 -1
  12. package/lib/cjs/domain/PlatformRouteDetails.js.map +1 -1
  13. package/lib/cjs/exports.js +31 -0
  14. package/lib/cjs/exports.js.map +1 -0
  15. package/lib/cjs/index.js +64 -30
  16. package/lib/cjs/index.js.map +1 -1
  17. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +1 -1
  18. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +8 -8
  19. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
  20. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +25 -13
  21. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +1 -1
  22. package/lib/cjs/middlewares/__mock__/FakeCtrl.js +1 -1
  23. package/lib/cjs/middlewares/bindEndpointMiddleware.js.map +1 -1
  24. package/lib/cjs/package.json +3 -0
  25. package/lib/cjs/services/FakeAdapter.js +55 -0
  26. package/lib/cjs/services/FakeAdapter.js.map +1 -0
  27. package/lib/cjs/services/Platform.js +30 -9
  28. package/lib/cjs/services/Platform.js.map +1 -1
  29. package/lib/cjs/services/PlatformAdapter.js +14 -0
  30. package/lib/cjs/services/PlatformAdapter.js.map +1 -0
  31. package/lib/cjs/services/PlatformApplication.js +9 -11
  32. package/lib/cjs/services/PlatformApplication.js.map +1 -1
  33. package/lib/cjs/services/PlatformHandler.js +11 -9
  34. package/lib/cjs/services/PlatformHandler.js.map +1 -1
  35. package/lib/cjs/services/PlatformMiddlewaresChain.js +56 -15
  36. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +1 -1
  37. package/lib/cjs/services/PlatformRequest.js +2 -2
  38. package/lib/cjs/services/PlatformResponse.js +5 -5
  39. package/lib/cjs/services/PlatformResponse.js.map +1 -1
  40. package/lib/cjs/services/PlatformRouter.js +14 -32
  41. package/lib/cjs/services/PlatformRouter.js.map +1 -1
  42. package/lib/cjs/services/PlatformTest.js +10 -3
  43. package/lib/cjs/services/PlatformTest.js.map +1 -1
  44. package/lib/cjs/utils/__mock__/Test1.js +8 -0
  45. package/lib/cjs/utils/__mock__/Test1.js.map +1 -0
  46. package/lib/cjs/utils/__mock__/Test2.js +8 -0
  47. package/lib/cjs/utils/__mock__/Test2.js.map +1 -0
  48. package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js +12 -0
  49. package/lib/cjs/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  50. package/lib/cjs/utils/__mock__/module1/Module1.js +19 -0
  51. package/lib/cjs/utils/__mock__/module1/Module1.js.map +1 -0
  52. package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js +17 -0
  53. package/lib/cjs/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  54. package/lib/cjs/utils/__mock__/module1/services/M1Service.js +17 -0
  55. package/lib/cjs/utils/__mock__/module1/services/M1Service.js.map +1 -0
  56. package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js +15 -0
  57. package/lib/cjs/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
  58. package/lib/cjs/utils/__mock__/module1/submodule/SubService.js +12 -0
  59. package/lib/cjs/utils/__mock__/module1/submodule/SubService.js.map +1 -0
  60. package/lib/cjs/utils/__mock__/module2/Module2.js +18 -0
  61. package/lib/cjs/utils/__mock__/module2/Module2.js.map +1 -0
  62. package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js +12 -0
  63. package/lib/cjs/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  64. package/lib/cjs/utils/createContext.js +2 -2
  65. package/lib/cjs/utils/createContext.js.map +1 -1
  66. package/lib/cjs/utils/createHandlerMetadata.js +2 -2
  67. package/lib/cjs/utils/createHandlerMetadata.js.map +1 -1
  68. package/lib/cjs/utils/createHttpServer.js +3 -8
  69. package/lib/cjs/utils/createHttpServer.js.map +1 -1
  70. package/lib/cjs/utils/createHttpsServer.js +3 -8
  71. package/lib/cjs/utils/createHttpsServer.js.map +1 -1
  72. package/lib/cjs/utils/createInjector.js +11 -3
  73. package/lib/cjs/utils/createInjector.js.map +1 -1
  74. package/lib/cjs/utils/getConfiguration.js +4 -0
  75. package/lib/cjs/utils/getConfiguration.js.map +1 -1
  76. package/lib/cjs/utils/setResponseHeaders.js.map +1 -1
  77. package/lib/esm/builder/PlatformBuilder.js +38 -32
  78. package/lib/esm/builder/PlatformBuilder.js.map +1 -1
  79. package/lib/esm/builder/PlatformControllerBuilder.js +8 -11
  80. package/lib/esm/builder/PlatformControllerBuilder.js.map +1 -1
  81. package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +1 -1
  82. package/lib/esm/config/services/PlatformConfiguration.js +6 -0
  83. package/lib/esm/config/services/PlatformConfiguration.js.map +1 -1
  84. package/lib/esm/decorators/multer/multerFileSize.js +1 -1
  85. package/lib/esm/decorators/multer/multerOptions.js +1 -1
  86. package/lib/esm/decorators/multer/multipartFile.js +1 -1
  87. package/lib/esm/decorators/multer/multipartFile.js.map +1 -1
  88. package/lib/esm/domain/ControllerProvider.js +1 -1
  89. package/lib/esm/domain/EndpointMetadata.js +1 -66
  90. package/lib/esm/domain/EndpointMetadata.js.map +1 -1
  91. package/lib/esm/domain/HandlerMetadata.js +1 -1
  92. package/lib/esm/domain/PlatformContext.js +3 -3
  93. package/lib/esm/domain/PlatformContext.js.map +1 -1
  94. package/lib/esm/domain/PlatformRouteDetails.js.map +1 -1
  95. package/lib/esm/exports.js +13 -0
  96. package/lib/esm/exports.js.map +1 -0
  97. package/lib/esm/index.js +64 -27
  98. package/lib/esm/index.js.map +1 -1
  99. package/lib/esm/interfaces/PlatformRouteOptions.js.map +1 -1
  100. package/lib/esm/middlewares/PlatformMulterMiddleware.js +16 -5
  101. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -1
  102. package/lib/esm/middlewares/bindEndpointMiddleware.js.map +1 -1
  103. package/lib/esm/package.json +3 -0
  104. package/lib/esm/services/FakeAdapter.js +51 -0
  105. package/lib/esm/services/FakeAdapter.js.map +1 -0
  106. package/lib/esm/services/Platform.js +31 -10
  107. package/lib/esm/services/Platform.js.map +1 -1
  108. package/lib/esm/services/PlatformAdapter.js +10 -0
  109. package/lib/esm/services/PlatformAdapter.js.map +1 -0
  110. package/lib/esm/services/PlatformApplication.js +11 -13
  111. package/lib/esm/services/PlatformApplication.js.map +1 -1
  112. package/lib/esm/services/PlatformHandler.js +13 -11
  113. package/lib/esm/services/PlatformHandler.js.map +1 -1
  114. package/lib/esm/services/PlatformMiddlewaresChain.js +61 -20
  115. package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -1
  116. package/lib/esm/services/PlatformResponse.js +1 -1
  117. package/lib/esm/services/PlatformResponse.js.map +1 -1
  118. package/lib/esm/services/PlatformRouter.js +13 -31
  119. package/lib/esm/services/PlatformRouter.js.map +1 -1
  120. package/lib/esm/services/PlatformTest.js +14 -8
  121. package/lib/esm/services/PlatformTest.js.map +1 -1
  122. package/lib/esm/utils/__mock__/Test1.js +4 -0
  123. package/lib/esm/utils/__mock__/Test1.js.map +1 -0
  124. package/lib/esm/utils/__mock__/Test2.js +4 -0
  125. package/lib/esm/utils/__mock__/Test2.js.map +1 -0
  126. package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js +9 -0
  127. package/lib/esm/utils/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  128. package/lib/esm/utils/__mock__/module1/Module1.js +16 -0
  129. package/lib/esm/utils/__mock__/module1/Module1.js.map +1 -0
  130. package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js +14 -0
  131. package/lib/esm/utils/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  132. package/lib/esm/utils/__mock__/module1/services/M1Service.js +14 -0
  133. package/lib/esm/utils/__mock__/module1/services/M1Service.js.map +1 -0
  134. package/lib/esm/utils/__mock__/module1/submodule/SubModule.js +12 -0
  135. package/lib/esm/utils/__mock__/module1/submodule/SubModule.js.map +1 -0
  136. package/lib/esm/utils/__mock__/module1/submodule/SubService.js +9 -0
  137. package/lib/esm/utils/__mock__/module1/submodule/SubService.js.map +1 -0
  138. package/lib/esm/utils/__mock__/module2/Module2.js +15 -0
  139. package/lib/esm/utils/__mock__/module2/Module2.js.map +1 -0
  140. package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js +9 -0
  141. package/lib/esm/utils/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  142. package/lib/esm/utils/createContext.js +5 -5
  143. package/lib/esm/utils/createContext.js.map +1 -1
  144. package/lib/esm/utils/createHandlerMetadata.js +3 -3
  145. package/lib/esm/utils/createHandlerMetadata.js.map +1 -1
  146. package/lib/esm/utils/createHttpServer.js +3 -8
  147. package/lib/esm/utils/createHttpServer.js.map +1 -1
  148. package/lib/esm/utils/createHttpsServer.js +3 -8
  149. package/lib/esm/utils/createHttpsServer.js.map +1 -1
  150. package/lib/esm/utils/createInjector.js +18 -10
  151. package/lib/esm/utils/createInjector.js.map +1 -1
  152. package/lib/esm/utils/getConfiguration.js +4 -0
  153. package/lib/esm/utils/getConfiguration.js.map +1 -1
  154. package/lib/esm/utils/setResponseHeaders.js.map +1 -1
  155. package/lib/esm/utils/useCtxHandler.js +1 -1
  156. package/lib/types/builder/PlatformBuilder.d.ts +9 -8
  157. package/lib/types/builder/PlatformControllerBuilder.d.ts +2 -1
  158. package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +6 -130
  159. package/lib/types/config/services/PlatformConfiguration.d.ts +12 -6
  160. package/lib/types/domain/EndpointMetadata.d.ts +1 -50
  161. package/lib/types/domain/PlatformContext.d.ts +1 -1
  162. package/lib/types/domain/PlatformRouteDetails.d.ts +2 -3
  163. package/lib/types/exports.d.ts +12 -0
  164. package/lib/types/index.d.ts +61 -17
  165. package/lib/types/interfaces/PlatformRouteOptions.d.ts +1 -1
  166. package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +8 -3
  167. package/lib/types/middlewares/bindEndpointMiddleware.d.ts +2 -1
  168. package/lib/types/services/FakeAdapter.d.ts +30 -0
  169. package/lib/types/services/Platform.d.ts +10 -1
  170. package/lib/types/services/PlatformAdapter.d.ts +47 -0
  171. package/lib/types/services/PlatformApplication.d.ts +3 -3
  172. package/lib/types/services/PlatformHandler.d.ts +1 -1
  173. package/lib/types/services/PlatformMiddlewaresChain.d.ts +6 -2
  174. package/lib/types/services/PlatformResponse.d.ts +6 -6
  175. package/lib/types/services/PlatformRouter.d.ts +10 -7
  176. package/lib/types/services/PlatformTest.d.ts +2 -2
  177. package/lib/types/utils/__mock__/Test1.d.ts +3 -0
  178. package/lib/types/utils/__mock__/Test2.d.ts +3 -0
  179. package/lib/types/utils/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
  180. package/lib/types/utils/__mock__/module1/Module1.d.ts +2 -0
  181. package/lib/types/utils/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
  182. package/lib/types/utils/__mock__/module1/services/M1Service.d.ts +5 -0
  183. package/lib/types/utils/__mock__/module1/submodule/SubModule.d.ts +2 -0
  184. package/lib/types/utils/__mock__/module1/submodule/SubService.d.ts +2 -0
  185. package/lib/types/utils/__mock__/module2/Module2.d.ts +2 -0
  186. package/lib/types/utils/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
  187. package/lib/types/utils/createHandlerMetadata.d.ts +1 -1
  188. package/lib/types/utils/createHttpServer.d.ts +1 -1
  189. package/lib/types/utils/createHttpsServer.d.ts +2 -1
  190. package/lib/types/utils/createInjector.d.ts +5 -3
  191. package/package.json +41 -26
  192. package/readme.md +52 -58
  193. package/tsconfig.compile.esm.json +2 -12
  194. package/lib/cjs/config/index.js +0 -7
  195. package/lib/cjs/config/index.js.map +0 -1
  196. package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js +0 -3
  197. package/lib/cjs/config/interfaces/EndpointDirectoriesSettings.js.map +0 -1
  198. package/lib/cjs/config/interfaces/index.js +0 -8
  199. package/lib/cjs/config/interfaces/index.js.map +0 -1
  200. package/lib/cjs/decorators/httpServer.js +0 -32
  201. package/lib/cjs/decorators/httpServer.js.map +0 -1
  202. package/lib/cjs/decorators/httpsServer.js +0 -32
  203. package/lib/cjs/decorators/httpsServer.js.map +0 -1
  204. package/lib/cjs/decorators/index.js +0 -21
  205. package/lib/cjs/decorators/index.js.map +0 -1
  206. package/lib/cjs/decorators/method/acceptMime.js +0 -28
  207. package/lib/cjs/decorators/method/acceptMime.js.map +0 -1
  208. package/lib/cjs/decorators/method/endpointFn.js +0 -15
  209. package/lib/cjs/decorators/method/endpointFn.js.map +0 -1
  210. package/lib/cjs/decorators/method/location.js +0 -6
  211. package/lib/cjs/decorators/method/location.js.map +0 -1
  212. package/lib/cjs/decorators/method/redirect.js +0 -6
  213. package/lib/cjs/decorators/method/redirect.js.map +0 -1
  214. package/lib/cjs/decorators/method/route.js +0 -13
  215. package/lib/cjs/decorators/method/route.js.map +0 -1
  216. package/lib/cjs/decorators/method/view.js +0 -34
  217. package/lib/cjs/decorators/method/view.js.map +0 -1
  218. package/lib/cjs/decorators/multer/index.js +0 -7
  219. package/lib/cjs/decorators/multer/index.js.map +0 -1
  220. package/lib/cjs/domain/index.js +0 -10
  221. package/lib/cjs/domain/index.js.map +0 -1
  222. package/lib/cjs/interfaces/PathType.js +0 -3
  223. package/lib/cjs/interfaces/PathType.js.map +0 -1
  224. package/lib/cjs/interfaces/PlatformAdapter.js +0 -3
  225. package/lib/cjs/interfaces/PlatformAdapter.js.map +0 -1
  226. package/lib/cjs/interfaces/index.js +0 -21
  227. package/lib/cjs/interfaces/index.js.map +0 -1
  228. package/lib/cjs/middlewares/index.js +0 -7
  229. package/lib/cjs/middlewares/index.js.map +0 -1
  230. package/lib/cjs/services/FakeRawDriver.js +0 -26
  231. package/lib/cjs/services/FakeRawDriver.js.map +0 -1
  232. package/lib/cjs/services/index.js +0 -12
  233. package/lib/cjs/services/index.js.map +0 -1
  234. package/lib/cjs/utils/index.js +0 -11
  235. package/lib/cjs/utils/index.js.map +0 -1
  236. package/lib/esm/config/index.js +0 -4
  237. package/lib/esm/config/index.js.map +0 -1
  238. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js +0 -2
  239. package/lib/esm/config/interfaces/EndpointDirectoriesSettings.js.map +0 -1
  240. package/lib/esm/config/interfaces/index.js +0 -5
  241. package/lib/esm/config/interfaces/index.js.map +0 -1
  242. package/lib/esm/decorators/httpServer.js +0 -28
  243. package/lib/esm/decorators/httpServer.js.map +0 -1
  244. package/lib/esm/decorators/httpsServer.js +0 -28
  245. package/lib/esm/decorators/httpsServer.js.map +0 -1
  246. package/lib/esm/decorators/index.js +0 -18
  247. package/lib/esm/decorators/index.js.map +0 -1
  248. package/lib/esm/decorators/method/acceptMime.js +0 -24
  249. package/lib/esm/decorators/method/acceptMime.js.map +0 -1
  250. package/lib/esm/decorators/method/endpointFn.js +0 -11
  251. package/lib/esm/decorators/method/endpointFn.js.map +0 -1
  252. package/lib/esm/decorators/method/location.js +0 -2
  253. package/lib/esm/decorators/method/location.js.map +0 -1
  254. package/lib/esm/decorators/method/redirect.js +0 -2
  255. package/lib/esm/decorators/method/redirect.js.map +0 -1
  256. package/lib/esm/decorators/method/route.js +0 -2
  257. package/lib/esm/decorators/method/route.js.map +0 -1
  258. package/lib/esm/decorators/method/view.js +0 -30
  259. package/lib/esm/decorators/method/view.js.map +0 -1
  260. package/lib/esm/decorators/multer/index.js +0 -4
  261. package/lib/esm/decorators/multer/index.js.map +0 -1
  262. package/lib/esm/domain/index.js +0 -7
  263. package/lib/esm/domain/index.js.map +0 -1
  264. package/lib/esm/interfaces/PathType.js +0 -2
  265. package/lib/esm/interfaces/PathType.js.map +0 -1
  266. package/lib/esm/interfaces/PlatformAdapter.js +0 -2
  267. package/lib/esm/interfaces/PlatformAdapter.js.map +0 -1
  268. package/lib/esm/interfaces/index.js +0 -18
  269. package/lib/esm/interfaces/index.js.map +0 -1
  270. package/lib/esm/middlewares/index.js +0 -4
  271. package/lib/esm/middlewares/index.js.map +0 -1
  272. package/lib/esm/services/FakeRawDriver.js +0 -22
  273. package/lib/esm/services/FakeRawDriver.js.map +0 -1
  274. package/lib/esm/services/index.js +0 -9
  275. package/lib/esm/services/index.js.map +0 -1
  276. package/lib/esm/utils/index.js +0 -8
  277. package/lib/esm/utils/index.js.map +0 -1
  278. package/lib/types/config/index.d.ts +0 -3
  279. package/lib/types/config/interfaces/EndpointDirectoriesSettings.d.ts +0 -3
  280. package/lib/types/config/interfaces/index.d.ts +0 -97
  281. package/lib/types/decorators/httpServer.d.ts +0 -28
  282. package/lib/types/decorators/httpsServer.d.ts +0 -28
  283. package/lib/types/decorators/index.d.ts +0 -14
  284. package/lib/types/decorators/method/acceptMime.d.ts +0 -19
  285. package/lib/types/decorators/method/endpointFn.d.ts +0 -9
  286. package/lib/types/decorators/method/location.d.ts +0 -1
  287. package/lib/types/decorators/method/redirect.d.ts +0 -1
  288. package/lib/types/decorators/method/route.d.ts +0 -1
  289. package/lib/types/decorators/method/view.d.ts +0 -25
  290. package/lib/types/decorators/multer/index.d.ts +0 -3
  291. package/lib/types/domain/index.d.ts +0 -6
  292. package/lib/types/interfaces/PathType.d.ts +0 -1
  293. package/lib/types/interfaces/PlatformAdapter.d.ts +0 -19
  294. package/lib/types/interfaces/index.d.ts +0 -17
  295. package/lib/types/middlewares/index.d.ts +0 -3
  296. package/lib/types/services/FakeRawDriver.d.ts +0 -15
  297. package/lib/types/services/index.d.ts +0 -8
  298. package/lib/types/utils/index.d.ts +0 -7
@@ -0,0 +1,9 @@
1
+ import { __decorate } from "tslib";
2
+ import { Injectable } from "@tsed/di";
3
+ let SubService = class SubService {
4
+ };
5
+ SubService = __decorate([
6
+ Injectable()
7
+ ], SubService);
8
+ export { SubService };
9
+ //# sourceMappingURL=SubService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubService.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module1/submodule/SubService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAAG;SAAb,UAAU","sourcesContent":["import {Injectable} from \"@tsed/di\";\n\n@Injectable()\nexport class SubService {}\n"]}
@@ -0,0 +1,15 @@
1
+ import { __decorate } from "tslib";
2
+ import { Module } from "@tsed/di";
3
+ import { M2Ctrl } from "./controllers/M2Ctrl.js";
4
+ let Module2 = class Module2 {
5
+ };
6
+ Module2 = __decorate([
7
+ Module({
8
+ mount: {
9
+ "/mod2": [M2Ctrl]
10
+ },
11
+ imports: []
12
+ })
13
+ ], Module2);
14
+ export { Module2 };
15
+ //# sourceMappingURL=Module2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module2.js","sourceRoot":"","sources":["../../../../../src/utils/__mock__/module2/Module2.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAQ5C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,MAAM,CAAC;QACN,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,MAAM,CAAC;SAClB;QACD,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,OAAO,CAAG;SAAV,OAAO","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {M2Ctrl} from \"./controllers/M2Ctrl\";\n\n@Module({\n mount: {\n \"/mod2\": [M2Ctrl]\n },\n imports: []\n})\nexport class Module2 {}\n"]}
@@ -0,0 +1,9 @@
1
+ import { __decorate } from "tslib";
2
+ import { Controller } from "@tsed/di";
3
+ let M2Ctrl = class M2Ctrl {
4
+ };
5
+ M2Ctrl = __decorate([
6
+ Controller("/m2")
7
+ ], M2Ctrl);
8
+ export { M2Ctrl };
9
+ //# sourceMappingURL=M2Ctrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M2Ctrl.js","sourceRoot":"","sources":["../../../../../../src/utils/__mock__/module2/controllers/M2Ctrl.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,IAAa,MAAM,GAAnB,MAAa,MAAM;CAAG,CAAA;AAAT,MAAM;IADlB,UAAU,CAAC,KAAK,CAAC;GACL,MAAM,CAAG;SAAT,MAAM","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/m2\")\nexport class M2Ctrl {}\n"]}
@@ -1,8 +1,8 @@
1
- import { PlatformContext } from "../domain/PlatformContext";
2
- import { PlatformRequest } from "../services/PlatformRequest";
3
- import { PlatformResponse } from "../services/PlatformResponse";
4
- const uuidv4 = require("uuid").v4;
5
- const defaultReqIdBuilder = (req) => req.get("x-request-id") || uuidv4().replace(/-/gi, "");
1
+ import { PlatformContext } from "../domain/PlatformContext.js";
2
+ import { PlatformRequest } from "../services/PlatformRequest.js";
3
+ import { PlatformResponse } from "../services/PlatformResponse.js";
4
+ import { v4 } from "uuid";
5
+ const defaultReqIdBuilder = (req) => req.get("x-request-id") || v4().replace(/-/gi, "");
6
6
  /**
7
7
  * Create the TsED context to wrap request, response, injector, etc...
8
8
  *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AG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,MAAM,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {PlatformContext} from \"../domain/PlatformContext\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {IncomingEvent} from \"../interfaces/IncomingEvent\";\n\nconst uuidv4 = require(\"uuid\").v4;\nconst defaultReqIdBuilder = (req: any) => req.get(\"x-request-id\") || uuidv4().replace(/-/gi, \"\");\n\n/**\n * Create the TsED context to wrap request, response, injector, etc...\n * @param injector\n * @ignore\n */\nexport function createContext(injector: InjectorService) {\n const ResponseKlass = injector.getProvider(PlatformResponse)?.useClass;\n const RequestKlass = injector.getProvider(PlatformRequest)?.useClass;\n const {reqIdBuilder = defaultReqIdBuilder, ...loggerOptions} = injector.settings.logger || {};\n\n return async (event: IncomingEvent): Promise<PlatformContext> => {\n const ctx = new PlatformContext({\n event,\n id: reqIdBuilder(event.request),\n logger: injector.logger,\n ...loggerOptions,\n injector,\n ResponseKlass,\n RequestKlass\n });\n\n ctx.response.onEnd(async () => {\n await ctx.emit(\"$onResponse\", ctx);\n await ctx.destroy();\n });\n\n await ctx.emit(\"$onRequest\", ctx);\n\n return ctx;\n };\n}\n"]}
1
+ {"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/utils/createContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAC,EAAE,EAAC,MAAM,MAAM,CAAC;AAExB,MAAM,mBAAmB,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAE7F;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAyB;;IACrD,MAAM,aAAa,GAAG,MAAA,QAAQ,CAAC,WAAW,CAAC,gBAAgB,CAAC,0CAAE,QAAQ,CAAC;IACvE,MAAM,YAAY,GAAG,MAAA,QAAQ,CAAC,WAAW,CAAC,eAAe,CAAC,0CAAE,QAAQ,CAAC;IACrE,MAAM,EAAC,YAAY,GAAG,mBAAmB,EAAE,GAAG,aAAa,EAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;IAE9F,OAAO,KAAK,EAAE,KAAoB,EAA4B,EAAE;QAC9D,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC;YAC9B,KAAK;YACL,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;YAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,aAAa;YAChB,QAAQ;YACR,aAAa;YACb,YAAY;SACb,CAAC,CAAC;QAEH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;YAC5B,MAAM,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;YACnC,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QAEH,MAAM,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {PlatformContext} from \"../domain/PlatformContext\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {IncomingEvent} from \"../interfaces/IncomingEvent\";\nimport {v4} from \"uuid\";\n\nconst defaultReqIdBuilder = (req: any) => req.get(\"x-request-id\") || v4().replace(/-/gi, \"\");\n\n/**\n * Create the TsED context to wrap request, response, injector, etc...\n * @param injector\n * @ignore\n */\nexport function createContext(injector: InjectorService) {\n const ResponseKlass = injector.getProvider(PlatformResponse)?.useClass;\n const RequestKlass = injector.getProvider(PlatformRequest)?.useClass;\n const {reqIdBuilder = defaultReqIdBuilder, ...loggerOptions} = injector.settings.logger || {};\n\n return async (event: IncomingEvent): Promise<PlatformContext> => {\n const ctx = new PlatformContext({\n event,\n id: reqIdBuilder(event.request),\n logger: injector.logger,\n ...loggerOptions,\n injector,\n ResponseKlass,\n RequestKlass\n });\n\n ctx.response.onEnd(async () => {\n await ctx.emit(\"$onResponse\", ctx);\n await ctx.destroy();\n });\n\n await ctx.emit(\"$onRequest\", ctx);\n\n return ctx;\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { EndpointMetadata } from "../domain/EndpointMetadata";
2
- import { HandlerMetadata } from "../domain/HandlerMetadata";
3
- import { HandlerType } from "../interfaces/HandlerType";
1
+ import { EndpointMetadata } from "@tsed/schema";
2
+ import { HandlerMetadata } from "../domain/HandlerMetadata.js";
3
+ import { HandlerType } from "../interfaces/HandlerType.js";
4
4
  function isMetadata(input) {
5
5
  return input instanceof HandlerMetadata;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAyB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAGtD,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,YAAY,eAAe,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAyB,EACzB,GAA2B,EAC3B,eAA6C,EAAE;IAE/C,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACnB,OAAO,GAAsB,CAAC;KAC/B;IAED,IAAI,OAA+B,CAAC;IAEpC,IAAI,GAAG,YAAY,gBAAgB,EAAE;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAE,CAAC;QAE3D,OAAO,GAAG;YACR,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;YACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAC;KACH;SAAM;QACL,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAE3C,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG;gBACR,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;gBACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,IAAI,EAAE,WAAW,CAAC,UAAU;gBAC5B,WAAW,EAAE,KAAK;aACnB,CAAC;SACH;aAAM;YACL,OAAO,GAAG;gBACR,MAAM,EAAE,GAAG;aACZ,CAAC;SACH;KACF;IAED,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IAEpC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {EndpointMetadata} from \"../domain/EndpointMetadata\";\nimport {HandlerMetadata, HandlerMetadataOptions} from \"../domain/HandlerMetadata\";\nimport {HandlerType} from \"../interfaces/HandlerType\";\nimport {PlatformRouteWithoutHandlers} from \"../interfaces/PlatformRouteOptions\";\n\nfunction isMetadata(input: any) {\n return input instanceof HandlerMetadata;\n}\n\n/**\n * @ignore\n */\nexport function createHandlerMetadata(\n injector: InjectorService,\n obj: any | EndpointMetadata,\n routeOptions: PlatformRouteWithoutHandlers = {}\n): HandlerMetadata {\n if (isMetadata(obj)) {\n return obj as HandlerMetadata;\n }\n\n let options: HandlerMetadataOptions;\n\n if (obj instanceof EndpointMetadata) {\n const provider = injector.getProvider(routeOptions.token)!;\n\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.ENDPOINT,\n propertyKey: obj.propertyKey\n };\n } else {\n const provider = injector.getProvider(obj);\n\n if (provider) {\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.MIDDLEWARE,\n propertyKey: \"use\"\n };\n } else {\n options = {\n target: obj\n };\n }\n }\n\n options.routeOptions = routeOptions;\n\n return new HandlerMetadata(options);\n}\n"]}
1
+ {"version":3,"file":"createHandlerMetadata.js","sourceRoot":"","sources":["../../../src/utils/createHandlerMetadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAyB,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAGtD,SAAS,UAAU,CAAC,KAAU;IAC5B,OAAO,KAAK,YAAY,eAAe,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAyB,EACzB,GAA2B,EAC3B,eAA6C,EAAE;IAE/C,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACnB,OAAO,GAAsB,CAAC;KAC/B;IAED,IAAI,OAA+B,CAAC;IAEpC,IAAI,GAAG,YAAY,gBAAgB,EAAE;QACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,CAAE,CAAC;QAE3D,OAAO,GAAG;YACR,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;YACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;YACrB,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;SAC7B,CAAC;KACH;SAAM;QACL,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAE3C,IAAI,QAAQ,EAAE;YACZ,OAAO,GAAG;gBACR,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,MAAM,EAAE,QAAQ,CAAC,QAAQ;gBACzB,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,IAAI,EAAE,WAAW,CAAC,UAAU;gBAC5B,WAAW,EAAE,KAAK;aACnB,CAAC;SACH;aAAM;YACL,OAAO,GAAG;gBACR,MAAM,EAAE,GAAG;aACZ,CAAC;SACH;KACF;IAED,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;IAEpC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import {InjectorService} from \"@tsed/di\";\nimport {EndpointMetadata} from \"@tsed/schema\";\nimport {HandlerMetadata, HandlerMetadataOptions} from \"../domain/HandlerMetadata\";\nimport {HandlerType} from \"../interfaces/HandlerType\";\nimport {PlatformRouteWithoutHandlers} from \"../interfaces/PlatformRouteOptions\";\n\nfunction isMetadata(input: any) {\n return input instanceof HandlerMetadata;\n}\n\n/**\n * @ignore\n */\nexport function createHandlerMetadata(\n injector: InjectorService,\n obj: any | EndpointMetadata,\n routeOptions: PlatformRouteWithoutHandlers = {}\n): HandlerMetadata {\n if (isMetadata(obj)) {\n return obj as HandlerMetadata;\n }\n\n let options: HandlerMetadataOptions;\n\n if (obj instanceof EndpointMetadata) {\n const provider = injector.getProvider(routeOptions.token)!;\n\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.ENDPOINT,\n propertyKey: obj.propertyKey\n };\n } else {\n const provider = injector.getProvider(obj);\n\n if (provider) {\n options = {\n token: provider.token,\n target: provider.useClass,\n scope: provider.scope,\n type: HandlerType.MIDDLEWARE,\n propertyKey: \"use\"\n };\n } else {\n options = {\n target: obj\n };\n }\n }\n\n options.routeOptions = routeOptions;\n\n return new HandlerMetadata(options);\n}\n"]}
@@ -1,28 +1,23 @@
1
1
  import { ProviderScope } from "@tsed/di";
2
2
  import { getHostInfoFromPort } from "@tsed/core";
3
3
  import Http from "http";
4
- import { HttpServer } from "../decorators/httpServer";
5
- import { listenServer } from "./listenServer";
4
+ import { listenServer } from "./listenServer.js";
6
5
  export function createHttpServer(injector, requestListener) {
7
6
  const { settings } = injector;
8
7
  const httpPort = settings.getRaw("httpPort");
9
8
  const httpOptions = settings.getRaw("httpOptions");
10
9
  const server = httpPort !== false ? Http.createServer(httpOptions, requestListener) : null;
11
- injector.addProvider(HttpServer, {
12
- scope: ProviderScope.SINGLETON,
13
- useValue: server
14
- });
15
10
  injector.addProvider(Http.Server, {
16
11
  scope: ProviderScope.SINGLETON,
17
12
  useValue: server
18
13
  });
19
- injector.invoke(HttpServer);
20
14
  injector.invoke(Http.Server);
21
- if (httpPort !== false) {
15
+ if (server) {
22
16
  const hostInfo = getHostInfoFromPort("http", httpPort);
23
17
  return async () => {
24
18
  const resolvedHostInfo = await listenServer(injector, server, hostInfo);
25
19
  settings.setRaw("httpPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
20
+ return server;
26
21
  };
27
22
  }
28
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,QAAyB,EAAE,eAAqC;IAC/F,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3F,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE;QAC/B,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;QAChC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEvD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAqB,EAAE,QAAQ,CAAC,CAAC;YACvF,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC,CAAC;KACH;AACH,CAAC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Http from \"http\";\nimport {HttpServer} from \"../decorators/httpServer\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener) {\n const {settings} = injector;\n const httpPort = settings.getRaw(\"httpPort\");\n const httpOptions = settings.getRaw(\"httpOptions\");\n\n const server = httpPort !== false ? Http.createServer(httpOptions, requestListener) : null;\n\n injector.addProvider(HttpServer, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.addProvider(Http.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(HttpServer);\n injector.invoke(Http.Server);\n\n if (httpPort !== false) {\n const hostInfo = getHostInfoFromPort(\"http\", httpPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Http.Server, hostInfo);\n settings.setRaw(\"httpPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n };\n }\n}\n"]}
1
+ {"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,QAAyB,EAAE,eAAqC;IAC/F,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3F,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;QAChC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEvD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAqB,EAAE,QAAQ,CAAC,CAAC;YACvF,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;YACpF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;AACH,CAAC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Http from \"http\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpServer(injector: InjectorService, requestListener: Http.RequestListener) {\n const {settings} = injector;\n const httpPort = settings.getRaw(\"httpPort\");\n const httpOptions = settings.getRaw(\"httpOptions\");\n\n const server = httpPort !== false ? Http.createServer(httpOptions, requestListener) : null;\n\n injector.addProvider(Http.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(Http.Server);\n\n if (server) {\n const hostInfo = getHostInfoFromPort(\"http\", httpPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Http.Server, hostInfo);\n settings.setRaw(\"httpPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n return server;\n };\n }\n}\n"]}
@@ -1,28 +1,23 @@
1
1
  import { ProviderScope } from "@tsed/di";
2
2
  import { getHostInfoFromPort } from "@tsed/core";
3
3
  import Https from "https";
4
- import { HttpsServer } from "../decorators/httpsServer";
5
- import { listenServer } from "./listenServer";
4
+ import { listenServer } from "./listenServer.js";
6
5
  export function createHttpsServer(injector, requestListener) {
7
6
  const { settings } = injector;
8
7
  const httpsPort = settings.getRaw("httpsPort");
9
8
  const httpsOptions = settings.getRaw("httpsOptions");
10
9
  const server = httpsPort !== false ? Https.createServer(httpsOptions, requestListener) : null;
11
- injector.addProvider(HttpsServer, {
12
- scope: ProviderScope.SINGLETON,
13
- useValue: server
14
- });
15
10
  injector.addProvider(Https.Server, {
16
11
  scope: ProviderScope.SINGLETON,
17
12
  useValue: server
18
13
  });
19
- injector.invoke(HttpsServer);
20
14
  injector.invoke(Https.Server);
21
- if (httpsPort !== false) {
15
+ if (server) {
22
16
  const hostInfo = getHostInfoFromPort("https", httpsPort);
23
17
  return async () => {
24
18
  const resolvedHostInfo = await listenServer(injector, server, hostInfo);
25
19
  settings.setRaw("httpsPort", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);
20
+ return server;
26
21
  };
27
22
  }
28
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,QAAyB,EAAE,eAAsC;IACjG,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9F,QAAQ,CAAC,WAAW,CAAC,WAAW,EAAE;QAChC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;QACjC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,SAAS,KAAK,KAAK,EAAE;QACvB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAEzD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAsB,EAAE,QAAQ,CAAC,CAAC;YACxF,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;QACvF,CAAC,CAAC;KACH;AACH,CAAC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Https from \"https\";\nimport Http from \"http\";\nimport {HttpsServer} from \"../decorators/httpsServer\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener) {\n const {settings} = injector;\n const httpsPort = settings.getRaw(\"httpsPort\");\n const httpsOptions = settings.getRaw(\"httpsOptions\");\n\n const server = httpsPort !== false ? Https.createServer(httpsOptions, requestListener) : null;\n\n injector.addProvider(HttpsServer, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.addProvider(Https.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(HttpsServer);\n injector.invoke(Https.Server);\n\n if (httpsPort !== false) {\n const hostInfo = getHostInfoFromPort(\"https\", httpsPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Https.Server, hostInfo);\n settings.setRaw(\"httpsPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n };\n }\n}\n"]}
1
+ {"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAC,MAAM,UAAU,CAAC;AACxD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,QAAyB,EAAE,eAAsC;IACjG,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE9F,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE;QACjC,KAAK,EAAE,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAEzD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAsB,EAAE,QAAQ,CAAC,CAAC;YACxF,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,gBAAgB,CAAC,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC;YACrF,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;AACH,CAAC","sourcesContent":["import {InjectorService, ProviderScope} from \"@tsed/di\";\nimport {getHostInfoFromPort} from \"@tsed/core\";\nimport Https from \"https\";\nimport Http from \"http\";\nimport {listenServer} from \"./listenServer\";\n\nexport function createHttpsServer(injector: InjectorService, requestListener?: Http.RequestListener) {\n const {settings} = injector;\n const httpsPort = settings.getRaw(\"httpsPort\");\n const httpsOptions = settings.getRaw(\"httpsOptions\");\n\n const server = httpsPort !== false ? Https.createServer(httpsOptions, requestListener) : null;\n\n injector.addProvider(Https.Server, {\n scope: ProviderScope.SINGLETON,\n useValue: server\n });\n\n injector.invoke(Https.Server);\n\n if (server) {\n const hostInfo = getHostInfoFromPort(\"https\", httpsPort);\n\n return async () => {\n const resolvedHostInfo = await listenServer(injector, server as Https.Server, hostInfo);\n settings.setRaw(\"httpsPort\", `${resolvedHostInfo.address}:${resolvedHostInfo.port}`);\n return server;\n };\n }\n}\n"]}
@@ -1,13 +1,14 @@
1
1
  import { InjectorService, setLoggerLevel } from "@tsed/di";
2
2
  import { $log } from "@tsed/logger";
3
3
  import { toMap } from "@tsed/core";
4
- import { PlatformConfiguration } from "../config/services/PlatformConfiguration";
5
- import { PlatformHandler } from "../services/PlatformHandler";
6
- import { PlatformResponse } from "../services/PlatformResponse";
7
- import { PlatformRouter } from "../services/PlatformRouter";
8
- import { PlatformApplication } from "../services/PlatformApplication";
9
- import { Platform } from "../services/Platform";
10
- import { PlatformRequest } from "../services/PlatformRequest";
4
+ import { PlatformConfiguration } from "../config/services/PlatformConfiguration.js";
5
+ import { PlatformHandler } from "../services/PlatformHandler.js";
6
+ import { PlatformResponse } from "../services/PlatformResponse.js";
7
+ import { PlatformRouter } from "../services/PlatformRouter.js";
8
+ import { PlatformApplication } from "../services/PlatformApplication.js";
9
+ import { Platform } from "../services/Platform.js";
10
+ import { PlatformRequest } from "../services/PlatformRequest.js";
11
+ import { PlatformAdapter } from "../services/PlatformAdapter.js";
11
12
  $log.name = "TSED";
12
13
  const DEFAULT_PROVIDERS = [
13
14
  { provide: PlatformHandler },
@@ -17,15 +18,22 @@ const DEFAULT_PROVIDERS = [
17
18
  { provide: PlatformApplication },
18
19
  { provide: Platform }
19
20
  ];
20
- export function createInjector({ providers = [], settings = {} }) {
21
+ export function createInjector({ adapter, settings = {} }) {
21
22
  const injector = new InjectorService();
22
23
  injector.addProvider(PlatformConfiguration);
23
24
  injector.settings = injector.invoke(PlatformConfiguration);
24
25
  injector.logger = $log;
25
26
  injector.settings.set(settings);
27
+ if (adapter) {
28
+ injector.addProvider(PlatformAdapter, {
29
+ useClass: adapter
30
+ });
31
+ }
32
+ injector.invoke(PlatformAdapter);
26
33
  setLoggerLevel(injector);
27
- providers = [...DEFAULT_PROVIDERS, ...providers];
28
- toMap(providers, "provide").forEach((provider, token) => {
34
+ const instance = injector.get(PlatformAdapter);
35
+ instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];
36
+ toMap(instance.providers, "provide").forEach((provider, token) => {
29
37
  injector.addProvider(token, provider);
30
38
  });
31
39
  injector.invoke(PlatformApplication);
@@ -1 +1 @@
1
- {"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAa,cAAc,EAAC,MAAM,UAAU,CAAC;AACpE,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,qBAAqB,EAAC,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,6BA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ACxC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import {InjectorService, IProvider, setLoggerLevel} from \"@tsed/di\";\nimport {$log} from \"@tsed/logger\";\nimport {toMap} from \"@tsed/core\";\nimport {PlatformConfiguration} from \"../config/services/PlatformConfiguration\";\nimport {PlatformHandler} from \"../services/PlatformHandler\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {PlatformRouter} from \"../services/PlatformRouter\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\n\n$log.name = \"TSED\";\n\nconst DEFAULT_PROVIDERS = [\n {provide: PlatformHandler},\n {provide: PlatformResponse},\n {provide: PlatformRequest},\n {provide: PlatformRouter},\n {provide: PlatformApplication},\n {provide: Platform}\n];\n\ninterface CreateInjectorOptions {\n providers?: IProvider[];\n settings?: Partial<TsED.Configuration>;\n}\n\nexport function createInjector({providers = [], settings = {}}: CreateInjectorOptions) {\n const injector = new InjectorService();\n injector.addProvider(PlatformConfiguration);\n\n injector.settings = injector.invoke(PlatformConfiguration);\n injector.logger = $log;\n injector.settings.set(settings);\n\n setLoggerLevel(injector);\n\n providers = [...DEFAULT_PROVIDERS, ...providers];\n\n toMap<any, IProvider>(providers, \"provide\").forEach((provider, token) => {\n injector.addProvider(token, provider);\n });\n\n injector.invoke(PlatformApplication);\n\n return injector;\n}\n"]}
1
+ {"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAgB,cAAc,EAAC,MAAM,UAAU,CAAC;AACvE,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,0C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CAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAkB,eAAe,CAAE,CAAC;IAEjE,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEnE,KAAK,CAAoB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QAClF,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import {InjectorService, ProviderOpts, setLoggerLevel} from \"@tsed/di\";\nimport {$log} from \"@tsed/logger\";\nimport {toMap, Type} from \"@tsed/core\";\nimport {PlatformConfiguration} from \"../config/services/PlatformConfiguration\";\nimport {PlatformHandler} from \"../services/PlatformHandler\";\nimport {PlatformResponse} from \"../services/PlatformResponse\";\nimport {PlatformRouter} from \"../services/PlatformRouter\";\nimport {PlatformApplication} from \"../services/PlatformApplication\";\nimport {Platform} from \"../services/Platform\";\nimport {PlatformRequest} from \"../services/PlatformRequest\";\nimport {PlatformAdapter} from \"../services/PlatformAdapter\";\n\n$log.name = \"TSED\";\n\nconst DEFAULT_PROVIDERS = [\n {provide: PlatformHandler},\n {provide: PlatformResponse},\n {provide: PlatformRequest},\n {provide: PlatformRouter},\n {provide: PlatformApplication},\n {provide: Platform}\n];\n\ninterface CreateInjectorOptions {\n adapter?: Type<PlatformAdapter<any, any>>;\n settings?: Partial<TsED.Configuration>;\n}\n\nexport function createInjector({adapter, settings = {}}: CreateInjectorOptions) {\n const injector = new InjectorService();\n injector.addProvider(PlatformConfiguration);\n\n injector.settings = injector.invoke(PlatformConfiguration);\n injector.logger = $log;\n injector.settings.set(settings);\n\n if (adapter) {\n injector.addProvider(PlatformAdapter, {\n useClass: adapter\n });\n }\n\n injector.invoke(PlatformAdapter);\n\n setLoggerLevel(injector);\n\n const instance = injector.get<PlatformAdapter>(PlatformAdapter)!;\n\n instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];\n\n toMap<any, ProviderOpts>(instance.providers, \"provide\").forEach((provider, token) => {\n injector.addProvider(token, provider);\n });\n\n injector.invoke(PlatformApplication);\n\n return injector;\n}\n"]}
@@ -1,9 +1,13 @@
1
1
  import { deepMerge, Env, Store } from "@tsed/core";
2
2
  import { ProviderScope, ProviderType } from "@tsed/di";
3
3
  export function getConfiguration(configuration = {}, module = null) {
4
+ if (configuration.$$resolved) {
5
+ return configuration;
6
+ }
4
7
  const store = module ? Store.from(module).get("configuration") || {} : {};
5
8
  const env = configuration.env || store.env || process.env.NODE_ENV || Env.DEV;
6
9
  const config = {
10
+ $$resolved: true,
7
11
  exclude: ["**/*.spec.ts", "**/*.spec.js"],
8
12
  componentsScan: ["${rootDir}/mvc/**/*.ts", "${rootDir}/services/**/*.ts", "${rootDir}/middlewares/**/*.ts"],
9
13
  env,
@@ -1 +1 @@
1
- {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/utils/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,GAAG,EAAE,KAAK,EAAO,MAAM,YAAY,CAAC;AACvD,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAErD,MAAM,UAAU,gBAAgB,CAAC,gBAAqB,EAAE,EAAE,SAA2B,IAAI;IACvF,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAK,OAAO,CAAC,GA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cesContent":["import {deepMerge, Env, Store, Type} from \"@tsed/core\";\nimport {ProviderScope, ProviderType} from \"@tsed/di\";\n\nexport function getConfiguration(configuration: any = {}, module: Type<any> | null = null) {\n const store = module ? Store.from(module).get(\"configuration\") || {} : {};\n const env = configuration.env || store.env || (process.env.NODE_ENV as Env) || Env.DEV;\n\n const config = {\n exclude: [\"**/*.spec.ts\", \"**/*.spec.js\"],\n componentsScan: [\"${rootDir}/mvc/**/*.ts\", \"${rootDir}/services/**/*.ts\", \"${rootDir}/middlewares/**/*.ts\"],\n env,\n httpPort: 8080,\n httpsPort: false,\n ...store,\n ...configuration,\n scopes: {\n [ProviderType.CONTROLLER]: ProviderScope.SINGLETON,\n ...store.scopes,\n ...configuration.scopes\n },\n mount:\n store.mount || configuration.mount\n ? deepMerge(store.mount || {}, configuration.mount || {})\n : {\n \"/rest\": \"${rootDir}/controllers/**/*.ts\"\n },\n logger: {\n debug: false,\n level: env === Env.TEST ? \"off\" : \"info\",\n logRequest: true,\n ...store.logger,\n ...configuration.logger,\n jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2\n }\n };\n\n if (!configuration.disableComponentsScan && store.componentsScan && configuration.componentsScan) {\n config.componentsScan = [...store.componentsScan, ...configuration.componentsScan];\n }\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/utils/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,GAAG,EAAE,KAAK,EAAO,MAAM,YAAY,CAAC;AACvD,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAErD,MAAM,UAAU,gBAAgB,CAAC,gBAAqB,EAAE,EAAE,SAA2B,IAAI;IACvF,IAAI,aAAa,CAAC,UAAU,EAAE;QAC5B,OAAO,aAAa,CAAC;KACtB;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC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Ac,IAAI,aAAa,CAAC,cAAc,EAAE;QAChG,MAAM,CAAC,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;KACpF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import {deepMerge, Env, Store, Type} from \"@tsed/core\";\nimport {ProviderScope, ProviderType} from \"@tsed/di\";\n\nexport function getConfiguration(configuration: any = {}, module: Type<any> | null = null) {\n if (configuration.$$resolved) {\n return configuration;\n }\n\n const store = module ? Store.from(module).get(\"configuration\") || {} : {};\n const env = configuration.env || store.env || (process.env.NODE_ENV as Env) || Env.DEV;\n\n const config = {\n $$resolved: true,\n exclude: [\"**/*.spec.ts\", \"**/*.spec.js\"],\n componentsScan: [\"${rootDir}/mvc/**/*.ts\", \"${rootDir}/services/**/*.ts\", \"${rootDir}/middlewares/**/*.ts\"],\n env,\n httpPort: 8080,\n httpsPort: false,\n ...store,\n ...configuration,\n scopes: {\n [ProviderType.CONTROLLER]: ProviderScope.SINGLETON,\n ...store.scopes,\n ...configuration.scopes\n },\n mount:\n store.mount || configuration.mount\n ? deepMerge(store.mount || {}, configuration.mount || {})\n : {\n \"/rest\": \"${rootDir}/controllers/**/*.ts\"\n },\n logger: {\n debug: false,\n level: env === Env.TEST ? \"off\" : \"info\",\n logRequest: true,\n ...store.logger,\n ...configuration.logger,\n jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2\n }\n };\n\n if (!configuration.disableComponentsScan && store.componentsScan && configuration.componentsScan) {\n config.componentsScan = [...store.componentsScan, ...configuration.componentsScan];\n }\n\n return config;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":"AAIA,SAAS,YAAY,CAAC,WAA2D,EAAE,OAAoC;IACrH,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,C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} from \"../services/PlatformResponse\";\n\nfunction mergeHeaders(specHeaders: Record<string, JsonHeader & {example: string}>, headers: Record<string, HeaderValue>) {\n return Object.entries(specHeaders).reduce((headers, [key, item]) => {\n key = key.toLowerCase();\n return {\n ...headers,\n [key]: headers[key] === undefined ? String(item.example) : headers[key]\n };\n }, headers);\n}\n\n/**\n * @ignore\n */\nexport function setResponseHeaders(ctx: PlatformContext) {\n const {response, endpoint} = ctx;\n const {operation} = endpoint;\n\n if (response.isDone()) {\n return;\n }\n\n if (!response.hasStatus()) {\n // apply status only if the isn't already modified\n response.status(operation.getStatus());\n }\n\n const statusCode = response.statusCode;\n const headers = operation.getHeadersOf(response.statusCode);\n const mergedHeaders = mergeHeaders(headers, response.getHeaders());\n\n response.setHeaders(mergedHeaders);\n\n if (operation.isRedirection(statusCode)) {\n response.redirect(statusCode, String(mergedHeaders[\"location\"]));\n }\n}\n"]}
1
+ {"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":"AAIA,SAAS,YAAY,CAAC,WAA2D,EAAE,OAA4B;IAC7G,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;QACjE,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO;YACL,GAAG,OAAO;YACV,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;SACxE,CAAC;IACJ,CAAC,EAAE,OAAO,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAoB;IACrD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE;QACrB,OAAO;KACR;IAED,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE;QACzB,kDAAkD;QAClD,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;KACxC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;IACvC,MAAM,OAAO,GAAG,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAEnE,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEnC,IAAI,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;QACvC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAClE;AACH,CAAC","sourcesContent":["import {JsonHeader} from \"@tsed/schema\";\nimport {OutgoingHttpHeaders} from \"http\";\nimport {PlatformContext} from \"../domain/PlatformContext\";\n\nfunction mergeHeaders(specHeaders: Record<string, JsonHeader & {example: string}>, headers: OutgoingHttpHeaders) {\n return Object.entries(specHeaders).reduce((headers, [key, item]) => {\n key = key.toLowerCase();\n return {\n ...headers,\n [key]: headers[key] === undefined ? String(item.example) : headers[key]\n };\n }, headers);\n}\n\n/**\n * @ignore\n */\nexport function setResponseHeaders(ctx: PlatformContext) {\n const {response, endpoint} = ctx;\n const {operation} = endpoint;\n\n if (response.isDone()) {\n return;\n }\n\n if (!response.hasStatus()) {\n // apply status only if the isn't already modified\n response.status(operation.getStatus());\n }\n\n const statusCode = response.statusCode;\n const headers = operation.getHeadersOf(response.statusCode);\n const mergedHeaders = mergeHeaders(headers, response.getHeaders());\n\n response.setHeaders(mergedHeaders);\n\n if (operation.isRedirection(statusCode)) {\n response.redirect(statusCode, String(mergedHeaders[\"location\"]));\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { HandlerType } from "../interfaces/HandlerType";
1
+ import { HandlerType } from "../interfaces/HandlerType.js";
2
2
  /**
3
3
  * Create Ts.ED context handler
4
4
  * @param fn
@@ -1,16 +1,16 @@
1
1
  /// <reference types="node" />
2
2
  import { Type } from "@tsed/core";
3
- import { InjectorService, IProvider } from "@tsed/di";
3
+ import { InjectorService, ProviderOpts, TokenProvider } from "@tsed/di";
4
4
  import { Platform } from "../services/Platform";
5
5
  import { PlatformApplication } from "../services/PlatformApplication";
6
- import { IncomingMessage, ServerResponse } from "http";
7
- import { PlatformAdapter, PlatformBuilderSettings } from "../interfaces/PlatformAdapter";
6
+ import type { IncomingMessage, ServerResponse } from "http";
7
+ import { PlatformAdapter, PlatformBuilderSettings } from "../services/PlatformAdapter";
8
8
  /**
9
9
  * @platform
10
10
  */
11
11
  export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Router> {
12
12
  #private;
13
- static adapter: Type<PlatformAdapter>;
13
+ static adapter: Type<PlatformAdapter<any, any>>;
14
14
  readonly name: string;
15
15
  protected startedAt: Date;
16
16
  protected current: Date;
@@ -19,6 +19,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
19
19
  get rootModule(): any;
20
20
  get app(): PlatformApplication<App, Router>;
21
21
  get platform(): Platform;
22
+ get adapter(): PlatformAdapter<App, Router>;
22
23
  /**
23
24
  * Return the settings configured by the decorator @@Configuration@@.
24
25
  *
@@ -42,7 +43,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
42
43
  */
43
44
  get settings(): TsED.Configuration & import("@tsed/di").DIConfiguration;
44
45
  get logger(): import("@tsed/di").DILogger;
45
- get disableBootstrapLog(): boolean | undefined;
46
+ get disableBootstrapLog(): any;
46
47
  static create<App = TsED.Application, Router = TsED.Router>(module: Type<any>, settings: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
47
48
  static build<App = TsED.Application, Router = TsED.Router>(module: Type<any>, { adapter, ...settings }: PlatformBuilderSettings<App, Router>): PlatformBuilder<App, Router>;
48
49
  /**
@@ -57,6 +58,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
57
58
  /**
58
59
  * Add classes to the components list
59
60
  * @param classes
61
+ * @deprecated
60
62
  */
61
63
  addComponents(classes: any | any[]): this;
62
64
  /**
@@ -79,7 +81,7 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
79
81
  * @param {string} endpoint
80
82
  * @param {any[]} controllers
81
83
  */
82
- addControllers(endpoint: string, controllers: any | string | (any | string)[]): void;
84
+ addControllers(endpoint: string, controllers: TokenProvider | TokenProvider[]): void;
83
85
  runLifecycle(): Promise<this>;
84
86
  loadInjector(): Promise<void>;
85
87
  listen(network?: boolean): Promise<void>;
@@ -87,11 +89,10 @@ export declare class PlatformBuilder<App = TsED.Application, Router = TsED.Route
87
89
  ready(): Promise<void>;
88
90
  callHook(hook: string, ...args: any[]): Promise<void>;
89
91
  loadStatics(hook: string): Promise<void>;
90
- useProvider(token: Type<any>, settings?: Partial<IProvider>): this;
92
+ useProvider(token: Type<any>, settings?: Partial<ProviderOpts>): this;
91
93
  bootstrap(): Promise<this>;
92
94
  protected loadRoutes(): Promise<void>;
93
95
  protected diff(): string;
94
- protected importProviders(): Promise<void>;
95
96
  /**
96
97
  * Load middlewares from configuration for the given hook
97
98
  * @param hook
@@ -13,5 +13,6 @@ export declare function createRouter(injector: InjectorService, provider: Contro
13
13
  * @ignore
14
14
  * @param injector
15
15
  * @param provider
16
+ * @param parentUseBefore
16
17
  */
17
- export declare function buildRouter(injector: InjectorService, provider: ControllerProvider): PlatformRouter<TsED.Router>;
18
+ export declare function buildRouter(injector: InjectorService, provider: ControllerProvider, parentUseBefore?: any[]): PlatformRouter<TsED.Application, TsED.Router>;
@@ -1,135 +1,11 @@
1
- /// <reference types="node" />
2
- import { FileFilterCallback } from "multer";
3
- import { Readable } from "stream";
1
+ import type multer from "multer";
4
2
  declare global {
5
3
  namespace TsED {
6
- interface MulterFile {
7
- /** Name of the form field associated with this file. */
8
- fieldname: string;
9
- /** Name of the file on the uploader's computer. */
10
- originalname: string;
11
- /** Value of the `Content-Type` header for this file. */
12
- mimetype: string;
13
- /** Size of the file in bytes. */
14
- size: number;
15
- /**
16
- * A readable stream of this file. Only available to the `_handleFile`
17
- * callback for custom `StorageEngine`s.
18
- */
19
- stream: Readable;
20
- /** `DiskStorage` only: Directory to which this file has been uploaded. */
21
- destination: string;
22
- /** `DiskStorage` only: Name of this file within `destination`. */
23
- filename: string;
24
- /** `DiskStorage` only: Full path to the uploaded file. */
25
- path: string;
26
- /** `MemoryStorage` only: A Buffer containing the entire file. */
27
- buffer: Buffer;
28
- }
29
- interface MulterStorageEngine {
30
- }
31
- interface MulterOptions {
32
- /**
33
- * A `StorageEngine` responsible for processing files uploaded via Multer.
34
- * Takes precedence over `dest`.
35
- */
36
- storage?: MulterStorageEngine;
37
- /**
38
- * The destination directory for uploaded files. If `storage` is not set
39
- * and `dest` is, Multer will create a `DiskStorage` instance configured
40
- * to store files at `dest` with random filenames.
41
- *
42
- * Ignored if `storage` is set.
43
- */
44
- dest?: string;
45
- /**
46
- * An object specifying various limits on incoming data. This object is
47
- * passed to Busboy directly, and the details of properties can be found
48
- * at https://github.com/mscdex/busboy#busboy-methods.
49
- */
50
- limits?: {
51
- /** Maximum size of each form field name in bytes. (Default: 100) */
52
- fieldNameSize?: number;
53
- /** Maximum size of each form field value in bytes. (Default: 1048576) */
54
- fieldSize?: number;
55
- /** Maximum number of non-file form fields. (Default: Infinity) */
56
- fields?: number;
57
- /** Maximum size of each file in bytes. (Default: Infinity) */
58
- fileSize?: number;
59
- /** Maximum number of file fields. (Default: Infinity) */
60
- files?: number;
61
- /** Maximum number of parts (non-file fields + files). (Default: Infinity) */
62
- parts?: number;
63
- /** Maximum number of headers. (Default: 2000) */
64
- headerPairs?: number;
65
- };
66
- /** Preserve the full path of the original filename rather than the basename. (Default: false) */
67
- preservePath?: boolean;
68
- /**
69
- * Optional function to control which files are uploaded. This is called
70
- * for every file that is processed.
71
- *
72
- * @param req The Express `Request` object.
73
- * @param file Object containing information about the processed file.
74
- * @param callback a function to control which files should be uploaded and which should be skipped.
75
- */
76
- fileFilter?(req: Request, file: MulterFile, callback: FileFilterCallback): void;
77
- }
78
- interface MulterField {
79
- name: string;
80
- maxCount?: number;
81
- }
82
- type MulterHandler = (req: any, res: any) => Promise<any>;
83
- interface Multer {
84
- /**
85
- * Returns middleware that processes a single file associated with the
86
- * given form field.
87
- *
88
- * The `Request` object will be populated with a `file` object containing
89
- * information about the processed file.
90
- *
91
- * @param fieldName Name of the multipart form field to process.
92
- */
93
- single(fieldName: string): MulterHandler;
94
- /**
95
- * Returns middleware that processes multiple files sharing the same field
96
- * name.
97
- *
98
- * The `Request` object will be populated with a `files` array containing
99
- * an information object for each processed file.
100
- *
101
- * @param fieldName Shared name of the multipart form fields to process.
102
- * @param maxCount Optional. Maximum number of files to process. (default: Infinity)
103
- * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName`
104
- */
105
- array(fieldName: string, maxCount?: number): MulterHandler;
106
- /**
107
- * Returns middleware that processes multiple files associated with the
108
- * given form fields.
109
- *
110
- * The `Request` object will be populated with a `files` object which
111
- * maps each field name to an array of the associated file information
112
- * objects.
113
- *
114
- * @param fields Array of `Field` objects describing multipart form fields to process.
115
- * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if more than `maxCount` files are associated with `fieldName` for any field.
116
- */
117
- fields(fields: MulterField[]): MulterHandler;
118
- /**
119
- * Returns middleware that processes all files contained in the multipart
120
- * request.
121
- *
122
- * The `Request` object will be populated with a `files` array containing
123
- * an information object for each processed file.
124
- */
125
- any(): MulterHandler;
126
- /**
127
- * Returns middleware that accepts only non-file multipart form fields.
128
- *
129
- * @throws `MulterError('LIMIT_UNEXPECTED_FILE')` if any file is encountered.
130
- */
131
- none(): MulterHandler;
132
- }
4
+ type MulterFile = Express.Multer.File;
5
+ type MulterStorageEngine = multer.StorageEngine;
6
+ type MulterOptions = multer.Options;
7
+ type MulterField = multer.Field;
8
+ type Multer = multer.Multer;
133
9
  }
134
10
  }
135
11
  export declare type PlatformMulter = TsED.Multer;
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { Env, getHostInfoFromPort } from "@tsed/core";
3
- import { DIConfiguration } from "@tsed/di";
3
+ import { DIConfiguration, TokenProvider } from "@tsed/di";
4
4
  import Https from "https";
5
- import { EndpointDirectoriesSettings, PlatformLoggerSettings } from "../interfaces";
6
5
  import { ConverterSettings } from "../interfaces/ConverterSettings";
6
+ import { PlatformLoggerSettings } from "../interfaces/PlatformLoggerSettings";
7
7
  /**
8
8
  * `PlatformConfiguration` contains all information about your Server configuration.
9
9
  */
@@ -23,12 +23,18 @@ export declare class PlatformConfiguration extends DIConfiguration {
23
23
  set httpsPort(value: string | number | false);
24
24
  get env(): Env;
25
25
  set env(value: Env);
26
- get mount(): EndpointDirectoriesSettings;
27
- set mount(value: EndpointDirectoriesSettings);
26
+ get mount(): Record<string, TokenProvider[]>;
27
+ set mount(value: Record<string, TokenProvider[]>);
28
+ /**
29
+ * @deprecated
30
+ */
28
31
  get componentsScan(): string[];
32
+ /**
33
+ * @deprecated
34
+ */
29
35
  set componentsScan(value: string[]);
30
- get statics(): EndpointDirectoriesSettings;
31
- set statics(value: EndpointDirectoriesSettings);
36
+ get statics(): Record<string, (any | string)[]>;
37
+ set statics(value: Record<string, (any | string)[]>);
32
38
  get acceptMimes(): string[];
33
39
  set acceptMimes(value: string[]);
34
40
  get debug(): boolean;