@dex-monit/observability-sdk-node 1.0.13 → 1.0.14

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 (34) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist/lib/console-capture.d.ts +1 -1
  5. package/dist/lib/console-capture.d.ts.map +1 -1
  6. package/dist/lib/console-capture.js +8 -3
  7. package/dist/lib/dex-logger.service.d.ts +1 -1
  8. package/dist/lib/dex-logger.service.d.ts.map +1 -1
  9. package/dist/lib/dex-logger.service.js +12 -9
  10. package/dist/lib/error-capture.interceptor.d.ts +1 -1
  11. package/dist/lib/error-capture.interceptor.d.ts.map +1 -1
  12. package/dist/lib/error-capture.interceptor.js +14 -11
  13. package/dist/lib/global-exception.filter.d.ts +1 -1
  14. package/dist/lib/global-exception.filter.d.ts.map +1 -1
  15. package/dist/lib/global-exception.filter.js +13 -10
  16. package/dist/lib/http-interceptor.d.ts +1 -1
  17. package/dist/lib/http-interceptor.d.ts.map +1 -1
  18. package/dist/lib/http-interceptor.js +29 -21
  19. package/dist/lib/monitoring-client.js +34 -23
  20. package/dist/lib/nest-logger-capture.d.ts +1 -1
  21. package/dist/lib/nest-logger-capture.d.ts.map +1 -1
  22. package/dist/lib/nest-logger-capture.js +23 -18
  23. package/dist/lib/remote-logger.d.ts +1 -1
  24. package/dist/lib/remote-logger.d.ts.map +1 -1
  25. package/dist/lib/remote-logger.js +8 -3
  26. package/dist/lib/request-id.middleware.js +18 -15
  27. package/dist/lib/sdk-node.d.ts +10 -10
  28. package/dist/lib/sdk-node.d.ts.map +1 -1
  29. package/dist/lib/sdk-node.js +13 -10
  30. package/dist/lib/sdk-node.module.d.ts +1 -1
  31. package/dist/lib/sdk-node.module.d.ts.map +1 -1
  32. package/dist/lib/sdk-node.module.js +54 -52
  33. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  34. package/package.json +2 -4
