node-red-contrib-uos-nats 0.1.30 → 0.1.32

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.
@@ -48,11 +48,14 @@ module.exports = function (RED) {
48
48
  };
49
49
 
50
50
  const processStates = (states) => {
51
+ // Helper to find definition by ID (fuzzy match string/number)
52
+ const getDef = (id) => defMap.get(id) || defMap.get(String(id)) || defMap.get(Number(id));
53
+
51
54
  return states
52
55
  .map((state) => ({
53
56
  providerId: this.providerId,
54
57
  id: state.id,
55
- key: defMap.get(state.id)?.key || state.id,
58
+ key: getDef(state.id)?.key || state.id,
56
59
  value: state.value,
57
60
  quality: state.quality,
58
61
  timestampNs: state.timestampNs,
@@ -60,6 +63,8 @@ module.exports = function (RED) {
60
63
  .filter((state) => shouldInclude(state.key));
61
64
  };
62
65
 
66
+ let performSnapshot = async () => { }; // Placeholder
67
+
63
68
  const start = async () => {
64
69
  try {
65
70
  this.status({ fill: 'yellow', shape: 'ring', text: 'connecting…' });
@@ -77,7 +82,7 @@ module.exports = function (RED) {
77
82
  nc = await connection.acquire();
78
83
  this.status({ fill: 'green', shape: 'dot', text: 'connected' });
79
84
 
80
- const performSnapshot = async () => {
85
+ performSnapshot = async () => {
81
86
  // Only request snapshot if connected
82
87
  if (!nc || nc.isClosed()) return;
83
88
  try {
@@ -90,11 +95,13 @@ module.exports = function (RED) {
90
95
  this.send({ payload: { type: 'snapshot', variables: filteredSnapshot } });
91
96
  }
92
97
  } catch (requestErr) {
93
- // Snapshot failed (timeout or no provider), log but don't stop
94
- // this.warn(`Snapshot failed: ${requestErr.message}`);
98
+ // Log snapshot failures to help debugging
99
+ this.warn(`Snapshot failed: ${requestErr.message}`);
95
100
  }
96
101
  };
97
102
 
103
+
104
+
98
105
  // Initial snapshot
99
106
  await performSnapshot();
100
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Node-RED nodes for u-OS Data Hub via NATS",
5
5
  "repository": {
6
6
  "type": "git",