@matter/protocol 0.16.0-alpha.0-20251029-bd92894d4 → 0.16.0-alpha.0-20251031-0f308af69

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 (33) hide show
  1. package/dist/cjs/action/errors.d.ts +7 -2
  2. package/dist/cjs/action/errors.d.ts.map +1 -1
  3. package/dist/cjs/action/errors.js +6 -3
  4. package/dist/cjs/action/errors.js.map +1 -1
  5. package/dist/cjs/interaction/InteractionClient.d.ts +2 -1
  6. package/dist/cjs/interaction/InteractionClient.d.ts.map +1 -1
  7. package/dist/cjs/interaction/InteractionClient.js +16 -5
  8. package/dist/cjs/interaction/InteractionClient.js.map +1 -1
  9. package/dist/cjs/peer/ControllerCommissioner.js +1 -1
  10. package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
  11. package/dist/cjs/peer/PeerSet.d.ts +1 -4
  12. package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
  13. package/dist/cjs/peer/PeerSet.js +1 -16
  14. package/dist/cjs/peer/PeerSet.js.map +1 -1
  15. package/dist/esm/action/errors.d.ts +7 -2
  16. package/dist/esm/action/errors.d.ts.map +1 -1
  17. package/dist/esm/action/errors.js +6 -3
  18. package/dist/esm/action/errors.js.map +1 -1
  19. package/dist/esm/interaction/InteractionClient.d.ts +2 -1
  20. package/dist/esm/interaction/InteractionClient.d.ts.map +1 -1
  21. package/dist/esm/interaction/InteractionClient.js +16 -5
  22. package/dist/esm/interaction/InteractionClient.js.map +1 -1
  23. package/dist/esm/peer/ControllerCommissioner.js +1 -1
  24. package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
  25. package/dist/esm/peer/PeerSet.d.ts +1 -4
  26. package/dist/esm/peer/PeerSet.d.ts.map +1 -1
  27. package/dist/esm/peer/PeerSet.js +1 -16
  28. package/dist/esm/peer/PeerSet.js.map +1 -1
  29. package/package.json +6 -6
  30. package/src/action/errors.ts +11 -6
  31. package/src/interaction/InteractionClient.ts +18 -6
  32. package/src/peer/ControllerCommissioner.ts +1 -1
  33. package/src/peer/PeerSet.ts +1 -18
