@onlineapps/error-handler-core 1.1.0 → 1.1.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/error-handler-core",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "Core error handling functionality for OA Drive microservices - classification, retry, circuit breaker, DLQ routing",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -20,7 +20,8 @@
20
20
  "author": "OnlineApps",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@onlineapps/monitoring-core": "^1.0.0",
23
+ "@onlineapps/monitoring-core": "1.0.10",
24
+ "@onlineapps/runtime-config": "1.0.2",
24
25
  "opossum": "^7.0.0"
25
26
  },
26
27
  "devDependencies": {
@@ -9,6 +9,7 @@ const RetryHandler = require('./RetryHandler');
9
9
  const CircuitBreakerManager = require('./CircuitBreaker');
10
10
  const DLQRouter = require('./DLQRouter');
11
11
  const CompensationHandler = require('./CompensationHandler');
12
+ const runtimeCfg = require('./config');
12
13
 
13
14
  class ErrorHandlerCore {
14
15
  /**
@@ -38,8 +39,9 @@ class ErrorHandlerCore {
38
39
  }
39
40
 
40
41
  this.serviceName = config.serviceName;
41
- this.serviceVersion = config.serviceVersion || '0.0.0';
42
- this.environment = config.environment || process.env.NODE_ENV || 'development';
42
+ const resolved = runtimeCfg.resolve(config);
43
+ this.serviceVersion = config.serviceVersion || resolved.serviceVersion;
44
+ this.environment = config.environment || resolved.environment;
43
45
  this.monitoring = config.monitoring;
44
46
 
45
47
  const handling = config.handling || {};
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  const os = require('os');
7
+ const runtimeCfg = require('./config');
7
8
 
8
9
  class UnifiedLogSchema {
9
10
  /**
@@ -74,7 +75,7 @@ class UnifiedLogSchema {
74
75
  // Metadata
75
76
  metadata: {
76
77
  severity: this._determineSeverity(errorType),
77
- environment: environment || process.env.NODE_ENV || 'development',
78
+ environment: runtimeCfg.get('environment', environment),
78
79
  version: serviceVersion || '0.0.0',
79
80
  hostname: os.hostname(),
80
81
  pid: process.pid
package/src/config.js ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Runtime configuration schema for @onlineapps/error-handler-core.
5
+ *
6
+ * Uses @onlineapps/runtime-config for unified priority:
7
+ * 1. Explicit config
8
+ * 2. Environment variable
9
+ * 3. Module-owned defaults (from ./defaults.js)
10
+ */
11
+
12
+ const { createRuntimeConfig } = require('@onlineapps/runtime-config');
13
+ const DEFAULTS = require('./defaults');
14
+
15
+ const runtimeCfg = createRuntimeConfig({
16
+ defaults: DEFAULTS,
17
+ schema: {
18
+ environment: { env: 'NODE_ENV', defaultKey: 'environment' },
19
+ serviceVersion: { env: 'SERVICE_VERSION', defaultKey: 'serviceVersion' },
20
+ }
21
+ });
22
+
23
+ module.exports = runtimeCfg;
24
+
25
+
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Module-owned defaults for @onlineapps/error-handler-core.
5
+ *
6
+ * Ownership rule:
7
+ * - Defaults in this file belong to error-handler-core (metadata defaults).
8
+ * - Service identity should be provided explicitly by callers.
9
+ */
10
+
11
+ module.exports = {
12
+ environment: 'development',
13
+ serviceVersion: '0.0.0',
14
+ };
15
+
16
+