@onlineapps/conn-orch-validator 2.0.30 → 2.0.32

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/conn-orch-validator",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "Validation orchestrator for OA Drive microservices - coordinates validation across all layers (base, infra, orch, business)",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -364,13 +364,16 @@ class CookbookTestRunner {
364
364
  * Resolve operation to HTTP endpoint
365
365
  */
366
366
  async resolveOperation(serviceName, operationName) {
367
- // Load operations.json from service path
368
- const operationsPath = this.servicePath
369
- ? path.join(this.servicePath, 'conn-config', 'operations.json')
370
- : null;
367
+ // Load operations.json prefer config/service/, fall back to conn-config/
368
+ let operationsPath = null;
369
+ if (this.servicePath) {
370
+ const newPath = path.join(this.servicePath, 'config', 'service', 'operations.json');
371
+ const legacyPath = path.join(this.servicePath, 'conn-config', 'operations.json');
372
+ operationsPath = fs.existsSync(newPath) ? newPath : (fs.existsSync(legacyPath) ? legacyPath : null);
373
+ }
371
374
 
372
- if (!operationsPath || !fs.existsSync(operationsPath)) {
373
- throw new Error(`Operations file not found for service: ${serviceName}`);
375
+ if (!operationsPath) {
376
+ throw new Error(`Operations file not found for service: ${serviceName} (checked config/service/ and conn-config/)`);
374
377
  }
375
378
 
376
379
  const operations = JSON.parse(fs.readFileSync(operationsPath, 'utf8'));
@@ -238,8 +238,9 @@ class ServiceReadinessValidator {
238
238
  validateStatus: () => true // Accept any status for validation
239
239
  });
240
240
 
241
- // Check response
242
- const isValid = response.status >= 200 && response.status < 300;
241
+ // Check response: 2xx = success, 4xx = endpoint works but rejected test data (valid)
242
+ // Only 5xx (server error) or connection failure = invalid endpoint
243
+ const isValid = response.status < 500;
243
244
 
244
245
  if (isValid) {
245
246
  results.successful++;
@@ -29,8 +29,11 @@ class ValidationOrchestrator {
29
29
  throw new Error('serviceUrl is required for ValidationOrchestrator');
30
30
  }
31
31
 
32
- // Paths
33
- this.configPath = path.join(this.serviceRoot, 'conn-config');
32
+ // Paths — prefer new config/service/ layout, fall back to legacy conn-config/
33
+ const newConfigDir = path.join(this.serviceRoot, 'config', 'service');
34
+ const legacyConfigDir = path.join(this.serviceRoot, 'conn-config');
35
+ this.configPath = fs.existsSync(newConfigDir) ? newConfigDir : legacyConfigDir;
36
+
34
37
  this.runtimePath = path.join(this.serviceRoot, 'conn-runtime');
35
38
  this.proofPath = path.join(this.runtimePath, 'validation-proof.json');
36
39
 
@@ -69,9 +69,14 @@ function createPreValidationTests(testsDir, options = {}) {
69
69
  );
70
70
  }
71
71
 
72
- // Load configuration
73
- const configPath = path.join(serviceRoot, 'conn-config/config.json');
74
- const operationsPath = path.join(serviceRoot, 'conn-config/operations.json');
72
+ // Load configuration — prefer config/service/, fall back to conn-config/
73
+ const resolveConfig = (filename) => {
74
+ const newPath = path.join(serviceRoot, 'config', 'service', filename);
75
+ const legacyPath = path.join(serviceRoot, 'conn-config', filename);
76
+ return fs.existsSync(newPath) ? newPath : legacyPath;
77
+ };
78
+ const configPath = resolveConfig('config.json');
79
+ const operationsPath = resolveConfig('operations.json');
75
80
  const proofPath = path.join(serviceRoot, '.validation-proof.json');
76
81
 
77
82
  const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
@@ -64,9 +64,14 @@ function createServiceReadinessTests(testsDir, options = {}) {
64
64
  );
65
65
  }
66
66
 
67
- // Load configuration files (validated above)
68
- const configPath = path.join(serviceRoot, 'conn-config/config.json');
69
- const operationsPath = path.join(serviceRoot, 'conn-config/operations.json');
67
+ // Load configuration files prefer config/service/, fall back to conn-config/
68
+ const resolveConfig = (filename) => {
69
+ const newPath = path.join(serviceRoot, 'config', 'service', filename);
70
+ const legacyPath = path.join(serviceRoot, 'conn-config', filename);
71
+ return fs.existsSync(newPath) ? newPath : legacyPath;
72
+ };
73
+ const configPath = resolveConfig('config.json');
74
+ const operationsPath = resolveConfig('operations.json');
70
75
  const appPath = path.join(serviceRoot, 'src/app.js');
71
76
 
72
77
  const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));