n8n-nodes-cribops 0.2.2 → 0.2.4
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/dist/package.json +1 -1
- package/dist/utils/HiveClient.js +21 -5
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/utils/HiveClient.js
CHANGED
|
@@ -12,13 +12,17 @@ class HiveClient {
|
|
|
12
12
|
const options = {
|
|
13
13
|
host: config.host,
|
|
14
14
|
port: config.port,
|
|
15
|
-
password: config.password,
|
|
16
15
|
retryStrategy: (times) => {
|
|
17
16
|
if (times > 3)
|
|
18
17
|
return null;
|
|
19
18
|
return Math.min(times * 100, 3000);
|
|
20
19
|
},
|
|
20
|
+
lazyConnect: true,
|
|
21
21
|
};
|
|
22
|
+
// Only set password if it's actually provided (not empty string)
|
|
23
|
+
if (config.password && config.password.trim() !== '') {
|
|
24
|
+
options.password = config.password;
|
|
25
|
+
}
|
|
22
26
|
if (config.tls) {
|
|
23
27
|
options.tls = {};
|
|
24
28
|
}
|
|
@@ -27,7 +31,8 @@ class HiveClient {
|
|
|
27
31
|
async connect() {
|
|
28
32
|
if (this.connected)
|
|
29
33
|
return;
|
|
30
|
-
//
|
|
34
|
+
// Connect and verify with a ping
|
|
35
|
+
await this.redis.connect();
|
|
31
36
|
await this.redis.ping();
|
|
32
37
|
this.connected = true;
|
|
33
38
|
}
|
|
@@ -37,11 +42,22 @@ class HiveClient {
|
|
|
37
42
|
}
|
|
38
43
|
async execute(operation, payload) {
|
|
39
44
|
const jsonPayload = JSON.stringify(payload);
|
|
40
|
-
|
|
45
|
+
let result;
|
|
46
|
+
try {
|
|
47
|
+
result = await this.redis.call('HIVE.EXEC', operation, jsonPayload);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
throw new Error(`HIVE.EXEC ${operation} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
51
|
+
}
|
|
41
52
|
if (result === null || result === undefined) {
|
|
42
|
-
throw new Error(`HIVE.EXEC ${operation} returned null -
|
|
53
|
+
throw new Error(`HIVE.EXEC ${operation} returned null - check Hive is running on the configured host`);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(String(result));
|
|
57
|
+
}
|
|
58
|
+
catch (parseErr) {
|
|
59
|
+
throw new Error(`Failed to parse HIVE.EXEC response: ${String(result).substring(0, 100)}`);
|
|
43
60
|
}
|
|
44
|
-
return JSON.parse(String(result));
|
|
45
61
|
}
|
|
46
62
|
async ping() {
|
|
47
63
|
return this.execute('ping', {});
|