@matter/protocol 0.13.1-alpha.0-20250508-047aa0277 → 0.13.1-alpha.0-20250511-74ef153aa
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/protocols.d.ts +59 -2
- package/dist/cjs/action/protocols.d.ts.map +1 -1
- package/dist/cjs/action/request/Read.d.ts +2 -2
- package/dist/cjs/action/request/Read.d.ts.map +1 -1
- package/dist/cjs/action/request/Read.js +4 -4
- package/dist/cjs/action/request/Read.js.map +1 -1
- package/dist/cjs/action/response/ReadResult.d.ts +6 -2
- package/dist/cjs/action/response/ReadResult.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeResponse.d.ts +46 -17
- package/dist/cjs/action/server/AttributeResponse.d.ts.map +1 -1
- package/dist/cjs/action/server/AttributeResponse.js +128 -110
- package/dist/cjs/action/server/AttributeResponse.js.map +2 -2
- package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts +36 -0
- package/dist/cjs/action/server/AttributeSubscriptionResponse.d.ts.map +1 -0
- package/dist/cjs/action/server/AttributeSubscriptionResponse.js +86 -0
- package/dist/cjs/action/server/AttributeSubscriptionResponse.js.map +6 -0
- package/dist/cjs/action/server/DataResponse.d.ts +45 -0
- package/dist/cjs/action/server/DataResponse.d.ts.map +1 -0
- package/dist/cjs/action/server/DataResponse.js +69 -0
- package/dist/cjs/action/server/DataResponse.js.map +6 -0
- package/dist/cjs/action/server/EventResponse.d.ts +28 -0
- package/dist/cjs/action/server/EventResponse.d.ts.map +1 -0
- package/dist/cjs/action/server/EventResponse.js +318 -0
- package/dist/cjs/action/server/EventResponse.js.map +6 -0
- package/dist/cjs/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/cjs/action/server/ServerInteraction.js +15 -2
- package/dist/cjs/action/server/ServerInteraction.js.map +1 -1
- package/dist/cjs/action/server/index.d.ts +3 -0
- package/dist/cjs/action/server/index.d.ts.map +1 -1
- package/dist/cjs/action/server/index.js +3 -0
- package/dist/cjs/action/server/index.js.map +1 -1
- package/dist/cjs/events/OccurrenceManager.d.ts +20 -11
- package/dist/cjs/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/cjs/events/OccurrenceManager.js +113 -74
- package/dist/cjs/events/OccurrenceManager.js.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.d.ts +14 -2
- package/dist/cjs/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/cjs/interaction/InteractionMessenger.js +87 -3
- package/dist/cjs/interaction/InteractionMessenger.js.map +1 -1
- package/dist/cjs/interaction/index.d.ts +0 -1
- package/dist/cjs/interaction/index.d.ts.map +1 -1
- package/dist/cjs/interaction/index.js +0 -1
- package/dist/cjs/interaction/index.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioningFlow.js +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +11 -1
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/action/protocols.d.ts +59 -2
- package/dist/esm/action/protocols.d.ts.map +1 -1
- package/dist/esm/action/request/Read.d.ts +2 -2
- package/dist/esm/action/request/Read.d.ts.map +1 -1
- package/dist/esm/action/request/Read.js +4 -4
- package/dist/esm/action/request/Read.js.map +1 -1
- package/dist/esm/action/response/ReadResult.d.ts +6 -2
- package/dist/esm/action/response/ReadResult.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeResponse.d.ts +46 -17
- package/dist/esm/action/server/AttributeResponse.d.ts.map +1 -1
- package/dist/esm/action/server/AttributeResponse.js +129 -113
- package/dist/esm/action/server/AttributeResponse.js.map +1 -1
- package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts +36 -0
- package/dist/esm/action/server/AttributeSubscriptionResponse.d.ts.map +1 -0
- package/dist/esm/action/server/AttributeSubscriptionResponse.js +66 -0
- package/dist/esm/action/server/AttributeSubscriptionResponse.js.map +6 -0
- package/dist/esm/action/server/DataResponse.d.ts +45 -0
- package/dist/esm/action/server/DataResponse.d.ts.map +1 -0
- package/dist/esm/action/server/DataResponse.js +49 -0
- package/dist/esm/action/server/DataResponse.js.map +6 -0
- package/dist/esm/action/server/EventResponse.d.ts +28 -0
- package/dist/esm/action/server/EventResponse.d.ts.map +1 -0
- package/dist/esm/action/server/EventResponse.js +305 -0
- package/dist/esm/action/server/EventResponse.js.map +6 -0
- package/dist/esm/action/server/ServerInteraction.d.ts.map +1 -1
- package/dist/esm/action/server/ServerInteraction.js +16 -3
- package/dist/esm/action/server/ServerInteraction.js.map +1 -1
- package/dist/esm/action/server/index.d.ts +3 -0
- package/dist/esm/action/server/index.d.ts.map +1 -1
- package/dist/esm/action/server/index.js +3 -0
- package/dist/esm/action/server/index.js.map +1 -1
- package/dist/esm/events/OccurrenceManager.d.ts +20 -11
- package/dist/esm/events/OccurrenceManager.d.ts.map +1 -1
- package/dist/esm/events/OccurrenceManager.js +117 -80
- package/dist/esm/events/OccurrenceManager.js.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.d.ts +14 -2
- package/dist/esm/interaction/InteractionMessenger.d.ts.map +1 -1
- package/dist/esm/interaction/InteractionMessenger.js +87 -3
- package/dist/esm/interaction/InteractionMessenger.js.map +1 -1
- package/dist/esm/interaction/index.d.ts +0 -1
- package/dist/esm/interaction/index.d.ts.map +1 -1
- package/dist/esm/interaction/index.js +0 -1
- package/dist/esm/interaction/index.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioningFlow.js +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +11 -1
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/package.json +6 -6
- package/src/action/protocols.ts +68 -2
- package/src/action/request/Read.ts +2 -2
- package/src/action/response/ReadResult.ts +8 -1
- package/src/action/server/AttributeResponse.ts +145 -118
- package/src/action/server/AttributeSubscriptionResponse.ts +90 -0
- package/src/action/server/DataResponse.ts +70 -0
- package/src/action/server/EventResponse.ts +381 -0
- package/src/action/server/ServerInteraction.ts +18 -4
- package/src/action/server/index.ts +3 -0
- package/src/events/OccurrenceManager.ts +126 -100
- package/src/interaction/InteractionMessenger.ts +93 -8
- package/src/interaction/index.ts +0 -1
- package/src/peer/ControllerCommissioningFlow.ts +1 -1
- package/src/protocol/MessageExchange.ts +13 -1
- package/dist/cjs/interaction/ServerSubscription.d.ts +0 -116
- package/dist/cjs/interaction/ServerSubscription.d.ts.map +0 -1
- package/dist/cjs/interaction/ServerSubscription.js +0 -778
- package/dist/cjs/interaction/ServerSubscription.js.map +0 -6
- package/dist/esm/interaction/ServerSubscription.d.ts +0 -116
- package/dist/esm/interaction/ServerSubscription.d.ts.map +0 -1
- package/dist/esm/interaction/ServerSubscription.js +0 -778
- package/dist/esm/interaction/ServerSubscription.js.map +0 -6
- package/src/interaction/ServerSubscription.ts +0 -1038
|
@@ -4,32 +4,19 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { AccessControl } from "#action/server/AccessControl.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { DataResponse, FallbackLimits, WildcardPathFlagsCodec } from "#action/server/DataResponse.js";
|
|
8
|
+
import { Diagnostic, InternalError, Logger } from "#general";
|
|
9
|
+
import { DataModelPath, ElementTag } from "#model";
|
|
9
10
|
import {
|
|
10
|
-
BitmapSchema,
|
|
11
11
|
GlobalAttributes,
|
|
12
12
|
NodeId,
|
|
13
13
|
Status,
|
|
14
|
-
StatusResponseError
|
|
15
|
-
WildcardPathFlagsBitmap
|
|
14
|
+
StatusResponseError
|
|
16
15
|
} from "#types";
|
|
17
|
-
import {
|
|
16
|
+
import { StatusCode } from "@matter/types";
|
|
17
|
+
const logger = Logger.get("AttributeResponse");
|
|
18
18
|
const GlobalAttrIds = new Set(Object.values(GlobalAttributes({})).map((attr) => attr.id));
|
|
19
|
-
|
|
20
|
-
const FallbackLimits = {
|
|
21
|
-
fabricScoped: false,
|
|
22
|
-
fabricSensitive: false,
|
|
23
|
-
readable: true,
|
|
24
|
-
readLevel: AccessLevel.View,
|
|
25
|
-
timed: false,
|
|
26
|
-
writable: true,
|
|
27
|
-
writeLevel: AccessLevel.Administer
|
|
28
|
-
};
|
|
29
|
-
class AttributeResponse {
|
|
30
|
-
// Configuration
|
|
31
|
-
#session;
|
|
32
|
-
#node;
|
|
19
|
+
class AttributeResponse extends DataResponse {
|
|
33
20
|
#versions;
|
|
34
21
|
// Each input AttributePathIB that does not have an error installs a producer. Producers run after validation and
|
|
35
22
|
// generate actual attribute data
|
|
@@ -43,12 +30,15 @@ class AttributeResponse {
|
|
|
43
30
|
#currentCluster;
|
|
44
31
|
#currentState;
|
|
45
32
|
#wildcardPathFlags = 0;
|
|
46
|
-
//
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
// Count how many attribute status (on error) and attribute values (on success) we have emitted
|
|
34
|
+
#statusCount = 0;
|
|
35
|
+
#valueCount = 0;
|
|
36
|
+
#filteredCount = 0;
|
|
37
|
+
constructor(node, session) {
|
|
38
|
+
super(node, session);
|
|
39
|
+
}
|
|
40
|
+
*process({ dataVersionFilters, attributeRequests }) {
|
|
41
|
+
const nodeId = this.session.fabric === void 0 ? NodeId.UNSPECIFIED_NODE_ID : this.nodeId;
|
|
52
42
|
if (dataVersionFilters?.length) {
|
|
53
43
|
this.#versions = {};
|
|
54
44
|
for (const {
|
|
@@ -66,16 +56,11 @@ class AttributeResponse {
|
|
|
66
56
|
}
|
|
67
57
|
for (const path of attributeRequests) {
|
|
68
58
|
if (path.endpointId === void 0 || path.clusterId === void 0 || path.attributeId === void 0) {
|
|
69
|
-
this
|
|
59
|
+
this.addWildcard(path);
|
|
70
60
|
} else {
|
|
71
|
-
this
|
|
61
|
+
this.addConcrete(path);
|
|
72
62
|
}
|
|
73
63
|
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Emits chunks produced by paths added via {@link #addWildcard} and {@link #addConcrete}.
|
|
77
|
-
*/
|
|
78
|
-
*[Symbol.iterator]() {
|
|
79
64
|
if (this.#dataProducers) {
|
|
80
65
|
for (const producer of this.#dataProducers) {
|
|
81
66
|
yield* producer.apply(this);
|
|
@@ -85,52 +70,74 @@ class AttributeResponse {
|
|
|
85
70
|
yield this.#chunk;
|
|
86
71
|
}
|
|
87
72
|
}
|
|
73
|
+
/** Guarded accessor for this.#currentEndpoint. This should never be undefined */
|
|
74
|
+
get #guardedCurrentEndpoint() {
|
|
75
|
+
if (this.#currentEndpoint === void 0) {
|
|
76
|
+
throw new InternalError("currentEndpoint is not set. Should never happen");
|
|
77
|
+
}
|
|
78
|
+
return this.#currentEndpoint;
|
|
79
|
+
}
|
|
80
|
+
/** Guarded accessor for this.#currentCluster. This should never be undefined */
|
|
81
|
+
get #guardedCurrentCluster() {
|
|
82
|
+
if (this.#currentCluster === void 0) {
|
|
83
|
+
throw new InternalError("currentCluster is not set. Should never happen");
|
|
84
|
+
}
|
|
85
|
+
return this.#currentCluster;
|
|
86
|
+
}
|
|
87
|
+
get counts() {
|
|
88
|
+
return {
|
|
89
|
+
status: this.#statusCount,
|
|
90
|
+
value: this.#valueCount,
|
|
91
|
+
existent: this.#valueCount + this.#filteredCount
|
|
92
|
+
};
|
|
93
|
+
}
|
|
88
94
|
/**
|
|
89
95
|
* Validate a wildcard path and update internal state.
|
|
90
96
|
*/
|
|
91
|
-
|
|
97
|
+
addWildcard(path) {
|
|
92
98
|
const { nodeId, endpointId, clusterId, attributeId, wildcardPathFlags } = path;
|
|
93
|
-
if (nodeId !== void 0 && nodeId !== this.#nodeId) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const wpf = wildcardPathFlags ? WildcardPathFlagsCodec.encode(wildcardPathFlags) : 0;
|
|
97
99
|
if (clusterId === void 0 && attributeId !== void 0 && !GlobalAttrIds.has(attributeId)) {
|
|
98
100
|
throw new StatusResponseError(
|
|
99
101
|
`Illegal read of wildcard cluster with non-global attribute #${attributeId}`,
|
|
100
102
|
Status.InvalidAction
|
|
101
103
|
);
|
|
102
104
|
}
|
|
105
|
+
if (nodeId !== void 0 && nodeId !== this.nodeId) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const wpf = wildcardPathFlags ? WildcardPathFlagsCodec.encode(wildcardPathFlags) : 0;
|
|
103
109
|
if (endpointId === void 0) {
|
|
104
110
|
this.#addProducer(function* () {
|
|
105
111
|
this.#wildcardPathFlags = wpf;
|
|
106
|
-
for (const endpoint2 of this
|
|
107
|
-
yield* this
|
|
112
|
+
for (const endpoint2 of this.node) {
|
|
113
|
+
yield* this.readEndpointForWildcard(endpoint2, path);
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
return;
|
|
111
117
|
}
|
|
112
|
-
const endpoint = this
|
|
118
|
+
const endpoint = this.node[endpointId];
|
|
113
119
|
if (endpoint) {
|
|
114
120
|
this.#addProducer(function() {
|
|
115
121
|
this.#wildcardPathFlags = wpf;
|
|
116
|
-
return this
|
|
122
|
+
return this.readEndpointForWildcard(endpoint, path);
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
127
|
* Validate a concrete path and update internal state.
|
|
122
128
|
*/
|
|
123
|
-
|
|
129
|
+
addConcrete(path) {
|
|
124
130
|
const { nodeId, endpointId, clusterId, attributeId } = path;
|
|
125
|
-
if (nodeId !== void 0 && this
|
|
126
|
-
this
|
|
131
|
+
if (nodeId !== void 0 && this.nodeId !== nodeId) {
|
|
132
|
+
this.addStatus(path, Status.UnsupportedNode);
|
|
133
|
+
return;
|
|
127
134
|
}
|
|
128
|
-
const endpoint = this
|
|
135
|
+
const endpoint = this.node[endpointId];
|
|
129
136
|
const cluster = endpoint?.[clusterId];
|
|
130
137
|
const attribute = cluster?.type.attributes[attributeId];
|
|
131
138
|
let limits;
|
|
132
139
|
if (attribute === void 0) {
|
|
133
|
-
const modelAttr = this
|
|
140
|
+
const modelAttr = this.node.matter.member(path.clusterId, [ElementTag.Cluster])?.member(path.attributeId, [ElementTag.Attribute]);
|
|
134
141
|
if (modelAttr) {
|
|
135
142
|
limits = AccessControl(modelAttr).limits;
|
|
136
143
|
} else {
|
|
@@ -145,39 +152,40 @@ class AttributeResponse {
|
|
|
145
152
|
endpoint: endpointId,
|
|
146
153
|
cluster: clusterId
|
|
147
154
|
},
|
|
148
|
-
owningFabric: this
|
|
155
|
+
owningFabric: this.session.fabric
|
|
149
156
|
};
|
|
150
|
-
const permission = this
|
|
157
|
+
const permission = this.session.authorityAt(limits.readLevel, location);
|
|
151
158
|
switch (permission) {
|
|
152
159
|
case AccessControl.Authority.Granted:
|
|
153
160
|
break;
|
|
154
161
|
case AccessControl.Authority.Unauthorized:
|
|
155
|
-
this
|
|
162
|
+
this.addStatus(path, Status.UnsupportedAccess);
|
|
156
163
|
return;
|
|
157
164
|
case AccessControl.Authority.Restricted:
|
|
158
|
-
this
|
|
165
|
+
this.addStatus(path, Status.AccessRestricted);
|
|
159
166
|
return;
|
|
160
167
|
default:
|
|
161
168
|
throw new InternalError(`Unsupported authorization state ${permission}`);
|
|
162
169
|
}
|
|
163
170
|
if (endpoint === void 0) {
|
|
164
|
-
this
|
|
171
|
+
this.addStatus(path, Status.UnsupportedEndpoint);
|
|
165
172
|
return;
|
|
166
173
|
}
|
|
167
174
|
if (cluster === void 0) {
|
|
168
|
-
this
|
|
175
|
+
this.addStatus(path, Status.UnsupportedCluster);
|
|
169
176
|
return;
|
|
170
177
|
}
|
|
171
|
-
if (attribute === void 0) {
|
|
172
|
-
this
|
|
178
|
+
if (attribute === void 0 || !cluster.type.attributes[attribute.id]) {
|
|
179
|
+
this.addStatus(path, Status.UnsupportedAttribute);
|
|
173
180
|
return;
|
|
174
181
|
}
|
|
175
182
|
if (!limits.readable) {
|
|
176
|
-
this
|
|
183
|
+
this.addStatus(path, Status.UnsupportedRead);
|
|
177
184
|
return;
|
|
178
185
|
}
|
|
179
186
|
const skipVersion = this.#versions?.[path.endpointId]?.[path.clusterId];
|
|
180
187
|
if (skipVersion !== void 0 && skipVersion === cluster.version) {
|
|
188
|
+
this.#filteredCount++;
|
|
181
189
|
return;
|
|
182
190
|
}
|
|
183
191
|
this.#addProducer(function* () {
|
|
@@ -188,19 +196,19 @@ class AttributeResponse {
|
|
|
188
196
|
}
|
|
189
197
|
this.#currentEndpoint = endpoint;
|
|
190
198
|
this.#currentCluster = cluster;
|
|
191
|
-
this.#currentState = cluster.open(this
|
|
199
|
+
this.#currentState = cluster.open(this.session);
|
|
192
200
|
} else if (this.#currentCluster !== cluster) {
|
|
193
201
|
this.#currentCluster = cluster;
|
|
194
|
-
this.#currentState = cluster.open(this
|
|
202
|
+
this.#currentState = cluster.open(this.session);
|
|
195
203
|
} else if (this.#currentState === void 0) {
|
|
196
|
-
this.#currentState = cluster.open(this
|
|
204
|
+
this.#currentState = cluster.open(this.session);
|
|
197
205
|
}
|
|
198
|
-
this.#
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.#currentCluster.type.attributes[attributeId].tlv
|
|
206
|
+
const value = this.#currentState[attributeId];
|
|
207
|
+
const version = cluster.version;
|
|
208
|
+
logger.debug(
|
|
209
|
+
() => `Reading attribute ${this.node.inspectPath(path)}=${Diagnostic.json(value)} (version=${version})`
|
|
203
210
|
);
|
|
211
|
+
this.#addValue(path, value, version, this.#currentCluster.type.attributes[attributeId].tlv);
|
|
204
212
|
});
|
|
205
213
|
}
|
|
206
214
|
/**
|
|
@@ -211,9 +219,9 @@ class AttributeResponse {
|
|
|
211
219
|
*
|
|
212
220
|
* {@link this.#wildcardPathFlags} to numeric bitmap must be set prior to invocation.
|
|
213
221
|
*
|
|
214
|
-
* TODO - skip endpoints for which subject is unauthorized
|
|
222
|
+
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
215
223
|
*/
|
|
216
|
-
|
|
224
|
+
*readEndpointForWildcard(endpoint, path) {
|
|
217
225
|
if (endpoint.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
218
226
|
return;
|
|
219
227
|
}
|
|
@@ -228,12 +236,12 @@ class AttributeResponse {
|
|
|
228
236
|
const { clusterId } = path;
|
|
229
237
|
if (clusterId === void 0) {
|
|
230
238
|
for (const cluster of endpoint) {
|
|
231
|
-
this
|
|
239
|
+
this.readClusterForWildcard(cluster, path);
|
|
232
240
|
}
|
|
233
241
|
} else {
|
|
234
242
|
const cluster = endpoint[clusterId];
|
|
235
243
|
if (cluster !== void 0) {
|
|
236
|
-
this
|
|
244
|
+
this.readClusterForWildcard(cluster, path);
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
}
|
|
@@ -244,7 +252,7 @@ class AttributeResponse {
|
|
|
244
252
|
*
|
|
245
253
|
* TODO - skip clusters for which subject is unauthorized
|
|
246
254
|
*/
|
|
247
|
-
|
|
255
|
+
readClusterForWildcard(cluster, path) {
|
|
248
256
|
if (cluster.type.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
249
257
|
return;
|
|
250
258
|
}
|
|
@@ -252,19 +260,29 @@ class AttributeResponse {
|
|
|
252
260
|
this.#currentCluster = cluster;
|
|
253
261
|
this.#currentState = void 0;
|
|
254
262
|
}
|
|
255
|
-
const skipVersion = this.#versions?.[this.#currentEndpoint.id]?.[cluster.type.id];
|
|
256
|
-
if (skipVersion !== void 0 && skipVersion === cluster.version) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
263
|
const { attributeId } = path;
|
|
264
|
+
const skipVersion = this.#versions?.[this.#guardedCurrentEndpoint.id]?.[cluster.type.id];
|
|
265
|
+
const filteredByVersion = skipVersion !== void 0 && skipVersion === cluster.version;
|
|
260
266
|
if (attributeId === void 0) {
|
|
267
|
+
if (filteredByVersion) {
|
|
268
|
+
for (const attribute of cluster.type.attributes) {
|
|
269
|
+
if (attribute.limits.readable) {
|
|
270
|
+
this.#filteredCount++;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
261
275
|
for (const attribute of cluster.type.attributes) {
|
|
262
|
-
this
|
|
276
|
+
this.readAttributeForWildcard(attribute, path);
|
|
263
277
|
}
|
|
264
278
|
} else {
|
|
279
|
+
if (filteredByVersion) {
|
|
280
|
+
this.#filteredCount++;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
265
283
|
const attribute = cluster.type.attributes[attributeId];
|
|
266
284
|
if (attribute !== void 0) {
|
|
267
|
-
this
|
|
285
|
+
this.readAttributeForWildcard(attribute, path);
|
|
268
286
|
}
|
|
269
287
|
}
|
|
270
288
|
}
|
|
@@ -273,30 +291,35 @@ class AttributeResponse {
|
|
|
273
291
|
*
|
|
274
292
|
* Depends on state initialized by {@link #readClusterForWildcard}.
|
|
275
293
|
*/
|
|
276
|
-
|
|
294
|
+
readAttributeForWildcard(attribute, path) {
|
|
295
|
+
if (!this.#guardedCurrentCluster.type.attributes[attribute.id]) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
277
298
|
if (attribute.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
278
299
|
return;
|
|
279
300
|
}
|
|
280
|
-
if (!attribute.limits.readable || this
|
|
301
|
+
if (!attribute.limits.readable || this.session.authorityAt(attribute.limits.readLevel, this.#guardedCurrentCluster.location) !== AccessControl.Authority.Granted) {
|
|
281
302
|
return;
|
|
282
303
|
}
|
|
283
304
|
if (this.#currentState === void 0) {
|
|
284
|
-
this.#currentState = this.#
|
|
305
|
+
this.#currentState = this.#guardedCurrentCluster.open(this.session);
|
|
285
306
|
}
|
|
286
307
|
const value = this.#currentState[attribute.id];
|
|
287
|
-
if (value
|
|
288
|
-
this
|
|
289
|
-
|
|
290
|
-
...path,
|
|
291
|
-
endpointId: this.#currentEndpoint?.id,
|
|
292
|
-
clusterId: this.#currentCluster?.type.id,
|
|
293
|
-
attributeId: attribute.id
|
|
294
|
-
},
|
|
295
|
-
this.#currentState[attribute.id],
|
|
296
|
-
this.#currentCluster.version,
|
|
297
|
-
attribute.tlv
|
|
298
|
-
);
|
|
308
|
+
if (value === void 0) {
|
|
309
|
+
logger.warn(`Attribute ${this.node.inspectPath(path)} defined and enabled but has no value.`);
|
|
310
|
+
return;
|
|
299
311
|
}
|
|
312
|
+
this.#addValue(
|
|
313
|
+
{
|
|
314
|
+
...path,
|
|
315
|
+
endpointId: this.#guardedCurrentEndpoint.id,
|
|
316
|
+
clusterId: this.#guardedCurrentCluster.type.id,
|
|
317
|
+
attributeId: attribute.id
|
|
318
|
+
},
|
|
319
|
+
this.#currentState[attribute.id],
|
|
320
|
+
this.#guardedCurrentCluster.version,
|
|
321
|
+
attribute.tlv
|
|
322
|
+
);
|
|
300
323
|
}
|
|
301
324
|
/**
|
|
302
325
|
* Add a function that produces data. These functions are run after validation of input paths.
|
|
@@ -308,20 +331,27 @@ class AttributeResponse {
|
|
|
308
331
|
this.#dataProducers = [producer];
|
|
309
332
|
}
|
|
310
333
|
}
|
|
334
|
+
#addReportData(report) {
|
|
335
|
+
if (this.#chunk) {
|
|
336
|
+
this.#chunk.push(report);
|
|
337
|
+
} else {
|
|
338
|
+
this.#chunk = [report];
|
|
339
|
+
}
|
|
340
|
+
}
|
|
311
341
|
/**
|
|
312
342
|
* Add a status value.
|
|
313
343
|
*/
|
|
314
|
-
|
|
344
|
+
addStatus(path, status) {
|
|
345
|
+
logger.debug(
|
|
346
|
+
() => `Error reading attribute ${this.node.inspectPath(path)}: Status=${StatusCode[status]}(${status})`
|
|
347
|
+
);
|
|
315
348
|
const report = {
|
|
316
349
|
kind: "attr-status",
|
|
317
350
|
path,
|
|
318
351
|
status
|
|
319
352
|
};
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
} else {
|
|
323
|
-
this.#chunk = [report];
|
|
324
|
-
}
|
|
353
|
+
this.#addReportData(report);
|
|
354
|
+
this.#statusCount++;
|
|
325
355
|
}
|
|
326
356
|
/**
|
|
327
357
|
* Add an attribute value.
|
|
@@ -334,26 +364,12 @@ class AttributeResponse {
|
|
|
334
364
|
version,
|
|
335
365
|
tlv
|
|
336
366
|
};
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
} else {
|
|
340
|
-
this.#chunk = [report];
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* The node ID used to filter paths with node ID specified. Unsure if this is ever actually used.
|
|
345
|
-
*/
|
|
346
|
-
get #nodeId() {
|
|
347
|
-
if (this.#cachedNodeId === void 0) {
|
|
348
|
-
this.#cachedNodeId = (this.#session.fabric && this.#node.nodeIdFor(this.#session.fabric)) ?? NodeId.UNSPECIFIED_NODE_ID;
|
|
349
|
-
}
|
|
350
|
-
return this.#cachedNodeId;
|
|
367
|
+
this.#addReportData(report);
|
|
368
|
+
this.#valueCount++;
|
|
351
369
|
}
|
|
352
370
|
}
|
|
353
371
|
export {
|
|
354
372
|
AttributeResponse,
|
|
355
|
-
|
|
356
|
-
GlobalAttrIds,
|
|
357
|
-
WildcardPathFlagsCodec
|
|
373
|
+
GlobalAttrIds
|
|
358
374
|
};
|
|
359
375
|
//# 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;AASA,SAAS,qBAAqB;
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AASA,SAAS,qBAAqB;AAC9B,SAAS,cAAc,gBAAgB,8BAA8B;AAErE,SAAS,YAAY,eAAe,cAAc;AAClD,SAAyB,eAAe,kBAAkB;AAC1D;AAAA,EAII;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,kBAAkB;AAE3B,MAAM,SAAS,OAAO,IAAI,mBAAmB;AAEtC,MAAM,gBAAgB,IAAI,IAAI,OAAO,OAAO,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,UAAQ,KAAK,EAAE,CAAC;AAOtF,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ACxG;AAEA,UAAM,SAA2C;AAAA,MAC7C,MAAM;AAAA,MACN;AAAA,MACA;AAAA,IACJ;AAEA,SAAK,eAAe,MAAM;AAC1B,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
5
|
"names": ["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,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Project CHIP Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { InternalError } from "#general";
|
|
7
|
+
import { AttributeResponse } from "./AttributeResponse.js";
|
|
8
|
+
class AttributeSubscriptionResponse extends AttributeResponse {
|
|
9
|
+
#filter;
|
|
10
|
+
#currentEndpointFilter;
|
|
11
|
+
#currentClusterFilter;
|
|
12
|
+
constructor(node, session, filter) {
|
|
13
|
+
super(node, session);
|
|
14
|
+
this.#filter = filter;
|
|
15
|
+
}
|
|
16
|
+
get filter() {
|
|
17
|
+
return this.#filter;
|
|
18
|
+
}
|
|
19
|
+
/** Guarded accessor for this.#currentEndpointFilter. This should never be undefined */
|
|
20
|
+
get currentEndpointFilter() {
|
|
21
|
+
if (!this.#currentEndpointFilter) {
|
|
22
|
+
throw new InternalError("currentEndpointFilter is not set. Should never happen");
|
|
23
|
+
}
|
|
24
|
+
return this.#currentEndpointFilter;
|
|
25
|
+
}
|
|
26
|
+
/** Guarded accessor for this.#currentCLusterFilter. This should never be undefined */
|
|
27
|
+
get currentClusterFilter() {
|
|
28
|
+
if (!this.#currentClusterFilter) {
|
|
29
|
+
throw new InternalError("currentClusterFilter is not set. Should never happen");
|
|
30
|
+
}
|
|
31
|
+
return this.#currentClusterFilter;
|
|
32
|
+
}
|
|
33
|
+
addConcrete(path) {
|
|
34
|
+
const { endpointId, clusterId, attributeId } = path;
|
|
35
|
+
if (this.#filter[endpointId]?.[clusterId]?.has(attributeId) === void 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
super.addConcrete(path);
|
|
39
|
+
}
|
|
40
|
+
*readEndpointForWildcard(endpoint, path) {
|
|
41
|
+
this.#currentEndpointFilter = this.#filter[endpoint.id];
|
|
42
|
+
if (this.#currentEndpointFilter === void 0) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
yield* super.readEndpointForWildcard(endpoint, path);
|
|
46
|
+
}
|
|
47
|
+
readClusterForWildcard(cluster, path) {
|
|
48
|
+
this.#currentClusterFilter = this.currentEndpointFilter[cluster.type.id];
|
|
49
|
+
if (this.#currentClusterFilter === void 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
super.readClusterForWildcard(cluster, path);
|
|
53
|
+
}
|
|
54
|
+
readAttributeForWildcard(attribute, path) {
|
|
55
|
+
if (!this.currentClusterFilter.has(attribute.id)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
super.readAttributeForWildcard(attribute, path);
|
|
59
|
+
}
|
|
60
|
+
addStatus() {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
AttributeSubscriptionResponse
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=AttributeSubscriptionResponse.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
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C;AAAA,EAEmB,yBAAyB,WAAkC,MAAqB;AAC/F,QAAI,CAAC,KAAK,qBAAqB,IAAI,UAAU,EAAE,GAAG;AAC9C;AAAA,IACJ;AACA,UAAM,yBAAyB,WAAW,IAAI;AAAA,EAClD;AAAA,EAEmB,YAAY;AAAA,EAE/B;AACJ;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataResponse.d.ts","sourceRoot":"","sources":["../../../../src/action/server/DataResponse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAgB,MAAM,EAA2B,MAAM,QAAQ,CAAC;AAEvE,eAAO,MAAM,sBAAsB;;;;;;;;;;EAAwC,CAAC;AAC5E,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,MAQ1C,CAAC;AAEF,8BAAsB,YAAY,CAAC,QAAQ,SAAS,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO;;gBAQjF,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ;IAKjD,SAAS,KAAK,IAAI,iBAEjB;IAED,SAAS,KAAK,OAAO,aAEpB;IAED;;OAEG;IACH,SAAS,KAAK,MAAM,WAMnB;IAED,QAAQ,CAAC,MAAM,EAAE;QACb;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC;CACL"}
|