@matter/node 0.18.0 → 0.18.1-alpha.0-20261111-b89790712

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.
Files changed (353) hide show
  1. package/dist/cjs/behavior/Behavior.d.ts.map +1 -1
  2. package/dist/cjs/behavior/Behavior.js +2 -0
  3. package/dist/cjs/behavior/Behavior.js.map +1 -1
  4. package/dist/cjs/behavior/Events.d.ts.map +1 -1
  5. package/dist/cjs/behavior/Events.js +4 -2
  6. package/dist/cjs/behavior/Events.js.map +1 -1
  7. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts +17 -3
  8. package/dist/cjs/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  9. package/dist/cjs/behavior/cluster/ClusterBehavior.js +2 -20
  10. package/dist/cjs/behavior/cluster/ClusterBehavior.js.map +1 -1
  11. package/dist/cjs/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  12. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js +8 -150
  13. package/dist/cjs/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  14. package/dist/cjs/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  15. package/dist/cjs/behavior/internal/BehaviorBacking.js +2 -0
  16. package/dist/cjs/behavior/internal/BehaviorBacking.js.map +1 -1
  17. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts +45 -0
  18. package/dist/cjs/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  19. package/dist/cjs/behavior/internal/ClusterDerivation.js +192 -0
  20. package/dist/cjs/behavior/internal/ClusterDerivation.js.map +6 -0
  21. package/dist/cjs/behavior/internal/ClusterStatics.d.ts +16 -0
  22. package/dist/cjs/behavior/internal/ClusterStatics.d.ts.map +1 -0
  23. package/dist/cjs/behavior/internal/ClusterStatics.js +138 -0
  24. package/dist/cjs/behavior/internal/ClusterStatics.js.map +6 -0
  25. package/dist/cjs/behavior/internal/ModeledState.d.ts +18 -0
  26. package/dist/cjs/behavior/internal/ModeledState.d.ts.map +1 -0
  27. package/dist/cjs/behavior/internal/ModeledState.js +54 -0
  28. package/dist/cjs/behavior/internal/ModeledState.js.map +6 -0
  29. package/dist/cjs/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  30. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js +3 -12
  31. package/dist/cjs/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  32. package/dist/cjs/behavior/state/managed/Datasource.js +28 -17
  33. package/dist/cjs/behavior/state/managed/Datasource.js.map +1 -1
  34. package/dist/cjs/behavior/state/managed/Internal.d.ts +16 -5
  35. package/dist/cjs/behavior/state/managed/Internal.d.ts.map +1 -1
  36. package/dist/cjs/behavior/state/managed/Internal.js +23 -25
  37. package/dist/cjs/behavior/state/managed/Internal.js.map +1 -1
  38. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts +45 -12
  39. package/dist/cjs/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  40. package/dist/cjs/behavior/state/managed/ManagedReference.js +74 -44
  41. package/dist/cjs/behavior/state/managed/ManagedReference.js.map +1 -1
  42. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts +31 -0
  43. package/dist/cjs/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  44. package/dist/cjs/behavior/state/managed/ReadOnlyReference.js +60 -0
  45. package/dist/cjs/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  46. package/dist/cjs/behavior/state/managed/ValReference.d.ts +47 -10
  47. package/dist/cjs/behavior/state/managed/ValReference.d.ts.map +1 -1
  48. package/dist/cjs/behavior/state/managed/ValReference.js +29 -0
  49. package/dist/cjs/behavior/state/managed/ValReference.js.map +2 -2
  50. package/dist/cjs/behavior/state/managed/values/BitmapManager.js +5 -20
  51. package/dist/cjs/behavior/state/managed/values/BitmapManager.js.map +1 -1
  52. package/dist/cjs/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  53. package/dist/cjs/behavior/state/managed/values/ListManager.js +262 -119
  54. package/dist/cjs/behavior/state/managed/values/ListManager.js.map +2 -2
  55. package/dist/cjs/behavior/state/managed/values/StructManager.js +14 -23
  56. package/dist/cjs/behavior/state/managed/values/StructManager.js.map +2 -2
  57. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts +13 -3
  58. package/dist/cjs/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  59. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js +12 -0
  60. package/dist/cjs/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  61. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  62. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  63. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js +9 -0
  64. package/dist/cjs/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  65. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  66. package/dist/cjs/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  67. package/dist/cjs/behavior/system/controller/ControllerBehavior.js +2 -1
  68. package/dist/cjs/behavior/system/controller/ControllerBehavior.js.map +1 -1
  69. package/dist/cjs/behavior/system/dcl/DclBehavior.d.ts +3 -3
  70. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  71. package/dist/cjs/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  72. package/dist/cjs/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  73. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  74. package/dist/cjs/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  75. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js +6 -1
  76. package/dist/cjs/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  77. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  78. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  79. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js +74 -0
  80. package/dist/cjs/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  81. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  82. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  83. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  84. package/dist/cjs/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  85. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts +2 -2
  86. package/dist/cjs/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  87. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  88. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  89. package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  90. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  91. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  92. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +104 -60
  93. package/dist/cjs/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  94. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  95. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  96. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  97. package/dist/cjs/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  98. package/dist/cjs/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  99. package/dist/cjs/behaviors/groupcast/GroupcastServer.js +41 -25
  100. package/dist/cjs/behaviors/groupcast/GroupcastServer.js.map +2 -2
  101. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  102. package/dist/cjs/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  103. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  104. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  105. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js +27 -23
  106. package/dist/cjs/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  107. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  108. package/dist/cjs/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  109. package/dist/cjs/behaviors/thermostat/ThermostatServer.js +66 -49
  110. package/dist/cjs/behaviors/thermostat/ThermostatServer.js.map +1 -1
  111. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  112. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  113. package/dist/cjs/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +1 -1
  114. package/dist/cjs/endpoint/properties/Behaviors.d.ts.map +1 -1
  115. package/dist/cjs/endpoint/properties/Behaviors.js +5 -1
  116. package/dist/cjs/endpoint/properties/Behaviors.js.map +1 -1
  117. package/dist/cjs/node/ClientNode.d.ts +6 -0
  118. package/dist/cjs/node/ClientNode.d.ts.map +1 -1
  119. package/dist/cjs/node/ClientNode.js +6 -0
  120. package/dist/cjs/node/ClientNode.js.map +1 -1
  121. package/dist/cjs/node/ServerNode.d.ts.map +1 -1
  122. package/dist/cjs/node/ServerNode.js +2 -0
  123. package/dist/cjs/node/ServerNode.js.map +1 -1
  124. package/dist/cjs/node/client/ClientEventEmitter.d.ts.map +1 -1
  125. package/dist/cjs/node/client/ClientEventEmitter.js +6 -2
  126. package/dist/cjs/node/client/ClientEventEmitter.js.map +1 -1
  127. package/dist/cjs/node/client/ClientStructure.d.ts.map +1 -1
  128. package/dist/cjs/node/client/ClientStructure.js +181 -108
  129. package/dist/cjs/node/client/ClientStructure.js.map +2 -2
  130. package/dist/cjs/node/client/Peers.d.ts +3 -2
  131. package/dist/cjs/node/client/Peers.d.ts.map +1 -1
  132. package/dist/cjs/node/client/Peers.js +8 -9
  133. package/dist/cjs/node/client/Peers.js.map +1 -1
  134. package/dist/cjs/node/integration/ChangeNotificationService.d.ts +14 -3
  135. package/dist/cjs/node/integration/ChangeNotificationService.d.ts.map +1 -1
  136. package/dist/cjs/node/integration/ProtocolService.d.ts.map +1 -1
  137. package/dist/cjs/node/integration/ProtocolService.js +38 -56
  138. package/dist/cjs/node/integration/ProtocolService.js.map +1 -1
  139. package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
  140. package/dist/cjs/node/server/InteractionServer.js +28 -24
  141. package/dist/cjs/node/server/InteractionServer.js.map +2 -2
  142. package/dist/cjs/node/server/ServerSubscription.d.ts +7 -2
  143. package/dist/cjs/node/server/ServerSubscription.d.ts.map +1 -1
  144. package/dist/cjs/node/server/ServerSubscription.js +83 -47
  145. package/dist/cjs/node/server/ServerSubscription.js.map +1 -1
  146. package/dist/cjs/testing/mock-server-node.d.ts +2 -1
  147. package/dist/cjs/testing/mock-server-node.d.ts.map +1 -1
  148. package/dist/cjs/testing/mock-server-node.js +8 -5
  149. package/dist/cjs/testing/mock-server-node.js.map +2 -2
  150. package/dist/cjs/testing/node-helpers.d.ts +5 -0
  151. package/dist/cjs/testing/node-helpers.d.ts.map +1 -1
  152. package/dist/cjs/testing/node-helpers.js +4 -4
  153. package/dist/cjs/testing/node-helpers.js.map +1 -1
  154. package/dist/esm/behavior/Behavior.d.ts.map +1 -1
  155. package/dist/esm/behavior/Behavior.js +2 -0
  156. package/dist/esm/behavior/Behavior.js.map +1 -1
  157. package/dist/esm/behavior/Events.d.ts.map +1 -1
  158. package/dist/esm/behavior/Events.js +4 -2
  159. package/dist/esm/behavior/Events.js.map +1 -1
  160. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts +17 -3
  161. package/dist/esm/behavior/cluster/ClusterBehavior.d.ts.map +1 -1
  162. package/dist/esm/behavior/cluster/ClusterBehavior.js +2 -20
  163. package/dist/esm/behavior/cluster/ClusterBehavior.js.map +1 -1
  164. package/dist/esm/behavior/cluster/ClusterBehaviorType.d.ts.map +1 -1
  165. package/dist/esm/behavior/cluster/ClusterBehaviorType.js +10 -159
  166. package/dist/esm/behavior/cluster/ClusterBehaviorType.js.map +1 -1
  167. package/dist/esm/behavior/internal/BehaviorBacking.d.ts.map +1 -1
  168. package/dist/esm/behavior/internal/BehaviorBacking.js +2 -0
  169. package/dist/esm/behavior/internal/BehaviorBacking.js.map +1 -1
  170. package/dist/esm/behavior/internal/ClusterDerivation.d.ts +45 -0
  171. package/dist/esm/behavior/internal/ClusterDerivation.d.ts.map +1 -0
  172. package/dist/esm/behavior/internal/ClusterDerivation.js +172 -0
  173. package/dist/esm/behavior/internal/ClusterDerivation.js.map +6 -0
  174. package/dist/esm/behavior/internal/ClusterStatics.d.ts +16 -0
  175. package/dist/esm/behavior/internal/ClusterStatics.d.ts.map +1 -0
  176. package/dist/esm/behavior/internal/ClusterStatics.js +118 -0
  177. package/dist/esm/behavior/internal/ClusterStatics.js.map +6 -0
  178. package/dist/esm/behavior/internal/ModeledState.d.ts +18 -0
  179. package/dist/esm/behavior/internal/ModeledState.d.ts.map +1 -0
  180. package/dist/esm/behavior/internal/ModeledState.js +34 -0
  181. package/dist/esm/behavior/internal/ModeledState.js.map +6 -0
  182. package/dist/esm/behavior/internal/ServerBehaviorBacking.d.ts.map +1 -1
  183. package/dist/esm/behavior/internal/ServerBehaviorBacking.js +3 -12
  184. package/dist/esm/behavior/internal/ServerBehaviorBacking.js.map +1 -1
  185. package/dist/esm/behavior/state/managed/Datasource.js +28 -17
  186. package/dist/esm/behavior/state/managed/Datasource.js.map +1 -1
  187. package/dist/esm/behavior/state/managed/Internal.d.ts +16 -5
  188. package/dist/esm/behavior/state/managed/Internal.d.ts.map +1 -1
  189. package/dist/esm/behavior/state/managed/Internal.js +23 -25
  190. package/dist/esm/behavior/state/managed/Internal.js.map +1 -1
  191. package/dist/esm/behavior/state/managed/ManagedReference.d.ts +45 -12
  192. package/dist/esm/behavior/state/managed/ManagedReference.d.ts.map +1 -1
  193. package/dist/esm/behavior/state/managed/ManagedReference.js +75 -45
  194. package/dist/esm/behavior/state/managed/ManagedReference.js.map +1 -1
  195. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts +31 -0
  196. package/dist/esm/behavior/state/managed/ReadOnlyReference.d.ts.map +1 -0
  197. package/dist/esm/behavior/state/managed/ReadOnlyReference.js +40 -0
  198. package/dist/esm/behavior/state/managed/ReadOnlyReference.js.map +6 -0
  199. package/dist/esm/behavior/state/managed/ValReference.d.ts +47 -10
  200. package/dist/esm/behavior/state/managed/ValReference.d.ts.map +1 -1
  201. package/dist/esm/behavior/state/managed/ValReference.js +25 -0
  202. package/dist/esm/behavior/state/managed/ValReference.js.map +2 -2
  203. package/dist/esm/behavior/state/managed/values/BitmapManager.js +6 -21
  204. package/dist/esm/behavior/state/managed/values/BitmapManager.js.map +1 -1
  205. package/dist/esm/behavior/state/managed/values/ListManager.d.ts.map +1 -1
  206. package/dist/esm/behavior/state/managed/values/ListManager.js +264 -129
  207. package/dist/esm/behavior/state/managed/values/ListManager.js.map +2 -2
  208. package/dist/esm/behavior/state/managed/values/StructManager.js +15 -24
  209. package/dist/esm/behavior/state/managed/values/StructManager.js.map +2 -2
  210. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts +13 -3
  211. package/dist/esm/behavior/system/commissioning/CommissioningClient.d.ts.map +1 -1
  212. package/dist/esm/behavior/system/commissioning/CommissioningClient.js +12 -0
  213. package/dist/esm/behavior/system/commissioning/CommissioningClient.js.map +1 -1
  214. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts +9 -1
  215. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.d.ts.map +1 -1
  216. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js +10 -1
  217. package/dist/esm/behavior/system/commissioning/RemoteDescriptor.js.map +1 -1
  218. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts +2 -1
  219. package/dist/esm/behavior/system/controller/ControllerBehavior.d.ts.map +1 -1
  220. package/dist/esm/behavior/system/controller/ControllerBehavior.js +2 -1
  221. package/dist/esm/behavior/system/controller/ControllerBehavior.js.map +1 -1
  222. package/dist/esm/behavior/system/dcl/DclBehavior.d.ts +3 -3
  223. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts +2 -1
  224. package/dist/esm/behavior/system/network/ServerGroupNetworking.d.ts.map +1 -1
  225. package/dist/esm/behavior/system/network/ServerGroupNetworking.js.map +1 -1
  226. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts +4 -0
  227. package/dist/esm/behavior/system/sessions/SessionsBehavior.d.ts.map +1 -1
  228. package/dist/esm/behavior/system/sessions/SessionsBehavior.js +6 -1
  229. package/dist/esm/behavior/system/sessions/SessionsBehavior.js.map +1 -1
  230. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts +28 -0
  231. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.d.ts.map +1 -0
  232. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js +54 -0
  233. package/dist/esm/behavior/system/subscriptions/SubscriptionStore.js.map +6 -0
  234. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts +8 -3
  235. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.d.ts.map +1 -1
  236. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js +61 -30
  237. package/dist/esm/behavior/system/subscriptions/SubscriptionsServer.js.map +1 -1
  238. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts +2 -2
  239. package/dist/esm/behaviors/access-control/AccessControlServer.d.ts.map +1 -1
  240. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
  241. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +43 -21
  242. package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
  243. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts +29 -23
  244. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.d.ts.map +1 -1
  245. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js +105 -60
  246. package/dist/esm/behaviors/general-diagnostics/GeneralDiagnosticsServer.js.map +1 -1
  247. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts +9 -1
  248. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.d.ts.map +1 -1
  249. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js +11 -7
  250. package/dist/esm/behaviors/group-key-management/GroupKeyManagementServer.js.map +1 -1
  251. package/dist/esm/behaviors/groupcast/GroupcastServer.d.ts.map +1 -1
  252. package/dist/esm/behaviors/groupcast/GroupcastServer.js +42 -25
  253. package/dist/esm/behaviors/groupcast/GroupcastServer.js.map +2 -2
  254. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts +1 -1
  255. package/dist/esm/behaviors/localization-configuration/LocalizationConfigurationServer.d.ts.map +1 -1
  256. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts +2 -0
  257. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.d.ts.map +1 -1
  258. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js +32 -24
  259. package/dist/esm/behaviors/operational-credentials/VendorIdVerification.js.map +1 -1
  260. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts +15 -4
  261. package/dist/esm/behaviors/thermostat/ThermostatServer.d.ts.map +1 -1
  262. package/dist/esm/behaviors/thermostat/ThermostatServer.js +66 -49
  263. package/dist/esm/behaviors/thermostat/ThermostatServer.js.map +1 -1
  264. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts +4 -4
  265. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.d.ts.map +1 -1
  266. package/dist/esm/behaviors/time-format-localization/TimeFormatLocalizationServer.js.map +1 -1
  267. package/dist/esm/endpoint/properties/Behaviors.d.ts.map +1 -1
  268. package/dist/esm/endpoint/properties/Behaviors.js +6 -2
  269. package/dist/esm/endpoint/properties/Behaviors.js.map +1 -1
  270. package/dist/esm/node/ClientNode.d.ts +6 -0
  271. package/dist/esm/node/ClientNode.d.ts.map +1 -1
  272. package/dist/esm/node/ClientNode.js +6 -0
  273. package/dist/esm/node/ClientNode.js.map +1 -1
  274. package/dist/esm/node/ServerNode.d.ts.map +1 -1
  275. package/dist/esm/node/ServerNode.js +2 -0
  276. package/dist/esm/node/ServerNode.js.map +1 -1
  277. package/dist/esm/node/client/ClientEventEmitter.d.ts.map +1 -1
  278. package/dist/esm/node/client/ClientEventEmitter.js +6 -2
  279. package/dist/esm/node/client/ClientEventEmitter.js.map +1 -1
  280. package/dist/esm/node/client/ClientStructure.d.ts.map +1 -1
  281. package/dist/esm/node/client/ClientStructure.js +181 -108
  282. package/dist/esm/node/client/ClientStructure.js.map +2 -2
  283. package/dist/esm/node/client/Peers.d.ts +3 -2
  284. package/dist/esm/node/client/Peers.d.ts.map +1 -1
  285. package/dist/esm/node/client/Peers.js +8 -10
  286. package/dist/esm/node/client/Peers.js.map +1 -1
  287. package/dist/esm/node/integration/ChangeNotificationService.d.ts +14 -3
  288. package/dist/esm/node/integration/ChangeNotificationService.d.ts.map +1 -1
  289. package/dist/esm/node/integration/ProtocolService.d.ts.map +1 -1
  290. package/dist/esm/node/integration/ProtocolService.js +40 -57
  291. package/dist/esm/node/integration/ProtocolService.js.map +1 -1
  292. package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
  293. package/dist/esm/node/server/InteractionServer.js +28 -25
  294. package/dist/esm/node/server/InteractionServer.js.map +2 -2
  295. package/dist/esm/node/server/ServerSubscription.d.ts +7 -2
  296. package/dist/esm/node/server/ServerSubscription.d.ts.map +1 -1
  297. package/dist/esm/node/server/ServerSubscription.js +83 -47
  298. package/dist/esm/node/server/ServerSubscription.js.map +1 -1
  299. package/dist/esm/testing/mock-server-node.d.ts +2 -1
  300. package/dist/esm/testing/mock-server-node.d.ts.map +1 -1
  301. package/dist/esm/testing/mock-server-node.js +16 -7
  302. package/dist/esm/testing/mock-server-node.js.map +2 -2
  303. package/dist/esm/testing/node-helpers.d.ts +5 -0
  304. package/dist/esm/testing/node-helpers.d.ts.map +1 -1
  305. package/dist/esm/testing/node-helpers.js +4 -4
  306. package/dist/esm/testing/node-helpers.js.map +1 -1
  307. package/package.json +6 -6
  308. package/src/behavior/Behavior.ts +2 -0
  309. package/src/behavior/Events.ts +6 -3
  310. package/src/behavior/cluster/ClusterBehavior.ts +22 -13
  311. package/src/behavior/cluster/ClusterBehaviorType.ts +9 -270
  312. package/src/behavior/internal/BehaviorBacking.ts +3 -0
  313. package/src/behavior/internal/ClusterDerivation.ts +295 -0
  314. package/src/behavior/internal/ClusterStatics.ts +180 -0
  315. package/src/behavior/internal/ModeledState.ts +58 -0
  316. package/src/behavior/internal/ServerBehaviorBacking.ts +3 -15
  317. package/src/behavior/state/managed/Datasource.ts +36 -21
  318. package/src/behavior/state/managed/Internal.ts +36 -33
  319. package/src/behavior/state/managed/ManagedReference.ts +120 -68
  320. package/src/behavior/state/managed/ReadOnlyReference.ts +54 -0
  321. package/src/behavior/state/managed/ValReference.ts +67 -11
  322. package/src/behavior/state/managed/values/BitmapManager.ts +6 -22
  323. package/src/behavior/state/managed/values/ListManager.ts +301 -146
  324. package/src/behavior/state/managed/values/StructManager.ts +20 -29
  325. package/src/behavior/system/commissioning/CommissioningClient.ts +22 -3
  326. package/src/behavior/system/commissioning/RemoteDescriptor.ts +17 -1
  327. package/src/behavior/system/controller/ControllerBehavior.ts +2 -1
  328. package/src/behavior/system/dcl/DclBehavior.ts +3 -3
  329. package/src/behavior/system/network/ServerGroupNetworking.ts +3 -2
  330. package/src/behavior/system/sessions/SessionsBehavior.ts +8 -2
  331. package/src/behavior/system/subscriptions/SubscriptionStore.ts +66 -0
  332. package/src/behavior/system/subscriptions/SubscriptionsServer.ts +73 -33
  333. package/src/behaviors/access-control/AccessControlServer.ts +3 -3
  334. package/src/behaviors/administrator-commissioning/AdministratorCommissioningServer.ts +47 -24
  335. package/src/behaviors/general-diagnostics/GeneralDiagnosticsServer.ts +138 -84
  336. package/src/behaviors/group-key-management/GroupKeyManagementServer.ts +12 -8
  337. package/src/behaviors/groupcast/GroupcastServer.ts +50 -34
  338. package/src/behaviors/localization-configuration/LocalizationConfigurationServer.ts +1 -1
  339. package/src/behaviors/operational-credentials/VendorIdVerification.ts +50 -35
  340. package/src/behaviors/thermostat/ThermostatServer.ts +93 -70
  341. package/src/behaviors/time-format-localization/TimeFormatLocalizationServer.ts +4 -4
  342. package/src/endpoint/properties/Behaviors.ts +6 -2
  343. package/src/node/ClientNode.ts +6 -0
  344. package/src/node/ServerNode.ts +2 -0
  345. package/src/node/client/ClientEventEmitter.ts +7 -3
  346. package/src/node/client/ClientStructure.ts +208 -135
  347. package/src/node/client/Peers.ts +10 -14
  348. package/src/node/integration/ChangeNotificationService.ts +18 -3
  349. package/src/node/integration/ProtocolService.ts +45 -57
  350. package/src/node/server/InteractionServer.ts +33 -35
  351. package/src/node/server/ServerSubscription.ts +88 -50
  352. package/src/testing/mock-server-node.ts +22 -9
  353. package/src/testing/node-helpers.ts +5 -1
