@tsed/common 8.0.0-beta.3 → 8.0.0-beta.5

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 (190) hide show
  1. package/lib/esm/index.js +11 -63
  2. package/lib/esm/index.js.map +1 -1
  3. package/lib/types/index.d.ts +11 -63
  4. package/package.json +11 -32
  5. package/readme.md +3 -3
  6. package/vitest.config.mts +5 -5
  7. package/.barrelsby.json +0 -5
  8. package/lib/esm/builder/PlatformBuilder.js +0 -308
  9. package/lib/esm/builder/PlatformBuilder.js.map +0 -1
  10. package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js +0 -2
  11. package/lib/esm/config/interfaces/PlatformJsonMapperSettings.js.map +0 -1
  12. package/lib/esm/config/interfaces/PlatformMulterSettings.js +0 -2
  13. package/lib/esm/config/interfaces/PlatformMulterSettings.js.map +0 -1
  14. package/lib/esm/config/interfaces/PlatformRouterSettings.js +0 -2
  15. package/lib/esm/config/interfaces/PlatformRouterSettings.js.map +0 -1
  16. package/lib/esm/config/interfaces/PlatformStaticsSettings.js +0 -2
  17. package/lib/esm/config/interfaces/PlatformStaticsSettings.js.map +0 -1
  18. package/lib/esm/config/services/PlatformConfiguration.js +0 -119
  19. package/lib/esm/config/services/PlatformConfiguration.js.map +0 -1
  20. package/lib/esm/constants/routerOptions.js +0 -2
  21. package/lib/esm/constants/routerOptions.js.map +0 -1
  22. package/lib/esm/decorators/PlatformProvider.js +0 -7
  23. package/lib/esm/decorators/PlatformProvider.js.map +0 -1
  24. package/lib/esm/decorators/multer/multerFileSize.js +0 -31
  25. package/lib/esm/decorators/multer/multerFileSize.js.map +0 -1
  26. package/lib/esm/decorators/multer/multerOptions.js +0 -49
  27. package/lib/esm/decorators/multer/multerOptions.js.map +0 -1
  28. package/lib/esm/decorators/multer/multipartFile.js +0 -74
  29. package/lib/esm/decorators/multer/multipartFile.js.map +0 -1
  30. package/lib/esm/decorators/params/error.js +0 -16
  31. package/lib/esm/decorators/params/error.js.map +0 -1
  32. package/lib/esm/decorators/params/next.js +0 -17
  33. package/lib/esm/decorators/params/next.js.map +0 -1
  34. package/lib/esm/decorators/params/request.js +0 -34
  35. package/lib/esm/decorators/params/request.js.map +0 -1
  36. package/lib/esm/decorators/params/response.js +0 -28
  37. package/lib/esm/decorators/params/response.js.map +0 -1
  38. package/lib/esm/domain/AnyToPromiseWithCtx.js +0 -21
  39. package/lib/esm/domain/AnyToPromiseWithCtx.js.map +0 -1
  40. package/lib/esm/domain/EndpointMetadata.js +0 -2
  41. package/lib/esm/domain/EndpointMetadata.js.map +0 -1
  42. package/lib/esm/domain/PlatformContext.js +0 -69
  43. package/lib/esm/domain/PlatformContext.js.map +0 -1
  44. package/lib/esm/domain/PlatformRouteDetails.js +0 -2
  45. package/lib/esm/domain/PlatformRouteDetails.js.map +0 -1
  46. package/lib/esm/exports.js +0 -10
  47. package/lib/esm/exports.js.map +0 -1
  48. package/lib/esm/interfaces/AfterInit.js +0 -2
  49. package/lib/esm/interfaces/AfterInit.js.map +0 -1
  50. package/lib/esm/interfaces/AfterListen.js +0 -2
  51. package/lib/esm/interfaces/AfterListen.js.map +0 -1
  52. package/lib/esm/interfaces/AfterRoutesInit.js +0 -2
  53. package/lib/esm/interfaces/AfterRoutesInit.js.map +0 -1
  54. package/lib/esm/interfaces/BeforeInit.js +0 -2
  55. package/lib/esm/interfaces/BeforeInit.js.map +0 -1
  56. package/lib/esm/interfaces/BeforeListen.js +0 -2
  57. package/lib/esm/interfaces/BeforeListen.js.map +0 -1
  58. package/lib/esm/interfaces/BeforeRoutesInit.js +0 -2
  59. package/lib/esm/interfaces/BeforeRoutesInit.js.map +0 -1
  60. package/lib/esm/interfaces/HandlerType.js +0 -14
  61. package/lib/esm/interfaces/HandlerType.js.map +0 -1
  62. package/lib/esm/interfaces/IncomingEvent.js +0 -2
  63. package/lib/esm/interfaces/IncomingEvent.js.map +0 -1
  64. package/lib/esm/interfaces/OnReady.js +0 -2
  65. package/lib/esm/interfaces/OnReady.js.map +0 -1
  66. package/lib/esm/interfaces/OnRequest.js +0 -2
  67. package/lib/esm/interfaces/OnRequest.js.map +0 -1
  68. package/lib/esm/interfaces/OnResponse.js +0 -2
  69. package/lib/esm/interfaces/OnResponse.js.map +0 -1
  70. package/lib/esm/interfaces/OnRoutesInit.js +0 -2
  71. package/lib/esm/interfaces/OnRoutesInit.js.map +0 -1
  72. package/lib/esm/interfaces/PlatformRouteOptions.js +0 -2
  73. package/lib/esm/interfaces/PlatformRouteOptions.js.map +0 -1
  74. package/lib/esm/interfaces/ResponseErrorObject.js +0 -2
  75. package/lib/esm/interfaces/ResponseErrorObject.js.map +0 -1
  76. package/lib/esm/interfaces/Route.js +0 -2
  77. package/lib/esm/interfaces/Route.js.map +0 -1
  78. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js +0 -36
  79. package/lib/esm/middlewares/PlatformAcceptMimesMiddleware.js.map +0 -1
  80. package/lib/esm/middlewares/PlatformMulterMiddleware.js +0 -66
  81. package/lib/esm/middlewares/PlatformMulterMiddleware.js.map +0 -1
  82. package/lib/esm/services/FakeAdapter.js +0 -2
  83. package/lib/esm/services/FakeAdapter.js.map +0 -1
  84. package/lib/esm/services/FakeResponse.js +0 -55
  85. package/lib/esm/services/FakeResponse.js.map +0 -1
  86. package/lib/esm/services/Platform.js +0 -73
  87. package/lib/esm/services/Platform.js.map +0 -1
  88. package/lib/esm/services/PlatformAdapter.js +0 -77
  89. package/lib/esm/services/PlatformAdapter.js.map +0 -1
  90. package/lib/esm/services/PlatformApplication.js +0 -41
  91. package/lib/esm/services/PlatformApplication.js.map +0 -1
  92. package/lib/esm/services/PlatformHandler.js +0 -130
  93. package/lib/esm/services/PlatformHandler.js.map +0 -1
  94. package/lib/esm/services/PlatformMiddlewaresChain.js +0 -57
  95. package/lib/esm/services/PlatformMiddlewaresChain.js.map +0 -1
  96. package/lib/esm/services/PlatformRequest.js +0 -141
  97. package/lib/esm/services/PlatformRequest.js.map +0 -1
  98. package/lib/esm/services/PlatformResponse.js +0 -306
  99. package/lib/esm/services/PlatformResponse.js.map +0 -1
  100. package/lib/esm/services/PlatformTest.js +0 -131
  101. package/lib/esm/services/PlatformTest.js.map +0 -1
  102. package/lib/esm/utils/closeServer.js +0 -4
  103. package/lib/esm/utils/closeServer.js.map +0 -1
  104. package/lib/esm/utils/createContext.js +0 -44
  105. package/lib/esm/utils/createContext.js.map +0 -1
  106. package/lib/esm/utils/createHttpServer.js +0 -13
  107. package/lib/esm/utils/createHttpServer.js.map +0 -1
  108. package/lib/esm/utils/createHttpsServer.js +0 -13
  109. package/lib/esm/utils/createHttpsServer.js.map +0 -1
  110. package/lib/esm/utils/createInjector.js +0 -41
  111. package/lib/esm/utils/createInjector.js.map +0 -1
  112. package/lib/esm/utils/createServer.js +0 -29
  113. package/lib/esm/utils/createServer.js.map +0 -1
  114. package/lib/esm/utils/ensureContext.js +0 -12
  115. package/lib/esm/utils/ensureContext.js.map +0 -1
  116. package/lib/esm/utils/getConfiguration.js +0 -32
  117. package/lib/esm/utils/getConfiguration.js.map +0 -1
  118. package/lib/esm/utils/getStaticsOptions.js +0 -17
  119. package/lib/esm/utils/getStaticsOptions.js.map +0 -1
  120. package/lib/esm/utils/listenServer.js +0 -10
  121. package/lib/esm/utils/listenServer.js.map +0 -1
  122. package/lib/esm/utils/mapReturnedResponse.js +0 -11
  123. package/lib/esm/utils/mapReturnedResponse.js.map +0 -1
  124. package/lib/esm/utils/printRoutes.js +0 -34
  125. package/lib/esm/utils/printRoutes.js.map +0 -1
  126. package/lib/esm/utils/registerPlatformAdapter.js +0 -7
  127. package/lib/esm/utils/registerPlatformAdapter.js.map +0 -1
  128. package/lib/esm/utils/setResponseHeaders.js +0 -25
  129. package/lib/esm/utils/setResponseHeaders.js.map +0 -1
  130. package/lib/types/builder/PlatformBuilder.d.ts +0 -100
  131. package/lib/types/config/interfaces/PlatformJsonMapperSettings.d.ts +0 -10
  132. package/lib/types/config/interfaces/PlatformMulterSettings.d.ts +0 -14
  133. package/lib/types/config/interfaces/PlatformRouterSettings.d.ts +0 -10
  134. package/lib/types/config/interfaces/PlatformStaticsSettings.d.ts +0 -17
  135. package/lib/types/config/services/PlatformConfiguration.d.ts +0 -67
  136. package/lib/types/constants/routerOptions.d.ts +0 -1
  137. package/lib/types/decorators/PlatformProvider.d.ts +0 -3
  138. package/lib/types/decorators/multer/multerFileSize.d.ts +0 -27
  139. package/lib/types/decorators/multer/multerOptions.d.ts +0 -42
  140. package/lib/types/decorators/multer/multipartFile.d.ts +0 -47
  141. package/lib/types/decorators/params/error.d.ts +0 -7
  142. package/lib/types/decorators/params/next.d.ts +0 -22
  143. package/lib/types/decorators/params/request.d.ts +0 -46
  144. package/lib/types/decorators/params/response.d.ts +0 -40
  145. package/lib/types/domain/AnyToPromiseWithCtx.d.ts +0 -10
  146. package/lib/types/domain/EndpointMetadata.d.ts +0 -1
  147. package/lib/types/domain/PlatformContext.d.ts +0 -80
  148. package/lib/types/domain/PlatformRouteDetails.d.ts +0 -7
  149. package/lib/types/exports.d.ts +0 -9
  150. package/lib/types/interfaces/AfterInit.d.ts +0 -3
  151. package/lib/types/interfaces/AfterListen.d.ts +0 -3
  152. package/lib/types/interfaces/AfterRoutesInit.d.ts +0 -3
  153. package/lib/types/interfaces/BeforeInit.d.ts +0 -3
  154. package/lib/types/interfaces/BeforeListen.d.ts +0 -3
  155. package/lib/types/interfaces/BeforeRoutesInit.d.ts +0 -3
  156. package/lib/types/interfaces/HandlerType.d.ts +0 -12
  157. package/lib/types/interfaces/IncomingEvent.d.ts +0 -6
  158. package/lib/types/interfaces/OnReady.d.ts +0 -3
  159. package/lib/types/interfaces/OnRequest.d.ts +0 -4
  160. package/lib/types/interfaces/OnResponse.d.ts +0 -4
  161. package/lib/types/interfaces/OnRoutesInit.d.ts +0 -3
  162. package/lib/types/interfaces/PlatformRouteOptions.d.ts +0 -15
  163. package/lib/types/interfaces/ResponseErrorObject.d.ts +0 -8
  164. package/lib/types/interfaces/Route.d.ts +0 -10
  165. package/lib/types/middlewares/PlatformAcceptMimesMiddleware.d.ts +0 -10
  166. package/lib/types/middlewares/PlatformMulterMiddleware.d.ts +0 -24
  167. package/lib/types/services/FakeAdapter.d.ts +0 -1
  168. package/lib/types/services/FakeResponse.d.ts +0 -22
  169. package/lib/types/services/Platform.d.ts +0 -25
  170. package/lib/types/services/PlatformAdapter.d.ts +0 -89
  171. package/lib/types/services/PlatformApplication.d.ts +0 -29
  172. package/lib/types/services/PlatformHandler.d.ts +0 -39
  173. package/lib/types/services/PlatformMiddlewaresChain.d.ts +0 -17
  174. package/lib/types/services/PlatformRequest.d.ts +0 -111
  175. package/lib/types/services/PlatformResponse.d.ts +0 -175
  176. package/lib/types/services/PlatformTest.d.ts +0 -61
  177. package/lib/types/utils/closeServer.d.ts +0 -7
  178. package/lib/types/utils/createContext.d.ts +0 -10
  179. package/lib/types/utils/createHttpServer.d.ts +0 -4
  180. package/lib/types/utils/createHttpsServer.d.ts +0 -4
  181. package/lib/types/utils/createInjector.d.ts +0 -8
  182. package/lib/types/utils/createServer.d.ts +0 -17
  183. package/lib/types/utils/ensureContext.d.ts +0 -2
  184. package/lib/types/utils/getConfiguration.d.ts +0 -2
  185. package/lib/types/utils/getStaticsOptions.d.ts +0 -5
  186. package/lib/types/utils/listenServer.d.ts +0 -8
  187. package/lib/types/utils/mapReturnedResponse.d.ts +0 -4
  188. package/lib/types/utils/printRoutes.d.ts +0 -2
  189. package/lib/types/utils/registerPlatformAdapter.d.ts +0 -3
  190. package/lib/types/utils/setResponseHeaders.d.ts +0 -5
