homebridge-philips-hue-sync-box
Version:
Homebridge plugin for the Philips Hue Sync Box.
30 lines • 1.36 kB
TypeScript
import { Execution, Hue, State } from '../state.js';
export type ValidationResult<T> = {
ok: true;
value: Partial<T>;
} | {
ok: false;
error: string;
};
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
/**
* Confirms the shape every accessory unconditionally dereferences
* (device.name/firmwareVersion/uniqueId, execution.mode/hdmiSource/
* brightness, hue.groups[*].name, hdmi.input1-4.name) is actually present,
* so a malformed or spoofed Sync Box response fails here instead of
* throwing a TypeError - or forwarding NaN/empty values to HomeKit - deep
* inside an accessory's update().
*/
export declare function isValidState(value: unknown): value is State;
/**
* Applies the same bounds/allowlist checks the HomeKit-driven accessory code applies
* before calling SyncBoxClient.updateExecution, so the API server can't be used to send
* values no legitimate code path would ever produce.
*/
export declare function validateExecution(input: unknown): ValidationResult<Execution>;
/**
* Mirrors EntertainmentTvDevice's group-existence check: only a groupId that exists in
* the device's current state may be forwarded to SyncBoxClient.updateHue.
*/
export declare function validateHue(input: unknown, state: State | null): ValidationResult<Hue>;
//# sourceMappingURL=validation.d.ts.map