@asenajs/asena 0.1.18 → 0.2.0

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 (260) hide show
  1. package/README.md +90 -147
  2. package/dist/index.d.ts +0 -9
  3. package/dist/index.js +0 -9
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/adapter/AsenaAdapter.d.ts +46 -54
  6. package/dist/lib/adapter/AsenaAdapter.js +22 -11
  7. package/dist/lib/adapter/AsenaAdapter.js.map +1 -1
  8. package/dist/lib/adapter/AsenaContext.d.ts +67 -57
  9. package/dist/lib/adapter/AsenaWebsocketAdapter.d.ts +57 -34
  10. package/dist/lib/adapter/AsenaWebsocketAdapter.js +43 -12
  11. package/dist/lib/adapter/AsenaWebsocketAdapter.js.map +1 -1
  12. package/dist/lib/adapter/index.d.ts +1 -0
  13. package/dist/lib/adapter/index.js +1 -0
  14. package/dist/lib/adapter/index.js.map +1 -1
  15. package/dist/lib/adapter/types/ApiParams.d.ts +73 -0
  16. package/dist/lib/adapter/types/ApiParams.js +2 -0
  17. package/dist/lib/adapter/types/ApiParams.js.map +1 -0
  18. package/dist/lib/adapter/types/AsenaHandler.d.ts +2 -0
  19. package/dist/lib/adapter/types/AsenaHandler.js +2 -0
  20. package/dist/lib/adapter/types/AsenaHandler.js.map +1 -0
  21. package/dist/lib/adapter/types/AsenaMiddlewareHandler.d.ts +2 -0
  22. package/dist/lib/adapter/types/AsenaMiddlewareHandler.js +2 -0
  23. package/dist/lib/adapter/types/AsenaMiddlewareHandler.js.map +1 -0
  24. package/dist/lib/adapter/types/BaseMiddleware.d.ts +57 -0
  25. package/dist/lib/adapter/types/BaseMiddleware.js +2 -0
  26. package/dist/lib/adapter/types/BaseMiddleware.js.map +1 -0
  27. package/dist/lib/adapter/types/ErrorHandler.d.ts +2 -0
  28. package/dist/lib/adapter/types/ErrorHandler.js +2 -0
  29. package/dist/lib/adapter/types/ErrorHandler.js.map +1 -0
  30. package/dist/lib/adapter/types/RouteParams.d.ts +8 -5
  31. package/dist/lib/adapter/types/ServeOptions.d.ts +7 -0
  32. package/dist/lib/adapter/types/ServeOptions.js +2 -0
  33. package/dist/lib/adapter/types/ServeOptions.js.map +1 -0
  34. package/dist/lib/adapter/types/WebSocketRegistry.d.ts +5 -4
  35. package/dist/lib/adapter/types/WebsocketAdapterParams.d.ts +1 -1
  36. package/dist/lib/adapter/types/index.d.ts +6 -0
  37. package/dist/lib/adapter/types/index.js +6 -0
  38. package/dist/lib/adapter/types/index.js.map +1 -1
  39. package/dist/lib/ioc/Container.d.ts +8 -3
  40. package/dist/lib/ioc/Container.js +100 -76
  41. package/dist/lib/ioc/Container.js.map +1 -1
  42. package/dist/lib/ioc/IocEngine.d.ts +2 -2
  43. package/dist/lib/ioc/IocEngine.js +28 -16
  44. package/dist/lib/ioc/IocEngine.js.map +1 -1
  45. package/dist/lib/ioc/component/componentUtils.d.ts +1 -1
  46. package/dist/lib/ioc/component/componentUtils.js +16 -12
  47. package/dist/lib/ioc/component/componentUtils.js.map +1 -1
  48. package/dist/lib/{server/decorators/components → ioc/component/decorators}/Component.d.ts +1 -1
  49. package/dist/lib/{server/decorators/components → ioc/component/decorators}/Component.js +2 -2
  50. package/dist/lib/ioc/component/decorators/Component.js.map +1 -0
  51. package/dist/lib/ioc/component/decorators/Implements.js +2 -2
  52. package/dist/lib/ioc/component/decorators/Implements.js.map +1 -1
  53. package/dist/lib/ioc/component/decorators/Inject.d.ts +1 -1
  54. package/dist/lib/ioc/component/decorators/Inject.js +6 -7
  55. package/dist/lib/ioc/component/decorators/Inject.js.map +1 -1
  56. package/dist/lib/ioc/component/decorators/PostConstruct.d.ts +6 -0
  57. package/dist/lib/ioc/component/decorators/PostConstruct.js +17 -0
  58. package/dist/lib/ioc/component/decorators/PostConstruct.js.map +1 -0
  59. package/dist/lib/ioc/component/decorators/Strategy.js +6 -6
  60. package/dist/lib/ioc/component/decorators/Strategy.js.map +1 -1
  61. package/dist/lib/ioc/component/decorators/index.d.ts +1 -0
  62. package/dist/lib/ioc/component/decorators/index.js +1 -0
  63. package/dist/lib/ioc/component/decorators/index.js.map +1 -1
  64. package/dist/lib/ioc/component/index.d.ts +1 -0
  65. package/dist/lib/ioc/component/index.js +2 -0
  66. package/dist/lib/ioc/component/index.js.map +1 -0
  67. package/dist/lib/ioc/constants/ComponentConstants.d.ts +4 -2
  68. package/dist/lib/ioc/constants/ComponentConstants.js +3 -1
  69. package/dist/lib/ioc/constants/ComponentConstants.js.map +1 -1
  70. package/dist/lib/ioc/helper/fileHelper.d.ts +1 -1
  71. package/dist/lib/ioc/helper/fileHelper.js +9 -3
  72. package/dist/lib/ioc/helper/fileHelper.js.map +1 -1
  73. package/dist/lib/ioc/helper/iocHelper.d.ts +2 -3
  74. package/dist/lib/ioc/helper/iocHelper.js +4 -2
  75. package/dist/lib/ioc/helper/iocHelper.js.map +1 -1
  76. package/dist/lib/ioc/types/{Component.d.ts → InjectableComponent.d.ts} +4 -4
  77. package/dist/lib/ioc/types/InjectableComponent.js +2 -0
  78. package/dist/lib/ioc/types/InjectableComponent.js.map +1 -0
  79. package/dist/lib/ioc/types/IocConfig.d.ts +1 -0
  80. package/dist/lib/ioc/types/decorators/ComponentParams.d.ts +1 -1
  81. package/dist/lib/ioc/types/decorators/ComponentType.d.ts +2 -2
  82. package/dist/lib/ioc/types/decorators/ComponentType.js +1 -1
  83. package/dist/lib/ioc/types/decorators/ComponentType.js.map +1 -1
  84. package/dist/lib/ioc/types/decorators/ControllerParams.d.ts +4 -3
  85. package/dist/lib/ioc/types/decorators/MiddlewareParams.d.ts +1 -1
  86. package/dist/lib/ioc/types/index.d.ts +1 -1
  87. package/dist/lib/ioc/types/index.js +1 -1
  88. package/dist/lib/ioc/types/index.js.map +1 -1
  89. package/dist/lib/{services/logger → logger}/DefaultLogger.d.ts +1 -1
  90. package/dist/lib/logger/DefaultLogger.js.map +1 -0
  91. package/dist/lib/{services/types → logger}/Logger.js.map +1 -1
  92. package/dist/lib/logger/index.d.ts +2 -0
  93. package/dist/lib/logger/index.js +3 -0
  94. package/dist/lib/logger/index.js.map +1 -0
  95. package/dist/lib/server/AsenaServer.d.ts +15 -14
  96. package/dist/lib/server/AsenaServer.js +125 -113
  97. package/dist/lib/server/AsenaServer.js.map +1 -1
  98. package/dist/lib/server/config/AsenaConfig.d.ts +43 -0
  99. package/dist/lib/server/config/AsenaConfig.js +2 -0
  100. package/dist/lib/server/config/AsenaConfig.js.map +1 -0
  101. package/dist/lib/server/config/index.d.ts +1 -0
  102. package/dist/lib/server/config/index.js +2 -0
  103. package/dist/lib/server/config/index.js.map +1 -0
  104. package/dist/lib/server/decorators/Override.d.ts +4 -4
  105. package/dist/lib/server/decorators/Override.js +11 -7
  106. package/dist/lib/server/decorators/Override.js.map +1 -1
  107. package/dist/lib/server/decorators/components/Config.d.ts +10 -0
  108. package/dist/lib/server/decorators/components/Config.js +14 -0
  109. package/dist/lib/server/decorators/components/Config.js.map +1 -0
  110. package/dist/lib/server/decorators/components/Controller.js +4 -4
  111. package/dist/lib/server/decorators/components/Controller.js.map +1 -1
  112. package/dist/lib/server/decorators/components/Middleware.d.ts +1 -1
  113. package/dist/lib/server/decorators/components/Middleware.js +19 -9
  114. package/dist/lib/server/decorators/components/Middleware.js.map +1 -1
  115. package/dist/lib/server/decorators/components/Schedule.d.ts +2 -2
  116. package/dist/lib/server/decorators/components/Schedule.js +7 -7
  117. package/dist/lib/server/decorators/components/Schedule.js.map +1 -1
  118. package/dist/lib/server/decorators/components/Service.d.ts +1 -1
  119. package/dist/lib/server/decorators/components/Service.js +2 -2
  120. package/dist/lib/server/decorators/components/Service.js.map +1 -1
  121. package/dist/lib/server/decorators/components/WebSocket.js +4 -4
  122. package/dist/lib/server/decorators/components/WebSocket.js.map +1 -1
  123. package/dist/lib/server/decorators/components/index.d.ts +1 -2
  124. package/dist/lib/server/decorators/components/index.js +1 -2
  125. package/dist/lib/server/decorators/components/index.js.map +1 -1
  126. package/dist/lib/server/decorators/index.d.ts +2 -1
  127. package/dist/lib/server/decorators/index.js +2 -1
  128. package/dist/lib/server/decorators/index.js.map +1 -1
  129. package/dist/lib/server/types/Class.d.ts +0 -3
  130. package/dist/lib/server/types/index.d.ts +2 -2
  131. package/dist/lib/server/types/index.js +2 -2
  132. package/dist/lib/server/types/index.js.map +1 -1
  133. package/dist/lib/server/web/decorators/http.base.d.ts +4 -0
  134. package/dist/lib/server/web/decorators/http.base.js +35 -0
  135. package/dist/lib/server/web/decorators/http.base.js.map +1 -0
  136. package/dist/lib/server/web/decorators/index.d.ts +4 -0
  137. package/dist/lib/server/web/decorators/index.js +5 -0
  138. package/dist/lib/server/web/decorators/index.js.map +1 -0
  139. package/dist/lib/server/web/decorators/methods/Connect.d.ts +7 -0
  140. package/dist/lib/server/web/decorators/methods/Connect.js +12 -0
  141. package/dist/lib/server/web/decorators/methods/Connect.js.map +1 -0
  142. package/dist/lib/server/web/decorators/methods/Delete.d.ts +7 -0
  143. package/dist/lib/server/web/decorators/methods/Delete.js +12 -0
  144. package/dist/lib/server/web/decorators/methods/Delete.js.map +1 -0
  145. package/dist/lib/server/web/decorators/methods/Get.d.ts +7 -0
  146. package/dist/lib/server/web/decorators/methods/Get.js +12 -0
  147. package/dist/lib/server/web/decorators/methods/Get.js.map +1 -0
  148. package/dist/lib/server/web/decorators/methods/Head.d.ts +7 -0
  149. package/dist/lib/server/web/decorators/methods/Head.js +12 -0
  150. package/dist/lib/server/web/decorators/methods/Head.js.map +1 -0
  151. package/dist/lib/server/web/decorators/methods/Options.d.ts +7 -0
  152. package/dist/lib/server/web/decorators/methods/Options.js +12 -0
  153. package/dist/lib/server/web/decorators/methods/Options.js.map +1 -0
  154. package/dist/lib/server/web/decorators/methods/Patch.d.ts +7 -0
  155. package/dist/lib/server/web/decorators/methods/Patch.js +12 -0
  156. package/dist/lib/server/web/decorators/methods/Patch.js.map +1 -0
  157. package/dist/lib/server/web/decorators/methods/Post.d.ts +7 -0
  158. package/dist/lib/server/web/decorators/methods/Post.js +12 -0
  159. package/dist/lib/server/web/decorators/methods/Post.js.map +1 -0
  160. package/dist/lib/server/web/decorators/methods/Put.d.ts +7 -0
  161. package/dist/lib/server/web/decorators/methods/Put.js +12 -0
  162. package/dist/lib/server/web/decorators/methods/Put.js.map +1 -0
  163. package/dist/lib/server/web/decorators/methods/Trace.d.ts +7 -0
  164. package/dist/lib/server/web/decorators/methods/Trace.js +12 -0
  165. package/dist/lib/server/web/decorators/methods/Trace.js.map +1 -0
  166. package/dist/lib/server/web/decorators/methods/index.d.ts +9 -0
  167. package/dist/lib/server/web/decorators/methods/index.js +10 -0
  168. package/dist/lib/server/web/decorators/methods/index.js.map +1 -0
  169. package/dist/lib/server/web/helper/middlewareHelper.d.ts +8 -2
  170. package/dist/lib/server/web/helper/middlewareHelper.js +11 -5
  171. package/dist/lib/server/web/helper/middlewareHelper.js.map +1 -1
  172. package/dist/lib/server/web/middleware/AsenaMiddlewareService.d.ts +8 -10
  173. package/dist/lib/server/web/middleware/AsenaMiddlewareService.js +1 -4
  174. package/dist/lib/server/web/middleware/AsenaMiddlewareService.js.map +1 -1
  175. package/dist/lib/server/web/middleware/AsenaValidationService.d.ts +15 -16
  176. package/dist/lib/server/web/middleware/AsenaValidationService.js +1 -8
  177. package/dist/lib/server/web/middleware/AsenaValidationService.js.map +1 -1
  178. package/dist/lib/server/web/types/HttpMethod.js.map +1 -0
  179. package/dist/lib/server/web/types/HttpStatus.d.ts +79 -0
  180. package/dist/lib/server/web/types/HttpStatus.js +85 -0
  181. package/dist/lib/server/web/types/HttpStatus.js.map +1 -0
  182. package/dist/lib/server/web/types/index.d.ts +2 -2
  183. package/dist/lib/server/web/types/index.js +2 -2
  184. package/dist/lib/server/web/types/index.js.map +1 -1
  185. package/dist/lib/server/web/websocket/AsenaSocket.d.ts +1 -0
  186. package/dist/lib/server/web/websocket/AsenaSocket.js +4 -0
  187. package/dist/lib/server/web/websocket/AsenaSocket.js.map +1 -1
  188. package/dist/lib/server/web/websocket/AsenaWebSocketServer.d.ts +39 -0
  189. package/dist/lib/server/web/websocket/AsenaWebSocketServer.js +41 -1
  190. package/dist/lib/server/web/websocket/AsenaWebSocketServer.js.map +1 -1
  191. package/dist/lib/server/web/websocket/AsenaWebSocketService.js +4 -4
  192. package/dist/lib/server/web/websocket/AsenaWebSocketService.js.map +1 -1
  193. package/dist/lib/server/web/websocket/index.d.ts +1 -0
  194. package/dist/lib/server/web/websocket/index.js +1 -0
  195. package/dist/lib/server/web/websocket/index.js.map +1 -1
  196. package/dist/lib/utils/typedMetadata.d.ts +3 -0
  197. package/dist/lib/utils/typedMetadata.js +16 -0
  198. package/dist/lib/utils/typedMetadata.js.map +1 -0
  199. package/package.json +55 -6
  200. package/dist/lib/adapter/defaultAdapter/DefaultAdapter.d.ts +0 -26
  201. package/dist/lib/adapter/defaultAdapter/DefaultAdapter.js +0 -92
  202. package/dist/lib/adapter/defaultAdapter/DefaultAdapter.js.map +0 -1
  203. package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.d.ts +0 -32
  204. package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.js +0 -97
  205. package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.js.map +0 -1
  206. package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.d.ts +0 -15
  207. package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.js +0 -77
  208. package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.js.map +0 -1
  209. package/dist/lib/adapter/defaultAdapter/index.d.ts +0 -3
  210. package/dist/lib/adapter/defaultAdapter/index.js +0 -4
  211. package/dist/lib/adapter/defaultAdapter/index.js.map +0 -1
  212. package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.d.ts +0 -3
  213. package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.js +0 -2
  214. package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.js.map +0 -1
  215. package/dist/lib/adapter/defaultAdapter/types/Handler.d.ts +0 -4
  216. package/dist/lib/adapter/defaultAdapter/types/Handler.js +0 -2
  217. package/dist/lib/adapter/defaultAdapter/types/Handler.js.map +0 -1
  218. package/dist/lib/adapter/defaultAdapter/types/index.d.ts +0 -2
  219. package/dist/lib/adapter/defaultAdapter/types/index.js +0 -3
  220. package/dist/lib/adapter/defaultAdapter/types/index.js.map +0 -1
  221. package/dist/lib/ioc/types/Component.js +0 -2
  222. package/dist/lib/ioc/types/Component.js.map +0 -1
  223. package/dist/lib/server/decorators/components/Component.js.map +0 -1
  224. package/dist/lib/server/decorators/components/ServerService.d.ts +0 -9
  225. package/dist/lib/server/decorators/components/ServerService.js +0 -13
  226. package/dist/lib/server/decorators/components/ServerService.js.map +0 -1
  227. package/dist/lib/server/web/api/apiHandler.d.ts +0 -55
  228. package/dist/lib/server/web/api/apiHandler.js +0 -107
  229. package/dist/lib/server/web/api/apiHandler.js.map +0 -1
  230. package/dist/lib/server/web/api/index.d.ts +0 -1
  231. package/dist/lib/server/web/api/index.js +0 -2
  232. package/dist/lib/server/web/api/index.js.map +0 -1
  233. package/dist/lib/server/web/http/HttpMethod.js.map +0 -1
  234. package/dist/lib/server/web/http/HttpStatus.d.ts +0 -77
  235. package/dist/lib/server/web/http/HttpStatus.js +0 -84
  236. package/dist/lib/server/web/http/HttpStatus.js.map +0 -1
  237. package/dist/lib/server/web/http/index.d.ts +0 -2
  238. package/dist/lib/server/web/http/index.js +0 -3
  239. package/dist/lib/server/web/http/index.js.map +0 -1
  240. package/dist/lib/server/web/types/ApiHandler.d.ts +0 -22
  241. package/dist/lib/server/web/types/ApiHandler.js +0 -2
  242. package/dist/lib/server/web/types/ApiHandler.js.map +0 -1
  243. package/dist/lib/server/web/types/BaseMiddleware.d.ts +0 -12
  244. package/dist/lib/server/web/types/BaseMiddleware.js +0 -2
  245. package/dist/lib/server/web/types/BaseMiddleware.js.map +0 -1
  246. package/dist/lib/services/index.d.ts +0 -3
  247. package/dist/lib/services/index.js +0 -4
  248. package/dist/lib/services/index.js.map +0 -1
  249. package/dist/lib/services/logger/DefaultLogger.js.map +0 -1
  250. package/dist/lib/services/serverService/AsenaService.d.ts +0 -7
  251. package/dist/lib/services/serverService/AsenaService.js +0 -7
  252. package/dist/lib/services/serverService/AsenaService.js.map +0 -1
  253. package/dist/lib/services/types/index.d.ts +0 -2
  254. package/dist/lib/services/types/index.js +0 -3
  255. package/dist/lib/services/types/index.js.map +0 -1
  256. /package/dist/lib/{services/logger → logger}/DefaultLogger.js +0 -0
  257. /package/dist/lib/{services/types → logger}/Logger.d.ts +0 -0
  258. /package/dist/lib/{services/types → logger}/Logger.js +0 -0
  259. /package/dist/lib/server/web/{http → types}/HttpMethod.d.ts +0 -0
  260. /package/dist/lib/server/web/{http → types}/HttpMethod.js +0 -0
