@tsed/common 8.0.0-alpha.4 → 8.0.0-alpha.6

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 (205) hide show
  1. package/lib/esm/services/PlatformTest.js.map +1 -1
  2. package/lib/types/builder/PlatformBuilder.d.ts +1 -1
  3. package/lib/types/config/services/PlatformConfiguration.d.ts +1 -1
  4. package/lib/types/domain/PlatformContext.d.ts +1 -1
  5. package/lib/types/interfaces/IncomingEvent.d.ts +1 -1
  6. package/lib/types/services/FakeResponse.d.ts +1 -1
  7. package/lib/types/services/PlatformAdapter.d.ts +1 -1
  8. package/lib/types/services/PlatformApplication.d.ts +1 -1
  9. package/lib/types/services/PlatformRequest.d.ts +1 -1
  10. package/lib/types/services/PlatformResponse.d.ts +2 -2
  11. package/lib/types/services/PlatformTest.d.ts +1 -1
  12. package/lib/types/utils/closeServer.d.ts +3 -3
  13. package/lib/types/utils/createHttpServer.d.ts +1 -1
  14. package/lib/types/utils/createHttpsServer.d.ts +1 -1
  15. package/lib/types/utils/createServer.d.ts +3 -3
  16. package/lib/types/utils/listenServer.d.ts +3 -3
  17. package/package.json +19 -20
  18. package/lib/cjs/builder/PlatformBuilder.js +0 -341
  19. package/lib/cjs/builder/PlatformBuilder.js.map +0 -1
  20. package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js +0 -3
  21. package/lib/cjs/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
  22. package/lib/cjs/config/interfaces/PlatformMulterSettings.js +0 -3
  23. package/lib/cjs/config/interfaces/PlatformMulterSettings.js.map +0 -1
  24. package/lib/cjs/config/interfaces/PlatformRouterSettings.js +0 -3
  25. package/lib/cjs/config/interfaces/PlatformRouterSettings.js.map +0 -1
  26. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js +0 -3
  27. package/lib/cjs/config/interfaces/PlatformStaticsSettings.js.map +0 -1
  28. package/lib/cjs/config/services/PlatformConfiguration.js +0 -122
  29. package/lib/cjs/config/services/PlatformConfiguration.js.map +0 -1
  30. package/lib/cjs/constants/routerOptions.js +0 -5
  31. package/lib/cjs/constants/routerOptions.js.map +0 -1
  32. package/lib/cjs/decorators/PlatformProvider.js +0 -11
  33. package/lib/cjs/decorators/PlatformProvider.js.map +0 -1
  34. package/lib/cjs/decorators/multer/multerFileSize.js +0 -35
  35. package/lib/cjs/decorators/multer/multerFileSize.js.map +0 -1
  36. package/lib/cjs/decorators/multer/multerOptions.js +0 -52
  37. package/lib/cjs/decorators/multer/multerOptions.js.map +0 -1
  38. package/lib/cjs/decorators/multer/multipartFile.js +0 -78
  39. package/lib/cjs/decorators/multer/multipartFile.js.map +0 -1
  40. package/lib/cjs/decorators/params/error.js +0 -20
  41. package/lib/cjs/decorators/params/error.js.map +0 -1
  42. package/lib/cjs/decorators/params/next.js +0 -21
  43. package/lib/cjs/decorators/params/next.js.map +0 -1
  44. package/lib/cjs/decorators/params/request.js +0 -39
  45. package/lib/cjs/decorators/params/request.js.map +0 -1
  46. package/lib/cjs/decorators/params/response.js +0 -33
  47. package/lib/cjs/decorators/params/response.js.map +0 -1
  48. package/lib/cjs/domain/AnyToPromiseWithCtx.js +0 -25
  49. package/lib/cjs/domain/AnyToPromiseWithCtx.js.map +0 -1
  50. package/lib/cjs/domain/EndpointMetadata.js +0 -6
  51. package/lib/cjs/domain/EndpointMetadata.js.map +0 -1
  52. package/lib/cjs/domain/PlatformContext.js +0 -73
  53. package/lib/cjs/domain/PlatformContext.js.map +0 -1
  54. package/lib/cjs/domain/PlatformRouteDetails.js +0 -3
  55. package/lib/cjs/domain/PlatformRouteDetails.js.map +0 -1
  56. package/lib/cjs/exports.js +0 -30
  57. package/lib/cjs/exports.js.map +0 -1
  58. package/lib/cjs/index.js +0 -67
  59. package/lib/cjs/index.js.map +0 -1
  60. package/lib/cjs/interfaces/AfterInit.js +0 -3
  61. package/lib/cjs/interfaces/AfterInit.js.map +0 -1
  62. package/lib/cjs/interfaces/AfterListen.js +0 -3
  63. package/lib/cjs/interfaces/AfterListen.js.map +0 -1
  64. package/lib/cjs/interfaces/AfterRoutesInit.js +0 -3
  65. package/lib/cjs/interfaces/AfterRoutesInit.js.map +0 -1
  66. package/lib/cjs/interfaces/BeforeInit.js +0 -3
  67. package/lib/cjs/interfaces/BeforeInit.js.map +0 -1
  68. package/lib/cjs/interfaces/BeforeListen.js +0 -3
  69. package/lib/cjs/interfaces/BeforeListen.js.map +0 -1
  70. package/lib/cjs/interfaces/BeforeRoutesInit.js +0 -3
  71. package/lib/cjs/interfaces/BeforeRoutesInit.js.map +0 -1
  72. package/lib/cjs/interfaces/HandlerType.js +0 -17
  73. package/lib/cjs/interfaces/HandlerType.js.map +0 -1
  74. package/lib/cjs/interfaces/IncomingEvent.js +0 -3
  75. package/lib/cjs/interfaces/IncomingEvent.js.map +0 -1
  76. package/lib/cjs/interfaces/OnReady.js +0 -3
  77. package/lib/cjs/interfaces/OnReady.js.map +0 -1
  78. package/lib/cjs/interfaces/OnRequest.js +0 -3
  79. package/lib/cjs/interfaces/OnRequest.js.map +0 -1
  80. package/lib/cjs/interfaces/OnResponse.js +0 -3
  81. package/lib/cjs/interfaces/OnResponse.js.map +0 -1
  82. package/lib/cjs/interfaces/OnRoutesInit.js +0 -3
  83. package/lib/cjs/interfaces/OnRoutesInit.js.map +0 -1
  84. package/lib/cjs/interfaces/PlatformRouteOptions.js +0 -3
  85. package/lib/cjs/interfaces/PlatformRouteOptions.js.map +0 -1
  86. package/lib/cjs/interfaces/ResponseErrorObject.js +0 -3
  87. package/lib/cjs/interfaces/ResponseErrorObject.js.map +0 -1
  88. package/lib/cjs/interfaces/Route.js +0 -3
  89. package/lib/cjs/interfaces/Route.js.map +0 -1
  90. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js +0 -39
  91. package/lib/cjs/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
  92. package/lib/cjs/middlewares/PlatformMulterMiddleware.js +0 -70
  93. package/lib/cjs/middlewares/PlatformMulterMiddleware.js.map +0 -1
  94. package/lib/cjs/package.json +0 -3
  95. package/lib/cjs/services/FakeAdapter.js +0 -6
  96. package/lib/cjs/services/FakeAdapter.js.map +0 -1
  97. package/lib/cjs/services/FakeResponse.js +0 -59
  98. package/lib/cjs/services/FakeResponse.js.map +0 -1
  99. package/lib/cjs/services/Platform.js +0 -76
  100. package/lib/cjs/services/Platform.js.map +0 -1
  101. package/lib/cjs/services/PlatformAdapter.js +0 -82
  102. package/lib/cjs/services/PlatformAdapter.js.map +0 -1
  103. package/lib/cjs/services/PlatformApplication.js +0 -44
  104. package/lib/cjs/services/PlatformApplication.js.map +0 -1
  105. package/lib/cjs/services/PlatformHandler.js +0 -133
  106. package/lib/cjs/services/PlatformHandler.js.map +0 -1
  107. package/lib/cjs/services/PlatformMiddlewaresChain.js +0 -60
  108. package/lib/cjs/services/PlatformMiddlewaresChain.js.map +0 -1
  109. package/lib/cjs/services/PlatformRequest.js +0 -144
  110. package/lib/cjs/services/PlatformRequest.js.map +0 -1
  111. package/lib/cjs/services/PlatformResponse.js +0 -309
  112. package/lib/cjs/services/PlatformResponse.js.map +0 -1
  113. package/lib/cjs/services/PlatformTest.js +0 -142
  114. package/lib/cjs/services/PlatformTest.js.map +0 -1
  115. package/lib/cjs/utils/closeServer.js +0 -8
  116. package/lib/cjs/utils/closeServer.js.map +0 -1
  117. package/lib/cjs/utils/createContext.js +0 -49
  118. package/lib/cjs/utils/createContext.js.map +0 -1
  119. package/lib/cjs/utils/createHttpServer.js +0 -18
  120. package/lib/cjs/utils/createHttpServer.js.map +0 -1
  121. package/lib/cjs/utils/createHttpsServer.js +0 -18
  122. package/lib/cjs/utils/createHttpsServer.js.map +0 -1
  123. package/lib/cjs/utils/createInjector.js +0 -45
  124. package/lib/cjs/utils/createInjector.js.map +0 -1
  125. package/lib/cjs/utils/createServer.js +0 -33
  126. package/lib/cjs/utils/createServer.js.map +0 -1
  127. package/lib/cjs/utils/ensureContext.js +0 -16
  128. package/lib/cjs/utils/ensureContext.js.map +0 -1
  129. package/lib/cjs/utils/getConfiguration.js +0 -36
  130. package/lib/cjs/utils/getConfiguration.js.map +0 -1
  131. package/lib/cjs/utils/getStaticsOptions.js +0 -21
  132. package/lib/cjs/utils/getStaticsOptions.js.map +0 -1
  133. package/lib/cjs/utils/listenServer.js +0 -14
  134. package/lib/cjs/utils/listenServer.js.map +0 -1
  135. package/lib/cjs/utils/mapReturnedResponse.js +0 -15
  136. package/lib/cjs/utils/mapReturnedResponse.js.map +0 -1
  137. package/lib/cjs/utils/printRoutes.js +0 -38
  138. package/lib/cjs/utils/printRoutes.js.map +0 -1
  139. package/lib/cjs/utils/registerPlatformAdapter.js +0 -11
  140. package/lib/cjs/utils/registerPlatformAdapter.js.map +0 -1
  141. package/lib/cjs/utils/setResponseHeaders.js +0 -29
  142. package/lib/cjs/utils/setResponseHeaders.js.map +0 -1
  143. package/lib/esm/package.json +0 -3
  144. package/lib/types-esm/builder/PlatformBuilder.d.ts +0 -100
  145. package/lib/types-esm/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
  146. package/lib/types-esm/config/interfaces/PlatformMulterSettings.d.ts +0 -14
  147. package/lib/types-esm/config/interfaces/PlatformRouterSettings.d.ts +0 -10
  148. package/lib/types-esm/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
  149. package/lib/types-esm/config/services/PlatformConfiguration.d.ts +0 -67
  150. package/lib/types-esm/constants/routerOptions.d.ts +0 -1
  151. package/lib/types-esm/decorators/PlatformProvider.d.ts +0 -3
  152. package/lib/types-esm/decorators/multer/multerFileSize.d.ts +0 -27
  153. package/lib/types-esm/decorators/multer/multerOptions.d.ts +0 -41
  154. package/lib/types-esm/decorators/multer/multipartFile.d.ts +0 -47
  155. package/lib/types-esm/decorators/params/error.d.ts +0 -7
  156. package/lib/types-esm/decorators/params/next.d.ts +0 -22
  157. package/lib/types-esm/decorators/params/request.d.ts +0 -46
  158. package/lib/types-esm/decorators/params/response.d.ts +0 -40
  159. package/lib/types-esm/domain/AnyToPromiseWithCtx.d.ts +0 -10
  160. package/lib/types-esm/domain/EndpointMetadata.d.ts +0 -1
  161. package/lib/types-esm/domain/PlatformContext.d.ts +0 -80
  162. package/lib/types-esm/domain/PlatformRouteDetails.d.ts +0 -7
  163. package/lib/types-esm/exports.d.ts +0 -11
  164. package/lib/types-esm/index.d.ts +0 -63
  165. package/lib/types-esm/interfaces/AfterInit.d.ts +0 -3
  166. package/lib/types-esm/interfaces/AfterListen.d.ts +0 -3
  167. package/lib/types-esm/interfaces/AfterRoutesInit.d.ts +0 -3
  168. package/lib/types-esm/interfaces/BeforeInit.d.ts +0 -3
  169. package/lib/types-esm/interfaces/BeforeListen.d.ts +0 -3
  170. package/lib/types-esm/interfaces/BeforeRoutesInit.d.ts +0 -3
  171. package/lib/types-esm/interfaces/HandlerType.d.ts +0 -12
  172. package/lib/types-esm/interfaces/IncomingEvent.d.ts +0 -6
  173. package/lib/types-esm/interfaces/OnReady.d.ts +0 -3
  174. package/lib/types-esm/interfaces/OnRequest.d.ts +0 -4
  175. package/lib/types-esm/interfaces/OnResponse.d.ts +0 -4
  176. package/lib/types-esm/interfaces/OnRoutesInit.d.ts +0 -3
  177. package/lib/types-esm/interfaces/PlatformRouteOptions.d.ts +0 -15
  178. package/lib/types-esm/interfaces/ResponseErrorObject.d.ts +0 -8
  179. package/lib/types-esm/interfaces/Route.d.ts +0 -10
  180. package/lib/types-esm/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
  181. package/lib/types-esm/middlewares/PlatformMulterMiddleware.d.ts +0 -24
  182. package/lib/types-esm/services/FakeAdapter.d.ts +0 -1
  183. package/lib/types-esm/services/FakeResponse.d.ts +0 -22
  184. package/lib/types-esm/services/Platform.d.ts +0 -25
  185. package/lib/types-esm/services/PlatformAdapter.d.ts +0 -89
  186. package/lib/types-esm/services/PlatformApplication.d.ts +0 -29
  187. package/lib/types-esm/services/PlatformHandler.d.ts +0 -39
  188. package/lib/types-esm/services/PlatformMiddlewaresChain.d.ts +0 -17
  189. package/lib/types-esm/services/PlatformRequest.d.ts +0 -111
  190. package/lib/types-esm/services/PlatformResponse.d.ts +0 -174
  191. package/lib/types-esm/services/PlatformTest.d.ts +0 -60
  192. package/lib/types-esm/utils/closeServer.d.ts +0 -7
  193. package/lib/types-esm/utils/createContext.d.ts +0 -10
  194. package/lib/types-esm/utils/createHttpServer.d.ts +0 -4
  195. package/lib/types-esm/utils/createHttpsServer.d.ts +0 -4
  196. package/lib/types-esm/utils/createInjector.d.ts +0 -9
  197. package/lib/types-esm/utils/createServer.d.ts +0 -17
  198. package/lib/types-esm/utils/ensureContext.d.ts +0 -2
  199. package/lib/types-esm/utils/getConfiguration.d.ts +0 -2
  200. package/lib/types-esm/utils/getStaticsOptions.d.ts +0 -5
  201. package/lib/types-esm/utils/listenServer.d.ts +0 -8
  202. package/lib/types-esm/utils/mapReturnedResponse.d.ts +0 -4
  203. package/lib/types-esm/utils/printRoutes.d.ts +0 -2
  204. package/lib/types-esm/utils/registerPlatformAdapter.d.ts +0 -3
  205. package/lib/types-esm/utils/setResponseHeaders.d.ts +0 -5
