@yarkivaev/scada 2.5.4 → 2.5.6

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/README.md CHANGED
@@ -219,6 +219,7 @@ Set `SINK_DB_PROFILE=central|edge`. Migrations run at supervisor-sink startup vi
219
219
  | `POSTGRES_ADMIN_URL` | Admin user for migrations |
220
220
  | `SINK_DB_PROFILE` | `central` or `edge` |
221
221
  | `SINK_PIPELINES` | `false` skips STOMP segment, decision, and alert consumers. The site container sets this and a `supervisor-sink` container keeps the default |
222
+ | `SEGMENT_REPAIR_HISTORY_ON_START` | `false` preserves closed historical boundaries at ingest startup. Omitted or `true` retains the existing same-name gap repair. Live ingest and silent-open handling remain active. |
222
223
  | `STATE_HTTP_PORT` / `STATE_HTTP_TOKEN` | Edge internal API |
223
224
  | `MQTT_URL`, `MQTT_TOPICS` | Optional metrics ingest |
224
225
  | `CLICKHOUSE_URL` | Central metrics sink |
@@ -580,6 +581,14 @@ servers:
580
581
 
581
582
  This changes the selected server only; it does not mutate the shared profile.
582
583
 
584
+ The optional `mdmesh` module projects `chart` settings into `releases(...).scada.mdmesh`,
585
+ with its explicit `namespace` and `enabled` (default `true`) taking precedence.
586
+ It uses the same profile inheritance and server overrides. A consuming application
587
+ owns the MDMesh chart and deployment; the generic application chart does not install it.
588
+ An optional root `hmi` catalog passes through reading, includes, expansion, and release
589
+ projection as `releases(...).hmi` without interpretation. Catalog validation belongs
590
+ to the consuming application.
591
+
583
592
  ### Central backup freshness
584
593
 
585
594
  Silent Modbus backup sources use `MX210/<device>` freshness identities. AMQP telemetry tracks `<source-family>/<device>`, so cooling for a device cannot hide missing MX210 electrical samples. Measurement topic paths are unchanged. Custom freshness callbacks must pass the source’s full identity to `seen()`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarkivaev/scada",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "SCADA domain objects, state persistence, and plant monitoring",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,6 +41,7 @@ export default function expand(document) {
41
41
  assertProfiles(document.servers || [], profiles);
42
42
  const servers = expandServers(document.servers || [], paths, document.mappings || {});