@@ -1,5 +1,5 @@
1
- import { ComponentType } from "../../../ioc/types";
2
- import { defineComponent } from "../../../ioc/component/componentUtils";
1
+ import { ComponentType } from '../../types';
2
+ import { defineComponent } from '../componentUtils';
3
3
  /**
4
4
  * Decorator for defining a generic Component.
5
5
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Component.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/Component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,aAAa,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAiC,EAAkB,EAAE;IAC7E,OAAO,eAAe,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { defineMetadata } from 'reflect-metadata/no-conflict';
2
1
  import { ComponentConstants } from '../../constants';
2
+ import { defineTypedMetadata } from '../../../utils/typedMetadata';
3
3
  /**
4
4
  * A class decorator that adds metadata to the target class.
5
5
  *
@@ -8,7 +8,7 @@ import { ComponentConstants } from '../../constants';
8
8
  */
9
9
  export function Implements(implement) {
10
10
  return (target) => {
11
- defineMetadata(ComponentConstants.InterfaceKey, implement, target);
11
+ defineTypedMetadata(ComponentConstants.InterfaceKey, implement, target);
12
12
  };
13
13
  }
14
14
  //# sourceMappingURL=Implements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Implements.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/Implements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,cAAc,CAAC,kBAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Implements.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/Implements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,mBAAmB,CAAS,kBAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC"}
