@5minds/node-red-contrib-processcube 1.5.8-develop-bfab3c-m3r4dore → 1.5.8-subscription-logging-a3f079-m42gnddb
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/externaltask-input.js
CHANGED
@@ -27,8 +27,12 @@ module.exports = function (RED) {
|
|
27
27
|
|
28
28
|
const engineEventEmitter = engine.eventEmitter;
|
29
29
|
|
30
|
+
node.log(`got event emmiter: ${JSON.stringify(engineEventEmitter)}`);
|
31
|
+
|
30
32
|
engineEventEmitter.on('engine-client-dispose', () => {
|
31
|
-
|
33
|
+
node.log('rm subsctiption');
|
34
|
+
engine.engineClient.externalTasks.removeSubscription(subscription, engine.identity);
|
35
|
+
node.log('done rm subscriptions');
|
32
36
|
});
|
33
37
|
|
34
38
|
engineEventEmitter.on('engine-client-changed', () => {
|
@@ -37,7 +41,9 @@ module.exports = function (RED) {
|
|
37
41
|
});
|
38
42
|
|
39
43
|
const register = async () => {
|
44
|
+
node.log('registering node');
|
40
45
|
const client = engine.engineClient;
|
46
|
+
node.log(`subscribing to client: ${JSON.stringify(engine.engineClient)}`);
|
41
47
|
|
42
48
|
if (!client) {
|
43
49
|
node.error('No engine configured.');
|
@@ -179,6 +185,7 @@ module.exports = function (RED) {
|
|
179
185
|
};
|
180
186
|
|
181
187
|
if (engine) {
|
188
|
+
node.log(`initial register: ${engine}`);
|
182
189
|
register();
|
183
190
|
}
|
184
191
|
}
|
package/package.json
CHANGED
@@ -40,31 +40,53 @@ module.exports = function (RED) {
|
|
40
40
|
};
|
41
41
|
|
42
42
|
function periodicallyRefreshEngineClient(node, n, intervalMs) {
|
43
|
+
node.log('starting refresh cycle');
|
43
44
|
function refreshUrl() {
|
44
45
|
const newUrl = RED.util.evaluateNodeProperty(n.url, n.urlType, node);
|
46
|
+
const newClientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
|
47
|
+
const newClientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
|
45
48
|
|
46
|
-
if (
|
49
|
+
if (
|
50
|
+
node.url === newUrl &&
|
51
|
+
node.credentials.clientId === newClientId &&
|
52
|
+
node.credentials.clientSecret === newClientSecret
|
53
|
+
) {
|
54
|
+
node.log('no new url found');
|
47
55
|
return;
|
48
56
|
}
|
49
57
|
|
58
|
+
node.log(`new url found: ${newUrl}`);
|
50
59
|
node.url = newUrl;
|
60
|
+
node.credentials.clientId = newClientId;
|
61
|
+
node.credentials.clientSecret = newClientSecret;
|
51
62
|
if (node.credentials.clientId && node.credentials.clientSecret) {
|
52
63
|
if (node.engineClient) {
|
64
|
+
node.log('disposing old engine client');
|
53
65
|
node.eventEmitter.emit('engine-client-dispose');
|
54
66
|
node.engineClient.dispose();
|
55
67
|
}
|
68
|
+
|
69
|
+
node.log('creating new engine client (without credentials)');
|
70
|
+
|
56
71
|
node.engineClient = new engine_client.EngineClient(node.url, () =>
|
57
72
|
getFreshIdentity(node.url, node)
|
58
73
|
);
|
59
74
|
|
75
|
+
node.log(`new engine client: ${JSON.stringify(node.engineClient)}`);
|
76
|
+
|
60
77
|
node.eventEmitter.emit('engine-client-changed');
|
61
78
|
} else {
|
62
79
|
if (node.engineClient) {
|
80
|
+
node.log('disposing old engine client (without credentials)');
|
63
81
|
node.eventEmitter.emit('engine-client-dispose');
|
64
82
|
node.engineClient.dispose();
|
65
83
|
}
|
84
|
+
|
85
|
+
node.log('creating new engine client (without credentials)');
|
66
86
|
node.engineClient = new engine_client.EngineClient(node.url);
|
67
87
|
|
88
|
+
node.log(`new engine client (without credentials): ${JSON.stringify(node.engineClient)}`);
|
89
|
+
|
68
90
|
node.eventEmitter.emit('engine-client-changed');
|
69
91
|
}
|
70
92
|
}
|