node-red-contrib-uos-nats 0.2.17 → 0.2.20

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.
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <!-- Broadcast/antenna symbol (centered at 20,20) -->
3
+ <circle cx="20" cy="20" r="3" fill="white"/>
4
+
5
+ <!-- Inner waves (centered) -->
6
+ <path d="M 12,12 Q 8,20 12,28" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
7
+ <path d="M 28,12 Q 32,20 28,28" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
8
+
9
+ <!-- Outer waves (centered) -->
10
+ <path d="M 7,4 Q 2,20 7,36" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
11
+ <path d="M 33,4 Q 38,20 33,36" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
12
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <!-- Database cylinder (shifted up for 40x40) -->
3
+ <ellipse cx="20" cy="10" rx="14" ry="4" fill="none" stroke="white" stroke-width="2.5"/>
4
+ <line x1="6" y1="10" x2="6" y2="25" stroke="white" stroke-width="2.5"/>
5
+ <line x1="34" y1="10" x2="34" y2="25" stroke="white" stroke-width="2.5"/>
6
+ <ellipse cx="20" cy="25" rx="14" ry="4" fill="none" stroke="white" stroke-width="2.5"/>
7
+
8
+ <!-- Arrow pointing DOWN (data flowing out) -->
9
+ <line x1="20" y1="28" x2="20" y2="38" stroke="white" stroke-width="2.5"/>
10
+ <polyline points="16,34 20,38 24,34" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
11
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40">
2
+ <!-- Database cylinder (shifted up) -->
3
+ <ellipse cx="20" cy="30" rx="14" ry="4" fill="none" stroke="white" stroke-width="2.5"/>
4
+ <line x1="6" y1="30" x2="6" y2="15" stroke="white" stroke-width="2.5"/>
5
+ <line x1="34" y1="30" x2="34" y2="15" stroke="white" stroke-width="2.5"/>
6
+ <ellipse cx="20" cy="15" rx="14" ry="4" fill="none" stroke="white" stroke-width="2.5"/>
7
+
8
+ <!-- Arrow pointing UP (data flowing in/command) -->
9
+ <line x1="20" y1="12" x2="20" y2="2" stroke="white" stroke-width="2.5"/>
10
+ <polyline points="16,6 20,2 24,6" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
11
+ </svg>
@@ -77,7 +77,7 @@ export class VariableList {
77
77
  }
78
78
  static endVariableList(builder) {
79
79
  const offset = builder.endObject();
80
- builder.requiredField(offset, 6); // base_timestamp
80
+ // builder.requiredField(offset, 6); // base_timestamp - DISABLED for stability
81
81
  return offset;
82
82
  }
83
83
  unpack() {
@@ -84,7 +84,7 @@ export class Variable {
84
84
  }
85
85
  static endVariable(builder) {
86
86
  const offset = builder.endObject();
87
- builder.requiredField(offset, 6); // value
87
+ // builder.requiredField(offset, 6); // value - DISABLED for stability
88
88
  return offset;
89
89
  }
90
90
  unpack() {
@@ -120,6 +120,7 @@ module.exports = function (RED) {
120
120
  const [payloads, subjects] = await loadModules();
121
121
  nc = await connection.acquire();
122
122
  await sendDefinitionUpdate(payloads, subjects);
123
+ // Listen for Variable READ requests
123
124
  sub = nc.subscribe(subjects.readVariablesQuery(this.providerId), {
124
125
  callback: (err, msg) => {
125
126
  if (err) {
@@ -129,6 +130,26 @@ module.exports = function (RED) {
129
130
  handleRead(payloads, msg).catch((error) => this.warn(error.message));
130
131
  },
131
132
  });
133
+
134
+ // Listen for Definition READ requests (Discovery)
135
+ const defSub = nc.subscribe(subjects.readProviderDefinitionQuery(this.providerId), {
136
+ callback: (err, msg) => {
137
+ if (err) {
138
+ this.warn(`Def request error: ${err.message}`);
139
+ return;
140
+ }
141
+ if (!msg.reply) return;
142
+
143
+ // Send known definition
144
+ const { payload } = payloads.buildProviderDefinitionEvent(definitions);
145
+ nc.publish(msg.reply, payload);
146
+ }
147
+ });
148
+
149
+ // Track the subscription to close it later if needed (though existing code only tracks 'sub')
150
+ // Ideally we should track both or use a subscription manager, but for now let's hope 'sub' isn't the only one closed.
151
+ // Actually, looking at close(), it likely calls connection.release(). NATS connection close cleans up subs.
152
+
132
153
  this.status({ fill: 'green', shape: 'dot', text: 'ready' });
133
154
 
134
155
  this.on('input', async (msg, send, done) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-uos-nats",
3
- "version": "0.2.17",
3
+ "version": "0.2.20",
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",
@@ -59,5 +59,8 @@
59
59
  "datahub-output": "nodes/datahub-output.js",
60
60
  "datahub-write": "nodes/datahub-write.js"
61
61
  }
62
+ },
63
+ "devDependencies": {
64
+ "dotenv": "^17.2.3"
62
65
  }
63
66
  }
@@ -1,12 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 60">
2
- <!-- Broadcast/antenna symbol -->
3
- <circle cx="20" cy="30" r="3" fill="white"/>
4
-
5
- <!-- Inner waves -->
6
- <path d="M 12,22 Q 8,30 12,38" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
7
- <path d="M 28,22 Q 32,30 28,38" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
8
-
9
- <!-- Outer waves -->
10
- <path d="M 7,14 Q 2,30 7,46" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
11
- <path d="M 33,14 Q 38,30 33,46" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round"/>
12
- </svg>
@@ -1,11 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 60">
2
- <!-- Database cylinder -->
3
- <ellipse cx="20" cy="15" rx="14" ry="5" fill="none" stroke="white" stroke-width="2.5"/>
4
- <line x1="6" y1="15" x2="6" y2="35" stroke="white" stroke-width="2.5"/>
5
- <line x1="34" y1="15" x2="34" y2="35" stroke="white" stroke-width="2.5"/>
6
- <ellipse cx="20" cy="35" rx="14" ry="5" fill="none" stroke="white" stroke-width="2.5"/>
7
-
8
- <!-- Arrow pointing DOWN (data flowing out) -->
9
- <line x1="20" y1="40" x2="20" y2="55" stroke="white" stroke-width="2.5"/>
10
- <polyline points="15,50 20,55 25,50" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
11
- </svg>
@@ -1,11 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 60">
2
- <!-- Database cylinder -->
3
- <ellipse cx="20" cy="45" rx="14" ry="5" fill="none" stroke="white" stroke-width="2.5"/>
4
- <line x1="6" y1="45" x2="6" y2="25" stroke="white" stroke-width="2.5"/>
5
- <line x1="34" y1="45" x2="34" y2="25" stroke="white" stroke-width="2.5"/>
6
- <ellipse cx="20" cy="25" rx="14" ry="5" fill="none" stroke="white" stroke-width="2.5"/>
7
-
8
- <!-- Arrow pointing UP (data flowing in/command) -->
9
- <line x1="20" y1="20" x2="20" y2="5" stroke="white" stroke-width="2.5"/>
10
- <polyline points="15,10 20,5 25,10" fill="none" stroke="white" stroke-width="2.5" stroke-linejoin="round"/>
11
- </svg>