node-red-contrib-uos-nats 0.1.41 → 0.1.43

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 CHANGED
@@ -43,10 +43,24 @@ export function buildReadVariablesResponse(defs, states, fingerprint) {
43
43
  builder.finish(response.pack(builder));
44
44
  return builder.asUint8Array();
45
45
  }
46
+ // Helper to omit field if null/empty
47
+ import { ReadVariablesQueryRequest } from './fbs/weidmueller/ucontrol/hub/read-variables-query-request.js';
48
+
46
49
  export function buildReadVariablesQuery(ids) {
47
- const query = new ReadVariablesQueryRequestT(ids ?? []);
48
50
  const builder = new flatbuffers.Builder(128);
49
- builder.finish(query.pack(builder));
51
+ let idsOffset = 0;
52
+
53
+ if (ids && ids.length > 0) {
54
+ idsOffset = ReadVariablesQueryRequest.createIdsVector(builder, ids);
55
+ }
56
+
57
+ ReadVariablesQueryRequest.startReadVariablesQueryRequest(builder);
58
+ if (idsOffset > 0) {
59
+ ReadVariablesQueryRequest.addIds(builder, idsOffset);
60
+ }
61
+ const offset = ReadVariablesQueryRequest.endReadVariablesQueryRequest(builder);
62
+
63
+ builder.finish(offset);
50
64
  return builder.asUint8Array();
51
65
  }
52
66
  export function decodeVariableList(list) {
@@ -135,8 +135,13 @@ module.exports = function (RED) {
135
135
  let targetIds = [];
136
136
  if (this.variables.length > 0) {
137
137
  // Reverse lookup: Find Def by Key
138
- // Only needed if we want to filter at source (which we do now to avoid empty list issues)
139
138
  const requestedKeys = new Set(this.variables);
139
+
140
+ // Debug Map Content before filtering
141
+ // if (defMap.size > 0 && providerRequestCount < 2) {
142
+ // this.warn(`DefMap Dump (Size ${defMap.size}): ${Array.from(defMap.values()).map(d=>d.key).slice(0,5).join(', ')} ...`);
143
+ // }
144
+
140
145
  for (const def of defMap.values()) {
141
146
  if (requestedKeys.has(def.key)) {
142
147
  targetIds.push(Number(def.id));
@@ -145,7 +150,12 @@ module.exports = function (RED) {
145
150
  if (targetIds.length === 0 && defMap.size > 0) {
146
151
  // We have definitions but found no matching keys for our config.
147
152
  // This implies misconfiguration or name changes.
153
+ const sampleKeys = Array.from(defMap.values()).map(d => `'${d.key}'`).slice(0, 5).join(', ');
154
+ const reqSample = this.variables.map(v => `'${v}'`).slice(0, 5).join(', ');
148
155
  this.warn(`Snapshot Warning: None of the ${this.variables.length} configured variables were found in the Provider Definition.`);
156
+ this.warn(` -> Requested: [${reqSample}...]`);
157
+ this.warn(` -> Available in DefMap (Size: ${defMap.size}): [${sampleKeys}...]`);
158
+ this.warn(` -> Please check for typos or prefix mismatches.`);
149
159
  }
150
160
  }
151
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "Node-RED nodes for u-OS Data Hub via NATS",
5
5
  "repository": {
6
6
  "type": "git",