@matter/protocol 0.16.0-alpha.0-20251205-dfb1e1556 → 0.16.0-alpha.0-20251209-d6072d23e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/action/Val.js +1 -1
- package/dist/cjs/action/Val.js.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/cjs/action/client/ClientInteraction.js +83 -35
- package/dist/cjs/action/client/ClientInteraction.js.map +2 -2
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts +10 -5
- package/dist/cjs/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.js +21 -1
- package/dist/cjs/action/client/subscription/ClientSubscription.js.map +2 -2
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js +2 -3
- package/dist/cjs/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptions.d.ts +4 -2
- package/dist/cjs/action/client/subscription/ClientSubscriptions.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/ClientSubscriptions.js +68 -8
- package/dist/cjs/action/client/subscription/ClientSubscriptions.js.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts +0 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/PeerSubscription.js +1 -2
- package/dist/cjs/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/cjs/action/client/subscription/SustainedSubscription.d.ts +0 -2
- package/dist/cjs/action/client/subscription/SustainedSubscription.d.ts.map +1 -1
- package/dist/cjs/action/client/subscription/SustainedSubscription.js +2 -4
- package/dist/cjs/action/client/subscription/SustainedSubscription.js.map +1 -1
- package/dist/cjs/action/request/Invoke.js +2 -2
- package/dist/cjs/action/request/Invoke.js.map +1 -1
- package/dist/cjs/action/response/ReadResult.d.ts +1 -1
- package/dist/cjs/action/response/ReadResult.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeReadResponse.js +78 -25
- package/dist/cjs/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeWriteResponse.js +70 -17
- package/dist/cjs/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/CommandInvokeResponse.js +83 -30
- package/dist/cjs/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/cjs/action/server/DataResponse.d.ts +1 -0
- package/dist/cjs/action/server/DataResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/DataResponse.js +3 -0
- package/dist/cjs/action/server/DataResponse.js.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.js +4 -4
- package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
- package/dist/cjs/advertisement/Advertisement.d.ts.map +1 -1
- package/dist/cjs/advertisement/Advertisement.js +66 -14
- package/dist/cjs/advertisement/Advertisement.js.map +1 -1
- package/dist/cjs/advertisement/Advertiser.d.ts +4 -1
- package/dist/cjs/advertisement/Advertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/Advertiser.js +63 -2
- package/dist/cjs/advertisement/Advertiser.js.map +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts +6 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.js +1 -1
- package/dist/cjs/advertisement/ble/BleAdvertiser.js.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts +5 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js +1 -1
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/cjs/certificate/kinds/Noc.js +8 -6
- package/dist/cjs/certificate/kinds/Noc.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.js +1 -1
- package/dist/cjs/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/cjs/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/cjs/cluster/client/AttributeClient.js +2 -2
- package/dist/cjs/cluster/client/AttributeClient.js.map +1 -1
- package/dist/cjs/codec/MessageCodec.d.ts +8 -1
- package/dist/cjs/codec/MessageCodec.d.ts.map +1 -1
- package/dist/cjs/codec/MessageCodec.js +38 -28
- package/dist/cjs/codec/MessageCodec.js.map +2 -2
- package/dist/cjs/common/FailsafeContext.d.ts +8 -9
- package/dist/cjs/common/FailsafeContext.d.ts.map +1 -1
- package/dist/cjs/common/FailsafeContext.js +27 -33
- package/dist/cjs/common/FailsafeContext.js.map +1 -1
- package/dist/cjs/common/FailsafeTimer.d.ts +4 -3
- package/dist/cjs/common/FailsafeTimer.d.ts.map +1 -1
- package/dist/cjs/common/FailsafeTimer.js +4 -4
- package/dist/cjs/common/FailsafeTimer.js.map +1 -1
- package/dist/cjs/common/Mark.d.ts +17 -0
- package/dist/cjs/common/Mark.d.ts.map +1 -0
- package/dist/cjs/{peer/OperationalPeer.js → common/Mark.js} +19 -3
- package/dist/cjs/common/Mark.js.map +6 -0
- package/dist/cjs/common/index.d.ts +1 -0
- package/dist/cjs/common/index.d.ts.map +1 -1
- package/dist/cjs/common/index.js +1 -0
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +16 -8
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +35 -18
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/fabric/FabricAuthority.d.ts +2 -2
- package/dist/cjs/fabric/FabricAuthority.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricAuthority.js +3 -3
- package/dist/cjs/fabric/FabricAuthority.js.map +1 -1
- package/dist/cjs/fabric/FabricManager.d.ts +10 -14
- package/dist/cjs/fabric/FabricManager.d.ts.map +1 -1
- package/dist/cjs/fabric/FabricManager.js +44 -40
- package/dist/cjs/fabric/FabricManager.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/cjs/interaction/InteractionClient.d.ts +2 -2
- package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionClient.js +39 -22
- package/dist/cjs/interaction/InteractionClient.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +2 -2
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +35 -27
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/interaction/Subscription.d.ts +16 -37
- package/dist/cjs/interaction/Subscription.d.ts.map +1 -1
- package/dist/cjs/interaction/Subscription.js +15 -68
- package/dist/cjs/interaction/Subscription.js.map +2 -2
- package/dist/cjs/interaction/SubscriptionClient.d.ts +2 -2
- package/dist/cjs/interaction/SubscriptionClient.d.ts.map +1 -1
- package/dist/cjs/interaction/SubscriptionClient.js +2 -2
- package/dist/cjs/interaction/SubscriptionClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsClient.d.ts +10 -10
- package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsClient.js +165 -80
- package/dist/cjs/mdns/MdnsClient.js.map +1 -1
- package/dist/cjs/mdns/MdnsServer.d.ts +2 -2
- package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsServer.js +173 -94
- package/dist/cjs/mdns/MdnsServer.js.map +2 -2
- package/dist/cjs/mdns/MdnsService.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsService.js +3 -2
- package/dist/cjs/mdns/MdnsService.js.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.d.ts +3 -2
- package/dist/cjs/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.js +2 -1
- package/dist/cjs/mdns/MdnsSocket.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.d.ts +2 -2
- package/dist/cjs/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +26 -28
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.js +3 -3
- package/dist/cjs/peer/ControllerDiscovery.js.map +1 -1
- package/dist/cjs/peer/Peer.d.ts +57 -0
- package/dist/cjs/peer/Peer.d.ts.map +1 -0
- package/dist/cjs/peer/Peer.js +182 -0
- package/dist/cjs/peer/Peer.js.map +6 -0
- package/dist/cjs/peer/PeerAddress.d.ts.map +1 -1
- package/dist/cjs/peer/PeerAddress.js +6 -3
- package/dist/cjs/peer/PeerAddress.js.map +1 -1
- package/dist/cjs/peer/PeerAddressStore.d.ts +3 -3
- package/dist/cjs/peer/PeerAddressStore.d.ts.map +1 -1
- package/{src/peer/OperationalPeer.ts → dist/cjs/peer/PeerDescriptor.d.ts} +14 -12
- package/dist/cjs/peer/PeerDescriptor.d.ts.map +1 -0
- package/dist/cjs/peer/PeerDescriptor.js +71 -0
- package/dist/cjs/peer/PeerDescriptor.js.map +6 -0
- package/dist/cjs/peer/PeerSet.d.ts +23 -26
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +173 -173
- package/dist/cjs/peer/PeerSet.js.map +2 -2
- package/dist/cjs/peer/index.d.ts +1 -1
- package/dist/cjs/peer/index.d.ts.map +1 -1
- package/dist/cjs/peer/index.js +1 -1
- package/dist/cjs/peer/index.js.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.js +4 -4
- package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.d.ts +6 -9
- package/dist/cjs/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +301 -243
- package/dist/cjs/protocol/ExchangeManager.js.map +2 -2
- package/dist/cjs/protocol/ExchangeProvider.d.ts +9 -11
- package/dist/cjs/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/cjs/protocol/ExchangeProvider.js +79 -32
- package/dist/cjs/protocol/ExchangeProvider.js.map +2 -2
- package/dist/cjs/protocol/MessageChannel.d.ts +6 -7
- package/dist/cjs/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageChannel.js +14 -16
- package/dist/cjs/protocol/MessageChannel.js.map +1 -1
- package/dist/cjs/protocol/MessageCounter.d.ts +4 -4
- package/dist/cjs/protocol/MessageCounter.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageCounter.js +7 -7
- package/dist/cjs/protocol/MessageCounter.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +31 -20
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +316 -231
- package/dist/cjs/protocol/MessageExchange.js.map +2 -2
- package/dist/cjs/protocol/ProtocolMocks.d.ts +100 -0
- package/dist/cjs/protocol/ProtocolMocks.d.ts.map +1 -0
- package/dist/cjs/protocol/ProtocolMocks.js +237 -0
- package/dist/cjs/protocol/ProtocolMocks.js.map +6 -0
- package/dist/cjs/protocol/errors.d.ts +35 -0
- package/dist/cjs/protocol/errors.d.ts.map +1 -0
- package/dist/cjs/protocol/errors.js +50 -0
- package/dist/cjs/protocol/errors.js.map +6 -0
- package/dist/cjs/protocol/index.d.ts +2 -1
- package/dist/cjs/protocol/index.d.ts.map +1 -1
- package/dist/cjs/protocol/index.js +2 -1
- package/dist/cjs/protocol/index.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts +1 -0
- package/dist/cjs/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.js +3 -0
- package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelProtocol.js +2 -2
- package/dist/cjs/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/cjs/session/GroupSession.d.ts +21 -10
- package/dist/cjs/session/GroupSession.d.ts.map +1 -1
- package/dist/cjs/session/GroupSession.js +37 -12
- package/dist/cjs/session/GroupSession.js.map +1 -1
- package/dist/cjs/session/NodeSession.d.ts +56 -50
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +95 -103
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/SecureSession.d.ts +4 -4
- package/dist/cjs/session/SecureSession.d.ts.map +1 -1
- package/dist/cjs/session/SecureSession.js +1 -1
- package/dist/cjs/session/SecureSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +82 -66
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js +218 -45
- package/dist/cjs/session/Session.js.map +1 -1
- package/dist/cjs/session/SessionManager.d.ts +33 -36
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/SessionManager.js +112 -150
- package/dist/cjs/session/SessionManager.js.map +1 -1
- package/dist/cjs/session/SessionParameters.d.ts +87 -0
- package/dist/cjs/session/SessionParameters.d.ts.map +1 -0
- package/dist/cjs/session/SessionParameters.js +81 -0
- package/dist/cjs/session/SessionParameters.js.map +6 -0
- package/dist/{esm/session/InsecureSession.d.ts → cjs/session/UnsecuredSession.d.ts} +18 -16
- package/dist/cjs/session/UnsecuredSession.d.ts.map +1 -0
- package/dist/cjs/session/{InsecureSession.js → UnsecuredSession.js} +21 -21
- package/dist/cjs/session/UnsecuredSession.js.map +6 -0
- package/dist/cjs/session/case/CaseClient.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseClient.js +6 -4
- package/dist/cjs/session/case/CaseClient.js.map +1 -1
- package/dist/cjs/session/case/CaseServer.d.ts.map +1 -1
- package/dist/cjs/session/case/CaseServer.js +14 -10
- package/dist/cjs/session/case/CaseServer.js.map +1 -1
- package/dist/cjs/session/index.d.ts +2 -1
- package/dist/cjs/session/index.d.ts.map +1 -1
- package/dist/cjs/session/index.js +2 -1
- package/dist/cjs/session/index.js.map +1 -1
- package/dist/cjs/session/pase/PaseClient.d.ts +3 -3
- package/dist/cjs/session/pase/PaseClient.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseClient.js +5 -3
- package/dist/cjs/session/pase/PaseClient.js.map +1 -1
- package/dist/cjs/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/cjs/session/pase/PaseServer.js +13 -13
- package/dist/cjs/session/pase/PaseServer.js.map +1 -1
- package/dist/esm/action/Val.js +1 -1
- package/dist/esm/action/Val.js.map +1 -1
- package/dist/esm/action/client/ClientInteraction.d.ts.map +1 -1
- package/dist/esm/action/client/ClientInteraction.js +83 -35
- package/dist/esm/action/client/ClientInteraction.js.map +2 -2
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts +10 -5
- package/dist/esm/action/client/subscription/ClientSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscription.js +22 -2
- package/dist/esm/action/client/subscription/ClientSubscription.js.map +2 -2
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js +2 -3
- package/dist/esm/action/client/subscription/ClientSubscriptionHandler.js.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptions.d.ts +4 -2
- package/dist/esm/action/client/subscription/ClientSubscriptions.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/ClientSubscriptions.js +68 -8
- package/dist/esm/action/client/subscription/ClientSubscriptions.js.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts +0 -1
- package/dist/esm/action/client/subscription/PeerSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/PeerSubscription.js +1 -2
- package/dist/esm/action/client/subscription/PeerSubscription.js.map +1 -1
- package/dist/esm/action/client/subscription/SustainedSubscription.d.ts +0 -2
- package/dist/esm/action/client/subscription/SustainedSubscription.d.ts.map +1 -1
- package/dist/esm/action/client/subscription/SustainedSubscription.js +2 -4
- package/dist/esm/action/client/subscription/SustainedSubscription.js.map +1 -1
- package/dist/esm/action/request/Invoke.js +2 -2
- package/dist/esm/action/request/Invoke.js.map +1 -1
- package/dist/esm/action/response/ReadResult.d.ts +1 -1
- package/dist/esm/action/response/ReadResult.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeReadResponse.js +78 -25
- package/dist/esm/action/server/AttributeReadResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeWriteResponse.js +70 -17
- package/dist/esm/action/server/AttributeWriteResponse.js.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.d.ts.map +1 -1
- package/dist/esm/action/server/CommandInvokeResponse.js +83 -30
- package/dist/esm/action/server/CommandInvokeResponse.js.map +1 -1
- package/dist/esm/action/server/DataResponse.d.ts +1 -0
- package/dist/esm/action/server/DataResponse.d.ts.map +1 -1
- package/dist/esm/action/server/DataResponse.js +3 -0
- package/dist/esm/action/server/DataResponse.js.map +1 -1
- package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/esm/action/server/ServerInteraction.js +4 -4
- package/dist/esm/action/server/ServerInteraction.js.map +1 -1
- package/dist/esm/advertisement/Advertisement.d.ts.map +1 -1
- package/dist/esm/advertisement/Advertisement.js +66 -14
- package/dist/esm/advertisement/Advertisement.js.map +1 -1
- package/dist/esm/advertisement/Advertiser.d.ts +4 -1
- package/dist/esm/advertisement/Advertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/Advertiser.js +63 -2
- package/dist/esm/advertisement/Advertiser.js.map +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts +6 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.js +1 -1
- package/dist/esm/advertisement/ble/BleAdvertiser.js.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts +5 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js +1 -1
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js.map +1 -1
- package/dist/esm/certificate/kinds/Noc.d.ts.map +1 -1
- package/dist/esm/certificate/kinds/Noc.js +8 -6
- package/dist/esm/certificate/kinds/Noc.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/asn.js +2 -2
- package/dist/esm/certificate/kinds/definitions/asn.js.map +1 -1
- package/dist/esm/certificate/kinds/definitions/attestation.d.ts.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.d.ts.map +1 -1
- package/dist/esm/cluster/client/AttributeClient.js +1 -1
- package/dist/esm/cluster/client/AttributeClient.js.map +1 -1
- package/dist/esm/codec/MessageCodec.d.ts +8 -1
- package/dist/esm/codec/MessageCodec.d.ts.map +1 -1
- package/dist/esm/codec/MessageCodec.js +39 -28
- package/dist/esm/codec/MessageCodec.js.map +2 -2
- package/dist/esm/common/FailsafeContext.d.ts +8 -9
- package/dist/esm/common/FailsafeContext.d.ts.map +1 -1
- package/dist/esm/common/FailsafeContext.js +27 -33
- package/dist/esm/common/FailsafeContext.js.map +1 -1
- package/dist/esm/common/FailsafeTimer.d.ts +4 -3
- package/dist/esm/common/FailsafeTimer.d.ts.map +1 -1
- package/dist/esm/common/FailsafeTimer.js +4 -4
- package/dist/esm/common/FailsafeTimer.js.map +1 -1
- package/dist/esm/common/Mark.d.ts +17 -0
- package/dist/esm/common/Mark.d.ts.map +1 -0
- package/dist/esm/common/Mark.js +18 -0
- package/dist/esm/common/Mark.js.map +6 -0
- package/dist/esm/common/index.d.ts +1 -0
- package/dist/esm/common/index.d.ts.map +1 -1
- package/dist/esm/common/index.js +1 -0
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/fabric/Fabric.d.ts +16 -8
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +36 -18
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/fabric/FabricAuthority.d.ts +2 -2
- package/dist/esm/fabric/FabricAuthority.d.ts.map +1 -1
- package/dist/esm/fabric/FabricAuthority.js +5 -5
- package/dist/esm/fabric/FabricAuthority.js.map +1 -1
- package/dist/esm/fabric/FabricManager.d.ts +10 -14
- package/dist/esm/fabric/FabricManager.d.ts.map +1 -1
- package/dist/esm/fabric/FabricManager.js +45 -40
- package/dist/esm/fabric/FabricManager.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interaction/AttributeDataEncoder.d.ts +1 -1
- package/dist/esm/interaction/InteractionClient.d.ts +2 -2
- package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionClient.js +39 -22
- package/dist/esm/interaction/InteractionClient.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +2 -2
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +33 -28
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/interaction/Subscription.d.ts +16 -37
- package/dist/esm/interaction/Subscription.d.ts.map +1 -1
- package/dist/esm/interaction/Subscription.js +16 -69
- package/dist/esm/interaction/Subscription.js.map +2 -2
- package/dist/esm/interaction/SubscriptionClient.d.ts +2 -2
- package/dist/esm/interaction/SubscriptionClient.d.ts.map +1 -1
- package/dist/esm/interaction/SubscriptionClient.js +2 -2
- package/dist/esm/interaction/SubscriptionClient.js.map +1 -1
- package/dist/esm/mdns/MdnsClient.d.ts +10 -10
- package/dist/esm/mdns/MdnsClient.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsClient.js +166 -80
- package/dist/esm/mdns/MdnsClient.js.map +1 -1
- package/dist/esm/mdns/MdnsServer.d.ts +2 -2
- package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsServer.js +176 -94
- package/dist/esm/mdns/MdnsServer.js.map +2 -2
- package/dist/esm/mdns/MdnsService.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsService.js +3 -2
- package/dist/esm/mdns/MdnsService.js.map +1 -1
- package/dist/esm/mdns/MdnsSocket.d.ts +3 -2
- package/dist/esm/mdns/MdnsSocket.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsSocket.js +2 -1
- package/dist/esm/mdns/MdnsSocket.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.d.ts +2 -2
- package/dist/esm/peer/ControllerCommissioner.d.ts.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +26 -28
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.js +1 -1
- package/dist/esm/peer/ControllerDiscovery.js.map +1 -1
- package/dist/esm/peer/Peer.d.ts +57 -0
- package/dist/esm/peer/Peer.d.ts.map +1 -0
- package/dist/esm/peer/Peer.js +162 -0
- package/dist/esm/peer/Peer.js.map +6 -0
- package/dist/esm/peer/PeerAddress.d.ts.map +1 -1
- package/dist/esm/peer/PeerAddress.js +6 -3
- package/dist/esm/peer/PeerAddress.js.map +1 -1
- package/dist/esm/peer/PeerAddressStore.d.ts +3 -3
- package/dist/esm/peer/PeerAddressStore.d.ts.map +1 -1
- package/dist/{cjs/peer/OperationalPeer.d.ts → esm/peer/PeerDescriptor.d.ts} +14 -7
- package/dist/esm/peer/PeerDescriptor.d.ts.map +1 -0
- package/dist/esm/peer/PeerDescriptor.js +51 -0
- package/dist/esm/peer/PeerDescriptor.js.map +6 -0
- package/dist/esm/peer/PeerSet.d.ts +23 -26
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +173 -175
- package/dist/esm/peer/PeerSet.js.map +2 -2
- package/dist/esm/peer/index.d.ts +1 -1
- package/dist/esm/peer/index.d.ts.map +1 -1
- package/dist/esm/peer/index.js +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.js +4 -4
- package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.d.ts +6 -9
- package/dist/esm/protocol/ExchangeManager.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +303 -248
- package/dist/esm/protocol/ExchangeManager.js.map +2 -2
- package/dist/esm/protocol/ExchangeProvider.d.ts +9 -11
- package/dist/esm/protocol/ExchangeProvider.d.ts.map +1 -1
- package/dist/esm/protocol/ExchangeProvider.js +81 -37
- package/dist/esm/protocol/ExchangeProvider.js.map +2 -2
- package/dist/esm/protocol/MessageChannel.d.ts +6 -7
- package/dist/esm/protocol/MessageChannel.d.ts.map +1 -1
- package/dist/esm/protocol/MessageChannel.js +22 -18
- package/dist/esm/protocol/MessageChannel.js.map +1 -1
- package/dist/esm/protocol/MessageCounter.d.ts +4 -4
- package/dist/esm/protocol/MessageCounter.d.ts.map +1 -1
- package/dist/esm/protocol/MessageCounter.js +7 -7
- package/dist/esm/protocol/MessageCounter.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +31 -20
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +318 -238
- package/dist/esm/protocol/MessageExchange.js.map +2 -2
- package/dist/esm/protocol/ProtocolMocks.d.ts +100 -0
- package/dist/esm/protocol/ProtocolMocks.d.ts.map +1 -0
- package/dist/esm/protocol/ProtocolMocks.js +230 -0
- package/dist/esm/protocol/ProtocolMocks.js.map +6 -0
- package/dist/esm/protocol/errors.d.ts +35 -0
- package/dist/esm/protocol/errors.d.ts.map +1 -0
- package/dist/esm/protocol/errors.js +30 -0
- package/dist/esm/protocol/errors.js.map +6 -0
- package/dist/esm/protocol/index.d.ts +2 -1
- package/dist/esm/protocol/index.d.ts.map +1 -1
- package/dist/esm/protocol/index.js +2 -1
- package/dist/esm/protocol/index.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts +1 -0
- package/dist/esm/securechannel/SecureChannelMessenger.d.ts.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.js +3 -0
- package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelProtocol.js +2 -2
- package/dist/esm/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/esm/session/GroupSession.d.ts +21 -10
- package/dist/esm/session/GroupSession.d.ts.map +1 -1
- package/dist/esm/session/GroupSession.js +41 -12
- package/dist/esm/session/GroupSession.js.map +1 -1
- package/dist/esm/session/NodeSession.d.ts +56 -50
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +99 -105
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/SecureSession.d.ts +4 -4
- package/dist/esm/session/SecureSession.d.ts.map +1 -1
- package/dist/esm/session/SecureSession.js +1 -1
- package/dist/esm/session/SecureSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +82 -66
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js +223 -45
- package/dist/esm/session/Session.js.map +1 -1
- package/dist/esm/session/SessionManager.d.ts +33 -36
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/SessionManager.js +113 -157
- package/dist/esm/session/SessionManager.js.map +1 -1
- package/dist/esm/session/SessionParameters.d.ts +87 -0
- package/dist/esm/session/SessionParameters.d.ts.map +1 -0
- package/dist/esm/session/SessionParameters.js +61 -0
- package/dist/esm/session/SessionParameters.js.map +6 -0
- package/dist/{cjs/session/InsecureSession.d.ts → esm/session/UnsecuredSession.d.ts} +18 -16
- package/dist/esm/session/UnsecuredSession.d.ts.map +1 -0
- package/dist/esm/session/{InsecureSession.js → UnsecuredSession.js} +18 -18
- package/dist/esm/session/UnsecuredSession.js.map +6 -0
- package/dist/esm/session/case/CaseClient.d.ts.map +1 -1
- package/dist/esm/session/case/CaseClient.js +5 -3
- package/dist/esm/session/case/CaseClient.js.map +1 -1
- package/dist/esm/session/case/CaseServer.d.ts.map +1 -1
- package/dist/esm/session/case/CaseServer.js +14 -10
- package/dist/esm/session/case/CaseServer.js.map +1 -1
- package/dist/esm/session/index.d.ts +2 -1
- package/dist/esm/session/index.d.ts.map +1 -1
- package/dist/esm/session/index.js +2 -1
- package/dist/esm/session/index.js.map +1 -1
- package/dist/esm/session/pase/PaseClient.d.ts +3 -3
- package/dist/esm/session/pase/PaseClient.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseClient.js +5 -3
- package/dist/esm/session/pase/PaseClient.js.map +1 -1
- package/dist/esm/session/pase/PaseServer.d.ts.map +1 -1
- package/dist/esm/session/pase/PaseServer.js +13 -13
- package/dist/esm/session/pase/PaseServer.js.map +1 -1
- package/package.json +6 -6
- package/src/action/client/ClientInteraction.ts +47 -13
- package/src/action/client/subscription/ClientSubscription.ts +30 -5
- package/src/action/client/subscription/ClientSubscriptionHandler.ts +2 -4
- package/src/action/client/subscription/ClientSubscriptions.ts +14 -3
- package/src/action/client/subscription/PeerSubscription.ts +2 -2
- package/src/action/client/subscription/SustainedSubscription.ts +2 -6
- package/src/action/request/Invoke.ts +2 -2
- package/src/action/response/ReadResult.ts +1 -1
- package/src/action/server/AttributeReadResponse.ts +2 -0
- package/src/action/server/AttributeWriteResponse.ts +2 -0
- package/src/action/server/CommandInvokeResponse.ts +1 -0
- package/src/action/server/DataResponse.ts +4 -0
- package/src/action/server/ServerInteraction.ts +4 -4
- package/src/advertisement/Advertisement.ts +6 -7
- package/src/advertisement/Advertiser.ts +12 -1
- package/src/advertisement/ble/BleAdvertiser.ts +7 -2
- package/src/advertisement/mdns/MdnsAdvertiser.ts +7 -1
- package/src/certificate/kinds/Noc.ts +12 -7
- package/src/certificate/kinds/definitions/asn.ts +2 -2
- package/src/certificate/kinds/definitions/attestation.ts +1 -0
- package/src/cluster/client/AttributeClient.ts +1 -1
- package/src/codec/MessageCodec.ts +39 -32
- package/src/common/FailsafeContext.ts +36 -39
- package/src/common/FailsafeTimer.ts +7 -6
- package/src/common/Mark.ts +17 -0
- package/src/common/index.ts +1 -0
- package/src/fabric/Fabric.ts +51 -23
- package/src/fabric/FabricAuthority.ts +4 -4
- package/src/fabric/FabricManager.ts +53 -40
- package/src/index.ts +3 -1
- package/src/interaction/InteractionClient.ts +40 -23
- package/src/interaction/InteractionMessenger.ts +38 -32
- package/src/interaction/Subscription.ts +20 -92
- package/src/interaction/SubscriptionClient.ts +3 -3
- package/src/mdns/MdnsClient.ts +20 -3
- package/src/mdns/MdnsServer.ts +13 -1
- package/src/mdns/MdnsService.ts +3 -2
- package/src/mdns/MdnsSocket.ts +9 -3
- package/src/peer/ControllerCommissioner.ts +35 -37
- package/src/peer/ControllerDiscovery.ts +1 -1
- package/src/peer/Peer.ts +161 -0
- package/src/peer/PeerAddress.ts +6 -2
- package/src/peer/PeerAddressStore.ts +3 -3
- package/src/peer/PeerDescriptor.ts +89 -0
- package/src/peer/PeerSet.ts +145 -213
- package/src/peer/index.ts +1 -1
- package/src/protocol/DeviceAdvertiser.ts +4 -4
- package/src/protocol/ExchangeManager.ts +149 -178
- package/src/protocol/ExchangeProvider.ts +31 -40
- package/src/protocol/MessageChannel.ts +29 -18
- package/src/protocol/MessageCounter.ts +8 -8
- package/src/protocol/MessageExchange.ts +181 -144
- package/src/protocol/ProtocolMocks.ts +302 -0
- package/src/protocol/errors.ts +44 -0
- package/src/protocol/index.ts +2 -1
- package/src/securechannel/SecureChannelMessenger.ts +4 -0
- package/src/securechannel/SecureChannelProtocol.ts +2 -2
- package/src/session/GroupSession.ts +67 -23
- package/src/session/NodeSession.ts +140 -136
- package/src/session/SecureSession.ts +6 -5
- package/src/session/Session.ts +234 -101
- package/src/session/SessionManager.ts +148 -187
- package/src/session/SessionParameters.ts +108 -0
- package/src/session/{InsecureSession.ts → UnsecuredSession.ts} +28 -26
- package/src/session/case/CaseClient.ts +6 -3
- package/src/session/case/CaseServer.ts +15 -11
- package/src/session/index.ts +2 -1
- package/src/session/pase/PaseClient.ts +12 -5
- package/src/session/pase/PaseServer.ts +14 -13
- package/dist/cjs/peer/OperationalPeer.d.ts.map +0 -1
- package/dist/cjs/peer/OperationalPeer.js.map +0 -6
- package/dist/cjs/protocol/ChannelManager.d.ts +0 -29
- package/dist/cjs/protocol/ChannelManager.d.ts.map +0 -1
- package/dist/cjs/protocol/ChannelManager.js +0 -178
- package/dist/cjs/protocol/ChannelManager.js.map +0 -6
- package/dist/cjs/session/InsecureSession.d.ts.map +0 -1
- package/dist/cjs/session/InsecureSession.js.map +0 -6
- package/dist/esm/peer/OperationalPeer.d.ts +0 -38
- package/dist/esm/peer/OperationalPeer.d.ts.map +0 -1
- package/dist/esm/peer/OperationalPeer.js +0 -6
- package/dist/esm/peer/OperationalPeer.js.map +0 -6
- package/dist/esm/protocol/ChannelManager.d.ts +0 -29
- package/dist/esm/protocol/ChannelManager.d.ts.map +0 -1
- package/dist/esm/protocol/ChannelManager.js +0 -158
- package/dist/esm/protocol/ChannelManager.js.map +0 -6
- package/dist/esm/session/InsecureSession.d.ts.map +0 -1
- package/dist/esm/session/InsecureSession.js.map +0 -6
- package/src/protocol/ChannelManager.ts +0 -180
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
AsyncObservable,
|
|
8
9
|
Bytes,
|
|
9
10
|
Construction,
|
|
10
11
|
Crypto,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
MatterFlowError,
|
|
18
19
|
MaybePromise,
|
|
19
20
|
Observable,
|
|
21
|
+
Observer,
|
|
20
22
|
StorageContext,
|
|
21
23
|
StorageManager,
|
|
22
24
|
} from "#general";
|
|
@@ -30,12 +32,6 @@ const logger = Logger.get("FabricManager");
|
|
|
30
32
|
export class FabricNotFoundError extends MatterError {}
|
|
31
33
|
export class FabricTableFullError extends MatterError {}
|
|
32
34
|
|
|
33
|
-
export enum FabricAction {
|
|
34
|
-
Added,
|
|
35
|
-
Removed,
|
|
36
|
-
Updated,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
35
|
export class FabricManager {
|
|
40
36
|
#crypto: Crypto;
|
|
41
37
|
#nextFabricIndex = 1;
|
|
@@ -44,8 +40,10 @@ export class FabricManager {
|
|
|
44
40
|
#storage?: StorageContext;
|
|
45
41
|
#events = {
|
|
46
42
|
added: Observable<[fabric: Fabric]>(),
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
replaced: Observable<[fabric: Fabric]>(unhandled("replacing")),
|
|
44
|
+
leaving: Observable<[fabric: Fabric]>(unhandled("leaving")),
|
|
45
|
+
deleting: AsyncObservable<[fabric: Fabric]>(unhandled("deleting")),
|
|
46
|
+
deleted: AsyncObservable<[fabric: Fabric]>(unhandled("deleted")),
|
|
49
47
|
failsafeClosed: Observable<[]>(),
|
|
50
48
|
};
|
|
51
49
|
#construction: Construction<FabricManager>;
|
|
@@ -111,7 +109,8 @@ export class FabricManager {
|
|
|
111
109
|
if (typeof address === "object") {
|
|
112
110
|
address = address.fabricIndex;
|
|
113
111
|
}
|
|
114
|
-
|
|
112
|
+
const fabric = this.maybeForIndex(address);
|
|
113
|
+
return fabric && !fabric.isDeleting;
|
|
115
114
|
}
|
|
116
115
|
|
|
117
116
|
for(address: FabricIndex | PeerAddress) {
|
|
@@ -149,7 +148,7 @@ export class FabricManager {
|
|
|
149
148
|
|
|
150
149
|
const storeResult = this.#storage.set(
|
|
151
150
|
"fabrics",
|
|
152
|
-
|
|
151
|
+
this.fabrics.map(fabric => fabric.config),
|
|
153
152
|
);
|
|
154
153
|
if (MaybePromise.is(storeResult)) {
|
|
155
154
|
return storeResult.then(() => this.#storage!.set("nextFabricIndex", this.#nextFabricIndex));
|
|
@@ -179,20 +178,22 @@ export class FabricManager {
|
|
|
179
178
|
#addOrUpdateFabricEntry(fabric: Fabric) {
|
|
180
179
|
const { fabricIndex } = fabric;
|
|
181
180
|
this.#fabrics.set(fabricIndex, fabric);
|
|
182
|
-
|
|
181
|
+
|
|
182
|
+
fabric.leaving.on(() => this.events.leaving.emit(fabric));
|
|
183
|
+
fabric.deleting.on(() => this.events.deleting.emit(fabric));
|
|
184
|
+
fabric.deleted.on(() => this.#handleFabricDeleted(fabric));
|
|
185
|
+
|
|
183
186
|
fabric.persistCallback = (isUpdate = true) => {
|
|
184
187
|
if (!this.#storage) {
|
|
185
188
|
if (isUpdate) {
|
|
186
|
-
logger.warn(
|
|
187
|
-
"Fabric can not be persisted because FabricManager has no storage but it is a fabric update.",
|
|
188
|
-
);
|
|
189
|
+
logger.warn(`Fabric ${fabricIndex} cannot persist because FabricManager has no storage`);
|
|
189
190
|
}
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
193
|
const persistResult = this.persistFabrics();
|
|
193
194
|
return MaybePromise.then(persistResult, () => {
|
|
194
195
|
if (isUpdate) {
|
|
195
|
-
this.#events.
|
|
196
|
+
this.#events.replaced.emit(fabric); // Assume Fabric got updated when persist callback is called
|
|
196
197
|
}
|
|
197
198
|
});
|
|
198
199
|
};
|
|
@@ -201,32 +202,26 @@ export class FabricManager {
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
async
|
|
205
|
+
async #handleFabricDeleted(fabric: Fabric) {
|
|
205
206
|
await this.#construction;
|
|
206
207
|
|
|
207
|
-
|
|
208
|
-
if (fabric === undefined)
|
|
209
|
-
throw new FabricNotFoundError(
|
|
210
|
-
`Fabric with index ${fabricIndex} cannot be removed because it does not exist.`,
|
|
211
|
-
);
|
|
212
|
-
this.#fabrics.delete(fabricIndex);
|
|
208
|
+
this.#fabrics.delete(fabric.fabricIndex);
|
|
213
209
|
if (this.#storage) {
|
|
214
210
|
await this.persistFabrics();
|
|
215
211
|
}
|
|
216
212
|
await fabric.storage?.clearAll();
|
|
217
|
-
this.#events.deleted.emit(fabric);
|
|
218
213
|
}
|
|
219
214
|
|
|
220
215
|
[Symbol.iterator]() {
|
|
221
216
|
this.#construction.assert();
|
|
222
217
|
|
|
223
|
-
return this
|
|
218
|
+
return this.fabrics[Symbol.iterator]();
|
|
224
219
|
}
|
|
225
220
|
|
|
226
221
|
get fabrics() {
|
|
227
222
|
this.#construction.assert();
|
|
228
223
|
|
|
229
|
-
return Array.from(this.#fabrics.values());
|
|
224
|
+
return Array.from(this.#fabrics.values()).filter(fabric => !fabric.isDeleting);
|
|
230
225
|
}
|
|
231
226
|
|
|
232
227
|
get length() {
|
|
@@ -247,6 +242,10 @@ export class FabricManager {
|
|
|
247
242
|
for (const fabric of this.#fabrics.values()) {
|
|
248
243
|
const candidateDestinationIds = await fabric.destinationIdsFor(fabric.nodeId, initiatorRandom);
|
|
249
244
|
if (candidateDestinationIds.some(candidate => Bytes.areEqual(candidate, destinationId))) {
|
|
245
|
+
if (fabric.isDeleting) {
|
|
246
|
+
throw new FabricNotFoundError("Fabric is deleting");
|
|
247
|
+
}
|
|
248
|
+
|
|
250
249
|
return fabric;
|
|
251
250
|
}
|
|
252
251
|
}
|
|
@@ -257,7 +256,7 @@ export class FabricManager {
|
|
|
257
256
|
findByKeypair(keypair: Key) {
|
|
258
257
|
this.#construction.assert();
|
|
259
258
|
|
|
260
|
-
for (const fabric of this
|
|
259
|
+
for (const fabric of this.fabrics) {
|
|
261
260
|
if (fabric.matchesKeyPair(keypair)) {
|
|
262
261
|
return fabric;
|
|
263
262
|
}
|
|
@@ -265,10 +264,26 @@ export class FabricManager {
|
|
|
265
264
|
return undefined;
|
|
266
265
|
}
|
|
267
266
|
|
|
268
|
-
|
|
267
|
+
maybeForIndex(index: FabricIndex) {
|
|
269
268
|
this.#construction.assert();
|
|
270
269
|
|
|
271
|
-
|
|
270
|
+
const fabric = this.#fabrics.get(index);
|
|
271
|
+
if (fabric && !fabric.isDeleting) {
|
|
272
|
+
return fabric;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
forIndex(index: FabricIndex) {
|
|
277
|
+
this.#construction.assert();
|
|
278
|
+
|
|
279
|
+
const fabric = this.#fabrics.get(index);
|
|
280
|
+
if (fabric === undefined) {
|
|
281
|
+
throw new FabricNotFoundError(`Fabric index ${index} does not exist`);
|
|
282
|
+
}
|
|
283
|
+
if (fabric.isDeleting) {
|
|
284
|
+
throw new FabricNotFoundError(`Fabric index ${index} is deleting`);
|
|
285
|
+
}
|
|
286
|
+
return fabric;
|
|
272
287
|
}
|
|
273
288
|
|
|
274
289
|
forDescriptor(descriptor: { rootPublicKey: Bytes; fabricId: FabricId }) {
|
|
@@ -281,14 +296,14 @@ export class FabricManager {
|
|
|
281
296
|
);
|
|
282
297
|
}
|
|
283
298
|
|
|
284
|
-
async
|
|
299
|
+
async replaceFabric(fabric: Fabric) {
|
|
285
300
|
await this.#construction;
|
|
286
301
|
|
|
287
302
|
const { fabricIndex } = fabric;
|
|
288
303
|
const existingFabric = this.#fabrics.get(fabricIndex);
|
|
289
304
|
if (existingFabric === undefined) {
|
|
290
305
|
throw new FabricNotFoundError(
|
|
291
|
-
`Fabric with index ${fabricIndex} cannot be
|
|
306
|
+
`Fabric with index ${fabricIndex} cannot be replaced because it does not exist.`,
|
|
292
307
|
);
|
|
293
308
|
}
|
|
294
309
|
if (existingFabric === fabric) {
|
|
@@ -301,16 +316,14 @@ export class FabricManager {
|
|
|
301
316
|
if (this.#storage) {
|
|
302
317
|
await this.persistFabrics();
|
|
303
318
|
}
|
|
304
|
-
this.#events.
|
|
319
|
+
this.#events.replaced.emit(fabric);
|
|
305
320
|
}
|
|
321
|
+
}
|
|
306
322
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
await fabric.remove();
|
|
315
|
-
}
|
|
323
|
+
// Log unhandled errors but do not abort deletion. We will still likely end up with inconsistent state but should be
|
|
324
|
+
// less harmful (and more secure) if we allow other observers to proceed
|
|
325
|
+
function unhandled(what: string) {
|
|
326
|
+
return (e: Error, observer: Observer) => {
|
|
327
|
+
logger.error(`Unhandled error in fabric ${what} observer ${observer.name || "(anon)"}`, e);
|
|
328
|
+
};
|
|
316
329
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// Must import first to avoid ESM load issues
|
|
8
|
+
export * from "./session/index.js";
|
|
9
|
+
|
|
7
10
|
export * from "./action/index.js";
|
|
8
11
|
export * from "./advertisement/index.js";
|
|
9
12
|
export * from "./bdx/index.js";
|
|
@@ -21,4 +24,3 @@ export * from "./mdns/index.js";
|
|
|
21
24
|
export * from "./peer/index.js";
|
|
22
25
|
export * from "./protocol/index.js";
|
|
23
26
|
export * from "./securechannel/index.js";
|
|
24
|
-
export * from "./session/index.js";
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { ReadScope } from "#action/client/ReadScope.js";
|
|
8
8
|
import { AccessControl } from "#clusters/access-control";
|
|
9
|
+
import { Mark } from "#common/Mark.js";
|
|
9
10
|
import {
|
|
10
11
|
Diagnostic,
|
|
11
12
|
Duration,
|
|
@@ -27,6 +28,7 @@ import { Specification } from "#model";
|
|
|
27
28
|
import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
|
|
28
29
|
import { PeerDataStore } from "#peer/PeerAddressStore.js";
|
|
29
30
|
import { PeerConnectionOptions, PeerSet } from "#peer/PeerSet.js";
|
|
31
|
+
import { SecureSession } from "#session/SecureSession.js";
|
|
30
32
|
import {
|
|
31
33
|
ArraySchema,
|
|
32
34
|
Attribute,
|
|
@@ -57,11 +59,11 @@ import {
|
|
|
57
59
|
resolveEventName,
|
|
58
60
|
} from "#types";
|
|
59
61
|
import { ExchangeProvider, ReconnectableExchangeProvider } from "../protocol/ExchangeProvider.js";
|
|
60
|
-
import { MessageChannel } from "../protocol/MessageChannel.js";
|
|
61
62
|
import { DecodedAttributeReportStatus, DecodedAttributeReportValue } from "./AttributeDataDecoder.js";
|
|
62
63
|
import { DecodedDataReport } from "./DecodedDataReport.js";
|
|
63
64
|
import { DecodedEventData, DecodedEventReportStatus, DecodedEventReportValue } from "./EventDataDecoder.js";
|
|
64
65
|
import { InteractionClientMessenger, ReadRequest } from "./InteractionMessenger.js";
|
|
66
|
+
import { Subscription } from "./Subscription.js";
|
|
65
67
|
import { RegisteredSubscription, SubscriptionClient } from "./SubscriptionClient.js";
|
|
66
68
|
|
|
67
69
|
const logger = Logger.get("InteractionClient");
|
|
@@ -97,7 +99,7 @@ export class InteractionClientProvider {
|
|
|
97
99
|
constructor(peers: PeerSet) {
|
|
98
100
|
this.#peers = peers;
|
|
99
101
|
this.#peers.deleted.on(peer => this.#onPeerLoss(peer.address));
|
|
100
|
-
this.#peers.disconnected.on(
|
|
102
|
+
this.#peers.disconnected.on(peer => this.#onPeerLoss(peer.address));
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
static [Environmental.create](env: Environment) {
|
|
@@ -126,8 +128,8 @@ export class InteractionClientProvider {
|
|
|
126
128
|
return this.getInteractionClient(address, options);
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
async
|
|
130
|
-
const exchangeProvider = await this.#peers.exchangeProviderFor(
|
|
131
|
+
async interactionClientFor(session: SecureSession): Promise<InteractionClient> {
|
|
132
|
+
const exchangeProvider = await this.#peers.exchangeProviderFor(session);
|
|
131
133
|
|
|
132
134
|
return new InteractionClient(
|
|
133
135
|
exchangeProvider,
|
|
@@ -144,7 +146,7 @@ export class InteractionClientProvider {
|
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
const isGroupAddress = PeerAddress.isGroup(address);
|
|
147
|
-
const nodeStore = isGroupAddress ? undefined : this.#peers.get(address)?.dataStore;
|
|
149
|
+
const nodeStore = isGroupAddress ? undefined : this.#peers.get(address)?.descriptor.dataStore;
|
|
148
150
|
await nodeStore?.construction; // Lazy initialize the data if not already done
|
|
149
151
|
|
|
150
152
|
const exchangeProvider = await this.#peers.exchangeProviderFor(address, options);
|
|
@@ -554,7 +556,8 @@ export class InteractionClient {
|
|
|
554
556
|
): Promise<DecodedDataReport> {
|
|
555
557
|
const { attributeRequests, eventRequests, dataVersionFilters, eventFilters, isFabricFiltered } = request;
|
|
556
558
|
logger.debug(() => [
|
|
557
|
-
"Read
|
|
559
|
+
"Read",
|
|
560
|
+
Mark.OUTBOUND,
|
|
558
561
|
messenger.exchange.via,
|
|
559
562
|
Diagnostic.dict({
|
|
560
563
|
attributes: attributeRequests?.length
|
|
@@ -590,7 +593,8 @@ export class InteractionClient {
|
|
|
590
593
|
|
|
591
594
|
if (attributeReports.length || eventReports.length || attributeStatus?.length || eventStatus?.length) {
|
|
592
595
|
logger.debug(() => [
|
|
593
|
-
"Read
|
|
596
|
+
"Read",
|
|
597
|
+
Mark.INBOUND,
|
|
594
598
|
messenger.exchange.via,
|
|
595
599
|
Diagnostic.dict({
|
|
596
600
|
attributes: attributeReports.length
|
|
@@ -611,7 +615,7 @@ export class InteractionClient {
|
|
|
611
615
|
}),
|
|
612
616
|
]);
|
|
613
617
|
} else {
|
|
614
|
-
logger.debug("Read
|
|
618
|
+
logger.debug("Read", Mark.INBOUND, messenger.exchange.via, "empty response");
|
|
615
619
|
}
|
|
616
620
|
|
|
617
621
|
return response;
|
|
@@ -739,7 +743,8 @@ export class InteractionClient {
|
|
|
739
743
|
}
|
|
740
744
|
|
|
741
745
|
logger.debug(() => [
|
|
742
|
-
"Write
|
|
746
|
+
"Write",
|
|
747
|
+
Mark.OUTBOUND,
|
|
743
748
|
messenger.exchange.via,
|
|
744
749
|
Diagnostic.dict({
|
|
745
750
|
attributes: attributes
|
|
@@ -818,7 +823,7 @@ export class InteractionClient {
|
|
|
818
823
|
if (!keepSubscriptions) {
|
|
819
824
|
for (const subscriptionId of this.#ownSubscriptionIds) {
|
|
820
825
|
logger.debug(
|
|
821
|
-
`Removing subscription
|
|
826
|
+
`Removing subscription ${Subscription.idStrOf(subscriptionId)} from InteractionClient because new subscription replaces it`,
|
|
822
827
|
);
|
|
823
828
|
this.removeSubscription(subscriptionId);
|
|
824
829
|
}
|
|
@@ -848,7 +853,8 @@ export class InteractionClient {
|
|
|
848
853
|
maximumPeerResponseTime: Duration;
|
|
849
854
|
}>(async messenger => {
|
|
850
855
|
logger.debug(() => [
|
|
851
|
-
"Subscribe
|
|
856
|
+
"Subscribe",
|
|
857
|
+
Mark.OUTBOUND,
|
|
852
858
|
messenger.exchange.via,
|
|
853
859
|
Diagnostic.dict({
|
|
854
860
|
attributes: resolveAttributeName({ endpointId, clusterId, attributeId }),
|
|
@@ -953,7 +959,8 @@ export class InteractionClient {
|
|
|
953
959
|
maximumPeerResponseTime: Duration;
|
|
954
960
|
}>(async messenger => {
|
|
955
961
|
logger.debug(() => [
|
|
956
|
-
"Subscribe
|
|
962
|
+
"Subscribe",
|
|
963
|
+
Mark.OUTBOUND,
|
|
957
964
|
messenger.exchange.via,
|
|
958
965
|
Diagnostic.dict({
|
|
959
966
|
events: resolveEventName({ endpointId, clusterId, eventId }),
|
|
@@ -1091,7 +1098,7 @@ export class InteractionClient {
|
|
|
1091
1098
|
if (!keepSubscriptions) {
|
|
1092
1099
|
for (const subscriptionId of this.#ownSubscriptionIds) {
|
|
1093
1100
|
logger.debug(
|
|
1094
|
-
`Removing subscription with ID ${subscriptionId} from InteractionClient because new subscription replaces it`,
|
|
1101
|
+
`Removing subscription with ID ${Subscription.idStrOf(subscriptionId)} from InteractionClient because new subscription replaces it`,
|
|
1095
1102
|
);
|
|
1096
1103
|
this.removeSubscription(subscriptionId);
|
|
1097
1104
|
}
|
|
@@ -1124,7 +1131,8 @@ export class InteractionClient {
|
|
|
1124
1131
|
maximumPeerResponseTime: Duration;
|
|
1125
1132
|
}>(async messenger => {
|
|
1126
1133
|
logger.debug(() => [
|
|
1127
|
-
"Subscribe
|
|
1134
|
+
"Subscribe",
|
|
1135
|
+
Mark.OUTBOUND,
|
|
1128
1136
|
messenger.exchange.via,
|
|
1129
1137
|
Diagnostic.dict({
|
|
1130
1138
|
attributes: attributeRequests.length
|
|
@@ -1157,10 +1165,11 @@ export class InteractionClient {
|
|
|
1157
1165
|
);
|
|
1158
1166
|
|
|
1159
1167
|
logger.info(
|
|
1160
|
-
"Subscription successful
|
|
1168
|
+
"Subscription successful",
|
|
1169
|
+
Mark.INBOUND,
|
|
1161
1170
|
messenger.exchange.via,
|
|
1162
1171
|
Diagnostic.dict({
|
|
1163
|
-
|
|
1172
|
+
...Subscription.diagnosticOf(subscribeResponse.subscriptionId),
|
|
1164
1173
|
maxInterval: Duration.format(Seconds(subscribeResponse.maxInterval)),
|
|
1165
1174
|
}),
|
|
1166
1175
|
);
|
|
@@ -1187,10 +1196,12 @@ export class InteractionClient {
|
|
|
1187
1196
|
const { attributeReports, eventReports } = dataReport;
|
|
1188
1197
|
|
|
1189
1198
|
// We emit events first because events usually happened and lead to a new final attribute value
|
|
1190
|
-
if (eventReports
|
|
1199
|
+
if (eventReports?.length) {
|
|
1191
1200
|
let maxEventNumber = this.#nodeStore?.maxEventNumber ?? eventReports[0].events[0].eventNumber;
|
|
1192
1201
|
eventReports.forEach(data => {
|
|
1193
|
-
logger.debug(
|
|
1202
|
+
logger.debug(
|
|
1203
|
+
`Event update ${Mark.INBOUND} ${resolveEventName(data.path)}: ${Diagnostic.json(data.events)}`,
|
|
1204
|
+
);
|
|
1194
1205
|
const { events } = data;
|
|
1195
1206
|
|
|
1196
1207
|
maxEventNumber =
|
|
@@ -1261,7 +1272,7 @@ export class InteractionClient {
|
|
|
1261
1272
|
await this.#nodeStore?.persistAttributes([data], scope);
|
|
1262
1273
|
}
|
|
1263
1274
|
logger.debug(
|
|
1264
|
-
`Attribute update
|
|
1275
|
+
`Attribute update ${Mark.INBOUND}${changed ? " (value changed)" : ""}: ${resolveAttributeName({
|
|
1265
1276
|
endpointId,
|
|
1266
1277
|
clusterId,
|
|
1267
1278
|
attributeId,
|
|
@@ -1406,11 +1417,15 @@ export class InteractionClient {
|
|
|
1406
1417
|
}
|
|
1407
1418
|
const response = responseSchema.decodeTlv(commandFields);
|
|
1408
1419
|
logger.debug(
|
|
1409
|
-
|
|
1420
|
+
"Invoke",
|
|
1421
|
+
Mark.INBOUND,
|
|
1422
|
+
resolveCommandName({
|
|
1410
1423
|
endpointId,
|
|
1411
1424
|
clusterId,
|
|
1412
1425
|
commandId: requestId,
|
|
1413
|
-
})
|
|
1426
|
+
}),
|
|
1427
|
+
"with",
|
|
1428
|
+
Diagnostic.json(response),
|
|
1414
1429
|
);
|
|
1415
1430
|
return response;
|
|
1416
1431
|
}
|
|
@@ -1480,11 +1495,13 @@ export class InteractionClient {
|
|
|
1480
1495
|
}, executeQueued);
|
|
1481
1496
|
|
|
1482
1497
|
logger.debug(
|
|
1483
|
-
|
|
1498
|
+
"Invoke successful",
|
|
1499
|
+
Mark.INBOUND,
|
|
1500
|
+
resolveCommandName({
|
|
1484
1501
|
endpointId,
|
|
1485
1502
|
clusterId,
|
|
1486
1503
|
commandId: requestId,
|
|
1487
|
-
})
|
|
1504
|
+
}),
|
|
1488
1505
|
);
|
|
1489
1506
|
}
|
|
1490
1507
|
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { ReadResult } from "#action/response/ReadResult.js";
|
|
8
|
+
import { Mark } from "#common/Mark.js";
|
|
8
9
|
import {
|
|
9
10
|
Bytes,
|
|
10
11
|
Diagnostic,
|
|
11
12
|
Duration,
|
|
13
|
+
hex,
|
|
12
14
|
InternalError,
|
|
13
15
|
Logger,
|
|
14
16
|
MatterFlowError,
|
|
@@ -19,14 +21,13 @@ import {
|
|
|
19
21
|
import { DecodedAttributeReportValue } from "#interaction/AttributeDataDecoder.js";
|
|
20
22
|
import { DecodedDataReport } from "#interaction/DecodedDataReport.js";
|
|
21
23
|
import { Specification } from "#model";
|
|
22
|
-
import {
|
|
24
|
+
import { RetransmissionLimitReachedError, SessionClosedError, UnexpectedMessageError } from "#protocol/errors.js";
|
|
23
25
|
import {
|
|
24
26
|
AttributeId,
|
|
25
27
|
ClusterId,
|
|
26
28
|
EndpointNumber,
|
|
27
29
|
ReceivedStatusResponseError,
|
|
28
30
|
Status,
|
|
29
|
-
StatusCode,
|
|
30
31
|
StatusResponseError,
|
|
31
32
|
TlvAny,
|
|
32
33
|
TlvAttributeReport,
|
|
@@ -48,12 +49,7 @@ import {
|
|
|
48
49
|
} from "#types";
|
|
49
50
|
import { Message, SessionType } from "../codec/MessageCodec.js";
|
|
50
51
|
import { ExchangeProvider } from "../protocol/ExchangeProvider.js";
|
|
51
|
-
import {
|
|
52
|
-
ExchangeSendOptions,
|
|
53
|
-
MessageExchange,
|
|
54
|
-
RetransmissionLimitReachedError,
|
|
55
|
-
UnexpectedMessageError,
|
|
56
|
-
} from "../protocol/MessageExchange.js";
|
|
52
|
+
import { ExchangeSendOptions, MessageExchange } from "../protocol/MessageExchange.js";
|
|
57
53
|
import {
|
|
58
54
|
AttributeReportPayload,
|
|
59
55
|
BaseDataReport,
|
|
@@ -65,6 +61,7 @@ import {
|
|
|
65
61
|
encodeEventPayload,
|
|
66
62
|
EventReportPayload,
|
|
67
63
|
} from "./AttributeDataEncoder.js";
|
|
64
|
+
import { Subscription } from "./Subscription.js";
|
|
68
65
|
|
|
69
66
|
export enum MessageType {
|
|
70
67
|
StatusResponse = 0x01,
|
|
@@ -123,7 +120,7 @@ class InteractionMessenger {
|
|
|
123
120
|
return this.exchange.send(messageType, payload, options);
|
|
124
121
|
}
|
|
125
122
|
|
|
126
|
-
sendStatus(status:
|
|
123
|
+
sendStatus(status: Status, options?: ExchangeSendOptions) {
|
|
127
124
|
return this.send(
|
|
128
125
|
MessageType.StatusResponse,
|
|
129
126
|
TlvStatusResponse.encode({ status, interactionModelRevision: Specification.INTERACTION_MODEL_REVISION }),
|
|
@@ -131,7 +128,7 @@ class InteractionMessenger {
|
|
|
131
128
|
...options,
|
|
132
129
|
logContext: {
|
|
133
130
|
for: options?.logContext?.for ? `I/Status-${options?.logContext?.for}` : undefined,
|
|
134
|
-
status: `${
|
|
131
|
+
status: `${Status[status] ?? "unknown"}(${Diagnostic.hex(status)})`,
|
|
135
132
|
...options?.logContext,
|
|
136
133
|
},
|
|
137
134
|
},
|
|
@@ -202,7 +199,7 @@ class InteractionMessenger {
|
|
|
202
199
|
|
|
203
200
|
if (messageType !== MessageType.StatusResponse) return;
|
|
204
201
|
const { status } = TlvStatusResponse.decode(payload);
|
|
205
|
-
if (status !==
|
|
202
|
+
if (status !== Status.Success)
|
|
206
203
|
throw new ReceivedStatusResponseError(
|
|
207
204
|
`Received error status: ${status}${logHint ? ` (${logHint})` : ""}`,
|
|
208
205
|
status,
|
|
@@ -305,7 +302,7 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
305
302
|
}
|
|
306
303
|
const timedRequest = TlvTimedRequest.decode(message.payload);
|
|
307
304
|
recipient.handleTimedRequest(this.exchange, timedRequest, message);
|
|
308
|
-
await this.sendStatus(
|
|
305
|
+
await this.sendStatus(Status.Success, {
|
|
309
306
|
logContext: { for: "TimedRequest" },
|
|
310
307
|
});
|
|
311
308
|
continueExchange = true;
|
|
@@ -321,17 +318,28 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
321
318
|
break; // We do not support multiple messages in group sessions
|
|
322
319
|
}
|
|
323
320
|
}
|
|
324
|
-
} catch (error
|
|
325
|
-
|
|
321
|
+
} catch (error) {
|
|
322
|
+
if (error instanceof NoResponseTimeoutError) {
|
|
323
|
+
logger.info(this.exchange.via, error);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
let errorStatusCode = Status.Failure;
|
|
326
328
|
if (error instanceof StatusResponseError) {
|
|
327
|
-
logger.info(
|
|
329
|
+
logger.info(
|
|
330
|
+
this.exchange.via,
|
|
331
|
+
"Status response",
|
|
332
|
+
Mark.OUTBOUND,
|
|
333
|
+
Diagnostic.strong(`${Status[error.code]}#${error.code}`),
|
|
334
|
+
"due to error:",
|
|
335
|
+
Diagnostic.errorMessage(error),
|
|
336
|
+
);
|
|
328
337
|
errorStatusCode = error.code;
|
|
329
|
-
} else if (error instanceof NoResponseTimeoutError) {
|
|
330
|
-
logger.info(error);
|
|
331
338
|
} else {
|
|
332
|
-
logger.warn(error);
|
|
339
|
+
logger.warn(this.exchange.via, error);
|
|
333
340
|
}
|
|
334
|
-
|
|
341
|
+
|
|
342
|
+
if (!isGroupSession) {
|
|
335
343
|
await this.sendStatus(errorStatusCode);
|
|
336
344
|
}
|
|
337
345
|
} finally {
|
|
@@ -687,7 +695,7 @@ export class InteractionServerMessenger extends InteractionMessenger {
|
|
|
687
695
|
}
|
|
688
696
|
|
|
689
697
|
const logContext = {
|
|
690
|
-
|
|
698
|
+
...Subscription.diagnosticOf(dataReportToSend),
|
|
691
699
|
interactionFlags: Diagnostic.asFlags({
|
|
692
700
|
empty: !dataReportToSend.attributeReports?.length && !dataReportToSend.eventReports?.length,
|
|
693
701
|
suppressResponse: dataReportToSend.suppressResponse,
|
|
@@ -920,22 +928,20 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
|
|
|
920
928
|
for await (const report of this.readDataReports()) {
|
|
921
929
|
if (expectedSubscriptionIds !== undefined) {
|
|
922
930
|
if (report.subscriptionId === undefined || !expectedSubscriptionIds.includes(report.subscriptionId)) {
|
|
923
|
-
await this.sendStatus(
|
|
931
|
+
await this.sendStatus(Status.InvalidSubscription, {
|
|
924
932
|
multipleMessageInteraction: true,
|
|
925
|
-
logContext:
|
|
926
|
-
subId: report.subscriptionId,
|
|
927
|
-
},
|
|
933
|
+
logContext: Subscription.diagnosticOf(report),
|
|
928
934
|
});
|
|
929
935
|
throw new UnexpectedDataError(
|
|
930
936
|
report.subscriptionId === undefined
|
|
931
937
|
? "Invalid Data report without Subscription ID"
|
|
932
|
-
: `Invalid Data report with unexpected subscription ID ${report
|
|
938
|
+
: `Invalid Data report with unexpected subscription ID ${Subscription.idStrOf(report)}`,
|
|
933
939
|
);
|
|
934
940
|
}
|
|
935
941
|
}
|
|
936
942
|
|
|
937
943
|
if (result?.subscriptionId !== undefined && report.subscriptionId !== result.subscriptionId) {
|
|
938
|
-
throw new UnexpectedDataError(`Invalid subscription ID ${report
|
|
944
|
+
throw new UnexpectedDataError(`Invalid subscription ID ${Subscription.idStrOf(report)} received`);
|
|
939
945
|
}
|
|
940
946
|
|
|
941
947
|
report.attributeReports = report.attributeReports ?? [];
|
|
@@ -987,14 +993,14 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
|
|
|
987
993
|
yield report;
|
|
988
994
|
|
|
989
995
|
if (report.moreChunkedMessages) {
|
|
990
|
-
await this.sendStatus(
|
|
996
|
+
await this.sendStatus(Status.Success, {
|
|
991
997
|
multipleMessageInteraction: true,
|
|
992
998
|
logContext: this.#logContextOf(report),
|
|
993
999
|
});
|
|
994
1000
|
} else if (!report.suppressResponse) {
|
|
995
1001
|
// We received the last message and need to send a final success, but we do not need to wait for it and
|
|
996
1002
|
// also don't care if it fails
|
|
997
|
-
this.sendStatus(
|
|
1003
|
+
this.sendStatus(Status.Success, {
|
|
998
1004
|
multipleMessageInteraction: true,
|
|
999
1005
|
logContext: this.#logContextOf(report),
|
|
1000
1006
|
}).catch(error => logger.info("Error sending success after final data report chunk", error));
|
|
@@ -1008,7 +1014,7 @@ export class IncomingInteractionClientMessenger extends InteractionMessenger {
|
|
|
1008
1014
|
|
|
1009
1015
|
#logContextOf(report: DataReport) {
|
|
1010
1016
|
return {
|
|
1011
|
-
subId: report.subscriptionId,
|
|
1017
|
+
subId: report.subscriptionId === undefined ? undefined : hex.fixed(report.subscriptionId, 8),
|
|
1012
1018
|
dataReportFlags: Diagnostic.asFlags({
|
|
1013
1019
|
empty: !report.attributeReports?.length && !report.eventReports?.length,
|
|
1014
1020
|
suppressResponse: report.suppressResponse,
|
|
@@ -1037,14 +1043,14 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
1037
1043
|
override async send(messageType: number, payload: Bytes, options?: ExchangeSendOptions) {
|
|
1038
1044
|
try {
|
|
1039
1045
|
if (this.exchange.channel.closed) {
|
|
1040
|
-
throw new
|
|
1046
|
+
throw new SessionClosedError("The exchange channel is closed. Please connect the device first.");
|
|
1041
1047
|
}
|
|
1042
1048
|
|
|
1043
1049
|
return await this.exchange.send(messageType, payload, options);
|
|
1044
1050
|
} catch (error) {
|
|
1045
1051
|
if (
|
|
1046
1052
|
this.#exchangeProvider.supportsReconnect &&
|
|
1047
|
-
(error instanceof RetransmissionLimitReachedError || error instanceof
|
|
1053
|
+
(error instanceof RetransmissionLimitReachedError || error instanceof SessionClosedError) &&
|
|
1048
1054
|
!options?.multipleMessageInteraction
|
|
1049
1055
|
) {
|
|
1050
1056
|
// When retransmission failed (most likely due to a lost connection or invalid session),
|
|
@@ -1139,7 +1145,7 @@ export class InteractionClientMessenger extends IncomingInteractionClientMesseng
|
|
|
1139
1145
|
|
|
1140
1146
|
if (subscribeResponse.subscriptionId !== subscriptionId) {
|
|
1141
1147
|
throw new MatterFlowError(
|
|
1142
|
-
`Received subscription ID ${subscribeResponse.subscriptionId} instead of ${subscriptionId}`,
|
|
1148
|
+
`Received subscription ID ${Subscription.idStrOf(subscribeResponse.subscriptionId)} instead of ${Subscription.idStrOf(subscriptionId)}`,
|
|
1143
1149
|
);
|
|
1144
1150
|
}
|
|
1145
1151
|
|