'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); };