@tsed/common 8.0.0-alpha.5 → 8.0.0-alpha.7

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 (239) hide show
  1. package/lib/esm/builder/PlatformBuilder.js.map +1 -1
  2. package/lib/esm/config/services/PlatformConfiguration.js.map +1 -1
  3. package/lib/esm/decorators/PlatformProvider.js.map +1 -1
  4. package/lib/esm/decorators/multer/multerOptions.js.map +1 -1
  5. package/lib/esm/decorators/multer/multipartFile.js.map +1 -1
  6. package/lib/esm/decorators/params/request.js +1 -1
  7. package/lib/esm/decorators/params/request.js.map +1 -1
  8. package/lib/esm/decorators/params/response.js.map +1 -1
  9. package/lib/esm/domain/AnyToPromiseWithCtx.js.map +1 -1
  10. package/lib/esm/domain/PlatformContext.js.map +1 -1
  11. package/lib/esm/exports.js +5 -5
  12. package/lib/esm/exports.js.map +1 -1
  13. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +1 -1
  14. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +1 -1
  15. package/lib/esm/services/Platform.js.map +1 -1
  16. package/lib/esm/services/PlatformAdapter.js.map +1 -1
  17. package/lib/esm/services/PlatformApplication.js.map +1 -1
  18. package/lib/esm/services/PlatformHandler.js.map +1 -1
  19. package/lib/esm/services/PlatformMiddlewaresChain.js.map +1 -1
  20. package/lib/esm/services/PlatformRequest.js.map +1 -1
  21. package/lib/esm/services/PlatformResponse.js.map +1 -1
  22. package/lib/esm/services/PlatformTest.js.map +1 -1
  23. package/lib/esm/utils/createContext.js.map +1 -1
  24. package/lib/esm/utils/createHttpServer.js.map +1 -1
  25. package/lib/esm/utils/createHttpsServer.js.map +1 -1
  26. package/lib/esm/utils/createInjector.js.map +1 -1
  27. package/lib/esm/utils/createServer.js.map +1 -1
  28. package/lib/esm/utils/ensureContext.js.map +1 -1
  29. package/lib/esm/utils/getConfiguration.js.map +1 -1
  30. package/lib/esm/utils/getStaticsOptions.js.map +1 -1
  31. package/lib/esm/utils/printRoutes.js.map +1 -1
  32. package/lib/esm/utils/registerPlatformAdapter.js.map +1 -1
  33. package/lib/esm/utils/setResponseHeaders.js.map +1 -1
  34. package/lib/types/builder/PlatformBuilder.d.ts +1 -1
  35. package/lib/types/config/services/PlatformConfiguration.d.ts +1 -1
  36. package/lib/types/domain/PlatformContext.d.ts +1 -1
  37. package/lib/types/exports.d.ts +5 -5
  38. package/lib/types/interfaces/IncomingEvent.d.ts +1 -1
  39. package/lib/types/services/FakeResponse.d.ts +1 -1
  40. package/lib/types/services/PlatformAdapter.d.ts +1 -1
  41. package/lib/types/services/PlatformApplication.d.ts +1 -1
  42. package/lib/types/services/PlatformRequest.d.ts +1 -1
  43. package/lib/types/services/PlatformResponse.d.ts +2 -2
  44. package/lib/types/services/PlatformTest.d.ts +1 -1
  45. package/lib/types/utils/closeServer.d.ts +3 -3
  46. package/lib/types/utils/createHttpServer.d.ts +1 -1
  47. package/lib/types/utils/createHttpsServer.d.ts +1 -1
  48. package/lib/types/utils/createServer.d.ts +3 -3
  49. package/lib/types/utils/listenServer.d.ts +3 -3
  50. package/package.json +22 -23
  51. package/vitest.config.mts +4 -4
  52. package/lib/cjs/builder/PlatformBuilder.js +0 -341
  53. package/lib/cjs/builder/PlatformBuilder.js.map +0 -1
  54. package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js +0 -3
  55. package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
  56. package/lib/cjs/config/interfaces/PlatformMulterSettings.js +0 -3
  57. package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +0 -1
  58. package/lib/cjs/config/interfaces/PlatformRouterSettings.js +0 -3
  59. package/lib/cjs/config/interfaces/PlatformRouterSettings.js.map +0 -1
  60. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +0 -3
  61. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +0 -1
  62. package/lib/cjs/config/services/PlatformConfiguration.js +0 -122
  63. package/lib/cjs/config/services/PlatformConfiguration.js.map +0 -1
  64. package/lib/cjs/constants/routerOptions.js +0 -5
  65. package/lib/cjs/constants/routerOptions.js.map +0 -1
  66. package/lib/cjs/decorators/PlatformProvider.js +0 -11
  67. package/lib/cjs/decorators/PlatformProvider.js.map +0 -1
  68. package/lib/cjs/decorators/multer/multerFileSize.js +0 -35
  69. package/lib/cjs/decorators/multer/multerFileSize.js.map +0 -1
  70. package/lib/cjs/decorators/multer/multerOptions.js +0 -52
  71. package/lib/cjs/decorators/multer/multerOptions.js.map +0 -1
  72. package/lib/cjs/decorators/multer/multipartFile.js +0 -78
  73. package/lib/cjs/decorators/multer/multipartFile.js.map +0 -1
  74. package/lib/cjs/decorators/params/error.js +0 -20
  75. package/lib/cjs/decorators/params/error.js.map +0 -1
  76. package/lib/cjs/decorators/params/next.js +0 -21
  77. package/lib/cjs/decorators/params/next.js.map +0 -1
  78. package/lib/cjs/decorators/params/request.js +0 -39
  79. package/lib/cjs/decorators/params/request.js.map +0 -1
  80. package/lib/cjs/decorators/params/response.js +0 -33
  81. package/lib/cjs/decorators/params/response.js.map +0 -1
  82. package/lib/cjs/domain/AnyToPromiseWithCtx.js +0 -25
  83. package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +0 -1
  84. package/lib/cjs/domain/EndpointMetadata.js +0 -6
  85. package/lib/cjs/domain/EndpointMetadata.js.map +0 -1
  86. package/lib/cjs/domain/PlatformContext.js +0 -73
  87. package/lib/cjs/domain/PlatformContext.js.map +0 -1
  88. package/lib/cjs/domain/PlatformRouteDetails.js +0 -3
  89. package/lib/cjs/domain/PlatformRouteDetails.js.map +0 -1
  90. package/lib/cjs/exports.js +0 -30
  91. package/lib/cjs/exports.js.map +0 -1
  92. package/lib/cjs/index.js +0 -67
  93. package/lib/cjs/index.js.map +0 -1
  94. package/lib/cjs/interfaces/AfterInit.js +0 -3
  95. package/lib/cjs/interfaces/AfterInit.js.map +0 -1
  96. package/lib/cjs/interfaces/AfterListen.js +0 -3
  97. package/lib/cjs/interfaces/AfterListen.js.map +0 -1
  98. package/lib/cjs/interfaces/AfterRoutesInit.js +0 -3
  99. package/lib/cjs/interfaces/AfterRoutesInit.js.map +0 -1
  100. package/lib/cjs/interfaces/BeforeInit.js +0 -3
  101. package/lib/cjs/interfaces/BeforeInit.js.map +0 -1
  102. package/lib/cjs/interfaces/BeforeListen.js +0 -3
  103. package/lib/cjs/interfaces/BeforeListen.js.map +0 -1
  104. package/lib/cjs/interfaces/BeforeRoutesInit.js +0 -3
  105. package/lib/cjs/interfaces/BeforeRoutesInit.js.map +0 -1
  106. package/lib/cjs/interfaces/HandlerType.js +0 -17
  107. package/lib/cjs/interfaces/HandlerType.js.map +0 -1
  108. package/lib/cjs/interfaces/IncomingEvent.js +0 -3
  109. package/lib/cjs/interfaces/IncomingEvent.js.map +0 -1
  110. package/lib/cjs/interfaces/OnReady.js +0 -3
  111. package/lib/cjs/interfaces/OnReady.js.map +0 -1
  112. package/lib/cjs/interfaces/OnRequest.js +0 -3
  113. package/lib/cjs/interfaces/OnRequest.js.map +0 -1
  114. package/lib/cjs/interfaces/OnResponse.js +0 -3
  115. package/lib/cjs/interfaces/OnResponse.js.map +0 -1
  116. package/lib/cjs/interfaces/OnRoutesInit.js +0 -3
  117. package/lib/cjs/interfaces/OnRoutesInit.js.map +0 -1
  118. package/lib/cjs/interfaces/PlatformRouteOptions.js +0 -3
  119. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +0 -1
  120. package/lib/cjs/interfaces/ResponseErrorObject.js +0 -3
  121. package/lib/cjs/interfaces/ResponseErrorObject.js.map +0 -1
  122. package/lib/cjs/interfaces/Route.js +0 -3
  123. package/lib/cjs/interfaces/Route.js.map +0 -1
  124. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +0 -39
  125. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
  126. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +0 -70
  127. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +0 -1
  128. package/lib/cjs/package.json +0 -3
  129. package/lib/cjs/services/FakeAdapter.js +0 -6
  130. package/lib/cjs/services/FakeAdapter.js.map +0 -1
  131. package/lib/cjs/services/FakeResponse.js +0 -59
  132. package/lib/cjs/services/FakeResponse.js.map +0 -1
  133. package/lib/cjs/services/Platform.js +0 -76
  134. package/lib/cjs/services/Platform.js.map +0 -1
  135. package/lib/cjs/services/PlatformAdapter.js +0 -82
  136. package/lib/cjs/services/PlatformAdapter.js.map +0 -1
  137. package/lib/cjs/services/PlatformApplication.js +0 -44
  138. package/lib/cjs/services/PlatformApplication.js.map +0 -1
  139. package/lib/cjs/services/PlatformHandler.js +0 -133
  140. package/lib/cjs/services/PlatformHandler.js.map +0 -1
  141. package/lib/cjs/services/PlatformMiddlewaresChain.js +0 -60
  142. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +0 -1
  143. package/lib/cjs/services/PlatformRequest.js +0 -144
  144. package/lib/cjs/services/PlatformRequest.js.map +0 -1
  145. package/lib/cjs/services/PlatformResponse.js +0 -309
  146. package/lib/cjs/services/PlatformResponse.js.map +0 -1
  147. package/lib/cjs/services/PlatformTest.js +0 -142
  148. package/lib/cjs/services/PlatformTest.js.map +0 -1
  149. package/lib/cjs/utils/closeServer.js +0 -8
  150. package/lib/cjs/utils/closeServer.js.map +0 -1
  151. package/lib/cjs/utils/createContext.js +0 -49
  152. package/lib/cjs/utils/createContext.js.map +0 -1
  153. package/lib/cjs/utils/createHttpServer.js +0 -18
  154. package/lib/cjs/utils/createHttpServer.js.map +0 -1
  155. package/lib/cjs/utils/createHttpsServer.js +0 -18
  156. package/lib/cjs/utils/createHttpsServer.js.map +0 -1
  157. package/lib/cjs/utils/createInjector.js +0 -45
  158. package/lib/cjs/utils/createInjector.js.map +0 -1
  159. package/lib/cjs/utils/createServer.js +0 -33
  160. package/lib/cjs/utils/createServer.js.map +0 -1
  161. package/lib/cjs/utils/ensureContext.js +0 -16
  162. package/lib/cjs/utils/ensureContext.js.map +0 -1
  163. package/lib/cjs/utils/getConfiguration.js +0 -36
  164. package/lib/cjs/utils/getConfiguration.js.map +0 -1
  165. package/lib/cjs/utils/getStaticsOptions.js +0 -21
  166. package/lib/cjs/utils/getStaticsOptions.js.map +0 -1
  167. package/lib/cjs/utils/listenServer.js +0 -14
  168. package/lib/cjs/utils/listenServer.js.map +0 -1
  169. package/lib/cjs/utils/mapReturnedResponse.js +0 -15
  170. package/lib/cjs/utils/mapReturnedResponse.js.map +0 -1
  171. package/lib/cjs/utils/printRoutes.js +0 -38
  172. package/lib/cjs/utils/printRoutes.js.map +0 -1
  173. package/lib/cjs/utils/registerPlatformAdapter.js +0 -11
  174. package/lib/cjs/utils/registerPlatformAdapter.js.map +0 -1
  175. package/lib/cjs/utils/setResponseHeaders.js +0 -29
  176. package/lib/cjs/utils/setResponseHeaders.js.map +0 -1
  177. package/lib/esm/package.json +0 -3
  178. package/lib/types-esm/builder/PlatformBuilder.d.ts +0 -100
  179. package/lib/types-esm/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
  180. package/lib/types-esm/config/interfaces/PlatformMulterSettings.d.ts +0 -14
  181. package/lib/types-esm/config/interfaces/PlatformRouterSettings.d.ts +0 -10
  182. package/lib/types-esm/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
  183. package/lib/types-esm/config/services/PlatformConfiguration.d.ts +0 -67
  184. package/lib/types-esm/constants/routerOptions.d.ts +0 -1
  185. package/lib/types-esm/decorators/PlatformProvider.d.ts +0 -3
  186. package/lib/types-esm/decorators/multer/multerFileSize.d.ts +0 -27
  187. package/lib/types-esm/decorators/multer/multerOptions.d.ts +0 -41
  188. package/lib/types-esm/decorators/multer/multipartFile.d.ts +0 -47
  189. package/lib/types-esm/decorators/params/error.d.ts +0 -7
  190. package/lib/types-esm/decorators/params/next.d.ts +0 -22
  191. package/lib/types-esm/decorators/params/request.d.ts +0 -46
  192. package/lib/types-esm/decorators/params/response.d.ts +0 -40
  193. package/lib/types-esm/domain/AnyToPromiseWithCtx.d.ts +0 -10
  194. package/lib/types-esm/domain/EndpointMetadata.d.ts +0 -1
  195. package/lib/types-esm/domain/PlatformContext.d.ts +0 -80
  196. package/lib/types-esm/domain/PlatformRouteDetails.d.ts +0 -7
  197. package/lib/types-esm/exports.d.ts +0 -11
  198. package/lib/types-esm/index.d.ts +0 -63
  199. package/lib/types-esm/interfaces/AfterInit.d.ts +0 -3
  200. package/lib/types-esm/interfaces/AfterListen.d.ts +0 -3
  201. package/lib/types-esm/interfaces/AfterRoutesInit.d.ts +0 -3
  202. package/lib/types-esm/interfaces/BeforeInit.d.ts +0 -3
  203. package/lib/types-esm/interfaces/BeforeListen.d.ts +0 -3
  204. package/lib/types-esm/interfaces/BeforeRoutesInit.d.ts +0 -3
  205. package/lib/types-esm/interfaces/HandlerType.d.ts +0 -12
  206. package/lib/types-esm/interfaces/IncomingEvent.d.ts +0 -6
  207. package/lib/types-esm/interfaces/OnReady.d.ts +0 -3
  208. package/lib/types-esm/interfaces/OnRequest.d.ts +0 -4
  209. package/lib/types-esm/interfaces/OnResponse.d.ts +0 -4
  210. package/lib/types-esm/interfaces/OnRoutesInit.d.ts +0 -3
  211. package/lib/types-esm/interfaces/PlatformRouteOptions.d.ts +0 -15
  212. package/lib/types-esm/interfaces/ResponseErrorObject.d.ts +0 -8
  213. package/lib/types-esm/interfaces/Route.d.ts +0 -10
  214. package/lib/types-esm/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
  215. package/lib/types-esm/middlewares/PlatformMulterMiddleware.d.ts +0 -24
  216. package/lib/types-esm/services/FakeAdapter.d.ts +0 -1
  217. package/lib/types-esm/services/FakeResponse.d.ts +0 -22
  218. package/lib/types-esm/services/Platform.d.ts +0 -25
  219. package/lib/types-esm/services/PlatformAdapter.d.ts +0 -89
  220. package/lib/types-esm/services/PlatformApplication.d.ts +0 -29
  221. package/lib/types-esm/services/PlatformHandler.d.ts +0 -39
  222. package/lib/types-esm/services/PlatformMiddlewaresChain.d.ts +0 -17
  223. package/lib/types-esm/services/PlatformRequest.d.ts +0 -111
  224. package/lib/types-esm/services/PlatformResponse.d.ts +0 -174
  225. package/lib/types-esm/services/PlatformTest.d.ts +0 -60
  226. package/lib/types-esm/utils/closeServer.d.ts +0 -7
  227. package/lib/types-esm/utils/createContext.d.ts +0 -10
  228. package/lib/types-esm/utils/createHttpServer.d.ts +0 -4
  229. package/lib/types-esm/utils/createHttpsServer.d.ts +0 -4
  230. package/lib/types-esm/utils/createInjector.d.ts +0 -9
  231. package/lib/types-esm/utils/createServer.d.ts +0 -17
  232. package/lib/types-esm/utils/ensureContext.d.ts +0 -2
  233. package/lib/types-esm/utils/getConfiguration.d.ts +0 -2
  234. package/lib/types-esm/utils/getStaticsOptions.d.ts +0 -5
  235. package/lib/types-esm/utils/listenServer.d.ts +0 -8
  236. package/lib/types-esm/utils/mapReturnedResponse.d.ts +0 -4
  237. package/lib/types-esm/utils/printRoutes.d.ts +0 -2
  238. package/lib/types-esm/utils/registerPlatformAdapter.d.ts +0 -3
  239. package/lib/types-esm/utils/setResponseHeaders.d.ts +0 -5
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.closeServer = void 0;
4
- function closeServer(server) {
5
- return new Promise((resolve) => server.close(() => resolve(undefined)));
6
- }
7
- exports.closeServer = closeServer;
8
- //# sourceMappingURL=closeServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"closeServer.js","sourceRoot":"","sources":["../../../src/utils/closeServer.ts"],"names":[],"mappings":";;;AAIA,SAAgB,WAAW,CAAC,MAAsD;IAChF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,kCAEC"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createContext = exports.buildIgnoreLog = void 0;
4
- const uuid_1 = require("uuid");
5
- const PlatformContext_js_1 = require("../domain/PlatformContext.js");
6
- const PlatformRequest_js_1 = require("../services/PlatformRequest.js");
7
- const PlatformResponse_js_1 = require("../services/PlatformResponse.js");
8
- function defaultReqIdBuilder(req) {
9
- return req.get("x-request-id") || (0, uuid_1.v4)().split("-").join("");
10
- }
11
- function mapIgnoreUrlPatterns(ignoreUrlPatterns) {
12
- return ignoreUrlPatterns.map((pattern) => (typeof pattern === "string" ? new RegExp(pattern, "gi") : pattern));
13
- }
14
- function buildIgnoreLog(ignoreUrlPatterns) {
15
- if (ignoreUrlPatterns) {
16
- ignoreUrlPatterns = mapIgnoreUrlPatterns(ignoreUrlPatterns);
17
- return (ignore, data, url) => ignoreUrlPatterns?.find((reg) => !!url.match(reg));
18
- }
19
- }
20
- exports.buildIgnoreLog = buildIgnoreLog;
21
- /**
22
- * Create the TsED context to wrap request, response, injector, etc...
23
- * @param injector
24
- * @ignore
25
- */
26
- function createContext(injector) {
27
- const ResponseKlass = injector.getProvider(PlatformResponse_js_1.PlatformResponse)?.useClass;
28
- const RequestKlass = injector.getProvider(PlatformRequest_js_1.PlatformRequest)?.useClass;
29
- const { reqIdBuilder = defaultReqIdBuilder, ...loggerOptions } = injector.settings.logger;
30
- const opts = {
31
- ...loggerOptions,
32
- logger: injector.logger,
33
- injector,
34
- ResponseKlass,
35
- RequestKlass
36
- };
37
- const ignoreLog = buildIgnoreLog(loggerOptions.ignoreUrlPatterns);
38
- return function invokeContext(event) {
39
- const $ctx = new PlatformContext_js_1.PlatformContext({
40
- ...opts,
41
- event,
42
- id: reqIdBuilder(event.request)
43
- });
44
- ignoreLog && $ctx.logger.alterIgnoreLog((ignore, data) => ignoreLog(ignore, data, $ctx.url));
45
- return $ctx;
46
- };
47
- }
48
- exports.createContext = createContext;
49
- //# sourceMappingURL=createContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/utils/createContext.ts"],"names":[],"mappings":";;;AACA,+BAAwB;AACxB,qEAA6D;AAE7D,uEAA+D;AAC/D,yEAAiE;AAEjE,SAAS,mBAAmB,CAAC,GAAQ;IACnC,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,IAAA,SAAE,GAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,oBAAoB,CAAC,iBAAwB;IACpD,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,OAAwB,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAClI,CAAC;AAED,SAAgB,cAAc,CAAC,iBAAoC;IACjE,IAAI,iBAAiB,EAAE;QACrB,iBAAiB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAC5D,OAAO,CAAC,MAAe,EAAE,IAAS,EAAE,GAAW,EAAE,EAAE,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;KACxG;AACH,CAAC;AALD,wCAKC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAyB;IACrD,MAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC,sCAAgB,CAAC,EAAE,QAAQ,CAAC;IACvE,MAAM,YAAY,GAAG,QAAQ,CAAC,WAAW,CAAC,oCAAe,CAAC,EAAE,QAAQ,CAAC;IACrE,MAAM,EAAC,YAAY,GAAG,mBAAmB,EAAE,GAAG,aAAa,EAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;IAExF,MAAM,IAAI,GAAG;QACX,GAAG,aAAa;QAChB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,QAAQ;QACR,aAAa;QACb,YAAY;KACb,CAAC;IAEF,MAAM,SAAS,GAAG,cAAc,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAElE,OAAO,SAAS,aAAa,CAAC,KAAoB;QAChD,MAAM,IAAI,GAAG,IAAI,oCAAe,CAAC;YAC/B,GAAG,IAAI;YACP,KAAK;YACL,EAAE,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;SAChC,CAAC,CAAC;QAEH,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAE7F,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AA1BD,sCA0BC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createHttpServer = void 0;
4
- const tslib_1 = require("tslib");
5
- const http_1 = tslib_1.__importDefault(require("http"));
6
- const createServer_js_1 = require("./createServer.js");
7
- function createHttpServer(injector, requestListener) {
8
- const { settings } = injector;
9
- const httpOptions = settings.get("httpOptions");
10
- return (0, createServer_js_1.createServer)(injector, {
11
- port: settings.get("httpPort"),
12
- type: "http",
13
- token: http_1.default.Server,
14
- server: () => http_1.default.createServer(httpOptions, requestListener)
15
- });
16
- }
17
- exports.createHttpServer = createHttpServer;
18
- //# sourceMappingURL=createHttpServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createHttpServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpServer.ts"],"names":[],"mappings":";;;;AACA,wDAAwB;AACxB,uDAA+C;AAE/C,SAAgB,gBAAgB,CAAC,QAAyB,EAAE,eAAqC;IAC/F,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAqB,aAAa,CAAC,CAAC;IAEpE,OAAO,IAAA,8BAAY,EAAC,QAAQ,EAAE;QAC5B,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;QAC9B,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,cAAI,CAAC,MAAM;QAClB,MAAM,EAAE,GAAG,EAAE,CAAC,cAAI,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC;AAVD,4CAUC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createHttpsServer = void 0;
4
- const tslib_1 = require("tslib");
5
- const https_1 = tslib_1.__importDefault(require("https"));
6
- const createServer_js_1 = require("./createServer.js");
7
- function createHttpsServer(injector, requestListener) {
8
- const { settings } = injector;
9
- const httpsOptions = settings.get("httpsOptions");
10
- return (0, createServer_js_1.createServer)(injector, {
11
- type: "https",
12
- token: https_1.default.Server,
13
- port: settings.get("httpsPort"),
14
- server: () => https_1.default.createServer(httpsOptions, requestListener)
15
- });
16
- }
17
- exports.createHttpsServer = createHttpsServer;
18
- //# sourceMappingURL=createHttpsServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":";;;;AAEA,0DAA0B;AAC1B,uDAA+C;AAE/C,SAAgB,iBAAiB,CAAC,QAAyB,EAAE,eAAsC;IACjG,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAElD,OAAO,IAAA,8BAAY,EAAC,QAAQ,EAAE;QAC5B,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,eAAK,CAAC,MAAM;QACnB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,eAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC;KAChE,CAAC,CAAC;AACL,CAAC;AAVD,8CAUC"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createInjector = void 0;
4
- const core_1 = require("@tsed/core");
5
- const di_1 = require("@tsed/di");
6
- const logger_1 = require("@tsed/logger");
7
- const PlatformConfiguration_js_1 = require("../config/services/PlatformConfiguration.js");
8
- const Platform_js_1 = require("../services/Platform.js");
9
- const PlatformAdapter_js_1 = require("../services/PlatformAdapter.js");
10
- const PlatformApplication_js_1 = require("../services/PlatformApplication.js");
11
- const PlatformHandler_js_1 = require("../services/PlatformHandler.js");
12
- const PlatformRequest_js_1 = require("../services/PlatformRequest.js");
13
- const PlatformResponse_js_1 = require("../services/PlatformResponse.js");
14
- logger_1.$log.name = "TSED";
15
- const DEFAULT_PROVIDERS = [
16
- { provide: PlatformHandler_js_1.PlatformHandler },
17
- { provide: PlatformResponse_js_1.PlatformResponse },
18
- { provide: PlatformRequest_js_1.PlatformRequest },
19
- { provide: PlatformApplication_js_1.PlatformApplication },
20
- { provide: Platform_js_1.Platform }
21
- ];
22
- function createInjector({ adapter, settings = {} }) {
23
- const injector = new di_1.InjectorService();
24
- injector.addProvider(PlatformConfiguration_js_1.PlatformConfiguration);
25
- injector.settings = injector.invoke(PlatformConfiguration_js_1.PlatformConfiguration);
26
- injector.logger = logger_1.$log;
27
- injector.settings.set(settings);
28
- if (adapter) {
29
- injector.addProvider(PlatformAdapter_js_1.PlatformAdapter, {
30
- useClass: adapter
31
- });
32
- }
33
- injector.invoke(PlatformAdapter_js_1.PlatformAdapter);
34
- injector.alias(PlatformAdapter_js_1.PlatformAdapter, "PlatformAdapter");
35
- (0, di_1.setLoggerConfiguration)(injector);
36
- const instance = injector.get(PlatformAdapter_js_1.PlatformAdapter);
37
- instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];
38
- (0, core_1.toMap)(instance.providers, "provide").forEach((provider, token) => {
39
- injector.addProvider(token, provider);
40
- });
41
- injector.invoke(PlatformApplication_js_1.PlatformApplication);
42
- return injector;
43
- }
44
- exports.createInjector = createInjector;
45
- //# sourceMappingURL=createInjector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,iCAA+E;AAC/E,yCAAkC;AAClC,0FAAkF;AAClF,yDAAiD;AACjD,uEAA+D;AAC/D,+EAAuE;AACvE,uEAA+D;AAC/D,uEAA+D;AAC/D,yEAAiE;AAEjE,aAAI,CAAC,IAAI,GAAG,MAAM,CAAC;AAEnB,MAAM,iBAAiB,GAAG;IACxB,EAAC,OAAO,EAAE,oCAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,sCAAgB,EAAC;IAC3B,EAAC,OAAO,EAAE,oCAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,4CAAmB,EAAC;IAC9B,EAAC,OAAO,EAAE,sBAAQ,EAAC;CACpB,CAAC;AAOF,SAAgB,cAAc,CAAC,EAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,EAAwB;IAC5E,MAAM,QAAQ,GAAG,IAAI,oBAAe,EAAE,CAAC;IACvC,QAAQ,CAAC,WAAW,CAAC,gDAAqB,CAAC,CAAC;IAE5C,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,gDAAqB,CAAC,CAAC;IAC3D,QAAQ,CAAC,MAAM,GAAG,aAAI,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEhC,IAAI,OAAO,EAAE;QACX,QAAQ,CAAC,WAAW,CAAC,oCAAe,EAAE;YACpC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;KACJ;IAED,QAAQ,CAAC,MAAM,CAAC,oCAAe,CAAC,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,oCAAe,EAAE,iBAAiB,CAAC,CAAC;IAEnD,IAAA,2BAAsB,EAAC,QAAQ,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAkB,oCAAe,CAAE,CAAC;IAEjE,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEnE,IAAA,YAAK,EAAoB,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,4CAAmB,CAAC,CAAC;IAErC,OAAO,QAAQ,CAAC;AAClB,CAAC;AA9BD,wCA8BC"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createServer = void 0;
4
- const core_1 = require("@tsed/core");
5
- const di_1 = require("@tsed/di");
6
- const listenServer_js_1 = require("./listenServer.js");
7
- function createServer(injector, { token, type, port, server: get, listen }) {
8
- const { settings } = injector;
9
- const server = port !== false ? get() : null;
10
- injector.addProvider(token, {
11
- scope: di_1.ProviderScope.SINGLETON,
12
- useValue: server
13
- });
14
- injector.invoke(token);
15
- if (server) {
16
- const hostInfo = (0, core_1.getHostInfoFromPort)(type, port);
17
- return async () => {
18
- const url = `${hostInfo.protocol}://${hostInfo.address}:${port}`;
19
- injector.logger.debug(`Start server on ${url}`);
20
- await (listen ? listen(hostInfo) : (0, listenServer_js_1.listenServer)(server, hostInfo));
21
- const address = server.address();
22
- if (address && typeof address !== "string") {
23
- hostInfo.address = address.address;
24
- hostInfo.port = address.port;
25
- }
26
- injector.logger.info(`Listen server on ${hostInfo.toString()}`);
27
- settings.set(`${type}Port`, `${hostInfo.address}:${hostInfo.port}`);
28
- return server;
29
- };
30
- }
31
- }
32
- exports.createServer = createServer;
33
- //# sourceMappingURL=createServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../../../src/utils/createServer.ts"],"names":[],"mappings":";;;AAAA,qCAAuE;AACvE,iCAAuE;AAIvE,uDAA+C;AAY/C,SAAgB,YAAY,CAC1B,QAAyB,EACzB,EAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAsB;IAE7D,MAAM,EAAC,QAAQ,EAAC,GAAG,QAAQ,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7C,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE;QAC1B,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvB,IAAI,MAAM,EAAE;QACV,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEjD,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,QAAQ,MAAM,QAAQ,CAAC,OAAO,IAAI,IAAI,EAAE,CAAC;YACjE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAC;YAEhD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YAEnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAEjC,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;gBAC1C,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;gBACnC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;aAC9B;YAED,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAChE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,EAAE,GAAG,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAEpE,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;KACH;AACH,CAAC;AApCD,oCAoCC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureContext = void 0;
4
- const di_1 = require("@tsed/di");
5
- function ensureContext(request, cb, fallback) {
6
- const $ctx = (0, di_1.getContext)();
7
- if ($ctx) {
8
- return cb($ctx);
9
- }
10
- if (!request?.$ctx && fallback) {
11
- return fallback();
12
- }
13
- return request.$ctx.runInContext(() => cb(request.$ctx));
14
- }
15
- exports.ensureContext = ensureContext;
16
- //# sourceMappingURL=ensureContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureContext.js","sourceRoot":"","sources":["../../../src/utils/ensureContext.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AAGpC,SAAgB,aAAa,CAAC,OAAY,EAAE,EAAkC,EAAE,QAAqB;IACnG,MAAM,IAAI,GAAG,IAAA,eAAU,GAAmB,CAAC;IAE3C,IAAI,IAAI,EAAE;QACR,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;KACjB;IAED,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE;QAC9B,OAAO,QAAQ,EAAE,CAAC;KACnB;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC;AAZD,sCAYC"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfiguration = void 0;
4
- const core_1 = require("@tsed/core");
5
- const di_1 = require("@tsed/di");
6
- function getConfiguration(configuration = {}, module = null) {
7
- if (configuration.$$resolved) {
8
- return configuration;
9
- }
10
- const store = module ? core_1.Store.from(module).get("configuration") || {} : {};
11
- const env = configuration.env || store.env || process.env.NODE_ENV || core_1.Env.DEV;
12
- return {
13
- $$resolved: true,
14
- env,
15
- httpPort: 8080,
16
- httpsPort: false,
17
- ...store,
18
- ...configuration,
19
- scopes: {
20
- [di_1.ProviderType.CONTROLLER]: di_1.ProviderScope.SINGLETON,
21
- ...store.scopes,
22
- ...configuration.scopes
23
- },
24
- mount: (0, di_1.mergeMount)(store.mount, configuration.mount),
25
- logger: {
26
- debug: false,
27
- level: env === core_1.Env.TEST ? "off" : "info",
28
- logRequest: true,
29
- ...store.logger,
30
- ...configuration.logger,
31
- jsonIndentation: process.env.NODE_ENV === core_1.Env.PROD ? 0 : 2
32
- }
33
- };
34
- }
35
- exports.getConfiguration = getConfiguration;
36
- //# sourceMappingURL=getConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/utils/getConfiguration.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAC5C,iCAAiE;AAEjE,SAAgB,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,YAAK,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,GAAG,CAAC,QAAgB,IAAI,UAAG,CAAC,GAAG,CAAC;IAEvF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG;QACH,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,GAAG,KAAK;QACR,GAAG,aAAa;QAChB,MAAM,EAAE;YACN,CAAC,iBAAY,CAAC,UAAU,CAAC,EAAE,kBAAa,CAAC,SAAS;YAClD,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;SACxB;QACD,KAAK,EAAE,IAAA,eAAU,EAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,GAAG,KAAK,UAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;YACxC,UAAU,EAAE,IAAI;YAChB,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;YACvB,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,UAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3D;KACF,CAAC;AACJ,CAAC;AA9BD,4CA8BC"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStaticsOptions = void 0;
4
- const core_1 = require("@tsed/core");
5
- function mapOptions(options) {
6
- const opts = typeof options === "string" ? { root: options } : options;
7
- return {
8
- ...opts,
9
- hook: (0, core_1.getValue)(opts, "hook", "$afterRoutesInit")
10
- };
11
- }
12
- function getStaticsOptions(statics) {
13
- return Object.entries(statics || {}).reduce((statics, [path, items]) => {
14
- [].concat(items).forEach((options) => {
15
- statics.push({ path, options: mapOptions(options) });
16
- });
17
- return statics;
18
- }, []);
19
- }
20
- exports.getStaticsOptions = getStaticsOptions;
21
- //# sourceMappingURL=getStaticsOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStaticsOptions.js","sourceRoot":"","sources":["../../../src/utils/getStaticsOptions.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAGpC,SAAS,UAAU,CAAC,OAAY;IAC9B,MAAM,IAAI,GAA2B,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7F,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,IAAA,eAAQ,EAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,SAAgB,iBAAiB,CAAC,OAAiC;IACjE,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CACzC,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QACzB,EAAE,CAAC,MAAM,CAAC,KAAY,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,EAAC,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAuD,CACxD,CAAC;AACJ,CAAC;AAXD,8CAWC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listenServer = void 0;
4
- function listenServer(server, hostInfo) {
5
- const { address, port } = hostInfo;
6
- const promise = new Promise((resolve, reject) => {
7
- server.on("listening", resolve);
8
- server.on("error", reject);
9
- });
10
- server.listen(port, address);
11
- return promise;
12
- }
13
- exports.listenServer = listenServer;
14
- //# sourceMappingURL=listenServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listenServer.js","sourceRoot":"","sources":["../../../src/utils/listenServer.ts"],"names":[],"mappings":";;;AAKA,SAAgB,YAAY,CAAC,MAAsD,EAAE,QAAgD;IACnI,MAAM,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,QAAQ,CAAC;IAEjC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAc,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAXD,oCAWC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapReturnedResponse = void 0;
4
- /**
5
- * @ignore
6
- */
7
- function mapReturnedResponse({ use, collection, ...options }) {
8
- return {
9
- ...options,
10
- type: options.type || use,
11
- collectionType: options.collectionType || collection
12
- };
13
- }
14
- exports.mapReturnedResponse = mapReturnedResponse;
15
- //# sourceMappingURL=mapReturnedResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapReturnedResponse.js","sourceRoot":"","sources":["../../../src/utils/mapReturnedResponse.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,mBAAmB,CAAC,EAAC,GAAG,EAAE,UAAU,EAAE,GAAG,OAAO,EAAM;IACpE,OAAO;QACL,GAAG,OAAO;QACV,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,GAAG;QACzB,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,UAAU;KACrD,CAAC;AACJ,CAAC;AAND,kDAMC"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printRoutes = void 0;
4
- const logger_1 = require("@tsed/logger");
5
- function printRoutes(routes) {
6
- const mapColor = {
7
- GET: "green",
8
- POST: "yellow",
9
- PUT: "blue",
10
- DELETE: "red",
11
- PATCH: "magenta",
12
- ALL: "cyan",
13
- STATICS: "white"
14
- };
15
- const list = routes.map((route) => {
16
- const method = route.method.toUpperCase();
17
- return {
18
- ...route,
19
- method: {
20
- length: method.length,
21
- toString: () => {
22
- return (0, logger_1.colorize)(method, mapColor[method]);
23
- }
24
- }
25
- };
26
- });
27
- const str = logger_1.$log.drawTable(list, {
28
- padding: 1,
29
- header: {
30
- method: "Method",
31
- url: "Endpoint",
32
- name: "Class method"
33
- }
34
- });
35
- return "\n" + str.trim();
36
- }
37
- exports.printRoutes = printRoutes;
38
- //# sourceMappingURL=printRoutes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printRoutes.js","sourceRoot":"","sources":["../../../src/utils/printRoutes.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAG5C,SAAgB,WAAW,CAAC,MAA8B;IACxD,MAAM,QAAQ,GAA4B;QACxC,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,SAAS;QAChB,GAAG,EAAE,MAAM;QACX,OAAO,EAAE,OAAO;KACjB,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAE1C,OAAO;YACL,GAAG,KAAK;YACR,MAAM,EAAE;gBACN,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,QAAQ,EAAE,GAAG,EAAE;oBACb,OAAO,IAAA,iBAAQ,EAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,aAAI,CAAC,SAAS,CAAC,IAAI,EAAE;QAC/B,OAAO,EAAE,CAAC;QACV,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,UAAU;YACf,IAAI,EAAE,cAAc;SACrB;KACF,CAAC,CAAC;IAEH,OAAO,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAnCD,kCAmCC"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerPlatformAdapter = void 0;
4
- const PlatformBuilder_js_1 = require("../builder/PlatformBuilder.js");
5
- const PlatformTest_js_1 = require("../services/PlatformTest.js");
6
- function registerPlatformAdapter(adapter) {
7
- PlatformTest_js_1.PlatformTest.adapter = adapter;
8
- PlatformBuilder_js_1.PlatformBuilder.adapter = adapter;
9
- }
10
- exports.registerPlatformAdapter = registerPlatformAdapter;
11
- //# sourceMappingURL=registerPlatformAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPlatformAdapter.js","sourceRoot":"","sources":["../../../src/utils/registerPlatformAdapter.ts"],"names":[],"mappings":";;;AACA,sEAA8D;AAE9D,iEAAyD;AAEzD,SAAgB,uBAAuB,CAAC,OAAmC;IACzE,8BAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IAC/B,oCAAe,CAAC,OAAO,GAAG,OAAO,CAAC;AACpC,CAAC;AAHD,0DAGC"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setResponseHeaders = void 0;
4
- /**
5
- * @ignore
6
- */
7
- function setResponseHeaders(ctx) {
8
- const { response, endpoint } = ctx;
9
- const { operation } = endpoint;
10
- if (ctx.isDone()) {
11
- return;
12
- }
13
- if (!response.hasStatus()) {
14
- // apply status only if the isn't already modified
15
- response.status(operation.getStatus());
16
- }
17
- const statusCode = response.statusCode;
18
- const headers = operation.getHeadersOf(statusCode);
19
- Object.entries(headers).forEach(([key, item]) => {
20
- if (!response.get(key) && item.example !== undefined) {
21
- response.setHeader(key, String(item.example));
22
- }
23
- });
24
- if (operation.isRedirection(statusCode)) {
25
- response.redirect(statusCode, response.get("location"));
26
- }
27
- }
28
- exports.setResponseHeaders = setResponseHeaders;
29
- //# sourceMappingURL=setResponseHeaders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,kBAAkB,CAAC,GAAoB;IACrD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE;QAChB,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,UAAU,CAAC,CAAC;IAEnD,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAQ,EAAE,EAAE;QACrD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YACpD,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SAC/C;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE;QACvC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;KACzD;AACH,CAAC;AAzBD,gDAyBC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,100 +0,0 @@
1
- /// <reference types="node" />
2
- import { Type } from "@tsed/core";
3
- import { InjectorService, ProviderOpts, TokenProvider } from "@tsed/di";
4
- import { PlatformLayer } from "@tsed/platform-router";
5
- import type { IncomingMessage, ServerResponse } from "http";
6
- import { Platform } from "../services/Platform.js";
7
- import { PlatformAdapter, PlatformBuilderSettings } from "../services/PlatformAdapter.js";
8
- import { PlatformApplication } from "../services/PlatformApplication.js";
9
- /**
10
- * @platform
11
- */
12
- export declare class PlatformBuilder<App = TsED.Application> {
13
- #private;
14
- static adapter: Type<PlatformAdapter<any>>;
15
- readonly name: string;
16
- protected startedAt: Date;
17
- protected current: Date;
18
- protected constructor(adapter: Type<PlatformAdapter<App>> | undefined, module: Type, settings: Partial<TsED.Configuration>);
19
- get injector(): InjectorService;
20
- get rootModule(): any;
21
- get app(): PlatformApplication<App>;
22
- get platform(): Platform;
23
- get adapter(): PlatformAdapter<App>;
24
- /**
25
- * Return the settings configured by the decorator @@Configuration@@.
26
- *
27
- * ```typescript
28
- * @Configuration({
29
- * port: 8000,
30
- * httpsPort: 8080,
31
- * mount: {
32
- * "/rest": "${rootDir}/controllers/**\/*.js"
33
- * }
34
- * })
35
- * export class Server {
36
- * $onInit(){
37
- * console.log(this.settings); // {rootDir, port, httpsPort,...}
38
- * }
39
- * }
40
- * ```
41
- *
42
- * @returns {PlatformConfiguration}
43
- */
44
- get settings(): import("@tsed/di").DIConfiguration;
45
- get logger(): import("@tsed/di").DILogger;
46
- get disableBootstrapLog(): any;
47
- static create<App = TsED.Application>(module: Type<any>, settings: PlatformBuilderSettings<App>): PlatformBuilder<App>;
48
- static build<App = TsED.Application>(module: Type<any>, { adapter, ...settings }: PlatformBuilderSettings<App>): PlatformBuilder<App>;
49
- /**
50
- * Bootstrap a server application
51
- * @param module
52
- * @param settings
53
- */
54
- static bootstrap<App = TsED.Application>(module: Type<any>, settings: PlatformBuilderSettings<App>): Promise<PlatformBuilder<App>>;
55
- callback(): (req: IncomingMessage, res: ServerResponse) => void;
56
- callback(req: IncomingMessage, res: ServerResponse): void;
57
- log(...data: any[]): any;
58
- /**
59
- * Add classes decorated by @@Controller@@ to components container.
60
- *
61
- * ### Example
62
- *
63
- * ```typescript
64
- * @Controller('/ctrl')
65
- * class MyController{
66
- * }
67
- *
68
- * platform.addControllers('/rest', [MyController])
69
- * ```
70
- *
71
- * ::: tip
72
- * If the MyController class isn't decorated, the class will be ignored.
73
- * :::
74
- *
75
- * @param {string} endpoint
76
- * @param {any[]} controllers
77
- */
78
- addControllers(endpoint: string, controllers: TokenProvider | TokenProvider[]): void;
79
- runLifecycle(): Promise<this>;
80
- loadInjector(): Promise<void>;
81
- listen(network?: boolean): Promise<void>;
82
- stop(): Promise<void>;
83
- ready(): Promise<void>;
84
- callHook(hook: string, ...args: any[]): Promise<void>;
85
- loadStatics(hook: string): void;
86
- useProvider(token: Type<any>, settings?: Partial<ProviderOpts>): this;
87
- bootstrap(): Promise<this>;
88
- protected mapRouters(): Promise<void>;
89
- protected diff(): string;
90
- /**
91
- * Load middlewares from configuration for the given hook
92
- * @param hook
93
- * @protected
94
- */
95
- protected loadMiddlewaresFor(hook: string): void;
96
- protected createHttpServers(): void;
97
- protected listenServers(): Promise<void>;
98
- protected logRoutes(layers: PlatformLayer[]): Promise<void>;
99
- protected mapTokenMiddlewares(): Promise<void>;
100
- }
@@ -1,10 +0,0 @@
1
- import { JsonMapperGlobalOptions } from "@tsed/json-mapper";
2
- export interface PlatformJsonMapperSettings extends JsonMapperGlobalOptions {
3
- }
4
- declare global {
5
- namespace TsED {
6
- interface Configuration extends Record<string, any> {
7
- jsonMapper?: PlatformJsonMapperSettings;
8
- }
9
- }
10
- }
@@ -1,14 +0,0 @@
1
- import type multer from "multer";
2
- declare global {
3
- namespace TsED {
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;
9
- }
10
- }
11
- export type PlatformMulter = TsED.Multer;
12
- export type PlatformMulterSettings = TsED.MulterOptions;
13
- export type PlatformMulterFile = TsED.MulterFile;
14
- export type PlatformMulterField = TsED.MulterField;
@@ -1,10 +0,0 @@
1
- export interface PlatformRouterSettings {
2
- appendChildrenRoutesFirst?: boolean;
3
- }
4
- declare global {
5
- namespace TsED {
6
- interface Configuration extends Record<string, any> {
7
- router?: PlatformRouterSettings;
8
- }
9
- }
10
- }
@@ -1,17 +0,0 @@
1
- declare global {
2
- namespace TsED {
3
- interface StaticsOptions {
4
- root: string;
5
- hook?: "$beforeRoutesInit" | "$afterRoutesInit";
6
- [key: string]: any;
7
- }
8
- }
9
- }
10
- export interface PlatformStaticsOptions extends TsED.StaticsOptions {
11
- root: string;
12
- [key: string]: any;
13
- }
14
- export type PathOrStaticsOptions = string | PlatformStaticsOptions;
15
- export interface PlatformStaticsSettings {
16
- [endpoint: string]: PathOrStaticsOptions | PathOrStaticsOptions[];
17
- }