@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 +2 -1
- package/src/registryClient.js +42 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-orch-registry",
|
|
3
|
-
"version": "1.1.
|
|
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",
|
package/src/registryClient.js
CHANGED
|
@@ -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
|
-
|
|
105
|
-
console.log(`[RegistryClient] ${this.serviceName}:
|
|
106
|
-
|
|
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
|
-
|
|
112
|
-
|
|
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
|
-
|
|
137
|
+
log(`✓ Proof file exists, reading...`);
|
|
118
138
|
|
|
119
139
|
// Read and parse file
|
|
120
140
|
const fileContent = fs.readFileSync(proofPath, 'utf8');
|
|
121
|
-
|
|
141
|
+
log(`✓ File read, size: ${fileContent.length} bytes`);
|
|
122
142
|
|
|
123
143
|
const proofData = JSON.parse(fileContent);
|
|
124
|
-
|
|
144
|
+
log(`✓ JSON parsed successfully`);
|
|
125
145
|
|
|
126
146
|
// Validate structure
|
|
127
147
|
if (!proofData.validationProof) {
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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
|
}
|