@matter/protocol 0.15.1 → 0.15.2-alpha.0-20250704-2715344f0

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 (349) hide show
  1. package/dist/cjs/action/Val.d.ts +4 -0
  2. package/dist/cjs/action/Val.d.ts.map +1 -1
  3. package/dist/cjs/action/Val.js.map +1 -1
  4. package/dist/cjs/action/client/ClientInteraction.d.ts +10 -8
  5. package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
  6. package/dist/cjs/action/client/ClientInteraction.js +152 -80
  7. package/dist/cjs/action/client/ClientInteraction.js.map +1 -1
  8. package/dist/cjs/action/client/ClientSubscription.d.ts +17 -0
  9. package/dist/cjs/action/client/ClientSubscription.d.ts.map +1 -0
  10. package/dist/cjs/action/client/ClientSubscription.js +22 -0
  11. package/dist/cjs/action/client/ClientSubscription.js.map +6 -0
  12. package/dist/cjs/action/client/ClientSubscriptionHandler.d.ts +20 -0
  13. package/dist/cjs/action/client/ClientSubscriptionHandler.d.ts.map +1 -0
  14. package/dist/cjs/action/client/ClientSubscriptionHandler.js +117 -0
  15. package/dist/cjs/action/client/ClientSubscriptionHandler.js.map +6 -0
  16. package/dist/cjs/action/client/ClientSubscriptions.d.ts +45 -0
  17. package/dist/cjs/action/client/ClientSubscriptions.d.ts.map +1 -0
  18. package/dist/cjs/action/client/ClientSubscriptions.js +141 -0
  19. package/dist/cjs/action/client/ClientSubscriptions.js.map +6 -0
  20. package/dist/cjs/action/client/InputChunk.d.ts +12 -0
  21. package/dist/cjs/action/client/InputChunk.d.ts.map +1 -0
  22. package/dist/cjs/action/client/InputChunk.js +89 -0
  23. package/dist/cjs/action/client/InputChunk.js.map +6 -0
  24. package/dist/cjs/action/client/ReadScope.d.ts +26 -0
  25. package/dist/cjs/action/client/ReadScope.d.ts.map +1 -0
  26. package/dist/cjs/action/client/ReadScope.js +87 -0
  27. package/dist/cjs/action/client/ReadScope.js.map +6 -0
  28. package/dist/cjs/action/client/index.d.ts +5 -0
  29. package/dist/cjs/action/client/index.d.ts.map +1 -1
  30. package/dist/cjs/action/client/index.js +5 -0
  31. package/dist/cjs/action/client/index.js.map +1 -1
  32. package/dist/cjs/action/request/Invoke.d.ts.map +1 -1
  33. package/dist/cjs/action/request/Invoke.js +8 -2
  34. package/dist/cjs/action/request/Invoke.js.map +1 -1
  35. package/dist/cjs/action/request/Read.d.ts +0 -4
  36. package/dist/cjs/action/request/Read.d.ts.map +1 -1
  37. package/dist/cjs/action/request/Read.js.map +1 -1
  38. package/dist/cjs/action/request/Subscribe.d.ts +14 -1
  39. package/dist/cjs/action/request/Subscribe.d.ts.map +1 -1
  40. package/dist/cjs/action/request/Subscribe.js +2 -2
  41. package/dist/cjs/action/request/Subscribe.js.map +1 -1
  42. package/dist/cjs/action/response/SubscribeResult.d.ts +3 -5
  43. package/dist/cjs/action/response/SubscribeResult.d.ts.map +1 -1
  44. package/dist/cjs/action/server/AttributeReadResponse.d.ts +1 -1
  45. package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
  46. package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts +1 -1
  47. package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts.map +1 -1
  48. package/dist/cjs/action/server/AttributeSubscriptionResponse.js.map +1 -1
  49. package/dist/cjs/action/server/CommandInvokeResponse.d.ts +2 -1
  50. package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -1
  51. package/dist/cjs/action/server/CommandInvokeResponse.js +3 -3
  52. package/dist/cjs/action/server/CommandInvokeResponse.js.map +1 -1
  53. package/dist/cjs/action/server/EventReadResponse.d.ts +1 -1
  54. package/dist/cjs/action/server/EventReadResponse.d.ts.map +1 -1
  55. package/dist/cjs/codec/MessageCodec.d.ts +1 -1
  56. package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
  57. package/dist/cjs/common/FailsafeContext.d.ts.map +1 -1
  58. package/dist/cjs/common/FailsafeContext.js +0 -1
  59. package/dist/cjs/common/FailsafeContext.js.map +1 -1
  60. package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
  61. package/dist/cjs/fabric/Fabric.js +13 -10
  62. package/dist/cjs/fabric/Fabric.js.map +1 -1
  63. package/dist/cjs/fabric/FabricAuthority.d.ts +6 -1
  64. package/dist/cjs/fabric/FabricAuthority.d.ts.map +1 -1
  65. package/dist/cjs/fabric/FabricAuthority.js +16 -0
  66. package/dist/cjs/fabric/FabricAuthority.js.map +1 -1
  67. package/dist/cjs/groups/FabricGroups.d.ts +1 -1
  68. package/dist/cjs/groups/FabricGroups.d.ts.map +1 -1
  69. package/dist/cjs/groups/Groups.d.ts +2 -2
  70. package/dist/cjs/groups/Groups.d.ts.map +1 -1
  71. package/dist/cjs/groups/Groups.js +2 -2
  72. package/dist/cjs/groups/Groups.js.map +1 -1
  73. package/dist/cjs/interaction/AttributeDataEncoder.d.ts +1 -1
  74. package/dist/cjs/interaction/FabricAccessControl.d.ts +1 -1
  75. package/dist/cjs/interaction/FabricAccessControl.d.ts.map +1 -1
  76. package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
  77. package/dist/cjs/interaction/InteractionClient.js +8 -4
  78. package/dist/cjs/interaction/InteractionClient.js.map +1 -1
  79. package/dist/cjs/interaction/InteractionMessenger.d.ts +21 -17
  80. package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
  81. package/dist/cjs/interaction/InteractionMessenger.js +20 -12
  82. package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
  83. package/dist/cjs/mdns/MdnsScanner.d.ts +5 -6
  84. package/dist/cjs/mdns/MdnsScanner.d.ts.map +1 -1
  85. package/dist/cjs/mdns/MdnsScanner.js.map +1 -1
  86. package/dist/cjs/peer/ControllerCommissioner.js +4 -4
  87. package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
  88. package/dist/cjs/peer/ControllerCommissioningFlow.js +2 -2
  89. package/dist/cjs/peer/ControllerCommissioningFlow.js.map +1 -1
  90. package/dist/cjs/peer/OperationalPeer.d.ts +1 -1
  91. package/dist/cjs/peer/OperationalPeer.d.ts.map +1 -1
  92. package/dist/cjs/peer/PeerAddress.d.ts.map +1 -1
  93. package/dist/cjs/peer/PeerAddress.js +1 -1
  94. package/dist/cjs/peer/PeerAddress.js.map +1 -1
  95. package/dist/cjs/peer/PeerAddressStore.d.ts +1 -1
  96. package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -1
  97. package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
  98. package/dist/cjs/peer/PeerSet.js +5 -5
  99. package/dist/cjs/peer/PeerSet.js.map +1 -1
  100. package/dist/cjs/protocol/ChannelManager.d.ts +1 -3
  101. package/dist/cjs/protocol/ChannelManager.d.ts.map +1 -1
  102. package/dist/cjs/protocol/ChannelManager.js +3 -6
  103. package/dist/cjs/protocol/ChannelManager.js.map +1 -1
  104. package/dist/cjs/protocol/DeviceCommissioner.d.ts +3 -2
  105. package/dist/cjs/protocol/DeviceCommissioner.d.ts.map +1 -1
  106. package/dist/cjs/protocol/DeviceCommissioner.js +6 -8
  107. package/dist/cjs/protocol/DeviceCommissioner.js.map +1 -1
  108. package/dist/cjs/protocol/ExchangeManager.d.ts +1 -3
  109. package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
  110. package/dist/cjs/protocol/ExchangeManager.js +7 -9
  111. package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
  112. package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
  113. package/dist/cjs/protocol/ExchangeProvider.js +7 -8
  114. package/dist/cjs/protocol/ExchangeProvider.js.map +1 -1
  115. package/dist/cjs/protocol/MessageChannel.d.ts +17 -4
  116. package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
  117. package/dist/cjs/protocol/MessageChannel.js +15 -6
  118. package/dist/cjs/protocol/MessageChannel.js.map +1 -1
  119. package/dist/cjs/protocol/MessageExchange.d.ts +0 -6
  120. package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
  121. package/dist/cjs/protocol/MessageExchange.js +5 -9
  122. package/dist/cjs/protocol/MessageExchange.js.map +1 -1
  123. package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +3 -0
  124. package/dist/cjs/securechannel/SecureChannelMessenger.d.ts.map +1 -1
  125. package/dist/cjs/securechannel/SecureChannelMessenger.js +4 -0
  126. package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
  127. package/dist/cjs/securechannel/SecureChannelProtocol.d.ts +0 -1
  128. package/dist/cjs/securechannel/SecureChannelProtocol.d.ts.map +1 -1
  129. package/dist/cjs/securechannel/SecureChannelProtocol.js +0 -3
  130. package/dist/cjs/securechannel/SecureChannelProtocol.js.map +1 -1
  131. package/dist/cjs/session/GroupSession.d.ts +1 -1
  132. package/dist/cjs/session/GroupSession.d.ts.map +1 -1
  133. package/dist/cjs/session/GroupSession.js +6 -6
  134. package/dist/cjs/session/GroupSession.js.map +1 -1
  135. package/dist/cjs/session/InsecureSession.d.ts +2 -1
  136. package/dist/cjs/session/InsecureSession.d.ts.map +1 -1
  137. package/dist/cjs/session/InsecureSession.js +5 -4
  138. package/dist/cjs/session/InsecureSession.js.map +1 -1
  139. package/dist/cjs/session/NodeSession.d.ts +5 -3
  140. package/dist/cjs/session/NodeSession.d.ts.map +1 -1
  141. package/dist/cjs/session/NodeSession.js +4 -2
  142. package/dist/cjs/session/NodeSession.js.map +1 -1
  143. package/dist/cjs/session/SessionManager.d.ts +2 -3
  144. package/dist/cjs/session/SessionManager.d.ts.map +1 -1
  145. package/dist/cjs/session/SessionManager.js +1 -3
  146. package/dist/cjs/session/SessionManager.js.map +1 -1
  147. package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
  148. package/dist/cjs/session/case/CaseClient.js +6 -5
  149. package/dist/cjs/session/case/CaseClient.js.map +1 -1
  150. package/dist/cjs/session/case/CaseServer.js +2 -2
  151. package/dist/cjs/session/case/CaseServer.js.map +1 -1
  152. package/dist/cjs/session/pase/PaseMessages.js +2 -2
  153. package/dist/cjs/session/pase/PaseMessages.js.map +1 -1
  154. package/dist/esm/action/Val.d.ts +4 -0
  155. package/dist/esm/action/Val.d.ts.map +1 -1
  156. package/dist/esm/action/Val.js.map +1 -1
  157. package/dist/esm/action/client/ClientInteraction.d.ts +10 -8
  158. package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
  159. package/dist/esm/action/client/ClientInteraction.js +154 -82
  160. package/dist/esm/action/client/ClientInteraction.js.map +1 -1
  161. package/dist/esm/action/client/ClientSubscription.d.ts +17 -0
  162. package/dist/esm/action/client/ClientSubscription.d.ts.map +1 -0
  163. package/dist/esm/action/client/ClientSubscription.js +6 -0
  164. package/dist/esm/action/client/ClientSubscription.js.map +6 -0
  165. package/dist/esm/action/client/ClientSubscriptionHandler.d.ts +20 -0
  166. package/dist/esm/action/client/ClientSubscriptionHandler.d.ts.map +1 -0
  167. package/dist/esm/action/client/ClientSubscriptionHandler.js +97 -0
  168. package/dist/esm/action/client/ClientSubscriptionHandler.js.map +6 -0
  169. package/dist/esm/action/client/ClientSubscriptions.d.ts +45 -0
  170. package/dist/esm/action/client/ClientSubscriptions.d.ts.map +1 -0
  171. package/dist/esm/action/client/ClientSubscriptions.js +129 -0
  172. package/dist/esm/action/client/ClientSubscriptions.js.map +6 -0
  173. package/dist/esm/action/client/InputChunk.d.ts +12 -0
  174. package/dist/esm/action/client/InputChunk.d.ts.map +1 -0
  175. package/dist/esm/action/client/InputChunk.js +69 -0
  176. package/dist/esm/action/client/InputChunk.js.map +6 -0
  177. package/dist/esm/action/client/ReadScope.d.ts +26 -0
  178. package/dist/esm/action/client/ReadScope.d.ts.map +1 -0
  179. package/dist/esm/action/client/ReadScope.js +67 -0
  180. package/dist/esm/action/client/ReadScope.js.map +6 -0
  181. package/dist/esm/action/client/index.d.ts +5 -0
  182. package/dist/esm/action/client/index.d.ts.map +1 -1
  183. package/dist/esm/action/client/index.js +5 -0
  184. package/dist/esm/action/client/index.js.map +1 -1
  185. package/dist/esm/action/request/Invoke.d.ts.map +1 -1
  186. package/dist/esm/action/request/Invoke.js +8 -2
  187. package/dist/esm/action/request/Invoke.js.map +1 -1
  188. package/dist/esm/action/request/Read.d.ts +0 -4
  189. package/dist/esm/action/request/Read.d.ts.map +1 -1
  190. package/dist/esm/action/request/Read.js.map +1 -1
  191. package/dist/esm/action/request/Subscribe.d.ts +14 -1
  192. package/dist/esm/action/request/Subscribe.d.ts.map +1 -1
  193. package/dist/esm/action/request/Subscribe.js +2 -2
  194. package/dist/esm/action/request/Subscribe.js.map +1 -1
  195. package/dist/esm/action/response/SubscribeResult.d.ts +3 -5
  196. package/dist/esm/action/response/SubscribeResult.d.ts.map +1 -1
  197. package/dist/esm/action/server/AttributeReadResponse.d.ts +1 -1
  198. package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
  199. package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts +1 -1
  200. package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts.map +1 -1
  201. package/dist/esm/action/server/AttributeSubscriptionResponse.js.map +1 -1
  202. package/dist/esm/action/server/CommandInvokeResponse.d.ts +2 -1
  203. package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -1
  204. package/dist/esm/action/server/CommandInvokeResponse.js +1 -1
  205. package/dist/esm/action/server/CommandInvokeResponse.js.map +1 -1
  206. package/dist/esm/action/server/EventReadResponse.d.ts +1 -1
  207. package/dist/esm/action/server/EventReadResponse.d.ts.map +1 -1
  208. package/dist/esm/codec/MessageCodec.d.ts +1 -1
  209. package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
  210. package/dist/esm/common/FailsafeContext.d.ts.map +1 -1
  211. package/dist/esm/common/FailsafeContext.js +0 -1
  212. package/dist/esm/common/FailsafeContext.js.map +1 -1
  213. package/dist/esm/fabric/Fabric.d.ts.map +1 -1
  214. package/dist/esm/fabric/Fabric.js +4 -1
  215. package/dist/esm/fabric/Fabric.js.map +1 -1
  216. package/dist/esm/fabric/FabricAuthority.d.ts +6 -1
  217. package/dist/esm/fabric/FabricAuthority.d.ts.map +1 -1
  218. package/dist/esm/fabric/FabricAuthority.js +25 -1
  219. package/dist/esm/fabric/FabricAuthority.js.map +1 -1
  220. package/dist/esm/groups/FabricGroups.d.ts +1 -1
  221. package/dist/esm/groups/FabricGroups.d.ts.map +1 -1
  222. package/dist/esm/groups/Groups.d.ts +2 -2
  223. package/dist/esm/groups/Groups.d.ts.map +1 -1
  224. package/dist/esm/groups/Groups.js +1 -1
  225. package/dist/esm/groups/Groups.js.map +1 -1
  226. package/dist/esm/interaction/AttributeDataEncoder.d.ts +1 -1
  227. package/dist/esm/interaction/FabricAccessControl.d.ts +1 -1
  228. package/dist/esm/interaction/FabricAccessControl.d.ts.map +1 -1
  229. package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
  230. package/dist/esm/interaction/InteractionClient.js +8 -4
  231. package/dist/esm/interaction/InteractionClient.js.map +1 -1
  232. package/dist/esm/interaction/InteractionMessenger.d.ts +21 -17
  233. package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
  234. package/dist/esm/interaction/InteractionMessenger.js +19 -11
  235. package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
  236. package/dist/esm/mdns/MdnsScanner.d.ts +5 -6
  237. package/dist/esm/mdns/MdnsScanner.d.ts.map +1 -1
  238. package/dist/esm/mdns/MdnsScanner.js.map +1 -1
  239. package/dist/esm/peer/ControllerCommissioner.js +2 -2
  240. package/dist/esm/peer/ControllerCommissioningFlow.js +1 -1
  241. package/dist/esm/peer/OperationalPeer.d.ts +1 -1
  242. package/dist/esm/peer/OperationalPeer.d.ts.map +1 -1
  243. package/dist/esm/peer/PeerAddress.d.ts.map +1 -1
  244. package/dist/esm/peer/PeerAddress.js +2 -2
  245. package/dist/esm/peer/PeerAddress.js.map +1 -1
  246. package/dist/esm/peer/PeerAddressStore.d.ts +1 -1
  247. package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -1
  248. package/dist/esm/peer/PeerSet.d.ts.map +1 -1
  249. package/dist/esm/peer/PeerSet.js +4 -4
  250. package/dist/esm/peer/PeerSet.js.map +1 -1
  251. package/dist/esm/protocol/ChannelManager.d.ts +1 -3
  252. package/dist/esm/protocol/ChannelManager.d.ts.map +1 -1
  253. package/dist/esm/protocol/ChannelManager.js +3 -6
  254. package/dist/esm/protocol/ChannelManager.js.map +1 -1
  255. package/dist/esm/protocol/DeviceCommissioner.d.ts +3 -2
  256. package/dist/esm/protocol/DeviceCommissioner.d.ts.map +1 -1
  257. package/dist/esm/protocol/DeviceCommissioner.js +4 -6
  258. package/dist/esm/protocol/DeviceCommissioner.js.map +1 -1
  259. package/dist/esm/protocol/ExchangeManager.d.ts +1 -3
  260. package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
  261. package/dist/esm/protocol/ExchangeManager.js +8 -7
  262. package/dist/esm/protocol/ExchangeManager.js.map +1 -1
  263. package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
  264. package/dist/esm/protocol/ExchangeProvider.js +4 -2
  265. package/dist/esm/protocol/ExchangeProvider.js.map +1 -1
  266. package/dist/esm/protocol/MessageChannel.d.ts +17 -4
  267. package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
  268. package/dist/esm/protocol/MessageChannel.js +12 -3
  269. package/dist/esm/protocol/MessageChannel.js.map +1 -1
  270. package/dist/esm/protocol/MessageExchange.d.ts +0 -6
  271. package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
  272. package/dist/esm/protocol/MessageExchange.js +7 -7
  273. package/dist/esm/protocol/MessageExchange.js.map +1 -1
  274. package/dist/esm/securechannel/SecureChannelMessenger.d.ts +3 -0
  275. package/dist/esm/securechannel/SecureChannelMessenger.d.ts.map +1 -1
  276. package/dist/esm/securechannel/SecureChannelMessenger.js +4 -0
  277. package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
  278. package/dist/esm/securechannel/SecureChannelProtocol.d.ts +0 -1
  279. package/dist/esm/securechannel/SecureChannelProtocol.d.ts.map +1 -1
  280. package/dist/esm/securechannel/SecureChannelProtocol.js +0 -3
  281. package/dist/esm/securechannel/SecureChannelProtocol.js.map +1 -1
  282. package/dist/esm/session/GroupSession.d.ts +1 -1
  283. package/dist/esm/session/GroupSession.d.ts.map +1 -1
  284. package/dist/esm/session/GroupSession.js +1 -1
  285. package/dist/esm/session/InsecureSession.d.ts +2 -1
  286. package/dist/esm/session/InsecureSession.d.ts.map +1 -1
  287. package/dist/esm/session/InsecureSession.js +3 -2
  288. package/dist/esm/session/InsecureSession.js.map +1 -1
  289. package/dist/esm/session/NodeSession.d.ts +5 -3
  290. package/dist/esm/session/NodeSession.d.ts.map +1 -1
  291. package/dist/esm/session/NodeSession.js +12 -2
  292. package/dist/esm/session/NodeSession.js.map +1 -1
  293. package/dist/esm/session/SessionManager.d.ts +2 -3
  294. package/dist/esm/session/SessionManager.d.ts.map +1 -1
  295. package/dist/esm/session/SessionManager.js +1 -3
  296. package/dist/esm/session/SessionManager.js.map +1 -1
  297. package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
  298. package/dist/esm/session/case/CaseClient.js +3 -2
  299. package/dist/esm/session/case/CaseClient.js.map +1 -1
  300. package/dist/esm/session/case/CaseServer.js +1 -1
  301. package/dist/esm/session/pase/PaseMessages.js +1 -1
  302. package/package.json +6 -6
  303. package/src/action/Val.ts +5 -0
  304. package/src/action/client/ClientInteraction.ts +178 -90
  305. package/src/action/client/ClientSubscription.ts +18 -0
  306. package/src/action/client/ClientSubscriptionHandler.ts +137 -0
  307. package/src/action/client/ClientSubscriptions.ts +172 -0
  308. package/src/action/client/InputChunk.ts +79 -0
  309. package/src/action/client/ReadScope.ts +107 -0
  310. package/src/action/client/index.ts +5 -0
  311. package/src/action/request/Invoke.ts +11 -2
  312. package/src/action/request/Read.ts +0 -5
  313. package/src/action/request/Subscribe.ts +17 -3
  314. package/src/action/response/SubscribeResult.ts +3 -4
  315. package/src/action/server/AttributeReadResponse.ts +1 -1
  316. package/src/action/server/AttributeSubscriptionResponse.ts +2 -1
  317. package/src/action/server/CommandInvokeResponse.ts +4 -2
  318. package/src/action/server/EventReadResponse.ts +2 -2
  319. package/src/codec/MessageCodec.ts +1 -1
  320. package/src/common/FailsafeContext.ts +0 -1
  321. package/src/fabric/Fabric.ts +4 -1
  322. package/src/fabric/FabricAuthority.ts +29 -1
  323. package/src/groups/FabricGroups.ts +1 -1
  324. package/src/groups/Groups.ts +3 -2
  325. package/src/interaction/FabricAccessControl.ts +1 -1
  326. package/src/interaction/InteractionClient.ts +8 -4
  327. package/src/interaction/InteractionMessenger.ts +20 -13
  328. package/src/mdns/MdnsScanner.ts +5 -6
  329. package/src/peer/ControllerCommissioner.ts +2 -2
  330. package/src/peer/ControllerCommissioningFlow.ts +1 -1
  331. package/src/peer/OperationalPeer.ts +1 -1
  332. package/src/peer/PeerAddress.ts +2 -2
  333. package/src/peer/PeerAddressStore.ts +1 -1
  334. package/src/peer/PeerSet.ts +6 -4
  335. package/src/protocol/ChannelManager.ts +2 -4
  336. package/src/protocol/DeviceCommissioner.ts +4 -8
  337. package/src/protocol/ExchangeManager.ts +9 -7
  338. package/src/protocol/ExchangeProvider.ts +7 -3
  339. package/src/protocol/MessageChannel.ts +19 -4
  340. package/src/protocol/MessageExchange.ts +8 -12
  341. package/src/securechannel/SecureChannelMessenger.ts +4 -0
  342. package/src/securechannel/SecureChannelProtocol.ts +0 -4
  343. package/src/session/GroupSession.ts +1 -1
  344. package/src/session/InsecureSession.ts +3 -1
  345. package/src/session/NodeSession.ts +14 -4
  346. package/src/session/SessionManager.ts +1 -3
  347. package/src/session/case/CaseClient.ts +3 -2
  348. package/src/session/case/CaseServer.ts +1 -1
  349. package/src/session/pase/PaseMessages.ts +1 -1
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { ReadResult } from "#action/response/ReadResult.js";
8
+ import { DecodedDataReport } from "#interaction/DecodedDataReport.js";
9
+ import { DataReport, Status, TlvAny } from "#types";
10
+
11
+ /**
12
+ * Converts a {@link DataReport} into a {@link ReadResult.Chunk}.
13
+ */
14
+ export function* InputChunk(input: DataReport): ReadResult.Chunk {
15
+ const report = DecodedDataReport(input);
16
+
17
+ for (const attr of report.attributeReports) {
18
+ yield {
19
+ kind: "attr-value",
20
+ tlv: TlvAny,
21
+ ...attr,
22
+ };
23
+ }
24
+
25
+ if (report.attributeStatus) {
26
+ for (const attr of report.attributeStatus) {
27
+ yield {
28
+ kind: "attr-status",
29
+ path: attr.path,
30
+ status: attr.status ?? Status.Failure, // TODO - attr.status shouldn't be optional?
31
+ clusterStatus: attr.clusterStatus,
32
+ };
33
+ }
34
+ }
35
+
36
+ for (const event of report.eventReports) {
37
+ for (const occurrence of event.events) {
38
+ yield {
39
+ kind: "event-value",
40
+ path: event.path,
41
+ value: occurrence,
42
+ number: occurrence.eventNumber,
43
+ priority: occurrence.priority,
44
+ timestamp: Number(
45
+ // TODO - this may not be useful, need to determine correct form
46
+ occurrence.epochTimestamp ??
47
+ occurrence.systemTimestamp ??
48
+ occurrence.deltaEpochTimestamp ??
49
+ occurrence.deltaSystemTimestamp ??
50
+ 0,
51
+ ),
52
+
53
+ // TODO - temporary, field will be removed
54
+ tlv: TlvAny,
55
+ };
56
+ }
57
+ }
58
+
59
+ if (report.eventStatus) {
60
+ for (const event of report.eventStatus) {
61
+ if (event.status !== undefined) {
62
+ yield {
63
+ kind: "event-status",
64
+ path: event.path,
65
+ status: event.status,
66
+ clusterStatus: event.clusterStatus,
67
+ };
68
+ }
69
+ if (event.clusterStatus !== undefined) {
70
+ yield {
71
+ kind: "event-status",
72
+ path: event.path,
73
+ status: event.status ?? Status.Failure,
74
+ clusterStatus: event.clusterStatus,
75
+ };
76
+ }
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,107 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { Read } from "#action/request/Read.js";
8
+ import { ClusterId, EndpointNumber } from "#types";
9
+
10
+ /**
11
+ * This utility tells you whether a given endpoint/cluster is in scope for a read.
12
+ */
13
+ export interface ReadScope {
14
+ /**
15
+ * Is a cluster included in the read?
16
+ *
17
+ * This is useful to determine if the read should include a version filter.
18
+ */
19
+ isRelevant(endpoint: EndpointNumber, cluster: ClusterId): boolean;
20
+
21
+ /**
22
+ * Are all attributes in a cluster included in a read?
23
+ *
24
+ * This is useful to determine if the cluster's version should be updated in response to a read.
25
+ */
26
+ isWildcard(endpoint: EndpointNumber, cluster: ClusterId): boolean;
27
+ }
28
+
29
+ interface Check {
30
+ (endpoint: EndpointNumber, cluster: ClusterId): boolean;
31
+ }
32
+
33
+ export function ReadScope(read: Read): ReadScope {
34
+ return {
35
+ isRelevant(endpoint, cluster) {
36
+ this.isRelevant = generateScopeTester(read, "any");
37
+ return this.isRelevant(endpoint, cluster);
38
+ },
39
+
40
+ isWildcard(endpoint, cluster) {
41
+ this.isWildcard = generateScopeTester(read, "all");
42
+ return this.isWildcard(endpoint, cluster);
43
+ },
44
+ };
45
+ }
46
+
47
+ function generateScopeTester(read: Read, attrRequirement: "any" | "all"): Check {
48
+ if (!read.attributeRequests?.length) {
49
+ return isNever;
50
+ }
51
+
52
+ let wildcardEndpointClusters: undefined | Set<ClusterId>;
53
+ let specificEndpointClusters: undefined | Record<EndpointNumber, true | Set<ClusterId>>;
54
+
55
+ for (const { endpointId, clusterId, attributeId } of read.attributeRequests) {
56
+ // Ignore path if it addresses a specific attribute and we are only interested in wildcard attributes
57
+ if (attributeId !== undefined && attrRequirement === "all") {
58
+ continue;
59
+ }
60
+
61
+ // Wildcard endpoint
62
+ if (endpointId === undefined) {
63
+ // Full wildcard read; short-circuit all subsequent logic
64
+ if (clusterId === undefined) {
65
+ return isAlways;
66
+ }
67
+
68
+ // Wildcard cluster across all endpoints
69
+ (wildcardEndpointClusters ??= new Set()).add(clusterId);
70
+ continue;
71
+ }
72
+
73
+ // Specific endpoint with wildcard cluster cases
74
+ if (clusterId === undefined) {
75
+ (specificEndpointClusters ??= {})[endpointId] = true;
76
+ continue;
77
+ }
78
+
79
+ // Specific endpoint and cluster
80
+ if (attributeId === undefined) {
81
+ let ep = specificEndpointClusters?.[endpointId];
82
+ if (ep === true) {
83
+ continue;
84
+ }
85
+ if (ep === undefined) {
86
+ ep = (specificEndpointClusters ??= {})[endpointId] = new Set();
87
+ }
88
+ ep.add(clusterId);
89
+ }
90
+ }
91
+
92
+ return (endpoint, cluster) => {
93
+ if (wildcardEndpointClusters?.has(cluster)) {
94
+ return true;
95
+ }
96
+ const ep = specificEndpointClusters?.[endpoint];
97
+ return ep === true || !!ep?.has(cluster);
98
+ };
99
+ }
100
+
101
+ function isNever() {
102
+ return false;
103
+ }
104
+
105
+ function isAlways() {
106
+ return true;
107
+ }
@@ -5,3 +5,8 @@
5
5
  */
6
6
 
7
7
  export * from "./ClientInteraction.js";
8
+ export * from "./ClientSubscription.js";
9
+ export * from "./ClientSubscriptionHandler.js";
10
+ export * from "./ClientSubscriptions.js";
11
+ export * from "./InputChunk.js";
12
+ export * from "./ReadScope.js";
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  import { FALLBACK_INTERACTIONMODEL_REVISION } from "#session/Session.js";
8
- import { ClusterType, CommandData, InvokeRequest, TlvSchema, TypeFromSchema } from "#types";
8
+ import { ClusterType, CommandData, InvokeRequest, TlvSchema, TlvStream, TypeFromSchema } from "#types";
9
9
  import { MalformedRequestError } from "./MalformedRequestError.js";
10
10
  import { Specifier } from "./Specifier.js";
11
11
 
@@ -72,11 +72,20 @@ export namespace Invoke {
72
72
  }
73
73
 
74
74
  export function Command<const C extends ClusterType>(request: Invoke.CommandRequest<C>): CommandData {
75
+ const command = Invoke.commandOf(request);
76
+
77
+ let commandFields: TlvStream | undefined;
78
+
79
+ if ("fields" in request) {
80
+ commandFields = command.requestSchema.encodeTlv(request.fields, { forWriteInteraction: true });
81
+ }
82
+
75
83
  const result: CommandData = {
76
84
  commandPath: {
77
85
  clusterId: Specifier.clusterFor(request.cluster).id,
78
- commandId: Invoke.commandOf(request).requestId,
86
+ commandId: command.requestId,
79
87
  },
88
+ commandFields,
80
89
  };
81
90
 
82
91
  const endpointId = Specifier.endpointIdOf(request);
@@ -23,11 +23,6 @@ import { Specifier } from "./Specifier.js";
23
23
  */
24
24
  export interface Read extends ReadRequest {}
25
25
 
26
- /**
27
- * Formulate a read request using Matter numeric IDs.
28
- */
29
- export function Read(options: Read.Options): Read;
30
-
31
26
  /**
32
27
  * Formulate a read request with extended options and name-based IDs.
33
28
  */
@@ -4,7 +4,8 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { UINT16_MAX } from "#general";
7
+ import type { ReadResult } from "#action/response/ReadResult.js";
8
+ import { CanceledError, TimeoutError, UINT16_MAX } from "#general";
8
9
  import { MalformedRequestError } from "./MalformedRequestError.js";
9
10
  import { Read } from "./Read.js";
10
11
 
@@ -18,10 +19,21 @@ export interface Subscribe extends Read {
18
19
  keepSubscriptions: boolean;
19
20
  minIntervalFloorSeconds?: number;
20
21
  maxIntervalCeilingSeconds?: number;
22
+ maxPeerResponseTime?: number;
23
+
24
+ /**
25
+ * Invoked when subscribed data changes.
26
+ */
27
+ updated?: (data: ReadResult) => Promise<void>;
28
+
29
+ /**
30
+ * Invoked when the subscription is no longer active.
31
+ */
32
+ closed?: (cause: CanceledError | TimeoutError) => void;
21
33
  }
22
34
 
23
- export function Subscribe(options: Subscribe.Options): Subscribe {
24
- const subscribe = Read(options) as unknown as Subscribe;
35
+ export function Subscribe(options: Subscribe.Options, ...selectors: Read.Selector[]): Subscribe {
36
+ const subscribe = Read(options, ...selectors) as unknown as Subscribe;
25
37
 
26
38
  const { keepSubscriptions, minIntervalFloorSeconds, maxIntervalCeilingSeconds } = options;
27
39
  subscribe.keepSubscriptions = keepSubscriptions ?? true;
@@ -48,6 +60,8 @@ export namespace Subscribe {
48
60
  keepSubscriptions?: boolean;
49
61
  minIntervalFloorSeconds?: number;
50
62
  maxIntervalCeilingSeconds?: number;
63
+ update?: Subscribe["updated"];
64
+ closed?: Subscribe["closed"];
51
65
  }
52
66
  }
53
67
 
@@ -5,10 +5,9 @@
5
5
  */
6
6
 
7
7
  import { SubscribeResponse } from "#types";
8
- import { ReadResult } from "./ReadResult.js";
9
8
 
10
- export interface SubscribeResult extends AsyncIterator<SubscribeResult.Chunk> {}
9
+ export type SubscribeResult = Promise<ActiveSubscription>;
11
10
 
12
- export namespace SubscribeResult {
13
- export type Chunk = ReadResult.Chunk | SubscribeResponse;
11
+ export interface ActiveSubscription extends SubscribeResponse {
12
+ close(): void;
14
13
  }
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { InteractionSession } from "#action/index.js";
7
+ import { InteractionSession } from "#action/Interactable.js";
8
8
  import { AttributeTypeProtocol, ClusterProtocol, EndpointProtocol, NodeProtocol } from "#action/protocols.js";
9
9
  import { Read } from "#action/request/Read.js";
10
10
  import { ReadResult } from "#action/response/ReadResult.js";
@@ -3,7 +3,8 @@
3
3
  * Copyright 2022-2025 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { InteractionSession } from "#action/index.js";
6
+
7
+ import { InteractionSession } from "#action/Interactable.js";
7
8
  import { AttributeTypeProtocol, ClusterProtocol, EndpointProtocol, NodeProtocol } from "#action/protocols.js";
8
9
  import { ReadResult } from "#action/response/ReadResult.js";
9
10
  import { InternalError } from "#general";
@@ -4,9 +4,10 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { CommandInvokeHandler, Invoke, InvokeResult, Subject } from "#action/index.js";
8
7
  import { InteractionSession } from "#action/Interactable.js";
9
- import { CommandTypeProtocol, EndpointProtocol, NodeProtocol } from "#action/protocols.js";
8
+ import { CommandInvokeHandler, CommandTypeProtocol, EndpointProtocol, NodeProtocol } from "#action/protocols.js";
9
+ import { Invoke } from "#action/request/Invoke.js";
10
+ import { InvokeResult } from "#action/response/InvokeResult.js";
10
11
  import { AccessControl } from "#action/server/AccessControl.js";
11
12
  import { DataResponse, FallbackLimits } from "#action/server/DataResponse.js";
12
13
  import { Diagnostic, InternalError, Logger } from "#general";
@@ -22,6 +23,7 @@ import {
22
23
  TlvStream,
23
24
  ValidationError,
24
25
  } from "#types";
26
+ import { Subject } from "./Subject.js";
25
27
 
26
28
  const logger = Logger.get("CommandInvokeResponse");
27
29
 
@@ -4,13 +4,13 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { InteractionSession } from "#action/index.js";
7
+ import { InteractionSession } from "#action/Interactable.js";
8
8
  import { ClusterProtocol, EndpointProtocol, EventTypeProtocol, NodeProtocol } from "#action/protocols.js";
9
9
  import { Read } from "#action/request/Read.js";
10
10
  import { ReadResult } from "#action/response/ReadResult.js";
11
11
  import { AccessControl } from "#action/server/AccessControl.js";
12
12
  import { DataResponse, FallbackLimits } from "#action/server/DataResponse.js";
13
- import { NumberedOccurrence } from "#events/index.js";
13
+ import { NumberedOccurrence } from "#events/Occurrence.js";
14
14
  import { InternalError, isObject, Logger } from "#general";
15
15
  import { DataModelPath, ElementTag, EventModel } from "#model";
16
16
  import {
@@ -14,7 +14,7 @@ import {
14
14
  NotImplementedError,
15
15
  UnexpectedDataError,
16
16
  } from "#general";
17
- import { ExchangeLogContext } from "#protocol/index.js";
17
+ import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
18
18
  import { GroupId, INTERACTION_PROTOCOL_ID, NodeId, SECURE_CHANNEL_PROTOCOL_ID, SecureMessageType } from "#types";
19
19
  import { MessageType } from "../interaction/InteractionMessenger.js";
20
20
 
@@ -183,7 +183,6 @@ export abstract class FailsafeContext {
183
183
  }
184
184
 
185
185
  async close() {
186
- await this.#construction;
187
186
  await this.#construction.close(async () => {
188
187
  if (this.#failsafe) {
189
188
  await this.#failsafe.close();
@@ -4,7 +4,10 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { Icac, Noc, Rcac, X509Base } from "#certificate/index.js";
7
+ import { Icac } from "#certificate/kinds/Icac.js";
8
+ import { Noc } from "#certificate/kinds/Noc.js";
9
+ import { Rcac } from "#certificate/kinds/Rcac.js";
10
+ import { X509Base } from "#certificate/kinds/X509Base.js";
8
11
  import {
9
12
  BinaryKeyPair,
10
13
  Bytes,
@@ -5,7 +5,16 @@
5
5
  */
6
6
 
7
7
  import { CertificateAuthority } from "#certificate/CertificateAuthority.js";
8
- import { Bytes, CRYPTO_SYMMETRIC_KEY_LENGTH, Environment, Environmental, ImplementationError, Logger } from "#general";
8
+ import {
9
+ Bytes,
10
+ Construction,
11
+ CRYPTO_SYMMETRIC_KEY_LENGTH,
12
+ Environment,
13
+ Environmental,
14
+ ImplementationError,
15
+ Logger,
16
+ Observable,
17
+ } from "#general";
9
18
  import { CaseAuthenticatedTag, FabricId, FabricIndex, NodeId, VendorId } from "#types";
10
19
  import { Fabric, FabricBuilder } from "./Fabric.js";
11
20
  import { FabricManager } from "./FabricManager.js";
@@ -48,14 +57,25 @@ export const DEFAULT_FABRIC_ID = FabricId(1);
48
57
  * Manages fabrics controlled locally associated with a specific CA.
49
58
  */
50
59
  export class FabricAuthority {
60
+ #construction: Construction<FabricAuthority>;
51
61
  #ca: CertificateAuthority;
52
62
  #fabrics: FabricManager;
53
63
  #config: FabricAuthorityConfiguration;
64
+ #fabricAdded = new Observable<[Fabric]>();
54
65
 
55
66
  constructor({ ca, fabrics, config }: FabricAuthorityContext) {
56
67
  this.#ca = ca;
57
68
  this.#fabrics = fabrics;
58
69
  this.#config = config;
70
+
71
+ this.#construction = Construction(this, async () => {
72
+ await this.#ca.construction;
73
+ await this.#fabrics.construction;
74
+ });
75
+ }
76
+
77
+ get construction() {
78
+ return this.#construction;
59
79
  }
60
80
 
61
81
  /**
@@ -89,6 +109,13 @@ export class FabricAuthority {
89
109
  return Array.from(this.#fabrics).filter(this.hasControlOf.bind(this));
90
110
  }
91
111
 
112
+ /**
113
+ * Emits after creating a new fabric.
114
+ */
115
+ get fabricAdded() {
116
+ return this.#fabricAdded;
117
+ }
118
+
92
119
  /**
93
120
  * Determine whether a fabric belongs to this authority.
94
121
  */
@@ -137,6 +164,7 @@ export class FabricAuthority {
137
164
  this.#fabrics.addFabric(fabric);
138
165
 
139
166
  logger.debug(`Created new controller fabric ${index}`);
167
+ this.#fabricAdded.emit(fabric);
140
168
 
141
169
  return fabric;
142
170
  }
@@ -3,7 +3,7 @@
3
3
  * Copyright 2022-2025 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Fabric } from "#fabric/Fabric.js";
6
+ import type { Fabric } from "#fabric/Fabric.js";
7
7
  import { BasicMap, Bytes, InternalError, MatterFlowError, StorageContext } from "#general";
8
8
  import { GroupKeySet, KeySets, OperationalKeySet } from "#groups/KeySets.js";
9
9
  import { MessagingState } from "#groups/MessagingState.js";
@@ -3,8 +3,9 @@
3
3
  * Copyright 2022-2025 Matter.js Authors
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { Subject } from "#action/index.js";
7
- import { Fabric } from "#fabric/Fabric.js";
6
+
7
+ import { Subject } from "#action/server/Subject.js";
8
+ import type { Fabric } from "#fabric/Fabric.js";
8
9
  import { BasicMap, DataWriter, ImplementationError, ipv6BytesToString } from "#general";
9
10
  import { EndpointNumber, GroupId } from "#types";
10
11
  import { KeySets, OperationalKeySet } from "./KeySets.js";
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { Subject } from "#action/server/Subject.js";
7
7
  import { AccessControl } from "#clusters/access-control";
8
- import { Fabric } from "#fabric/Fabric.js";
8
+ import type { Fabric } from "#fabric/Fabric.js";
9
9
  import { InternalError, Logger, MatterFlowError } from "#general";
10
10
  import { AccessLevel } from "#model";
11
11
  import {
@@ -509,7 +509,8 @@ export class InteractionClient {
509
509
  .join(", ")} and events ${eventRequests?.map(path => resolveEventName(path)).join(", ")}`,
510
510
  );
511
511
  // Send read request and combine all (potentially chunked) responses
512
- const response = await messenger.sendReadRequest(request);
512
+ await messenger.sendReadRequest(request);
513
+ const response = await messenger.readAggregateDataReport();
513
514
 
514
515
  // Normalize and decode the response
515
516
  const normalizedResult = DecodedDataReport(response);
@@ -752,7 +753,7 @@ export class InteractionClient {
752
753
  report: DataReport;
753
754
  maximumPeerResponseTimeMs: number;
754
755
  }>(async messenger => {
755
- const { subscribeResponse, report } = await messenger.sendSubscribeRequest({
756
+ await messenger.sendSubscribeRequest({
756
757
  interactionModelRevision: Specification.INTERACTION_MODEL_REVISION,
757
758
  attributeRequests: [{ endpointId, clusterId, attributeId }],
758
759
  dataVersionFilters:
@@ -764,6 +765,7 @@ export class InteractionClient {
764
765
  maxIntervalCeilingSeconds,
765
766
  isFabricFiltered,
766
767
  });
768
+ const { subscribeResponse, report } = await messenger.readAggregateSubscribeResponse();
767
769
  return {
768
770
  subscribeResponse,
769
771
  report,
@@ -863,7 +865,7 @@ export class InteractionClient {
863
865
  report: DataReport;
864
866
  maximumPeerResponseTimeMs: number;
865
867
  }>(async messenger => {
866
- const { subscribeResponse, report } = await messenger.sendSubscribeRequest({
868
+ await messenger.sendSubscribeRequest({
867
869
  interactionModelRevision: Specification.INTERACTION_MODEL_REVISION,
868
870
  eventRequests: [{ endpointId, clusterId, eventId, isUrgent }],
869
871
  eventFilters: minimumEventNumber !== undefined ? [{ eventMin: minimumEventNumber }] : undefined,
@@ -872,6 +874,7 @@ export class InteractionClient {
872
874
  maxIntervalCeilingSeconds,
873
875
  isFabricFiltered,
874
876
  });
877
+ const { subscribeResponse, report } = await messenger.readAggregateSubscribeResponse();
875
878
  return {
876
879
  subscribeResponse,
877
880
  report,
@@ -1030,7 +1033,7 @@ export class InteractionClient {
1030
1033
  report: DataReport;
1031
1034
  maximumPeerResponseTimeMs: number;
1032
1035
  }>(async messenger => {
1033
- const { subscribeResponse, report } = await messenger.sendSubscribeRequest({
1036
+ await messenger.sendSubscribeRequest({
1034
1037
  interactionModelRevision: Specification.INTERACTION_MODEL_REVISION,
1035
1038
  attributeRequests,
1036
1039
  eventRequests,
@@ -1044,6 +1047,7 @@ export class InteractionClient {
1044
1047
  dataVersion,
1045
1048
  })),
1046
1049
  });
1050
+ const { subscribeResponse, report } = await messenger.readAggregateSubscribeResponse();
1047
1051
  return {
1048
1052
  subscribeResponse,
1049
1053
  report,
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import { ReadResult } from "#action/index.js";
7
+ import { ReadResult } from "#action/response/ReadResult.js";
8
8
  import {
9
9
  Diagnostic,
10
10
  InternalError,
@@ -14,6 +14,7 @@ import {
14
14
  UnexpectedDataError,
15
15
  } from "#general";
16
16
  import { Specification } from "#model";
17
+ import { ChannelNotConnectedError } from "#protocol/MessageChannel.js";
17
18
  import {
18
19
  ReceivedStatusResponseError,
19
20
  Status,
@@ -37,7 +38,6 @@ import {
37
38
  TypeFromSchema,
38
39
  } from "#types";
39
40
  import { Message, SessionType } from "../codec/MessageCodec.js";
40
- import { ChannelNotConnectedError } from "../protocol/ExchangeManager.js";
41
41
  import { ExchangeProvider } from "../protocol/ExchangeProvider.js";
42
42
  import {
43
43
  ExchangeSendOptions,
@@ -848,6 +848,14 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
848
848
  return result;
849
849
  }
850
850
 
851
+ /**
852
+ * Read a single data report.
853
+ */
854
+ async readDataReport() {
855
+ const dataReportMessage = await this.waitFor("DataReport", MessageType.ReportData);
856
+ return TlvDataReport.decode(dataReportMessage.payload);
857
+ }
858
+
851
859
  /**
852
860
  * Read data reports as they come in on the wire.
853
861
  *
@@ -855,8 +863,7 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
855
863
  */
856
864
  async *readDataReports() {
857
865
  while (true) {
858
- const dataReportMessage = await this.waitFor("DataReport", MessageType.ReportData);
859
- const report = TlvDataReport.decode(dataReportMessage.payload);
866
+ const report = await this.readDataReport();
860
867
 
861
868
  yield report;
862
869
 
@@ -895,16 +902,16 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
895
902
  }
896
903
 
897
904
  export class InteractionClientMessenger extends IncomingInteractionClientMessenger {
905
+ #exchangeProvider: ExchangeProvider;
906
+
898
907
  static async create(exchangeProvider: ExchangeProvider) {
899
908
  const exchange = await exchangeProvider.initiateExchange();
900
909
  return new this(exchange, exchangeProvider);
901
910
  }
902
911
 
903
- constructor(
904
- exchange: MessageExchange,
905
- private readonly exchangeProvider: ExchangeProvider,
906
- ) {
912
+ constructor(exchange: MessageExchange, exchangeProvider: ExchangeProvider) {
907
913
  super(exchange);
914
+ this.#exchangeProvider = exchangeProvider;
908
915
  }
909
916
 
910
917
  /** Implements a send method with an automatic reconnection mechanism */
@@ -917,7 +924,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
917
924
  return await this.exchange.send(messageType, payload, options);
918
925
  } catch (error) {
919
926
  if (
920
- this.exchangeProvider.supportsReconnect &&
927
+ this.#exchangeProvider.supportsReconnect &&
921
928
  (error instanceof RetransmissionLimitReachedError || error instanceof ChannelNotConnectedError) &&
922
929
  !options?.multipleMessageInteraction
923
930
  ) {
@@ -927,8 +934,8 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
927
934
  `${error instanceof RetransmissionLimitReachedError ? "Retransmission limit reached" : "Channel not connected"}, trying to reconnect and resend the message.`,
928
935
  );
929
936
  await this.exchange.close();
930
- if (await this.exchangeProvider.reconnectChannel()) {
931
- this.exchange = await this.exchangeProvider.initiateExchange();
937
+ if (await this.#exchangeProvider.reconnectChannel()) {
938
+ this.exchange = await this.#exchangeProvider.initiateExchange();
932
939
  return await this.exchange.send(messageType, payload, options);
933
940
  }
934
941
  } else {
@@ -939,8 +946,6 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
939
946
 
940
947
  async sendReadRequest(readRequest: ReadRequest) {
941
948
  await this.send(MessageType.ReadRequest, this.#encodeReadingRequest(TlvReadRequest, readRequest));
942
-
943
- return this.readAggregateDataReport();
944
949
  }
945
950
 
946
951
  #encodeReadingRequest<T extends TlvSchema<any>>(schema: T, request: TypeFromSchema<T>) {
@@ -1000,7 +1005,9 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
1000
1005
  async sendSubscribeRequest(subscribeRequest: SubscribeRequest) {
1001
1006
  const request = this.#encodeReadingRequest(TlvSubscribeRequest, subscribeRequest);
1002
1007
  await this.send(MessageType.SubscribeRequest, request);
1008
+ }
1003
1009
 
1010
+ async readAggregateSubscribeResponse() {
1004
1011
  const report = await this.readAggregateDataReport();
1005
1012
  const { subscriptionId } = report;
1006
1013