@elsikora/cladi 1.0.1

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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/dist/cjs/domain/enum/index.d.ts +3 -0
  4. package/dist/cjs/domain/enum/index.d.ts.map +1 -0
  5. package/dist/cjs/domain/enum/logger-log-level.enum.d.ts +11 -0
  6. package/dist/cjs/domain/enum/logger-log-level.enum.d.ts.map +1 -0
  7. package/dist/cjs/domain/enum/logger-log-level.enum.js +14 -0
  8. package/dist/cjs/domain/enum/logger-log-level.enum.js.map +1 -0
  9. package/dist/cjs/domain/enum/service-token.enum.d.ts +10 -0
  10. package/dist/cjs/domain/enum/service-token.enum.d.ts.map +1 -0
  11. package/dist/cjs/domain/enum/service-token.enum.js +13 -0
  12. package/dist/cjs/domain/enum/service-token.enum.js.map +1 -0
  13. package/dist/cjs/domain/index.d.ts +3 -0
  14. package/dist/cjs/domain/index.d.ts.map +1 -0
  15. package/dist/cjs/domain/interface/container.interface.d.ts +55 -0
  16. package/dist/cjs/domain/interface/container.interface.d.ts.map +1 -0
  17. package/dist/cjs/domain/interface/error.interface.d.ts +18 -0
  18. package/dist/cjs/domain/interface/error.interface.d.ts.map +1 -0
  19. package/dist/cjs/domain/interface/factory.interface.d.ts +19 -0
  20. package/dist/cjs/domain/interface/factory.interface.d.ts.map +1 -0
  21. package/dist/cjs/domain/interface/index.d.ts +6 -0
  22. package/dist/cjs/domain/interface/index.d.ts.map +1 -0
  23. package/dist/cjs/domain/interface/logger/index.d.ts +3 -0
  24. package/dist/cjs/domain/interface/logger/index.d.ts.map +1 -0
  25. package/dist/cjs/domain/interface/logger/interface.d.ts +37 -0
  26. package/dist/cjs/domain/interface/logger/interface.d.ts.map +1 -0
  27. package/dist/cjs/domain/interface/logger/method-options.interface.d.ts +14 -0
  28. package/dist/cjs/domain/interface/logger/method-options.interface.d.ts.map +1 -0
  29. package/dist/cjs/domain/interface/registry.interface.d.ts +54 -0
  30. package/dist/cjs/domain/interface/registry.interface.d.ts.map +1 -0
  31. package/dist/cjs/index.d.ts +4 -0
  32. package/dist/cjs/index.d.ts.map +1 -0
  33. package/dist/cjs/index.js +38 -0
  34. package/dist/cjs/index.js.map +1 -0
  35. package/dist/cjs/infrastructure/class/base/container.class.d.ts +67 -0
  36. package/dist/cjs/infrastructure/class/base/container.class.d.ts.map +1 -0
  37. package/dist/cjs/infrastructure/class/base/container.class.js +193 -0
  38. package/dist/cjs/infrastructure/class/base/container.class.js.map +1 -0
  39. package/dist/cjs/infrastructure/class/base/error.class.d.ts +18 -0
  40. package/dist/cjs/infrastructure/class/base/error.class.d.ts.map +1 -0
  41. package/dist/cjs/infrastructure/class/base/error.class.js +30 -0
  42. package/dist/cjs/infrastructure/class/base/error.class.js.map +1 -0
  43. package/dist/cjs/infrastructure/class/base/factory.class.d.ts +38 -0
  44. package/dist/cjs/infrastructure/class/base/factory.class.d.ts.map +1 -0
  45. package/dist/cjs/infrastructure/class/base/factory.class.js +79 -0
  46. package/dist/cjs/infrastructure/class/base/factory.class.js.map +1 -0
  47. package/dist/cjs/infrastructure/class/base/index.d.ts +5 -0
  48. package/dist/cjs/infrastructure/class/base/index.d.ts.map +1 -0
  49. package/dist/cjs/infrastructure/class/base/registry.class.d.ts +73 -0
  50. package/dist/cjs/infrastructure/class/base/registry.class.d.ts.map +1 -0
  51. package/dist/cjs/infrastructure/class/base/registry.class.js +221 -0
  52. package/dist/cjs/infrastructure/class/base/registry.class.js.map +1 -0
  53. package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.d.ts +6 -0
  54. package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.d.ts.map +1 -0
  55. package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.js +12 -0
  56. package/dist/cjs/infrastructure/constant/console-logger-default-options.constant.js.map +1 -0
  57. package/dist/cjs/infrastructure/constant/index.d.ts +2 -0
  58. package/dist/cjs/infrastructure/constant/index.d.ts.map +1 -0
  59. package/dist/cjs/infrastructure/factory/core.factory.d.ts +51 -0
  60. package/dist/cjs/infrastructure/factory/core.factory.d.ts.map +1 -0
  61. package/dist/cjs/infrastructure/factory/core.factory.js +85 -0
  62. package/dist/cjs/infrastructure/factory/core.factory.js.map +1 -0
  63. package/dist/cjs/infrastructure/factory/index.d.ts +2 -0
  64. package/dist/cjs/infrastructure/factory/index.d.ts.map +1 -0
  65. package/dist/cjs/infrastructure/index.d.ts +6 -0
  66. package/dist/cjs/infrastructure/index.d.ts.map +1 -0
  67. package/dist/cjs/infrastructure/interface/base/container-options.interface.d.ts +11 -0
  68. package/dist/cjs/infrastructure/interface/base/container-options.interface.d.ts.map +1 -0
  69. package/dist/cjs/infrastructure/interface/base/error-options.interface.d.ts +22 -0
  70. package/dist/cjs/infrastructure/interface/base/error-options.interface.d.ts.map +1 -0
  71. package/dist/cjs/infrastructure/interface/base/factory-options.interface.d.ts +21 -0
  72. package/dist/cjs/infrastructure/interface/base/factory-options.interface.d.ts.map +1 -0
  73. package/dist/cjs/infrastructure/interface/base/index.d.ts +5 -0
  74. package/dist/cjs/infrastructure/interface/base/index.d.ts.map +1 -0
  75. package/dist/cjs/infrastructure/interface/base/registry-options.interface.d.ts +11 -0
  76. package/dist/cjs/infrastructure/interface/base/registry-options.interface.d.ts.map +1 -0
  77. package/dist/cjs/infrastructure/interface/console-logger-options.interface.d.ts +15 -0
  78. package/dist/cjs/infrastructure/interface/console-logger-options.interface.d.ts.map +1 -0
  79. package/dist/cjs/infrastructure/interface/core-factory-options.interface.d.ts +11 -0
  80. package/dist/cjs/infrastructure/interface/core-factory-options.interface.d.ts.map +1 -0
  81. package/dist/cjs/infrastructure/interface/index.d.ts +4 -0
  82. package/dist/cjs/infrastructure/interface/index.d.ts.map +1 -0
  83. package/dist/cjs/infrastructure/service/console-logger.service.d.ts +71 -0
  84. package/dist/cjs/infrastructure/service/console-logger.service.d.ts.map +1 -0
  85. package/dist/cjs/infrastructure/service/console-logger.service.js +130 -0
  86. package/dist/cjs/infrastructure/service/console-logger.service.js.map +1 -0
  87. package/dist/cjs/infrastructure/service/index.d.ts +2 -0
  88. package/dist/cjs/infrastructure/service/index.d.ts.map +1 -0
  89. package/dist/cjs/package.json +3 -0
  90. package/dist/cjs/presentation/utility/create/container.utility.d.ts +9 -0
  91. package/dist/cjs/presentation/utility/create/container.utility.d.ts.map +1 -0
  92. package/dist/cjs/presentation/utility/create/container.utility.js +18 -0
  93. package/dist/cjs/presentation/utility/create/container.utility.js.map +1 -0
  94. package/dist/cjs/presentation/utility/create/factory.utility.d.ts +10 -0
  95. package/dist/cjs/presentation/utility/create/factory.utility.d.ts.map +1 -0
  96. package/dist/cjs/presentation/utility/create/factory.utility.js +19 -0
  97. package/dist/cjs/presentation/utility/create/factory.utility.js.map +1 -0
  98. package/dist/cjs/presentation/utility/create/index.d.ts +5 -0
  99. package/dist/cjs/presentation/utility/create/index.d.ts.map +1 -0
  100. package/dist/cjs/presentation/utility/create/logger.utility.d.ts +9 -0
  101. package/dist/cjs/presentation/utility/create/logger.utility.d.ts.map +1 -0
  102. package/dist/cjs/presentation/utility/create/logger.utility.js +16 -0
  103. package/dist/cjs/presentation/utility/create/logger.utility.js.map +1 -0
  104. package/dist/cjs/presentation/utility/create/registry.utility.d.ts +12 -0
  105. package/dist/cjs/presentation/utility/create/registry.utility.d.ts.map +1 -0
  106. package/dist/cjs/presentation/utility/create/registry.utility.js +19 -0
  107. package/dist/cjs/presentation/utility/create/registry.utility.js.map +1 -0
  108. package/dist/esm/domain/enum/index.d.ts +3 -0
  109. package/dist/esm/domain/enum/index.d.ts.map +1 -0
  110. package/dist/esm/domain/enum/logger-log-level.enum.d.ts +11 -0
  111. package/dist/esm/domain/enum/logger-log-level.enum.d.ts.map +1 -0
  112. package/dist/esm/domain/enum/logger-log-level.enum.js +14 -0
  113. package/dist/esm/domain/enum/logger-log-level.enum.js.map +1 -0
  114. package/dist/esm/domain/enum/service-token.enum.d.ts +10 -0
  115. package/dist/esm/domain/enum/service-token.enum.d.ts.map +1 -0
  116. package/dist/esm/domain/enum/service-token.enum.js +13 -0
  117. package/dist/esm/domain/enum/service-token.enum.js.map +1 -0
  118. package/dist/esm/domain/index.d.ts +3 -0
  119. package/dist/esm/domain/index.d.ts.map +1 -0
  120. package/dist/esm/domain/interface/container.interface.d.ts +55 -0
  121. package/dist/esm/domain/interface/container.interface.d.ts.map +1 -0
  122. package/dist/esm/domain/interface/error.interface.d.ts +18 -0
  123. package/dist/esm/domain/interface/error.interface.d.ts.map +1 -0
  124. package/dist/esm/domain/interface/factory.interface.d.ts +19 -0
  125. package/dist/esm/domain/interface/factory.interface.d.ts.map +1 -0
  126. package/dist/esm/domain/interface/index.d.ts +6 -0
  127. package/dist/esm/domain/interface/index.d.ts.map +1 -0
  128. package/dist/esm/domain/interface/logger/index.d.ts +3 -0
  129. package/dist/esm/domain/interface/logger/index.d.ts.map +1 -0
  130. package/dist/esm/domain/interface/logger/interface.d.ts +37 -0
  131. package/dist/esm/domain/interface/logger/interface.d.ts.map +1 -0
  132. package/dist/esm/domain/interface/logger/method-options.interface.d.ts +14 -0
  133. package/dist/esm/domain/interface/logger/method-options.interface.d.ts.map +1 -0
  134. package/dist/esm/domain/interface/registry.interface.d.ts +54 -0
  135. package/dist/esm/domain/interface/registry.interface.d.ts.map +1 -0
  136. package/dist/esm/index.d.ts +4 -0
  137. package/dist/esm/index.d.ts.map +1 -0
  138. package/dist/esm/index.js +14 -0
  139. package/dist/esm/index.js.map +1 -0
  140. package/dist/esm/infrastructure/class/base/container.class.d.ts +67 -0
  141. package/dist/esm/infrastructure/class/base/container.class.d.ts.map +1 -0
  142. package/dist/esm/infrastructure/class/base/container.class.js +191 -0
  143. package/dist/esm/infrastructure/class/base/container.class.js.map +1 -0
  144. package/dist/esm/infrastructure/class/base/error.class.d.ts +18 -0
  145. package/dist/esm/infrastructure/class/base/error.class.d.ts.map +1 -0
  146. package/dist/esm/infrastructure/class/base/error.class.js +28 -0
  147. package/dist/esm/infrastructure/class/base/error.class.js.map +1 -0
  148. package/dist/esm/infrastructure/class/base/factory.class.d.ts +38 -0
  149. package/dist/esm/infrastructure/class/base/factory.class.d.ts.map +1 -0
  150. package/dist/esm/infrastructure/class/base/factory.class.js +77 -0
  151. package/dist/esm/infrastructure/class/base/factory.class.js.map +1 -0
  152. package/dist/esm/infrastructure/class/base/index.d.ts +5 -0
  153. package/dist/esm/infrastructure/class/base/index.d.ts.map +1 -0
  154. package/dist/esm/infrastructure/class/base/registry.class.d.ts +73 -0
  155. package/dist/esm/infrastructure/class/base/registry.class.d.ts.map +1 -0
  156. package/dist/esm/infrastructure/class/base/registry.class.js +219 -0
  157. package/dist/esm/infrastructure/class/base/registry.class.js.map +1 -0
  158. package/dist/esm/infrastructure/constant/console-logger-default-options.constant.d.ts +6 -0
  159. package/dist/esm/infrastructure/constant/console-logger-default-options.constant.d.ts.map +1 -0
  160. package/dist/esm/infrastructure/constant/console-logger-default-options.constant.js +10 -0
  161. package/dist/esm/infrastructure/constant/console-logger-default-options.constant.js.map +1 -0
  162. package/dist/esm/infrastructure/constant/index.d.ts +2 -0
  163. package/dist/esm/infrastructure/constant/index.d.ts.map +1 -0
  164. package/dist/esm/infrastructure/factory/core.factory.d.ts +51 -0
  165. package/dist/esm/infrastructure/factory/core.factory.d.ts.map +1 -0
  166. package/dist/esm/infrastructure/factory/core.factory.js +83 -0
  167. package/dist/esm/infrastructure/factory/core.factory.js.map +1 -0
  168. package/dist/esm/infrastructure/factory/index.d.ts +2 -0
  169. package/dist/esm/infrastructure/factory/index.d.ts.map +1 -0
  170. package/dist/esm/infrastructure/index.d.ts +6 -0
  171. package/dist/esm/infrastructure/index.d.ts.map +1 -0
  172. package/dist/esm/infrastructure/interface/base/container-options.interface.d.ts +11 -0
  173. package/dist/esm/infrastructure/interface/base/container-options.interface.d.ts.map +1 -0
  174. package/dist/esm/infrastructure/interface/base/error-options.interface.d.ts +22 -0
  175. package/dist/esm/infrastructure/interface/base/error-options.interface.d.ts.map +1 -0
  176. package/dist/esm/infrastructure/interface/base/factory-options.interface.d.ts +21 -0
  177. package/dist/esm/infrastructure/interface/base/factory-options.interface.d.ts.map +1 -0
  178. package/dist/esm/infrastructure/interface/base/index.d.ts +5 -0
  179. package/dist/esm/infrastructure/interface/base/index.d.ts.map +1 -0
  180. package/dist/esm/infrastructure/interface/base/registry-options.interface.d.ts +11 -0
  181. package/dist/esm/infrastructure/interface/base/registry-options.interface.d.ts.map +1 -0
  182. package/dist/esm/infrastructure/interface/console-logger-options.interface.d.ts +15 -0
  183. package/dist/esm/infrastructure/interface/console-logger-options.interface.d.ts.map +1 -0
  184. package/dist/esm/infrastructure/interface/core-factory-options.interface.d.ts +11 -0
  185. package/dist/esm/infrastructure/interface/core-factory-options.interface.d.ts.map +1 -0
  186. package/dist/esm/infrastructure/interface/index.d.ts +4 -0
  187. package/dist/esm/infrastructure/interface/index.d.ts.map +1 -0
  188. package/dist/esm/infrastructure/service/console-logger.service.d.ts +71 -0
  189. package/dist/esm/infrastructure/service/console-logger.service.d.ts.map +1 -0
  190. package/dist/esm/infrastructure/service/console-logger.service.js +128 -0
  191. package/dist/esm/infrastructure/service/console-logger.service.js.map +1 -0
  192. package/dist/esm/infrastructure/service/index.d.ts +2 -0
  193. package/dist/esm/infrastructure/service/index.d.ts.map +1 -0
  194. package/dist/esm/package.json +3 -0
  195. package/dist/esm/presentation/utility/create/container.utility.d.ts +9 -0
  196. package/dist/esm/presentation/utility/create/container.utility.d.ts.map +1 -0
  197. package/dist/esm/presentation/utility/create/container.utility.js +16 -0
  198. package/dist/esm/presentation/utility/create/container.utility.js.map +1 -0
  199. package/dist/esm/presentation/utility/create/factory.utility.d.ts +10 -0
  200. package/dist/esm/presentation/utility/create/factory.utility.d.ts.map +1 -0
  201. package/dist/esm/presentation/utility/create/factory.utility.js +17 -0
  202. package/dist/esm/presentation/utility/create/factory.utility.js.map +1 -0
  203. package/dist/esm/presentation/utility/create/index.d.ts +5 -0
  204. package/dist/esm/presentation/utility/create/index.d.ts.map +1 -0
  205. package/dist/esm/presentation/utility/create/logger.utility.d.ts +9 -0
  206. package/dist/esm/presentation/utility/create/logger.utility.d.ts.map +1 -0
  207. package/dist/esm/presentation/utility/create/logger.utility.js +14 -0
  208. package/dist/esm/presentation/utility/create/logger.utility.js.map +1 -0
  209. package/dist/esm/presentation/utility/create/registry.utility.d.ts +12 -0
  210. package/dist/esm/presentation/utility/create/registry.utility.d.ts.map +1 -0
  211. package/dist/esm/presentation/utility/create/registry.utility.js +17 -0
  212. package/dist/esm/presentation/utility/create/registry.utility.js.map +1 -0
  213. package/package.json +89 -0
