/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { DnsRecord, DnsRecordType, SrvRecordValue } from "#codec/DnsCodec.js"; import type { Timestamp } from "#time/Timestamp.js"; import { AsyncObserver, BasicObservable } from "#util/Observable.js"; import { MaybePromise } from "#util/Promises.js"; /** * Manages records associated with a single DNS-SD qname. * * Every DNS-SD qname of interest has a 1:1 relationship with a single instance of this class in the context of a * {@link DnssdNames}. We therefore can use the qname or {@link DnssdName} interchangeably. * * An {@link DnssdName} is created when a new name is discovered or requested by another component. The name * automatically deletes when there are no longer observers or unexpired records. */ export declare class DnssdName extends BasicObservable<[changes: DnssdName.Changes], MaybePromise> { #private; readonly qname: string; constructor(qname: string, context: DnssdName.Context); off(observer: AsyncObserver<[]>): void; close(): Promise; get records(): MapIterator; get parameters(): Map; get isDiscovered(): boolean; installRecord(record: DnsRecord): false | undefined; deleteRecord(record: DnsRecord, ifOlderThan?: Timestamp): void; } export declare namespace DnssdName { interface Context { delete(name: DnssdName): void; registerForExpiration(record: Record): void; unregisterForExpiration(record: Record): void; get(qname: string): DnssdName; } interface Expiration { expiresAt: Timestamp; } interface PointerRecord extends DnsRecord, Expiration { recordType: DnsRecordType.PTR; } interface HostRecord extends DnsRecord, Expiration { recordType: DnsRecordType.A | DnsRecordType.AAAA; } interface ServiceRecord extends DnsRecord, Expiration { recordType: DnsRecordType.SRV; } type Record = PointerRecord | ServiceRecord | HostRecord; interface Changes { name: DnssdName; updated?: Record[]; deleted?: Record[]; } } //# sourceMappingURL=DnssdName.d.ts.map