logiscout 1.0.1 → 1.0.4

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 (181) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +193 -0
  3. package/dist/cjs/api/Interceptor.cjs +66 -7
  4. package/dist/cjs/api/Interceptor.d.ts +4 -3
  5. package/dist/cjs/api/Interceptor.d.ts.map +1 -1
  6. package/dist/cjs/api/LogApi.cjs +2 -6
  7. package/dist/cjs/api/LogApi.d.ts +2 -3
  8. package/dist/cjs/api/LogApi.d.ts.map +1 -1
  9. package/dist/cjs/core/constants/Levels/LevelsColors.cjs +11 -0
  10. package/dist/cjs/core/constants/Levels/LevelsColors.d.ts +3 -0
  11. package/dist/cjs/core/constants/Levels/LevelsColors.d.ts.map +1 -0
  12. package/dist/cjs/core/constants/Levels/LevelsSeverity.cjs +11 -0
  13. package/dist/cjs/core/constants/Levels/LevelsSeverity.d.ts +3 -0
  14. package/dist/cjs/core/constants/Levels/LevelsSeverity.d.ts.map +1 -0
  15. package/dist/cjs/core/context/RequestContext.cjs +4 -14
  16. package/dist/cjs/core/context/RequestContext.d.ts +0 -3
  17. package/dist/cjs/core/context/RequestContext.d.ts.map +1 -1
  18. package/dist/cjs/core/enum/LogPayLoads.cjs +8 -0
  19. package/dist/cjs/core/enum/LogPayLoads.d.ts +5 -0
  20. package/dist/cjs/core/enum/LogPayLoads.d.ts.map +1 -0
  21. package/dist/cjs/core/formatters/winston/FormatLogs.cjs +18 -0
  22. package/dist/cjs/core/formatters/winston/FormatLogs.d.ts +3 -0
  23. package/dist/cjs/core/formatters/winston/FormatLogs.d.ts.map +1 -0
  24. package/dist/cjs/core/interface/CorrelationSession.cjs +2 -0
  25. package/dist/cjs/core/interface/CorrelationSession.d.ts +32 -0
  26. package/dist/cjs/core/interface/CorrelationSession.d.ts.map +1 -0
  27. package/dist/cjs/core/interface/JsonzierConfig.cjs +2 -0
  28. package/dist/cjs/core/interface/JsonzierConfig.d.ts +6 -0
  29. package/dist/cjs/core/interface/JsonzierConfig.d.ts.map +1 -0
  30. package/dist/cjs/core/interface/RequestContext.cjs +2 -0
  31. package/dist/cjs/core/interface/RequestContext.d.ts +4 -0
  32. package/dist/cjs/core/interface/RequestContext.d.ts.map +1 -0
  33. package/dist/cjs/core/interface/payloads/Payloads.cjs +2 -0
  34. package/dist/cjs/core/interface/payloads/Payloads.d.ts +11 -0
  35. package/dist/cjs/core/interface/payloads/Payloads.d.ts.map +1 -0
  36. package/dist/cjs/core/store/CorrelationStore.cjs +29 -0
  37. package/dist/cjs/core/store/CorrelationStore.d.ts +5 -0
  38. package/dist/cjs/core/store/CorrelationStore.d.ts.map +1 -0
  39. package/dist/cjs/core/types/LogEntry.d.ts +1 -0
  40. package/dist/cjs/core/types/LogEntry.d.ts.map +1 -1
  41. package/dist/cjs/errors/ThrowError.cjs +6 -0
  42. package/dist/cjs/errors/ThrowError.d.ts +2 -0
  43. package/dist/cjs/errors/ThrowError.d.ts.map +1 -0
  44. package/dist/cjs/index.cjs +13 -2
  45. package/dist/cjs/index.d.ts +1 -0
  46. package/dist/cjs/index.d.ts.map +1 -1
  47. package/dist/cjs/init.cjs +13 -0
  48. package/dist/cjs/init.d.ts +3 -0
  49. package/dist/cjs/init.d.ts.map +1 -0
  50. package/dist/cjs/initiator/state.cjs +17 -0
  51. package/dist/cjs/initiator/state.d.ts +8 -0
  52. package/dist/cjs/initiator/state.d.ts.map +1 -0
  53. package/dist/cjs/middlewares/correlationMiddleware.cjs +29 -63
  54. package/dist/cjs/middlewares/correlationMiddleware.d.ts +1 -16
  55. package/dist/cjs/middlewares/correlationMiddleware.d.ts.map +1 -1
  56. package/dist/cjs/services/Levels/Levels.cjs +10 -10
  57. package/dist/cjs/services/Levels/Levels.d.ts +15 -5
  58. package/dist/cjs/services/Levels/Levels.d.ts.map +1 -1
  59. package/dist/cjs/services/Logger/Logger.cjs +59 -114
  60. package/dist/cjs/services/Logger/Logger.d.ts +10 -2
  61. package/dist/cjs/services/Logger/Logger.d.ts.map +1 -1
  62. package/dist/cjs/services/formatters/ConsoleFormatter.cjs +30 -0
  63. package/dist/cjs/services/formatters/ConsoleFormatter.d.ts +12 -0
  64. package/dist/cjs/services/formatters/ConsoleFormatter.d.ts.map +1 -0
  65. package/dist/cjs/services/processors/Jsonizer.cjs +31 -0
  66. package/dist/cjs/services/processors/Jsonizer.d.ts +11 -0
  67. package/dist/cjs/services/processors/Jsonizer.d.ts.map +1 -0
  68. package/dist/cjs/services/transporter/ConsoleTranspoter.cjs +16 -0
  69. package/dist/cjs/services/transporter/ConsoleTranspoter.d.ts +5 -0
  70. package/dist/cjs/services/transporter/ConsoleTranspoter.d.ts.map +1 -0
  71. package/dist/cjs/services/transporter/ServerTransporter.cjs +31 -0
  72. package/dist/cjs/services/transporter/ServerTransporter.d.ts +10 -0
  73. package/dist/cjs/services/transporter/ServerTransporter.d.ts.map +1 -0
  74. package/dist/cjs/utils/GenerateCorrelationId.cjs +10 -0
  75. package/dist/cjs/utils/GenerateCorrelationId.d.ts +2 -0
  76. package/dist/cjs/utils/GenerateCorrelationId.d.ts.map +1 -0
  77. package/dist/cjs/validator/ValidateComponentName.cjs +14 -0
  78. package/dist/cjs/validator/ValidateComponentName.d.ts +2 -0
  79. package/dist/cjs/validator/ValidateComponentName.d.ts.map +1 -0
  80. package/dist/cjs/validator/ValidateLogEntry.cjs +18 -0
  81. package/dist/cjs/validator/ValidateLogEntry.d.ts +3 -0
  82. package/dist/cjs/validator/ValidateLogEntry.d.ts.map +1 -0
  83. package/dist/cjs/validator/ValidateLogLevel.cjs +11 -0
  84. package/dist/cjs/validator/ValidateLogLevel.d.ts +2 -0
  85. package/dist/cjs/validator/ValidateLogLevel.d.ts.map +1 -0
  86. package/dist/cjs/validator/ValidateLogMessage.cjs +10 -0
  87. package/dist/cjs/validator/ValidateLogMessage.d.ts +2 -0
  88. package/dist/cjs/validator/ValidateLogMessage.d.ts.map +1 -0
  89. package/dist/cjs/validator/ValidateRequestContext.cjs +18 -0
  90. package/dist/cjs/validator/ValidateRequestContext.d.ts +2 -0
  91. package/dist/cjs/validator/ValidateRequestContext.d.ts.map +1 -0
  92. package/dist/esm/api/Interceptor.d.ts +4 -3
  93. package/dist/esm/api/Interceptor.d.ts.map +1 -1
  94. package/dist/esm/api/Interceptor.js +64 -7
  95. package/dist/esm/api/LogApi.d.ts +2 -3
  96. package/dist/esm/api/LogApi.d.ts.map +1 -1
  97. package/dist/esm/api/LogApi.js +2 -3
  98. package/dist/esm/core/constants/Levels/LevelsColors.d.ts +3 -0
  99. package/dist/esm/core/constants/Levels/LevelsColors.d.ts.map +1 -0
  100. package/dist/esm/core/constants/Levels/LevelsColors.js +8 -0
  101. package/dist/esm/core/constants/Levels/LevelsSeverity.d.ts +3 -0
  102. package/dist/esm/core/constants/Levels/LevelsSeverity.d.ts.map +1 -0
  103. package/dist/esm/core/constants/Levels/LevelsSeverity.js +8 -0
  104. package/dist/esm/core/context/RequestContext.d.ts +0 -3
  105. package/dist/esm/core/context/RequestContext.d.ts.map +1 -1
  106. package/dist/esm/core/context/RequestContext.js +4 -14
  107. package/dist/esm/core/enum/LogPayLoads.d.ts +5 -0
  108. package/dist/esm/core/enum/LogPayLoads.d.ts.map +1 -0
  109. package/dist/esm/core/enum/LogPayLoads.js +5 -0
  110. package/dist/esm/core/formatters/winston/FormatLogs.d.ts +3 -0
  111. package/dist/esm/core/formatters/winston/FormatLogs.d.ts.map +1 -0
  112. package/dist/esm/core/formatters/winston/FormatLogs.js +15 -0
  113. package/dist/esm/core/interface/CorrelationSession.d.ts +32 -0
  114. package/dist/esm/core/interface/CorrelationSession.d.ts.map +1 -0
  115. package/dist/esm/core/interface/CorrelationSession.js +1 -0
  116. package/dist/esm/core/interface/JsonzierConfig.d.ts +6 -0
  117. package/dist/esm/core/interface/JsonzierConfig.d.ts.map +1 -0
  118. package/dist/esm/core/interface/JsonzierConfig.js +1 -0
  119. package/dist/esm/core/interface/RequestContext.d.ts +4 -0
  120. package/dist/esm/core/interface/RequestContext.d.ts.map +1 -0
  121. package/dist/esm/core/interface/RequestContext.js +1 -0
  122. package/dist/esm/core/interface/payloads/Payloads.d.ts +11 -0
  123. package/dist/esm/core/interface/payloads/Payloads.d.ts.map +1 -0
  124. package/dist/esm/core/interface/payloads/Payloads.js +1 -0
  125. package/dist/esm/core/store/CorrelationStore.d.ts +5 -0
  126. package/dist/esm/core/store/CorrelationStore.d.ts.map +1 -0
  127. package/dist/esm/core/store/CorrelationStore.js +24 -0
  128. package/dist/esm/core/types/LogEntry.d.ts +1 -0
  129. package/dist/esm/core/types/LogEntry.d.ts.map +1 -1
  130. package/dist/esm/errors/ThrowError.d.ts +2 -0
  131. package/dist/esm/errors/ThrowError.d.ts.map +1 -0
  132. package/dist/esm/errors/ThrowError.js +3 -0
  133. package/dist/esm/index.d.ts +1 -0
  134. package/dist/esm/index.d.ts.map +1 -1
  135. package/dist/esm/index.js +11 -1
  136. package/dist/esm/init.d.ts +3 -0
  137. package/dist/esm/init.d.ts.map +1 -0
  138. package/dist/esm/init.js +10 -0
  139. package/dist/esm/initiator/state.d.ts +8 -0
  140. package/dist/esm/initiator/state.d.ts.map +1 -0
  141. package/dist/esm/initiator/state.js +13 -0
  142. package/dist/esm/middlewares/correlationMiddleware.d.ts +1 -16
  143. package/dist/esm/middlewares/correlationMiddleware.d.ts.map +1 -1
  144. package/dist/esm/middlewares/correlationMiddleware.js +28 -58
  145. package/dist/esm/services/Levels/Levels.d.ts +15 -5
  146. package/dist/esm/services/Levels/Levels.d.ts.map +1 -1
  147. package/dist/esm/services/Levels/Levels.js +10 -10
  148. package/dist/esm/services/Logger/Logger.d.ts +10 -2
  149. package/dist/esm/services/Logger/Logger.d.ts.map +1 -1
  150. package/dist/esm/services/Logger/Logger.js +56 -81
  151. package/dist/esm/services/formatters/ConsoleFormatter.d.ts +12 -0
  152. package/dist/esm/services/formatters/ConsoleFormatter.d.ts.map +1 -0
  153. package/dist/esm/services/formatters/ConsoleFormatter.js +26 -0
  154. package/dist/esm/services/processors/Jsonizer.d.ts +11 -0
  155. package/dist/esm/services/processors/Jsonizer.d.ts.map +1 -0
  156. package/dist/esm/services/processors/Jsonizer.js +27 -0
  157. package/dist/esm/services/transporter/ConsoleTranspoter.d.ts +5 -0
  158. package/dist/esm/services/transporter/ConsoleTranspoter.d.ts.map +1 -0
  159. package/dist/esm/services/transporter/ConsoleTranspoter.js +9 -0
  160. package/dist/esm/services/transporter/ServerTransporter.d.ts +10 -0
  161. package/dist/esm/services/transporter/ServerTransporter.d.ts.map +1 -0
  162. package/dist/esm/services/transporter/ServerTransporter.js +27 -0
  163. package/dist/esm/utils/GenerateCorrelationId.d.ts +2 -0
  164. package/dist/esm/utils/GenerateCorrelationId.d.ts.map +1 -0
  165. package/dist/esm/utils/GenerateCorrelationId.js +4 -0
  166. package/dist/esm/validator/ValidateComponentName.d.ts +2 -0
  167. package/dist/esm/validator/ValidateComponentName.d.ts.map +1 -0
  168. package/dist/esm/validator/ValidateComponentName.js +11 -0
  169. package/dist/esm/validator/ValidateLogEntry.d.ts +3 -0
  170. package/dist/esm/validator/ValidateLogEntry.d.ts.map +1 -0
  171. package/dist/esm/validator/ValidateLogEntry.js +15 -0
  172. package/dist/esm/validator/ValidateLogLevel.d.ts +2 -0
  173. package/dist/esm/validator/ValidateLogLevel.d.ts.map +1 -0
  174. package/dist/esm/validator/ValidateLogLevel.js +8 -0
  175. package/dist/esm/validator/ValidateLogMessage.d.ts +2 -0
  176. package/dist/esm/validator/ValidateLogMessage.d.ts.map +1 -0
  177. package/dist/esm/validator/ValidateLogMessage.js +7 -0
  178. package/dist/esm/validator/ValidateRequestContext.d.ts +2 -0
  179. package/dist/esm/validator/ValidateRequestContext.d.ts.map +1 -0
  180. package/dist/esm/validator/ValidateRequestContext.js +15 -0
  181. package/package.json +5 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Jsonizer.d.ts","sourceRoot":"","sources":["../../../../src/services/processors/Jsonizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAKxD,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,MAAM,EAAE,cAAc;IAM3B,SAAS,CACd,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,QAAQ,GACd,kBAAkB;CAkBtB"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ConsoleTransporter = void 0;
