/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { DataModelPath } from "@matter/model"; import type { ClusterId, CommandId } from "@matter/types"; import { ClusterType, EndpointNumber, Global, TlvSchema } from "@matter/types"; /** * A "specifier" addresses a specific element of the Matter data model in the context of a request. */ export declare namespace Specifier { /** * Minimal structural type for clusters used in requests. {@link ClusterType.Concrete} satisfies this. */ interface ClusterLike { readonly id: ClusterId; readonly name: string; readonly attributes?: Record; readonly commands?: Record; readonly events?: Record; } /** * Clusters we designate with an object to convey structural and type information. The second form of this union * allows for specification with a host object (such as a ClusterBehavior instance or class). */ type Cluster = ClusterLike | { cluster: ClusterLike; }; /** * You may address endpoints with a bare ID but the object form allows an "endpoint object" as input and optionally * conveys additional metadata. */ type Endpoint = EndpointNumber | { number: EndpointNumber; versions?: Record; minEvent?: number; }; /** * An attribute specifier may be the name of a cluster attribute or the name of a cluster or global attribute. */ type Attribute = ClusterType.Attribute | (string & keyof NonNullable) | GlobalAttributeName; /** * A command specifier may be the name of a cluster command or a command object. */ type Command = ClusterType.Command | (string & keyof NonNullable); /** * @deprecated Scheduled for removal in 0.19. * Legacy command specifier from ClusterType. Use {@link ClusterType.Command}. */ interface ClusterTypeCommand { requestId: CommandId; requestSchema: TlvSchema; responseSchema: TlvSchema; timed: boolean; } /** * An event specifier may be the name of a cluster event or an event object. */ type Event = ClusterType.Event | (string & keyof NonNullable); type GlobalAttributeName = keyof typeof Global.attributes; /** * Extract a cluster type from a cluster specifier type. */ type ClusterFor = T extends ClusterLike ? T : T extends { cluster: ClusterLike; } ? T["cluster"] : never; /** * Extract a cluster type from a cluster specifier. */ function clusterFor(specifier?: T): ClusterFor; /** * Extract an attribute object from a cluster and attribute specifier. */ function attributeFor(cluster: ClusterLike | undefined, specifier: Specifier.Attribute): ClusterType.Attribute; /** * Extract a command type from a cluster type and command specifier. */ type CommandFor> = CMD extends string ? C["commands"] extends Record ? C["commands"][CMD] : ClusterType.Command : CMD extends ClusterType.Command ? CMD : ClusterType.Command; function commandFor>(cluster: C | undefined, specifier: CMD): CommandFor; /** * Extract an event object from a cluster and event specifier. */ function eventFor(cluster: ClusterLike | undefined, specifier: Specifier.Event): ClusterType.Event; /** * Extract the cluster type from a cluster request type. */ type ClusterOf = T extends { cluster: Specifier.Cluster; } ? Specifier.ClusterFor : undefined; /** * Extract the cluster type from an element request. */ function clusterOf(request: T): ClusterOf; /** * Determine endpoint number for an object with an endpoint specifier. */ function endpointIdOf(request: T): EndpointNumber | undefined; } /** * Resolve a request-side specifier location into a {@link DataModelPath} for human-readable diagnostics. * * Mirrors the segment shape of {@link ExpandedPath} (state./events./markers) so client-side specifier paths and * server-side wire paths render consistently. Element names fall back to camelized hex IDs when the element is * unknown. */ export declare function resolvePathForSpecifier(location: { endpoint?: Specifier.Endpoint; cluster?: Specifier.Cluster; attribute?: Specifier.Attribute>; event?: Specifier.Event>; command?: Specifier.Command>; isUrgent?: boolean; listIndex?: number | null; }): DataModelPath; //# sourceMappingURL=Specifier.d.ts.map