@@ -134,24 +134,36 @@ export class ClientStructure {
134
134
  #attributeIds = new Map<ClusterId, Map<string, number>>();
135
135
 
136
136
  /**
137
- * Which endpoints have named each part in a `PartsList`, and what each of those lists contained.
137
+ * The parts each endpoint's current `PartsList` names.
138
138
  *
139
139
  * Parenthood cannot be decided from a single list, because a device type composing its list of
140
140
  * every descendant ({@link EndpointComposition.FullFamily}) says nothing about which endpoint owns
141
- * a part. A claim stays here until it can be decided; nothing is ever reparented, so an
142
- * undecidable claim waits for the read that settles it rather than being guessed at.
141
+ * a part. {@link #placeParts} reads all lists together; nothing is ever reparented, so a part
142
+ * whose owner cannot be told yet waits for the read that settles it rather than being guessed at.
143
143
  */
144
- #partClaims = new Map<EndpointStructure, Set<EndpointStructure>>();
145
144
  #partsListOf = new Map<EndpointStructure, Set<EndpointNumber>>();
146
145
 
147
146
  /**
148
- * How each endpoint composes its `PartsList`, for the endpoints that have said.
147
+ * The endpoints on the node as of the last structural apply, or `undefined` while the root has not reported its
148
+ * `PartsList`; see {@link #findEndpointsOnTheNode}.
149
+ */
150
+ #endpointsOnTheNode?: Set<EndpointNumber>;
151
+
152
+ /** Endpoints that left the node but stay placed, because they hold endpoints on the node. */
153
+ #keptOffTheNode = new Set<EndpointNumber>();
154
+
155
+ #warnedIncompleteRootPartsList = false;
156
+
157
+ /**
158
+ * How each endpoint composes its `PartsList`, for the endpoints that have said. Read it through
159
+ * {@link #compositionOf}, which does not use the root's entry.
149
160
  *
150
161
  * Absent means the endpoint has not reported its device types yet, which is not the same as
151
162
  * composing a tree: a list from an endpoint whose composition is unknown says nothing about who
152
- * owns what, so claims from it wait rather than being read as a parent's.
163
+ * owns what, so it is not weighed in deciding a part's owner yet.
153
164
  */
154
165
  #composition = new Map<EndpointStructure, EndpointComposition>();
166
+ #warnedRootWithoutDeviceType = false;
155
167
  #events: ClientStructureEvents;
156
168
  #changed = Observable<[void]>();
157
169
  #applying = 0;
@@ -241,7 +253,9 @@ export class ClientStructure {
241
253
  }
242
254
  }