7
+ const winston_1 = require("winston");
8
+ const FormatLogs_js_1 = __importDefault(require("../../core/formatters/winston/FormatLogs.cjs"));
9
+ class ConsoleTransporter {
10
+ transport() {
11
+ return new winston_1.transports.Console({
12
+ format: (0, FormatLogs_js_1.default)(),
13
+ });
14
+ }
15
+ }
16
+ exports.ConsoleTransporter = ConsoleTransporter;
@@ -0,0 +1,5 @@
1
+ import { transport } from "winston";
2
+ export declare class ConsoleTransporter {
3
+ transport(): transport;
4
+ }
5
+ //# sourceMappingURL=ConsoleTranspoter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleTranspoter.d.ts","sourceRoot":"","sources":["../../../../src/services/transporter/ConsoleTranspoter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAE,MAAM,SAAS,CAAC;AAGhD,qBAAa,kBAAkB;IAC7B,SAAS,IAAI,SAAS;CAKvB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerTransporter = void 0;
4
+ const LogApi_js_1 = require("../../api/LogApi.cjs");
5
+ const LogPayLoads_js_1 = require("../../core/enum/LogPayLoads.cjs");
6
+ class ServerTransporter {
7
+ transport(session) {
8
+ if (this.isFrontendSession(session)) {
9
+ this.sendSingle(session);
10
+ return;
11
+ }
12
+ this.sendCorrelation(session);
13
+ }
14
+ sendCorrelation(session) {
15
+ (0, LogApi_js_1.LogApi)({
16
+ type: LogPayLoads_js_1.LogPayloadType.SESSION,
17
+ data: session,
18
+ });
19
+ }
20
+ sendSingle(session) {
21
+ (0, LogApi_js_1.LogApi)({
22
+ type: LogPayLoads_js_1.LogPayloadType.SINGLE,
23
+ data: session,
24
+ });
25
+ }
26
+ isFrontendSession(session) {
27
+ // Decide ONLY based on session shape/data
28
+ return session.correlationId === "no-correlation-id";
29
+ }
30
+ }
31
+ exports.ServerTransporter = ServerTransporter;
@@ -0,0 +1,10 @@
1
+ import { CorrelationSession, NonCorrelationSession } from "../../core/interface/CorrelationSession.js";
2
+ type AnySession = CorrelationSession | NonCorrelationSession;
3
+ export declare class ServerTransporter {
4
+ transport(session: AnySession): void;
5
+ private sendCorrelation;
6
+ private sendSingle;
7
+ private isFrontendSession;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=ServerTransporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ServerTransporter.d.ts","sourceRoot":"","sources":["../../../../src/services/transporter/ServerTransporter.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,4CAA4C,CAAC;AAEpD,KAAK,UAAU,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAE7D,qBAAa,iBAAiB;IAC5B,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IASpC,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,iBAAiB;CAM1B"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateCorrelationId = generateCorrelationId;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ function generateCorrelationId(projectName, componentName) {
9
+ return `${projectName}-${componentName}-${crypto_1.default.randomUUID()}`;
10
+ }
@@ -0,0 +1,2 @@
1
+ export declare function generateCorrelationId(projectName: string, componentName: string): string;
2
+ //# sourceMappingURL=GenerateCorrelationId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerateCorrelationId.d.ts","sourceRoot":"","sources":["../../../src/utils/GenerateCorrelationId.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CAER"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = validateComponentName;
4
+ const ThrowError_js_1 = require("../errors/ThrowError.cjs");
5
+ function validateComponentName(componentName) {
6
+ if (!componentName || typeof componentName !== "string") {
7
+ (0, ThrowError_js_1.throwError)("Logger: Component name must be a non-empty string. " +
8
+ "Usage: createLogger('ComponentName')");
9
+ }
10
+ if (componentName.length > 100) {
11
+ (0, ThrowError_js_1.throwError)("Logger: Component name cannot exceed 100 characters. " +
12
+ `Received: '${componentName.substring(0, 20)}...'`);
13
+ }
14
+ }
@@ -0,0 +1,2 @@
1
+ export default function validateComponentName(componentName: string): void;
2
+ //# sourceMappingURL=ValidateComponentName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateComponentName.d.ts","sourceRoot":"","sources":["../../../src/validator/ValidateComponentName.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,aAAa,EAAC,MAAM,QAajE"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = validateLogEntry;
4
+ const ThrowError_js_1 = require("../errors/ThrowError.cjs");
5
+ function validateLogEntry(entry) {
6
+ if (!entry) {
7
+ (0, ThrowError_js_1.throwError)("[Logiscout] Log entry is undefined or null");
8
+ }
9
+ if (!entry.message || typeof entry.message !== "string") {
10
+ (0, ThrowError_js_1.throwError)("[Logiscout] Log message must be a non-empty string. " +
11
+ `Usage: logiscout.${entry.level}('Your message', { meta })`);
12
+ }
13
+ if (entry.message.length > 10000) {
14
+ console.error("[Logiscout] Log message exceeds 10000 characters. Message truncated.");
15
+ entry.message =
16
+ entry.message.substring(0, 10000) + "... [truncated]";
17
+ }
18
+ }
@@ -0,0 +1,3 @@
1
+ import { LogEntry } from "../core/types/LogEntry.js";
2
+ export default function validateLogEntry(entry: LogEntry): void;
3
+ //# sourceMappingURL=ValidateLogEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateLogEntry.d.ts","sourceRoot":"","sources":["../../../src/validator/ValidateLogEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAoB9D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = validateLogLevel;
4
+ const LogLevels_js_1 = require("../core/enum/LogLevels.cjs");
5
+ const ThrowError_js_1 = require("../errors/ThrowError.cjs");
6
+ function validateLogLevel(logLevel) {
7
+ if (!Object.values(LogLevels_js_1.LogLevels).includes(logLevel)) {
8
+ (0, ThrowError_js_1.throwError)(`Logger: Invalid log level '${logLevel}'. ` +
9
+ `Valid levels: ${Object.values(LogLevels_js_1.LogLevels).join(", ")}`);
10
+ }
11
+ }
@@ -0,0 +1,2 @@
1
+ export default function validateLogLevel(logLevel: any): void;
2
+ //# sourceMappingURL=ValidateLogLevel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateLogLevel.d.ts","sourceRoot":"","sources":["../../../src/validator/ValidateLogLevel.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI,CAO5D"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = validateLogMessage;
4
+ const ThrowError_js_1 = require("../errors/ThrowError.cjs");
5
+ function validateLogMessage(message) {
6
+ if (!message || typeof message !== "string") {
7
+ (0, ThrowError_js_1.throwError)(`Logger: Message must be a non-empty string. ` +
8
+ `Received: ${typeof message === "undefined" ? "undefined" : typeof message}`);
9
+ }
10
+ }
@@ -0,0 +1,2 @@
1
+ export default function validateLogMessage(message: string): void;
2
+ //# sourceMappingURL=ValidateLogMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateLogMessage.d.ts","sourceRoot":"","sources":["../../../src/validator/ValidateLogMessage.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAShE"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateRequestContext = validateRequestContext;
4
+ const ThrowError_js_1 = require("../errors/ThrowError.cjs");
5
+ function validateRequestContext(fn, correlationId) {
6
+ if (typeof fn !== "function") {
7
+ (0, ThrowError_js_1.throwError)("RequestContext.run() requires a function as the first parameter. " +
8
+ "Usage: RequestContext.run(() => { ... }, correlationId?)");
9
+ }
10
+ // Validate correlationId if provided
11
+ if (correlationId !== undefined && typeof correlationId !== "string") {
12
+ (0, ThrowError_js_1.throwError)("RequestContext.run(): correlationId must be a string if provided. " +
13
+ `Received: ${typeof correlationId}`);
14
+ }
15
+ if (correlationId && correlationId.length > 100) {
16
+ (0, ThrowError_js_1.throwError)("RequestContext.run(): correlationId cannot exceed 100 characters.");
17
+ }
18
+ }
@@ -0,0 +1,2 @@
1
+ export declare function validateRequestContext(fn: () => void, correlationId: string | undefined): void;
2
+ //# sourceMappingURL=ValidateRequestContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateRequestContext.d.ts","sourceRoot":"","sources":["../../../src/validator/ValidateRequestContext.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,IAAI,EACd,aAAa,EAAE,MAAM,GAAC,SAAS,GAC9B,IAAI,CAqBN"}
@@ -1,4 +1,5 @@
1
- import { AxiosInstance } from "axios";
2
- declare const HTTP: AxiosInstance;
3
- export default HTTP;
1
+ declare let IMAGE_BASE_URL: string;
2
+ declare let APP_URL: string;
3
+ export { IMAGE_BASE_URL, APP_URL };
4
+ export declare const HTTP: import("axios").AxiosInstance;
4
5
  //# sourceMappingURL=Interceptor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Interceptor.d.ts","sourceRoot":"","sources":["../../../src/api/Interceptor.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,aAOV,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Interceptor.d.ts","sourceRoot":"","sources":["../../../src/api/Interceptor.ts"],"names":[],"mappings":"AAMA,QAAA,IAAI,cAAc,QAAK,CAAC;AACxB,QAAA,IAAI,OAAO,QAAK,CAAC;AAUjB,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AAUnC,eAAO,MAAM,IAAI,+BAIf,CAAC"}