43
43
  return frozen({
44
+ ...(document.hmi !== undefined && { hmi: document.hmi }),
44
45
  mappings: document.mappings || {},
45
46
  namespace,
46
47
  profiles,
@@ -23,6 +23,10 @@ function bindOne(name, spec, secret) {
23
23
  if (name === 'telemetry_store') {
24
24
  return ['clickhouse', { enabled: spec.enabled !== false }];
25
25
  }
26
+ if (name === 'mdmesh') {
27
+ return ['mdmesh', { ...spec.chart, ...(spec.namespace !== undefined && { namespace: spec.namespace }),
28
+ enabled: spec.enabled !== false }];
29
+ }
26
30
  throw new Error(`system document has no module ${name}`);
27
31
  }
28
32
 
@@ -31,7 +35,7 @@ function bindOne(name, spec, secret) {
31
35
  *
32
36
  * @param {object} profile - server profile
33
37
  * @param {string|undefined} secret - state-store Secret name
34
- * @returns {object} postgres, rabbitmq, and clickhouse fragments
38
+ * @returns {object} postgres, rabbitmq, clickhouse, and mdmesh fragments
35
39
  * @example
36
40
  * bindModules({ modules: { telemetry_store: { enabled: true } } }, 'pg');
37
41
  */
@@ -110,6 +110,7 @@ export default function releases(document, cluster) {
110
110
  const profile = profileFor(expanded, host);
111
111
  assertHeld(expanded, links);
112
112
  return frozen({
113
+ ...(expanded.hmi !== undefined && { hmi: expanded.hmi }),
113
114
  ...(profile.target && { target: profile.target }),
114
115
  apps: passedApps(profile),
115
116
  scada: scadaRelease(expanded, host, profile, links)
@@ -30,6 +30,14 @@ function milliseconds(env, key, fallback) {
30
30
  return value;
31
31
  }
32
32
 
33
+ function historyRepair(value) {
34
+ if (value === undefined) { return true; }
35
+ if (value !== 'true' && value !== 'false') {
36
+ throw new TypeError('SEGMENT_REPAIR_HISTORY_ON_START must be true or false');
37
+ }
38
+ return value === 'true';
39
+ }
40
+
33
41
  export function readDeploymentConfig(env) {
34
42
  const root = path.join(appRoot, '../..');
35
43
  const prefetch = Number(env.STOMP_PREFETCH || '128');
@@ -54,6 +62,7 @@ export function readDeploymentConfig(env) {
54
62
  requestTimeoutMs: parseRequestTimeoutMs(env.REQUEST_TIMEOUT_MS),
55
63
  pipelines: env.COLLECTOR_MODE !== 'external' && env.SINK_PIPELINES !== 'false',
56
64
  pipeline: {
65
+ repairHistoryOnStart: historyRepair(env.SEGMENT_REPAIR_HISTORY_ON_START),
57
66
  transactions: segmentTransactionConfig(env, dbPoolMax),
58
67
  maxMessageBytes: milliseconds(env, 'STOMP_MAX_MESSAGE_BYTES', 1048576),
59
68
  maxPendingBytes: milliseconds(env, 'STOMP_MAX_PENDING_BYTES', prefetch * 1048576),
@@ -43,6 +43,14 @@ function segmentSinks(postgres, pool) {
43
43
  };
44
44
  }
45
45
 
46
+ function pipelineSettings(config) {
47
+ const settings = config.transactions?.enabled ? { ...config, transactions: segmentBatchPolicy(config.transactions) } : config;
48
+ if (settings.repairHistoryOnStart !== undefined && typeof settings.repairHistoryOnStart !== 'boolean') {
49
+ throw new TypeError('repairHistoryOnStart must be boolean');
50
+ }
51
+ return settings;
52
+ }
53
+
46
54
  /**
47
55
  * Pipeline for streaming STOMP segment data to PostgreSQL segments table.
48
56
  * Subscribes to the durable ingest queue so shovel traffic survives consumer gaps.
@@ -56,7 +64,7 @@ function segmentSinks(postgres, pool) {
56
64
  * @returns {object} Pipeline with start() and stop() methods
57
65
  */
58
66
  export default function segmentPipeline(stomp, postgres, pool, config) {
59
- const settings = config.transactions?.enabled ? { ...config, transactions: segmentBatchPolicy(config.transactions) } : config;
67
+ const settings = pipelineSettings(config);
60
68
  const budget = silenceBudget(settings.segmentWindow || 15);
61
69
  const { segmentSink, splitSink } = segmentSinks(postgres, pool);
62
70
  const continued = continuedSegments(segmentSink, pool, budget);
@@ -89,10 +97,12 @@ export default function segmentPipeline(stomp, postgres, pool, config) {
89
97
  health() { return source.health(); },
90
98
  destination,
91
99
  async start() {
92
- const repair = abutSegments(pool, budget);
93
- void repair.catch((error) => {
94
- processingErrorLog('abut_segments', error, { budgetSeconds: budget });
95
- });
100
+ if (settings.repairHistoryOnStart !== false) {
101
+ const repair = abutSegments(pool, budget);
102
+ void repair.catch((error) => {
103
+ processingErrorLog('abut_segments', error, { budgetSeconds: budget });
104
+ });
105
+ }
96
106
  await source.start();
97
107
  await silence.start();
98
108
  },