@@ -6,4 +6,4 @@ import type { Class } from '../../../server/types';
6
6
  * @param expression - The expression to evaluate on the injected class.
7
7
  * @returns {PropertyDecorator} - The property decorator function.
8
8
  */
9
- export declare const Inject: (Injection: Class, expression?: (injectedClass: any) => any) => PropertyDecorator;
9
+ export declare const Inject: (Injection: Class | string, expression?: (injectedClass: any) => any) => PropertyDecorator;
@@ -1,5 +1,5 @@
1
- import { defineMetadata, getMetadata } from 'reflect-metadata/no-conflict';
2
1
  import { ComponentConstants } from '../../constants';
2
+ import { defineTypedMetadata, getOwnTypedMetadata } from '../../../utils/typedMetadata';
3
3
  /**
4
4
  * Property decorator to inject a dependency.
5
5
  *
@@ -9,18 +9,17 @@ import { ComponentConstants } from '../../constants';
9
9
  */
10
10
  export const Inject = (Injection, expression) => {
11
11
  return (target, propertyKey) => {
12
- const dependencies = getMetadata(ComponentConstants.DependencyKey, target.constructor) || {};
13
- defineMetadata('design:type', Injection, target, propertyKey);
12
+ const dependencies = getOwnTypedMetadata(ComponentConstants.DependencyKey, target.constructor) || {};
14
13
  if (!dependencies[propertyKey]) {
15
- dependencies[propertyKey] = Injection;
14
+ dependencies[propertyKey] = typeof Injection === 'string' ? Injection : Injection.name;
16
15
  }
17
- defineMetadata(ComponentConstants.DependencyKey, dependencies, target.constructor);
16
+ defineTypedMetadata(ComponentConstants.DependencyKey, dependencies, target.constructor);
18
17
  if (expression) {
19
- const expressions = getMetadata(ComponentConstants.ExpressionKey, target.constructor) || {};
18
+ const expressions = getOwnTypedMetadata(ComponentConstants.ExpressionKey, target.constructor) || {};
20
19
  if (!expressions[propertyKey]) {
21
20
  expressions[propertyKey] = expression;
22
21
  }
23
- defineMetadata(ComponentConstants.ExpressionKey, expressions, target.constructor);
22
+ defineTypedMetadata(ComponentConstants.ExpressionKey, expressions, target.constructor);
24
23
  }
25
24
  };
26
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Inject.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/Inject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAgB,EAAE,UAAuC,EAAqB,EAAE;IACrG,OAAO,CAAC,MAAc,EAAE,WAAmB,EAAO,EAAE;QAClD,MAAM,YAAY,GAAe,WAA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CAAC,EAAE,CAAC;YAC/B,YAAY,CAAC,WAAW,CAAC,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;QACzF,CAAC;QAED,mBAAmB,CAAe,kBAAkB,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAEtG,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,WAAW,GACf,mBAAmB,CAAc,kBAAkB,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAE/F,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC9B,WAAW,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;YACxC,CAAC;YAED,mBAAmB,CAAc,kBAAkB,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A decorator that marks a method to be called after the component's construction.
3
+ *
4
+ * @returns {PropertyDecorator} The property decorator function.
5
+ */
6
+ export declare const PostConstruct: () => PropertyDecorator;
@@ -0,0 +1,17 @@
1
+ import { ComponentConstants } from '../../constants';
2
+ import { defineTypedMetadata, getOwnTypedMetadata } from '../../../utils/typedMetadata';
3
+ /**
4
+ * A decorator that marks a method to be called after the component's construction.
5
+ *
6
+ * @returns {PropertyDecorator} The property decorator function.
7
+ */
8
+ export const PostConstruct = () => {
9
+ return (target, propertyKey) => {
10
+ const postConstructs = getOwnTypedMetadata(ComponentConstants.PostConstructKey, target.constructor) || [];
11
+ if (!postConstructs.includes(propertyKey)) {
12
+ postConstructs.push(propertyKey);
13
+ }
14
+ defineTypedMetadata(ComponentConstants.PostConstructKey, postConstructs, target.constructor);
15
+ };
16
+ };
17
+ //# sourceMappingURL=PostConstruct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PostConstruct.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/PostConstruct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAsB,EAAE;IACnD,OAAO,CAAC,MAAc,EAAE,WAAmB,EAAQ,EAAE;QACnD,MAAM,cAAc,GAClB,mBAAmB,CAAW,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAE/F,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1C,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC;QAED,mBAAmB,CAAW,kBAAkB,CAAC,gBAAgB,EAAE,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACzG,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { defineMetadata, getMetadata } from 'reflect-metadata/no-conflict';
2
1
  import { ComponentConstants } from '../../constants';
2
+ import { defineTypedMetadata, getOwnTypedMetadata } from '../../../utils/typedMetadata';
3
3
  /**
4
4
  * Property decorator to define a strategy.
5
5
  *
@@ -9,20 +9,20 @@ import { ComponentConstants } from '../../constants';
9
9
  */
10
10
  export const Strategy = (Injection, expression) => {
11
11
  return (target, propertyKey) => {
12
- const strategies = getMetadata(ComponentConstants.StrategyKey, target.constructor) || {};
13
- defineMetadata('design:type', Injection, target, propertyKey);
12
+ const strategies = getOwnTypedMetadata(ComponentConstants.StrategyKey, target.constructor) || {};
13
+ defineTypedMetadata('design:type', Injection, target.constructor, propertyKey);
14
14
  const injectionName = typeof Injection === 'string' ? Injection : Injection.name;
15
15
  if (!strategies[propertyKey]) {
16
16
  strategies[propertyKey] = injectionName;
17
17
  }
18
18
  if (expression) {
19
- const expressions = getMetadata(ComponentConstants.ExpressionKey, target.constructor) || {};
19
+ const expressions = getOwnTypedMetadata(ComponentConstants.ExpressionKey, target.constructor) || {};
20
20
  if (!expressions[propertyKey]) {
21
21
  expressions[propertyKey] = expression;
22
22
  }
23
- defineMetadata(ComponentConstants.ExpressionKey, expressions, target.constructor);
23
+ defineTypedMetadata(ComponentConstants.ExpressionKey, expressions, target.constructor);
24
24
  }
25
- defineMetadata(ComponentConstants.StrategyKey, strategies, target.constructor);
25
+ defineTypedMetadata(ComponentConstants.StrategyKey, strategies, target.constructor);
26
26
  };
27
27
  };
28
28
  //# sourceMappingURL=Strategy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Strategy.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/Strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,SAAyB,EAAE,UAAmC,EAAqB,EAAE;IAC5G,OAAO,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE;QAC7C,MAAM,UAAU,GAAe,WAAW,CAAC,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAErG,cAAc,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC;QAEjF,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7B,UAAU,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC;QAC1C,CAAC;QAED,IAAI,UAAU,E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AC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,WAAW,GAAgB,mBAAmB,CAAc,kBAAkB,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAE9H,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC9B,WAAW,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;YACxC,CAAC;YAED,mBAAmB,CAAc,kBAAkB,CAAC,aAAa,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACtG,CAAC;QAED,mBAAmB,CAAa,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAClG,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -2,3 +2,4 @@ export * from './Inject';
2
2
  export * from './Implements';
3
3
  export * from '../componentUtils';
4
4
  export * from './Strategy';
5
+ export * from './PostConstruct';
@@ -2,4 +2,5 @@ export * from './Inject';
2
2
  export * from './Implements';
3
3
  export * from '../componentUtils';
4
4
  export * from './Strategy';
5
+ export * from './PostConstruct';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/ioc/component/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './decorators';
@@ -0,0 +1,2 @@
1
+ export * from './decorators';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/ioc/component/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -4,15 +4,17 @@
4
4
  export declare enum ComponentConstants {
5
5
  RouteKey = "_routeKey",
6
6
  DependencyKey = "_IDependencies",
7
+ SoftDependencyKey = "_ISoftDependencies",
8
+ PostConstructKey = "_IPostConstruct",
7
9
  ScopeKey = "_IScope",
8
10
  NameKey = "_IName",
9
11
  StrategyKey = "_IStrategy",
10
12
  InterfaceKey = "_Interface",
11
13
  PathKey = "_IPath",
12
14
  MiddlewaresKey = "_IMiddlewares",
13
- IsMiddlewareKey = "_IIsMiddleware",
14
15
  CronKey = "_ICron",
15
16
  IOCObjectKey = "_IIocObject",
16
17
  OverrideKey = "_IOverride",
17
- ExpressionKey = "_IExpression"
18
+ ExpressionKey = "_IExpression",
19
+ ValidatorKey = "_IValidator"
18
20
  }
@@ -5,16 +5,18 @@ export var ComponentConstants;
5
5
  (function (ComponentConstants) {
6
6
  ComponentConstants["RouteKey"] = "_routeKey";
7
7
  ComponentConstants["DependencyKey"] = "_IDependencies";
8
+ ComponentConstants["SoftDependencyKey"] = "_ISoftDependencies";
9
+ ComponentConstants["PostConstructKey"] = "_IPostConstruct";
8
10
  ComponentConstants["ScopeKey"] = "_IScope";
9
11
  ComponentConstants["NameKey"] = "_IName";
10
12
  ComponentConstants["StrategyKey"] = "_IStrategy";
11
13
  ComponentConstants["InterfaceKey"] = "_Interface";
12
14
  ComponentConstants["PathKey"] = "_IPath";
13
15
  ComponentConstants["MiddlewaresKey"] = "_IMiddlewares";
14
- ComponentConstants["IsMiddlewareKey"] = "_IIsMiddleware";
15
16
  ComponentConstants["CronKey"] = "_ICron";
16
17
  ComponentConstants["IOCObjectKey"] = "_IIocObject";
17
18
  ComponentConstants["OverrideKey"] = "_IOverride";
18
19
  ComponentConstants["ExpressionKey"] = "_IExpression";
20
+ ComponentConstants["ValidatorKey"] = "_IValidator";
19
21
  })(ComponentConstants || (ComponentConstants = {}));
20
22
  //# sourceMappingURL=ComponentConstants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentConstants.js","sourceRoot":"","sources":["../../../../lib/ioc/constants/ComponentConstants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,kBAcX;AAdD,WAAY,kBAAkB;IAC5B,4CAAsB,CAAA;IACtB,sDAAgC,CAAA;IAChC,0CAAoB,CAAA;IACpB,wCAAkB,CAAA;IAClB,gDAA0B,CAAA;IAC1B,iDAA2B,CAAA;IAC3B,wCAAkB,CAAA;IAClB,sDAAgC,CAAA;IAChC,wDAAkC,CAAA;IAClC,wCAAkB,CAAA;IAClB,kDAA4B,CAAA;IAC5B,gDAA0B,CAAA;IAC1B,oDAA8B,CAAA;AAChC,CAAC,EAdW,kBAAkB,KAAlB,kBAAkB,QAc7B"}
1
+ {"version":3,"file":"ComponentConstants.js","sourceRoot":"","sources":["../../../../lib/ioc/constants/ComponentConstants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,kBAgBX;AAhBD,WAAY,kBAAkB;IAC5B,4CAAsB,CAAA;IACtB,sDAAgC,CAAA;IAChC,8DAAwC,CAAA;IACxC,0DAAoC,CAAA;IACpC,0CAAoB,CAAA;IACpB,wCAAkB,CAAA;IAClB,gDAA0B,CAAA;IAC1B,iDAA2B,CAAA;IAC3B,wCAAkB,CAAA;IAClB,sDAAgC,CAAA;IAChC,wCAAkB,CAAA;IAClB,kDAA4B,CAAA;IAC5B,gDAA0B,CAAA;IAC1B,oDAA8B,CAAA;IAC9B,kDAA4B,CAAA;AAC9B,CAAC,EAhBW,kBAAkB,KAAlB,kBAAkB,QAgB7B"}
@@ -1,4 +1,4 @@
1
1
  import type { IocConfig } from '../types';
2
2
  export declare const getAllFiles: (dirPath: string, arrayOfFiles?: string[]) => string[];
3
3
  export declare const readJson: (path: any) => any;
4
- export declare const readConfigFile: () => IocConfig | null;
4
+ export declare const readConfigFile: () => Promise<IocConfig | null>;
@@ -18,12 +18,18 @@ export const readJson = (path) => {
18
18
  const file = fs.readFileSync(path, { encoding: 'utf-8' });
19
19
  return JSON.parse(file);
20
20
  };
21
- export const readConfigFile = () => {
21
+ export const readConfigFile = async () => {
22
22
  const folderPath = path.join(process.cwd());
23
23
  const files = getAllFiles(folderPath);
24
24
  for (const file of files) {
25
- if (file.endsWith('asenarc.json')) {
26
- return readJson(file);
25
+ if (file.endsWith('asena-config.ts')) {
26
+ try {
27
+ return (await import(file)).default;
28
+ }
29
+ catch (e) {
30
+ console.error('Cannot read config file', e);
31
+ throw new Error('AsenaConfig file cannot read.');
32
+ }
27
33
  }
28
34
  }
29
35
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"fileHelper.js","sourceRoot":"","sources":["../../../../lib/ioc/helper/fileHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,2BAA2B;AAE3B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,eAAyB,EAAE,EAAY,EAAE;IACpF,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEtC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAE1C,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACxC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,Q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aAAM,CAAC;YACN,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IAE1D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAA+B,EAAE;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAa,WAAW,CAAC,UAAU,CAAC,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC;gBACH,OAAO,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,OAAoB,CAAC;YACnD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAC;gBAE5C,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
- import type { Component } from '../types';
2
- import type { Class } from '../../server/types';
1
+ import type { InjectableComponent } from '../types';
3
2
  interface StringMap {
4
3
  [key: string]: string;
5
4
  }
6
- export declare const getStrategyClass: (interfaceNames: StringMap, injectables: Component[]) => Class[];
5
+ export declare const getStrategyClass: (interfaceNames: StringMap, injectables: InjectableComponent[]) => string[];
7
6
  export {};
@@ -1,10 +1,12 @@
1
+ import { getTypedMetadata } from '../../utils/typedMetadata';
2
+ import { ComponentConstants } from '../constants';
1
3
  // make it proper class
2
4
  export const getStrategyClass = (interfaceNames, injectables) => {
3
5
  if (!interfaceNames)
4
6
  return [];
5
7
  const strategies = Object.values(interfaceNames);
6
8
  return injectables
7
- .filter(injectable => strategies.includes(injectable.interface))
8
- .map(injectable => injectable.Class);
9
+ .filter((injectable) => strategies.includes(injectable.interface))
10
+ .map((injectable) => getTypedMetadata(ComponentConstants.NameKey, injectable.Class));
9
11
  };
10
12
  //# sourceMappingURL=iocHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"iocHelper.js","sourceRoot":"","sources":["../../../../lib/ioc/helper/iocHelper.ts"],"names":[],"mappings":"AAMA,uBAAuB;AACvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAAyB,EAAE,WAAwB,EAAW,EAAE;IAC/F,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEjD,OAAO,WAAW;SACf,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SAC/D,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"iocHelper.js","sourceRoot":"","sources":["../../../../lib/ioc/helper/iocHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,uBAAuB;AACvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAAyB,EAAE,WAAkC,EAAY,EAAE;IAC1G,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEjD,OAAO,WAAW;SACf,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACjE,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,gBAAgB,CAAS,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AACjG,CAAC,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { Class } from '../../server/types';
2
- export interface Component {
2
+ export interface InjectableComponent {
3
3
  Class: Class;
4
4
  interface: string;
5
5
  }
6
- export interface Injectable {
7
- [key: string]: Class | Class[];
6
+ export interface Dependencies {
7
+ [key: string]: string;
8
8
  }
9
- export interface Expression {
9
+ export interface Expressions {
10
10
  [key: string]: (injectedClass: any) => any;
11
11
  }
12
12
  export interface Strategies {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=InjectableComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InjectableComponent.js","sourceRoot":"","sources":["../../../../lib/ioc/types/InjectableComponent.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
1
  export interface IocConfig {
2
2
  sourceFolder: string;
3
+ rootFile: string;
3
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { Scope } from '../Scope';
2
2
  export interface ComponentParams {
3
- name: string;
3
+ name?: string;
4
4
  scope?: Scope;
5
5
  }
@@ -2,8 +2,8 @@ export declare enum ComponentType {
2
2
  COMPONENT = "COMPONENT",
3
3
  SERVICE = "SERVICE",
4
4
  CONTROLLER = "CONTROLLER",
5
- SERVER_SERVICE = "SERVER_SERVICE",
6
5
  SCHEDULE = "SCHEDULE",
7
6
  MIDDLEWARE = "MIDDLEWARE",
8
- WEBSOCKET = "WEBSOCKET"
7
+ WEBSOCKET = "WEBSOCKET",
8
+ CONFIG = "CONFIG"
9
9
  }
@@ -3,9 +3,9 @@ export var ComponentType;
3
3
  ComponentType["COMPONENT"] = "COMPONENT";
4
4
  ComponentType["SERVICE"] = "SERVICE";
5
5
  ComponentType["CONTROLLER"] = "CONTROLLER";
6
- ComponentType["SERVER_SERVICE"] = "SERVER_SERVICE";
7
6
  ComponentType["SCHEDULE"] = "SCHEDULE";
8
7
  ComponentType["MIDDLEWARE"] = "MIDDLEWARE";
9
8
  ComponentType["WEBSOCKET"] = "WEBSOCKET";
9
+ ComponentType["CONFIG"] = "CONFIG";
10
10
  })(ComponentType || (ComponentType = {}));
11
11
  //# sourceMappingURL=ComponentType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentType.js","sourceRoot":"","sources":["../../../../../lib/ioc/types/decorators/ComponentType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,kDAAiC,CAAA;IACjC,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;AACzB,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB"}
1
+ {"version":3,"file":"ComponentType.js","sourceRoot":"","sources":["../../../../../lib/ioc/types/decorators/ComponentType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,kCAAiB,CAAA;AACnB,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB"}
@@ -1,6 +1,7 @@
1
1
  import type { ComponentParams } from './ComponentParams';
2
- import type { MiddlewareClass } from '../../../server/types';
3
- export interface ControllerParams extends ComponentParams {
2
+ import type { AsenaContext } from '../../../adapter';
3
+ import type { MiddlewareClass } from "../../../server/web/middleware";
4
+ export interface ControllerParams<C extends AsenaContext<any, any> = AsenaContext<any, any>> extends ComponentParams {
4
5
  path: string;
5
- middlewares?: MiddlewareClass[];
6
+ middlewares?: MiddlewareClass<C>[];
6
7
  }
@@ -1,4 +1,4 @@
1
1
  import type { ComponentParams } from './ComponentParams';
2
2
  export interface MiddlewareParams extends ComponentParams {
3
- override?: boolean;
3
+ validator?: boolean;
4
4
  }
@@ -5,5 +5,5 @@ export * from './decorators/ServiceParams';
5
5
  export * from './decorators/ScheduleParams';
6
6
  export * from './Scope';
7
7
  export * from './IocConfig';
8
- export * from './Component';
8
+ export * from './InjectableComponent';
9
9
  export * from './ContainerService';
@@ -5,6 +5,6 @@ export * from './decorators/ServiceParams';
5
5
  export * from './decorators/ScheduleParams';
6
6
  export * from './Scope';
7
7
  export * from './IocConfig';
8
- export * from './Component';
8
+ export * from './InjectableComponent';
9
9
  export * from './ContainerService';
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/ioc/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/ioc/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from 'winston';
2
2
  import winston from 'winston';
3
- import type { ServerLogger } from '../types';
3
+ import type { ServerLogger } from './Logger';
4
4
  export declare const defaultFormat: winston.Logform.Format;
5
5
  export declare const green: (message: string) => string;
6
6
  export declare const red: (message: string) => string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultLogger.js","sourceRoot":"","sources":["../../../lib/logger/DefaultLogger.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CACjD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,EAC3D,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EACtB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;IAC7B,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC;IAErD,OAAO,GAAG,SAAS,KAAK,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAClH,CAAC,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,WAAW,OAAO,SAAS,CAAC;AAEtE,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,WAAW,OAAO,SAAS,CAAC;AAEpE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,WAAW,OAAO,SAAS,CAAC;AAEvE,MAAM,OAAO,aAAa;IAEjB,MAAM,CAAS;IAEtB;QACE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;YACjC,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;YAC7B,UAAU,EAAE,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,EAAS,CAAC,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,IAAU;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,IAAI,CAAC,OAAe,EAAE,IAAU;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,KAAK,CAAC,OAAe,EAAE,IAAU;QACtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAEM,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CAEF"}
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../../lib/services/types/Logger.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../lib/logger/Logger.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './DefaultLogger';
2
+ export * from './Logger';
@@ -0,0 +1,3 @@
1
+ export * from './DefaultLogger';
2
+ export * from './Logger';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/logger/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC"}
@@ -1,26 +1,27 @@
1
1
  import type { Class } from './types';
2
- import type { ServerLogger } from '../services';
3
- import type { AsenaAdapter } from '../adapter';
4
- import type { WSOptions } from './web/websocket';
5
- export declare class AsenaServer {
2
+ import type { Container } from '../ioc';
3
+ import type { AsenaAdapter, AsenaWebsocketAdapter } from '../adapter';
4
+ import { type ServerLogger } from '../logger';
5
+ export declare class AsenaServer<A extends AsenaAdapter<any, any, any, AsenaWebsocketAdapter<any, any>>> {
6
6
  private _port;
7
7
  private controllers;
8
8
  private _components;
9
9
  private _ioc;
10
10
  private _logger;
11
- private _adapter;
12
- private _wsOptions;
13
- constructor(adapter?: AsenaAdapter<any, any, any, any, any>);
11
+ private readonly _adapter;
12
+ constructor(adapter: A, logger?: ServerLogger);
13
+ initialize(): Promise<Container>;
14
14
  start(gc?: boolean): Promise<void>;
15
- components(components: Class[]): AsenaServer;
16
- port(port: number): AsenaServer;
17
- logger(value: ServerLogger): AsenaServer;
18
- wsOptions(options: WSOptions): AsenaServer;
15
+ components(components: Class[]): this;
16
+ port(port: number): this;
17
+ logger(value: ServerLogger): this;
19
18
  private initializeControllers;
19
+ private validateAndSetControllers;
20
20
  private prepareTopMiddlewares;
21
- private prepareMiddleware;
21
+ private prepareValidator;
22
+ private prepareRouteMiddleware;
23
+ private prepareMiddlewares;
22
24
  private prepareWebSocket;
23
- private prepareServerServices;
24
- private configureErrorHandling;
25
+ private prepareConfigs;
25
26
  private prepareLogger;
26
27
  }