import type { Camera, Chime, Fob, Light, ProtectClient, Relay, Sensor, Viewer } from "../../index.ts"; /** * Any device projection the CLI can address. The NVR is intentionally excluded - it is a state singleton with no device projection, so commands that act on the * controller itself (a reboot) handle it explicitly rather than through device lookup. * * @category CLI */ export type AnyDevice = Camera | Chime | Fob | Light | Relay | Sensor | Viewer; /** * Every device projection in the current state, across every device category, in a single flat array. The basis for name resolution and id/name lookup. * * @param client - The connected client. * * @returns All device projections. * * @category CLI */ export declare function allDevices(client: ProtectClient): AnyDevice[]; /** * The device categories the CLI selects a *class* of devices by - the plural words shared verbatim across `watch state `, `reboot `, and * `info [category]`, so the vocabulary is learned once and means the same thing wherever a command names a class of devices. This is the single source for that name set; * `watch state`'s selector map is typed against {@link DeviceCategory} so it cannot drift from it. * * @category CLI */ export declare const DEVICE_CATEGORIES: readonly ["cameras", "chimes", "fobs", "lights", "relays", "sensors", "viewers"]; /** * One of the {@link DEVICE_CATEGORIES} plural words. * * @category CLI */ export type DeviceCategory = typeof DEVICE_CATEGORIES[number]; /** * Whether a raw token is one of the device-category words. The membership test that lets a command resolve a positional to "a class of devices." * * @param token - The token as typed. * * @returns `true` when `token` is a known device category. * * @category CLI */ export declare function isDeviceCategory(token: string): token is DeviceCategory; /** * The device projections of one category, read live from the client. The single mapping from a category word to its projection collection, shared by the commands that * act on or list a whole class (`reboot ` rebooting each, `info [category]` listing them). * * @param client - The connected client. * @param category - The device category. * * @returns That category's device projections. * * @category CLI */ export declare function devicesInCategory(client: ProtectClient, category: DeviceCategory): readonly AnyDevice[]; /** * Build a device-id-to-name resolver from the current state, used to render the `--device` filter and event output in names rather than opaque ids. Built once per * invocation from a snapshot; an id absent from the map (an event for a device that has since left state) resolves to `undefined` and the caller falls back to the id. * * @param client - The connected client. * * @returns A function mapping a device (or NVR) id to its display name, or `undefined` when unknown. * * @category CLI */ export declare function buildNameResolver(client: ProtectClient): (id: string) => string | undefined; /** * Resolve a device of a specific class by the operator's token - an exact id across all collections first, then a case-insensitive exact name match - and narrow it to * that class. This is the single source of truth for "resolve a token to a device of a given class": every class-specific command (the `camera`/`relay`/`chime` action * groups) resolves through it, so there is one resolution mechanism rather than one per class. A token that resolves to a device of a *different* class fails with a * precise message naming both classes, rather than silently acting on the wrong device or returning nothing. * * @typeParam K - The requested device class, as a `modelKey` literal. * * @param client - The connected client. * @param token - The device id or name as typed. * @param modelKey - The class the device must be, as its `modelKey` literal (`"camera"`, `"relay"`, `"chime"`, ...). * * @returns The matching device, narrowed to the requested class. * * @throws {@link CliError} when nothing matches, when a name is ambiguous, or when the token resolves to a device of a different class. * * @category CLI */ export declare function findDeviceOfType(client: ProtectClient, token: string, modelKey: K): Extract; /** * Resolve a camera by the operator's token - an exact id first (the unambiguous path), then a case-insensitive exact name match. A thin, typed convenience over * {@link findDeviceOfType}, so camera resolution and every other class-specific resolution share the one mechanism rather than maintaining a parallel resolver. * * @param client - The connected client. * @param token - The camera id or name as typed. * * @returns The matching camera. * * @throws {@link CliError} when nothing matches, or when a name is ambiguous. * * @category CLI */ export declare function findCamera(client: ProtectClient, token: string): Camera; /** * Resolve a device of any category by the operator's token - an exact id across all collections first, then a case-insensitive exact name match. * * @param client - The connected client. * @param token - The device id or name as typed. * * @returns The matching device projection. * * @throws {@link CliError} when nothing matches, or when a name is ambiguous. * * @category CLI */ export declare function findDevice(client: ProtectClient, token: string): AnyDevice; /** * The device projections a token matches - an exact id (at most one) or, failing that, every case-insensitive exact-name match. Returns the raw match set rather than * forcing it to one, so a caller can resolve "exactly one device" itself ({@link findDevice}) *or* decide what a zero-match means - which is what lets `reboot` try a * device first and fall back to a category word only when no device owns the name (the device-first resolution a destructive command wants). * * @param client - The connected client. * @param token - The device id or name as typed. * * @returns The matching device projections: empty when nothing matches, one for an id or unique name, several for an ambiguous name. * * @category CLI */ export declare function findDeviceMatches(client: ProtectClient, token: string): AnyDevice[]; //# sourceMappingURL=lookup.d.ts.map