/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ImplementationError, MatterAggregateError } from "@matter/general"; import { Behavior } from "../Behavior.js"; import { ClusterBehavior } from "./ClusterBehavior.js"; /** * Thrown when a {@link ClusterBehavior} cannot be constructed due to fatal errors. */ export declare class ClusterImplementationError extends MatterAggregateError { constructor(name: string, errors: ClusterElementError[]); } /** * Thrown when a {@link ClusterBehavior} element is implemented incorrectly. */ export declare class ClusterElementError extends ImplementationError { constructor(element: string, message: string); } /** * Analyzes a ClusterBehavior implementation to ensure it conforms to the Matter specification. * * As this API is accessible via vanilla JavaScript, validation includes tests for errors that TypeScript otherwise * prevents. * * Records elements supported and a list of errors if validation fails. */ export declare class ValidatedElements { #private; /** * Supported attributes. */ attributes: Set; /** * Attribute name → ID mapping for all supported attributes (including globals). */ attributeIds: Map; /** * Supported commands. */ commands: Set; /** * Commands that are structurally present on the prototype, including {@link Behavior.unimplemented} stubs. */ presentCommands: Set; /** * Supported events. */ events: Set; /** * A list of implementation errors, if any. */ errors?: { element: string; message: string; fatal: boolean; }[]; /** * Obtain validation information. * * Validation may run against the type alone or with a specific instance of the behavior. The latter option allows * for per-instance specialization. * * A command the conformance of the cluster requires is fatal when it has no implementation. When it throws * {@link Behavior.unimplemented} it is fatal with {@link ValidatedElements.Options.strict strict} set and a warning * otherwise. * * @param type the behavior type to analyze * @param instance optional concrete instance of the behavior */ constructor(type: ClusterBehavior.Type, instance?: Behavior, options?: ValidatedElements.Options); /** * If there are errors, log and throw an exception. */ report(): void; /** * Record that the conformance of the cluster requires command `name`. Only effective while the constructor * runs. * * @internal */ requireCommand(name: string): void; error(element: string | undefined, message: string, fatal: boolean): void; } export declare namespace ValidatedElements { interface Options { /** * Treat every required command that throws {@link Behavior.unimplemented} as fatal. */ strict?: boolean; } } //# sourceMappingURL=ValidatedElements.d.ts.map