@matter/protocol 0.13.1-alpha.0-20250509-28e1567e1 → 0.13.1-alpha.0-20250515-a4c61c546

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 (118) hide show
  1. package/dist/cjs/action/protocols.d.ts +59 -2
  2. package/dist/cjs/action/protocols.d.ts.map +1 -1
  3. package/dist/cjs/action/request/Read.d.ts +2 -2
  4. package/dist/cjs/action/request/Read.d.ts.map +1 -1
  5. package/dist/cjs/action/request/Read.js +4 -4
  6. package/dist/cjs/action/request/Read.js.map +1 -1
  7. package/dist/cjs/action/response/ReadResult.d.ts +6 -2
  8. package/dist/cjs/action/response/ReadResult.d.ts.map +1 -1
  9. package/dist/cjs/action/server/AttributeResponse.d.ts +46 -17
  10. package/dist/cjs/action/server/AttributeResponse.d.ts.map +1 -1
  11. package/dist/cjs/action/server/AttributeResponse.js +128 -110
  12. package/dist/cjs/action/server/AttributeResponse.js.map +2 -2
  13. package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts +36 -0
  14. package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts.map +1 -0
  15. package/dist/cjs/action/server/AttributeSubscriptionResponse.js +86 -0
  16. package/dist/cjs/action/server/AttributeSubscriptionResponse.js.map +6 -0
  17. package/dist/cjs/action/server/DataResponse.d.ts +45 -0
  18. package/dist/cjs/action/server/DataResponse.d.ts.map +1 -0
  19. package/dist/cjs/action/server/DataResponse.js +69 -0
  20. package/dist/cjs/action/server/DataResponse.js.map +6 -0
  21. package/dist/cjs/action/server/EventResponse.d.ts +28 -0
  22. package/dist/cjs/action/server/EventResponse.d.ts.map +1 -0
  23. package/dist/cjs/action/server/EventResponse.js +318 -0
  24. package/dist/cjs/action/server/EventResponse.js.map +6 -0
  25. package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
  26. package/dist/cjs/action/server/ServerInteraction.js +15 -2
  27. package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
  28. package/dist/cjs/action/server/index.d.ts +3 -0
  29. package/dist/cjs/action/server/index.d.ts.map +1 -1
  30. package/dist/cjs/action/server/index.js +3 -0
  31. package/dist/cjs/action/server/index.js.map +1 -1
  32. package/dist/cjs/events/OccurrenceManager.d.ts +20 -11
  33. package/dist/cjs/events/OccurrenceManager.d.ts.map +1 -1
  34. package/dist/cjs/events/OccurrenceManager.js +113 -74
  35. package/dist/cjs/events/OccurrenceManager.js.map +1 -1
  36. package/dist/cjs/interaction/InteractionMessenger.d.ts +14 -2
  37. package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
  38. package/dist/cjs/interaction/InteractionMessenger.js +87 -3
  39. package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
  40. package/dist/cjs/interaction/index.d.ts +0 -1
  41. package/dist/cjs/interaction/index.d.ts.map +1 -1
  42. package/dist/cjs/interaction/index.js +0 -1
  43. package/dist/cjs/interaction/index.js.map +1 -1
  44. package/dist/cjs/peer/ControllerCommissioningFlow.js +1 -1
  45. package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
  46. package/dist/cjs/protocol/MessageExchange.js +11 -1
  47. package/dist/cjs/protocol/MessageExchange.js.map +1 -1
  48. package/dist/esm/action/protocols.d.ts +59 -2
  49. package/dist/esm/action/protocols.d.ts.map +1 -1
  50. package/dist/esm/action/request/Read.d.ts +2 -2
  51. package/dist/esm/action/request/Read.d.ts.map +1 -1
  52. package/dist/esm/action/request/Read.js +4 -4
  53. package/dist/esm/action/request/Read.js.map +1 -1
  54. package/dist/esm/action/response/ReadResult.d.ts +6 -2
  55. package/dist/esm/action/response/ReadResult.d.ts.map +1 -1
  56. package/dist/esm/action/server/AttributeResponse.d.ts +46 -17
  57. package/dist/esm/action/server/AttributeResponse.d.ts.map +1 -1
  58. package/dist/esm/action/server/AttributeResponse.js +129 -113
  59. package/dist/esm/action/server/AttributeResponse.js.map +1 -1
  60. package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts +36 -0
  61. package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts.map +1 -0
  62. package/dist/esm/action/server/AttributeSubscriptionResponse.js +66 -0
  63. package/dist/esm/action/server/AttributeSubscriptionResponse.js.map +6 -0
  64. package/dist/esm/action/server/DataResponse.d.ts +45 -0
  65. package/dist/esm/action/server/DataResponse.d.ts.map +1 -0
  66. package/dist/esm/action/server/DataResponse.js +49 -0
  67. package/dist/esm/action/server/DataResponse.js.map +6 -0
  68. package/dist/esm/action/server/EventResponse.d.ts +28 -0
  69. package/dist/esm/action/server/EventResponse.d.ts.map +1 -0
  70. package/dist/esm/action/server/EventResponse.js +305 -0
  71. package/dist/esm/action/server/EventResponse.js.map +6 -0
  72. package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
  73. package/dist/esm/action/server/ServerInteraction.js +16 -3
  74. package/dist/esm/action/server/ServerInteraction.js.map +1 -1
  75. package/dist/esm/action/server/index.d.ts +3 -0
  76. package/dist/esm/action/server/index.d.ts.map +1 -1
  77. package/dist/esm/action/server/index.js +3 -0
  78. package/dist/esm/action/server/index.js.map +1 -1
  79. package/dist/esm/events/OccurrenceManager.d.ts +20 -11
  80. package/dist/esm/events/OccurrenceManager.d.ts.map +1 -1
  81. package/dist/esm/events/OccurrenceManager.js +117 -80
  82. package/dist/esm/events/OccurrenceManager.js.map +1 -1
  83. package/dist/esm/interaction/InteractionMessenger.d.ts +14 -2
  84. package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
  85. package/dist/esm/interaction/InteractionMessenger.js +87 -3
  86. package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
  87. package/dist/esm/interaction/index.d.ts +0 -1
  88. package/dist/esm/interaction/index.d.ts.map +1 -1
  89. package/dist/esm/interaction/index.js +0 -1
  90. package/dist/esm/interaction/index.js.map +1 -1
  91. package/dist/esm/peer/ControllerCommissioningFlow.js +1 -1
  92. package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
  93. package/dist/esm/protocol/MessageExchange.js +11 -1
  94. package/dist/esm/protocol/MessageExchange.js.map +1 -1
  95. package/package.json +6 -6
  96. package/src/action/protocols.ts +68 -2
  97. package/src/action/request/Read.ts +2 -2
  98. package/src/action/response/ReadResult.ts +8 -1
  99. package/src/action/server/AttributeResponse.ts +145 -118
  100. package/src/action/server/AttributeSubscriptionResponse.ts +90 -0
  101. package/src/action/server/DataResponse.ts +70 -0
  102. package/src/action/server/EventResponse.ts +381 -0
  103. package/src/action/server/ServerInteraction.ts +18 -4
  104. package/src/action/server/index.ts +3 -0
  105. package/src/events/OccurrenceManager.ts +126 -100
  106. package/src/interaction/InteractionMessenger.ts +93 -8
  107. package/src/interaction/index.ts +0 -1
  108. package/src/peer/ControllerCommissioningFlow.ts +1 -1
  109. package/src/protocol/MessageExchange.ts +13 -1
  110. package/dist/cjs/interaction/ServerSubscription.d.ts +0 -116
  111. package/dist/cjs/interaction/ServerSubscription.d.ts.map +0 -1
  112. package/dist/cjs/interaction/ServerSubscription.js +0 -778
  113. package/dist/cjs/interaction/ServerSubscription.js.map +0 -6
  114. package/dist/esm/interaction/ServerSubscription.d.ts +0 -116
  115. package/dist/esm/interaction/ServerSubscription.d.ts.map +0 -1
  116. package/dist/esm/interaction/ServerSubscription.js +0 -778
  117. package/dist/esm/interaction/ServerSubscription.js.map +0 -6
  118. package/src/interaction/ServerSubscription.ts +0 -1038