@@ -1,10 +1,67 @@
1
1
  import axios from "axios";
2
- const HTTP = axios.create({
3
- baseURL: "http://127.0.0.1:3000/api/",
4
- headers: {
5
- "Content-Type": "application/json",
6
- Accept: "application/json",
7
- },
2
+ // Determine the environment and set base URLs
3
+ const environment = "local";
4
+ console.log("Environment:", environment);
5
+ let IMAGE_BASE_URL = "";
6
+ let APP_URL = "";
7
+ if (environment === "local") {
8
+ APP_URL = "https://practice-backend-new.thedoclinq.com/api/";
9
+ }
10
+ else if (environment === "prod") {
11
+ APP_URL = "https://practicebackend-uat.thedoclinq.com/api/";
12
+ }
13
+ else {
14
+ APP_URL = "http://127.0.0.1:8000/logs/";
15
+ }
16
+ export { IMAGE_BASE_URL, APP_URL };
17
+ // Axios base config
18
+ const baseURL = `${APP_URL}`;
19
+ const headers = {
20
+ accept: "application/json",
21
+ "Content-Type": "application/json",
22
+ };
23
+ // Create instance
24
+ export const HTTP = axios.create({
25
+ baseURL,
26
+ headers,
8
27
  withCredentials: false,
9
28
  });
10
- export default HTTP;
29
+ // // Token getter (matches Postman `auth_token`)
30
+ // const getToken = () => {
31
+ // if (typeof window !== "undefined") {
32
+ // return (
33
+ // localStorage.getItem("auth_token") ||
34
+ // localStorage.getItem("token") ||
35
+ // localStorage.getItem("clientaccesstoken")
36
+ // );
37
+ // }
38
+ // // 👇 Hardcoded fallback for build time or SSR
39
+ // return "2|G3Y7woZ55m7W0vHHm0UZbTGO34i1bQJRsLUQqPEY04c662f9";
40
+ // };
41
+ // // Request interceptor for attaching Authorization header
42
+ // HTTP.interceptors.request.use(
43
+ // (config) => {
44
+ // const token = getToken();
45
+ // if (token) {
46
+ // config.headers["Authorization"] = `Bearer ${token}`;
47
+ // }
48
+ // return config;
49
+ // },
50
+ // (error) => Promise.reject(error)
51
+ // );
52
+ // // Response interceptor for handling 401 unauthorized
53
+ // HTTP.interceptors.response.use(
54
+ // (response) => response,
55
+ // (error) => {
56
+ // if (error.response?.status === 401 || message === "Unauthenticated.") {
57
+ // console.error("Unauthorized, redirecting to login...");
58
+ // localStorage.removeItem("auth_token");
59
+ // localStorage.removeItem("token");
60
+ // localStorage.removeItem("clientaccesstoken");
61
+ // localStorage.removeItem("healthcare_user");
62
+ // window.location.reload();
63
+ // // window.location.href = "/doctor-signin";
64
+ // }
65
+ // return Promise.reject(error);
66
+ // }
67
+ // );
@@ -1,6 +1,5 @@
1
- interface LogPayload {
2
- logs: unknown;
3
- }
1
+ import { BackendLogPayload, FrontendLogPayload } from "../core/interface/payloads/Payloads.js";
2
+ type LogPayload = BackendLogPayload | FrontendLogPayload;
4
3
  export declare function LogApi(data: LogPayload): Promise<void>;
5
4
  export {};
6
5
  //# sourceMappingURL=LogApi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogApi.d.ts","sourceRoot":"","sources":["../../../src/api/LogApi.ts"],"names":[],"mappings":"AAEA,UAAU,UAAU;IAClB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAO5D"}
1
+ {"version":3,"file":"LogApi.d.ts","sourceRoot":"","sources":["../../../src/api/LogApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,wCAAwC,CAAC;AAIhD,KAAK,UAAU,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AACzD,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAO5D"}
@@ -1,8 +1,7 @@
1
- import HTTP from "./Interceptor.js";
2
1
  export async function LogApi(data) {
3
2
  try {
4
- const response = await HTTP.post("/log", data);
5
- console.log("Log sent successfully:", response.status);
3
+ // console.log(data);
4
+ // const response = await HTTP.post("/log", data);
6
5
  }
7
6
  catch (error) {
8
7
  console.error("Failed to send log:", error);
@@ -0,0 +1,3 @@
1
+ import { LogLevels } from "../../enum/LogLevels.js";
2
+ export declare const LEVEL_COLORS: Record<LogLevels, string>;
3
+ //# sourceMappingURL=LevelsColors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LevelsColors.d.ts","sourceRoot":"","sources":["../../../../../src/core/constants/Levels/LevelsColors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMlD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { LogLevels } from "../../enum/LogLevels.js";
2
+ export const LEVEL_COLORS = {
3
+ [LogLevels.DEBUG]: "\x1b[90m", // gray
4
+ [LogLevels.INFO]: "\x1b[32m", // green
5
+ [LogLevels.WARN]: "\x1b[33m", // yellow
6
+ [LogLevels.ERROR]: "\x1b[31m", // red
7
+ [LogLevels.CRITICAL]: "\x1b[35m" // magenta
8
+ };
@@ -0,0 +1,3 @@
1
+ import { LogLevels } from "../../enum/LogLevels.js";
2
+ export declare const LOG_LEVEL_SEVERITY: Record<LogLevels, number>;
3
+ //# sourceMappingURL=LevelsSeverity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LevelsSeverity.d.ts","sourceRoot":"","sources":["../../../../../src/core/constants/Levels/LevelsSeverity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAM/C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { LogLevels } from "../../enum/LogLevels.js";
2
+ export const LOG_LEVEL_SEVERITY = {
3
+ [LogLevels.CRITICAL]: 0,
4
+ [LogLevels.ERROR]: 1,
5
+ [LogLevels.WARN]: 2,
6
+ [LogLevels.INFO]: 3,
7
+ [LogLevels.DEBUG]: 4,
8
+ };
@@ -1,6 +1,3 @@
1
- export interface RequestContextData {
2
- correlationId: string;
3
- }
4
1
  export declare class RequestContext {
5
2
  static run(fn: () => void, correlationId?: string): void;
6
3
  static getCorrelationId(): string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../../../../src/core/context/RequestContext.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB;AAID,qBAAa,cAAc;IACzB,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IA0CxD,MAAM,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;CAc9C"}
1
+ {"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../../../../src/core/context/RequestContext.ts"],"names":[],"mappings":"AAUA,qBAAa,cAAc;IACzB,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAuBxD,MAAM,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;CAc9C"}
@@ -1,21 +1,11 @@
1
1
  import { AsyncLocalStorage } from "async_hooks";
2
2
  import { randomUUID } from "crypto";
3
+ import { throwError } from "../../errors/ThrowError.js";
4
+ import { validateRequestContext } from "../../validator/ValidateRequestContext.js";
3
5
  const storage = new AsyncLocalStorage();
4
6
  export class RequestContext {
5
7
  static run(fn, correlationId) {
6
- // Validate function parameter
7
- if (typeof fn !== "function") {
8
- throw new Error("RequestContext.run() requires a function as the first parameter. " +
9
- "Usage: RequestContext.run(() => { ... }, correlationId?)");
10
- }
11
- // Validate correlationId if provided
12
- if (correlationId !== undefined && typeof correlationId !== "string") {
13
- throw new Error("RequestContext.run(): correlationId must be a string if provided. " +
14
- `Received: ${typeof correlationId}`);
15
- }
16
- if (correlationId && correlationId.length > 100) {
17
- throw new Error("RequestContext.run(): correlationId cannot exceed 100 characters.");
18
- }
8
+ validateRequestContext(fn, correlationId);
19
9
  // Generate UUID if not provided
20
10
  const id = correlationId ?? randomUUID();
21
11
  try {
@@ -24,7 +14,7 @@ export class RequestContext {
24
14
  }, fn);
25
15
  }
26
16
  catch (error) {
27
- throw new Error(`RequestContext.run(): Failed to run function in context. ${error instanceof Error ? error.message : "Unknown error"}`);
17
+ throwError(`RequestContext.run(): Failed to run function in context. ${error instanceof Error ? error.message : "Unknown error"}`);
28
18
  }
29
19
  }
30
20
  static getCorrelationId() {
@@ -0,0 +1,5 @@
1
+ export declare enum LogPayloadType {
2
+ SESSION = "session",
3
+ SINGLE = "single"
4
+ }
5
+ //# sourceMappingURL=LogPayLoads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogPayLoads.d.ts","sourceRoot":"","sources":["../../../../src/core/enum/LogPayLoads.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB"}
@@ -0,0 +1,5 @@
1
+ export var LogPayloadType;
2
+ (function (LogPayloadType) {
3
+ LogPayloadType["SESSION"] = "session";
4
+ LogPayloadType["SINGLE"] = "single";
5
+ })(LogPayloadType || (LogPayloadType = {}));
@@ -0,0 +1,3 @@
1
+ import winston from "winston";
2
+ export default function formatLogs(): winston.Logform.Format;
3
+ //# sourceMappingURL=FormatLogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormatLogs.d.ts","sourceRoot":"","sources":["../../../../../src/core/formatters/winston/FormatLogs.ts"],"names":[],"mappings":"AAAA,OAAO,OAAwD,MAAM,SAAS,CAAC;AAK/E,MAAM,CAAC,OAAO,UAAU,UAAU,2BAejC"}
@@ -0,0 +1,15 @@
1
+ import { format } from "winston";
2
+ import { ConsoleFormatter } from "../../../services/formatters/ConsoleFormatter.js";
3
+ const consoleFormatter = new ConsoleFormatter();
4
+ export default function formatLogs() {
5
+ return format.combine(format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), format.printf(({ timestamp, level, message, component, ...meta }) => {
6
+ const formatted = consoleFormatter.format({
7
+ level: level,
8
+ message: String(message),
9
+ timestamp: String(timestamp),
10
+ component: component,
11
+ ...meta,
12
+ });
13
+ return formatted;
14
+ }));
15
+ }
@@ -0,0 +1,32 @@
1
+ import { LogLevels } from "../enum/LogLevels.js";
2
+ export interface CorrelationSession {
3
+ projectName: string;
4
+ environment: string;
5
+ correlationId: string;
6
+ component?: string;
7
+ startedAt: string;
8
+ endedAt?: string;
9
+ durationMs?: number;
10
+ request?: {
11
+ method?: string;
12
+ path?: string;
13
+ statusCode?: number;
14
+ };
15
+ logs: Array<{
16
+ timestamp: string;
17
+ level: LogLevels;
18
+ message: string;
19
+ meta?: Record<string, unknown>;
20
+ component: string;
21
+ }>;
22
+ }
23
+ export interface NonCorrelationSession {
24
+ projectName: string;
25
+ timestamp: string;
26
+ level: LogLevels;
27
+ message: string;
28
+ meta?: Record<string, unknown>;
29
+ component: string;
30
+ correlationId?: string;
31
+ }
32
+ //# sourceMappingURL=CorrelationSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrelationSession.d.ts","sourceRoot":"","sources":["../../../../src/core/interface/CorrelationSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF,IAAI,EAAE,KAAK,CAAC;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,SAAS,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/B,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAC,MAAM,CAAA;CACtB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface JsonizerConfig {
2
+ projectName: string;
3
+ environment: string;
4
+ componentName: string;
5
+ }
6
+ //# sourceMappingURL=JsonzierConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonzierConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/interface/JsonzierConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface RequestContextData {
2
+ correlationId: string;
3
+ }
4
+ //# sourceMappingURL=RequestContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../../../../src/core/interface/RequestContext.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { LogPayloadType } from "../../enum/LogPayLoads.js";
2
+ import { CorrelationSession, NonCorrelationSession } from "../CorrelationSession.js";
3
+ export interface BackendLogPayload {
4
+ type: LogPayloadType.SESSION;
5
+ data: CorrelationSession;
6
+ }
7
+ export interface FrontendLogPayload {
8
+ type: LogPayloadType.SINGLE;
9
+ data: NonCorrelationSession;
10
+ }
11
+ //# sourceMappingURL=Payloads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payloads.d.ts","sourceRoot":"","sources":["../../../../../src/core/interface/payloads/Payloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAErF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC;IAC7B,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,qBAAqB,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { CorrelationSession } from "../interface/CorrelationSession.js";
2
+ export declare function getOrCreateSession(correlationId: string, base: Omit<CorrelationSession, "logs" | "startedAt">): CorrelationSession;
3
+ export declare function endSession(correlationId: string): CorrelationSession | undefined;
4
+ export declare function removeSession(correlationId: string): void;
5
+ //# sourceMappingURL=CorrelationStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CorrelationStore.d.ts","sourceRoot":"","sources":["../../../../src/core/store/CorrelationStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAIxE,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,WAAW,CAAC,GACnD,kBAAkB,CASpB;AAED,wBAAgB,UAAU,CAAC,aAAa,EAAE,MAAM,kCAU/C;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,QAElD"}
@@ -0,0 +1,24 @@
1
+ const sessions = new Map();
2
+ export function getOrCreateSession(correlationId, base) {
3
+ if (!sessions.has(correlationId)) {
4
+ sessions.set(correlationId, {
5
+ ...base,
6
+ startedAt: new Date().toISOString(),
7
+ logs: [],
8
+ });
9
+ }
10
+ return sessions.get(correlationId);
11
+ }
12
+ export function endSession(correlationId) {
13
+ const session = sessions.get(correlationId);
14
+ if (!session)
15
+ return;
16
+ session.endedAt = new Date().toISOString();
17
+ session.durationMs =
18
+ new Date(session.endedAt).getTime() -
19
+ new Date(session.startedAt).getTime();
20
+ return session;
21
+ }
22
+ export function removeSession(correlationId) {
23
+ sessions.delete(correlationId);
24
+ }
@@ -5,5 +5,6 @@ export interface LogEntry {
5
5
  timestamp: string;
6
6
  level: LogLevels;
7
7
  correlationId?: string;
8
+ send?: boolean;
8
9
  }
9
10
  //# sourceMappingURL=LogEntry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogEntry.d.ts","sourceRoot":"","sources":["../../../../src/core/types/LogEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"LogEntry.d.ts","sourceRoot":"","sources":["../../../../src/core/types/LogEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAC,OAAO,CAAA;CACd"}
@@ -0,0 +1,2 @@
1
+ export declare function throwError(message: string): never;
2
+ //# sourceMappingURL=ThrowError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThrowError.d.ts","sourceRoot":"","sources":["../../../src/errors/ThrowError.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAEjD"}