/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { RemoteActorContext } from "#behavior/context/server/RemoteActorContext.js"; import { ControllerBehavior } from "#behavior/system/controller/ControllerBehavior.js"; import { Agent } from "#endpoint/Agent.js"; import { Endpoint } from "#endpoint/Endpoint.js"; import { Node } from "#node/Node.js"; import { ServerNode } from "#node/ServerNode.js"; import { Identity, MaybePromise, NetworkSimulator } from "@matter/general"; import { AccessLevel, MatterModel } from "@matter/model"; import { ProtocolMocks, SessionManager } from "@matter/protocol"; import { MockExchange } from "./mock-exchange.js"; /** * A {@link ServerNode} wired for tests: mock time, mock crypto, in-memory storage (unless the test configured storage) and a * simulated network host. Nodes created while a test runs are closed after it, and the run fails at the end if a test * left one open. */ export declare class MockServerNode extends ServerNode { #private; /** * Creates the node without starting it. Initializes {@link MockTime}, seeds mock crypto from the network index and sets up * the environment, storage and simulated network host. */ constructor(type?: T, options?: MockServerNode.Options); constructor(config: Partial>); /** * The model the node validates against: `matter` from the options if given, otherwise the standard model. */ get matter(): MatterModel; /** * The network simulator this node's host is attached to. */ get simulator(): NetworkSimulator; /** * Perform fake online activity */ online(options: Partial & { accessLevel?: AccessLevel; }, actor: (agent: Agent.Instance) => MaybePromise): MaybePromise; /** * Creates a node, adds the device and starts it, resolving once it is online. If it fails, the node is closed and the error * rethrown. With `online: false` it only waits for construction; no exchange capture is installed then, so * {@link handleExchange} never resolves. * Outgoing exchanges are mock exchanges queued for {@link handleExchange}. */ static createOnline(type?: T, options?: MockServerNode.Options): Promise>; static createOnline(definition: T | MockServerNode.Configuration, options?: MockServerNode.Options): Promise>; /** * Resolves with the next exchange the node initiates towards a peer. Only available on nodes made by {@link createOnline}. */ handleExchange(): Promise; /** * Creates a mock secure session on this node and returns an exchange on it. `options` override the session settings, for example `fabric`. */ createExchange(options?: Partial[0]>): Promise; /** * Stops the node, advancing mock time until it is offline. */ stop(): Promise; /** * Closes the node, advancing mock time until it is destroyed. `stepMs` sets the time step used while waiting. */ close(stepMs?: number): Promise; /** * Installs a test fabric in the node's fabric manager and returns it once the node has reported the change. */ addFabric(): Promise; } export declare namespace MockServerNode { /** * Root endpoint type of mock nodes: the standard server root with {@link ControllerBehavior}. */ const RootEndpoint: import("../index.js").MutableEndpoint.With, import("../index.js").SupportedBehaviors.With, readonly [typeof ControllerBehavior]>, {}>; interface RootEndpoint extends Identity { } /** * Options specific to mock nodes, on top of the regular node options. */ interface MockOptions extends Node.NodeOptions { /** * Set to `false` to build the node without starting it. Defaults to starting it. */ online?: boolean; /** * Device added to the node. Defaults to an On/Off Light; pass `undefined` explicitly to add none. */ device?: Endpoint.Definition; /** * Index of the simulated network host. When set, the node id is `node` plus the index in hex. Defaults to 0x80. */ index?: number; /** * Simulator to join, so nodes can talk to each other. Defaults to a new one. */ simulator?: NetworkSimulator; /** * The model the node validates its device types in, instead of the standard model. */ matter?: MatterModel; } /** * Options for creating a {@link MockServerNode}. */ type Options = Endpoint.Options; /** * Full configuration for creating a {@link MockServerNode}. */ type Configuration = Endpoint.Configuration; } //# sourceMappingURL=mock-server-node.d.ts.map