@@ -1,142 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlatformTest = void 0;
4
- const tslib_1 = require("tslib");
5
- const di_1 = require("@tsed/di");
6
- const accepts_1 = tslib_1.__importDefault(require("accepts"));
7
- const PlatformBuilder_js_1 = require("../builder/PlatformBuilder.js");
8
- const PlatformContext_js_1 = require("../domain/PlatformContext.js");
9
- const createInjector_js_1 = require("../utils/createInjector.js");
10
- const getConfiguration_js_1 = require("../utils/getConfiguration.js");
11
- const FakeResponse_1 = require("./FakeResponse");
12
- const PlatformApplication_js_1 = require("./PlatformApplication.js");
13
- /**
14
- * @platform
15
- */
16
- class PlatformTest extends di_1.DITest {
17
- static async create(settings = {}) {
18
- di_1.DITest.injector = PlatformTest.createInjector((0, getConfiguration_js_1.getConfiguration)(settings));
19
- await di_1.DITest.createContainer();
20
- }
21
- /**
22
- * Create a new injector with the right default services
23
- */
24
- static createInjector(settings = {}) {
25
- return (0, createInjector_js_1.createInjector)({
26
- settings: di_1.DITest.configure({ httpPort: false, httpsPort: false, ...settings })
27
- });
28
- }
29
- /**
30
- * Load the server silently without listening port and configure it on test profile.
31
- * @decorator
32
- * @param mod
33
- * @param listen
34
- * @param settings
35
- * @returns {Promise<void>}
36
- */
37
- static bootstrap(mod, { listen, ...settings } = {}) {
38
- return async function before() {
39
- let instance;
40
- const adapter = settings.platform || settings.adapter || PlatformTest.adapter;
41
- /* istanbul ignore next */
42
- if (!adapter) {
43
- throw new Error("Platform adapter is not specified. Have you added at least `import @tsed/platform-express` (or equivalent) on your Server.ts ?");
44
- }
45
- // @ts-ignore
46
- settings = di_1.DITest.configure(settings);
47
- settings.adapter = adapter;
48
- const configuration = (0, getConfiguration_js_1.getConfiguration)(settings, mod);
49
- const disableComponentsScan = configuration.disableComponentsScan || !!process.env.WEBPACK;
50
- if (!disableComponentsScan) {
51
- const { importProviders } = await Promise.resolve().then(() => tslib_1.__importStar(require("@tsed/components-scan")));
52
- await importProviders(configuration);
53
- }
54
- instance = await PlatformBuilder_js_1.PlatformBuilder.build(mod, configuration).bootstrap();
55
- await instance.listen(!!listen);
56
- // used by inject method
57
- di_1.DITest.injector = instance.injector;
58
- };
59
- }
60
- /**
61
- * It injects services into the test function where you can alter, spy on, and manipulate them.
62
- *
63
- * The inject function has two parameters
64
- *
65
- * * an array of Service dependency injection tokens,
66
- * * a test function whose parameters correspond exactly to each item in the injection token array.
67
- *
68
- * @param targets
69
- * @param func
70
- */
71
- static inject(targets, func) {
72
- return async () => {
73
- if (!di_1.DITest.hasInjector()) {
74
- await PlatformTest.create();
75
- }
76
- const injector = di_1.DITest.injector;
77
- const deps = [];
78
- for (const target of targets) {
79
- deps.push(injector.has(target) ? injector.get(target) : await injector.invoke(target));
80
- }
81
- return func(...deps);
82
- };
83
- }
84
- /**
85
- * Return the raw application (express or koa).
86
- * Use this callback with SuperTest.
87
- *
88
- * ```typescript
89
- * let request: SuperTest.Agent;
90
- * beforeEach(PlatformTest.bootstrap(Server, {
91
- * mount: {
92
- * "/rest": [ProductsController]
93
- * }
94
- * }));
95
- * beforeEach(() => {
96
- * request = SuperTest(PlatformTest.callback());
97
- * });
98
- * ```
99
- */
100
- static callback() {
101
- return di_1.DITest.injector.get(PlatformApplication_js_1.PlatformApplication)?.callback();
102
- }
103
- static createRequest(options = {}) {
104
- return {
105
- headers: {},
106
- method: "GET",
107
- url: "/",
108
- query: {},
109
- get(key) {
110
- return this.headers[key.toLowerCase()];
111
- },
112
- accepts(mime) {
113
- return (0, accepts_1.default)(this).types([].concat(mime));
114
- },
115
- ...options
116
- };
117
- }
118
- static createResponse(options = {}) {
119
- return new FakeResponse_1.FakeResponse(options);
120
- }
121
- static createRequestContext(options = {}) {
122
- const event = {
123
- ...options.event,
124
- request: options?.request?.request || options?.event?.request || PlatformTest.createRequest(),
125
- response: options?.response?.response || options?.event?.response || PlatformTest.createResponse()
126
- };
127
- const $ctx = new PlatformContext_js_1.PlatformContext({
128
- id: "id",
129
- injector: di_1.DITest.injector,
130
- logger: di_1.DITest.injector.logger,
131
- url: "/",
132
- ...options,
133
- event
134
- });
135
- if (options.endpoint) {
136
- $ctx.endpoint = options.endpoint;
137
- }
138
- return $ctx;
139
- }
140
- }
141
- exports.PlatformTest = PlatformTest;
142
- //# sourceMappingURL=PlatformTest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformTest.js","sourceRoot":"","sources":["../../../src/services/PlatformTest.ts"],"names":[],"mappings":";;;;AACA,iCAAiD;AACjD,8DAA8B;AAE9B,sEAA8D;AAC9D,qEAAqF;AACrF,kEAA0D;AAC1D,sEAA8D;AAC9D,iDAA4C;AAE5C,qEAA6D;AAE7D;;GAEG;AACH,MAAa,YAAa,SAAQ,WAAM;IAGtC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,WAAwC,EAAE;QAC5D,WAAM,CAAC,QAAQ,GAAG,YAAY,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AC,IAAwB;gBAC9B,OAAO,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAa,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,UAAe,EAAE;QACrC,OAAO,IAAI,2BAAY,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,UAAiD,EAAE;QAC7E,MAAM,KAAK,GAAG;YACZ,GAAG,OAAO,CAAC,KAAK;YAChB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,CAAC,aAAa,EAAE;YAC7F,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAAE,KAAK,EAAE,QAAQ,IAAI,YAAY,CAAC,cAAc,EAAE;SACnG,CAAC;QAEF,MAAM,IAAI,GAAG,IAAI,oCAAe,CAAC;YAC/B,EAAE,EAAE,IAAI;YACR,QAAQ,EAAE,WAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,WAAM,CAAC,QAAQ,CAAC,MAAM;YAC9B,GAAG,EAAE,GAAG;YACR,GAAG,OAAO;YACV,KAAK;SACN,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnJD,oCAmJC"}
@@ -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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_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
- }