/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { Behavior } from "#behavior/Behavior.js"; import type { BehaviorBacking } from "#behavior/internal/BehaviorBacking.js"; import type { Endpoint } from "#endpoint/Endpoint.js"; import type { ServerNode } from "#node/ServerNode.js"; import { Observable, Timestamp } from "@matter/general"; import { EventModel } from "@matter/model"; import { Val } from "@matter/protocol"; import { EventNumber, Priority } from "@matter/types"; /** * High-level change notification service. * * This service provides an optimized path to detecting property changes for all endpoints associated with a node. This * includes endpoints on peers. */ export declare class ChangeNotificationService { #private; constructor(node: ServerNode); /** * Change event source. */ get change(): Observable<[changes: ChangeNotificationService.Change], void>; /** * Invoked by the {@link BehaviorBacking} when state changes. */ broadcastUpdate(backing: BehaviorBacking, properties: string[]): void; /** * Invoked by {@link Events} or {@link ClientEventEmitter} as events occur. */ broadcastEvent(endpoint: Endpoint, behavior: Behavior.Type, event: EventModel, occurrence: ChangeNotificationService.OccurrenceProperties): void; close(): void; } export declare namespace ChangeNotificationService { type Key = string | number; /** * Emits when state changes. * * If present, {@link properties} indicates the specific updated properties. Otherwise the recipient should * consider all properties. */ interface PropertyUpdate { kind: "update"; endpoint: Endpoint; behavior: Behavior.Type; version: number; properties?: string[]; } interface OccurrenceProperties { number: EventNumber; timestamp: Timestamp; priority: Priority; payload?: Val.Struct; } /** * Emits when a Matter event occurs. */ interface EventOccurrence extends OccurrenceProperties { kind: "event"; endpoint: Endpoint; behavior: Behavior.Type; event: EventModel; } /** * Emits when endpoints/nodes are deleted. * * This indicates to the recipient to drop the associated data subtree. */ interface EndpointDelete { kind: "delete"; endpoint: Endpoint; } type Change = PropertyUpdate | EventOccurrence | EndpointDelete; } //# sourceMappingURL=ChangeNotificationService.d.ts.map