@@ -1,13 +0,0 @@
1
- import Https from "https";
2
- import { createServer } from "./createServer.js";
3
- export function createHttpsServer(injector, requestListener) {
4
- const { settings } = injector;
5
- const httpsOptions = settings.get("httpsOptions");
6
- return createServer(injector, {
7
- type: "https",
8
- token: Https.Server,
9
- port: settings.get("httpsPort"),
10
- server: () => Https.createServer(httpsOptions, requestListener)
11
- });
12
- }
13
- //# sourceMappingURL=createHttpsServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createHttpsServer.js","sourceRoot":"","sources":["../../../src/utils/createHttpsServer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C,MAAM,UAAU,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,YAAY,CAAC,QAAQ,EAAE;QAC5B,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC;QAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,eAAe,CAAC;KAChE,CAAC,CAAC;AACL,CAAC"}
@@ -1,41 +0,0 @@
1
- import { toMap } from "@tsed/core";
2
- import { injector, setLoggerConfiguration } from "@tsed/di";
3
- import { $log } from "@tsed/logger";
4
- import { PlatformConfiguration } from "../config/services/PlatformConfiguration.js";
5
- import { Platform } from "../services/Platform.js";
6
- import { PlatformAdapter } from "../services/PlatformAdapter.js";
7
- import { PlatformApplication } from "../services/PlatformApplication.js";
8
- import { PlatformHandler } from "../services/PlatformHandler.js";
9
- import { PlatformRequest } from "../services/PlatformRequest.js";
10
- import { PlatformResponse } from "../services/PlatformResponse.js";
11
- $log.name = "TSED";
12
- const DEFAULT_PROVIDERS = [
13
- { provide: PlatformHandler },
14
- { provide: PlatformResponse },
15
- { provide: PlatformRequest },
16
- { provide: PlatformApplication },
17
- { provide: Platform }
18
- ];
19
- export function createInjector({ adapter, settings = {} }) {
20
- const inj = injector();
21
- inj.addProvider(PlatformConfiguration);
22
- inj.settings = inj.invoke(PlatformConfiguration);
23
- inj.logger = $log;
24
- inj.settings.set(settings);
25
- if (adapter) {
26
- inj.addProvider(PlatformAdapter, {
27
- useClass: adapter
28
- });
29
- }
30
- inj.invoke(PlatformAdapter);
31
- inj.alias(PlatformAdapter, "PlatformAdapter");
32
- setLoggerConfiguration(inj);
33
- const instance = inj.get(PlatformAdapter);
34
- instance.providers = [...DEFAULT_PROVIDERS, ...instance.providers];
35
- toMap(instance.providers, "provide").forEach((provider, token) => {
36
- inj.addProvider(token, provider);
37
- });
38
- inj.invoke(PlatformApplication);
39
- return inj;
40
- }
41
- //# sourceMappingURL=createInjector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createInjector.js","sourceRoot":"","sources":["../../../src/utils/createInjector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAgB,sBAAsB,EAAC,MAAM,UAAU,CAAC;AACxE,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAC,qBAAqB,EAAC,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAC,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAEjE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;AAEnB,MAAM,iBAAiB,GAAG;IACxB,EAAC,OAAO,EAAE,eAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,gBAAgB,EAAC;IAC3B,EAAC,OAAO,EAAE,eAAe,EAAC;IAC1B,EAAC,OAAO,EAAE,mBAAmB,EAAC;IAC9B,EAAC,OAAO,EAAE,QAAQ,EAAC;CACpB,CAAC;AAOF,MAAM,UAAU,cAAc,CAAC,EAAC,OAAO,EAAE,QAAQ,GAAG,EAAE,EAAwB;IAC5E,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;IACvB,GAAG,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAEvC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACjD,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE3B,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,WAAW,CAAC,eAAe,EAAE;YAC/B,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC5B,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IAE9C,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAE5B,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAkB,eAAe,CAAE,CAAC;IAE5D,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEnE,KAAK,CAAoB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QAClF,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEhC,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,29 +0,0 @@
1
- import { getHostInfoFromPort } from "@tsed/core";
2
- import { ProviderScope } from "@tsed/di";
3
- import { listenServer } from "./listenServer.js";
4
- export function createServer(injector, { token, type, port, server: get, listen }) {
5
- const { settings } = injector;
6
- const server = port !== false ? get() : null;
7
- injector.addProvider(token, {
8
- scope: ProviderScope.SINGLETON,
9
- useValue: server
10
- });
11
- injector.invoke(token);
12
- if (server) {
13
- const hostInfo = getHostInfoFromPort(type, port);
14
- return async () => {
15
- const url = `${hostInfo.protocol}://${hostInfo.address}:${port}`;
16
- injector.logger.debug(`Start server on ${url}`);
17
- await (listen ? listen(hostInfo) : listenServer(server, hostInfo));
18
- const address = server.address();
19
- if (address && typeof address !== "string") {
20
- hostInfo.address = address.address;
21
- hostInfo.port = address.port;
22
- }
23
- injector.logger.info(`Listen server on ${hostInfo.toString()}`);
24
- settings.set(`${type}Port`, `${hostInfo.address}:${hostInfo.port}`);
25
- return server;
26
- };
27
- }
28
- }
29
- //# sourceMappingURL=createServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createServer.js","sourceRoot":"","sources":["../../../src/utils/createServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AACvE,OAAO,EAAkB,aAAa,EAAgB,MAAM,UAAU,CAAC;AAKvE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAY/C,MAAM,UAAU,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,aAAa,CAAC,SAAS;QAC9B,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvB,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,QAAQ,GAAG,mBAAmB,CAAC,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,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YAEnE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAEjC,IAAI,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAC3C,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;gBACnC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAC/B,CAAC;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;IACJ,CAAC;AACH,CAAC"}
@@ -1,12 +0,0 @@
1
- import { getContext } from "@tsed/di";
2
- export function ensureContext(request, cb, fallback) {
3
- const $ctx = getContext();
4
- if ($ctx) {
5
- return cb($ctx);
6
- }
7
- if (!request?.$ctx && fallback) {
8
- return fallback();
9
- }
10
- return request.$ctx.runInContext(() => cb(request.$ctx));
11
- }
12
- //# sourceMappingURL=ensureContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureContext.js","sourceRoot":"","sources":["../../../src/utils/ensureContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAIpC,MAAM,UAAU,aAAa,CAAC,OAAY,EAAE,EAAkC,EAAE,QAAqB;IACnG,MAAM,IAAI,GAAG,UAAU,EAAmB,CAAC;IAE3C,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC/B,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,32 +0,0 @@
1
- import { Env, Store } from "@tsed/core";
2
- import { mergeMount, ProviderScope, ProviderType } from "@tsed/di";
3
- export function getConfiguration(configuration = {}, module = null) {
4
- if (configuration.$$resolved) {
5
- return configuration;
6
- }
7
- const store = module ? Store.from(module).get("configuration") || {} : {};
8
- const env = configuration.env || store.env || process.env.NODE_ENV || Env.DEV;
9
- return {
10
- $$resolved: true,
11
- env,
12
- httpPort: 8080,
13
- httpsPort: false,
14
- ...store,
15
- ...configuration,
16
- scopes: {
17
- [ProviderType.CONTROLLER]: ProviderScope.SINGLETON,
18
- ...store.scopes,
19
- ...configuration.scopes
20
- },
21
- mount: mergeMount(store.mount, configuration.mount),
22
- logger: {
23
- debug: false,
24
- level: env === Env.TEST ? "off" : "info",
25
- logRequest: true,
26
- ...store.logger,
27
- ...configuration.logger,
28
- jsonIndentation: process.env.NODE_ENV === Env.PROD ? 0 : 2
29
- }
30
- };
31
- }
32
- //# sourceMappingURL=getConfiguration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConfiguration.js","sourceRoot":"","sources":["../../../src/utils/getConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAE,KAAK,EAAO,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAE,aAAa,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAEjE,MAAM,UAAU,gBAAgB,CAAC,gBAAqB,EAAE,EAAE,SAA2B,IAAI;IACvF,IAAI,aAAa,CAAC,UAAU,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,IAAK,OAAO,CAAC,GAAG,CAAC,QAAgB,IAAI,GAAG,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,YAAY,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,SAAS;YAClD,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,aAAa,CAAC,MAAM;SACxB;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE;YACN,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,GAAG,KAAK,GAAG,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,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3D;KACF,CAAC;AACJ,CAAC"}
@@ -1,17 +0,0 @@
1
- import { getValue } from "@tsed/core";
2
- function mapOptions(options) {
3
- const opts = typeof options === "string" ? { root: options } : options;
4
- return {
5
- ...opts,
6
- hook: getValue(opts, "hook", "$afterRoutesInit")
7
- };
8
- }
9
- export function getStaticsOptions(statics) {
10
- return Object.entries(statics || {}).reduce((statics, [path, items]) => {
11
- [].concat(items).forEach((options) => {
12
- statics.push({ path, options: mapOptions(options) });
13
- });
14
- return statics;
15
- }, []);
16
- }
17
- //# sourceMappingURL=getStaticsOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStaticsOptions.js","sourceRoot":"","sources":["../../../src/utils/getStaticsOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC,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,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,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"}
@@ -1,10 +0,0 @@
1
- export function listenServer(server, hostInfo) {
2
- const { address, port } = hostInfo;
3
- const promise = new Promise((resolve, reject) => {
4
- server.on("listening", resolve);
5
- server.on("error", reject);
6
- });
7
- server.listen(port, address);
8
- return promise;
9
- }
10
- //# sourceMappingURL=listenServer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"listenServer.js","sourceRoot":"","sources":["../../../src/utils/listenServer.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,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"}
@@ -1,11 +0,0 @@
1
- /**
2
- * @ignore
3
- */
4
- export function mapReturnedResponse({ use, collection, ...options }) {
5
- return {
6
- ...options,
7
- type: options.type || use,
8
- collectionType: options.collectionType || collection
9
- };
10
- }
11
- //# sourceMappingURL=mapReturnedResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapReturnedResponse.js","sourceRoot":"","sources":["../../../src/utils/mapReturnedResponse.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,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"}
@@ -1,34 +0,0 @@
1
- import { $log, colorize } from "@tsed/logger";
2
- export function printRoutes(routes) {
3
- const mapColor = {
4
- GET: "green",
5
- POST: "yellow",
6
- PUT: "blue",
7
- DELETE: "red",
8
- PATCH: "magenta",
9
- ALL: "cyan",
10
- STATICS: "white"
11
- };
12
- const list = routes.map((route) => {
13
- const method = route.method.toUpperCase();
14
- return {
15
- ...route,
16
- method: {
17
- length: method.length,
18
- toString: () => {
19
- return colorize(method, mapColor[method]);
20
- }
21
- }
22
- };
23
- });
24
- const str = $log.drawTable(list, {
25
- padding: 1,
26
- header: {
27
- method: "Method",
28
- url: "Endpoint",
29
- name: "Class method"
30
- }
31
- });
32
- return "\n" + str.trim();
33
- }
34
- //# sourceMappingURL=printRoutes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printRoutes.js","sourceRoot":"","sources":["../../../src/utils/printRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,UAAU,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,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC5C,CAAC;aACF;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,IAAI,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"}
@@ -1,7 +0,0 @@
1
- import { PlatformBuilder } from "../builder/PlatformBuilder.js";
2
- import { PlatformTest } from "../services/PlatformTest.js";
3
- export function registerPlatformAdapter(adapter) {
4
- PlatformTest.adapter = adapter;
5
- PlatformBuilder.adapter = adapter;
6
- }
7
- //# sourceMappingURL=registerPlatformAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registerPlatformAdapter.js","sourceRoot":"","sources":["../../../src/utils/registerPlatformAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAEzD,MAAM,UAAU,uBAAuB,CAAC,OAAmC;IACzE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;IAC/B,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;AACpC,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * @ignore
3
- */
4
- export function setResponseHeaders(ctx) {
5
- const { response, endpoint } = ctx;
6
- const { operation } = endpoint;
7
- if (ctx.isDone()) {
8
- return;
9
- }
10
- if (!response.hasStatus()) {
11
- // apply status only if the isn't already modified
12
- response.status(operation.getStatus());
13
- }
14
- const statusCode = response.statusCode;
15
- const headers = operation.getHeadersOf(statusCode);
16
- Object.entries(headers).forEach(([key, item]) => {
17
- if (!response.get(key) && item.example !== undefined) {
18
- response.setHeader(key, String(item.example));
19
- }
20
- });
21
- if (operation.isRedirection(statusCode)) {
22
- response.redirect(statusCode, response.get("location"));
23
- }
24
- }
25
- //# sourceMappingURL=setResponseHeaders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setResponseHeaders.js","sourceRoot":"","sources":["../../../src/utils/setResponseHeaders.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAoB;IACrD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;QAC1B,kDAAkD;QAClD,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;IACzC,CAAC;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,CAAC;YACrD,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
@@ -1,100 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
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
- }
@@ -1,67 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { getHostInfoFromPort } from "@tsed/core";
3
- import { DIConfiguration, TokenProvider } from "@tsed/di";
4
- import Https from "https";
5
- import { PlatformJsonMapperSettings } from "../interfaces/PlatformJsonMapperSettings.js";
6
- /**
7
- * `PlatformConfiguration` contains all information about your Server configuration.
8
- */
9
- export declare class PlatformConfiguration extends DIConfiguration {
10
- constructor();
11
- get port(): string | number | false;
12
- set port(value: string | number | false);
13
- get httpsOptions(): Https.ServerOptions;
14
- set httpsOptions(value: Https.ServerOptions);
15
- get httpPort(): string | number | false;
16
- set httpPort(value: string | number | false);
17
- get httpsPort(): string | number | false;
18
- set httpsPort(value: string | number | false);
19
- get mount(): Record<string, TokenProvider[]>;
20
- set mount(value: Record<string, TokenProvider[]>);
21
- get statics(): Record<string, (any | string)[]>;
22
- set statics(value: Record<string, (any | string)[]>);
23
- get acceptMimes(): string[];
24
- set acceptMimes(value: string[]);
25
- get jsonMapper(): Partial<PlatformJsonMapperSettings>;
26
- set jsonMapper(options: Partial<PlatformJsonMapperSettings>);
27
- get additionalProperties(): boolean;
28
- /**
29
- *
30
- * @returns {string|number}
31
- */
32
- getHttpPort(): ReturnType<typeof getHostInfoFromPort>;
33
- /**
34
- *
35
- * @param settings
36
- */
37
- setHttpPort(settings: {
38
- address: string;
39
- port: number;
40
- }): void;
41
- /**
42
- *
43
- * @returns {string|number}
44
- */
45
- getHttpsPort(): {
46
- protocol: string;
47
- address: string;
48
- port: number;
49
- toString(): string;
50
- };
51
- /**
52
- *
53
- * @param settings
54
- */
55
- setHttpsPort(settings: {
56
- address: string;
57
- port: number;
58
- }): void;
59
- getBestHost(): {
60
- protocol: string;
61
- address: string;
62
- port: number;
63
- toString(): string;
64
- } | {
65
- toString(): string;
66
- };
67
- }
@@ -1 +0,0 @@
1
- export declare const ROUTER_OPTIONS: unique symbol;
@@ -1,3 +0,0 @@
1
- import { Type } from "@tsed/core";
2
- import { PlatformAdapter } from "../services/PlatformAdapter.js";
3
- export declare function PlatformProvider(): (klass: Type<PlatformAdapter>) => void;
@@ -1,27 +0,0 @@
1
- /**
2
- * Define file size limit.
3
- *
4
- * ```typescript
5
- * import {Post} from "@tsed/schema";
6
- * import {Controller, MulterOptions, MultipartFile} from "@tsed/common";
7
- * import {Multer} from "@types/multer";
8
- *
9
- * type MulterFile = Express.Multer.File;
10
- *
11
- * @Controller('/')
12
- * class MyCtrl {
13
- * @Post('/file2')
14
- * @MulterFileSize(1024) // (Ko). Applied for all fields
15
- * private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
16
- *
17
- * }
18
- * }
19
- * ```
20
- *
21
- * > See the tutorial on the [multer configuration](/tutorials/multer.md).
22
- * @param fileSize
23
- * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
24
- * @decorator
25
- * @multer
26
- */
27
- export declare function MulterFileSize(fileSize: number): MethodDecorator;
@@ -1,42 +0,0 @@
1
- import { PlatformMulterSettings } from "../../config/interfaces/PlatformMulterSettings.js";
2
- /**
3
- * Define multer option for all MultipartFile
4
- *
5
- * ```typescript
6
- * import {Controller, PlatformMulterFile, MultipartFile, MulterOptions} from "@tsed/common";
7
- * import {Post} from "@tsed/schema";
8
- *
9
- * @Controller('/')
10
- * class MyCtrl {
11
- * @Post('/file')
12
- * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
13
- *
14
- * }
15
- *
16
- * @Post('/file')
17
- * @MulterOptions({dest: "/other-dir"})
18
- * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile) {
19
- *
20
- * }
21
- *
22
- * @Post('/file2')
23
- * @MulterOptions({dest: "/other-dir"})
24
- * private uploadFile(@MultipartFile("file1") file: PlatformMulterFile, @MultipartFile("file2") file2: PlatformMulterFile) {
25
- *
26
- * }
27
- *
28
- * @Post('/files')
29
- * private uploadFile(@MultipartFile("file1") files: PlatformMulterFile[]) {
30
- *
31
- * }
32
- * }
33
- * ```
34
- *
35
- * See the tutorial on the [multer configuration](/tutorials/multer.md).
36
- *
37
- * @param {multer.Options} options
38
- * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor}
39
- * @decorator
40
- * @multer
41
- */
42
- export declare function MulterOptions(options: PlatformMulterSettings): MethodDecorator;
@@ -1,47 +0,0 @@
1
- import { PlatformMulterFile } from "../../config/interfaces/PlatformMulterSettings.js";
2
- /**
3
- * Define a parameter as Multipart file.
4
- *
5
- * ```typescript
6
- * import {Post} from "@tsed/schema";
7
- * import {Controller, MulterOptions, MultipartFile} from "@tsed/common";
8
- * import {Multer} from "@types/multer";
9
- *
10
- * type MulterFile = Express.Multer.File;
11
- *
12
- * @Controller('/')
13
- * class MyCtrl {
14
- * @Post('/file')
15
- * private uploadFile(@MultipartFile("file1") file: MulterFile) {
16
- *
17
- * }
18
- *
19
- * @Post('/file')
20
- * @MulterOptions({dest: "/other-dir"})
21
- * private uploadFile(@MultipartFile("file1") file: MulterFile) {
22
- *
23
- * }
24
- *
25
- * @Post('/file2')
26
- * @MulterOptions({dest: "/other-dir"})
27
- * private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
28
- *
29
- * }
30
- *
31
- * @Post('/files')
32
- * private uploadFile(@MultipartFile("file1") files: MulterFile[]) {
33
- *
34
- * }
35
- * }
36
- * ```
37
- *
38
- * > See the tutorial on the [multer configuration](/tutorials/multer.md).
39
- *
40
- * @param name
41
- * @param maxCount
42
- * @returns Function
43
- * @decorator
44
- * @input
45
- */
46
- export declare function MultipartFile(name: string, maxCount?: number): ParameterDecorator;
47
- export type MultipartFile = PlatformMulterFile;