@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 ElsiKora
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,325 @@
1
+ <p align="center">
2
+ <img src="https://6jft62zmy9nx2oea.public.blob.vercel-storage.com/cladi-eBDDJPOc5fj21RO45PzAwrdkkqGCHi.png" width="500" alt="project-logo">
3
+ </p>
4
+
5
+ <h1 align="center">ClaDI 🧩</h1>
6
+ <p align="center"><em>ClaDI is a library for creating and managing classes in TypeScript</em></p>
7
+
8
+ <p align="center">
9
+ <a aria-label="ElsiKora logo" href="https://elsikora.com">
10
+ <img src="https://img.shields.io/badge/MADE%20BY%20ElsiKora-333333.svg?style=for-the-badge" alt="ElsiKora">
11
+ </a> <img src="https://img.shields.io/badge/typescript-blue.svg?style=for-the-badge&logo=typescript&logoColor=white" alt="typescript"> <img src="https://img.shields.io/badge/npm-red.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"> <img src="https://img.shields.io/badge/license-MIT-yellow.svg?style=for-the-badge&logo=license&logoColor=white" alt="license-MIT"> <img src="https://img.shields.io/badge/Node.js-green.svg?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"> <img src="https://img.shields.io/badge/ESM-orange.svg?style=for-the-badge&logo=javascript&logoColor=white" alt="ESM"> <img src="https://img.shields.io/badge/CJS-teal.svg?style=for-the-badge&logo=javascript&logoColor=white" alt="CJS"> <img src="https://img.shields.io/badge/zero-deps-brightgreen.svg?style=for-the-badge&logo=checkmarx&logoColor=white" alt="zero-deps">
12
+ </p>
13
+
14
+
15
+ ## 📚 Table of Contents
16
+ - [Description](#-description)
17
+ - [Features](#-features)
18
+ - [Installation](#-installation)
19
+ - [Usage](#-usage)
20
+ - [Roadmap](#-roadmap)
21
+ - [FAQ](#-faq)
22
+ - [License](#-license)
23
+
24
+
25
+ ## 📖 Description
26
+ ClaDI is a powerful TypeScript library that provides a robust foundation for building scalable applications through class-based dependency injection. With ClaDI, you can easily create, manage, and organize your application's classes and dependencies with a clean, modular architecture. The library offers a comprehensive set of tools for class instantiation, dependency registration, and lifecycle management, making it ideal for both small projects and enterprise-level applications. Whether you're building a simple utility or a complex system, ClaDI helps establish a solid architectural foundation with minimal overhead.
27
+
28
+ ## 🚀 Features
29
+ - ✨ **🚀 Zero dependencies - Lightweight footprint with no external runtime dependencies**
30
+ - ✨ **📦 Registry system - Store, retrieve, and manage class templates efficiently**
31
+ - ✨ **🏭 Factory pattern - Create class instances with automatic deep cloning**
32
+ - ✨ **💉 Dependency injection - Simple yet powerful container for managing application services**
33
+ - ✨ **🔄 Caching mechanism - Performance optimization for frequently used classes**
34
+ - ✨ **🧩 Modular architecture - Clean separation of concerns with domain, infrastructure, and presentation layers**
35
+ - ✨ **📝 Comprehensive logging - Built-in logging system with multiple log levels and context support**
36
+ - ✨ **🔌 Multiple format support - Works with both ESM and CommonJS module systems**
37
+ - ✨ **✅ Fully tested - Extensive unit and E2E test coverage ensures reliability**
38
+
39
+ ## 🛠 Installation
40
+ ```bash
41
+ # Using npm
42
+ npm install @elsikora/cladi
43
+
44
+ # Using yarn
45
+ yarn add @elsikora/cladi
46
+
47
+ # Using pnpm
48
+ pnpm add @elsikora/cladi
49
+
50
+ # Using bun
51
+ bun add @elsikora/cladi
52
+ ```
53
+
54
+ ## 💡 Usage
55
+ ## Basic Usage
56
+
57
+ The following example demonstrates how to create and use the core components of ClaDI:
58
+
59
+ ```typescript
60
+ import { createContainer, createFactory, createLogger, createRegistry, ELoggerLogLevel } from '@elsikora/cladi';
61
+
62
+ // Define a simple model with required 'name' property
63
+ interface User {
64
+ name: string;
65
+ email: string;
66
+ role: string;
67
+ }
68
+
69
+ // Create a logger
70
+ const logger = createLogger({
71
+ level: ELoggerLogLevel.DEBUG,
72
+ source: 'UserModule'
73
+ });
74
+
75
+ // Create a registry to store user templates
76
+ const registry = createRegistry<User>({ logger });
77
+
78
+ // Register user templates
79
+ registry.register({ name: 'admin', email: 'admin@example.com', role: 'admin' });
80
+ registry.register({ name: 'user', email: 'user@example.com', role: 'user' });
81
+
82
+ // Create a factory to instantiate users from templates
83
+ const factory = createFactory<User>({ registry, logger });
84
+
85
+ // Create a user instance (returns a deep clone of the template)
86
+ const adminUser = factory.create('admin');
87
+ console.log(adminUser); // { name: 'admin', email: 'admin@example.com', role: 'admin' }
88
+
89
+ // Modify instance (won't affect the original template)
90
+ adminUser.email = 'new-admin@example.com';
91
+ ```
92
+
93
+ ## Dependency Injection Container
94
+
95
+ Use the container to manage application services:
96
+
97
+ ```typescript
98
+ import { createContainer, ELoggerLogLevel, type ILogger } from '@elsikora/cladi';
99
+
100
+ // Create symbols for service identification
101
+ const LoggerToken = Symbol('Logger');
102
+ const DatabaseToken = Symbol('Database');
103
+
104
+ // Create a container
105
+ const container = createContainer({});
106
+
107
+ // Register services
108
+ container.register(LoggerToken, createLogger({
109
+ level: ELoggerLogLevel.INFO,
110
+ source: 'AppRoot'
111
+ }));
112
+
113
+ container.register(DatabaseToken, {
114
+ connect: () => console.log('Connected to database'),
115
+ query: (sql: string) => console.log(`Executing query: ${sql}`)
116
+ });
117
+
118
+ // Retrieve services
119
+ const logger = container.get<ILogger>(LoggerToken);
120
+ const db = container.get(DatabaseToken);
121
+
122
+ logger?.info('Application started');
123
+ db?.connect();
124
+ db?.query('SELECT * FROM users');
125
+ ```
126
+
127
+ ## Advanced Logging
128
+
129
+ The built-in logger provides extensive capabilities:
130
+
131
+ ```typescript
132
+ import { createLogger, ELoggerLogLevel } from '@elsikora/cladi';
133
+
134
+ const logger = createLogger({
135
+ level: ELoggerLogLevel.TRACE, // Most detailed logging level
136
+ source: 'PaymentService'
137
+ });
138
+
139
+ // Basic logging
140
+ logger.info('Processing payment');
141
+
142
+ // Logging with context data
143
+ logger.debug('Payment details received', {
144
+ context: {
145
+ paymentId: '12345',
146
+ amount: 99.99,
147
+ currency: 'USD'
148
+ }
149
+ });
150
+
151
+ // Method-specific source
152
+ logger.warn('Retry attempt required', {
153
+ source: 'PaymentGateway', // Will be combined with constructor source
154
+ context: {
155
+ attempt: 2,
156
+ maxAttempts: 3
157
+ }
158
+ });
159
+
160
+ // Sample output:
161
+ // [2023-07-15T12:34:56.789Z] INFO: [PaymentService] Processing payment
162
+ // [2023-07-15T12:34:56.790Z] DEBUG: [PaymentService] Payment details received {"paymentId":"12345","amount":99.99,"currency":"USD"}
163
+ // [2023-07-15T12:34:56.791Z] WARN: [PaymentService → PaymentGateway] Retry attempt required {"attempt":2,"maxAttempts":3}
164
+ ```
165
+
166
+ ## Core Factory Pattern
167
+
168
+ For more advanced scenarios, use the CoreFactory singleton:
169
+
170
+ ```typescript
171
+ import { CoreFactory, ELoggerLogLevel, type IRegistry, type IFactory, type IContainer } from '@elsikora/cladi';
172
+
173
+ // Create the core factory instance with options
174
+ const coreFactory = CoreFactory.getInstance({
175
+ logger: createLogger({
176
+ level: ELoggerLogLevel.INFO,
177
+ source: 'CoreFactory'
178
+ })
179
+ });
180
+
181
+ // Define a product model
182
+ interface Product {
183
+ name: string;
184
+ price: number;
185
+ inStock: boolean;
186
+ }
187
+
188
+ // Create infrastructure components
189
+ const productRegistry = coreFactory.createRegistry<Product>({});
190
+ const productFactory = coreFactory.createFactory<Product>({ registry: productRegistry });
191
+ const appContainer = coreFactory.createContainer({});
192
+
193
+ // Register product templates
194
+ productRegistry.register({ name: 'Basic Widget', price: 9.99, inStock: true });
195
+ productRegistry.register({ name: 'Premium Widget', price: 19.99, inStock: false });
196
+
197
+ // Create product instances
198
+ const basicWidget = productFactory.create('Basic Widget');
199
+ console.log(basicWidget); // { name: 'Basic Widget', price: 9.99, inStock: true }
200
+ ```
201
+
202
+ ## Custom Transformers
203
+
204
+ You can provide custom transformers to modify objects during instantiation:
205
+
206
+ ```typescript
207
+ import { createFactory, createRegistry } from '@elsikora/cladi';
208
+
209
+ interface OrderTemplate {
210
+ name: string;
211
+ basePrice: number;
212
+ discountPercent: number;
213
+ }
214
+
215
+ // Create registry and register templates
216
+ const orderRegistry = createRegistry<OrderTemplate>({});
217
+ orderRegistry.register({
218
+ name: 'standard',
219
+ basePrice: 100,
220
+ discountPercent: 0
221
+ });
222
+ orderRegistry.register({
223
+ name: 'sale',
224
+ basePrice: 100,
225
+ discountPercent: 20
226
+ });
227
+
228
+ // Custom transformer that adds calculated fields
229
+ const orderTransformer = (template: OrderTemplate) => {
230
+ const discount = template.basePrice * (template.discountPercent / 100);
231
+ return {
232
+ ...template,
233
+ discount,
234
+ finalPrice: template.basePrice - discount,
235
+ timestamp: new Date().toISOString()
236
+ };
237
+ };
238
+
239
+ // Create factory with custom transformer
240
+ const orderFactory = createFactory<ReturnType<typeof orderTransformer>>({
241
+ registry: orderRegistry as any,
242
+ transformer: orderTransformer
243
+ });
244
+
245
+ // Create instances with transformed properties
246
+ const standardOrder = orderFactory.create('standard');
247
+ console.log(standardOrder);
248
+ // {
249
+ // name: 'standard',
250
+ // basePrice: 100,
251
+ // discountPercent: 0,
252
+ // discount: 0,
253
+ // finalPrice: 100,
254
+ // timestamp: '2023-07-15T12:34:56.789Z'
255
+ // }
256
+
257
+ const saleOrder = orderFactory.create('sale');
258
+ console.log(saleOrder);
259
+ // {
260
+ // name: 'sale',
261
+ // basePrice: 100,
262
+ // discountPercent: 20,
263
+ // discount: 20,
264
+ // finalPrice: 80,
265
+ // timestamp: '2023-07-15T12:34:56.790Z'
266
+ // }
267
+ ```
268
+
269
+ ## 🛣 Roadmap
270
+ | Task / Feature | Status |
271
+ |----------------|--------|
272
+ | Core Registry implementation | ✅ Done |
273
+ | Core Factory implementation | ✅ Done |
274
+ | Dependency Injection Container | ✅ Done |
275
+ | Logging System | ✅ Done |
276
+ | Support for ESM and CJS modules | ✅ Done |
277
+ | Registry caching mechanism | ✅ Done |
278
+ | Factory deep cloning | ✅ Done |
279
+ | Custom transformers | ✅ Done |
280
+ | API documentation | 🚧 In Progress |
281
+ | Type safety improvements | 🚧 In Progress |
282
+ | Async factory support | 🚧 In Progress |
283
+ | Schema validation | 🚧 In Progress |
284
+ | Event system | 🚧 In Progress |
285
+ | Circular dependency detection | 🚧 In Progress |
286
+ | Lifecycle hooks | 🚧 In Progress |
287
+ | Lazy loading | 🚧 In Progress |
288
+ | Serialization/deserialization utilities | 🚧 In Progress |
289
+ | Performance benchmarks | 🚧 In Progress |
290
+ | Web framework integrations | 🚧 In Progress |
291
+
292
+ ## ❓ FAQ
293
+ ## Frequently Asked Questions
294
+
295
+ ### Is ClaDI suitable for small projects?
296
+ Yes, ClaDI is designed to be scalable for projects of all sizes. For small projects, you can use just the components you need, such as the Registry and Factory, without implementing the full dependency injection system.
297
+
298
+ ### How does ClaDI compare to other DI frameworks like InversifyJS or TypeDI?
299
+ ClaDI is more lightweight and focused, with zero external dependencies. It provides core building blocks rather than a full-featured DI framework. It's suitable for projects that need a clean, extensible foundation with minimal overhead.
300
+
301
+ ### Does ClaDI work with browser environments?
302
+ Yes, ClaDI is designed to work in both Node.js and browser environments. It's built with ES modules and also provides CommonJS compatibility.
303
+
304
+ ### How does the registry's caching mechanism work?
305
+ The registry implements an internal cache for `getAll()` and `getMany()` operations. When you register or unregister items, the cache is automatically cleared to ensure you always get fresh data.
306
+
307
+ ### Can I use ClaDI with React, Angular, or Vue?
308
+ Yes, ClaDI can be used with any frontend framework. It's framework-agnostic and provides core infrastructure that can be integrated into your component system.
309
+
310
+ ### How do I handle circular dependencies?
311
+ Currently, circular dependencies must be managed manually. However, the roadmap includes adding circular dependency detection to help identify and resolve these issues.
312
+
313
+ ### Is there a performance penalty for using the factory pattern?
314
+ The factory performs deep cloning of templates using `structuredClone()`, which has better performance than JSON serialization methods. For most applications, this overhead is negligible, and the benefits of immutability outweigh the performance cost.
315
+
316
+ ## 🔒 License
317
+ This project is licensed under **MIT License
318
+
319
+ Copyright (c) 2025 ElsiKora
320
+
321
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
322
+
323
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
324
+
325
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**.
@@ -0,0 +1,3 @@
1
+ export { ELoggerLogLevel } from "./logger-log-level.enum";
2
+ export { EServiceToken } from "./service-token.enum";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domain/enum/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Log levels.
3
+ */
4
+ export declare enum ELoggerLogLevel {
5
+ DEBUG = "debug",
6
+ ERROR = "error",
7
+ INFO = "info",
8
+ TRACE = "trace",
9
+ WARN = "warn"
10
+ }
11
+ //# sourceMappingURL=logger-log-level.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-log-level.enum.d.ts","sourceRoot":"","sources":["../../../../src/domain/enum/logger-log-level.enum.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,eAAe;IAC1B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACb"}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Log levels.
5
+ */
6
+ exports.ELoggerLogLevel = void 0;
7
+ (function (ELoggerLogLevel) {
8
+ ELoggerLogLevel["DEBUG"] = "debug";
9
+ ELoggerLogLevel["ERROR"] = "error";
10
+ ELoggerLogLevel["INFO"] = "info";
11
+ ELoggerLogLevel["TRACE"] = "trace";
12
+ ELoggerLogLevel["WARN"] = "warn";
13
+ })(exports.ELoggerLogLevel || (exports.ELoggerLogLevel = {}));
14
+ //# sourceMappingURL=logger-log-level.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-log-level.enum.js","sources":["../../../../../src/domain/enum/logger-log-level.enum.ts"],"sourcesContent":[null],"names":["ELoggerLogLevel"],"mappings":";;AAAA;;AAEG;AACSA;AAAZ,CAAA,UAAY,eAAe,EAAA;AAC1B,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,eAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACd,CAAC,EANWA,uBAAe,KAAfA,uBAAe,GAM1B,EAAA,CAAA,CAAA;;"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Service tokens for dependency injection.
3
+ */
4
+ export declare enum EServiceToken {
5
+ CONTAINER = "container",
6
+ FACTORY = "factory",
7
+ LOGGER = "logger",
8
+ REGISTRY = "registry"
9
+ }
10
+ //# sourceMappingURL=service-token.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-token.enum.d.ts","sourceRoot":"","sources":["../../../../src/domain/enum/service-token.enum.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,aAAa;IACxB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACrB"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Service tokens for dependency injection.
5
+ */
6
+ exports.EServiceToken = void 0;
7
+ (function (EServiceToken) {
8
+ EServiceToken["CONTAINER"] = "container";
9
+ EServiceToken["FACTORY"] = "factory";
10
+ EServiceToken["LOGGER"] = "logger";
11
+ EServiceToken["REGISTRY"] = "registry";
12
+ })(exports.EServiceToken || (exports.EServiceToken = {}));
13
+ //# sourceMappingURL=service-token.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-token.enum.js","sources":["../../../../../src/domain/enum/service-token.enum.ts"],"sourcesContent":[null],"names":["EServiceToken"],"mappings":";;AAAA;;AAEG;AACSA;AAAZ,CAAA,UAAY,aAAa,EAAA;AACxB,IAAA,aAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,aAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACtB,CAAC,EALWA,qBAAa,KAAbA,qBAAa,GAKxB,EAAA,CAAA,CAAA;;"}
@@ -0,0 +1,3 @@
1
+ export * from "./enum";
2
+ export type * from "./interface";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,mBAAmB,aAAa,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Simple dependency injection container interface.
3
+ */
4
+ export interface IContainer {
5
+ /**
6
+ * Clear all dependencies from the container.
7
+ */
8
+ clear(): void;
9
+ /**
10
+ * Get a dependency from the container.
11
+ * @param token Token that identifies the dependency.
12
+ * @returns The dependency, or undefined if it doesn't exist.
13
+ */
14
+ get<T>(token: symbol): T | undefined;
15
+ /**
16
+ * Get all dependencies from the container.
17
+ * @returns An array of all dependencies.
18
+ */
19
+ getAll(): Array<unknown>;
20
+ /**
21
+ * Get multiple dependencies from the container.
22
+ * @param tokens Tokens that identify the dependencies.
23
+ * @returns An array of dependencies.
24
+ */
25
+ getMany<T>(tokens: Array<symbol>): Array<T>;
26
+ /**
27
+ * Check if a dependency exists in the container.
28
+ * @param token Token that identifies the dependency.
29
+ * @returns True if the dependency exists, false otherwise.
30
+ */
31
+ has(token: symbol): boolean;
32
+ /**
33
+ * Register a dependency in the container.
34
+ * @param {symbol} token Token that identifies the dependency.
35
+ * @param {T} implementation Implementation of the dependency.
36
+ */
37
+ register<T>(token: symbol, implementation: T): void;
38
+ /**
39
+ * Register a dependency in the container.
40
+ * @param {Array<symbol>} tokens Tokens that identify the dependencies.
41
+ * @param {Record<symbol, T>} implementations Implementations of the dependencies.
42
+ */
43
+ registerMany<T>(tokens: Array<symbol>, implementations: Record<symbol, T>): void;
44
+ /**
45
+ * Unregister a dependency from the container.
46
+ * @param token Token that identifies the dependency.
47
+ */
48
+ unregister(token: symbol): void;
49
+ /**
50
+ * Unregister multiple dependencies from the container.
51
+ * @param tokens Tokens that identify the dependencies.
52
+ */
53
+ unregisterMany(tokens: Array<symbol>): void;
54
+ }
55
+ //# sourceMappingURL=container.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container.interface.d.ts","sourceRoot":"","sources":["../../../../src/domain/interface/container.interface.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IAErC;;;OAGG;IACH,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5C;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAEjF;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;OAGG;IACH,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC5C"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Standard error interface for all application errors.
3
+ */
4
+ export interface IError extends Error {
5
+ /**
6
+ * Original error that caused this error, if any.
7
+ */
8
+ CAUSE?: Error;
9
+ /**
10
+ * Error code to uniquely identify error types.
11
+ */
12
+ CODE: string;
13
+ /**
14
+ * Additional context about the error.
15
+ */
16
+ context?: Record<string, unknown>;
17
+ }
18
+ //# sourceMappingURL=error.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.interface.d.ts","sourceRoot":"","sources":["../../../../src/domain/interface/error.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAO,SAAQ,KAAK;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
@@ -0,0 +1,19 @@
1
+ import type { IRegistry } from "./registry.interface";
2
+ /**
3
+ * Generic factory interface for creating items by name.
4
+ * @template T The type of items created by the factory.
5
+ */
6
+ export interface IFactory<T> {
7
+ /**
8
+ * Create an item by name.
9
+ * @param name The name of the item to create.
10
+ * @returns The created item.
11
+ */
12
+ create(name: string): T;
13
+ /**
14
+ * Get the registry associated with this factory.
15
+ * @returns The registry instance.
16
+ */
17
+ getRegistry(): IRegistry<T>;
18
+ }
19
+ //# sourceMappingURL=factory.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.interface.d.ts","sourceRoot":"","sources":["../../../../src/domain/interface/factory.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC;IAExB;;;OAGG;IACH,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;CAC5B"}
@@ -0,0 +1,6 @@
1
+ export type { IContainer } from "./container.interface";
2
+ export type { IError } from "./error.interface";
3
+ export type { IFactory } from "./factory.interface";
4
+ export type * from "./logger/index";
5
+ export type { IRegistry } from "./registry.interface";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domain/interface/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,mBAAmB,gBAAgB,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { type ILogger } from "./interface";
2
+ export { type ILoggerMethodOptions } from "./method-options.interface";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/domain/interface/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -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"}