@matter/node 0.16.0-alpha.0-20251207-37e501b18 → 0.16.0-alpha.0-20251210-206ca2db7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/behavior/Behavior.js +5 -5
- package/dist/cjs/behavior/Behavior.js.map +1 -1
- package/dist/cjs/behavior/Events.js +1 -1
- package/dist/cjs/behavior/cluster/ClusterBehaviorType.js +2 -2
- package/dist/cjs/behavior/cluster/ClusterBehaviorType.js.map +1 -1
- package/dist/cjs/behavior/cluster/cluster-behavior-utils.js +1 -1
- package/dist/cjs/behavior/cluster/cluster-behavior-utils.js.map +1 -1
- package/dist/cjs/behavior/context/Contextual.js +1 -1
- package/dist/cjs/behavior/context/Contextual.js.map +1 -1
- package/dist/cjs/behavior/context/NodeActivity.js +1 -1
- package/dist/cjs/behavior/context/NodeActivity.js.map +1 -1
- package/dist/cjs/behavior/internal/BackingEvents.js +2 -2
- package/dist/cjs/behavior/internal/BackingEvents.js.map +1 -1
- package/dist/cjs/behavior/state/managed/Internal.js +2 -2
- package/dist/cjs/behavior/state/managed/Internal.js.map +1 -1
- package/dist/cjs/behavior/state/managed/values/BitmapManager.js +1 -1
- package/dist/cjs/behavior/state/managed/values/BitmapManager.js.map +1 -1
- package/dist/cjs/behavior/state/managed/values/StructManager.js +1 -1
- package/dist/cjs/behavior/state/managed/values/StructManager.js.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts +6 -2
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.js +13 -4
- package/dist/cjs/behavior/system/commissioning/CommissioningClient.js.map +2 -2
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.js +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts +1 -1
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js +3 -2
- package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
- package/dist/cjs/behavior/system/commissioning/index.d.ts +1 -0
- package/dist/cjs/behavior/system/commissioning/index.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/index.js +1 -0
- package/dist/cjs/behavior/system/commissioning/index.js.map +1 -1
- package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
- package/dist/cjs/behavior/system/controller/ControllerBehavior.js +5 -2
- package/dist/cjs/behavior/system/controller/ControllerBehavior.js.map +1 -1
- package/dist/cjs/behavior/system/controller/discovery/CommissioningDiscovery.d.ts +1 -1
- package/dist/cjs/behavior/system/mqtt/MqttInterface.js +1 -1
- package/dist/cjs/behavior/system/network/ServerNetworkRuntime.js +1 -1
- package/dist/cjs/behavior/system/network/index.d.ts +1 -0
- package/dist/cjs/behavior/system/network/index.d.ts.map +1 -1
- package/dist/cjs/behavior/system/network/index.js +1 -0
- package/dist/cjs/behavior/system/network/index.js.map +1 -1
- package/dist/cjs/behavior/system/remote/RemoteInterface.js +1 -1
- package/dist/cjs/behavior/system/websocket/WebSocketInterface.js +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts +1 -2
- package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +1 -1
- package/dist/cjs/behaviors/basic-information/BasicInformationServer.d.ts +1 -2
- package/dist/cjs/behaviors/basic-information/BasicInformationServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/basic-information/BasicInformationServer.js.map +1 -1
- package/dist/cjs/behaviors/general-commissioning/GeneralCommissioningServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/general-commissioning/GeneralCommissioningServer.js +2 -1
- package/dist/cjs/behaviors/general-commissioning/GeneralCommissioningServer.js.map +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +1 -1
- package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts +1 -2
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
- package/dist/cjs/behaviors/scenes-management/ScenesManagementServer.js +1 -1
- package/dist/cjs/endpoint/Agent.js +1 -1
- package/dist/cjs/endpoint/Agent.js.map +1 -1
- package/dist/cjs/endpoint/Endpoint.js +1 -1
- package/dist/cjs/endpoint/properties/Behaviors.d.ts +8 -0
- package/dist/cjs/endpoint/properties/Behaviors.d.ts.map +1 -1
- package/dist/cjs/endpoint/properties/Behaviors.js +7 -17
- package/dist/cjs/endpoint/properties/Behaviors.js.map +2 -2
- package/dist/cjs/endpoint/properties/EndpointInitializer.d.ts +2 -1
- package/dist/cjs/endpoint/properties/EndpointInitializer.d.ts.map +1 -1
- package/dist/cjs/endpoint/properties/EndpointInitializer.js.map +1 -1
- package/dist/cjs/endpoint/properties/Endpoints.d.ts +1 -1
- package/dist/cjs/endpoint/properties/Endpoints.d.ts.map +1 -1
- package/dist/cjs/endpoint/properties/Endpoints.js +4 -4
- package/dist/cjs/endpoint/properties/Endpoints.js.map +1 -1
- package/dist/cjs/node/Node.d.ts.map +1 -1
- package/dist/cjs/node/Node.js +13 -4
- package/dist/cjs/node/Node.js.map +1 -1
- package/dist/cjs/node/NodePhysicalProperties.d.ts.map +1 -1
- package/dist/cjs/node/NodePhysicalProperties.js +6 -4
- package/dist/cjs/node/NodePhysicalProperties.js.map +1 -1
- package/dist/cjs/node/ServerNode.js +1 -1
- package/dist/cjs/node/client/PeerBehavior.js +1 -1
- package/dist/cjs/node/client/PeerBehavior.js.map +1 -1
- package/dist/cjs/node/client/index.d.ts +1 -0
- package/dist/cjs/node/client/index.d.ts.map +1 -1
- package/dist/cjs/node/client/index.js +1 -0
- package/dist/cjs/node/client/index.js.map +1 -1
- package/dist/cjs/node/index.d.ts +1 -0
- package/dist/cjs/node/index.d.ts.map +1 -1
- package/dist/cjs/node/index.js +1 -0
- package/dist/cjs/node/index.js.map +1 -1
- package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/cjs/node/server/InteractionServer.js +7 -4
- package/dist/cjs/node/server/InteractionServer.js.map +2 -2
- package/dist/cjs/node/server/ServerEndpointInitializer.d.ts +3 -1
- package/dist/cjs/node/server/ServerEndpointInitializer.d.ts.map +1 -1
- package/dist/cjs/node/server/ServerEndpointInitializer.js +10 -0
- package/dist/cjs/node/server/ServerEndpointInitializer.js.map +1 -1
- package/dist/cjs/node/server/ServerSubscription.d.ts +1 -1
- package/dist/cjs/node/server/ServerSubscription.js +1 -1
- package/dist/esm/behavior/Behavior.js +5 -5
- package/dist/esm/behavior/Behavior.js.map +1 -1
- package/dist/esm/behavior/Events.js +1 -1
- package/dist/esm/behavior/cluster/ClusterBehaviorType.js +2 -2
- package/dist/esm/behavior/cluster/ClusterBehaviorType.js.map +1 -1
- package/dist/esm/behavior/cluster/cluster-behavior-utils.js +1 -1
- package/dist/esm/behavior/cluster/cluster-behavior-utils.js.map +1 -1
- package/dist/esm/behavior/context/Contextual.js +1 -1
- package/dist/esm/behavior/context/Contextual.js.map +1 -1
- package/dist/esm/behavior/context/NodeActivity.js +1 -1
- package/dist/esm/behavior/context/NodeActivity.js.map +1 -1
- package/dist/esm/behavior/internal/BackingEvents.js +2 -2
- package/dist/esm/behavior/internal/BackingEvents.js.map +1 -1
- package/dist/esm/behavior/state/managed/Internal.js +2 -2
- package/dist/esm/behavior/state/managed/Internal.js.map +1 -1
- package/dist/esm/behavior/state/managed/values/BitmapManager.js +1 -1
- package/dist/esm/behavior/state/managed/values/BitmapManager.js.map +1 -1
- package/dist/esm/behavior/state/managed/values/StructManager.js +1 -1
- package/dist/esm/behavior/state/managed/values/StructManager.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts +6 -2
- package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningClient.js +14 -4
- package/dist/esm/behavior/system/commissioning/CommissioningClient.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.js +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts +1 -1
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js +3 -2
- package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/index.d.ts +1 -0
- package/dist/esm/behavior/system/commissioning/index.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/index.js +1 -0
- package/dist/esm/behavior/system/commissioning/index.js.map +1 -1
- package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
- package/dist/esm/behavior/system/controller/ControllerBehavior.js +5 -2
- package/dist/esm/behavior/system/controller/ControllerBehavior.js.map +1 -1
- package/dist/esm/behavior/system/controller/discovery/CommissioningDiscovery.d.ts +1 -1
- package/dist/esm/behavior/system/mqtt/MqttInterface.js +1 -1
- package/dist/esm/behavior/system/network/ServerNetworkRuntime.js +1 -1
- package/dist/esm/behavior/system/network/index.d.ts +1 -0
- package/dist/esm/behavior/system/network/index.d.ts.map +1 -1
- package/dist/esm/behavior/system/network/index.js +1 -0
- package/dist/esm/behavior/system/network/index.js.map +1 -1
- package/dist/esm/behavior/system/remote/RemoteInterface.js +1 -1
- package/dist/esm/behavior/system/websocket/WebSocketInterface.js +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.d.ts +1 -2
- package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
- package/dist/esm/behaviors/access-control/AccessControlServer.js.map +1 -1
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +1 -1
- package/dist/esm/behaviors/basic-information/BasicInformationServer.d.ts +1 -2
- package/dist/esm/behaviors/basic-information/BasicInformationServer.d.ts.map +1 -1
- package/dist/esm/behaviors/basic-information/BasicInformationServer.js.map +1 -1
- package/dist/esm/behaviors/general-commissioning/GeneralCommissioningServer.d.ts.map +1 -1
- package/dist/esm/behaviors/general-commissioning/GeneralCommissioningServer.js +2 -1
- package/dist/esm/behaviors/general-commissioning/GeneralCommissioningServer.js.map +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +1 -1
- package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts +1 -2
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
- package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
- package/dist/esm/behaviors/scenes-management/ScenesManagementServer.js +1 -1
- package/dist/esm/endpoint/Agent.js +1 -1
- package/dist/esm/endpoint/Agent.js.map +1 -1
- package/dist/esm/endpoint/Endpoint.js +1 -1
- package/dist/esm/endpoint/properties/Behaviors.d.ts +8 -0
- package/dist/esm/endpoint/properties/Behaviors.d.ts.map +1 -1
- package/dist/esm/endpoint/properties/Behaviors.js +7 -17
- package/dist/esm/endpoint/properties/Behaviors.js.map +2 -2
- package/dist/esm/endpoint/properties/EndpointInitializer.d.ts +2 -1
- package/dist/esm/endpoint/properties/EndpointInitializer.d.ts.map +1 -1
- package/dist/esm/endpoint/properties/EndpointInitializer.js.map +1 -1
- package/dist/esm/endpoint/properties/Endpoints.d.ts +1 -1
- package/dist/esm/endpoint/properties/Endpoints.d.ts.map +1 -1
- package/dist/esm/endpoint/properties/Endpoints.js +4 -4
- package/dist/esm/endpoint/properties/Endpoints.js.map +1 -1
- package/dist/esm/node/Node.d.ts.map +1 -1
- package/dist/esm/node/Node.js +13 -4
- package/dist/esm/node/Node.js.map +1 -1
- package/dist/esm/node/NodePhysicalProperties.d.ts.map +1 -1
- package/dist/esm/node/NodePhysicalProperties.js +6 -4
- package/dist/esm/node/NodePhysicalProperties.js.map +1 -1
- package/dist/esm/node/ServerNode.js +1 -1
- package/dist/esm/node/client/PeerBehavior.js +1 -1
- package/dist/esm/node/client/PeerBehavior.js.map +1 -1
- package/dist/esm/node/client/index.d.ts +1 -0
- package/dist/esm/node/client/index.d.ts.map +1 -1
- package/dist/esm/node/client/index.js +1 -0
- package/dist/esm/node/client/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +1 -0
- package/dist/esm/node/index.d.ts.map +1 -1
- package/dist/esm/node/index.js +1 -0
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/esm/node/server/InteractionServer.js +8 -4
- package/dist/esm/node/server/InteractionServer.js.map +2 -2
- package/dist/esm/node/server/ServerEndpointInitializer.d.ts +3 -1
- package/dist/esm/node/server/ServerEndpointInitializer.d.ts.map +1 -1
- package/dist/esm/node/server/ServerEndpointInitializer.js +10 -0
- package/dist/esm/node/server/ServerEndpointInitializer.js.map +1 -1
- package/dist/esm/node/server/ServerSubscription.d.ts +1 -1
- package/dist/esm/node/server/ServerSubscription.js +1 -1
- package/package.json +7 -7
- package/src/behavior/system/commissioning/CommissioningClient.ts +21 -2
- package/src/behavior/system/commissioning/CommissioningServer.ts +2 -2
- package/src/behavior/system/commissioning/RemoteDescriptor.ts +3 -2
- package/src/behavior/system/commissioning/index.ts +1 -0
- package/src/behavior/system/controller/ControllerBehavior.ts +6 -3
- package/src/behavior/system/network/index.ts +1 -0
- package/src/behaviors/access-control/AccessControlServer.ts +2 -2
- package/src/behaviors/basic-information/BasicInformationServer.ts +2 -3
- package/src/behaviors/general-commissioning/GeneralCommissioningServer.ts +1 -0
- package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +1 -1
- package/src/behaviors/group-key-management/GroupKeyManagementServer.ts +2 -2
- package/src/endpoint/properties/Behaviors.ts +24 -14
- package/src/endpoint/properties/EndpointInitializer.ts +2 -1
- package/src/endpoint/properties/Endpoints.ts +4 -4
- package/src/node/Node.ts +12 -3
- package/src/node/NodePhysicalProperties.ts +6 -4
- package/src/node/client/index.ts +1 -0
- package/src/node/index.ts +1 -0
- package/src/node/server/InteractionServer.ts +7 -3
- package/src/node/server/ServerEndpointInitializer.ts +14 -1
- package/src/node/server/ServerSubscription.ts +1 -1
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import { Behavior } from "#behavior/Behavior.js";
|
|
7
7
|
import { BehaviorBacking } from "#behavior/internal/BehaviorBacking.js";
|
|
8
8
|
import { Endpoint } from "#endpoint/Endpoint.js";
|
|
9
|
+
import type { Agent } from "#endpoint/index.js";
|
|
9
10
|
import { EndpointInitializer } from "#endpoint/properties/EndpointInitializer.js";
|
|
10
|
-
import { Environment } from "#general";
|
|
11
|
+
import { Environment, MaybePromise } from "#general";
|
|
11
12
|
export declare class ServerEndpointInitializer extends EndpointInitializer {
|
|
12
13
|
#private;
|
|
13
14
|
constructor(environment: Environment);
|
|
@@ -21,5 +22,6 @@ export declare class ServerEndpointInitializer extends EndpointInitializer {
|
|
|
21
22
|
* initializes.
|
|
22
23
|
*/
|
|
23
24
|
createBacking(endpoint: Endpoint, type: Behavior.Type): BehaviorBacking;
|
|
25
|
+
behaviorsInitialized(agent: Agent): MaybePromise;
|
|
24
26
|
}
|
|
25
27
|
//# sourceMappingURL=ServerEndpointInitializer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerEndpointInitializer.d.ts","sourceRoot":"","sources":["../../../../src/node/server/ServerEndpointInitializer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ServerEndpointInitializer.d.ts","sourceRoot":"","sources":["../../../../src/node/server/ServerEndpointInitializer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAyB,YAAY,EAAE,MAAM,UAAU,CAAC;AAO5E,qBAAa,yBAA0B,SAAQ,mBAAmB;;gBAGlD,WAAW,EAAE,WAAW;IAK3B,oBAAoB,CAAC,QAAQ,EAAE,QAAQ;IAa1C,eAAe,CAAC,QAAQ,EAAE,QAAQ;IAQlC,oBAAoB,CAAC,QAAQ,EAAE,QAAQ;IAQ7C;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,eAAe;IAgD9D,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY;CAS5D"}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Copyright 2022-2025 Matter.js Authors
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { limitEndpointAttributeDataToAllowedFabrics } from "#behavior/cluster/FabricScopedDataHandler.js";
|
|
6
7
|
import { ServerBehaviorBacking } from "#behavior/internal/ServerBehaviorBacking.js";
|
|
7
8
|
import { Endpoint } from "#endpoint/Endpoint.js";
|
|
8
9
|
import { EndpointInitializer } from "#endpoint/properties/EndpointInitializer.js";
|
|
9
10
|
import { InternalError, Logger } from "#general";
|
|
11
|
+
import { FabricManager } from "#protocol";
|
|
10
12
|
import { ServerNodeStore } from "#storage/server/ServerNodeStore.js";
|
|
11
13
|
import { DescriptorServer } from "../../behaviors/descriptor/DescriptorServer.js";
|
|
12
14
|
const logger = Logger.get("BehaviorInit");
|
|
@@ -80,6 +82,14 @@ class ServerEndpointInitializer extends EndpointInitializer {
|
|
|
80
82
|
logger.warn(`Using fallback ID of ${id} for child of ${endpoint.owner}; assign ID to remove this warning`);
|
|
81
83
|
return id;
|
|
82
84
|
}
|
|
85
|
+
behaviorsInitialized(agent) {
|
|
86
|
+
if (agent.env.has(FabricManager)) {
|
|
87
|
+
const fabricIndices = agent.env.get(FabricManager).fabrics.map((fabric) => fabric.fabricIndex);
|
|
88
|
+
if (fabricIndices.length > 0) {
|
|
89
|
+
return limitEndpointAttributeDataToAllowedFabrics(agent.endpoint, fabricIndices);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
83
93
|
}
|
|
84
94
|
export {
|
|
85
95
|
ServerEndpointInitializer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/node/server/ServerEndpointInitializer.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAS,kDAAkD;AAE3D,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AAEzB,SAAS,2BAA2B;AACpC,SAAsB,eAAe,cAA4B;AACjE,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAEjC,MAAM,SAAS,OAAO,IAAI,cAAc;AAEjC,MAAM,kCAAkC,oBAAoB;AAAA,EAC/D;AAAA,EAEA,YAAY,aAA0B;AAClC,UAAM;AACN,SAAK,SAAS,YAAY,IAAI,eAAe;AAAA,EACjD;AAAA,EAES,qBAAqB,UAAoB;AAC9C,QAAI,CAAC,SAAS,UAAU,OAAO;AAC3B,eAAS,KAAK,KAAK,cAAc,QAAQ;AAAA,IAC7C;AAEA,SAAK,OAAO,eAAe,aAAa,QAAQ;AAGhD,QAAI,EAAE,iBAAiB,MAAM,SAAS,UAAU,YAAY;AACxD,eAAS,UAAU,OAAO,kBAAkB,QAAW,KAAK;AAAA,IAChE;AAAA,EACJ;AAAA,EAEA,MAAM,gBAAgB,UAAoB;AACtC,QAAI,CAAC,SAAS,UAAU,OAAO;AAC3B;AAAA,IACJ;AAEA,UAAM,KAAK,OAAO,eAAe,sBAAsB,QAAQ;AAAA,EACnE;AAAA,EAEA,MAAM,qBAAqB,UAAoB;AAC3C,QAAI,CAAC,SAAS,UAAU,SAAS,SAAS,WAAW,GAAG;AACpD;AAAA,IACJ;AAEA,SAAK,OAAO,eAAe,2BAA2B,QAAQ;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cAAc,UAAoB,MAAsC;AACpE,UAAM,QAAQ,KAAK,OAAO,iBAAiB,QAAQ,EAAE,uBAAuB,KAAK,EAAE;AAEnF,WAAO,IAAI,sBAAsB,UAAU,MAAM,OAAO,SAAS,UAAU,WAAW,IAAI,CAAC;AAAA,EAC/F;AAAA;AAAA;AAAA;AAAA,EAKA,cAAc,UAAoB;AAC9B,UAAM,YACF,SAAS,UAAU,UAAU,oBAAoB,SAAS,UAAU,UAAU;AAClF,QAAI,WAAW;AACX,YAAM,WAAW;AAAA,QACb,GAAG,IAAI,UAAU,MAAM;AAAA,QACvB,GAAG,SAAS,UAAU,YAAY,SAAS;AAAA,MAC/C;AAEA,UAAIA,MAAM,SAAoC;AAC9C,UAAIA,KAAI;AACJ,eAAOA;AAAA,MACX;AAEA,MAAAA,MAAM,SAAoC;AAC1C,UAAIA,KAAI;AACJ,eAAOA;AAAA,MACX;AAAA,IACJ;AAEA,QAAI,EAAE,SAAS,iBAAiB,WAAW;AACvC,YAAM,IAAI,cAAc,2DAA2D;AAAA,IACvF;AACA,QAAI,CAAC,SAAS,MAAM,UAAU,OAAO;AACjC,YAAM,IAAI,cAAc,2DAA2D;AAAA,IACvF;AAEA,UAAM,QAAQ,SAAS,MAAM,MAAM,QAAQ,QAAQ;AACnD,QAAI,UAAU,IAAI;AACd,YAAM,IAAI,cAAc,wEAAwE;AAAA,IACpG;AAGA,UAAM,KAAK,OAAO,KAAK;AACvB,WAAO,KAAK,wBAAwB,EAAE,iBAAiB,SAAS,KAAK,oCAAoC;AAEzG,WAAO;AAAA,EACX;AAAA,EAES,qBAAqB,OAA4B;AAEtD,QAAI,MAAM,IAAI,IAAI,aAAa,GAAG;AAC9B,YAAM,gBAAgB,MAAM,IAAI,IAAI,aAAa,EAAE,QAAQ,IAAI,YAAU,OAAO,WAAW;AAC3F,UAAI,cAAc,SAAS,GAAG;AAC1B,eAAO,2CAA2C,MAAM,UAAU,aAAa;AAAA,MACnF;AAAA,IACJ;AAAA,EACJ;AACJ;",
|
|
5
5
|
"names": ["id"]
|
|
6
6
|
}
|
|
@@ -116,7 +116,7 @@ export declare class ServerSubscription implements Subscription {
|
|
|
116
116
|
dataVersion: import("#types").FieldType<number>;
|
|
117
117
|
}>[]>;
|
|
118
118
|
interactionModelRevision: import("#types").FieldType<number>;
|
|
119
|
-
}>, "
|
|
119
|
+
}>, "interactionModelRevision" | "keepSubscriptions">;
|
|
120
120
|
get cancelled(): AsyncObservable<[subscription: Subscription], void>;
|
|
121
121
|
get maxInterval(): Duration;
|
|
122
122
|
get sendInterval(): Duration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
1
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
2
2
|
var __typeError = (msg) => {
|
|
3
3
|
throw TypeError(msg);
|
|
4
4
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/node",
|
|
3
|
-
"version": "0.16.0-alpha.0-
|
|
3
|
+
"version": "0.16.0-alpha.0-20251210-206ca2db7",
|
|
4
4
|
"description": "API for building Matter nodes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"#*": "./src/*"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@matter/general": "0.16.0-alpha.0-
|
|
46
|
-
"@matter/model": "0.16.0-alpha.0-
|
|
47
|
-
"@matter/types": "0.16.0-alpha.0-
|
|
48
|
-
"@matter/protocol": "0.16.0-alpha.0-
|
|
45
|
+
"@matter/general": "0.16.0-alpha.0-20251210-206ca2db7",
|
|
46
|
+
"@matter/model": "0.16.0-alpha.0-20251210-206ca2db7",
|
|
47
|
+
"@matter/types": "0.16.0-alpha.0-20251210-206ca2db7",
|
|
48
|
+
"@matter/protocol": "0.16.0-alpha.0-20251210-206ca2db7"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@matter/tools": "0.16.0-alpha.0-
|
|
52
|
-
"@matter/testing": "0.16.0-alpha.0-
|
|
51
|
+
"@matter/tools": "0.16.0-alpha.0-20251210-206ca2db7",
|
|
52
|
+
"@matter/testing": "0.16.0-alpha.0-20251210-206ca2db7"
|
|
53
53
|
},
|
|
54
54
|
"files": [
|
|
55
55
|
"dist/**/*",
|
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
import { Behavior } from "#behavior/Behavior.js";
|
|
8
8
|
import { Events as BaseEvents } from "#behavior/Events.js";
|
|
9
9
|
import { OperationalCredentialsClient } from "#behaviors/operational-credentials";
|
|
10
|
+
import { OperationalCredentials } from "#clusters/operational-credentials";
|
|
10
11
|
import {
|
|
12
|
+
ClassExtends,
|
|
11
13
|
Diagnostic,
|
|
12
14
|
Duration,
|
|
13
15
|
ImplementationError,
|
|
14
16
|
Logger,
|
|
17
|
+
MatterError,
|
|
15
18
|
NotImplementedError,
|
|
16
19
|
Observable,
|
|
17
20
|
ServerAddress,
|
|
@@ -40,6 +43,7 @@ import { IdentityService } from "#node/server/IdentityService.js";
|
|
|
40
43
|
import {
|
|
41
44
|
CommissioningMode,
|
|
42
45
|
ControllerCommissioner,
|
|
46
|
+
ControllerCommissioningFlow,
|
|
43
47
|
DiscoveryData,
|
|
44
48
|
Fabric,
|
|
45
49
|
FabricAuthority,
|
|
@@ -113,7 +117,7 @@ export class CommissioningClient extends Behavior {
|
|
|
113
117
|
|
|
114
118
|
// Validate passcode
|
|
115
119
|
let { passcode } = opts;
|
|
116
|
-
if (
|
|
120
|
+
if (!Number.isFinite(passcode)) {
|
|
117
121
|
passcode = Number.parseInt(passcode as unknown as string);
|
|
118
122
|
if (!Number.isFinite(passcode)) {
|
|
119
123
|
throw new ImplementationError(`You must provide the numeric passcode to commission a node`);
|
|
@@ -162,6 +166,7 @@ export class CommissioningClient extends Behavior {
|
|
|
162
166
|
nodeId: address.nodeId,
|
|
163
167
|
passcode,
|
|
164
168
|
discoveryData: this.descriptor,
|
|
169
|
+
commissioningFlowImpl: options.commissioningFlowImpl,
|
|
165
170
|
};
|
|
166
171
|
|
|
167
172
|
if (this.finalizeCommissioning !== CommissioningClient.prototype.finalizeCommissioning) {
|
|
@@ -217,7 +222,16 @@ export class CommissioningClient extends Behavior {
|
|
|
217
222
|
|
|
218
223
|
const opcreds = this.agent.get(OperationalCredentialsClient);
|
|
219
224
|
|
|
220
|
-
|
|
225
|
+
const fabricIndex = opcreds.state.currentFabricIndex;
|
|
226
|
+
logger.debug(`Removing node ${peerAddress.toString()} by removing fabric ${fabricIndex} on the node`);
|
|
227
|
+
|
|
228
|
+
const result = await opcreds.removeFabric({ fabricIndex });
|
|
229
|
+
|
|
230
|
+
if (result.statusCode !== OperationalCredentials.NodeOperationalCertStatus.Ok) {
|
|
231
|
+
throw new MatterError(
|
|
232
|
+
`Removing node ${peerAddress.toString()} failed with status ${result.statusCode} "${result.debugText}".`,
|
|
233
|
+
);
|
|
234
|
+
}
|
|
221
235
|
|
|
222
236
|
this.state.peerAddress = undefined;
|
|
223
237
|
|
|
@@ -486,6 +500,11 @@ export namespace CommissioningClient {
|
|
|
486
500
|
*/
|
|
487
501
|
fabricAuthority?: FabricAuthority;
|
|
488
502
|
|
|
503
|
+
/**
|
|
504
|
+
* Custom commissioning flow implementation to use instead of the default.
|
|
505
|
+
*/
|
|
506
|
+
commissioningFlowImpl?: ClassExtends<ControllerCommissioningFlow>;
|
|
507
|
+
|
|
489
508
|
/**
|
|
490
509
|
* Discovery capabilities to use for discovery. These are included in the QR code normally and defined if BLE
|
|
491
510
|
* is supported for initial commissioning.
|
|
@@ -98,8 +98,6 @@ export class CommissioningServer extends Behavior {
|
|
|
98
98
|
this.reactTo((this.endpoint as Node).lifecycle.online, this.#enterOnlineMode);
|
|
99
99
|
|
|
100
100
|
this.reactTo((this.endpoint as Node).lifecycle.goingOffline, this.#enterOfflineMode);
|
|
101
|
-
|
|
102
|
-
this.reactTo(this.env.get(FabricManager).events.added, this.enterOperationalMode);
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
override async [Symbol.asyncDispose]() {
|
|
@@ -203,6 +201,8 @@ export class CommissioningServer extends Behavior {
|
|
|
203
201
|
}
|
|
204
202
|
|
|
205
203
|
async #enterOnlineMode() {
|
|
204
|
+
this.reactTo(this.env.get(FabricManager).events.added, this.enterOperationalMode);
|
|
205
|
+
|
|
206
206
|
// If already commissioned, trigger operational announcement
|
|
207
207
|
if ((this.endpoint.lifecycle as NodeLifecycle).isCommissioned) {
|
|
208
208
|
// Restore subscriptions if we have some persisted
|
|
@@ -148,9 +148,9 @@ export namespace RemoteDescriptor {
|
|
|
148
148
|
return result;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export function toLongForm(descriptor: RemoteDescriptor | undefined, long: Long) {
|
|
151
|
+
export function toLongForm(descriptor: RemoteDescriptor | undefined, long: Long = {}) {
|
|
152
152
|
if (!descriptor) {
|
|
153
|
-
|
|
153
|
+
return long;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
const { addresses, discoveredAt, ttl, deviceIdentifier, VP, DT, DN, RI, PH, PI, SII, SAI, SAT, T, ICD } =
|
|
@@ -206,5 +206,6 @@ export namespace RemoteDescriptor {
|
|
|
206
206
|
if ("CM" in descriptor) {
|
|
207
207
|
long.commissioningMode = descriptor.CM;
|
|
208
208
|
}
|
|
209
|
+
return long;
|
|
209
210
|
}
|
|
210
211
|
}
|
|
@@ -88,7 +88,7 @@ export class ControllerBehavior extends Behavior {
|
|
|
88
88
|
|
|
89
89
|
this.reactTo(node.lifecycle.online, this.#nodeOnline);
|
|
90
90
|
if (node.lifecycle.isOnline) {
|
|
91
|
-
this.#nodeOnline();
|
|
91
|
+
await this.#nodeOnline();
|
|
92
92
|
}
|
|
93
93
|
this.reactTo(node.lifecycle.goingOffline, this.#nodeGoingOffline);
|
|
94
94
|
}
|
|
@@ -108,7 +108,7 @@ export class ControllerBehavior extends Behavior {
|
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
#nodeOnline() {
|
|
111
|
+
async #nodeOnline() {
|
|
112
112
|
// Configure network connections
|
|
113
113
|
const netTransports = this.env.get(ConnectionlessTransportSet);
|
|
114
114
|
if (this.state.ble) {
|
|
@@ -116,9 +116,12 @@ export class ControllerBehavior extends Behavior {
|
|
|
116
116
|
netTransports.add(this.env.get(Ble).centralInterface);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
// Add each pre-existing fabric to discovery criteria
|
|
119
|
+
// Add each pre-existing fabric to discovery criteria and update fabric label if needed
|
|
120
120
|
const authority = this.env.get(FabricAuthority);
|
|
121
121
|
for (const fabric of authority.fabrics) {
|
|
122
|
+
if (fabric.label !== this.state.adminFabricLabel) {
|
|
123
|
+
await fabric.setLabel(this.state.adminFabricLabel);
|
|
124
|
+
}
|
|
122
125
|
this.#enableScanningForFabric(fabric);
|
|
123
126
|
}
|
|
124
127
|
this.reactTo(authority.fabricAdded, this.#enableScanningForFabric);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
8
8
|
import { AccessControl as AccessControlTypes } from "#clusters/access-control";
|
|
9
|
-
import { Bytes, deepCopy, InternalError, Logger
|
|
9
|
+
import { Bytes, deepCopy, InternalError, Logger } from "#general";
|
|
10
10
|
import { NodeLifecycle } from "#node/NodeLifecycle.js";
|
|
11
11
|
import {
|
|
12
12
|
AccessControl,
|
|
@@ -49,7 +49,7 @@ const logger = Logger.get("AccessControlServer");
|
|
|
49
49
|
export class AccessControlServer extends AccessControlBehavior.with("Extension") {
|
|
50
50
|
declare internal: AccessControlServer.Internal;
|
|
51
51
|
|
|
52
|
-
override initialize()
|
|
52
|
+
override initialize() {
|
|
53
53
|
this.reactTo(this.events.acl$Changing, this.#validateAccessControlListChanges); // Enhanced Validation
|
|
54
54
|
this.reactTo(this.events.acl$Changed, this.#handleAccessControlListChange); // Event handling for changes
|
|
55
55
|
if (this.state.extension !== undefined) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
8
8
|
import { OnlineEvent } from "#behavior/Events.js";
|
|
9
9
|
import { BasicInformation } from "#clusters/basic-information";
|
|
10
|
-
import { Diagnostic, ImplementationError, Logger
|
|
10
|
+
import { Diagnostic, ImplementationError, Logger } from "#general";
|
|
11
11
|
import { AttributeModel, EventModel, Schema, Specification } from "#model";
|
|
12
12
|
import { NodeLifecycle } from "#node/NodeLifecycle.js";
|
|
13
13
|
import { Fabric, FabricManager } from "#protocol";
|
|
@@ -25,7 +25,7 @@ const Base = BasicInformationBehavior.enable({
|
|
|
25
25
|
* This is the default server implementation of BasicInformationBehavior.
|
|
26
26
|
*/
|
|
27
27
|
export class BasicInformationServer extends Base {
|
|
28
|
-
override initialize()
|
|
28
|
+
override initialize() {
|
|
29
29
|
const state = this.state;
|
|
30
30
|
|
|
31
31
|
const defaultsSet = {} as Record<string, any>;
|
|
@@ -63,7 +63,6 @@ export class BasicInformationServer extends Base {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const lifecycle = this.endpoint.lifecycle as NodeLifecycle;
|
|
66
|
-
|
|
67
66
|
this.reactTo(lifecycle.online, this.#online);
|
|
68
67
|
this.reactTo(lifecycle.goingOffline, this.#goingOffline);
|
|
69
68
|
|
|
@@ -56,6 +56,7 @@ export class GeneralCommissioningServer extends GeneralCommissioningBehavior {
|
|
|
56
56
|
/** As required by Commissioning Flows any new PASE session needs to arm the failsafe for 60s. */
|
|
57
57
|
async #handleAddedPaseSessions(session: NodeSession) {
|
|
58
58
|
if (
|
|
59
|
+
session.isInitiator || // Only server sessions
|
|
59
60
|
!session.isPase || // Only PASE sessions
|
|
60
61
|
session.fabric !== undefined // That does not have an assigned fabric (can never happen in real usecases)
|
|
61
62
|
) {
|
|
@@ -64,7 +64,7 @@ export class GeneralDiagnosticsServer extends Base {
|
|
|
64
64
|
declare state: GeneralDiagnosticsServer.State;
|
|
65
65
|
static override readonly schema = schema;
|
|
66
66
|
|
|
67
|
-
override initialize()
|
|
67
|
+
override initialize() {
|
|
68
68
|
if (this.state.testEventTriggersEnabled === undefined) {
|
|
69
69
|
this.state.testEventTriggersEnabled = false;
|
|
70
70
|
} else if (this.state.testEventTriggersEnabled) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
8
8
|
import { GroupKeyManagement } from "#clusters/group-key-management";
|
|
9
|
-
import { deepCopy, ImplementationError, Logger
|
|
9
|
+
import { deepCopy, ImplementationError, Logger } from "#general";
|
|
10
10
|
import { DatatypeModel, FieldElement } from "#model";
|
|
11
11
|
import { NodeLifecycle } from "#node/NodeLifecycle.js";
|
|
12
12
|
import { assertRemoteActor, Fabric, FabricManager, hasRemoteActor, IPK_DEFAULT_EPOCH_START_TIME } from "#protocol";
|
|
@@ -47,7 +47,7 @@ export class GroupKeyManagementServer extends GroupKeyManagementBehavior {
|
|
|
47
47
|
declare state: GroupKeyManagementServer.State;
|
|
48
48
|
static override readonly schema = schema;
|
|
49
49
|
|
|
50
|
-
override initialize()
|
|
50
|
+
override initialize() {
|
|
51
51
|
if (this.features.cacheAndSync) {
|
|
52
52
|
throw new ImplementationError("The CacheAndSync feature is provisional. Do not use it.");
|
|
53
53
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import { Behavior } from "#behavior/Behavior.js";
|
|
8
8
|
import type { ClusterBehavior } from "#behavior/cluster/ClusterBehavior.js";
|
|
9
|
-
import { limitEndpointAttributeDataToAllowedFabrics } from "#behavior/cluster/FabricScopedDataHandler.js";
|
|
10
9
|
import { ActionContext } from "#behavior/context/ActionContext.js";
|
|
11
10
|
import { NodeActivity } from "#behavior/context/NodeActivity.js";
|
|
12
11
|
import { LocalActorContext } from "#behavior/context/server/LocalActorContext.js";
|
|
@@ -28,7 +27,7 @@ import {
|
|
|
28
27
|
} from "#general";
|
|
29
28
|
import { FeatureSet } from "#model";
|
|
30
29
|
import { ProtocolService } from "#node/integration/ProtocolService.js";
|
|
31
|
-
import { ClusterTypeProtocol,
|
|
30
|
+
import { ClusterTypeProtocol, Val } from "#protocol";
|
|
32
31
|
import { ClusterType, VoidSchema } from "#types";
|
|
33
32
|
import type { Agent } from "../Agent.js";
|
|
34
33
|
import type { Endpoint } from "../Endpoint.js";
|
|
@@ -243,16 +242,6 @@ export class Behaviors {
|
|
|
243
242
|
promise = endpointInitializer.behaviorsInitialized(agent);
|
|
244
243
|
}
|
|
245
244
|
|
|
246
|
-
if (this.#endpoint.env.has(FabricManager)) {
|
|
247
|
-
const fabricIndices = this.#endpoint.env.get(FabricManager).fabrics.map(fabric => fabric.fabricIndex);
|
|
248
|
-
if (fabricIndices.length > 0) {
|
|
249
|
-
// Make sure the state on startup only includes allowed Fabric scoped data
|
|
250
|
-
return MaybePromise.then(promise, () =>
|
|
251
|
-
limitEndpointAttributeDataToAllowedFabrics(this.#endpoint, fabricIndices),
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
245
|
return promise;
|
|
257
246
|
};
|
|
258
247
|
|
|
@@ -281,7 +270,17 @@ export class Behaviors {
|
|
|
281
270
|
/**
|
|
282
271
|
* Does the {@link Endpoint} support a specified behavior?
|
|
283
272
|
*/
|
|
284
|
-
has<T extends Behavior.Type>(type: T)
|
|
273
|
+
has<T extends Behavior.Type>(type: T): boolean;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Does the {@link Endpoint} support a specified behavior by its behavior Id?
|
|
277
|
+
*/
|
|
278
|
+
has(typeId: string): boolean;
|
|
279
|
+
|
|
280
|
+
has(type: Behavior.Type | string): boolean {
|
|
281
|
+
if (typeof type === "string") {
|
|
282
|
+
return !!this.#supported[type];
|
|
283
|
+
}
|
|
285
284
|
const myType = this.#supported[type.id];
|
|
286
285
|
return myType === type || myType?.supports(type);
|
|
287
286
|
}
|
|
@@ -609,7 +608,18 @@ export class Behaviors {
|
|
|
609
608
|
/**
|
|
610
609
|
* Obtain current data version of behavior.
|
|
611
610
|
*/
|
|
612
|
-
versionOf(type: Behavior.Type)
|
|
611
|
+
versionOf(type: Behavior.Type): number;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Obtain current data version of behavior by its behavior Id, if existing
|
|
615
|
+
*/
|
|
616
|
+
versionOf(typeId: string): number | undefined;
|
|
617
|
+
|
|
618
|
+
versionOf(type: Behavior.Type | string) {
|
|
619
|
+
if (typeof type === "string") {
|
|
620
|
+
const backing = this.#backings[type];
|
|
621
|
+
return backing?.maybeDatasource?.version;
|
|
622
|
+
}
|
|
613
623
|
const backing = this.#backingFor(type);
|
|
614
624
|
return backing.datasource.version;
|
|
615
625
|
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { Behavior } from "#behavior/Behavior.js";
|
|
8
8
|
import type { BehaviorBacking } from "#behavior/internal/BehaviorBacking.js";
|
|
9
9
|
import type { Agent } from "#endpoint/Agent.js";
|
|
10
|
+
import { MaybePromise } from "#general";
|
|
10
11
|
import type { Endpoint } from "../Endpoint.js";
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -40,5 +41,5 @@ export abstract class EndpointInitializer {
|
|
|
40
41
|
/**
|
|
41
42
|
* Invoked after behaviors are initialized but before the initialization transaction commits.
|
|
42
43
|
*/
|
|
43
|
-
behaviorsInitialized(_agent: Agent) {}
|
|
44
|
+
behaviorsInitialized(_agent: Agent): MaybePromise {}
|
|
44
45
|
}
|
|
@@ -61,14 +61,14 @@ export class Endpoints implements ImmutableSet<Endpoint> {
|
|
|
61
61
|
return this.#list[Symbol.iterator]();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
for(
|
|
65
|
-
if (
|
|
64
|
+
for(id: number | string): Endpoint {
|
|
65
|
+
if (id === 0) {
|
|
66
66
|
return this.#node;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const endpoint = typeof
|
|
69
|
+
const endpoint = typeof id === "string" ? this.#idIndex[id] : this.#index[id];
|
|
70
70
|
if (endpoint === undefined) {
|
|
71
|
-
throw new StatusResponse.NotFoundError(`Endpoint ${
|
|
71
|
+
throw new StatusResponse.NotFoundError(`Endpoint ${id} does not exist`);
|
|
72
72
|
}
|
|
73
73
|
return endpoint;
|
|
74
74
|
}
|
package/src/node/Node.ts
CHANGED
|
@@ -41,6 +41,7 @@ export abstract class Node<T extends Node.CommonRootEndpoint = Node.CommonRootEn
|
|
|
41
41
|
#environment: Environment;
|
|
42
42
|
#runtime?: NetworkRuntime;
|
|
43
43
|
#startInProgress = false;
|
|
44
|
+
#closeInProgress = false;
|
|
44
45
|
|
|
45
46
|
constructor(config: Node.Configuration<T>) {
|
|
46
47
|
const parentEnvironment = config.environment ?? config.owner?.env ?? Environment.default;
|
|
@@ -183,9 +184,17 @@ export abstract class Node<T extends Node.CommonRootEndpoint = Node.CommonRootEn
|
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
override async close() {
|
|
186
|
-
this
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
if (this.#closeInProgress) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.#closeInProgress = true;
|
|
191
|
+
try {
|
|
192
|
+
this.lifecycle.targetState = "offline";
|
|
193
|
+
await this.lifecycle.mutex.close();
|
|
194
|
+
await this.closeWithMutex();
|
|
195
|
+
} finally {
|
|
196
|
+
this.#closeInProgress = false;
|
|
197
|
+
}
|
|
189
198
|
}
|
|
190
199
|
|
|
191
200
|
protected async closeWithMutex() {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { DescriptorClient } from "#behaviors/descriptor";
|
|
7
8
|
import { NetworkCommissioningClient } from "#behaviors/network-commissioning";
|
|
8
9
|
import { PowerSourceClient } from "#behaviors/power-source";
|
|
9
10
|
import { ThreadNetworkDiagnosticsClient } from "#behaviors/thread-network-diagnostics";
|
|
@@ -20,7 +21,7 @@ import { ClusterId } from "#types";
|
|
|
20
21
|
* Inspects a node to generate {@link PhysicalDeviceProperties}.
|
|
21
22
|
*/
|
|
22
23
|
export function NodePhysicalProperties(node: Node) {
|
|
23
|
-
const rootEndpointServerList = [...node.
|
|
24
|
+
const rootEndpointServerList = [...(node.maybeStateOf(DescriptorClient)?.serverList ?? [])];
|
|
24
25
|
|
|
25
26
|
const properties: PhysicalDeviceProperties = {
|
|
26
27
|
threadConnected: false,
|
|
@@ -58,8 +59,9 @@ function inspectEndpoint(endpoint: Endpoint, properties: PhysicalDevicePropertie
|
|
|
58
59
|
const powerSource = endpoint.behaviors.typeFor(PowerSourceClient);
|
|
59
60
|
if (powerSource) {
|
|
60
61
|
const features = powerSource.schema.supportedFeatures;
|
|
62
|
+
const status = endpoint.stateOf(PowerSourceClient).status;
|
|
61
63
|
if (features.has("WIRED")) {
|
|
62
|
-
if (
|
|
64
|
+
if (status === PowerSource.PowerSourceStatus.Active) {
|
|
63
65
|
// Should we only consider A/C "mains" powered? What is a DC adapter? What is an external battery?
|
|
64
66
|
// For now assuming "wired" means "don't worry about power consumption"
|
|
65
67
|
properties.isMainsPowered = true;
|
|
@@ -71,9 +73,9 @@ function inspectEndpoint(endpoint: Endpoint, properties: PhysicalDevicePropertie
|
|
|
71
73
|
endpoint.behaviors.elementsOf(powerSource).attributes.has("batChargeLevel")
|
|
72
74
|
) {
|
|
73
75
|
if (
|
|
74
|
-
|
|
76
|
+
status === PowerSource.PowerSourceStatus.Active ||
|
|
75
77
|
// Some devices do not properly specify state as active
|
|
76
|
-
|
|
78
|
+
status === PowerSource.PowerSourceStatus.Unspecified
|
|
77
79
|
) {
|
|
78
80
|
properties.isBatteryPowered = true;
|
|
79
81
|
}
|
package/src/node/client/index.ts
CHANGED
package/src/node/index.ts
CHANGED
|
@@ -448,11 +448,15 @@ export class InteractionServer implements ProtocolHandler, InteractionRecipient
|
|
|
448
448
|
|
|
449
449
|
if (fabric !== undefined && !keepSubscriptions) {
|
|
450
450
|
let clearedCount = 0;
|
|
451
|
-
for (const
|
|
452
|
-
|
|
451
|
+
for (const sess of this.#context.sessions.sessions) {
|
|
452
|
+
if (!PeerAddress.is(sess.peerAddress, session.peerAddress)) {
|
|
453
|
+
// Ignore subscriptions from other peers
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
for (const subscription of sess.subscriptions) {
|
|
453
457
|
await subscription.handlePeerCancel();
|
|
458
|
+
clearedCount++;
|
|
454
459
|
}
|
|
455
|
-
clearedCount++;
|
|
456
460
|
}
|
|
457
461
|
if (clearedCount > 0) {
|
|
458
462
|
logger.debug(
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Behavior } from "#behavior/Behavior.js";
|
|
8
|
+
import { limitEndpointAttributeDataToAllowedFabrics } from "#behavior/cluster/FabricScopedDataHandler.js";
|
|
8
9
|
import { BehaviorBacking } from "#behavior/internal/BehaviorBacking.js";
|
|
9
10
|
import { ServerBehaviorBacking } from "#behavior/internal/ServerBehaviorBacking.js";
|
|
10
11
|
import { Endpoint } from "#endpoint/Endpoint.js";
|
|
12
|
+
import type { Agent } from "#endpoint/index.js";
|
|
11
13
|
import { EndpointInitializer } from "#endpoint/properties/EndpointInitializer.js";
|
|
12
|
-
import { Environment, InternalError, Logger } from "#general";
|
|
14
|
+
import { Environment, InternalError, Logger, MaybePromise } from "#general";
|
|
15
|
+
import { FabricManager } from "#protocol";
|
|
13
16
|
import { ServerNodeStore } from "#storage/server/ServerNodeStore.js";
|
|
14
17
|
import { DescriptorServer } from "../../behaviors/descriptor/DescriptorServer.js";
|
|
15
18
|
|
|
@@ -105,4 +108,14 @@ export class ServerEndpointInitializer extends EndpointInitializer {
|
|
|
105
108
|
|
|
106
109
|
return id;
|
|
107
110
|
}
|
|
111
|
+
|
|
112
|
+
override behaviorsInitialized(agent: Agent): MaybePromise {
|
|
113
|
+
// Make sure the state only includes allowed Fabric scoped data when an endpoint is added after node is online
|
|
114
|
+
if (agent.env.has(FabricManager)) {
|
|
115
|
+
const fabricIndices = agent.env.get(FabricManager).fabrics.map(fabric => fabric.fabricIndex);
|
|
116
|
+
if (fabricIndices.length > 0) {
|
|
117
|
+
return limitEndpointAttributeDataToAllowedFabrics(agent.endpoint, fabricIndices);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
108
121
|
}
|
|
@@ -443,7 +443,7 @@ export class ServerSubscription implements Subscription {
|
|
|
443
443
|
break;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
this.#lastUpdateTime = Time.nowMs;
|
|
446
|
+
this.#lastUpdateTime = Time.nowMs; // TODO Count time from here or from "receive of the ack"?
|
|
447
447
|
|
|
448
448
|
try {
|
|
449
449
|
using sending = updating?.join("sending");
|