243
255
 
244
- this.#resolvePartClaims();
256
+ this.#endpointsOnTheNode = this.#findEndpointsOnTheNode();
257
+ this.#checkRootPartsList();
258
+ this.#placeParts();
245
259
 
246
260
  const changes = this.#pendingChanges;
247
261
  this.#pendingChanges = new Map();
@@ -996,6 +1010,10 @@ export class ClientStructure {
996
1010
  | undefined;
997
1011
  if (Array.isArray(deviceTypeList)) {
998
1012
  this.#noteComposition(structure, deviceTypeList);
1013
+ // The behavior's state holds an empty list until the peer reports one
1014
+ if (!endpoint.number && structure.reportedLists?.has(DEVICE_TYPE_LIST_ATTR_ID)) {
1015
+ this.#checkRootDeviceTypes(deviceTypeList);
1016
+ }
999
1017
 
1000
1018
  const endpointType = endpoint.type;
1001
1019
  for (const dt of deviceTypeList) {
@@ -1080,68 +1098,21 @@ export class ClientStructure {
1080
1098
  return;
1081
1099
  }
1082
1100
 
1083
- // Which claimant owns a part is decided by #resolvePartClaims, once every list this
1084
- // interaction carries is in.
1101
+ // Which endpoint owns a part is decided by #placeParts, once every list this interaction
1102
+ // carries is in.
1085
1103
  const named = new Set<EndpointNumber>();
1086
1104
  for (const value of partsList) {
1087
1105
  // The peer's own value, so it is checked rather than trusted; one out of range names no
1088
- // endpoint this could hold
1089
- if (typeof value !== "number" || !EndpointNumber.isValid(value)) {
1106
+ // endpoint this could hold, and the root is no endpoint's part (Matter Core § 9.2.8)
1107
+ if (typeof value !== "number" || !EndpointNumber.isValid(value) || value === ROOT_ENDPOINT_NUMBER) {
1090
1108
  continue;
1091
1109
  }
1092
1110
 
1093
1111
  const partNo = EndpointNumber(value);
1094
1112
  named.add(partNo);
1095
-
1096
- const part = this.#endpointFor(partNo);
1097
- let claimants = this.#partClaims.get(part);
1098
- if (claimants === undefined) {
1099
- claimants = new Set();
1100
- this.#partClaims.set(part, claimants);
1101
- }
1102
- claimants.add(structure);
1113
+ this.#endpointFor(partNo);
1103
1114
  }
1104
- this.#retractClaimsOf(structure, named);
1105
1115
  this.#partsListOf.set(structure, named);
1106
-
1107
- // For the root partsList specifically, if an endpoint is no longer present then it has been removed from the
1108
- // node. Schedule for erase
1109
- if (endpoint.maybeNumber === 0) {
1110
- const numbersUsed = new Set(partsList);
1111
- for (const descendent of (endpoint as Node).endpoints) {
1112
- // Skip root endpoint and uninitialized numbers (though latter shouldn't be possible)
1113
- if (!descendent.maybeNumber) {
1114
- continue;
1115
- }
1116
-
1117
- if (!numbersUsed.has(descendent.number)) {
1118
- const endpoint = this.#endpoints.get(descendent.number);
1119
- if (endpoint === undefined) {
1120
- continue;
1121
- }
1122
-
1123
- // Erasing an endpoint closes everything below it, and nothing can move what it
1124
- // held elsewhere first. A peer that drops an endpoint while still naming what
1125
- // hangs from it contradicts itself, and the endpoints it still names are worth
1126
- // more than a tree that matches its list exactly.
1127
- const named = new Array<Endpoint>();
1128
- descendent.visit(below => {
1129
- if (below !== descendent && below.maybeNumber !== undefined && numbersUsed.has(below.number)) {
1130
- named.push(below);
1131
- }
1132
- });
1133
- if (named.length) {
1134
- logger.warn(
1135
- `Keeping ${descendent} although the peer's root no longer names it:`,
1136
- `it holds ${named.join(", ")}, which the root does name`,
1137
- );
1138
- continue;
1139
- }
1140
-
1141
- this.#scheduleStructureChange(endpoint, "erase");
1142
- }
1143
- }
1144
- }
1145
1116
  }
1146
1117
 
1147
1118
  #endpointFor(number: EndpointNumber) {
@@ -1273,15 +1244,9 @@ export class ClientStructure {
1273
1244
  );
1274
1245
 
1275
1246
  this.#endpoints.delete(endpoint.number);
1276
- this.#partClaims.delete(structure);
1277
1247
  this.#partsListOf.delete(structure);
1278
1248
  this.#composition.delete(structure);
1279
- for (const [part, claimants] of this.#partClaims) {
1280
- claimants.delete(structure);
1281
- if (claimants.size === 0) {
1282
- this.#partClaims.delete(part);
1283
- }
1284
- }
1249
+ this.#keptOffTheNode.delete(endpoint.number);
1285
1250
 
1286
1251
  // Skip deletion if the endpoint was already destroyed, e.g. because a parent endpoint was erased first and
1287
1252
  // recursively closed its children
@@ -1399,11 +1364,18 @@ export class ClientStructure {
1399
1364
  }
1400
1365
 
1401
1366
  /**
1402
- * Decide the owner of every part whose owner is now known, then apply the structural changes that
1403
- * fall out of it.
1367
+ * Decide which endpoints are on the node and the owner of every part whose owner is now known, then apply the
1368
+ * structural changes that fall out of it.
1404
1369
  */
1405
1370
  async #applyPendingChanges() {
1406
- this.#resolvePartClaims();
1371
+ const previous = this.#endpointsOnTheNode;
1372
+ const current = this.#findEndpointsOnTheNode();
1373
+ this.#endpointsOnTheNode = current;
1374
+ this.#checkRootPartsList();
1375
+ if (previous !== undefined && current !== undefined) {
1376
+ this.#eraseEndpointsOffTheNode(previous, current);
1377
+ }
1378
+ this.#placeParts();
1407
1379
 
1408
1380
  for (const [endpoint, change] of this.#pendingChanges.entries()) {
1409
1381
  this.#pendingChanges.delete(endpoint);
@@ -1424,24 +1396,40 @@ export class ClientStructure {
1424
1396
  }
1425
1397
 
1426
1398
  /**
1427
- * Give every part whose owner is now known an owner, and schedule its installation.
1399
+ * Give every part on the node whose owner is now known an owner, and schedule its installation.
1428
1400
  *
1429
1401
  * A part named by an ordinary endpoint's list is that endpoint's child. A part named only by
1430
1402
  * full-family lists is a child of the innermost of them — but only once every endpoint those lists
1431
1403
  * name has reported its own parts, because until then a list naming it says no more than that it
1432
1404
  * is somewhere below. A part is placed only below an owner that is itself placed, so it is never
1433
- * installed or announced below an endpoint that is not on the node. A claim that is undecided, or
1434
- * whose owner is not placed yet, stays for a later interaction to settle.
1405
+ * installed or announced below an endpoint that is not on the node. Each call reads the current
1406
+ * lists, so a part that cannot be placed yet is considered again on the next apply.
1435
1407
  */
1436
- #resolvePartClaims() {
1408
+ #placeParts() {
1409
+ const claimantsOf = new Map<EndpointStructure, Set<EndpointStructure>>();
1410
+ for (const [claimant, parts] of this.#partsListOf) {
1411
+ for (const partNo of parts) {
1412
+ const part = this.#endpoints.get(partNo);
1413
+ if (part === undefined) {
1414
+ continue;
1415
+ }
1416
+
1417
+ let claimants = claimantsOf.get(part);
1418
+ if (claimants === undefined) {
1419
+ claimants = new Set();
1420
+ claimantsOf.set(part, claimants);
1421
+ }
1422
+ claimants.add(claimant);
1423
+ }
1424
+ }
1425
+
1437
1426
  let placedAny: boolean;
1438
1427
  do {
1439
1428
  placedAny = false;
1440
- for (const [part, claimants] of [...this.#partClaims]) {
1429
+ for (const [part, claimants] of claimantsOf) {
1441
1430
  // Nothing is reparented: an endpoint the peer has already placed keeps its parent, and
1442
1431
  // Matter has no operation that would move it (Core § 9.2.7.3's single-parent requirement)
1443
- if (this.#ownerOf(part) !== undefined) {
1444
- this.#partClaims.delete(part);
1432
+ if (this.#isPlaced(part) || !this.#isOnTheNode(part)) {
1445
1433
  continue;
1446
1434
  }
1447
1435
 
@@ -1451,15 +1439,6 @@ export class ClientStructure {
1451
1439
  }
1452
1440
  const { owner, contenders } = decision;
1453
1441
 
1454
- this.#partClaims.delete(part);
1455
-
1456
- // The root names every endpoint the peer has, and its removal scan runs while attribute
1457
- // data is read — before this. Installing a part the root no longer names would resurrect
1458
- // an endpoint that scan has already passed over.
1459
- if (!this.#isOnTheNode(part)) {
1460
- continue;
1461
- }
1462
-
1463
1442
  if (contenders.length) {
1464
1443
  logger.warn(
1465
1444
  `Taking ${owner.endpoint} as the parent of ${part.endpoint}:`,
@@ -1485,21 +1464,120 @@ export class ClientStructure {
1485
1464
  }
1486
1465
 
1487
1466
  /**
1488
- * Whether the peer's root names `structure`, so far as the root has said.
1489
- *
1490
- * A root endpoint composes its `PartsList` of every descendant (Matter Core § 9.2.8), so an
1491
- * endpoint the root does not name is not a descendant of the node at all — whether it has gone
1492
- * away or was never part of the tree the peer describes. Until the root has reported a list there
1493
- * is nothing to judge against and every endpoint is taken as present.
1467
+ * Whether `structure` is on the node as of the last structural apply; see {@link #findEndpointsOnTheNode}. Until
1468
+ * the root has reported a list there is nothing to judge against and every endpoint is taken as present.
1494
1469
  */
1495
1470
  #isOnTheNode(structure: EndpointStructure) {
1496
- if (structure.endpoint.maybeNumber === 0) {
1497
- return true;
1471
+ const number = structure.endpoint.maybeNumber;
1472
+ return number === undefined || this.#isNumberOnTheNode(number);
1473
+ }
1474
+
1475
+ #isNumberOnTheNode(number: EndpointNumber) {
1476
+ return (
1477
+ number === ROOT_ENDPOINT_NUMBER ||
1478
+ this.#endpointsOnTheNode === undefined ||
1479
+ this.#endpointsOnTheNode.has(number)
1480
+ );
1481
+ }
1482
+
1483
+ /**
1484
+ * The endpoints on the node other than the root, or `undefined` while the root has not reported its `PartsList`.
1485
+ *
1486
+ * A `PartsList` names only endpoints that exist (Matter Core § 9.2.7.3), and the root's names every endpoint on the
1487
+ * node (§ 9.2.8). Some peers name only part of their endpoints there. An endpoint that the `PartsList` of an
1488
+ * endpoint on the node names is on the node too, once the peer has reported its DeviceTypeList or PartsList; until
1489
+ * then the entry may name an endpoint that does not exist.
1490
+ */
1491
+ #findEndpointsOnTheNode() {
1492
+ const rootParts = this.#rootPartsList();
1493
+ if (rootParts === undefined) {
1494
+ return undefined;
1495
+ }
1496
+
1497
+ const found = new Set(rootParts);
1498
+ const pending = [...found];
1499
+ for (let number = pending.pop(); number !== undefined; number = pending.pop()) {
1500
+ const structure = this.#endpoints.get(number);
1501
+ const named = structure === undefined ? undefined : this.#partsListOf.get(structure);
1502
+ for (const part of named ?? []) {
1503
+ if (found.has(part) || !this.#hasReportedDescriptorList(part)) {
1504
+ continue;
1505
+ }
1506
+ found.add(part);
1507
+ pending.push(part);
1508
+ }
1498
1509
  }
1510
+ return found;
1511
+ }
1512
+
1513
+ #hasReportedDescriptorList(number: EndpointNumber) {
1514
+ return !!this.#endpoints.get(number)?.reportedLists?.size;
1515
+ }
1499
1516
 
1517
+ #rootPartsList() {
1500
1518
  const root = this.#endpoints.get(ROOT_ENDPOINT_NUMBER);
1501
- const rootParts = root === undefined ? undefined : this.#partsListOf.get(root);
1502
- return rootParts === undefined || rootParts.has(structure.endpoint.number);
1519
+ return root === undefined ? undefined : this.#partsListOf.get(root);
1520
+ }
1521
+
1522
+ /**
1523
+ * Schedule the erase of every placed endpoint that left the node since `previous`.
1524
+ *
1525
+ * Only an endpoint the peer had on the node is erased, so an endpoint the peer never named stays, such as one
1526
+ * added locally. An endpoint that holds an endpoint still on the node is kept, because erasing it would close that
1527
+ * endpoint too; it is checked again on every apply.
1528
+ */
1529
+ #eraseEndpointsOffTheNode(previous: Set<EndpointNumber>, current: Set<EndpointNumber>) {
1530
+ const candidates = new Set([...previous, ...this.#keptOffTheNode]);
1531
+ for (const number of candidates) {
1532
+ const structure = this.#endpoints.get(number);
1533
+ if (current.has(number) || structure === undefined || !this.#isPlaced(structure)) {
1534
+ this.#keptOffTheNode.delete(number);
1535
+ continue;
1536
+ }
1537
+
1538
+ const { endpoint } = structure;
1539
+ const held = new Array<Endpoint>();
1540
+ endpoint.visit(below => {
1541
+ if (below !== endpoint && below.maybeNumber !== undefined && current.has(below.number)) {
1542
+ held.push(below);
1543
+ }
1544
+ });
1545
+ if (!held.length) {
1546
+ this.#keptOffTheNode.delete(number);
1547
+ this.#scheduleStructureChange(structure, "erase");
1548
+ continue;
1549
+ }
1550
+
1551
+ const message = [
1552
+ `Keeping ${endpoint} although it is no longer on the node:`,
1553
+ `it holds ${held.join(", ")}, which are on the node`,
1554
+ ];
1555
+ if (this.#keptOffTheNode.has(number)) {
1556
+ logger.debug(...message);
1557
+ } else {
1558
+ logger.warn(...message);
1559
+ this.#keptOffTheNode.add(number);
1560
+ }
1561
+ }
1562
+ }
1563
+
1564
+ /** Warn once per node when the root's `PartsList` does not name every endpoint on the node. */
1565
+ #checkRootPartsList() {
1566
+ const rootParts = this.#rootPartsList();
1567
+ if (this.#warnedIncompleteRootPartsList || rootParts === undefined || this.#endpointsOnTheNode === undefined) {
1568
+ return;
1569
+ }
1570
+
1571
+ const unnamed = [...this.#endpointsOnTheNode].filter(number => !rootParts.has(number)).sort((a, b) => a - b);
1572
+ if (!unnamed.length) {
1573
+ return;
1574
+ }
1575
+
1576
+ this.#warnedIncompleteRootPartsList = true;
1577
+ logger.warn(
1578
+ `Peer ${this.#node} does not name endpoints ${unnamed.join(", ")} in the PartsList of its root endpoint,`,
1579
+ "although Matter requires the root to list every endpoint; other endpoints name them, so they are on the node",
1580
+ );
1503
1581
  }
1504
1582
 
1505
1583
  /**
@@ -1510,9 +1588,8 @@ export class ClientStructure {
1510
1588
  const ordinary = new Array<EndpointStructure>();
1511
1589
  const fullFamily = new Array<EndpointStructure>();
1512
1590
  for (const claimant of claimants) {
1513
- // An endpoint the root does not name is not on the node, so it owns nothing. It would
1514
- // otherwise take parts the root does name and hold them below itself, where nothing
1515
- // installs them.
1591
+ // An endpoint not on the node owns nothing. It would otherwise take parts that are on the
1592
+ // node and hold them below itself, where nothing installs them.
1516
1593
  if (!this.#isOnTheNode(claimant)) {
1517
1594
  continue;
1518
1595
  }
@@ -1520,7 +1597,7 @@ export class ClientStructure {
1520
1597
  // What a list means depends on how its endpoint composes one, so a claimant that has not
1521
1598
  // said cannot be weighed against the others yet. Deciding without it would place the part
1522
1599
  // under a parent that a later report cannot correct.
1523
- if (!this.#composition.has(claimant)) {
1600
+ if (this.#compositionOf(claimant) === undefined) {
1524
1601
  return undefined;
1525
1602
  }
1526
1603
 
@@ -1581,14 +1658,12 @@ export class ClientStructure {
1581
1658
 
1582
1659
  /**
1583
1660
  * Whether every endpoint `structure` names has reported a `PartsList` of its own, which is what
1584
- * makes the parts it names and nobody else's its own children. An endpoint the root no longer
1585
- * names reports nothing more, so it is not waited for.
1661
+ * makes the parts it names and nobody else's its own children. An endpoint that is not on the
1662
+ * node reports nothing more, so it is not waited for.
1586
1663
  */
1587
1664
  #partsAccountedFor(structure: EndpointStructure) {
1588
- const root = this.#endpoints.get(ROOT_ENDPOINT_NUMBER);
1589
- const rootParts = root === undefined ? undefined : this.#partsListOf.get(root);
1590
1665
  for (const partNo of this.#partsListOf.get(structure) ?? []) {
1591
- if (rootParts !== undefined && !rootParts.has(partNo)) {
1666
+ if (!this.#isNumberOnTheNode(partNo)) {
1592
1667
  continue;
1593
1668
  }
1594
1669
 
@@ -1600,36 +1675,6 @@ export class ClientStructure {
1600
1675
  return true;
1601
1676
  }
1602
1677
 
1603
- /**
1604
- * Withdraw `structure`'s claim on the parts its previous `PartsList` named and `named` does not.
1605
- *
1606
- * A claim that outlives the list it came from would let an endpoint the peer has dropped be
1607
- * installed later, once the claim became decidable — the peer's current lists are the only
1608
- * statement of what it has.
1609
- */
1610
- #retractClaimsOf(structure: EndpointStructure, named: Set<EndpointNumber>) {
1611
- for (const partNo of this.#partsListOf.get(structure) ?? []) {
1612
- if (named.has(partNo)) {
1613
- continue;
1614
- }
1615
-
1616
- const part = this.#endpoints.get(partNo);
1617
- if (part === undefined) {
1618
- continue;
1619
- }
1620
-
1621
- const claimants = this.#partClaims.get(part);
1622
- if (claimants === undefined) {
1623
- continue;
1624
- }
1625
-
1626
- claimants.delete(structure);
1627
- if (claimants.size === 0) {
1628
- this.#partClaims.delete(part);
1629
- }
1630
- }
1631
- }
1632
-
1633
1678
  /**
1634
1679
  * Record how `structure` composes its `PartsList`, from every device type it reports.
1635
1680
  *
@@ -1661,9 +1706,37 @@ export class ClientStructure {
1661
1706
  }
1662
1707
  }
1663
1708
 
1709
+ /**
1710
+ * How `structure` composes its `PartsList`, or `undefined` while it has not said.
1711
+ *
1712
+ * The root's `PartsList` lists every endpoint on the node (Matter Core § 9.2.8), so its composition is known
1713
+ * whatever device types it reports.
1714
+ */
1715
+ #compositionOf(structure: EndpointStructure) {
1716
+ if (structure.endpoint.maybeNumber === 0) {
1717
+ return EndpointComposition.FullFamily;
1718
+ }
1719
+ return this.#composition.get(structure);
1720
+ }
1721
+
1664
1722
  /** Whether `structure`'s `PartsList` names every descendant rather than its own children. */
1665
1723
  #isFullFamily(structure: EndpointStructure) {
1666
- return this.#composition.get(structure) === EndpointComposition.FullFamily;
1724
+ return this.#compositionOf(structure) === EndpointComposition.FullFamily;
1725
+ }
1726
+
1727
+ /**
1728
+ * Warn once per node when the root reports no device type, although its DeviceTypeList needs at least one entry
1729
+ * (Matter Core § 9.5.6.1). Placing the endpoints does not depend on it; see {@link #compositionOf}.
1730
+ */
1731
+ #checkRootDeviceTypes(deviceTypeList: Descriptor.DeviceType[]) {
1732
+ if (this.#warnedRootWithoutDeviceType || deviceTypeList.some(dt => typeof dt?.deviceType === "number")) {
1733
+ return;
1734
+ }
1735
+ this.#warnedRootWithoutDeviceType = true;
1736
+ logger.warn(
1737
+ `Peer ${this.#node} reports no device type on its root endpoint, although Matter requires at least one;`,
1738
+ "its PartsList is read as listing every endpoint on the node",
1739
+ );
1667
1740
  }
1668
1741
 
1669
1742
  /**
@@ -43,7 +43,6 @@ import {
43
43
  Minutes,
44
44
  Mutex,
45
45
  Observable,
46
- Seconds,
47
46
  Time,
48
47
  Timestamp,
49
48
  UninitializedDependencyError,
@@ -413,8 +412,9 @@ export class Peers extends EndpointContainer<ClientNode> {
413
412
  }
414
413
 
415
414
  /**
416
- * Look up a peer by numeric/string id or {@link PeerAddress}. A {@link PeerAddress} matches the commissioned
417
- * peer whose {@link CommissioningClient} peer address equals it; otherwise the container's id lookup is used.
415
+ * Look up a peer by numeric/string id or {@link PeerAddress}. A {@link PeerAddress} matches the peer whose
416
+ * {@link ClientNode.peerAddress} equals it, also a peer that failed to load; otherwise the container's id lookup is
417
+ * used.
418
418
  *
419
419
  * Look up by {@link PeerAddress} for anything held while a peer is commissioned: a local id may be reissued to a
420
420
  * different device once the peer it named is gone, so the same string can resolve to a peer that never saw the
@@ -426,11 +426,9 @@ export class Peers extends EndpointContainer<ClientNode> {
426
426
  if (typeof id !== "string" && typeof id !== "number") {
427
427
  const address = PeerAddress(id);
428
428
  for (const node of this) {
429
- if (node.behaviors.active.some(behavior => behavior.id === "commissioning")) {
430
- const nodeAddress = node.maybeStateOf("commissioning")?.peerAddress as PeerAddress | undefined;
431
- if (nodeAddress !== undefined && PeerAddress.is(nodeAddress, address)) {
432
- return node;
433
- }
429
+ const nodeAddress = node.peerAddress;
430
+ if (nodeAddress !== undefined && PeerAddress.is(nodeAddress, address)) {
431
+ return node;
434
432
  }
435
433
  }
436
434
  return undefined;
@@ -924,11 +922,9 @@ export class Peers extends EndpointContainer<ClientNode> {
924
922
  return;
925
923
  }
926
924
 
927
- // Use the current session's createdAt as asOf so it (and newer sessions) are preserved
928
- // while older sessions (from before the reboot) are closed. If the currentSession is
929
- // undefined (no known session), handlePeerShutdown uses the current Time.nowUs value as its cutoff.
925
+ // Sessions registered before the current session are treated as from before the restart
930
926
  const sessionManager = this.owner.env.get(SessionManager);
931
- await sessionManager.handlePeerShutdown(peerAddress, sessionManager.maybeSessionFor(peerAddress)?.createdAt);
927
+ await sessionManager.handlePeerShutdown(peerAddress, sessionManager.maybeSessionFor(peerAddress));
932
928
  }
933
929
  }
934
930
 
@@ -995,11 +991,11 @@ class Factory extends ClientNodeFactory {
995
991
  }
996
992
  }
997
993
 
998
- function expirationOf<T extends { discoveredAt?: Timestamp; ttl?: Duration | number }>(
994
+ function expirationOf<T extends { discoveredAt?: Timestamp; ttl?: Duration }>(
999
995
  lifespan: T,
1000
996
  ): T extends { discoveredAt: Timestamp } ? Timestamp : Timestamp | undefined {
1001
997
  if (lifespan.discoveredAt !== undefined) {
1002
- return Timestamp(lifespan.discoveredAt + (Seconds(lifespan.ttl) ?? DEFAULT_TTL));
998
+ return Timestamp(lifespan.discoveredAt + (lifespan.ttl ?? DEFAULT_TTL));
1003
999
  }
1004
1000
  return undefined as unknown as Timestamp;
1005
1001
  }
@@ -273,17 +273,32 @@ export namespace ChangeNotificationService {
273
273
  }
274
274
 
275
275
  /**
276
- * The wire timestamp variant {@link OccurrenceProperties.timestamp} carries. Matter Core §10.7 defines exactly
276
+ * The wire timestamp variant {@link OccurrenceProperties.timestamp} carries. Matter Core §10.6.9 defines exactly
277
277
  * four and an event sets exactly one: an absolute time against the Posix epoch or against device system (uptime)
278
- * time, or, on either clock, a delta from the preceding event of the same priority. A consumer forwarding the
279
- * occurrence must not guess which, as neither the clock nor absolute-vs-delta is recoverable from the value.
278
+ * time, or, on either clock, a delta from the prior event (§10.7.3.1). A consumer forwarding the occurrence must
279
+ * not guess which, as neither the clock nor absolute-vs-delta is recoverable from the value.
280
280
  */
281
281
  export type TimestampKind = "epoch" | "system" | "epoch-delta" | "system-delta";
282
282
 
283
283
  export interface OccurrenceProperties {
284
284
  number: EventNumber;
285
+
286
+ /**
287
+ * The timestamp as the peer sent it, or the local epoch time for an event of this node. For a delta
288
+ * {@link timestampKind} this is the delta; use {@link resolvedTimestamp} for the absolute time.
289
+ */
285
290
  timestamp: Timestamp;
291
+
286
292
  timestampKind: TimestampKind;
293
+
294
+ /**
295
+ * Absolute time of the occurrence in milliseconds, on the clock {@link timestampKind} names: Posix epoch for
296
+ * `"epoch"` and `"epoch-delta"`, device system time for `"system"` and `"system-delta"`. Undefined when the
297
+ * absolute time cannot be determined, see `ReadResult.EventValue.resolvedTimestamp` in
298
+ * `@matter/protocol`.
299
+ */
300
+ resolvedTimestamp?: number;
301
+
287
302
  priority: Priority;
288
303
  payload?: Val.Struct;
289
304
  }