/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { ClusterBehavior } from "#behavior/cluster/ClusterBehavior.js"; import type { ClusterBehaviorType } from "#behavior/cluster/ClusterBehaviorType.js"; import { Datasource } from "#behavior/state/managed/Datasource.js"; import type { ValReference } from "#behavior/state/managed/ValReference.js"; import { Endpoint } from "#endpoint/Endpoint.js"; import type { Node } from "#node/Node.js"; import type { StateStream } from "#node/integration/StateStream.js"; import { Observable } from "@matter/general"; import { type Read, type ReadResult } from "@matter/protocol"; import type { ClusterId, EndpointNumber } from "@matter/types"; import type { ClientEventEmitter } from "./ClientEventEmitter.js"; import { PeerBehavior } from "./PeerBehavior.js"; /** * Manages endpoint and behavior structure for the local representation of a local node. * * This class supports update via data sourced from the Matter protocol or from matter.js's remote APIs. */ export declare class ClientStructure { #private; /** * Optional event emitter for Matter protocol events. Set after construction. */ eventEmitter?: ClientEventEmitter; constructor(node: Node, storeFactory: ClientStructure.StoreFactory, options?: ClientStructure.Options); get changed(): Observable<[void], void>; /** * The node this structure manages. */ get node(): Node; /** * Load initial structure from cached endpoint stores. * * Each entry in {@link endpointStores} must expose an `id` (stringified endpoint number) and `knownBehaviors` * (iterable of stringified cluster IDs). */ loadCache(endpointStores: Iterable<{ id: string; knownBehaviors: Iterable; }>): void; /** * Obtain the store for a remote cluster. */ storeForRemote(endpoint: Endpoint, type: ClusterBehavior.Type): Datasource.ExternallyMutableStore; /** * Inject version filters into a Read or Subscribe request. */ injectVersionFilters(request: T): T; /** * Update the node structure by applying attribute changes from a Matter protocol interaction. */ mutate(request: Read, changes: ReadResult): AsyncGenerator; /** * Apply {@link StateStream.WireChange}s to the structure. * * Values are keyed by property name (not attribute ID). */ applyWireChanges(changes: StateStream.WireChange[]): Promise; /** * Determines if the subscription is fabric filtered. */ get subscribedFabricFiltered(): boolean; /** * Obtain the cluster namespace for an {@link EndpointNumber} and {@link ClusterId}. */ clusterFor(endpoint: EndpointNumber, cluster: ClusterId): import("@matter/types").ClusterType.Concrete | undefined; /** * Obtain the {@link Endpoint} for a {@link EndpointNumber}. */ endpointFor(endpoint: EndpointNumber): Endpoint | undefined; } export declare namespace ClientStructure { /** * Creates a {@link Datasource.ExternallyMutableStore} for a behavior on an endpoint. */ type StoreFactory = (endpoint: Endpoint, behaviorId: string, primaryKey: ValReference.PrimaryKey) => Datasource.ExternallyMutableStore; interface Options { /** * Factory for command implementations used when generating peer behaviors. */ commandFactory?: ClusterBehaviorType.CommandFactory; } } interface EndpointStructure { pendingOwner?: EndpointStructure; endpoint: Endpoint; clusters: Map; } interface ClusterStructure extends Partial { kind: "discovered"; id: ClusterId; behavior?: ClusterBehavior.Type; pendingBehavior?: ClusterBehavior.Type; pendingDelete?: boolean; store: Datasource.ExternallyMutableStore; } /** * Queue entry for pending notifications. */ export type PendingEvent = EndpointEvent | ClusterEvent; interface EndpointEvent { kind: "endpoint"; endpoint: EndpointStructure; } interface ClusterEvent { kind: "cluster"; subkind: "add" | "delete" | "replace"; endpoint: EndpointStructure; cluster: ClusterStructure; } export {}; //# sourceMappingURL=ClientStructure.d.ts.map