@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 +0,0 @@
1
- {"version":3,"file":"IncomingEvent.js","sourceRoot":"","sources":["../../../src/interfaces/IncomingEvent.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=OnReady.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnReady.js","sourceRoot":"","sources":["../../../src/interfaces/OnReady.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=OnRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnRequest.js","sourceRoot":"","sources":["../../../src/interfaces/OnRequest.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=OnResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnResponse.js","sourceRoot":"","sources":["../../../src/interfaces/OnResponse.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=OnRoutesInit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OnRoutesInit.js","sourceRoot":"","sources":["../../../src/interfaces/OnRoutesInit.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=PlatformRouteOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformRouteOptions.js","sourceRoot":"","sources":["../../../src/interfaces/PlatformRouteOptions.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ResponseErrorObject.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResponseErrorObject.js","sourceRoot":"","sources":["../../../src/interfaces/ResponseErrorObject.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Route.js","sourceRoot":"","sources":["../../../src/interfaces/Route.ts"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformAcceptMimesMiddleware = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@tsed/core");
6
- const di_1 = require("@tsed/di");
7
- const exceptions_1 = require("@tsed/exceptions");
8
- const platform_middlewares_1 = require("@tsed/platform-middlewares");
9
- const platform_params_1 = require("@tsed/platform-params");
10
- /**
11
- * @middleware
12
- * @platform
13
- */
14
- let PlatformAcceptMimesMiddleware = class PlatformAcceptMimesMiddleware {
15
- use(ctx) {
16
- const { endpoint, request } = ctx;
17
- const mimes = (0, core_1.uniq)((endpoint?.get("acceptMimes") || []).concat(this.acceptMimes));
18
- if (mimes.length && !request.accepts(mimes)) {
19
- throw new exceptions_1.NotAcceptable(mimes.join(", "));
20
- }
21
- }
22
- };
23
- tslib_1.__decorate([
24
- (0, di_1.Constant)("acceptMimes", []),
25
- tslib_1.__metadata("design:type", Array)
26
- ], PlatformAcceptMimesMiddleware.prototype, "acceptMimes", void 0);
27
- tslib_1.__decorate([
28
- tslib_1.__param(0, (0, platform_params_1.Context)()),
29
- tslib_1.__metadata("design:type", Function),
30
- tslib_1.__metadata("design:paramtypes", [Object]),
31
- tslib_1.__metadata("design:returntype", void 0)
32
- ], PlatformAcceptMimesMiddleware.prototype, "use", null);
33
- PlatformAcceptMimesMiddleware = tslib_1.__decorate([
34
- (0, platform_middlewares_1.Middleware)({
35
- priority: -10
36
- })
37
- ], PlatformAcceptMimesMiddleware);
38
- exports.PlatformAcceptMimesMiddleware = PlatformAcceptMimesMiddleware;
39
- //# sourceMappingURL=PlatformAcceptMimesMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformAcceptMimesMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/PlatformAcceptMimesMiddleware.ts"],"names":[],"mappings":";;;;AAAA,qCAAgC;AAChC,iCAAkC;AAClC,iDAA+C;AAC/C,qEAAyE;AACzE,2DAA8C;AAE9C;;;GAGG;AAII,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAIjC,GAAG,CAAY,GAAY;QAChC,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAC,GAAG,GAAG,CAAC;QAChC,MAAM,KAAK,GAAG,IAAA,WAAI,EAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAElF,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC3C,MAAM,IAAI,0BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3C;IACH,CAAC;CACF,CAAA;AAXC;IAAC,IAAA,aAAQ,EAAC,aAAa,EAAE,EAAE,CAAC;;kEACN;AAEtB;IAAY,mBAAA,IAAA,yBAAO,GAAE,CAAA;;;;wDAOpB;AAXU,6BAA6B;IAHzC,IAAA,iCAAU,EAAC;QACV,QAAQ,EAAE,CAAC,EAAE;KACd,CAAC;GACW,6BAA6B,CAYzC;AAZY,sEAA6B"}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var PlatformMulterMiddleware_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PlatformMulterMiddleware = exports.MulterException = void 0;
5
- const tslib_1 = require("tslib");
6
- const di_1 = require("@tsed/di");
7
- const exceptions_1 = require("@tsed/exceptions");
8
- const platform_middlewares_1 = require("@tsed/platform-middlewares");
9
- const platform_params_1 = require("@tsed/platform-params");
10
- const PlatformContext_js_1 = require("../domain/PlatformContext.js");
11
- const PlatformApplication_js_1 = require("../services/PlatformApplication.js");
12
- class MulterException extends exceptions_1.BadRequest {
13
- constructor(er) {
14
- super(er.message);
15
- this.origin = er;
16
- this.name = er.code;
17
- }
18
- }
19
- exports.MulterException = MulterException;
20
- /**
21
- * @middleware
22
- */
23
- let PlatformMulterMiddleware = PlatformMulterMiddleware_1 = class PlatformMulterMiddleware {
24
- async use(ctx) {
25
- try {
26
- const { fields, options = {} } = ctx.endpoint.get(PlatformMulterMiddleware_1);
27
- const settings = {
28
- ...this.settings,
29
- ...options
30
- };
31
- /* istanbul ignore next */
32
- if (settings.storage) {
33
- delete settings.dest;
34
- }
35
- const middleware = this.app.multer(settings).fields(this.getFields({ fields }));
36
- return await middleware(ctx.getRequest(), ctx.getResponse());
37
- }
38
- catch (er) {
39
- if (er.code) {
40
- throw new MulterException(er);
41
- }
42
- throw er;
43
- }
44
- }
45
- getFields(conf) {
46
- return conf.fields.map(({ name, maxCount }) => ({ name, maxCount }));
47
- }
48
- };
49
- tslib_1.__decorate([
50
- (0, di_1.Value)("multer", {}) // NOTE: don't use constant to getting multer configuration. See issue #1840
51
- ,
52
- tslib_1.__metadata("design:type", Object)
53
- ], PlatformMulterMiddleware.prototype, "settings", void 0);
54
- tslib_1.__decorate([
55
- (0, di_1.Inject)(),
56
- tslib_1.__metadata("design:type", PlatformApplication_js_1.PlatformApplication)
57
- ], PlatformMulterMiddleware.prototype, "app", void 0);
58
- tslib_1.__decorate([
59
- tslib_1.__param(0, (0, platform_params_1.Context)()),
60
- tslib_1.__metadata("design:type", Function),
61
- tslib_1.__metadata("design:paramtypes", [PlatformContext_js_1.PlatformContext]),
62
- tslib_1.__metadata("design:returntype", Promise)
63
- ], PlatformMulterMiddleware.prototype, "use", null);
64
- PlatformMulterMiddleware = PlatformMulterMiddleware_1 = tslib_1.__decorate([
65
- (0, platform_middlewares_1.Middleware)({
66
- priority: 10
67
- })
68
- ], PlatformMulterMiddleware);
69
- exports.PlatformMulterMiddleware = PlatformMulterMiddleware;
70
- //# sourceMappingURL=PlatformMulterMiddleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformMulterMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/PlatformMulterMiddleware.ts"],"names":[],"mappings":";;;;;AAAA,iCAAuC;AACvC,iDAA4C;AAC5C,qEAAyE;AACzE,2DAA8C;AAG9C,qEAA6D;AAC7D,+EAAuE;AAMvE,MAAa,eAAgB,SAAQ,uBAAU;IAC7C,YAAY,EAAe;QACzB,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;IACtB,CAAC;CACF;AAND,0CAMC;AAED;;GAEG;AAII,IAAM,wBAAwB,gCAA9B,MAAM,wB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ACV,QAAQ,EAAE,EAAE;KACb,CAAC;GACW,wBAAwB,CAmCpC;AAnCY,4DAAwB"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeAdapter = void 0;
4
- var PlatformAdapter_js_1 = require("./PlatformAdapter.js");
5
- Object.defineProperty(exports, "FakeAdapter", { enumerable: true, get: function () { return PlatformAdapter_js_1.FakeAdapter; } });
6
- //# sourceMappingURL=FakeAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeAdapter.js","sourceRoot":"","sources":["../../../src/services/FakeAdapter.ts"],"names":[],"mappings":";;;AAAA,2DAAiD;AAAzC,iHAAA,WAAW,OAAA"}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeResponse = void 0;
4
- const node_events_1 = require("node:events");
5
- class FakeResponse extends node_events_1.EventEmitter {
6
- constructor(opts = {}) {
7
- super();
8
- this.headers = {};
9
- this.locals = {};
10
- this.statusCode = 200;
11
- Object.assign(this, opts);
12
- }
13
- status(code) {
14
- this.statusCode = code;
15
- return this;
16
- }
17
- contentType(content) {
18
- this.set("content-type", content);
19
- }
20
- contentLength(content) {
21
- this.set("content-length", content);
22
- }
23
- redirect(status, path) {
24
- this.statusCode = status;
25
- this.set("location", path);
26
- }
27
- location(path) {
28
- this.set("location", path);
29
- }
30
- get(key) {
31
- return this.headers[key.toLowerCase()];
32
- }
33
- getHeaders() {
34
- return this.headers;
35
- }
36
- set(key, value) {
37
- this.headers[key.toLowerCase()] = value;
38
- return this;
39
- }
40
- setHeader(key, value) {
41
- this.headers[key.toLowerCase()] = value;
42
- return this;
43
- }
44
- send(data) {
45
- this.data = data;
46
- }
47
- json(data) {
48
- this.data = data;
49
- }
50
- write(chunk) {
51
- this.emit("data", chunk);
52
- }
53
- end(data) {
54
- data !== undefined && (this.data = data);
55
- this.emit("end");
56
- }
57
- }
58
- exports.FakeResponse = FakeResponse;
59
- //# sourceMappingURL=FakeResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FakeResponse.js","sourceRoot":"","sources":["../../../src/services/FakeResponse.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC,MAAa,YAAa,SAAQ,0BAAY;IAM5C,YAAY,IAAI,GAAG,EAAE;QACnB,KAAK,EAAE,CAAC;QANV,YAAO,GAA4B,EAAE,CAAC;QACtC,WAAM,GAA4B,EAAE,CAAC;QACrC,eAAU,GAAW,GAAG,CAAC;QAMvB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,OAAe;QACzB,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,aAAa,CAAC,OAAe;QAC3B,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,MAAc,EAAE,IAAY;QACnC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAU;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,KAAU;QAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,IAAS;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,IAAS;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,KAAU;QACd,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,GAAG,CAAC,IAAS;QACX,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;CACF;AArED,oCAqEC"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Platform = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const platform_router_1 = require("@tsed/platform-router");
7
- const PlatformApplication_js_1 = require("./PlatformApplication.js");
8
- const PlatformHandler_js_1 = require("./PlatformHandler.js");
9
- /**
10
- * `Platform` is used to provide all routes collected by annotation `@Controller`.
11
- *
12
- * @platform
13
- */
14
- let Platform = class Platform {
15
- #layers;
16
- constructor(injector, platformApplication, platformRouters) {
17
- this.injector = injector;
18
- this.platformApplication = platformApplication;
19
- this.platformRouters = platformRouters;
20
- platformRouters.prebuild();
21
- }
22
- get app() {
23
- return this.platformApplication;
24
- }
25
- addRoutes(routes) {
26
- routes.forEach((routeSettings) => {
27
- this.addRoute(routeSettings.route, routeSettings.token);
28
- });
29
- }
30
- addRoute(route, token) {
31
- const provider = this.injector.getProvider(token);
32
- if (!provider || provider.hasParent()) {
33
- return this;
34
- }
35
- const router = this.platformRouters.from(provider.token);
36
- this.app.use(route, router);
37
- return this;
38
- }
39
- getLayers() {
40
- this.#layers = this.#layers || this.platformRouters.getLayers(this.app);
41
- return this.#layers;
42
- }
43
- /**
44
- * Get all controllers mounted on the application.
45
- * @returns {RouteController[]}
46
- */
47
- getMountedControllers() {
48
- const controllers = this.getLayers().reduce((controllers, layer) => {
49
- if (layer.isProvider()) {
50
- const route = String(layer.getBasePath());
51
- const key = `${layer.provider.toString()}:${route}`;
52
- if (!controllers.has(key)) {
53
- controllers.set(key, {
54
- route,
55
- routes: new Set(),
56
- provider: layer.provider
57
- });
58
- }
59
- controllers.get(key).routes.add(String(layer.path));
60
- }
61
- return controllers;
62
- }, new Map());
63
- return [...controllers.values()];
64
- }
65
- };
66
- Platform = tslib_1.__decorate([
67
- (0, di_1.Injectable)({
68
- scope: di_1.ProviderScope.SINGLETON,
69
- imports: [PlatformHandler_js_1.PlatformHandler]
70
- }),
71
- tslib_1.__metadata("design:paramtypes", [di_1.InjectorService,
72
- PlatformApplication_js_1.PlatformApplication,
73
- platform_router_1.PlatformRouters])
74
- ], Platform);
75
- exports.Platform = Platform;
76
- //# sourceMappingURL=Platform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Platform.js","sourceRoot":"","sources":["../../../src/services/Platform.ts"],"names":[],"mappings":";;;;AAAA,iCAAuG;AACvG,2DAAqE;AAErE,qEAA6D;AAC7D,6DAAqD;AAErD;;;;GAIG;AAKI,IAAM,QAAQ,GAAd,MAAM,QAAQ;IACnB,OAAO,CAAkB;IAEzB,YACW,QAAyB,EACzB,mBAAwC,EACxC,eAAgC;QAFhC,aAAQ,GAAR,QAAQ,CAAiB;QACzB,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,oBAAe,GAAf,eAAe,CAAiB;QAEzC,eAAe,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAED,IAAI,GAAG;QACL,O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,EAAE;oBACzB,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK;wBACL,MAAM,EAAE,IAAI,GAAG,EAAE;wBACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;qBACzB,CAAC,CAAC;iBACJ;gBAED,WAAW,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;aACtD;YAED,OAAO,WAAW,CAAC;QACrB,CAAC,EAAE,IAAI,GAAG,EAA2B,CAAC,CAAC;QAEvC,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;CACF,CAAA;AAnEY,QAAQ;IAJpB,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,OAAO,EAAE,CAAC,oCAAe,CAAC;KAC3B,CAAC;6CAKqB,oBAAe;QACJ,4CAAmB;QACvB,iCAAe;GANhC,QAAQ,CAmEpB;AAnEY,4BAAQ"}
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FakeAdapter = exports.PlatformAdapter = void 0;
4
- const di_1 = require("@tsed/di");
5
- const createHttpServer_js_1 = require("../utils/createHttpServer.js");
6
- const createHttpsServer_js_1 = require("../utils/createHttpsServer.js");
7
- class PlatformAdapter {
8
- constructor(injector) {
9
- this.injector = injector;
10
- }
11
- get app() {
12
- return this.injector.get("PlatformApplication");
13
- }
14
- getServers() {
15
- return [(0, createHttpServer_js_1.createHttpServer)(this.injector, this.app.callback()), (0, createHttpsServer_js_1.createHttpsServer)(this.injector, this.app.callback())].filter(Boolean);
16
- }
17
- onInit() {
18
- return Promise.resolve();
19
- }
20
- beforeLoadRoutes() {
21
- return Promise.resolve();
22
- }
23
- afterLoadRoutes() {
24
- return Promise.resolve();
25
- }
26
- }
27
- exports.PlatformAdapter = PlatformAdapter;
28
- class FakeAdapter extends PlatformAdapter {
29
- constructor() {
30
- super(...arguments);
31
- this.providers = [];
32
- }
33
- static { this.NAME = "FAKE_ADAPTER"; }
34
- static createFakeRawDriver() {
35
- // istanbul ignore next
36
- function FakeRawDriver() { }
37
- // istanbul ignore next
38
- function use() {
39
- return this;
40
- }
41
- FakeRawDriver.use = use;
42
- FakeRawDriver.all = use;
43
- FakeRawDriver.get = use;
44
- FakeRawDriver.patch = use;
45
- FakeRawDriver.post = use;
46
- FakeRawDriver.put = use;
47
- FakeRawDriver.head = use;
48
- FakeRawDriver.delete = use;
49
- FakeRawDriver.options = use;
50
- return FakeRawDriver;
51
- }
52
- createApp() {
53
- const app = FakeAdapter.createFakeRawDriver();
54
- return {
55
- app,
56
- callback() {
57
- return app;
58
- }
59
- };
60
- }
61
- multipart(options) {
62
- return {};
63
- }
64
- statics(endpoint, options) {
65
- return {};
66
- }
67
- bodyParser(type) {
68
- return () => { };
69
- }
70
- mapLayers(layers) { }
71
- mapHandler(handler) {
72
- return handler;
73
- }
74
- useContext() { }
75
- }
76
- exports.FakeAdapter = FakeAdapter;
77
- (0, di_1.registerProvider)({
78
- provide: PlatformAdapter,
79
- deps: [di_1.InjectorService],
80
- useClass: FakeAdapter
81
- });
82
- //# sourceMappingURL=PlatformAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformAdapter.js","sourceRoot":"","sources":["../../../src/services/PlatformAdapter.ts"],"names":[],"mappings":";;;AACA,iCAAyE;AAMzE,sEAA8D;AAC9D,wEAAgE;AAIhE,MAAsB,eAAe;IAOnC,YAAsB,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;IAAG,CAAC;IAEnD,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAA2B,qBAAqB,CAAE,CAAC;IAC7E,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAA,sCAAgB,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,Q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C,OAA+B;QACvC,OAAO,EAAS,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAA+B;QACvD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IAED,SAAS,CAAC,MAAuB,IAAG,CAAC;IAErC,UAAU,CAAC,OAAgD;QACzD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,UAAU,KAAI,CAAC;;AAtDjB,kCAuDC;AAED,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,CAAC,oBAAe,CAAC;IACvB,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAC"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformApplication = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const platform_router_1 = require("@tsed/platform-router");
7
- const PlatformAdapter_js_1 = require("./PlatformAdapter.js");
8
- /**
9
- * `PlatformApplication` is used to provide all routes collected by annotation `@Controller`.
10
- *
11
- * @platform
12
- */
13
- let PlatformApplication = class PlatformApplication extends platform_router_1.PlatformRouter {
14
- constructor(adapter, injector) {
15
- super(injector);
16
- this.adapter = adapter;
17
- this.injector = injector;
18
- const { app, callback } = adapter.createApp();
19
- this.rawApp = app;
20
- this.rawCallback = callback;
21
- }
22
- getApp() {
23
- return this.rawApp;
24
- }
25
- multer(options) {
26
- return this.adapter.multipart(options);
27
- }
28
- callback(req, res) {
29
- if (req && res) {
30
- return this.callback()(req, res);
31
- }
32
- return this.rawCallback();
33
- }
34
- };
35
- PlatformApplication = tslib_1.__decorate([
36
- (0, di_1.Injectable)({
37
- scope: di_1.ProviderScope.SINGLETON,
38
- alias: "PlatformApplication"
39
- }),
40
- tslib_1.__metadata("design:paramtypes", [PlatformAdapter_js_1.PlatformAdapter,
41
- di_1.InjectorService])
42
- ], PlatformApplication);
43
- exports.PlatformApplication = PlatformApplication;
44
- //# sourceMappingURL=PlatformApplication.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformApplication.js","sourceRoot":"","sources":["../../../src/services/PlatformApplication.ts"],"names":[],"mappings":";;;;AAAA,iCAAoE;AACpE,2DAAqD;AAGrD,6DAAqD;AASrD;;;;GAIG;AAKI,IAAM,mBAAmB,GAAzB,MAAM,mBAA4C,SAAQ,gCAAc;IAI7E,YACS,OAA6B,EAC7B,QAAyB;QAEhC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAHT,YAAO,GAAP,OAAO,CAAsB;QAC7B,aAAQ,GAAR,QAAQ,CAAiB;QAGhC,MAAM,EAAC,GAAG,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;QAE5C,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAClB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,OAA+B;QACpC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAID,QAAQ,CAAC,GAAqB,EAAE,GAAoB;QAClD,IAAI,GAAG,IAAI,GAAG,EAAE;YACd,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SAClC;QAED,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;CACF,CAAA;AAhCY,mBAAmB;IAJ/B,IAAA,eAAU,EAAC;QACV,KAAK,EAAE,kBAAa,CAAC,SAAS;QAC9B,KAAK,EAAE,qBAAqB;KAC7B,CAAC;6CAMkB,oCAAe;QACd,oBAAe;GANvB,mBAAmB,CAgC/B;AAhCY,kDAAmB"}
@@ -1,133 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformHandler = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@tsed/core");
6
- const di_1 = require("@tsed/di");
7
- const platform_exceptions_1 = require("@tsed/platform-exceptions");
8
- const platform_params_1 = require("@tsed/platform-params");
9
- const platform_response_filter_1 = require("@tsed/platform-response-filter");
10
- const platform_router_1 = require("@tsed/platform-router");
11
- const AnyToPromiseWithCtx_js_1 = require("../domain/AnyToPromiseWithCtx.js");
12
- const setResponseHeaders_js_1 = require("../utils/setResponseHeaders.js");
13
- const PlatformApplication_js_1 = require("./PlatformApplication.js");
14
- const PlatformMiddlewaresChain_js_1 = require("./PlatformMiddlewaresChain.js");
15
- /**
16
- * Platform Handler abstraction layer. Wrap original class method to a pure platform handler (Express, Koa, etc...).
17
- * @platform
18
- */
19
- let PlatformHandler = class PlatformHandler {
20
- constructor(platformRouters) {
21
- this.platformRouters = platformRouters;
22
- // configure the router module
23
- platformRouters.hooks
24
- .on("alterEndpointHandlers", (handlers, operationRoute) => {
25
- handlers = this.platformMiddlewaresChain.get(handlers, operationRoute);
26
- handlers.after.push((0, platform_router_1.useResponseHandler)(this.flush.bind(this)));
27
- return handlers;
28
- })
29
- .on("alterHandler", (handlerMetadata) => {
30
- const handler = handlerMetadata.isInjectable() ? this.createHandler(handlerMetadata) : handlerMetadata.handler;
31
- return this.platformApplication.adapter.mapHandler(handler, handlerMetadata);
32
- });
33
- }
34
- createHandler(handlerMetadata) {
35
- const handler = this.platformParams.compileHandler(handlerMetadata);
36
- return ($ctx) => {
37
- $ctx.handlerMetadata = handlerMetadata;
38
- return this.onRequest(handler, $ctx);
39
- };
40
- }
41
- /**
42
- * @param provider
43
- * @param propertyKey
44
- */
45
- createCustomHandler(provider, propertyKey) {
46
- const metadata = new platform_router_1.PlatformHandlerMetadata({
47
- provider,
48
- type: platform_router_1.PlatformHandlerType.CUSTOM,
49
- propertyKey
50
- });
51
- return this.createHandler(metadata);
52
- }
53
- /**
54
- * Call handler when a request his handle
55
- */
56
- async onRequest(handler, $ctx) {
57
- const { handlerMetadata } = $ctx;
58
- if (handlerMetadata.type === platform_router_1.PlatformHandlerType.CTX_FN) {
59
- return handler({ $ctx });
60
- }
61
- const resolver = new AnyToPromiseWithCtx_js_1.AnyToPromiseWithCtx($ctx);
62
- const response = await resolver.call(handler);
63
- // Note: restore previous handler metadata (for OIDC)
64
- $ctx.handlerMetadata = handlerMetadata;
65
- if (response.state === core_1.AnyToPromiseStatus.RESOLVED && !$ctx.isDone()) {
66
- return this.onResponse(response, $ctx);
67
- }
68
- }
69
- onResponse({ status, data, headers }, $ctx) {
70
- if (status) {
71
- $ctx.response.status(status);
72
- }
73
- if (headers) {
74
- $ctx.response.setHeaders(headers);
75
- }
76
- if (data !== undefined) {
77
- $ctx.data = data;
78
- }
79
- $ctx.error = null;
80
- // set headers each times that an endpoint is called
81
- if ($ctx.handlerMetadata.isEndpoint()) {
82
- (0, setResponseHeaders_js_1.setResponseHeaders)($ctx);
83
- }
84
- }
85
- /**
86
- * Send the response to the consumer.
87
- * @protected
88
- * @param $ctx
89
- */
90
- async flush($ctx) {
91
- if (!$ctx.error) {
92
- $ctx.error = await (0, core_1.catchAsyncError)(async () => {
93
- const { response } = $ctx;
94
- if (!$ctx.isDone()) {
95
- let data = await this.responseFilter.serialize($ctx.data, $ctx);
96
- data = await this.responseFilter.transform(data, $ctx);
97
- response.body(data);
98
- }
99
- });
100
- }
101
- if ($ctx.error) {
102
- this.platformExceptions.catch($ctx.error, $ctx);
103
- }
104
- }
105
- };
106
- tslib_1.__decorate([
107
- (0, di_1.Inject)(),
108
- tslib_1.__metadata("design:type", platform_response_filter_1.PlatformResponseFilter)
109
- ], PlatformHandler.prototype, "responseFilter", void 0);
110
- tslib_1.__decorate([
111
- (0, di_1.Inject)(),
112
- tslib_1.__metadata("design:type", platform_params_1.PlatformParams)
113
- ], PlatformHandler.prototype, "platformParams", void 0);
114
- tslib_1.__decorate([
115
- (0, di_1.Inject)(),
116
- tslib_1.__metadata("design:type", platform_exceptions_1.PlatformExceptions)
117
- ], PlatformHandler.prototype, "platformExceptions", void 0);
118
- tslib_1.__decorate([
119
- (0, di_1.Inject)(),
120
- tslib_1.__metadata("design:type", PlatformApplication_js_1.PlatformApplication)
121
- ], PlatformHandler.prototype, "platformApplication", void 0);
122
- tslib_1.__decorate([
123
- (0, di_1.Inject)(),
124
- tslib_1.__metadata("design:type", PlatformMiddlewaresChain_js_1.PlatformMiddlewaresChain)
125
- ], PlatformHandler.prototype, "platformMiddlewaresChain", void 0);
126
- PlatformHandler = tslib_1.__decorate([
127
- (0, di_1.Injectable)({
128
- scope: di_1.ProviderScope.SINGLETON
129
- }),
130
- tslib_1.__metadata("design:paramtypes", [platform_router_1.PlatformRouters])
131
- ], PlatformHandler);
132
- exports.PlatformHandler = PlatformHandler;
133
- //# sourceMappingURL=PlatformHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformHandler.js","sourceRoot":"","sources":["../../../src/services/PlatformHandler.ts"],"names":[],"mappings":";;;;AAAA,qCAAiF;AACjF,iCAAqE;AACrE,mEAA6D;AAC7D,2DAA6E;AAC7E,6EAAsE;AACtE,2DAM+B;AAE/B,6EAAqE;AAErE,0EAAkE;AAClE,qEAA6D;AAC7D,+EAAuE;AAEvE;;;GAGG;AAII,IAAM,eAAe,GAArB,MAAM,eAAe;IAgB1B,YAAsB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;QACpD,8BAA8B;QAC9B,eAAe,CAAC,KAAK;aAClB,EAAE,CAAC,uBAAuB,EAAE,CAAC,QAAkC,EAAE,cAAkC,EAAE,EAAE;YACtG,QAAQ,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAEvE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,oCAAkB,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAE/D,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