@matter/node 0.17.2 → 0.17.3-alpha.0-20260617-ea3690abc
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/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.js +5 -4
- package/dist/cjs/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +1 -1
- package/dist/cjs/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
- package/dist/cjs/behaviors/thermostat/AtomicWriteHandler.d.ts.map +1 -1
- package/dist/cjs/behaviors/thermostat/AtomicWriteHandler.js +15 -8
- package/dist/cjs/behaviors/thermostat/AtomicWriteHandler.js.map +1 -1
- package/dist/cjs/node/server/InteractionServer.d.ts +3 -3
- package/dist/cjs/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/cjs/node/server/InteractionServer.js +8 -10
- package/dist/cjs/node/server/InteractionServer.js.map +1 -1
- package/dist/cjs/node/server/ServerSubscription.d.ts.map +1 -1
- package/dist/cjs/node/server/ServerSubscription.js +15 -12
- package/dist/cjs/node/server/ServerSubscription.js.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.d.ts.map +1 -1
- package/dist/esm/behavior/system/commissioning/CommissioningServer.js +5 -4
- package/dist/esm/behavior/system/commissioning/CommissioningServer.js.map +1 -1
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.d.ts.map +1 -1
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js +10 -2
- package/dist/esm/behaviors/administrator-commissioning/AdministratorCommissioningServer.js.map +1 -1
- package/dist/esm/behaviors/thermostat/AtomicWriteHandler.d.ts.map +1 -1
- package/dist/esm/behaviors/thermostat/AtomicWriteHandler.js +22 -9
- package/dist/esm/behaviors/thermostat/AtomicWriteHandler.js.map +1 -1
- package/dist/esm/node/server/InteractionServer.d.ts +3 -3
- package/dist/esm/node/server/InteractionServer.d.ts.map +1 -1
- package/dist/esm/node/server/InteractionServer.js +8 -10
- package/dist/esm/node/server/InteractionServer.js.map +1 -1
- package/dist/esm/node/server/ServerSubscription.d.ts.map +1 -1
- package/dist/esm/node/server/ServerSubscription.js +15 -12
- package/dist/esm/node/server/ServerSubscription.js.map +1 -1
- package/package.json +6 -6
- package/src/behavior/system/commissioning/CommissioningServer.ts +7 -4
- package/src/behaviors/administrator-commissioning/AdministratorCommissioningServer.ts +12 -2
- package/src/behaviors/thermostat/AtomicWriteHandler.ts +32 -16
- package/src/node/server/InteractionServer.ts +15 -15
- package/src/node/server/ServerSubscription.ts +17 -12
|
@@ -49,16 +49,16 @@ import {
|
|
|
49
49
|
} from "@matter/protocol";
|
|
50
50
|
import {
|
|
51
51
|
AttributeData,
|
|
52
|
+
AttributePath,
|
|
52
53
|
DEFAULT_MAX_PATHS_PER_INVOKE,
|
|
54
|
+
EventPath,
|
|
53
55
|
INTERACTION_PROTOCOL_ID,
|
|
54
56
|
InvokeResponseData,
|
|
55
57
|
ReceivedStatusResponseError,
|
|
56
58
|
Status,
|
|
57
59
|
StatusResponseError,
|
|
58
60
|
TlvAny,
|
|
59
|
-
TlvAttributePath,
|
|
60
61
|
TlvClusterPath,
|
|
61
|
-
TlvEventPath,
|
|
62
62
|
TlvInvokeResponseData,
|
|
63
63
|
TlvInvokeResponseForSend,
|
|
64
64
|
TlvSubscribeResponse,
|
|
@@ -75,17 +75,14 @@ export interface PeerSubscription {
|
|
|
75
75
|
peerAddress: PeerAddress;
|
|
76
76
|
minIntervalFloor: Duration;
|
|
77
77
|
maxIntervalCeiling: Duration;
|
|
78
|
-
attributeRequests?:
|
|
79
|
-
eventRequests?:
|
|
78
|
+
attributeRequests?: AttributePath[];
|
|
79
|
+
eventRequests?: EventPath[];
|
|
80
80
|
isFabricFiltered: boolean;
|
|
81
81
|
maxInterval: Duration;
|
|
82
82
|
sendInterval: Duration;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function validateReadAttributesPath(path:
|
|
86
|
-
if (isGroupSession) {
|
|
87
|
-
throw new StatusResponseError("Illegal read request with group session", Status.InvalidAction);
|
|
88
|
-
}
|
|
85
|
+
function validateReadAttributesPath(path: AttributePath) {
|
|
89
86
|
const { clusterId, attributeId } = path;
|
|
90
87
|
if (clusterId === undefined && attributeId !== undefined) {
|
|
91
88
|
if (!GLOBAL_IDS.has(attributeId)) {
|
|
@@ -97,14 +94,17 @@ function validateReadAttributesPath(path: TypeFromSchema<typeof TlvAttributePath
|
|
|
97
94
|
}
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
function validateReadEventPath(path:
|
|
97
|
+
function validateReadEventPath(path: EventPath) {
|
|
101
98
|
const { clusterId, eventId } = path;
|
|
102
99
|
if (clusterId === undefined && eventId !== undefined) {
|
|
103
100
|
throw new StatusResponseError("Illegal read request with wildcard cluster ID", Status.InvalidAction);
|
|
104
101
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Per Matter §8.4.3.2, Read and Subscribe share one valid-path algorithm. */
|
|
105
|
+
function validateReadPaths(attributeRequests?: AttributePath[], eventRequests?: EventPath[]) {
|
|
106
|
+
attributeRequests?.forEach(path => validateReadAttributesPath(path));
|
|
107
|
+
eventRequests?.forEach(path => validateReadEventPath(path));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
function clusterPathToId({ nodeId, endpointId, clusterId }: TypeFromSchema<typeof TlvClusterPath>) {
|
|
@@ -310,6 +310,8 @@ export class InteractionServer implements ProtocolHandler, InteractionRecipient
|
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
validateReadPaths(attributeRequests, eventRequests);
|
|
314
|
+
|
|
313
315
|
return {
|
|
314
316
|
dataReport: {
|
|
315
317
|
interactionModelRevision: Specification.INTERACTION_MODEL_REVISION,
|
|
@@ -592,9 +594,7 @@ export class InteractionServer implements ProtocolHandler, InteractionRecipient
|
|
|
592
594
|
}),
|
|
593
595
|
]);
|
|
594
596
|
|
|
595
|
-
|
|
596
|
-
attributeRequests?.forEach(path => validateReadAttributesPath(path));
|
|
597
|
-
eventRequests?.forEach(path => validateReadEventPath(path));
|
|
597
|
+
validateReadPaths(attributeRequests, eventRequests);
|
|
598
598
|
|
|
599
599
|
if (minIntervalFloorSeconds < 0) {
|
|
600
600
|
throw new StatusResponseError(
|
|
@@ -266,20 +266,25 @@ export class ServerSubscription implements Subscription {
|
|
|
266
266
|
// controller minimum. But in general never faster than minimum interval configured or 2 seconds
|
|
267
267
|
// (SUBSCRIPTION_MIN_INTERVAL_S). Additionally, we add a randomization window to the max interval to avoid all
|
|
268
268
|
// devices sending at the same time. But we make sure not to exceed the global max interval.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
269
|
+
// Spec §8.5.3.2 lower bound: MaxInterval must stay >= MinIntervalFloor even when the floor
|
|
270
|
+
// exceeds the publisher limit, so re-raise after the MAX_INTERVAL_PUBLISHER_LIMIT cap.
|
|
271
|
+
const maxInterval = Duration.max(
|
|
272
|
+
this.minIntervalFloor,
|
|
273
|
+
Duration.min(
|
|
274
|
+
Millis.floor(
|
|
275
|
+
Millis(
|
|
274
276
|
Duration.max(
|
|
275
|
-
|
|
276
|
-
Duration.
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
subscriptionMinInterval,
|
|
278
|
+
Duration.max(
|
|
279
|
+
this.minIntervalFloor,
|
|
280
|
+
Duration.min(subscriptionMaxInterval, this.maxIntervalCeiling),
|
|
281
|
+
),
|
|
282
|
+
) +
|
|
283
|
+
subscriptionRandomizationWindow * Math.random(),
|
|
284
|
+
),
|
|
280
285
|
),
|
|
286
|
+
MAX_INTERVAL_PUBLISHER_LIMIT,
|
|
281
287
|
),
|
|
282
|
-
MAX_INTERVAL_PUBLISHER_LIMIT,
|
|
283
288
|
);
|
|
284
289
|
let sendInterval = Millis.floor(Millis(maxInterval / 2)); // Ideally we send at half the max interval
|
|
285
290
|
if (sendInterval < Minutes.one) {
|
|
@@ -455,7 +460,7 @@ export class ServerSubscription implements Subscription {
|
|
|
455
460
|
break;
|
|
456
461
|
}
|
|
457
462
|
|
|
458
|
-
this.#lastUpdateTime = Time.nowMs;
|
|
463
|
+
this.#lastUpdateTime = Time.nowMs;
|
|
459
464
|
|
|
460
465
|
try {
|
|
461
466
|
using sending = updating?.join("sending");
|