@onlineapps/conn-orch-registry 1.1.7 → 1.1.9

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-registry",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "license": "MIT",
5
5
  "description": "Connector-registry-client provides the core communication mechanism for microservices in this environment. It enables them to interact with a services_registry to receive and fulfill tasks by submitting heartbeats or their API descriptions.",
6
6
  "keywords": [
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@onlineapps/conn-base-storage": "^1.0.0",
42
+ "@onlineapps/conn-orch-registry": "^1.1.8",
42
43
  "amqplib": "^0.10.3",
43
44
  "axios": "^1.5.0",
44
45
  "dotenv": "^16.1.4",
@@ -66,7 +66,9 @@ class ServiceRegistryClient extends EventEmitter {
66
66
  await this.queueManager.init();
67
67
 
68
68
  // Load validation proof if exists
69
+ console.error(`[RegistryClient] ${this.serviceName}: === CALLING _loadValidationProof() ===`);
69
70
  await this._loadValidationProof();
71
+ console.error(`[RegistryClient] ${this.serviceName}: === FINISHED _loadValidationProof() ===`);
70
72
 
71
73
  // Create service-specific response queue
72
74
  this.serviceResponseQueue = `${this.serviceName}.responses`;
@@ -99,41 +101,59 @@ class ServiceRegistryClient extends EventEmitter {
99
101
  * @returns {Promise<void>}
100
102
  */
101
103
  async _loadValidationProof() {
104
+ console.log(`[RegistryClient] ${this.serviceName}: >>> ENTERING _loadValidationProof() <<<`);
105
+
102
106
  const proofPath = path.join(process.cwd(), '.validation-proof.json');
107
+ const debugLogPath = path.join(process.cwd(), '.validation-debug.log');
103
108
 
104
- // Log attempt with full context
105
- console.log(`[RegistryClient] ${this.serviceName}: Loading validation proof from ${proofPath}`);
106
- console.log(`[RegistryClient] ${this.serviceName}: Current working directory: ${process.cwd()}`);
109
+ console.log(`[RegistryClient] ${this.serviceName}: CWD = ${process.cwd()}`);
110
+ console.log(`[RegistryClient] ${this.serviceName}: Proof path = ${proofPath}`);
111
+
112
+ // Write to file for debugging (append mode)
113
+ const log = (msg) => {
114
+ const timestamp = new Date().toISOString();
115
+ const logLine = `${timestamp} [${this.serviceName}] ${msg}\n`;
116
+ try {
117
+ fs.appendFileSync(debugLogPath, logLine);
118
+ } catch (err) {
119
+ console.error(`[RegistryClient] Failed to write debug log: ${err.message}`);
120
+ }
121
+ console.log(`[RegistryClient] ${msg}`);
122
+ };
123
+
124
+ log('=== _loadValidationProof() CALLED ===');
125
+ log(`CWD: ${process.cwd()}`);
126
+ log(`Proof path: ${proofPath}`);
107
127
 
108
128
  try {
109
129
  // Check file existence explicitly
110
130
  if (!fs.existsSync(proofPath)) {
111
- console.log(`[RegistryClient] ${this.serviceName}: ⚠️ Validation proof file NOT FOUND at ${proofPath}`);
112
- console.log(`[RegistryClient] ${this.serviceName}: Service will use Tier 2 validation (online validation by Registry)`);
131
+ log(`⚠️ Validation proof file NOT FOUND`);
132
+ log(`Service will use Tier 2 validation`);
113
133
  this.validationProof = null;
114
134
  return;
115
135
  }
116
136
 
117
- console.log(`[RegistryClient] ${this.serviceName}: ✓ Proof file exists, reading...`);
137
+ log(`✓ Proof file exists, reading...`);
118
138
 
119
139
  // Read and parse file
120
140
  const fileContent = fs.readFileSync(proofPath, 'utf8');
121
- console.log(`[RegistryClient] ${this.serviceName}: ✓ File read, size: ${fileContent.length} bytes`);
141
+ log(`✓ File read, size: ${fileContent.length} bytes`);
122
142
 
123
143
  const proofData = JSON.parse(fileContent);
124
- console.log(`[RegistryClient] ${this.serviceName}: ✓ JSON parsed successfully`);
144
+ log(`✓ JSON parsed successfully`);
125
145
 
126
146
  // Validate structure
127
147
  if (!proofData.validationProof) {
128
- console.error(`[RegistryClient] ${this.serviceName}: ❌ ERROR: Missing 'validationProof' field in ${proofPath}`);
129
- console.error(`[RegistryClient] ${this.serviceName}: Available fields: ${Object.keys(proofData).join(', ')}`);
148
+ log(`❌ ERROR: Missing 'validationProof' field`);
149
+ log(`Available fields: ${Object.keys(proofData).join(', ')}`);
130
150
  this.validationProof = null;
131
151
  return;
132
152
  }
133
153
 
134
154
  if (!proofData.validationData) {
135
- console.error(`[RegistryClient] ${this.serviceName}: ❌ ERROR: Missing 'validationData' field in ${proofPath}`);
136
- console.error(`[RegistryClient] ${this.serviceName}: Available fields: ${Object.keys(proofData).join(', ')}`);
155
+ log(`❌ ERROR: Missing 'validationData' field`);
156
+ log(`Available fields: ${Object.keys(proofData).join(', ')}`);
137
157
  this.validationProof = null;
138
158
  return;
139
159
  }
@@ -144,19 +164,19 @@ class ServiceRegistryClient extends EventEmitter {
144
164
  data: proofData.validationData
145
165
  };
146
166
 
147
- console.log(`[RegistryClient] ${this.serviceName}: ✅ SUCCESS - Validation proof loaded`);
148
- console.log(`[RegistryClient] ${this.serviceName}: Proof hash: ${this.validationProof.hash.substring(0, 32)}...`);
149
- console.log(`[RegistryClient] ${this.serviceName}: Validator: ${this.validationProof.data.validator}`);
150
- console.log(`[RegistryClient] ${this.serviceName}: Tests passed: ${this.validationProof.data.testsPassed}/${this.validationProof.data.testsRun}`);
151
- console.log(`[RegistryClient] ${this.serviceName}: Validated at: ${this.validationProof.data.validatedAt}`);
167
+ log(`✅ SUCCESS - Validation proof loaded`);
168
+ log(` Proof hash: ${this.validationProof.hash.substring(0, 32)}...`);
169
+ log(` Validator: ${this.validationProof.data.validator}`);
170
+ log(` Tests passed: ${this.validationProof.data.testsPassed}/${this.validationProof.data.testsRun}`);
171
+ log(` Validated at: ${this.validationProof.data.validatedAt}`);
152
172
 
153
173
  } catch (error) {
154
174
  // Non-critical error - service can still register without proof (will trigger Tier 2 validation)
155
- console.error(`[RegistryClient] ${this.serviceName}: ❌ EXCEPTION while loading validation proof`);
156
- console.error(`[RegistryClient] ${this.serviceName}: Error: ${error.message}`);
157
- console.error(`[RegistryClient] ${this.serviceName}: Stack: ${error.stack}`);
158
- console.error(`[RegistryClient] ${this.serviceName}: Path attempted: ${proofPath}`);
159
- console.log(`[RegistryClient] ${this.serviceName}: Service will use Tier 2 validation (online validation by Registry)`);
175
+ log(`❌ EXCEPTION while loading validation proof`);
176
+ log(` Error: ${error.message}`);
177
+ log(` Stack: ${error.stack}`);
178
+ log(` Path attempted: ${proofPath}`);
179
+ log(`Service will use Tier 2 validation`);
160
180
  this.validationProof = null;
161
181
  }
162
182
  }