import type { ENTITY_STATE, PICK_ENTITY, TRawDomains } from "@digital-alchemy/hass"; import type { AddEntityOptions, TSerialize } from "./base-domain.mts"; import type { EntityConfigCommon, Updatable } from "./common-config.mts"; import type { TSynapseId } from "./utility.mts"; export type TSynapseEntityStorage = { unique_id: TSynapseId; keys: () => string[]; purge: () => void; set: (key: KEY, value: CONFIGURATION[KEY]) => Promise; get: (key: KEY) => CONFIGURATION[KEY]; isStored(key: string): key is Extract; export: () => CONFIGURATION; }; export type AddStateOptions, DATA extends object> = { domain: TRawDomains; /** * Automatically trigger reactive config updates in response to updates from these entities * * List gets merged with `onUpdate` array in the configs, is convenient shorthand */ bind?: Updatable[]; entity: AddEntityOptions, ATTRIBUTES, LOCALS, DATA>; /** * initial import from typescript defs */ load_config_keys: (keyof AddEntityOptions, ATTRIBUTES, LOCALS, DATA>)[]; } & TSerialize; export type ConfigMapper = { key: KEY; load(entity: ENTITY_STATE): unknown; } | KEY;