/** * @file Node-RED helper that stores external actor state for `lsh-logic`. * * The coordinator reads external actors from Node-RED context using * `${otherDevicesPrefix}.${actorName}.state`. This helper owns the repetitive * edge work around MQTT payloads: extracting an actor name, normalizing odd * vendor states to boolean values, and writing the context path consistently. */ import type { Node, NodeAPI } from "node-red"; import type { ContextName } from "./node-red-runtime"; type PrefixSource = "config" | "manual"; type ActorNameSource = "msg" | "config"; type LshExternalStateNodeDef = { id: string; type: string; name: string; z: string; storeContext: ContextName; prefixSource: PrefixSource; prefix: string; configContext: ContextName; configKey: string; actorNameSource: ActorNameSource; actorName: string; actorNameProperty: string; stateProperty: string; trueValues: string; falseValues: string; caseSensitive: boolean | string; invert: boolean | string; acceptRetained: boolean | string; storeOnlyChanges: boolean | string; storeMetadata: boolean | string; configWaitTimeoutMs?: number | string; }; /** * Runtime class attached to a single `lsh-external-state` Node-RED node instance. */ export declare class LshExternalStateNode { private readonly node; private readonly red; private readonly config; private readonly pendingStores; /** * Creates one runtime instance and validates the editor configuration once. */ constructor(node: Node, red: NodeAPI, config: LshExternalStateNodeDef); /** * Wires Node-RED lifecycle events and guarantees pending timers are cleaned up. */ private registerNodeEventHandlers; /** * Handles one external state message and always completes the Node-RED callback. */ private handleInput; /** * Extracts actor/state data from a message and rejects ambiguous values. */ private parseUpdate; /** * Converts raw integration-specific state into a boolean without guessing. */ private normalizeExternalState; /** * Resolves the target context prefix and stores the update when possible. */ private tryStoreUpdate; /** * Resolves the external actor prefix from config export or manual config. */ private resolvePrefix; /** * Writes state and optional metadata to the selected Node-RED context store. */ private storeWithPrefix; /** * Queues config-readiness problems or reports them immediately when waiting is disabled. */ private deferOrSkip; /** * Stores the latest pending state for an actor and schedules the next config check. */ private queuePendingStore; /** * Re-checks one queued actor and stores it once lsh_config is readable. */ private retryPendingStore; /** * Reads a configured Node-RED message property using the runtime utility API. */ private readMessageProperty; /** * Selects the configured flow/global context store. */ private getContext; /** * Formats the warning shown when state parsing rejects an input message. */ private invalidStateWarning; /** * Formats the warning shown when exported lsh_config is unavailable. */ private missingConfigWarning; /** * Reports an intentional no-op without throwing or failing the Node-RED message. */ private skip; /** * Updates the Node-RED node status with the package-wide status shape. */ private setStatus; } export {}; //# sourceMappingURL=lsh-external-state.d.ts.map