@@ -0,0 +1,37 @@
1
+ import type { ILoggerMethodOptions } from "./method-options.interface";
2
+ /**
3
+ * Logger interface.
4
+ */
5
+ export interface ILogger {
6
+ /**
7
+ * Log a debug message.
8
+ * @param message Message to log.
9
+ * @param options Optional logging options.
10
+ */
11
+ debug(message: string, options?: ILoggerMethodOptions): void;
12
+ /**
13
+ * Log an error message.
14
+ * @param message Message to log.
15
+ * @param options Optional logging options.
16
+ */
17
+ error(message: string, options?: ILoggerMethodOptions): void;
18
+ /**
19
+ * Log an info message.
20
+ * @param message Message to log.
21
+ * @param options Optional logging options.
22
+ */
23
+ info(message: string, options?: ILoggerMethodOptions): void;
24
+ /**
25
+ * Log a trace message.
26
+ * @param message Message to log.
27
+ * @param options Optional logging options.
28
+ */
29
+ trace(message: string, options?: ILoggerMethodOptions): void;
30
+ /**
31
+ * Log a warning message.
32
+ * @param message Message to log.
33
+ * @param options Optional logging options.
34
+ */
35
+ warn(message: string, options?: ILoggerMethodOptions): void;
36
+ }
37
+ //# sourceMappingURL=interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../../src/domain/interface/logger/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE7D;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE7D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE5D;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE7D;;;;OAIG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC5D"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Log options interface.
3
+ */
4
+ export interface ILoggerMethodOptions {
5
+ /**
6
+ * Optional context to include with the log.
7
+ */
8
+ context?: Record<string, unknown>;
9
+ /**
10
+ * Optional source identifier (e.g. "React", "NestJS Scheduler").
11
+ */
12
+ source?: string;
13
+ }
14
+ //# sourceMappingURL=method-options.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-options.interface.d.ts","sourceRoot":"","sources":["../../../../../src/domain/interface/logger/method-options.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Generic registry interface for managing items by name.
3
+ * @template T The type of items stored in the registry.
4
+ */
5
+ export interface IRegistry<T> {
6
+ /**
7
+ * Clear the registry.
8
+ */
9
+ clear(): void;
10
+ /**
11
+ * Get a single item from the registry by name.
12
+ * @param name The name of the item to get.
13
+ * @returns The item or undefined if it doesn't exist.
14
+ */
15
+ get(name: string): T | undefined;
16
+ /**
17
+ * Get all items from the registry.
18
+ * @returns An array of all items.
19
+ */
20
+ getAll(): Array<T>;
21
+ /**
22
+ * Get multiple items from the registry by their names.
23
+ * @param names The names of the items to get.
24
+ * @returns An array of items.
25
+ */
26
+ getMany(names: Array<string>): Array<T>;
27
+ /**
28
+ * Check if an item exists in the registry by name.
29
+ * @param name The name of the item to check.
30
+ * @returns True if the item exists, false otherwise.
31
+ */
32
+ has(name: string): boolean;
33
+ /**
34
+ * Register a single item in the registry.
35
+ * @param item The item to register.
36
+ */
37
+ register(item: T): void;
38
+ /**
39
+ * Register multiple items in the registry.
40
+ * @param items The items to register.
41
+ */
42
+ registerMany(items: Array<T>): void;
43
+ /**
44
+ * Unregister a single item from the registry by name.
45
+ * @param name The name of the item to unregister.
46
+ */
47
+ unregister(name: string): void;
48
+ /**
49
+ * Unregister multiple items from the registry by their names.
50
+ * @param names The names of the items to unregister.
51
+ */
52
+ unregisterMany(names: Array<string>): void;
53
+ }
54
+ //# sourceMappingURL=registry.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.interface.d.ts","sourceRoot":"","sources":["../../../../src/domain/interface/registry.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC3B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAExC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAEpC;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B;;;OAGG;IACH,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC3C"}
@@ -0,0 +1,4 @@
1
+ export * from "./domain";
2
+ export * from "./infrastructure";
3
+ export * from "./presentation/utility/create";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { ELoggerLogLevel } from './domain/enum/logger-log-level.enum.js';
2
+ export { EServiceToken } from './domain/enum/service-token.enum.js';
3
+ export { BaseContainer } from './infrastructure/class/base/container.class.js';
4
+ export { BaseError } from './infrastructure/class/base/error.class.js';
5
+ export { BaseFactory } from './infrastructure/class/base/factory.class.js';
6
+ export { BaseRegistry } from './infrastructure/class/base/registry.class.js';
7
+ export { CONSOLE_LOGGER_DEFAULT_OPTIONS } from './infrastructure/constant/console-logger-default-options.constant.js';
8
+ export { CoreFactory } from './infrastructure/factory/core.factory.js';
9
+ export { ConsoleLoggerService } from './infrastructure/service/console-logger.service.js';
10
+ export { createContainer } from './presentation/utility/create/container.utility.js';
11
+ export { createFactory } from './presentation/utility/create/factory.utility.js';
12
+ export { createLogger } from './presentation/utility/create/logger.utility.js';
13
+ export { createRegistry } from './presentation/utility/create/registry.utility.js';
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,67 @@
1
+ import type { IContainer } from '../../../src/domain/interface/container.interface';
2
+ import type { IBaseContainerOptions } from '../../../src/infrastructure/interface/index';
3
+ /**
4
+ * Simple dependency injection container implementation.
5
+ */
6
+ export declare class BaseContainer implements IContainer {
7
+ private readonly DEPENDENCIES;
8
+ private readonly LOGGER;
9
+ /**
10
+ * Create a new container.
11
+ * @param {IBaseContainerOptions} options - The options to use for the container.
12
+ */
13
+ constructor(options: IBaseContainerOptions);
14
+ /**
15
+ * Clear all dependencies from the container.
16
+ */
17
+ clear(): void;
18
+ /**
19
+ * Get a dependency from the container.
20
+ * @param {symbol} token Token that identifies the dependency.
21
+ * @returns {T | undefined} The dependency, or undefined if it doesn't exist.
22
+ * @template T The type of the dependency.
23
+ */
24
+ get<T>(token: symbol): T | undefined;
25
+ /**
26
+ * Get all dependencies from the container.
27
+ * @returns {Array<unknown>} An array of all dependencies.
28
+ */
29
+ getAll(): Array<unknown>;
30
+ /**
31
+ * Get multiple dependencies from the container.
32
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
33
+ * @returns {Array<unknown>} An array of dependencies.
34
+ */
35
+ getMany<T>(tokens: Array<symbol>): Array<T>;
36
+ /**
37
+ * Check if a dependency exists in the container.
38
+ * @param {symbol} token Token that identifies the dependency.
39
+ * @returns {boolean} True if the dependency exists, false otherwise.
40
+ */
41
+ has(token: symbol): boolean;
42
+ /**
43
+ * Register a dependency in the container.
44
+ * @param {symbol} token Token that identifies the dependency.
45
+ * @param {T} implementation Implementation of the dependency.
46
+ * @template T The type of the dependency.
47
+ */
48
+ register(token: symbol, implementation: unknown): void;
49
+ /**
50
+ * Register multiple dependencies in the container.
51
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
52
+ * @param {Array<T>} implementations Implementations of the dependencies.
53
+ * @template T The type of the dependencies.
54
+ */
55
+ registerMany(tokens: Array<symbol>, implementations: Record<symbol, unknown>): void;
56
+ /**
57
+ * Remove a dependency from the container.
58
+ * @param {symbol} token Token that identifies the dependency.
59
+ */
60
+ unregister(token: symbol): void;
61
+ /**
62
+ * Remove multiple dependencies from the container.
63
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
64
+ */
65
+ unregisterMany(tokens: Array<symbol>): void;
66
+ }
67
+ //# sourceMappingURL=container.class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.class.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/class/base/container.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMvE;;GAEG;AACH,qBAAa,aAAc,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuB;IAEpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC;;;OAGG;gBACS,OAAO,EAAE,qBAAqB;IAK1C;;OAEG;IACI,KAAK,IAAI,IAAI;IAMpB;;;;;OAKG;IAEI,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAoB3C;;;OAGG;IACI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC;IAQ/B;;;;OAIG;IACI,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAwBlD;;;;OAIG;IACI,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAclC;;;;;OAKG;IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,IAAI;IAsB7D;;;;;OAKG;IAEI,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAyB1F;;;OAGG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAmBtC;;;OAGG;IACI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;CAwBlD"}
@@ -0,0 +1,191 @@
1
+ import { ConsoleLoggerService } from '../../service/console-logger.service.js';
2
+ import { BaseError } from './error.class.js';
3
+
4
+ /**
5
+ * Simple dependency injection container implementation.
6
+ */
7
+ class BaseContainer {
8
+ DEPENDENCIES;
9
+ LOGGER;
10
+ /**
11
+ * Create a new container.
12
+ * @param {IBaseContainerOptions} options - The options to use for the container.
13
+ */
14
+ constructor(options) {
15
+ this.DEPENDENCIES = new Map();
16
+ this.LOGGER = options.logger ?? new ConsoleLoggerService();
17
+ }
18
+ /**
19
+ * Clear all dependencies from the container.
20
+ */
21
+ clear() {
22
+ this.LOGGER.debug("Clearing all dependencies from container", { source: "Container" });
23
+ this.DEPENDENCIES.clear();
24
+ this.LOGGER.debug("Container cleared successfully", { source: "Container" });
25
+ }
26
+ /**
27
+ * Get a dependency from the container.
28
+ * @param {symbol} token Token that identifies the dependency.
29
+ * @returns {T | undefined} The dependency, or undefined if it doesn't exist.
30
+ * @template T The type of the dependency.
31
+ */
32
+ // eslint-disable-next-line @elsikora/typescript/no-unnecessary-type-parameters
33
+ get(token) {
34
+ if (!token) {
35
+ this.LOGGER.warn("Attempted to get dependency with empty token", { source: "Container" });
36
+ return undefined;
37
+ }
38
+ this.LOGGER.debug(`Getting dependency with token: ${String(token.description)}`, { source: "Container" });
39
+ const dependency = this.DEPENDENCIES.get(token);
40
+ if (dependency) {
41
+ this.LOGGER.debug(`Dependency found: ${String(token.description)}`, { source: "Container" });
42
+ }
43
+ else {
44
+ this.LOGGER.debug(`Dependency not found: ${String(token.description)}`, { source: "Container" });
45
+ }
46
+ return dependency;
47
+ }
48
+ /**
49
+ * Get all dependencies from the container.
50
+ * @returns {Array<unknown>} An array of all dependencies.
51
+ */
52
+ getAll() {
53
+ this.LOGGER.debug("Getting all dependencies", { source: "Container" });
54
+ const dependencies = [...this.DEPENDENCIES.values()];
55
+ this.LOGGER.debug(`Retrieved ${String(dependencies.length)} dependencies`, { source: "Container" });
56
+ return dependencies;
57
+ }
58
+ /**
59
+ * Get multiple dependencies from the container.
60
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
61
+ * @returns {Array<unknown>} An array of dependencies.
62
+ */
63
+ getMany(tokens) {
64
+ if (!tokens) {
65
+ throw new BaseError("Tokens cannot be null or undefined", {
66
+ code: "CONTAINER_TOKENS_NOT_NULL_OR_UNDEFINED",
67
+ source: "Container",
68
+ });
69
+ }
70
+ if (!Array.isArray(tokens)) {
71
+ throw new BaseError("Tokens must be an array", {
72
+ code: "CONTAINER_TOKENS_NOT_ARRAY",
73
+ source: "Container",
74
+ });
75
+ }
76
+ this.LOGGER.debug(`Getting ${String(tokens.length)} dependencies by token`, { source: "Container" });
77
+ const result = tokens.map((token) => this.get(token)).filter((item) => item !== undefined);
78
+ this.LOGGER.debug(`Retrieved ${String(result.length)} dependencies`, { source: "Container" });
79
+ return result;
80
+ }
81
+ /**
82
+ * Check if a dependency exists in the container.
83
+ * @param {symbol} token Token that identifies the dependency.
84
+ * @returns {boolean} True if the dependency exists, false otherwise.
85
+ */
86
+ has(token) {
87
+ if (!token) {
88
+ return false;
89
+ }
90
+ this.LOGGER.debug(`Checking if dependency exists: ${String(token.description)}`, { source: "Container" });
91
+ const isExists = this.DEPENDENCIES.has(token);
92
+ this.LOGGER.debug(`Dependency ${isExists ? "exists" : "does not exist"}: ${String(token.description)}`, { source: "Container" });
93
+ return isExists;
94
+ }
95
+ /**
96
+ * Register a dependency in the container.
97
+ * @param {symbol} token Token that identifies the dependency.
98
+ * @param {T} implementation Implementation of the dependency.
99
+ * @template T The type of the dependency.
100
+ */
101
+ register(token, implementation) {
102
+ if (!token) {
103
+ throw new BaseError("Token cannot be null or undefined", {
104
+ code: "CONTAINER_TOKEN_NOT_NULL_OR_UNDEFINED",
105
+ source: "Container",
106
+ });
107
+ }
108
+ this.LOGGER.debug(`Registering dependency with token: ${String(token.description)}`, { source: "Container" });
109
+ if (this.has(token)) {
110
+ throw new BaseError("Dependency already exists in container", {
111
+ code: "CONTAINER_DEPENDENCY_ALREADY_EXISTS",
112
+ source: "Container",
113
+ });
114
+ }
115
+ this.DEPENDENCIES.set(token, implementation);
116
+ this.LOGGER.debug(`Dependency registered successfully: ${String(token.description)}`, { source: "Container" });
117
+ }
118
+ /**
119
+ * Register multiple dependencies in the container.
120
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
121
+ * @param {Array<T>} implementations Implementations of the dependencies.
122
+ * @template T The type of the dependencies.
123
+ */
124
+ registerMany(tokens, implementations) {
125
+ if (!tokens) {
126
+ throw new BaseError("Tokens cannot be null or undefined", {
127
+ code: "CONTAINER_TOKENS_NOT_NULL_OR_UNDEFINED",
128
+ source: "Container",
129
+ });
130
+ }
131
+ if (!Array.isArray(tokens)) {
132
+ throw new BaseError("Tokens must be an array", {
133
+ code: "CONTAINER_TOKENS_NOT_ARRAY",
134
+ source: "Container",
135
+ });
136
+ }
137
+ this.LOGGER.debug(`Registering ${String(tokens.length)} dependencies`, { source: "Container" });
138
+ // eslint-disable-next-line @elsikora/no-secrets/no-pattern-match
139
+ for (const token of tokens) {
140
+ this.register(token, implementations[token]);
141
+ }
142
+ this.LOGGER.debug(`${String(tokens.length)} dependencies registered successfully`, { source: "Container" });
143
+ }
144
+ /**
145
+ * Remove a dependency from the container.
146
+ * @param {symbol} token Token that identifies the dependency.
147
+ */
148
+ unregister(token) {
149
+ if (!token) {
150
+ throw new BaseError("Token cannot be null or undefined", {
151
+ code: "CONTAINER_TOKEN_NOT_NULL_OR_UNDEFINED",
152
+ source: "Container",
153
+ });
154
+ }
155
+ this.LOGGER.debug(`Unregistering dependency with token: ${String(token.description)}`, { source: "Container" });
156
+ const wasDeleted = this.DEPENDENCIES.delete(token);
157
+ if (wasDeleted) {
158
+ this.LOGGER.debug(`Dependency unregistered successfully: ${String(token.description)}`, { source: "Container" });
159
+ }
160
+ else {
161
+ this.LOGGER.debug(`Dependency not found for unregistering: ${String(token.description)}`, { source: "Container" });
162
+ }
163
+ }
164
+ /**
165
+ * Remove multiple dependencies from the container.
166
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
167
+ */
168
+ unregisterMany(tokens) {
169
+ if (!tokens) {
170
+ throw new BaseError("Tokens cannot be null or undefined", {
171
+ code: "CONTAINER_TOKENS_NOT_NULL_OR_UNDEFINED",
172
+ source: "Container",
173
+ });
174
+ }
175
+ if (!Array.isArray(tokens)) {
176
+ throw new BaseError("Tokens must be an array", {
177
+ code: "CONTAINER_TOKENS_NOT_ARRAY",
178
+ source: "Container",
179
+ });
180
+ }
181
+ this.LOGGER.debug(`Unregistering ${String(tokens.length)} dependencies`, { source: "Container" });
182
+ // eslint-disable-next-line @elsikora/no-secrets/no-pattern-match
183
+ for (const token of tokens) {
184
+ this.unregister(token);
185
+ }
186
+ this.LOGGER.debug(`${String(tokens.length)} dependencies unregistered`, { source: "Container" });
187
+ }
188
+ }
189
+
190
+ export { BaseContainer };
191
+ //# sourceMappingURL=container.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.class.js","sources":["../../../../../../src/infrastructure/class/base/container.class.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA;;AAEG;MACU,aAAa,CAAA;AACR,IAAA,YAAY;AAEZ,IAAA,MAAM;AAEvB;;;AAGG;AACH,IAAA,WAAA,CAAY,OAA8B,EAAA;AACzC,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAmB;QAC9C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,oBAAoB,EAAE;;AAG3D;;AAEG;IACI,KAAK,GAAA;AACX,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACtF,QAAA,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;AACz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ions } from '../../../src/infrastructure/interface/base/index';
3
+ /**
4
+ * Base error class.
5
+ */
6
+ export declare class BaseError extends Error implements IError {
7
+ readonly CAUSE?: Error;
8
+ readonly CODE: string;
9
+ readonly CONTEXT?: Record<string, unknown>;
10
+ readonly SOURCE?: string;
11
+ /**
12
+ * Creates a new base error.
13
+ * @param {string} message Error message.
14
+ * @param {IBaseErrorOptions} options Error options.
15
+ */
16
+ constructor(message: string, options: IBaseErrorOptions);
17
+ }
18
+ //# sourceMappingURL=error.class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.class.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/class/base/error.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAExE;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAM,YAAW,MAAM;IACrD,SAAgB,KAAK,CAAC,EAAE,KAAK,CAAC;IAE9B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAE7B,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB;CAYvD"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Base error class.
3
+ */
4
+ class BaseError extends Error {
5
+ CAUSE;
6
+ CODE;
7
+ CONTEXT;
8
+ SOURCE;
9
+ /**
10
+ * Creates a new base error.
11
+ * @param {string} message Error message.
12
+ * @param {IBaseErrorOptions} options Error options.
13
+ */
14
+ constructor(message, options) {
15
+ super(message);
16
+ this.name = this.constructor.name;
17
+ this.CAUSE = options.cause;
18
+ this.CODE = options.code;
19
+ this.CONTEXT = options.context;
20
+ this.SOURCE = options.source;
21
+ if (typeof Error.captureStackTrace === "function") {
22
+ Error.captureStackTrace(this, this.constructor);
23
+ }
24
+ }
25
+ }
26
+
27
+ export { BaseError };
28
+ //# sourceMappingURL=error.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.class.js","sources":["../../../../../../src/infrastructure/class/base/error.class.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;;AAEG;AACG,MAAO,SAAU,SAAQ,KAAK,CAAA;AACnB,IAAA,KAAK;AAEL,IAAA,IAAI;AAEJ,IAAA,OAAO;AAEP,IAAA,MAAM;AAEtB;;;;AAIG;IACH,WAAY,CAAA,OAAe,EAAE,OAA0B,EAAA;QACtD,KAAK,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI;AACjC,QAAA,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK;AAC1B,QAAA,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI;AACxB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO;AAC9B,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;AAE5B,QAAA,IAAI,OAAO,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE;YAClD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC;;;AAGjD;;;;"}
@@ -0,0 +1,38 @@
1
+ import type { IFactory } from '../../../src/domain/interface/factory.interface';
2
+ import type { IRegistry } from '../../../src/domain/interface/registry.interface';
3
+ import type { IBaseFactoryOptions } from '../../../src/infrastructure/interface/base/index';
4
+ /**
5
+ * Generic factory implementation that creates items by name using a registry as data source.
6
+ * @template T The type of items created by the factory.
7
+ */
8
+ export declare class BaseFactory<T> implements IFactory<T> {
9
+ private readonly CACHE;
10
+ private readonly LOGGER;
11
+ private readonly REGISTRY;
12
+ private readonly TRANSFORMER?;
13
+ /**
14
+ * Creates a new factory instance.
15
+ * @param {IBaseFactoryOptions<T>} options Factory creation options including registry, optional transformer, and logger.
16
+ */
17
+ constructor(options: IBaseFactoryOptions<T>);
18
+ /**
19
+ * Clear the factory's item cache.
20
+ * This should be called when the registry changes to ensure the factory
21
+ * doesn't return stale items.
22
+ * @param {string} [name] Optional name of the item to clear from cache. If not provided, all items are cleared.
23
+ */
24
+ clearCache(name?: string): void;
25
+ /**
26
+ * Create an item by name.
27
+ * @param {string} name The name of the item to create.
28
+ * @returns {T} The created item.
29
+ * @throws RegistryItemNotFoundError if no item with the given name exists in the registry.
30
+ */
31
+ create(name: string): T;
32
+ /**
33
+ * Get the registry associated with this factory.
34
+ * @returns {IRegistry<T>} The registry instance.
35
+ */
36
+ getRegistry(): IRegistry<T>;
37
+ }
38
+ //# sourceMappingURL=factory.class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.class.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/class/base/factory.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAM1E;;;GAGG;AACH,qBAAa,WAAW,CAAC,CAAC,CAAE,YAAW,QAAQ,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IAEvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IAExC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAqB;IAElD;;;OAGG;gBACS,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAO3C;;;;;OAKG;IACI,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAUtC;;;;;OAKG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC;IAgC9B;;;OAGG;IACI,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC;CAGlC"}
@@ -0,0 +1,77 @@
1
+ import { ConsoleLoggerService } from '../../service/console-logger.service.js';
2
+ import { BaseError } from './error.class.js';
3
+
4
+ /**
5
+ * Generic factory implementation that creates items by name using a registry as data source.
6
+ * @template T The type of items created by the factory.
7
+ */
8
+ class BaseFactory {
9
+ CACHE;
10
+ LOGGER;
11
+ REGISTRY;
12
+ TRANSFORMER;
13
+ /**
14
+ * Creates a new factory instance.
15
+ * @param {IBaseFactoryOptions<T>} options Factory creation options including registry, optional transformer, and logger.
16
+ */
17
+ constructor(options) {
18
+ this.REGISTRY = options.registry;
19
+ this.TRANSFORMER = options.transformer;
20
+ this.LOGGER = options.logger ?? new ConsoleLoggerService();
21
+ this.CACHE = new Map();
22
+ }
23
+ /**
24
+ * Clear the factory's item cache.
25
+ * This should be called when the registry changes to ensure the factory
26
+ * doesn't return stale items.
27
+ * @param {string} [name] Optional name of the item to clear from cache. If not provided, all items are cleared.
28
+ */
29
+ clearCache(name) {
30
+ if (name) {
31
+ this.CACHE.delete(name);
32
+ this.LOGGER.debug(`Cache cleared for item: ${name}`, { source: "Factory" });
33
+ }
34
+ else {
35
+ this.CACHE.clear();
36
+ this.LOGGER.debug("Factory cache cleared", { source: "Factory" });
37
+ }
38
+ }
39
+ /**
40
+ * Create an item by name.
41
+ * @param {string} name The name of the item to create.
42
+ * @returns {T} The created item.
43
+ * @throws RegistryItemNotFoundError if no item with the given name exists in the registry.
44
+ */
45
+ create(name) {
46
+ this.LOGGER.debug(`Creating item: ${name}`, { source: "Factory" });
47
+ const cachedItem = this.CACHE.get(name);
48
+ if (cachedItem) {
49
+ this.LOGGER.debug(`Retrieved item from cache: ${name}`, { source: "Factory" });
50
+ // eslint-disable-next-line @elsikora/node/no-unsupported-features/node-builtins
51
+ return structuredClone(cachedItem);
52
+ }
53
+ const template = this.REGISTRY.get(name);
54
+ if (!template) {
55
+ throw new BaseError("Template not found", {
56
+ code: "TEMPLATE_NOT_FOUND",
57
+ source: "Factory",
58
+ });
59
+ }
60
+ // eslint-disable-next-line @elsikora/node/no-unsupported-features/node-builtins
61
+ const result = this.TRANSFORMER ? this.TRANSFORMER(template) : structuredClone(template);
62
+ this.CACHE.set(name, result);
63
+ this.LOGGER.debug(`Created item: ${name}`, { source: "Factory" });
64
+ // eslint-disable-next-line @elsikora/node/no-unsupported-features/node-builtins
65
+ return structuredClone(result);
66
+ }
67
+ /**
68
+ * Get the registry associated with this factory.
69
+ * @returns {IRegistry<T>} The registry instance.
70
+ */
71
+ getRegistry() {
72
+ return this.REGISTRY;
73
+ }
74
+ }
75
+
76
+ export { BaseFactory };
77
+ //# sourceMappingURL=factory.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.class.js","sources":["../../../../../../src/infrastructure/class/base/factory.class.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AASA;;;AAGG;MACU,WAAW,CAAA;AACN,IAAA,KAAK;AAEL,IAAA,MAAM;AAEN,IAAA,QAAQ;AAER,IAAA,WAAW;AAE5B;;;AAGG;AACH,IAAA,WAAA,CAAY,OAA+B,EAAA;AAC1C,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAChC,QAAA,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW;QACtC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,oBAAoB,EAAE;AAC1D,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAa;;AAGlC;;;;;AAKG;AACI,IAAA,UAAU,CAAC,IAAa,EAAA;QAC9B,IAAI,IAAI,EAAE;AACT,YAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACvB,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAA2B,wBAAA,EAAA,IAAI,CAAE,CAAA,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;;aACrE;AACN,Y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jB,OAAO,IAAI,CAAC,QAAQ;;AAErB;;;;"}
@@ -0,0 +1,5 @@
1
+ export { BaseContainer } from "./container.class";
2
+ export { BaseError } from "./error.class";
3
+ export { BaseFactory } from "./factory.class";
4
+ export { BaseRegistry } from "./registry.class";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/infrastructure/class/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}