@@ -1,6 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startNestLoggerCapture = startNestLoggerCapture;
4
+ exports.stopNestLoggerCapture = stopNestLoggerCapture;
5
+ exports.isNestLoggerCaptureActive = isNestLoggerCaptureActive;
1
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { Logger as NestLogger, ConsoleLogger } from '@nestjs/common';
3
- import { RequestContextService } from '@dex-monit/observability-request-context';
7
+ const common_1 = require("@nestjs/common");
8
+ const observability_request_context_1 = require("@dex-monit/observability-request-context");
4
9
  const NEST_TO_SEVERITY = {
5
10
  debug: 'debug',
6
11
  verbose: 'debug',
@@ -24,7 +29,7 @@ function sendToMonitoring(severity, message, context) {
24
29
  if (context?.startsWith('DEX') || message.startsWith('[DEX') || message.startsWith('[MonitoringClient]')) {
25
30
  return;
26
31
  }
27
- const requestContext = RequestContextService.get();
32
+ const requestContext = observability_request_context_1.RequestContextService.get();
28
33
  monitoringClientRef.captureLog(severity, message, {
29
34
  source: 'nest-logger',
30
35
  context,
@@ -61,7 +66,7 @@ function createWrappedMethod(original, severity, getContext) {
61
66
  /**
62
67
  * Start capturing NestJS native Logger output
63
68
  */
64
- export function startNestLoggerCapture(monitoringClient) {
69
+ function startNestLoggerCapture(monitoringClient) {
65
70
  if (isCapturing) {
66
71
  return;
67
72
  }
@@ -70,25 +75,25 @@ export function startNestLoggerCapture(monitoringClient) {
70
75
  // 1. Patch static methods on NestLogger
71
76
  originalStaticMethods = {};
72
77
  for (const method of methods) {
73
- if (typeof NestLogger[method] === 'function') {
74
- originalStaticMethods[method] = NestLogger[method].bind(NestLogger);
75
- NestLogger[method] = createWrappedMethod(originalStaticMethods[method], NEST_TO_SEVERITY[method]);
78
+ if (typeof common_1.Logger[method] === 'function') {
79
+ originalStaticMethods[method] = common_1.Logger[method].bind(common_1.Logger);
80
+ common_1.Logger[method] = createWrappedMethod(originalStaticMethods[method], NEST_TO_SEVERITY[method]);
76
81
  }
77
82
  }
78
83
  // 2. Patch prototype methods on NestLogger
79
84
  originalPrototypeMethods = {};
80
85
  for (const method of methods) {
81
- if (typeof NestLogger.prototype[method] === 'function') {
82
- originalPrototypeMethods[method] = NestLogger.prototype[method];
83
- NestLogger.prototype[method] = createWrappedMethod(originalPrototypeMethods[method], NEST_TO_SEVERITY[method], function () { return this.context; });
86
+ if (typeof common_1.Logger.prototype[method] === 'function') {
87
+ originalPrototypeMethods[method] = common_1.Logger.prototype[method];
88
+ common_1.Logger.prototype[method] = createWrappedMethod(originalPrototypeMethods[method], NEST_TO_SEVERITY[method], function () { return this.context; });
84
89
  }
85
90
  }
86
91
  // 3. Patch ConsoleLogger prototype (NestJS internal logger)
87
92
  originalConsoleLoggerMethods = {};
88
93
  for (const method of methods) {
89
- if (typeof ConsoleLogger.prototype[method] === 'function') {
90
- originalConsoleLoggerMethods[method] = ConsoleLogger.prototype[method];
91
- ConsoleLogger.prototype[method] = createWrappedMethod(originalConsoleLoggerMethods[method], NEST_TO_SEVERITY[method], function () { return this.context; });
94
+ if (typeof common_1.ConsoleLogger.prototype[method] === 'function') {
95
+ originalConsoleLoggerMethods[method] = common_1.ConsoleLogger.prototype[method];
96
+ common_1.ConsoleLogger.prototype[method] = createWrappedMethod(originalConsoleLoggerMethods[method], NEST_TO_SEVERITY[method], function () { return this.context; });
92
97
  }
93
98
  }
94
99
  isCapturing = true;
@@ -97,7 +102,7 @@ export function startNestLoggerCapture(monitoringClient) {
97
102
  /**
98
103
  * Stop capturing NestJS native Logger output
99
104
  */
100
- export function stopNestLoggerCapture() {
105
+ function stopNestLoggerCapture() {
101
106
  if (!isCapturing) {
102
107
  return;
103
108
  }
@@ -106,7 +111,7 @@ export function stopNestLoggerCapture() {
106
111
  if (originalStaticMethods) {
107
112
  for (const method of methods) {
108
113
  if (originalStaticMethods[method]) {
109
- NestLogger[method] = originalStaticMethods[method];
114
+ common_1.Logger[method] = originalStaticMethods[method];
110
115
  }
111
116
  }
112
117
  originalStaticMethods = null;
@@ -115,7 +120,7 @@ export function stopNestLoggerCapture() {
115
120
  if (originalPrototypeMethods) {
116
121
  for (const method of methods) {
117
122
  if (originalPrototypeMethods[method]) {
118
- NestLogger.prototype[method] = originalPrototypeMethods[method];
123
+ common_1.Logger.prototype[method] = originalPrototypeMethods[method];
119
124
  }
120
125
  }
121
126
  originalPrototypeMethods = null;
@@ -124,7 +129,7 @@ export function stopNestLoggerCapture() {
124
129
  if (originalConsoleLoggerMethods) {
125
130
  for (const method of methods) {
126
131
  if (originalConsoleLoggerMethods[method]) {
127
- ConsoleLogger.prototype[method] = originalConsoleLoggerMethods[method];
132
+ common_1.ConsoleLogger.prototype[method] = originalConsoleLoggerMethods[method];
128
133
  }
129
134
  }
130
135
  originalConsoleLoggerMethods = null;
@@ -135,6 +140,6 @@ export function stopNestLoggerCapture() {
135
140
  /**
136
141
  * Check if NestJS Logger capture is active
137
142
  */
138
- export function isNestLoggerCaptureActive() {
143
+ function isNestLoggerCaptureActive() {
139
144
  return isCapturing;
140
145
  }
@@ -1,5 +1,5 @@
1
1
  import { Logger, LogContext, LoggerConfig } from '@dex-monit/observability-logger';
2
- import { MonitoringClient } from './monitoring-client.js';
2
+ import { MonitoringClient } from './monitoring-client';
3
3
  import { Severity } from '@dex-monit/observability-contracts';
4
4
  /**
5
5
  * Configuration for remote logger
@@ -1 +1 @@
1
- {"version":3,"file":"remote-logger.d.ts","sourceRoot":"","sources":["../../src/lib/remote-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,uDAAuD;IACvD,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;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAUnB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAKlD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAKjD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAKjD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAClD,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAC/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAiChE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;IAClD,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,IAAI;CAiBzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAE3E"}
@@ -1,4 +1,8 @@
1
- import { Logger } from '@dex-monit/observability-logger';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RemoteLogger = void 0;
4
+ exports.createRemoteLogger = createRemoteLogger;
5
+ const observability_logger_1 = require("@dex-monit/observability-logger");
2
6
  const LEVEL_PRIORITY = {
3
7
  debug: 0,
4
8
  info: 1,
@@ -12,7 +16,7 @@ const LEVEL_PRIORITY = {
12
16
  * Extends the base Logger with automatic remote log capture.
13
17
  * Logs are buffered and sent in batches for efficiency.
14
18
  */
15
- export class RemoteLogger extends Logger {
19
+ class RemoteLogger extends observability_logger_1.Logger {
16
20
  monitoringClient;
17
21
  remoteLevel;
18
22
  bufferLogs;
@@ -152,9 +156,10 @@ export class RemoteLogger extends Logger {
152
156
  }
153
157
  }
154
158
  }
159
+ exports.RemoteLogger = RemoteLogger;
155
160
  /**
156
161
  * Create a remote logger instance
157
162
  */
158
- export function createRemoteLogger(config) {
163
+ function createRemoteLogger(config) {
159
164
  return new RemoteLogger(config);
160
165
  }
@@ -1,12 +1,15 @@
1
- import { __esDecorate, __runInitializers } from "tslib";
2
- import { Injectable } from '@nestjs/common';
3
- import { v4 as uuidv4 } from 'uuid';
4
- import { RequestContextService } from '@dex-monit/observability-request-context';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestIdMiddleware = exports.TRANSACTION_ID_HEADER = exports.REQUEST_ID_HEADER = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const uuid_1 = require("uuid");
7
+ const observability_request_context_1 = require("@dex-monit/observability-request-context");
5
8
  /**
6
9
  * Header names for request tracing
7
10
  */
8
- export const REQUEST_ID_HEADER = 'x-request-id';
9
- export const TRANSACTION_ID_HEADER = 'x-transaction-id';
11
+ exports.REQUEST_ID_HEADER = 'x-request-id';
12
+ exports.TRANSACTION_ID_HEADER = 'x-transaction-id';
10
13
  /**
11
14
  * Middleware to generate request IDs and setup request context
12
15
  *
@@ -17,7 +20,7 @@ export const TRANSACTION_ID_HEADER = 'x-transaction-id';
17
20
  * 4. Adds response headers for tracing
18
21
  */
19
22
  let RequestIdMiddleware = (() => {
20
- let _classDecorators = [Injectable()];
23
+ let _classDecorators = [(0, common_1.Injectable)()];
21
24
  let _classDescriptor;
22
25
  let _classExtraInitializers = [];
23
26
  let _classThis;
@@ -25,19 +28,19 @@ let RequestIdMiddleware = (() => {
25
28
  static { _classThis = this; }
26
29
  static {
27
30
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
28
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
31
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
29
32
  RequestIdMiddleware = _classThis = _classDescriptor.value;
30
33
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
31
- __runInitializers(_classThis, _classExtraInitializers);
34
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
32
35
  }
33
36
  use(req, res, next) {
34
37
  // Extract or generate request ID
35
- const requestId = req.headers[REQUEST_ID_HEADER] || uuidv4();
38
+ const requestId = req.headers[exports.REQUEST_ID_HEADER] || (0, uuid_1.v4)();
36
39
  // Extract or generate transaction ID (for distributed tracing)
37
- const transactionId = req.headers[TRANSACTION_ID_HEADER] || uuidv4();
40
+ const transactionId = req.headers[exports.TRANSACTION_ID_HEADER] || (0, uuid_1.v4)();
38
41
  // Set response headers
39
- res.setHeader(REQUEST_ID_HEADER, requestId);
40
- res.setHeader(TRANSACTION_ID_HEADER, transactionId);
42
+ res.setHeader(exports.REQUEST_ID_HEADER, requestId);
43
+ res.setHeader(exports.TRANSACTION_ID_HEADER, transactionId);
41
44
  // Create request context
42
45
  const context = {
43
46
  requestId,
@@ -50,11 +53,11 @@ let RequestIdMiddleware = (() => {
50
53
  },
51
54
  };
52
55
  // Run the rest of the middleware chain within the context
53
- RequestContextService.run(context, () => {
56
+ observability_request_context_1.RequestContextService.run(context, () => {
54
57
  next();
55
58
  });
56
59
  }
57
60
  };
58
61
  return RequestIdMiddleware = _classThis;
59
62
  })();
60
- export { RequestIdMiddleware };
63
+ exports.RequestIdMiddleware = RequestIdMiddleware;
@@ -1,11 +1,11 @@
1
- export * from './sdk-node.module.js';
2
- export * from './request-id.middleware.js';
3
- export * from './global-exception.filter.js';
4
- export * from './error-capture.interceptor.js';
5
- export * from './monitoring-client.js';
6
- export * from './remote-logger.js';
7
- export * from './dex-logger.service.js';
8
- export * from './console-capture.js';
9
- export * from './nest-logger-capture.js';
10
- export * from './http-interceptor.js';
1
+ export * from './sdk-node.module';
2
+ export * from './request-id.middleware';
3
+ export * from './global-exception.filter';
4
+ export * from './error-capture.interceptor';
5
+ export * from './monitoring-client';
6
+ export * from './remote-logger';
7
+ export * from './dex-logger.service';
8
+ export * from './console-capture';
9
+ export * from './nest-logger-capture';
10
+ export * from './http-interceptor';
11
11
  //# sourceMappingURL=sdk-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-node.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"sdk-node.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
@@ -1,11 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
1
4
  // Re-export everything from the module files
2
- export * from './sdk-node.module.js';
3
- export * from './request-id.middleware.js';
4
- export * from './global-exception.filter.js';
5
- export * from './error-capture.interceptor.js';
6
- export * from './monitoring-client.js';
7
- export * from './remote-logger.js';
8
- export * from './dex-logger.service.js';
9
- export * from './console-capture.js';
10
- export * from './nest-logger-capture.js';
11
- export * from './http-interceptor.js';
5
+ tslib_1.__exportStar(require("./sdk-node.module"), exports);
6
+ tslib_1.__exportStar(require("./request-id.middleware"), exports);
7
+ tslib_1.__exportStar(require("./global-exception.filter"), exports);
8
+ tslib_1.__exportStar(require("./error-capture.interceptor"), exports);
9
+ tslib_1.__exportStar(require("./monitoring-client"), exports);
10
+ tslib_1.__exportStar(require("./remote-logger"), exports);
11
+ tslib_1.__exportStar(require("./dex-logger.service"), exports);
12
+ tslib_1.__exportStar(require("./console-capture"), exports);
13
+ tslib_1.__exportStar(require("./nest-logger-capture"), exports);
14
+ tslib_1.__exportStar(require("./http-interceptor"), exports);
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule, MiddlewareConsumer, NestModule, OnModuleDestroy } from '@nestjs/common';
2
- import { MonitoringClientConfig } from './monitoring-client.js';
2
+ import { MonitoringClientConfig } from './monitoring-client';
3
3
  import { LoggerConfig, LOGGER_TOKEN } from '@dex-monit/observability-logger';
4
4
  import { Severity } from '@dex-monit/observability-contracts';
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sdk-node.module.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,kBAAkB,EAClB,UAAU,EACV,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAEL,sBAAsB,EAEvB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAEL,YAAY,EACZ,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,yFAAyF;IACzF,UAAU,CAA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;IACjB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,uBAAuB,oCAAoC,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,qBAEa,aAAc,YAAW,UAAU,EAAE,eAAe;IAC/D,OAAO,CAAC,MAAM,CAAC,YAAY,CAA6B;IAExD;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,aAAa;IAiH1D;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAK7C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAUvC"}
@@ -1,22 +1,24 @@
1
- import { __esDecorate, __runInitializers } from "tslib";
2
- import { Module, Global, } from '@nestjs/common';
3
- import { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';
4
- import { RequestIdMiddleware } from './request-id.middleware.js';
5
- import { GlobalExceptionFilter } from './global-exception.filter.js';
6
- import { ErrorCaptureInterceptor } from './error-capture.interceptor.js';
7
- import { MonitoringClient, createMonitoringClient, } from './monitoring-client.js';
8
- import { RemoteLogger, createRemoteLogger } from './remote-logger.js';
9
- import { DexLoggerService, DEX_LOGGER_TOKEN } from './dex-logger.service.js';
10
- import { startConsoleCapture, stopConsoleCapture } from './console-capture.js';
11
- import { startNestLoggerCapture, stopNestLoggerCapture, } from './nest-logger-capture.js';
12
- import { HttpTraceInterceptor } from './http-interceptor.js';
13
- import { Logger, LOGGER_TOKEN, } from '@dex-monit/observability-logger';
14
- // Re-export LOGGER_TOKEN for convenience
15
- export { LOGGER_TOKEN };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SdkNodeModule = exports.MONITORING_CLIENT_TOKEN = exports.LOGGER_TOKEN = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const core_1 = require("@nestjs/core");
7
+ const request_id_middleware_1 = require("./request-id.middleware");
8
+ const global_exception_filter_1 = require("./global-exception.filter");
9
+ const error_capture_interceptor_1 = require("./error-capture.interceptor");
10
+ const monitoring_client_1 = require("./monitoring-client");
11
+ const remote_logger_1 = require("./remote-logger");
12
+ const dex_logger_service_1 = require("./dex-logger.service");
13
+ const console_capture_1 = require("./console-capture");
14
+ const nest_logger_capture_1 = require("./nest-logger-capture");
15
+ const http_interceptor_1 = require("./http-interceptor");
16
+ const observability_logger_1 = require("@dex-monit/observability-logger");
17
+ Object.defineProperty(exports, "LOGGER_TOKEN", { enumerable: true, get: function () { return observability_logger_1.LOGGER_TOKEN; } });
16
18
  /**
17
19
  * Token for injecting the monitoring client
18
20
  */
19
- export const MONITORING_CLIENT_TOKEN = 'OBSERVABILITY_MONITORING_CLIENT';
21
+ exports.MONITORING_CLIENT_TOKEN = 'OBSERVABILITY_MONITORING_CLIENT';
20
22
  /**
21
23
  * SDK Node Module
22
24
  *
@@ -30,7 +32,7 @@ export const MONITORING_CLIENT_TOKEN = 'OBSERVABILITY_MONITORING_CLIENT';
30
32
  * - Monitoring client instance
31
33
  */
32
34
  let SdkNodeModule = (() => {
33
- let _classDecorators = [Global(), Module({})];
35
+ let _classDecorators = [(0, common_1.Global)(), (0, common_1.Module)({})];
34
36
  let _classDescriptor;
35
37
  let _classExtraInitializers = [];
36
38
  let _classThis;
@@ -38,7 +40,7 @@ let SdkNodeModule = (() => {
38
40
  static { _classThis = this; }
39
41
  static {
40
42
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
41
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
43
+ tslib_1.__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
42
44
  SdkNodeModule = _classThis = _classDescriptor.value;
43
45
  if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
44
46
  }
@@ -48,10 +50,10 @@ let SdkNodeModule = (() => {
48
50
  */
49
51
  static forRoot(config) {
50
52
  const monitoringClient = config.monitoring
51
- ? createMonitoringClient(config.monitoring)
53
+ ? (0, monitoring_client_1.createMonitoringClient)(config.monitoring)
52
54
  : undefined;
53
55
  // Use RemoteLogger if monitoring is configured
54
- const logger = createRemoteLogger({
56
+ const logger = (0, remote_logger_1.createRemoteLogger)({
55
57
  ...config.logger,
56
58
  monitoringClient,
57
59
  remoteLevel: config.remoteLogLevel || 'debug', // Default: capture ALL logs
@@ -64,12 +66,12 @@ let SdkNodeModule = (() => {
64
66
  const captureNestLogger = config.captureNestLogger ?? true;
65
67
  // NestJS Logger capture (default: true) - START FIRST
66
68
  if (captureNestLogger) {
67
- startNestLoggerCapture(monitoringClient);
69
+ (0, nest_logger_capture_1.startNestLoggerCapture)(monitoringClient);
68
70
  }
69
71
  // Console capture (default: true)
70
72
  // Skip NestJS logs if we're also capturing NestJS Logger to avoid duplicates
71
73
  if (captureConsole) {
72
- startConsoleCapture(monitoringClient, {
74
+ (0, console_capture_1.startConsoleCapture)(monitoringClient, {
73
75
  skipNestJsLogs: captureNestLogger,
74
76
  });
75
77
  }
@@ -79,76 +81,76 @@ let SdkNodeModule = (() => {
79
81
  providers: [
80
82
  // Monitoring Client
81
83
  {
82
- provide: MONITORING_CLIENT_TOKEN,
84
+ provide: exports.MONITORING_CLIENT_TOKEN,
83
85
  useValue: monitoringClient,
84
86
  },
85
87
  {
86
- provide: MonitoringClient,
88
+ provide: monitoring_client_1.MonitoringClient,
87
89
  useValue: monitoringClient,
88
90
  },
89
91
  // DexLoggerService - the main logger to use
90
92
  {
91
- provide: DEX_LOGGER_TOKEN,
93
+ provide: dex_logger_service_1.DEX_LOGGER_TOKEN,
92
94
  useFactory: () => {
93
- const dexLogger = new DexLoggerService();
95
+ const dexLogger = new dex_logger_service_1.DexLoggerService();
94
96
  dexLogger.setMonitoringClient(monitoringClient);
95
97
  return dexLogger;
96
98
  },
97
99
  },
98
100
  {
99
- provide: DexLoggerService,
101
+ provide: dex_logger_service_1.DexLoggerService,
100
102
  useFactory: () => {
101
- const dexLogger = new DexLoggerService();
103
+ const dexLogger = new dex_logger_service_1.DexLoggerService();
102
104
  dexLogger.setMonitoringClient(monitoringClient);
103
105
  return dexLogger;
104
106
  },
105
107
  },
106
108
  // Legacy Logger support
107
109
  {
108
- provide: LOGGER_TOKEN,
110
+ provide: observability_logger_1.LOGGER_TOKEN,
109
111
  useValue: logger,
110
112
  },
111
113
  {
112
- provide: Logger,
114
+ provide: observability_logger_1.Logger,
113
115
  useValue: logger,
114
116
  },
115
117
  {
116
- provide: RemoteLogger,
118
+ provide: remote_logger_1.RemoteLogger,
117
119
  useValue: logger,
118
120
  },
119
121
  // Interceptor captures errors BEFORE any exception filter
120
122
  {
121
- provide: APP_INTERCEPTOR,
122
- useFactory: () => new ErrorCaptureInterceptor(monitoringClient),
123
+ provide: core_1.APP_INTERCEPTOR,
124
+ useFactory: () => new error_capture_interceptor_1.ErrorCaptureInterceptor(monitoringClient),
123
125
  },
124
126
  // HTTP trace interceptor (captures all HTTP requests)
125
127
  ...((config.captureHttpRequests ?? true)
126
128
  ? [
127
129
  {
128
- provide: APP_INTERCEPTOR,
129
- useFactory: () => new HttpTraceInterceptor(monitoringClient),
130
+ provide: core_1.APP_INTERCEPTOR,
131
+ useFactory: () => new http_interceptor_1.HttpTraceInterceptor(monitoringClient),
130
132
  },
131
133
  ]
132
134
  : []),
133
135
  // Keep the filter as fallback for non-HTTP contexts
134
136
  {
135
- provide: APP_FILTER,
136
- useFactory: () => new GlobalExceptionFilter(logger, monitoringClient),
137
+ provide: core_1.APP_FILTER,
138
+ useFactory: () => new global_exception_filter_1.GlobalExceptionFilter(logger, monitoringClient),
137
139
  },
138
- RequestIdMiddleware,
139
- HttpTraceInterceptor,
140
+ request_id_middleware_1.RequestIdMiddleware,
141
+ http_interceptor_1.HttpTraceInterceptor,
140
142
  ],
141
143
  exports: [
142
144
  // Main exports
143
- DexLoggerService,
144
- DEX_LOGGER_TOKEN,
145
- MONITORING_CLIENT_TOKEN,
146
- MonitoringClient,
147
- HttpTraceInterceptor,
145
+ dex_logger_service_1.DexLoggerService,
146
+ dex_logger_service_1.DEX_LOGGER_TOKEN,
147
+ exports.MONITORING_CLIENT_TOKEN,
148
+ monitoring_client_1.MonitoringClient,
149
+ http_interceptor_1.HttpTraceInterceptor,
148
150
  // Legacy exports
149
- LOGGER_TOKEN,
150
- Logger,
151
- RemoteLogger,
151
+ observability_logger_1.LOGGER_TOKEN,
152
+ observability_logger_1.Logger,
153
+ remote_logger_1.RemoteLogger,
152
154
  ],
153
155
  };
154
156
  }
@@ -157,24 +159,24 @@ let SdkNodeModule = (() => {
157
159
  */
158
160
  configure(consumer) {
159
161
  // Apply RequestIdMiddleware to all routes
160
- consumer.apply(RequestIdMiddleware).forRoutes('*');
162
+ consumer.apply(request_id_middleware_1.RequestIdMiddleware).forRoutes('*');
161
163
  }
162
164
  /**
163
165
  * Cleanup on module destroy
164
166
  */
165
167
  async onModuleDestroy() {
166
168
  // Stop captures
167
- stopConsoleCapture();
168
- stopNestLoggerCapture();
169
+ (0, console_capture_1.stopConsoleCapture)();
170
+ (0, nest_logger_capture_1.stopNestLoggerCapture)();
169
171
  // Flush remaining logs
170
172
  if (SdkNodeModule.remoteLogger) {
171
173
  await SdkNodeModule.remoteLogger.close();
172
174
  }
173
175
  }
174
176
  static {
175
- __runInitializers(_classThis, _classExtraInitializers);
177
+ tslib_1.__runInitializers(_classThis, _classExtraInitializers);
176
178
  }
177
179
  };
178
180
  return SdkNodeModule = _classThis;
179
181
  })();
180
- export { SdkNodeModule };
182
+ exports.SdkNodeModule = SdkNodeModule;