@@ -92,6 +92,7 @@ export interface AttributeStatus {
92
92
  export class InteractionClientProvider {
93
93
  readonly #peers: PeerSet;
94
94
  readonly #clients = new PeerAddressMap<InteractionClient>();
95
+ readonly #subscriptionClient = new SubscriptionClient();
95
96
 
96
97
  constructor(peers: PeerSet) {
97
98
  this.#peers = peers;
@@ -109,6 +110,10 @@ export class InteractionClientProvider {
109
110
  return this.#peers;
110
111
  }
111
112
 
113
+ get subscriptionClient() {
114
+ return this.#subscriptionClient;
115
+ }
116
+
112
117
  async connect(
113
118
  address: PeerAddress,
114
119
  options: PeerConnectionOptions & {
@@ -126,7 +131,7 @@ export class InteractionClientProvider {
126
131
 
127
132
  return new InteractionClient(
128
133
  exchangeProvider,
129
- this.#peers.subscriptionClient,
134
+ this.#subscriptionClient,
130
135
  undefined,
131
136
  this.#peers.interactionQueue,
132
137
  );
@@ -146,7 +151,7 @@ export class InteractionClientProvider {
146
151
 
147
152
  client = new InteractionClient(
148
153
  exchangeProvider,
149
- this.#peers.subscriptionClient,
154
+ this.#subscriptionClient,
150
155
  address,
151
156
  this.#peers.interactionQueue,
152
157
  nodeStore,
@@ -169,14 +174,21 @@ export class InteractionClient {
169
174
  readonly #exchangeProvider: ExchangeProvider;
170
175
  readonly #nodeStore?: PeerDataStore;
171
176
  readonly #ownSubscriptionIds = new Set<number>();
172
- readonly #subscriptionClient: SubscriptionClient;
173
177
  readonly #queue?: PromiseQueue;
174
178
  readonly #address?: PeerAddress;
175
179
  readonly isGroupAddress: boolean;
176
180
 
181
+ // TODO - SubscriptionClient is used by CommissioningController but not ClientNode. However InteractionClient *is*
182
+ // used by ClientNode to perform commissioning, during which time SubscriptionClient is unnecessary. So this should
183
+ // be set after commissioning
184
+ //
185
+ // If we remove CommissioningController then this entire class goes away; if we first move commissioning to
186
+ // ClientInteraction then this should become required
187
+ readonly #subscriptionClient?: SubscriptionClient;
188
+
177
189
  constructor(
178
190
  exchangeProvider: ExchangeProvider,
179
- subscriptionClient: SubscriptionClient,
191
+ subscriptionClient?: SubscriptionClient,
180
192
  address?: PeerAddress,
181
193
  queue?: PromiseQueue,
182
194
  nodeStore?: PeerDataStore,
@@ -214,7 +226,7 @@ export class InteractionClient {
214
226
 
215
227
  removeSubscription(subscriptionId: number) {
216
228
  this.#ownSubscriptionIds.delete(subscriptionId);
217
- this.#subscriptionClient.delete(subscriptionId);
229
+ this.#subscriptionClient?.delete(subscriptionId);
218
230
  }
219
231
 
220
232
  async getAllAttributes(
@@ -892,7 +904,7 @@ export class InteractionClient {
892
904
 
893
905
  async #registerSubscription(subscription: RegisteredSubscription, initialReport: DecodedDataReport) {
894
906
  this.#ownSubscriptionIds.add(subscription.id);
895
- this.#subscriptionClient.add(subscription);
907
+ this.#subscriptionClient?.add(subscription);
896
908
  await subscription.onData(initialReport);
897
909
  }
898
910
 
@@ -467,7 +467,7 @@ export class ControllerCommissioner {
467
467
  // Use the created secure session to do the commissioning
468
468
  new InteractionClient(
469
469
  new DedicatedChannelExchangeProvider(this.#context.exchanges, paseSecureMessageChannel),
470
- this.#context.clients.peers.subscriptionClient,
470
+ undefined,
471
471
  address,
472
472
  ),
473
473
  this.#context.ca,
@@ -32,7 +32,6 @@ import {
32
32
  Time,
33
33
  Timer,
34
34
  } from "#general";
35
- import { SubscriptionClient } from "#interaction/SubscriptionClient.js";
36
35
  import { MdnsClient } from "#mdns/MdnsClient.js";
37
36
  import { PeerAddress, PeerAddressMap } from "#peer/PeerAddress.js";
38
37
  import { ChannelManager } from "#protocol/ChannelManager.js";
@@ -107,7 +106,6 @@ export interface PeerSetContext {
107
106
  sessions: SessionManager;
108
107
  channels: ChannelManager;
109
108
  exchanges: ExchangeManager;
110
- subscriptionClient: SubscriptionClient;
111
109
  scanners: ScannerSet;
112
110
  transports: ConnectionlessTransportSet;
113
111
  store: PeerAddressStore;
@@ -120,7 +118,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
120
118
  readonly #sessions: SessionManager;
121
119
  readonly #channels: ChannelManager;
122
120
  readonly #exchanges: ExchangeManager;
123
- readonly #subscriptionClient: SubscriptionClient;
124
121
  readonly #scanners: ScannerSet;
125
122
  readonly #transports: ConnectionlessTransportSet;
126
123
  readonly #caseClient: CaseClient;
@@ -138,20 +135,11 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
138
135
  readonly #disconnected = AsyncObservable<[address: PeerAddress]>();
139
136
 
140
137
  constructor(context: PeerSetContext) {
141
- const {
142
- sessions,
143
- channels,
144
- exchanges,
145
- subscriptionClient,
146
- scanners,
147
- transports: netInterfaces,
148
- store,
149
- } = context;
138
+ const { sessions, channels, exchanges, scanners, transports: netInterfaces, store } = context;
150
139
 
151
140
  this.#sessions = sessions;
152
141
  this.#channels = channels;
153
142
  this.#exchanges = exchanges;
154
- this.#subscriptionClient = subscriptionClient;
155
143
  this.#scanners = scanners;
156
144
  this.#transports = netInterfaces;
157
145
  this.#store = store;
@@ -241,7 +229,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
241
229
  sessions: env.get(SessionManager),
242
230
  channels: env.get(ChannelManager),
243
231
  exchanges: env.get(ExchangeManager),
244
- subscriptionClient: env.get(SubscriptionClient),
245
232
  scanners: env.get(ScannerSet),
246
233
  transports: env.get(ConnectionlessTransportSet),
247
234
  store: env.get(PeerAddressStore),
@@ -254,10 +241,6 @@ export class PeerSet implements ImmutableSet<OperationalPeer>, ObservableSet<Ope
254
241
  return this.#peers;
255
242
  }
256
243
 
257
- get subscriptionClient() {
258
- return this.#subscriptionClient;
259
- }
260
-
261
244
  get interactionQueue() {
262
245
  return this.#interactionQueue;
263
246
  }