@yarkivaev/scada 2.3.59 → 2.3.60
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/index.js
CHANGED
|
@@ -20,7 +20,8 @@ export { default as shopWithTimeline } from './src/application/shopWithTimeline.
|
|
|
20
20
|
export { default as plantOperations } from './src/application/plantOperations.js';
|
|
21
21
|
export { default as metricsPlant } from './src/application/metricsPlant.js';
|
|
22
22
|
export { default as plantServer } from './src/application/plantServer.js';
|
|
23
|
-
export { default as siteServer } from './src/application/siteServer.js';
|
|
23
|
+
export { default as siteServer, bindSiteOperations } from './src/application/siteServer.js';
|
|
24
|
+
export { acceptOperationDeliver } from './src/infrastructure/sync/operationSyncIngest.js';
|
|
24
25
|
export { default as foldedMetricsSink } from './src/application/foldedMetricsSink.js';
|
|
25
26
|
export {
|
|
26
27
|
default as siteOperatorCatalog,
|
package/package.json
CHANGED
|
@@ -6,9 +6,9 @@ import pubsub from '../domain/shared/pubsub.js';
|
|
|
6
6
|
*
|
|
7
7
|
* Optional kindSources inject non-PG kinds into listForMachine merges.
|
|
8
8
|
*
|
|
9
|
-
* @param {object} persistence - operations store with upsert, upsertMany, get, remove, listForMachine, latestForMachine
|
|
9
|
+
* @param {object} persistence - operations store with upsert, upsertMany, get, remove, drop, listForMachine, latestForMachine
|
|
10
10
|
* @param {object} [kindSources] - map of kind to { list(machineId, range) }
|
|
11
|
-
* @returns {object} operations with listForMachine, latestForMachine, upsert, upsertMany, get, remove, and stream
|
|
11
|
+
* @returns {object} operations with listForMachine, latestForMachine, upsert, upsertMany, get, remove, drop, and stream
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* const ops = plantOperations(dataAccess.operations, { temp: temperaturePort });
|
|
@@ -55,6 +55,19 @@ function startMqtt(sink, env) {
|
|
|
55
55
|
return pipeline;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Replaces sink persistence with the domain operations port used by plant HTTP and AMQP sync.
|
|
60
|
+
*
|
|
61
|
+
* @param {object} sink - supervisor sink with dataAccess.operations
|
|
62
|
+
* @param {object} [kindSources] - optional non-PG kind sources
|
|
63
|
+
* @returns {object} wrapped operations port
|
|
64
|
+
*/
|
|
65
|
+
export function bindSiteOperations(sink, kindSources) {
|
|
66
|
+
const ops = plantOperations(sink.dataAccess.operations, kindSources);
|
|
67
|
+
sink.dataAccess.operations = ops;
|
|
68
|
+
return ops;
|
|
69
|
+
}
|
|
70
|
+
|
|
58
71
|
function startOperationSync(sink, env) {
|
|
59
72
|
if (env.SINK_DB_PROFILE === 'edge' || !env.AMQP_URL) {
|
|
60
73
|
return undefined;
|
|
@@ -106,11 +119,7 @@ function siteExtraRoutes(catalog, extraRoutes) {
|
|
|
106
119
|
export default async function siteServer(config) {
|
|
107
120
|
const env = config.env || process.env;
|
|
108
121
|
const sink = supervisorSink(env);
|
|
109
|
-
const ops =
|
|
110
|
-
sink.dataAccess.operations,
|
|
111
|
-
config.kindSources || config.operationSources
|
|
112
|
-
);
|
|
113
|
-
sink.dataAccess.operations = ops;
|
|
122
|
+
const ops = bindSiteOperations(sink, config.kindSources || config.operationSources);
|
|
114
123
|
const http = edgeApi(sink.dataAccess, {
|
|
115
124
|
port: sink.apiPort,
|
|
116
125
|
token: sink.apiToken,
|
|
@@ -62,10 +62,10 @@ function writeMany(persistence, bus, items) {
|
|
|
62
62
|
* sorted by occurred_at. Omitted kinds default to injectable source keys.
|
|
63
63
|
* latestForMachine reads only from persistence (single kind).
|
|
64
64
|
*
|
|
65
|
-
* @param {object} persistence - store with upsert, get, remove, listForMachine, latestForMachine
|
|
65
|
+
* @param {object} persistence - store with upsert, get, remove, drop, listForMachine, latestForMachine
|
|
66
66
|
* @param {object} bus - pubsub instance with stream and emit methods
|
|
67
67
|
* @param {object} [kindSources] - map of kind to { list(machineId, range) }
|
|
68
|
-
* @returns {object} operations with listForMachine, latestForMachine, upsert, upsertMany, get, remove, stream
|
|
68
|
+
* @returns {object} operations with listForMachine, latestForMachine, upsert, upsertMany, get, remove, drop, stream
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
71
|
* const ops = operations(store, bus, { temp: temperaturePort });
|
|
@@ -107,6 +107,9 @@ export default function operations(persistence, bus, kindSources) {
|
|
|
107
107
|
return operation;
|
|
108
108
|
});
|
|
109
109
|
},
|
|
110
|
+
drop(machineId, key) {
|
|
111
|
+
return persistence.drop(machineId, key);
|
|
112
|
+
},
|
|
110
113
|
stream: bus.stream
|
|
111
114
|
};
|
|
112
115
|
}
|