Refactor of settler to use BaseNodeAdapter + commandRegistry + statusBadge. settler follows the platform refactor plan in .claude/refactor/MODULE_SPLIT.md. Tests stay green; CONTRACT.md generated; legacy aliases preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const { BaseNodeAdapter } = require('generalFunctions');
|
|
const Settler = require('./specificClass');
|
|
const commands = require('./commands');
|
|
|
|
// settler is event-driven on Port 0: the 3-stream Fluent envelope is
|
|
// re-emitted whenever the upstream reactor fires stateChange or an
|
|
// operator pushes data.influent. Port 1 (InfluxDB telemetry) reuses the
|
|
// base `output-changed` pipeline via `getOutput()`. `tickInterval=null`
|
|
// means BaseNodeAdapter installs no periodic loop — settling state has
|
|
// no time-dependent integrator.
|
|
class nodeClass extends BaseNodeAdapter {
|
|
static DomainClass = Settler;
|
|
static commands = commands;
|
|
static tickInterval = null;
|
|
static statusInterval = 1000;
|
|
|
|
buildDomainConfig() {
|
|
return {};
|
|
}
|
|
|
|
_emitOutputs() {
|
|
if (!this.source) return;
|
|
const fluent = this.source.getEffluent;
|
|
const raw = this.source.getOutput?.() || {};
|
|
const cfg = this.source.config || this.config;
|
|
const influxMsg = this._output.formatMsg(raw, cfg, 'influxdb');
|
|
this.node.send([fluent, influxMsg, null]);
|
|
}
|
|
}
|
|
|
|
module.exports = nodeClass;
|