@@ -19,36 +19,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var AttributeResponse_exports = {};
20
20
  __export(AttributeResponse_exports, {
21
21
  AttributeResponse: () => AttributeResponse,
22
- FallbackLimits: () => FallbackLimits,
23
- GlobalAttrIds: () => GlobalAttrIds,
24
- WildcardPathFlagsCodec: () => WildcardPathFlagsCodec
22
+ GlobalAttrIds: () => GlobalAttrIds
25
23
  });
26
24
  module.exports = __toCommonJS(AttributeResponse_exports);
27
25
  var import_AccessControl = require("#action/server/AccessControl.js");
26
+ var import_DataResponse = require("#action/server/DataResponse.js");
28
27
  var import_general = require("#general");
29
28
  var import_model = require("#model");
30
29
  var import_types = require("#types");
31
- var import_model2 = require("@matter/model");
30
+ var import_types2 = require("@matter/types");
32
31
  /**
33
32
  * @license
34
33
  * Copyright 2022-2025 Project CHIP Authors
35
34
  * SPDX-License-Identifier: Apache-2.0
36
35
  */
36
+ const logger = import_general.Logger.get("AttributeResponse");
37
37
  const GlobalAttrIds = new Set(Object.values((0, import_types.GlobalAttributes)({})).map((attr) => attr.id));
