@yarkivaev/scada 2.3.84 → 2.3.85
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
|
@@ -42,14 +42,24 @@ function segmentRow(parsed, startTime, endTime) {
|
|
|
42
42
|
return row;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function emitPiece(bus, piece) {
|
|
46
|
+
const times = timestamps(piece);
|
|
47
|
+
bus.emit({ type: 'created', segment: segmentRow(piece, times.startTime, times.endTime) });
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
function consume(raw, buses) {
|
|
46
51
|
const parsed = JSON.parse(raw.payload);
|
|
47
52
|
const bus = buses[parsed.machine];
|
|
48
53
|
if (!bus) {
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
if (parsed.type === 'split-family' && Array.isArray(parsed.pieces)) {
|
|
57
|
+
parsed.pieces.forEach((piece) => {
|
|
58
|
+
emitPiece(bus, piece);
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
emitPiece(bus, parsed);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
/**
|
|
@@ -57,6 +67,8 @@ function consume(raw, buses) {
|
|
|
57
67
|
*
|
|
58
68
|
* Subscribes to STOMP segment exchange and emits created events
|
|
59
69
|
* on per-machine timeline pubsub buses for SSE delivery.
|
|
70
|
+
* A split-family envelope emits one event per piece. The envelope
|
|
71
|
+
* itself has no start or end, and must not be read as one segment.
|
|
60
72
|
*
|
|
61
73
|
* @param {function} source - factory(collector) returning { start(), stop() }
|
|
62
74
|
* @param {object} buses - map of machine IDs to pubsub buses with emit()
|