Refactor of reactor to use BaseNodeAdapter + commandRegistry + statusBadge. reactor 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>
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
// Reactor input handlers. Each receives (source, msg, ctx) where source is
|
|
// the Reactor domain and ctx is { node, RED, send, logger }. The handlers
|
|
// either forward to engine setters or drive a synchronous state update.
|
|
|
|
exports.dataClock = (source, msg) => {
|
|
source.updateState(msg.timestamp ?? Date.now());
|
|
};
|
|
|
|
exports.dataFluent = (source, msg) => { source.setInfluent = msg; };
|
|
exports.dataOTR = (source, msg) => { source.setOTR = msg; };
|
|
exports.dataTemperature = (source, msg) => { source.setTemperature = msg; };
|
|
exports.dataDispersion = (source, msg) => { source.setDispersion = msg; };
|
|
|
|
exports.childRegister = (source, msg, ctx) => {
|
|
const childId = msg.payload;
|
|
const RED = ctx?.RED;
|
|
const childObj = RED?.nodes?.getNode?.(childId);
|
|
if (!childObj || !childObj.source) {
|
|
source?.logger?.warn?.(`registerChild skipped: missing child/source for id=${childId}`);
|
|
return;
|
|
}
|
|
source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent);
|
|
};
|