feat(formatters): frost handoff formatter + config wiring
Adds src/helper/formatters/frostFormatter.js — structured-envelope formatter parallel to the InfluxDB one. Produces dbase messages that a CoreSync collector can forward to FROST/SensorThings without coupling producing nodes to FROST HTTP details. Registered in formatters/index.js. Config additions in 4 node schemas (machineGroupControl, measurement, pumpingStation, rotatingMachine) expose the new dbase format option in the editor. Part of the CoreSync FROST handoff initiative — see superproject CORESYNC_FROST_INTERVIEW_HANDOFF.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,7 @@
|
|||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
||||||
|
{ "value": "frost", "description": "FROST/SensorThings CoreSync payload." },
|
||||||
{ "value": "json", "description": "Raw JSON payload." },
|
{ "value": "json", "description": "Raw JSON payload." },
|
||||||
{ "value": "csv", "description": "CSV-formatted payload." }
|
{ "value": "csv", "description": "CSV-formatted payload." }
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -120,6 +120,7 @@
|
|||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
||||||
|
{ "value": "frost", "description": "FROST/SensorThings CoreSync payload." },
|
||||||
{ "value": "json", "description": "Raw JSON payload." },
|
{ "value": "json", "description": "Raw JSON payload." },
|
||||||
{ "value": "csv", "description": "CSV-formatted payload." }
|
{ "value": "csv", "description": "CSV-formatted payload." }
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -166,6 +166,10 @@
|
|||||||
"value": "influxdb",
|
"value": "influxdb",
|
||||||
"description": "InfluxDB telemetry payload."
|
"description": "InfluxDB telemetry payload."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"value": "frost",
|
||||||
|
"description": "FROST/SensorThings CoreSync payload."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"value": "json",
|
"value": "json",
|
||||||
"description": "JSON payload."
|
"description": "JSON payload."
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
{ "value": "influxdb", "description": "InfluxDB line-protocol payload (default)." },
|
||||||
|
{ "value": "frost", "description": "FROST/SensorThings CoreSync payload." },
|
||||||
{ "value": "json", "description": "Raw JSON payload." },
|
{ "value": "json", "description": "Raw JSON payload." },
|
||||||
{ "value": "csv", "description": "CSV-formatted payload." }
|
{ "value": "csv", "description": "CSV-formatted payload." }
|
||||||
],
|
],
|
||||||
|
|||||||
23
src/helper/formatters/frostFormatter.js
Normal file
23
src/helper/formatters/frostFormatter.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* FROST handoff formatter
|
||||||
|
* -----------------------
|
||||||
|
* Keeps the same structured envelope as the InfluxDB formatter so a shared
|
||||||
|
* CoreSync collector can accept existing EVOLV dbase messages without coupling
|
||||||
|
* producing nodes to FROST HTTP details.
|
||||||
|
*/
|
||||||
|
function format(measurement, metadata) {
|
||||||
|
const { fields, tags, config } = metadata;
|
||||||
|
return {
|
||||||
|
measurement,
|
||||||
|
fields,
|
||||||
|
tags: tags || {},
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
source: {
|
||||||
|
nodeId: config?.general?.id,
|
||||||
|
softwareType: config?.functionality?.softwareType,
|
||||||
|
unit: config?.general?.unit || config?.asset?.unit,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { format };
|
||||||
@@ -14,6 +14,7 @@ const influxdbFormatter = require('./influxdbFormatter');
|
|||||||
const jsonFormatter = require('./jsonFormatter');
|
const jsonFormatter = require('./jsonFormatter');
|
||||||
const csvFormatter = require('./csvFormatter');
|
const csvFormatter = require('./csvFormatter');
|
||||||
const processFormatter = require('./processFormatter');
|
const processFormatter = require('./processFormatter');
|
||||||
|
const frostFormatter = require('./frostFormatter');
|
||||||
|
|
||||||
// Built-in registry
|
// Built-in registry
|
||||||
const registry = {
|
const registry = {
|
||||||
@@ -21,6 +22,7 @@ const registry = {
|
|||||||
json: jsonFormatter,
|
json: jsonFormatter,
|
||||||
csv: csvFormatter,
|
csv: csvFormatter,
|
||||||
process: processFormatter,
|
process: processFormatter,
|
||||||
|
frost: frostFormatter,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user