node-red-contrib-uos-nats 0.2.40 → 0.2.42
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/lib/payloads.js +26 -1
- package/nodes/datahub-output.js +2 -0
- package/package.json +1 -1
package/lib/payloads.js
CHANGED
|
@@ -432,10 +432,35 @@ function mapDataType(dataType) {
|
|
|
432
432
|
return VariableDataType.STRING;
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
+
// Map string types to Enum integers for hashing
|
|
436
|
+
function mapDataTypeToInt(dt) {
|
|
437
|
+
switch (dt) {
|
|
438
|
+
case 'INT64': return VariableDataType.INT64;
|
|
439
|
+
case 'FLOAT64': return VariableDataType.FLOAT64;
|
|
440
|
+
case 'STRING': return VariableDataType.STRING;
|
|
441
|
+
case 'BOOLEAN': return VariableDataType.BOOLEAN;
|
|
442
|
+
default: return VariableDataType.STRING;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
435
446
|
function computeFingerprint(defs) {
|
|
436
447
|
const hash = createHash('sha256');
|
|
437
448
|
for (const def of [...defs].sort((a, b) => a.id - b.id)) {
|
|
438
|
-
|
|
449
|
+
// Must match Python: id:key:type:access:experimental
|
|
450
|
+
// Python uses Enum.value (integer) for type and access
|
|
451
|
+
const dtInt = mapDataTypeToInt(def.dataType);
|
|
452
|
+
const acInt = mapAccessType(def.access);
|
|
453
|
+
const exp = def.experimental ?? false;
|
|
454
|
+
|
|
455
|
+
// Note: Python uses "True"/"False" string representation of bool?
|
|
456
|
+
// Python: f"{...}:{var.experimental}".encode() -> str(True) is "True"
|
|
457
|
+
// JS: String(true) is "true".
|
|
458
|
+
// Let's verify Python's bool stringification.
|
|
459
|
+
// Python str(True) -> 'True'. JS String(true) -> 'true'. Case mismatch!
|
|
460
|
+
// We must capitalize bools to match Python.
|
|
461
|
+
const expStr = exp ? 'True' : 'False';
|
|
462
|
+
|
|
463
|
+
hash.update(`${def.id}:${def.key}:${dtInt}:${acInt}:${expStr}`);
|
|
439
464
|
}
|
|
440
465
|
const digest = hash.digest();
|
|
441
466
|
return digest.readBigUInt64BE(0);
|
package/nodes/datahub-output.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-uos-nats",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.42",
|
|
4
4
|
"description": "Node-RED nodes for Weidmüller u-OS Data Hub. Read, write, and provide variables via NATS protocol with OAuth2 authentication. Features: Variable Key resolution, custom icons, example flows, and provider definition caching.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "IoTUeli",
|