@yarkivaev/scada-server 1.1.2 → 1.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarkivaev/scada-server",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Composable SCADA server implementing Supervisor API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,18 +41,18 @@ export default function segmentRoute(basePath, plant) {
41
41
  options.to = query.to;
42
42
  }
43
43
  const segments = await machine.segments.query(options);
44
- const items = segments.map((s) => {
44
+ const items = segments.map(({ name, start_time: startTime, end_time: endTime, duration, options: opts, label }) => {
45
45
  const mapped = {
46
- name: s.name,
47
- start: s.startTime.toISOString(),
48
- end: s.duration === 0 ? new Date().toISOString() : s.endTime.toISOString(),
49
- duration: s.duration
46
+ name,
47
+ start: startTime.toISOString(),
48
+ end: duration === 0 ? new Date().toISOString() : endTime.toISOString(),
49
+ duration
50
50
  };
51
- if (s.options) {
52
- mapped.options = s.options;
51
+ if (opts) {
52
+ mapped.options = opts;
53
53
  }
54
- if (s.label) {
55
- mapped.label = s.label;
54
+ if (label) {
55
+ mapped.label = label;
56
56
  }
57
57
  return mapped;
58
58
  });