@halsystems/red-bacnet 2.2.0-alpha.1 → 2.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.0]
4
+ ### Changed
5
+ - Matched v2.2.0-alpha.2 release
6
+
7
+ ## [2.2.0-alpha.2]
8
+ ### Changed
9
+ - all `nodes` retained original `msg` properties
10
+ - `writePoint` emit `payload` with failed points after completion
11
+
3
12
  ## [2.2.0-alpha.1]
4
13
  ### Changed
5
14
  - `ConcorrentTasksWithNetworkAwareness` added `invoke-id` generator and tracking
package/common/bacnet.js CHANGED
@@ -402,7 +402,12 @@ module.exports = {
402
402
  getNextInvokeId
403
403
  );
404
404
  } catch (err) {
405
- eventEmitter.emit(EVENT_ERROR, { id: id, error: getErrMsg(err) });
405
+ eventEmitter.emit(EVENT_ERROR, {
406
+ point: {
407
+ [point.id]: point.value
408
+ },
409
+ error: getErrMsg(err)
410
+ });
406
411
  }
407
412
  return
408
413
  }
@@ -89,9 +89,6 @@ module.exports = {
89
89
  }
90
90
 
91
91
  this.msg.payload = validatedDevices;
92
- delete this.msg.network;
93
- delete this.msg.lowLimit;
94
- delete this.msg.highLimit;
95
92
  this.eventEmitter.emit(EVENT_OUTPUT, this.msg);
96
93
  this.#updateProgress(100)
97
94
  resolve();
@@ -249,7 +249,6 @@ module.exports = {
249
249
 
250
250
  this.msg.payload = exportPointsList;
251
251
  this.msg.device = device;
252
- delete this.msg.devices;
253
252
  this.eventEmitter.emit(EVENT_OUTPUT, this.msg);
254
253
  }
255
254
  }
@@ -313,8 +313,6 @@ module.exports = {
313
313
  }
314
314
 
315
315
  this.msg.payload = exportPoints;
316
- delete this.msg.devices;
317
- delete this.msg.points;
318
316
  this.eventEmitter.emit(EVENT_OUTPUT, this.msg);
319
317
  }
320
318
  }
@@ -20,6 +20,7 @@ const {
20
20
  module.exports = {
21
21
  WritePointJob: class WritePointJob extends BaseJob {
22
22
  writePointDetails = {}
23
+ failedPoints = {}
23
24
  devicePointSeparator = '.';
24
25
 
25
26
  constructor(
@@ -176,14 +177,7 @@ module.exports = {
176
177
  }
177
178
 
178
179
  // add point details
179
- pointDetails[id] = {
180
- deviceName: p.deviceName,
181
- bacType: p.bacType,
182
- bacInstance: p.bacInstance,
183
- bacProp: p.bacProp,
184
- valueType: p.valueType,
185
- priority: p.priority
186
- }
180
+ pointDetails[id] = { ...p };
187
181
  });
188
182
 
189
183
  if (pointSchemaErrList.length > 0) {
@@ -307,6 +301,7 @@ module.exports = {
307
301
  });
308
302
 
309
303
  smartWriteEvent.on(EVENT_ERROR, (data) => {
304
+ Object.assign(this.failedPoints, data.point);
310
305
  this.eventEmitter.emit(EVENT_ERROR, errMsg(
311
306
  this.name, ERR_WRITING_POINT, data
312
307
  ));
@@ -319,34 +314,8 @@ module.exports = {
319
314
  }
320
315
 
321
316
  #exportWriteResults() {
322
- // Separate successful and failed points
323
- const failedPoints = {};
324
- let totalPoints = 0;
325
- let successfulPoints = 0;
326
-
327
- Object.entries(this.writePointDetails).forEach(([key, value]) => {
328
- totalPoints++;
329
- // Check if point has an error property (would be set if write failed)
330
- if (value.error) {
331
- failedPoints[key] = value;
332
- } else {
333
- successfulPoints++;
334
- }
335
- });
336
-
337
317
  // Update msg with results
338
- this.msg.payload = failedPoints;
339
- this.msg.result = {
340
- written: successfulPoints,
341
- failed: Object.keys(failedPoints).length,
342
- total: totalPoints
343
- };
344
-
345
- // Remove input properties from msg
346
- delete this.msg.devices;
347
- delete this.msg.points;
348
- delete this.msg.writePoints;
349
-
318
+ this.msg.payload = this.failedPoints;
350
319
  this.eventEmitter.emit(EVENT_OUTPUT, this.msg);
351
320
  }
352
321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@halsystems/red-bacnet",
3
- "version": "2.2.0-alpha.1",
3
+ "version": "2.2.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -95,7 +95,7 @@
95
95
  <dt class="optional">msg.id <span class="property-type">string | number</span></dt>
96
96
  <dd> Job ID. Default to <code>discoverPoints</code> if not provided.</dd>
97
97
  <dt class="optional">msg.priority <span class="property-type">number</span></dt>
98
- <dd> Job priority in queue. Default to <code>5</code> if not provided.</dd>
98
+ <dd> Job priority in queue. Default to <code>5</code> if not provided.</dd>
99
99
  </dl>
100
100
 
101
101
  <h3>Outputs</h3>
@@ -91,7 +91,7 @@
91
91
  <dd> Job ID. Default to <code>readPoints</code> if not provided.</dd>
92
92
 
93
93
  <dt class="optional">msg.priority <span class="property-type">number</span></dt>
94
- <dd> Job priority in queue. Default to <code>2</code> if not provided.</dd>
94
+ <dd> Job priority in queue. Default to <code>3</code> if not provided.</dd>
95
95
  </dl>
96
96
 
97
97
  <h3>Outputs</h3>
@@ -82,6 +82,12 @@
82
82
  <dd> Job priority in queue. Default to <code>2</code> if not provided.</dd>
83
83
  </dl>
84
84
 
85
+ <h3>Outputs</h3>
86
+ <dl class="message-properties">
87
+ <dt>msg.payload <span class="property-type">object</span></dt>
88
+ <dd>Failed to write points.</dd>
89
+ </dl>
90
+
85
91
  <h3>Details</h3>
86
92
  <p>If node is triggered while existing job is running, new job will be coalesced if <code>msg.id</code> are identical, else new job will be put in queue until current job is completed.</p>
87
93
  </script>