Skip to content

eufy-mega / model/capabilities / CapabilityActions

Type Alias: CapabilityActions

ts
type CapabilityActions = Record<string, (...args) => any>;

The loose base for a capability's bound action object — a bag of async methods. Each module declares its own precise, JSDoc'd alias (e.g. PtzActions, CameraActions) and returns THAT from actions(); those aliases are what the fluent dev.<cap>() accessors expose (assembled into DeviceActionMap in the barrel). This base only exists so CapabilityModule.actions has a common return type that every concrete alias is assignable to. Control actions resolve to void (they dispatch a Command); media actions resolve to data — a Promise of a still/stream/buffer, or a synchronous AsyncIterable (continuous fragment recording), so the return type is any.

This models the common case: a methods-bag (control capabilities). A READ-ONLY data capability (info, returning a plain DeviceInfo) is the deliberate exception — it asserts its result to this type locally (see info.ts) rather than weaken this base for every module. The consumer-facing types stay precise via DeviceActionMap (ptz: PtzActions, info: DeviceInfo, …), from which the fluent dev.<cap>() accessors are derived.

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations or eufy. "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.