38
- const WildcardPathFlagsCodec = (0, import_types.BitmapSchema)(import_types.WildcardPathFlagsBitmap);
39
- const FallbackLimits = {
40
- fabricScoped: false,
41
- fabricSensitive: false,
42
- readable: true,
43
- readLevel: import_model.AccessLevel.View,
44
- timed: false,
45
- writable: true,
46
- writeLevel: import_model.AccessLevel.Administer
47
- };
48
- class AttributeResponse {
49
- // Configuration
50
- #session;
51
- #node;
38
+ class AttributeResponse extends import_DataResponse.DataResponse {
52
39
  #versions;
53
40
  // Each input AttributePathIB that does not have an error installs a producer. Producers run after validation and
54
41
  // generate actual attribute data
@@ -62,12 +49,15 @@ class AttributeResponse {
62
49
  #currentCluster;
63
50
  #currentState;
64
51
  #wildcardPathFlags = 0;
65
- // The node ID may be expensive to retrieve and is invariant so we cache it here
66
- #cachedNodeId;
67
- constructor(node, session, { dataVersionFilters, attributeRequests }) {
68
- this.#node = node;
69
- this.#session = session;
70
- const nodeId = session.fabric === void 0 ? import_types.NodeId.UNSPECIFIED_NODE_ID : this.#nodeId;
52
+ // Count how many attribute status (on error) and attribute values (on success) we have emitted
53
+ #statusCount = 0;
54
+ #valueCount = 0;
55
+ #filteredCount = 0;
56
+ constructor(node, session) {
57
+ super(node, session);
58
+ }
59
+ *process({ dataVersionFilters, attributeRequests }) {
60
+ const nodeId = this.session.fabric === void 0 ? import_types.NodeId.UNSPECIFIED_NODE_ID : this.nodeId;
71
61
  if (dataVersionFilters?.length) {
72
62
  this.#versions = {};
73
63
  for (const {
@@ -85,16 +75,11 @@ class AttributeResponse {
85
75
  }
86
76
  for (const path of attributeRequests) {
87
77
  if (path.endpointId === void 0 || path.clusterId === void 0 || path.attributeId === void 0) {
88
- this.#addWildcard(path);
78
+ this.addWildcard(path);
89
79
  } else {
90
- this.#addConcrete(path);
80
+ this.addConcrete(path);
91
81
  }
92
82
  }
93
- }
94
- /**
95
- * Emits chunks produced by paths added via {@link #addWildcard} and {@link #addConcrete}.
96
- */
97
- *[Symbol.iterator]() {
98
83
  if (this.#dataProducers) {
99
84
  for (const producer of this.#dataProducers) {
100
85
  yield* producer.apply(this);
@@ -104,99 +89,122 @@ class AttributeResponse {
104
89
  yield this.#chunk;
105
90
  }
106
91
  }
92
+ /** Guarded accessor for this.#currentEndpoint. This should never be undefined */
93
+ get #guardedCurrentEndpoint() {
94
+ if (this.#currentEndpoint === void 0) {
95
+ throw new import_general.InternalError("currentEndpoint is not set. Should never happen");
96
+ }
97
+ return this.#currentEndpoint;
98
+ }
99
+ /** Guarded accessor for this.#currentCluster. This should never be undefined */
100
+ get #guardedCurrentCluster() {
101
+ if (this.#currentCluster === void 0) {
102
+ throw new import_general.InternalError("currentCluster is not set. Should never happen");
103
+ }
104
+ return this.#currentCluster;
105
+ }
106
+ get counts() {
107
+ return {
108
+ status: this.#statusCount,
109
+ value: this.#valueCount,
110
+ existent: this.#valueCount + this.#filteredCount
111
+ };
112
+ }
107
113
  /**
108
114
  * Validate a wildcard path and update internal state.
109
115
  */
110
- #addWildcard(path) {
116
+ addWildcard(path) {
111
117
  const { nodeId, endpointId, clusterId, attributeId, wildcardPathFlags } = path;
112
- if (nodeId !== void 0 && nodeId !== this.#nodeId) {
113
- return;
114
- }
115
- const wpf = wildcardPathFlags ? WildcardPathFlagsCodec.encode(wildcardPathFlags) : 0;
116
118
  if (clusterId === void 0 && attributeId !== void 0 && !GlobalAttrIds.has(attributeId)) {
117
119
  throw new import_types.StatusResponseError(
118
120
  `Illegal read of wildcard cluster with non-global attribute #${attributeId}`,
119
121
  import_types.Status.InvalidAction
120
122
  );
121
123
  }
124
+ if (nodeId !== void 0 && nodeId !== this.nodeId) {
125
+ return;
126
+ }
127
+ const wpf = wildcardPathFlags ? import_DataResponse.WildcardPathFlagsCodec.encode(wildcardPathFlags) : 0;
122
128
  if (endpointId === void 0) {
123
129
  this.#addProducer(function* () {
124
130
  this.#wildcardPathFlags = wpf;
125
- for (const endpoint2 of this.#node) {
126
- yield* this.#readEndpointForWildcard(endpoint2, path);
131
+ for (const endpoint2 of this.node) {
132
+ yield* this.readEndpointForWildcard(endpoint2, path);
127
133
  }
128
134
  });
129
135
  return;
130
136
  }
131
- const endpoint = this.#node[endpointId];
137
+ const endpoint = this.node[endpointId];
132
138
  if (endpoint) {
133
139
  this.#addProducer(function() {
134
140
  this.#wildcardPathFlags = wpf;
135
- return this.#readEndpointForWildcard(endpoint, path);
141
+ return this.readEndpointForWildcard(endpoint, path);
136
142
  });
137
143
  }
138
144
  }
139
145
  /**
140
146
  * Validate a concrete path and update internal state.
141
147
  */
142
- #addConcrete(path) {
148
+ addConcrete(path) {
143
149
  const { nodeId, endpointId, clusterId, attributeId } = path;
144
- if (nodeId !== void 0 && this.#nodeId !== nodeId) {
145
- this.#addStatus(path, import_types.Status.UnsupportedNode);
150
+ if (nodeId !== void 0 && this.nodeId !== nodeId) {
151
+ this.addStatus(path, import_types.Status.UnsupportedNode);
152
+ return;
146
153
  }
147
- const endpoint = this.#node[endpointId];
154
+ const endpoint = this.node[endpointId];
148
155
  const cluster = endpoint?.[clusterId];
149
156
  const attribute = cluster?.type.attributes[attributeId];
150
157
  let limits;
151
158
  if (attribute === void 0) {
152
- const modelAttr = this.#node.matter.member(path.clusterId, [import_model.ElementTag.Cluster])?.member(path.attributeId, [import_model.ElementTag.Attribute]);
159
+ const modelAttr = this.node.matter.member(path.clusterId, [import_model.ElementTag.Cluster])?.member(path.attributeId, [import_model.ElementTag.Attribute]);
153
160
  if (modelAttr) {
154
161
  limits = (0, import_AccessControl.AccessControl)(modelAttr).limits;
155
162
  } else {
156
- limits = FallbackLimits;
163
+ limits = import_DataResponse.FallbackLimits;
157
164
  }
158
165
  } else {
159
166
  limits = attribute.limits;
160
167
  }
161
168
  const location = {
162
169
  ...cluster?.location ?? {
163
- path: import_model2.DataModelPath.none,
170
+ path: import_model.DataModelPath.none,
164
171
  endpoint: endpointId,
165
172
  cluster: clusterId
166
173
  },
167
- owningFabric: this.#session.fabric
174
+ owningFabric: this.session.fabric
168
175
  };
169
- const permission = this.#session.authorityAt(limits.readLevel, location);
176
+ const permission = this.session.authorityAt(limits.readLevel, location);
170
177
  switch (permission) {
171
178
  case import_AccessControl.AccessControl.Authority.Granted:
172
179
  break;
173
180
  case import_AccessControl.AccessControl.Authority.Unauthorized:
174
- this.#addStatus(path, import_types.Status.UnsupportedAccess);
181
+ this.addStatus(path, import_types.Status.UnsupportedAccess);
175
182
  return;
176
183
  case import_AccessControl.AccessControl.Authority.Restricted:
177
- this.#addStatus(path, import_types.Status.AccessRestricted);
184
+ this.addStatus(path, import_types.Status.AccessRestricted);
178
185
  return;
179
186
  default:
180
187
  throw new import_general.InternalError(`Unsupported authorization state ${permission}`);
181
188
  }
182
189
  if (endpoint === void 0) {
183
- this.#addStatus(path, import_types.Status.UnsupportedEndpoint);
190
+ this.addStatus(path, import_types.Status.UnsupportedEndpoint);
184
191
  return;
185
192
  }
186
193
  if (cluster === void 0) {
187
- this.#addStatus(path, import_types.Status.UnsupportedCluster);
194
+ this.addStatus(path, import_types.Status.UnsupportedCluster);
188
195
  return;
189
196
  }
190
- if (attribute === void 0) {
191
- this.#addStatus(path, import_types.Status.UnsupportedAttribute);
197
+ if (attribute === void 0 || !cluster.type.attributes[attribute.id]) {
198
+ this.addStatus(path, import_types.Status.UnsupportedAttribute);
192
199
  return;
193
200
  }
194
201
  if (!limits.readable) {
195
- this.#addStatus(path, import_types.Status.UnsupportedRead);
202
+ this.addStatus(path, import_types.Status.UnsupportedRead);
196
203
  return;
197
204
  }
198
205
  const skipVersion = this.#versions?.[path.endpointId]?.[path.clusterId];
199
206
  if (skipVersion !== void 0 && skipVersion === cluster.version) {
207
+ this.#filteredCount++;
200
208
  return;
201
209
  }
202
210
  this.#addProducer(function* () {
@@ -207,19 +215,19 @@ class AttributeResponse {
207
215
  }
208
216
  this.#currentEndpoint = endpoint;
209
217
  this.#currentCluster = cluster;
210
- this.#currentState = cluster.open(this.#session);
218
+ this.#currentState = cluster.open(this.session);
211
219
  } else if (this.#currentCluster !== cluster) {
212
220
  this.#currentCluster = cluster;
213
- this.#currentState = cluster.open(this.#session);
221
+ this.#currentState = cluster.open(this.session);
214
222
  } else if (this.#currentState === void 0) {
215
- this.#currentState = cluster.open(this.#session);
223
+ this.#currentState = cluster.open(this.session);
216
224
  }
217
- this.#addValue(
218
- path,
219
- this.#currentState[attributeId],
220
- cluster.version,
221
- this.#currentCluster.type.attributes[attributeId].tlv
225
+ const value = this.#currentState[attributeId];
226
+ const version = cluster.version;
227
+ logger.debug(
228
+ () => `Reading attribute ${this.node.inspectPath(path)}=${import_general.Diagnostic.json(value)} (version=${version})`
222
229
  );
230
+ this.#addValue(path, value, version, this.#currentCluster.type.attributes[attributeId].tlv);
223
231
  });
224
232
  }
225
233
  /**
@@ -230,9 +238,9 @@ class AttributeResponse {
230
238
  *
231
239
  * {@link this.#wildcardPathFlags} to numeric bitmap must be set prior to invocation.
232
240
  *
233
- * TODO - skip endpoints for which subject is unauthorized
241
+ * TODO - skip endpoints for which subject is unauthorized as optimization
234
242
  */
235
- *#readEndpointForWildcard(endpoint, path) {
243
+ *readEndpointForWildcard(endpoint, path) {
236
244
  if (endpoint.wildcardPathFlags & this.#wildcardPathFlags) {
237
245
  return;
238
246
  }
@@ -247,12 +255,12 @@ class AttributeResponse {
247
255
  const { clusterId } = path;
248
256
  if (clusterId === void 0) {
249
257
  for (const cluster of endpoint) {
250
- this.#readClusterForWildcard(cluster, path);
258
+ this.readClusterForWildcard(cluster, path);
251
259
  }
252
260
  } else {
253
261
  const cluster = endpoint[clusterId];
254
262
  if (cluster !== void 0) {
255
- this.#readClusterForWildcard(cluster, path);
263
+ this.readClusterForWildcard(cluster, path);
256
264
  }
257
265
  }
258
266
  }
@@ -263,7 +271,7 @@ class AttributeResponse {
263
271
  *
264
272
  * TODO - skip clusters for which subject is unauthorized
265
273
  */
266
- #readClusterForWildcard(cluster, path) {
274
+ readClusterForWildcard(cluster, path) {
267
275
  if (cluster.type.wildcardPathFlags & this.#wildcardPathFlags) {
268
276
  return;
269
277
  }
@@ -271,19 +279,29 @@ class AttributeResponse {
271
279
  this.#currentCluster = cluster;
272
280
  this.#currentState = void 0;
273
281
  }
274
- const skipVersion = this.#versions?.[this.#currentEndpoint.id]?.[cluster.type.id];
275
- if (skipVersion !== void 0 && skipVersion === cluster.version) {
276
- return;
277
- }
278
282
  const { attributeId } = path;
283
+ const skipVersion = this.#versions?.[this.#guardedCurrentEndpoint.id]?.[cluster.type.id];
284
+ const filteredByVersion = skipVersion !== void 0 && skipVersion === cluster.version;
279
285
  if (attributeId === void 0) {
286
+ if (filteredByVersion) {
287
+ for (const attribute of cluster.type.attributes) {
288
+ if (attribute.limits.readable) {
289
+ this.#filteredCount++;
290
+ }
291
+ }
292
+ return;
293
+ }
280
294
  for (const attribute of cluster.type.attributes) {
281
- this.#readAttributeForWildcard(attribute, path);
295
+ this.readAttributeForWildcard(attribute, path);
282
296
  }
283
297
  } else {
298
+ if (filteredByVersion) {
299
+ this.#filteredCount++;
300
+ return;
301
+ }
284
302
  const attribute = cluster.type.attributes[attributeId];
285
303
  if (attribute !== void 0) {
286
- this.#readAttributeForWildcard(attribute, path);
304
+ this.readAttributeForWildcard(attribute, path);
287
305
  }
288
306
  }
289
307
  }
@@ -292,30 +310,35 @@ class AttributeResponse {
292
310
  *
293
311
  * Depends on state initialized by {@link #readClusterForWildcard}.
294
312
  */
295
- #readAttributeForWildcard(attribute, path) {
313
+ readAttributeForWildcard(attribute, path) {
314
+ if (!this.#guardedCurrentCluster.type.attributes[attribute.id]) {
315
+ return;
316
+ }
296
317
  if (attribute.wildcardPathFlags & this.#wildcardPathFlags) {
297
318
  return;
298
319
  }
299
- if (!attribute.limits.readable || this.#session.authorityAt(attribute.limits.readLevel, this.#currentCluster.location) !== import_AccessControl.AccessControl.Authority.Granted) {
320
+ if (!attribute.limits.readable || this.session.authorityAt(attribute.limits.readLevel, this.#guardedCurrentCluster.location) !== import_AccessControl.AccessControl.Authority.Granted) {
300
321
  return;
301
322
  }
302
323
  if (this.#currentState === void 0) {
303
- this.#currentState = this.#currentCluster.open(this.#session);
324
+ this.#currentState = this.#guardedCurrentCluster.open(this.session);
304
325
  }
305
326
  const value = this.#currentState[attribute.id];
306
- if (value !== void 0) {
307
- this.#addValue(
308
- {
309
- ...path,
310
- endpointId: this.#currentEndpoint?.id,
311
- clusterId: this.#currentCluster?.type.id,
312
- attributeId: attribute.id
313
- },
314
- this.#currentState[attribute.id],
315
- this.#currentCluster.version,
316
- attribute.tlv
317
- );
327
+ if (value === void 0) {
328
+ logger.warn(`Attribute ${this.node.inspectPath(path)} defined and enabled but has no value.`);
329
+ return;
318
330
  }
331
+ this.#addValue(
332
+ {
333
+ ...path,
334
+ endpointId: this.#guardedCurrentEndpoint.id,
335
+ clusterId: this.#guardedCurrentCluster.type.id,
336
+ attributeId: attribute.id
337
+ },
338
+ this.#currentState[attribute.id],
339
+ this.#guardedCurrentCluster.version,
340
+ attribute.tlv
341
+ );
319
342
  }
320
343
  /**
321
344
  * Add a function that produces data. These functions are run after validation of input paths.
@@ -327,20 +350,27 @@ class AttributeResponse {
327
350
  this.#dataProducers = [producer];
328
351
  }
329
352
  }
353
+ #addReportData(report) {
354
+ if (this.#chunk) {
355
+ this.#chunk.push(report);
356
+ } else {
357
+ this.#chunk = [report];
358
+ }
359
+ }
330
360
  /**
331
361
  * Add a status value.
332
362
  */
333
- #addStatus(path, status) {
363
+ addStatus(path, status) {
364
+ logger.debug(
365
+ () => `Error reading attribute ${this.node.inspectPath(path)}: Status=${import_types2.StatusCode[status]}(${status})`
366
+ );
334
367
  const report = {
335
368
  kind: "attr-status",
336
369
  path,
337
370
  status
338
371
  };
339
- if (this.#chunk) {
340
- this.#chunk.push(report);
341
- } else {
342
- this.#chunk = [report];
343
- }
372
+ this.#addReportData(report);
373
+ this.#statusCount++;
344
374
  }
345
375
  /**
346
376
  * Add an attribute value.
@@ -353,20 +383,8 @@ class AttributeResponse {
353
383
  version,
354
384
  tlv
355
385
  };
356
- if (this.#chunk) {
357
- this.#chunk.push(report);
358
- } else {
359
- this.#chunk = [report];
360
- }
361
- }
362
- /**
363
- * The node ID used to filter paths with node ID specified. Unsure if this is ever actually used.
364
- */
365
- get #nodeId() {
366
- if (this.#cachedNodeId === void 0) {
367
- this.#cachedNodeId = (this.#session.fabric && this.#node.nodeIdFor(this.#session.fabric)) ?? import_types.NodeId.UNSPECIFIED_NODE_ID;
368
- }
369
- return this.#cachedNodeId;
386
+ this.#addReportData(report);
387
+ this.#valueCount++;
370
388
  }
371
389
  }
372
390
  //# sourceMappingURL=AttributeResponse.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/action/server/AttributeResponse.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,2BAA8B;AAE9B,qBAA8B;AAC9B,mBAAwD;AACxD,mBAUO;AACP,IAAAA,gBAA8B;AAxB9B;AAAA;AAAA;AAAA;AAAA;AA2BO,MAAM,gBAAgB,IAAI,IAAI,OAAO,WAAO,+BAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,UAAQ,KAAK,EAAE,CAAC;AACtF,MAAM,6BAAyB,2BAAa,oCAAuB;AACnE,MAAM,iBAAuC;AAAA,EAChD,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,WAAW,yBAAY;AAAA,EACvB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY,yBAAY;AAC5B;AAOO,MAAM,kBAAkF;AAAA;AAAA,EA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SAAK;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,MAAwC,OAAgB,SAAiB,KAAyB;AACxG,UAAM,SAAoC;AAAA,MACtC,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAEA,SAAK,eAAe,MAAM;AAC1B,SAAK;AAAA,EACT;AACJ;",
5
+ "names": ["import_types", "endpoint"]
6
6
  }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Project CHIP Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { AttributeTypeProtocol, ClusterProtocol, EndpointProtocol, NodeProtocol } from "#action/protocols.js";
7
+ import { ReadResult } from "#action/response/ReadResult.js";
8
+ import { AttributeId, AttributePath, ClusterId, EndpointNumber } from "#types";
9
+ import { AccessControl } from "./AccessControl.js";
10
+ import { AttributeResponse } from "./AttributeResponse.js";
11
+ type ClusterFilter = {
12
+ [clusterId: ClusterId]: Set<AttributeId>;
13
+ };
14
+ export type AttributeResponseFilter = {
15
+ [endpointId: EndpointNumber]: ClusterFilter;
16
+ };
17
+ /**
18
+ * AttributeSubscriptionResponse is a specialized version of AttributeResponse that processes a read/subscribe request
19
+ * with a filter applied to the attributes. Only the attributes that match the filter will be processed.
20
+ */
21
+ export declare class AttributeSubscriptionResponse<SessionT extends AccessControl.Session = AccessControl.Session> extends AttributeResponse<SessionT> {
22
+ #private;
23
+ constructor(node: NodeProtocol, session: SessionT, filter: AttributeResponseFilter);
24
+ get filter(): AttributeResponseFilter;
25
+ /** Guarded accessor for this.#currentEndpointFilter. This should never be undefined */
26
+ protected get currentEndpointFilter(): ClusterFilter;
27
+ /** Guarded accessor for this.#currentCLusterFilter. This should never be undefined */
28
+ protected get currentClusterFilter(): Set<number>;
29
+ protected addConcrete(path: ReadResult.ConcreteAttributePath): void;
30
+ protected readEndpointForWildcard(endpoint: EndpointProtocol, path: AttributePath): Generator<ReadResult.Report[], void, unknown>;
31
+ protected readClusterForWildcard(cluster: ClusterProtocol, path: AttributePath): void;
32
+ protected readAttributeForWildcard(attribute: AttributeTypeProtocol, path: AttributePath): void;
33
+ protected addStatus(): void;
34
+ }
35
+ export {};
36
+ //# sourceMappingURL=AttributeSubscriptionResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttributeSubscriptionResponse.d.ts","sourceRoot":"","sources":["../../../../src/action/server/AttributeSubscriptionResponse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,KAAK,aAAa,GAAG;IACjB,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;CAC5C,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG;IAClC,CAAC,UAAU,EAAE,cAAc,GAAG,aAAa,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,qBAAa,6BAA6B,CACtC,QAAQ,SAAS,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAChE,SAAQ,iBAAiB,CAAC,QAAQ,CAAC;;gBAKrB,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,uBAAuB;IAKlF,IAAI,MAAM,4BAET;IAED,wFAAwF;IACxF,SAAS,KAAK,qBAAqB,kBAKlC;IAED,uFAAuF;IACvF,SAAS,KAAK,oBAAoB,gBAKjC;cAEkB,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,qBAAqB;cAQjD,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa;cAQxE,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa;cAQpE,wBAAwB,CAAC,SAAS,EAAE,qBAAqB,EAAE,IAAI,EAAE,aAAa;cAO9E,SAAS;CAG/B"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var AttributeSubscriptionResponse_exports = {};
20
+ __export(AttributeSubscriptionResponse_exports, {
21
+ AttributeSubscriptionResponse: () => AttributeSubscriptionResponse
22
+ });
23
+ module.exports = __toCommonJS(AttributeSubscriptionResponse_exports);
24
+ var import_general = require("#general");
25
+ var import_AttributeResponse = require("./AttributeResponse.js");
26
+ /**
27
+ * @license
28
+ * Copyright 2022-2025 Project CHIP Authors
29
+ * SPDX-License-Identifier: Apache-2.0
30
+ */
31
+ class AttributeSubscriptionResponse extends import_AttributeResponse.AttributeResponse {
32
+ #filter;
33
+ #currentEndpointFilter;
34
+ #currentClusterFilter;
35
+ constructor(node, session, filter) {
36
+ super(node, session);
37
+ this.#filter = filter;
38
+ }
39
+ get filter() {
40
+ return this.#filter;
41
+ }
42
+ /** Guarded accessor for this.#currentEndpointFilter. This should never be undefined */
43
+ get currentEndpointFilter() {
44
+ if (!this.#currentEndpointFilter) {
45
+ throw new import_general.InternalError("currentEndpointFilter is not set. Should never happen");
46
+ }
47
+ return this.#currentEndpointFilter;
48
+ }
49
+ /** Guarded accessor for this.#currentCLusterFilter. This should never be undefined */
50
+ get currentClusterFilter() {
51
+ if (!this.#currentClusterFilter) {
52
+ throw new import_general.InternalError("currentClusterFilter is not set. Should never happen");
53
+ }
54
+ return this.#currentClusterFilter;
55
+ }
56
+ addConcrete(path) {
57
+ const { endpointId, clusterId, attributeId } = path;
58
+ if (this.#filter[endpointId]?.[clusterId]?.has(attributeId) === void 0) {
59
+ return;
60
+ }
61
+ super.addConcrete(path);
62
+ }
63
+ *readEndpointForWildcard(endpoint, path) {
64
+ this.#currentEndpointFilter = this.#filter[endpoint.id];
65
+ if (this.#currentEndpointFilter === void 0) {
66
+ return;
67
+ }
68
+ yield* super.readEndpointForWildcard(endpoint, path);
69
+ }
70
+ readClusterForWildcard(cluster, path) {
71
+ this.#currentClusterFilter = this.currentEndpointFilter[cluster.type.id];
72
+ if (this.#currentClusterFilter === void 0) {
73
+ return;
74
+ }
75
+ super.readClusterForWildcard(cluster, path);
76
+ }
77
+ readAttributeForWildcard(attribute, path) {
78
+ if (!this.currentClusterFilter.has(attribute.id)) {
79
+ return;
80
+ }
81
+ super.readAttributeForWildcard(attribute, path);
82
+ }
83
+ addStatus() {
84
+ }
85
+ }
86
+ //# sourceMappingURL=AttributeSubscriptionResponse.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/action/server/AttributeSubscriptionResponse.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,qBAA8B;AAG9B,+BAAkC;AAVlC;AAAA;AAAA;AAAA;AAAA;AAuBO,MAAM,sCAEH,2CAA4B;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EAEA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
2
+ * @license
3
+ * Copyright 2022-2025 Project CHIP Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { NodeProtocol } from "#action/protocols.js";
7
+ import { AccessControl } from "#action/server/AccessControl.js";
8
+ import { NodeId } from "#types";
9
+ export declare const WildcardPathFlagsCodec: import("#types").BitmapSchemaInternal<{
10
+ skipRootNode: import("#types").BitFlag;
11
+ skipGlobalAttributes: import("#types").BitFlag;
12
+ skipAttributeList: import("#types").BitFlag;
13
+ reserved1: import("#types").BitFlag;
14
+ skipCommandLists: import("#types").BitFlag;
15
+ skipCustomElements: import("#types").BitFlag;
16
+ skipFixedAttributes: import("#types").BitFlag;
17
+ skipChangesOmittedAttributes: import("#types").BitFlag;
18
+ skipDiagnosticsClusters: import("#types").BitFlag;
19
+ }>;
20
+ export declare const FallbackLimits: AccessControl.Limits;
21
+ export declare abstract class DataResponse<SessionT extends AccessControl.Session = AccessControl.Session> {
22
+ #private;
23
+ constructor(node: NodeProtocol, session: SessionT);
24
+ protected get node(): NodeProtocol;
25
+ protected get session(): SessionT;
26
+ /**
27
+ * The node ID used to filter paths with node ID specified. Unsure if this is ever actually used.
28
+ */
29
+ protected get nodeId(): NodeId;
30
+ abstract counts: {
31
+ /**
32
+ * Number of existent entries that were processed. Not all must have had data to send.
33
+ */
34
+ existent: number;
35
+ /**
36
+ * Number of status responses (aka errors we have sent)
37
+ */
38
+ status: number;
39
+ /**
40
+ * Number of value responses (aka success we have sent)
41
+ */
42
+ value: number;
43
+ };
44
+ }
45
+ //# sourceMappingURL=DataResponse.d.ts.map