@riddix/hamh 2.1.0-alpha.411 → 2.1.0-alpha.413
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/backend/cli.js
CHANGED
|
@@ -2229,12 +2229,12 @@ var init_Diagnostic = __esm({
|
|
|
2229
2229
|
const diagnostic = Array();
|
|
2230
2230
|
format(details);
|
|
2231
2231
|
return Diagnostic2("error", diagnostic);
|
|
2232
|
-
function format({ id, message: message2, path:
|
|
2232
|
+
function format({ id, message: message2, path: path9, cause }) {
|
|
2233
2233
|
if (id) {
|
|
2234
2234
|
diagnostic.push(Diagnostic2.squash("[", Diagnostic2.strong(id), "]"));
|
|
2235
2235
|
}
|
|
2236
|
-
if (
|
|
2237
|
-
diagnostic.push(Diagnostic2.squash(
|
|
2236
|
+
if (path9) {
|
|
2237
|
+
diagnostic.push(Diagnostic2.squash(path9, ":"));
|
|
2238
2238
|
}
|
|
2239
2239
|
const hasCause = cause !== void 0;
|
|
2240
2240
|
if (hasCause) {
|
|
@@ -2324,12 +2324,12 @@ var init_Diagnostic = __esm({
|
|
|
2324
2324
|
let message2;
|
|
2325
2325
|
let rawStack;
|
|
2326
2326
|
let id;
|
|
2327
|
-
let
|
|
2327
|
+
let path9;
|
|
2328
2328
|
if (error2 !== void 0 && error2 !== null) {
|
|
2329
2329
|
if (typeof error2 === "string" || typeof error2 === "number") {
|
|
2330
2330
|
return { message: `${error2}` };
|
|
2331
2331
|
}
|
|
2332
|
-
({ message: message2, stack: rawStack, id, path:
|
|
2332
|
+
({ message: message2, stack: rawStack, id, path: path9 } = error2);
|
|
2333
2333
|
if (message2 === void 0) {
|
|
2334
2334
|
message2 = error2.toString();
|
|
2335
2335
|
}
|
|
@@ -2348,7 +2348,7 @@ var init_Diagnostic = __esm({
|
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
2350
|
if (!rawStack) {
|
|
2351
|
-
return { message: message2, id, path:
|
|
2351
|
+
return { message: message2, id, path: path9 };
|
|
2352
2352
|
}
|
|
2353
2353
|
rawStack = rawStack.toString();
|
|
2354
2354
|
rawStack = rawStack.replace(/^.*?\n\nError: /gs, "Error: ");
|
|
@@ -2403,7 +2403,7 @@ var init_Diagnostic = __esm({
|
|
|
2403
2403
|
if (truncatedToParent) {
|
|
2404
2404
|
stack.push(Diagnostic2.weak("(see parent frames)"));
|
|
2405
2405
|
}
|
|
2406
|
-
return { message: message2, id, path:
|
|
2406
|
+
return { message: message2, id, path: path9, stack, stackLines };
|
|
2407
2407
|
}
|
|
2408
2408
|
Diagnostic2.messageAndStackFor = messageAndStackFor;
|
|
2409
2409
|
})(Diagnostic || (Diagnostic = {}));
|
|
@@ -8818,16 +8818,16 @@ var init_RuntimeService = __esm({
|
|
|
8818
8818
|
});
|
|
8819
8819
|
|
|
8820
8820
|
// ../../node_modules/.pnpm/@matter+general@0.16.10/node_modules/@matter/general/dist/esm/environment/VariableService.js
|
|
8821
|
-
function addVariable(into,
|
|
8822
|
-
if (!
|
|
8821
|
+
function addVariable(into, path9, value) {
|
|
8822
|
+
if (!path9.length) {
|
|
8823
8823
|
return;
|
|
8824
8824
|
}
|
|
8825
|
-
const firstPathEntry =
|
|
8825
|
+
const firstPathEntry = path9[0];
|
|
8826
8826
|
if (firstPathEntry === "__proto__" || firstPathEntry === "constructor" || firstPathEntry === "prototype") {
|
|
8827
8827
|
throw new ImplementationError(`Invalid variable path name: ${firstPathEntry}`);
|
|
8828
8828
|
}
|
|
8829
8829
|
let current = into[firstPathEntry];
|
|
8830
|
-
if (
|
|
8830
|
+
if (path9.length === 1) {
|
|
8831
8831
|
if (current === void 0) {
|
|
8832
8832
|
into[firstPathEntry] = value;
|
|
8833
8833
|
}
|
|
@@ -8836,7 +8836,7 @@ function addVariable(into, path8, value) {
|
|
|
8836
8836
|
if (typeof current !== "object") {
|
|
8837
8837
|
current = into[firstPathEntry] = {};
|
|
8838
8838
|
}
|
|
8839
|
-
addVariable(current,
|
|
8839
|
+
addVariable(current, path9.slice(1), value);
|
|
8840
8840
|
}
|
|
8841
8841
|
function parseUnixStyle(values4) {
|
|
8842
8842
|
const variables = {};
|
|
@@ -9031,16 +9031,16 @@ var init_VariableService = __esm({
|
|
|
9031
9031
|
return value;
|
|
9032
9032
|
}
|
|
9033
9033
|
addConfigStyle(vars) {
|
|
9034
|
-
const
|
|
9034
|
+
const path9 = Array();
|
|
9035
9035
|
const add = (vars2) => {
|
|
9036
9036
|
for (const name in vars2) {
|
|
9037
9037
|
const val = vars2[name];
|
|
9038
9038
|
if (isObject(val)) {
|
|
9039
|
-
|
|
9039
|
+
path9.push(name);
|
|
9040
9040
|
add(val);
|
|
9041
|
-
|
|
9041
|
+
path9.pop();
|
|
9042
9042
|
} else {
|
|
9043
|
-
this.set([...
|
|
9043
|
+
this.set([...path9, name].join("."), val);
|
|
9044
9044
|
}
|
|
9045
9045
|
}
|
|
9046
9046
|
};
|
|
@@ -11045,8 +11045,8 @@ var init_AppAddress = __esm({
|
|
|
11045
11045
|
host = `${host}:${definition.transport.port}`;
|
|
11046
11046
|
}
|
|
11047
11047
|
}
|
|
11048
|
-
const
|
|
11049
|
-
definition = `${protocol}://${host}${
|
|
11048
|
+
const path9 = definition.path ?? "/";
|
|
11049
|
+
definition = `${protocol}://${host}${path9}`;
|
|
11050
11050
|
}
|
|
11051
11051
|
try {
|
|
11052
11052
|
super(definition);
|
|
@@ -16441,8 +16441,8 @@ var init_errors2 = __esm({
|
|
|
16441
16441
|
"../../node_modules/.pnpm/@matter+model@0.16.10/node_modules/@matter/model/dist/esm/common/errors.js"() {
|
|
16442
16442
|
init_esm();
|
|
16443
16443
|
SchemaImplementationError = class extends MatterError {
|
|
16444
|
-
constructor(
|
|
16445
|
-
super(`Definition of ${
|
|
16444
|
+
constructor(path9, message) {
|
|
16445
|
+
super(`Definition of ${path9.path ?? path9}: ${message}`);
|
|
16446
16446
|
}
|
|
16447
16447
|
};
|
|
16448
16448
|
}
|
|
@@ -38183,10 +38183,10 @@ var init_ModelTraversal = __esm({
|
|
|
38183
38183
|
if (type === void 0) {
|
|
38184
38184
|
return;
|
|
38185
38185
|
}
|
|
38186
|
-
const
|
|
38187
|
-
if (
|
|
38186
|
+
const path9 = type.split(".");
|
|
38187
|
+
if (path9.length === 1) {
|
|
38188
38188
|
for (const tag3 of model.allowedBaseTags) {
|
|
38189
|
-
const found = this.findType(this.findParent(model),
|
|
38189
|
+
const found = this.findType(this.findParent(model), path9[0], tag3);
|
|
38190
38190
|
if (found) {
|
|
38191
38191
|
return found;
|
|
38192
38192
|
}
|
|
@@ -38194,7 +38194,7 @@ var init_ModelTraversal = __esm({
|
|
|
38194
38194
|
return;
|
|
38195
38195
|
}
|
|
38196
38196
|
for (const tag3 of model.allowedBaseTags) {
|
|
38197
|
-
const found = this.findQualifiedType(this.findParent(model),
|
|
38197
|
+
const found = this.findQualifiedType(this.findParent(model), path9, tag3);
|
|
38198
38198
|
if (found) {
|
|
38199
38199
|
return found;
|
|
38200
38200
|
}
|
|
@@ -38489,21 +38489,21 @@ var init_ModelTraversal = __esm({
|
|
|
38489
38489
|
* This is quite complicated and would be painfully slow except in practice we don't use many qualified types and
|
|
38490
38490
|
* those we do use resolve with few failing branches in the search once the root qualifier of the name matches.
|
|
38491
38491
|
*/
|
|
38492
|
-
findQualifiedType(scope,
|
|
38492
|
+
findQualifiedType(scope, path9, tag3) {
|
|
38493
38493
|
if (!scope) {
|
|
38494
38494
|
return;
|
|
38495
38495
|
}
|
|
38496
38496
|
function resolve4(scope2, position = 0) {
|
|
38497
|
-
if (position ===
|
|
38498
|
-
return scope2.children.select(
|
|
38497
|
+
if (position === path9.length - 1) {
|
|
38498
|
+
return scope2.children.select(path9[position], tag3);
|
|
38499
38499
|
}
|
|
38500
|
-
for (const subscope of scope2.children.selectAll(
|
|
38500
|
+
for (const subscope of scope2.children.selectAll(path9[position])) {
|
|
38501
38501
|
const result = resolve4(subscope, position + 1);
|
|
38502
38502
|
if (result) {
|
|
38503
38503
|
return result;
|
|
38504
38504
|
}
|
|
38505
38505
|
}
|
|
38506
|
-
if (position === 0 && scope2.tag === ElementTag.Matter &&
|
|
38506
|
+
if (position === 0 && scope2.tag === ElementTag.Matter && path9[0] === "Matter") {
|
|
38507
38507
|
const result = resolve4(scope2, position + 1);
|
|
38508
38508
|
if (result) {
|
|
38509
38509
|
return result;
|
|
@@ -91490,9 +91490,9 @@ function encodeAttributePayload(attributePayload, options) {
|
|
|
91490
91490
|
if (attributeData === void 0) {
|
|
91491
91491
|
return TlvAttributeReport.encodeTlv({ attributeStatus });
|
|
91492
91492
|
}
|
|
91493
|
-
const { path:
|
|
91493
|
+
const { path: path9, schema: schema6, payload, dataVersion } = attributeData;
|
|
91494
91494
|
return TlvAttributeReport.encodeTlv({
|
|
91495
|
-
attributeData: { path:
|
|
91495
|
+
attributeData: { path: path9, data: schema6.encodeTlv(payload, options), dataVersion }
|
|
91496
91496
|
});
|
|
91497
91497
|
}
|
|
91498
91498
|
function encodeEventPayload(eventPayload, options) {
|
|
@@ -91501,7 +91501,7 @@ function encodeEventPayload(eventPayload, options) {
|
|
|
91501
91501
|
return TlvEventReport.encodeTlv({ eventStatus });
|
|
91502
91502
|
}
|
|
91503
91503
|
const {
|
|
91504
|
-
path:
|
|
91504
|
+
path: path9,
|
|
91505
91505
|
schema: schema6,
|
|
91506
91506
|
payload,
|
|
91507
91507
|
eventNumber,
|
|
@@ -91513,7 +91513,7 @@ function encodeEventPayload(eventPayload, options) {
|
|
|
91513
91513
|
} = eventData;
|
|
91514
91514
|
return TlvEventReport.encodeTlv({
|
|
91515
91515
|
eventData: {
|
|
91516
|
-
path:
|
|
91516
|
+
path: path9,
|
|
91517
91517
|
data: schema6.encodeTlv(payload, options),
|
|
91518
91518
|
priority: priority3,
|
|
91519
91519
|
systemTimestamp,
|
|
@@ -91543,7 +91543,7 @@ function chunkAttributePayload(attributePayload) {
|
|
|
91543
91543
|
`Cannot chunk an AttributePayload with just a attributeStatus: ${Diagnostic.json(attributePayload)}`
|
|
91544
91544
|
);
|
|
91545
91545
|
}
|
|
91546
|
-
const { schema: schema6, path:
|
|
91546
|
+
const { schema: schema6, path: path9, dataVersion, payload } = attributeData;
|
|
91547
91547
|
if (!(schema6 instanceof ArraySchema) || !Array.isArray(payload)) {
|
|
91548
91548
|
throw new MatterFlowError(
|
|
91549
91549
|
`Cannot chunk an AttributePayload with attributeData that is not an array: ${Diagnostic.json(
|
|
@@ -91554,14 +91554,14 @@ function chunkAttributePayload(attributePayload) {
|
|
|
91554
91554
|
const chunks = new Array();
|
|
91555
91555
|
chunks.push({
|
|
91556
91556
|
hasFabricSensitiveData,
|
|
91557
|
-
attributeData: { schema: schema6, path: { ...
|
|
91557
|
+
attributeData: { schema: schema6, path: { ...path9, listIndex: void 0 }, payload: [], dataVersion }
|
|
91558
91558
|
});
|
|
91559
91559
|
payload.forEach((element2) => {
|
|
91560
91560
|
chunks.push({
|
|
91561
91561
|
hasFabricSensitiveData,
|
|
91562
91562
|
attributeData: {
|
|
91563
91563
|
schema: schema6.elementSchema,
|
|
91564
|
-
path: { ...
|
|
91564
|
+
path: { ...path9, listIndex: null },
|
|
91565
91565
|
payload: element2,
|
|
91566
91566
|
dataVersion
|
|
91567
91567
|
}
|
|
@@ -92074,13 +92074,13 @@ var init_InteractionMessenger = __esm({
|
|
|
92074
92074
|
static convertServerInteractionReport(report) {
|
|
92075
92075
|
switch (report.kind) {
|
|
92076
92076
|
case "attr-value": {
|
|
92077
|
-
const { path:
|
|
92077
|
+
const { path: path9, value: payload, version: dataVersion, tlv: schema6 } = report;
|
|
92078
92078
|
if (schema6 === void 0) {
|
|
92079
|
-
throw new InternalError(`Attribute ${
|
|
92079
|
+
throw new InternalError(`Attribute ${path9.clusterId}/${path9.attributeId} not found`);
|
|
92080
92080
|
}
|
|
92081
92081
|
const data = {
|
|
92082
92082
|
attributeData: {
|
|
92083
|
-
path:
|
|
92083
|
+
path: path9,
|
|
92084
92084
|
payload,
|
|
92085
92085
|
schema: schema6,
|
|
92086
92086
|
dataVersion
|
|
@@ -92091,10 +92091,10 @@ var init_InteractionMessenger = __esm({
|
|
|
92091
92091
|
return data;
|
|
92092
92092
|
}
|
|
92093
92093
|
case "attr-status": {
|
|
92094
|
-
const { path:
|
|
92094
|
+
const { path: path9, status: status3, clusterStatus } = report;
|
|
92095
92095
|
const statusReport = {
|
|
92096
92096
|
attributeStatus: {
|
|
92097
|
-
path:
|
|
92097
|
+
path: path9,
|
|
92098
92098
|
status: { status: status3 }
|
|
92099
92099
|
},
|
|
92100
92100
|
hasFabricSensitiveData: false
|
|
@@ -92106,7 +92106,7 @@ var init_InteractionMessenger = __esm({
|
|
|
92106
92106
|
}
|
|
92107
92107
|
case "event-value": {
|
|
92108
92108
|
const {
|
|
92109
|
-
path:
|
|
92109
|
+
path: path9,
|
|
92110
92110
|
value: payload,
|
|
92111
92111
|
number: eventNumber,
|
|
92112
92112
|
priority: priority3,
|
|
@@ -92115,7 +92115,7 @@ var init_InteractionMessenger = __esm({
|
|
|
92115
92115
|
} = report;
|
|
92116
92116
|
const data = {
|
|
92117
92117
|
eventData: {
|
|
92118
|
-
path:
|
|
92118
|
+
path: path9,
|
|
92119
92119
|
eventNumber,
|
|
92120
92120
|
priority: priority3,
|
|
92121
92121
|
epochTimestamp,
|
|
@@ -92128,10 +92128,10 @@ var init_InteractionMessenger = __esm({
|
|
|
92128
92128
|
return data;
|
|
92129
92129
|
}
|
|
92130
92130
|
case "event-status": {
|
|
92131
|
-
const { path:
|
|
92131
|
+
const { path: path9, status: status3, clusterStatus } = report;
|
|
92132
92132
|
const statusReport = {
|
|
92133
92133
|
eventStatus: {
|
|
92134
|
-
path:
|
|
92134
|
+
path: path9,
|
|
92135
92135
|
status: { status: status3 }
|
|
92136
92136
|
},
|
|
92137
92137
|
hasFabricSensitiveData: false
|
|
@@ -101110,8 +101110,8 @@ function normalizeAndDecodeReadAttributeReport(data, leftoverAttributeReports) {
|
|
|
101110
101110
|
if (attributeData === void 0) {
|
|
101111
101111
|
break;
|
|
101112
101112
|
}
|
|
101113
|
-
const { path:
|
|
101114
|
-
if (
|
|
101113
|
+
const { path: path9, data: tlvData } = attributeData;
|
|
101114
|
+
if (path9.listIndex !== void 0) {
|
|
101115
101115
|
chunkedArrayDataFound = true;
|
|
101116
101116
|
continue;
|
|
101117
101117
|
} else if (chunkedArrayDataFound || // We found chunked elements before so this must be array initial value now
|
|
@@ -101136,25 +101136,25 @@ function expandPathsInAttributeData(data, acceptWildcardPaths = false) {
|
|
|
101136
101136
|
let lastPath;
|
|
101137
101137
|
data.forEach((value) => {
|
|
101138
101138
|
if (value === void 0) return;
|
|
101139
|
-
const { path:
|
|
101140
|
-
if (
|
|
101139
|
+
const { path: path9 } = value;
|
|
101140
|
+
if (path9.enableTagCompression) {
|
|
101141
101141
|
if (lastPath === void 0) throw new UnexpectedDataError("Tag compression enabled, but no previous path");
|
|
101142
|
-
if (
|
|
101143
|
-
if (
|
|
101144
|
-
if (
|
|
101145
|
-
if (
|
|
101142
|
+
if (path9.nodeId === void 0 && lastPath.nodeId !== void 0) path9.nodeId = lastPath.nodeId;
|
|
101143
|
+
if (path9.endpointId === void 0) path9.endpointId = lastPath.endpointId;
|
|
101144
|
+
if (path9.clusterId === void 0) path9.clusterId = lastPath.clusterId;
|
|
101145
|
+
if (path9.attributeId === void 0) path9.attributeId = lastPath.attributeId;
|
|
101146
101146
|
if (value.dataVersion === void 0 && lastPath.dataVersion !== void 0)
|
|
101147
101147
|
value.dataVersion = lastPath.dataVersion;
|
|
101148
|
-
} else if (
|
|
101148
|
+
} else if (path9.endpointId !== void 0 && path9.clusterId !== void 0 && path9.attributeId !== void 0) {
|
|
101149
101149
|
lastPath = {
|
|
101150
|
-
nodeId:
|
|
101151
|
-
endpointId:
|
|
101152
|
-
clusterId:
|
|
101153
|
-
attributeId:
|
|
101150
|
+
nodeId: path9.nodeId,
|
|
101151
|
+
endpointId: path9.endpointId,
|
|
101152
|
+
clusterId: path9.clusterId,
|
|
101153
|
+
attributeId: path9.attributeId,
|
|
101154
101154
|
dataVersion: value.dataVersion
|
|
101155
101155
|
};
|
|
101156
101156
|
} else if (!acceptWildcardPaths) {
|
|
101157
|
-
throw new UnexpectedDataError("Tag compression disabled, but path is incomplete: " + Diagnostic.json(
|
|
101157
|
+
throw new UnexpectedDataError("Tag compression disabled, but path is incomplete: " + Diagnostic.json(path9));
|
|
101158
101158
|
}
|
|
101159
101159
|
});
|
|
101160
101160
|
return data;
|
|
@@ -103077,77 +103077,77 @@ var init_errors5 = __esm({
|
|
|
103077
103077
|
init_esm3();
|
|
103078
103078
|
init_esm2();
|
|
103079
103079
|
SchemaViolationError = class extends StatusResponseError {
|
|
103080
|
-
constructor(prefix,
|
|
103081
|
-
const text = `${prefix} ${
|
|
103080
|
+
constructor(prefix, path9, message, code) {
|
|
103081
|
+
const text = `${prefix} ${path9.path ?? path9}: ${message} (${code})`;
|
|
103082
103082
|
super(text, code);
|
|
103083
103083
|
this.message = text;
|
|
103084
103084
|
}
|
|
103085
103085
|
};
|
|
103086
103086
|
ReadError = class extends SchemaViolationError {
|
|
103087
|
-
constructor(
|
|
103088
|
-
super("Reading",
|
|
103087
|
+
constructor(path9, message, code) {
|
|
103088
|
+
super("Reading", path9, message, code ?? Status2.UnsupportedRead);
|
|
103089
103089
|
}
|
|
103090
103090
|
};
|
|
103091
103091
|
WriteError = class extends SchemaViolationError {
|
|
103092
|
-
constructor(
|
|
103093
|
-
super("Writing",
|
|
103092
|
+
constructor(path9, message, code) {
|
|
103093
|
+
super("Writing", path9, message, code ?? Status2.UnsupportedWrite);
|
|
103094
103094
|
}
|
|
103095
103095
|
};
|
|
103096
103096
|
InvokeError = class extends SchemaViolationError {
|
|
103097
|
-
constructor(
|
|
103098
|
-
super("Invoking",
|
|
103097
|
+
constructor(path9, message, code) {
|
|
103098
|
+
super("Invoking", path9, message, code ?? Status2.UnsupportedAccess);
|
|
103099
103099
|
}
|
|
103100
103100
|
};
|
|
103101
103101
|
ValidateError = class extends SchemaViolationError {
|
|
103102
|
-
constructor(
|
|
103103
|
-
super("Validating",
|
|
103102
|
+
constructor(path9, message, code) {
|
|
103103
|
+
super("Validating", path9, message, code ?? Status2.InvalidDataType);
|
|
103104
103104
|
}
|
|
103105
103105
|
};
|
|
103106
103106
|
DatatypeError = class extends ValidateError {
|
|
103107
|
-
constructor(
|
|
103107
|
+
constructor(path9, type, value, code) {
|
|
103108
103108
|
let str = `${value}`;
|
|
103109
103109
|
if (str.length > 60) {
|
|
103110
103110
|
str = `${str.substring(60)}\u2026`;
|
|
103111
103111
|
}
|
|
103112
|
-
super(
|
|
103112
|
+
super(path9, `Value "${str}" is not ${type}`, code);
|
|
103113
103113
|
}
|
|
103114
103114
|
};
|
|
103115
103115
|
ConstraintError = class extends ValidateError {
|
|
103116
|
-
constructor(schema6,
|
|
103117
|
-
super(
|
|
103116
|
+
constructor(schema6, path9, message) {
|
|
103117
|
+
super(path9, `Constraint "${schema6.constraint}": ${message}`, Status2.ConstraintError);
|
|
103118
103118
|
}
|
|
103119
103119
|
};
|
|
103120
103120
|
IntegerRangeError = class extends ValidateError {
|
|
103121
|
-
constructor(
|
|
103122
|
-
super(
|
|
103121
|
+
constructor(path9, message) {
|
|
103122
|
+
super(path9, message, Status2.ConstraintError);
|
|
103123
103123
|
}
|
|
103124
103124
|
};
|
|
103125
103125
|
UnknownEnumValueError = class extends ValidateError {
|
|
103126
|
-
constructor(
|
|
103127
|
-
super(
|
|
103126
|
+
constructor(path9, message) {
|
|
103127
|
+
super(path9, message, Status2.ConstraintError);
|
|
103128
103128
|
}
|
|
103129
103129
|
};
|
|
103130
103130
|
ConformanceError = class extends ValidateError {
|
|
103131
|
-
constructor(schema6,
|
|
103131
|
+
constructor(schema6, path9, message, choice) {
|
|
103132
103132
|
let prefix;
|
|
103133
103133
|
if (choice) {
|
|
103134
103134
|
prefix = `Conformance choice "${choice}"`;
|
|
103135
103135
|
} else {
|
|
103136
103136
|
prefix = `Conformance "${schema6.conformance}"`;
|
|
103137
103137
|
}
|
|
103138
|
-
super(
|
|
103138
|
+
super(path9, `${prefix}: ${message}`, Status2.ConstraintError);
|
|
103139
103139
|
}
|
|
103140
103140
|
};
|
|
103141
103141
|
EnumValueConformanceError = class extends ConformanceError {
|
|
103142
103142
|
};
|
|
103143
103143
|
ExpiredReferenceError = class extends SchemaViolationError {
|
|
103144
|
-
constructor(
|
|
103145
|
-
super("Referencing",
|
|
103144
|
+
constructor(path9) {
|
|
103145
|
+
super("Referencing", path9, "This value is no longer available because its context has exited", Status2.Failure);
|
|
103146
103146
|
}
|
|
103147
103147
|
};
|
|
103148
103148
|
PhantomReferenceError = class extends SchemaViolationError {
|
|
103149
|
-
constructor(
|
|
103150
|
-
super("Referencing",
|
|
103149
|
+
constructor(path9) {
|
|
103150
|
+
super("Referencing", path9, "Container was removed", Status2.Failure);
|
|
103151
103151
|
}
|
|
103152
103152
|
};
|
|
103153
103153
|
}
|
|
@@ -103183,8 +103183,8 @@ function Read(optionsOrSelector, ...selectors) {
|
|
|
103183
103183
|
isFabricFiltered: fabricFilter,
|
|
103184
103184
|
interactionModelRevision,
|
|
103185
103185
|
[Diagnostic.value]: () => Diagnostic.dict({
|
|
103186
|
-
attributes: attributeRequests?.length ? selectors.filter(({ kind }) => kind === "attribute").map((
|
|
103187
|
-
events: eventRequests?.length ? selectors.filter(({ kind }) => kind === "event").map((
|
|
103186
|
+
attributes: attributeRequests?.length ? selectors.filter(({ kind }) => kind === "attribute").map((path9) => resolvePathForSpecifier(path9)).join(", ") : void 0,
|
|
103187
|
+
events: eventRequests?.length ? selectors.filter(({ kind }) => kind === "event").map((path9) => resolvePathForSpecifier(path9)).join(", ") : void 0,
|
|
103188
103188
|
dataVersionFilters: versionFilters?.length ? versionFilters.map(
|
|
103189
103189
|
({ path: { endpointId, clusterId: clusterId3 }, dataVersion }) => `${endpointId}/${clusterId3}=${dataVersion}`
|
|
103190
103190
|
).join(", ") : void 0,
|
|
@@ -103357,8 +103357,8 @@ var init_Subscribe = __esm({
|
|
|
103357
103357
|
});
|
|
103358
103358
|
|
|
103359
103359
|
// ../../node_modules/.pnpm/@matter+protocol@0.16.10/node_modules/@matter/protocol/dist/esm/action/request/Write.js
|
|
103360
|
-
function isAclOrExtensionPath(
|
|
103361
|
-
const { clusterId: clusterId3, attributeId } =
|
|
103360
|
+
function isAclOrExtensionPath(path9) {
|
|
103361
|
+
const { clusterId: clusterId3, attributeId } = path9;
|
|
103362
103362
|
return clusterId3 === AclClusterId && (attributeId === AclAttributeId || attributeId === AclExtensionAttributeId);
|
|
103363
103363
|
}
|
|
103364
103364
|
function Write(optionsOrData, ...data) {
|
|
@@ -103512,29 +103512,29 @@ var init_SubscribeResult = __esm({
|
|
|
103512
103512
|
});
|
|
103513
103513
|
|
|
103514
103514
|
// ../../node_modules/.pnpm/@matter+protocol@0.16.10/node_modules/@matter/protocol/dist/esm/common/ExpandedPath.js
|
|
103515
|
-
function ExpandedPath({ path:
|
|
103515
|
+
function ExpandedPath({ path: path9, matter: matter2, base, kind }) {
|
|
103516
103516
|
if (matter2 === void 0) {
|
|
103517
103517
|
matter2 = Matter;
|
|
103518
103518
|
}
|
|
103519
103519
|
if (base && "path" in base) {
|
|
103520
103520
|
base = base.path;
|
|
103521
103521
|
}
|
|
103522
|
-
const endpointIdent =
|
|
103522
|
+
const endpointIdent = path9.endpointId ?? "*";
|
|
103523
103523
|
base = base ? base.at(endpointIdent, "endpoint") : DataModelPath(endpointIdent, "endpoint");
|
|
103524
103524
|
let cluster2;
|
|
103525
|
-
base = base.at(identityOf(matter2, ClusterModel,
|
|
103526
|
-
if ("attributeId" in
|
|
103527
|
-
base = base.at("state").at(identityOf(cluster2, AttributeModel,
|
|
103528
|
-
if (
|
|
103529
|
-
return base.at(
|
|
103525
|
+
base = base.at(identityOf(matter2, ClusterModel, path9.clusterId), "cluster");
|
|
103526
|
+
if ("attributeId" in path9) {
|
|
103527
|
+
base = base.at("state").at(identityOf(cluster2, AttributeModel, path9.attributeId));
|
|
103528
|
+
if (path9.listIndex) {
|
|
103529
|
+
return base.at(path9.listIndex, "entry");
|
|
103530
103530
|
}
|
|
103531
103531
|
return base;
|
|
103532
103532
|
}
|
|
103533
|
-
if ("commandId" in
|
|
103534
|
-
return base.at(identityOf(cluster2, CommandModel,
|
|
103533
|
+
if ("commandId" in path9) {
|
|
103534
|
+
return base.at(identityOf(cluster2, CommandModel, path9.commandId));
|
|
103535
103535
|
}
|
|
103536
|
-
if ("eventId" in
|
|
103537
|
-
return base.at("events").at(identityOf(cluster2, EventModel,
|
|
103536
|
+
if ("eventId" in path9) {
|
|
103537
|
+
return base.at("events").at(identityOf(cluster2, EventModel, path9.eventId));
|
|
103538
103538
|
}
|
|
103539
103539
|
return base.at("*", kind ?? "element");
|
|
103540
103540
|
function identityOf(parent, type, id) {
|
|
@@ -103621,13 +103621,13 @@ var init_PathError = __esm({
|
|
|
103621
103621
|
PathError = class extends StatusResponseError {
|
|
103622
103622
|
#id;
|
|
103623
103623
|
#path;
|
|
103624
|
-
constructor({ path:
|
|
103624
|
+
constructor({ path: path9, status: { id, status: status3, clusterStatus }, message }) {
|
|
103625
103625
|
if (message === void 0) {
|
|
103626
103626
|
message = capitalize(decamelize(camelize(id), " "));
|
|
103627
103627
|
}
|
|
103628
103628
|
super(message, status3, clusterStatus);
|
|
103629
103629
|
this.#id = id;
|
|
103630
|
-
this.#path =
|
|
103630
|
+
this.#path = path9;
|
|
103631
103631
|
}
|
|
103632
103632
|
get id() {
|
|
103633
103633
|
return this.#id;
|
|
@@ -103651,9 +103651,9 @@ var init_WriteResult = __esm({
|
|
|
103651
103651
|
((WriteResult2) => {
|
|
103652
103652
|
function assertSuccess(result) {
|
|
103653
103653
|
const errors = result.filter((attr) => attr.status !== Status2.Success).map((attr) => {
|
|
103654
|
-
const
|
|
103654
|
+
const path9 = ExpandedPath({ ...attr, kind: "attribute" });
|
|
103655
103655
|
const status3 = new ExpandedStatus(attr);
|
|
103656
|
-
return new PathError({ path:
|
|
103656
|
+
return new PathError({ path: path9, status: status3 });
|
|
103657
103657
|
});
|
|
103658
103658
|
if (!errors.length) {
|
|
103659
103659
|
return;
|
|
@@ -104105,11 +104105,11 @@ var init_AttributeReadResponse = __esm({
|
|
|
104105
104105
|
(this.#versions[endpointId] ?? (this.#versions[endpointId] = {}))[clusterId3] = dataVersion;
|
|
104106
104106
|
}
|
|
104107
104107
|
}
|
|
104108
|
-
for (const
|
|
104109
|
-
if (
|
|
104110
|
-
this.addWildcard(
|
|
104108
|
+
for (const path9 of attributeRequests) {
|
|
104109
|
+
if (path9.endpointId === void 0 || path9.clusterId === void 0 || path9.attributeId === void 0) {
|
|
104110
|
+
this.addWildcard(path9);
|
|
104111
104111
|
} else {
|
|
104112
|
-
this.addConcrete(
|
|
104112
|
+
this.addConcrete(path9);
|
|
104113
104113
|
}
|
|
104114
104114
|
}
|
|
104115
104115
|
if (this.#dataProducers) {
|
|
@@ -104150,8 +104150,8 @@ var init_AttributeReadResponse = __esm({
|
|
|
104150
104150
|
/**
|
|
104151
104151
|
* Validate a wildcard path and update internal state.
|
|
104152
104152
|
*/
|
|
104153
|
-
addWildcard(
|
|
104154
|
-
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId, wildcardPathFlags } =
|
|
104153
|
+
addWildcard(path9) {
|
|
104154
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId, wildcardPathFlags } = path9;
|
|
104155
104155
|
if (clusterId3 === void 0 && attributeId !== void 0 && !GlobalAttrIds.has(attributeId)) {
|
|
104156
104156
|
throw new StatusResponseError(
|
|
104157
104157
|
`Illegal read of wildcard cluster with non-global attribute #${attributeId}`,
|
|
@@ -104166,7 +104166,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104166
104166
|
this.#addProducer(function* () {
|
|
104167
104167
|
this.#wildcardPathFlags = wpf;
|
|
104168
104168
|
for (const endpoint2 of this.node) {
|
|
104169
|
-
yield* this.readEndpointForWildcard(endpoint2,
|
|
104169
|
+
yield* this.readEndpointForWildcard(endpoint2, path9);
|
|
104170
104170
|
}
|
|
104171
104171
|
});
|
|
104172
104172
|
return;
|
|
@@ -104175,17 +104175,17 @@ var init_AttributeReadResponse = __esm({
|
|
|
104175
104175
|
if (endpoint) {
|
|
104176
104176
|
this.#addProducer(function() {
|
|
104177
104177
|
this.#wildcardPathFlags = wpf;
|
|
104178
|
-
return this.readEndpointForWildcard(endpoint,
|
|
104178
|
+
return this.readEndpointForWildcard(endpoint, path9);
|
|
104179
104179
|
});
|
|
104180
104180
|
}
|
|
104181
104181
|
}
|
|
104182
104182
|
/**
|
|
104183
104183
|
* Validate a concrete path and update internal state.
|
|
104184
104184
|
*/
|
|
104185
|
-
addConcrete(
|
|
104186
|
-
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } =
|
|
104185
|
+
addConcrete(path9) {
|
|
104186
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } = path9;
|
|
104187
104187
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
104188
|
-
this.addStatus(
|
|
104188
|
+
this.addStatus(path9, Status2.UnsupportedNode);
|
|
104189
104189
|
return;
|
|
104190
104190
|
}
|
|
104191
104191
|
const endpoint = this.node[endpointId];
|
|
@@ -104193,7 +104193,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104193
104193
|
const attribute2 = cluster2?.type.attributes[attributeId];
|
|
104194
104194
|
let limits;
|
|
104195
104195
|
if (attribute2 === void 0) {
|
|
104196
|
-
const modelAttr = this.node.matter.member(
|
|
104196
|
+
const modelAttr = this.node.matter.member(path9.clusterId, [ElementTag.Cluster])?.member(path9.attributeId, [ElementTag.Attribute]);
|
|
104197
104197
|
if (modelAttr) {
|
|
104198
104198
|
limits = AccessControl4(modelAttr).limits;
|
|
104199
104199
|
} else {
|
|
@@ -104216,32 +104216,32 @@ var init_AttributeReadResponse = __esm({
|
|
|
104216
104216
|
case AccessControl4.Authority.Granted:
|
|
104217
104217
|
break;
|
|
104218
104218
|
case AccessControl4.Authority.Unauthorized:
|
|
104219
|
-
this.addStatus(
|
|
104219
|
+
this.addStatus(path9, Status2.UnsupportedAccess);
|
|
104220
104220
|
return;
|
|
104221
104221
|
case AccessControl4.Authority.Restricted:
|
|
104222
|
-
this.addStatus(
|
|
104222
|
+
this.addStatus(path9, Status2.AccessRestricted);
|
|
104223
104223
|
return;
|
|
104224
104224
|
default:
|
|
104225
104225
|
throw new InternalError(`Unsupported authorization state ${permission}`);
|
|
104226
104226
|
}
|
|
104227
104227
|
}
|
|
104228
104228
|
if (endpoint === void 0) {
|
|
104229
|
-
this.addStatus(
|
|
104229
|
+
this.addStatus(path9, Status2.UnsupportedEndpoint);
|
|
104230
104230
|
return;
|
|
104231
104231
|
}
|
|
104232
104232
|
if (cluster2 === void 0) {
|
|
104233
|
-
this.addStatus(
|
|
104233
|
+
this.addStatus(path9, Status2.UnsupportedCluster);
|
|
104234
104234
|
return;
|
|
104235
104235
|
}
|
|
104236
104236
|
if (attribute2 === void 0 || !cluster2.type.attributes[attribute2.id]) {
|
|
104237
|
-
this.addStatus(
|
|
104237
|
+
this.addStatus(path9, Status2.UnsupportedAttribute);
|
|
104238
104238
|
return;
|
|
104239
104239
|
}
|
|
104240
104240
|
if (!limits.readable) {
|
|
104241
|
-
this.addStatus(
|
|
104241
|
+
this.addStatus(path9, Status2.UnsupportedRead);
|
|
104242
104242
|
return;
|
|
104243
104243
|
}
|
|
104244
|
-
const skipVersion = this.#versions?.[
|
|
104244
|
+
const skipVersion = this.#versions?.[path9.endpointId]?.[path9.clusterId];
|
|
104245
104245
|
if (skipVersion !== void 0 && skipVersion === cluster2.version) {
|
|
104246
104246
|
this.#filteredCount++;
|
|
104247
104247
|
return;
|
|
@@ -104264,9 +104264,9 @@ var init_AttributeReadResponse = __esm({
|
|
|
104264
104264
|
const value = this.#currentState[attributeId];
|
|
104265
104265
|
const version = cluster2.version;
|
|
104266
104266
|
logger55.debug(
|
|
104267
|
-
() => `Reading attribute ${this.node.inspectPath(
|
|
104267
|
+
() => `Reading attribute ${this.node.inspectPath(path9)}=${serialize(value)} (version=${version})`
|
|
104268
104268
|
);
|
|
104269
|
-
this.#addValue(
|
|
104269
|
+
this.#addValue(path9, value, version, this.#currentCluster.type.attributes[attributeId].tlv);
|
|
104270
104270
|
});
|
|
104271
104271
|
}
|
|
104272
104272
|
/**
|
|
@@ -104279,7 +104279,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104279
104279
|
*
|
|
104280
104280
|
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
104281
104281
|
*/
|
|
104282
|
-
*readEndpointForWildcard(endpoint,
|
|
104282
|
+
*readEndpointForWildcard(endpoint, path9) {
|
|
104283
104283
|
if (endpoint.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
104284
104284
|
return;
|
|
104285
104285
|
}
|
|
@@ -104291,15 +104291,15 @@ var init_AttributeReadResponse = __esm({
|
|
|
104291
104291
|
this.#currentEndpoint = endpoint;
|
|
104292
104292
|
this.#currentCluster = void 0;
|
|
104293
104293
|
}
|
|
104294
|
-
const { clusterId: clusterId3 } =
|
|
104294
|
+
const { clusterId: clusterId3 } = path9;
|
|
104295
104295
|
if (clusterId3 === void 0) {
|
|
104296
104296
|
for (const cluster2 of endpoint) {
|
|
104297
|
-
this.readClusterForWildcard(cluster2,
|
|
104297
|
+
this.readClusterForWildcard(cluster2, path9);
|
|
104298
104298
|
}
|
|
104299
104299
|
} else {
|
|
104300
104300
|
const cluster2 = endpoint[clusterId3];
|
|
104301
104301
|
if (cluster2 !== void 0) {
|
|
104302
|
-
this.readClusterForWildcard(cluster2,
|
|
104302
|
+
this.readClusterForWildcard(cluster2, path9);
|
|
104303
104303
|
}
|
|
104304
104304
|
}
|
|
104305
104305
|
}
|
|
@@ -104310,7 +104310,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104310
104310
|
*
|
|
104311
104311
|
* TODO - skip clusters for which subject is unauthorized
|
|
104312
104312
|
*/
|
|
104313
|
-
readClusterForWildcard(cluster2,
|
|
104313
|
+
readClusterForWildcard(cluster2, path9) {
|
|
104314
104314
|
if (cluster2.type.wildcardPathFlags & this.#wildcardPathFlags) {
|
|
104315
104315
|
return;
|
|
104316
104316
|
}
|
|
@@ -104318,7 +104318,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104318
104318
|
this.#currentCluster = cluster2;
|
|
104319
104319
|
this.#currentState = void 0;
|
|
104320
104320
|
}
|
|
104321
|
-
const { attributeId } =
|
|
104321
|
+
const { attributeId } = path9;
|
|
104322
104322
|
const skipVersion = this.#versions?.[this.#guardedCurrentEndpoint.id]?.[cluster2.type.id];
|
|
104323
104323
|
const filteredByVersion = skipVersion !== void 0 && skipVersion === cluster2.version;
|
|
104324
104324
|
if (attributeId === void 0) {
|
|
@@ -104331,7 +104331,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104331
104331
|
return;
|
|
104332
104332
|
}
|
|
104333
104333
|
for (const attribute2 of cluster2.type.attributes) {
|
|
104334
|
-
this.readAttributeForWildcard(attribute2,
|
|
104334
|
+
this.readAttributeForWildcard(attribute2, path9);
|
|
104335
104335
|
}
|
|
104336
104336
|
} else {
|
|
104337
104337
|
if (filteredByVersion) {
|
|
@@ -104340,7 +104340,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104340
104340
|
}
|
|
104341
104341
|
const attribute2 = cluster2.type.attributes[attributeId];
|
|
104342
104342
|
if (attribute2 !== void 0) {
|
|
104343
|
-
this.readAttributeForWildcard(attribute2,
|
|
104343
|
+
this.readAttributeForWildcard(attribute2, path9);
|
|
104344
104344
|
}
|
|
104345
104345
|
}
|
|
104346
104346
|
}
|
|
@@ -104349,7 +104349,7 @@ var init_AttributeReadResponse = __esm({
|
|
|
104349
104349
|
*
|
|
104350
104350
|
* Depends on state initialized by {@link #readClusterForWildcard}.
|
|
104351
104351
|
*/
|
|
104352
|
-
readAttributeForWildcard(attribute2,
|
|
104352
|
+
readAttributeForWildcard(attribute2, path9) {
|
|
104353
104353
|
if (!this.#guardedCurrentCluster.type.attributes[attribute2.id]) {
|
|
104354
104354
|
return;
|
|
104355
104355
|
}
|
|
@@ -104364,12 +104364,12 @@ var init_AttributeReadResponse = __esm({
|
|
|
104364
104364
|
}
|
|
104365
104365
|
const value = this.#currentState[attribute2.id];
|
|
104366
104366
|
if (value === void 0) {
|
|
104367
|
-
logger55.warn(`Attribute ${this.node.inspectPath(
|
|
104367
|
+
logger55.warn(`Attribute ${this.node.inspectPath(path9)} defined and enabled but has no value.`);
|
|
104368
104368
|
return;
|
|
104369
104369
|
}
|
|
104370
104370
|
this.#addValue(
|
|
104371
104371
|
{
|
|
104372
|
-
...
|
|
104372
|
+
...path9,
|
|
104373
104373
|
endpointId: this.#guardedCurrentEndpoint.id,
|
|
104374
104374
|
clusterId: this.#guardedCurrentCluster.type.id,
|
|
104375
104375
|
attributeId: attribute2.id
|
|
@@ -104399,13 +104399,13 @@ var init_AttributeReadResponse = __esm({
|
|
|
104399
104399
|
/**
|
|
104400
104400
|
* Add a status value.
|
|
104401
104401
|
*/
|
|
104402
|
-
addStatus(
|
|
104402
|
+
addStatus(path9, status3) {
|
|
104403
104403
|
logger55.debug(
|
|
104404
|
-
() => `Error reading attribute ${this.node.inspectPath(
|
|
104404
|
+
() => `Error reading attribute ${this.node.inspectPath(path9)}: Status=${StatusCode[status3]}(${status3})`
|
|
104405
104405
|
);
|
|
104406
104406
|
const report = {
|
|
104407
104407
|
kind: "attr-status",
|
|
104408
|
-
path:
|
|
104408
|
+
path: path9,
|
|
104409
104409
|
status: status3
|
|
104410
104410
|
};
|
|
104411
104411
|
this.#addReportData(report);
|
|
@@ -104414,10 +104414,10 @@ var init_AttributeReadResponse = __esm({
|
|
|
104414
104414
|
/**
|
|
104415
104415
|
* Add an attribute value.
|
|
104416
104416
|
*/
|
|
104417
|
-
#addValue(
|
|
104417
|
+
#addValue(path9, value, version, tlv) {
|
|
104418
104418
|
const report = {
|
|
104419
104419
|
kind: "attr-value",
|
|
104420
|
-
path:
|
|
104420
|
+
path: path9,
|
|
104421
104421
|
value,
|
|
104422
104422
|
version,
|
|
104423
104423
|
tlv
|
|
@@ -104460,32 +104460,32 @@ var init_AttributeSubscriptionResponse = __esm({
|
|
|
104460
104460
|
}
|
|
104461
104461
|
return this.#currentClusterDirty;
|
|
104462
104462
|
}
|
|
104463
|
-
addConcrete(
|
|
104464
|
-
const { endpointId, clusterId: clusterId3, attributeId } =
|
|
104463
|
+
addConcrete(path9) {
|
|
104464
|
+
const { endpointId, clusterId: clusterId3, attributeId } = path9;
|
|
104465
104465
|
if (this.#dirty[endpointId]?.[clusterId3]?.has(attributeId) === void 0) {
|
|
104466
104466
|
return;
|
|
104467
104467
|
}
|
|
104468
|
-
super.addConcrete(
|
|
104468
|
+
super.addConcrete(path9);
|
|
104469
104469
|
}
|
|
104470
|
-
*readEndpointForWildcard(endpoint,
|
|
104470
|
+
*readEndpointForWildcard(endpoint, path9) {
|
|
104471
104471
|
this.#currentEndpointDirty = this.#dirty[endpoint.id];
|
|
104472
104472
|
if (this.#currentEndpointDirty === void 0) {
|
|
104473
104473
|
return;
|
|
104474
104474
|
}
|
|
104475
|
-
yield* super.readEndpointForWildcard(endpoint,
|
|
104475
|
+
yield* super.readEndpointForWildcard(endpoint, path9);
|
|
104476
104476
|
}
|
|
104477
|
-
readClusterForWildcard(cluster2,
|
|
104477
|
+
readClusterForWildcard(cluster2, path9) {
|
|
104478
104478
|
this.#currentClusterDirty = this.currentEndpointDirty[cluster2.type.id];
|
|
104479
104479
|
if (this.#currentClusterDirty === void 0) {
|
|
104480
104480
|
return;
|
|
104481
104481
|
}
|
|
104482
|
-
super.readClusterForWildcard(cluster2,
|
|
104482
|
+
super.readClusterForWildcard(cluster2, path9);
|
|
104483
104483
|
}
|
|
104484
|
-
readAttributeForWildcard(attribute2,
|
|
104484
|
+
readAttributeForWildcard(attribute2, path9) {
|
|
104485
104485
|
if (!this.currentClusterDirty.has(attribute2.id)) {
|
|
104486
104486
|
return;
|
|
104487
104487
|
}
|
|
104488
|
-
super.readAttributeForWildcard(attribute2,
|
|
104488
|
+
super.readAttributeForWildcard(attribute2, path9);
|
|
104489
104489
|
}
|
|
104490
104490
|
addStatus() {
|
|
104491
104491
|
}
|
|
@@ -104568,9 +104568,9 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104568
104568
|
try {
|
|
104569
104569
|
const _writing = __using19(_stack, this.join("writing"));
|
|
104570
104570
|
const writeResponses = new Array();
|
|
104571
|
-
for (const { path:
|
|
104572
|
-
if (
|
|
104573
|
-
const responses = await this.#processWildcard(
|
|
104571
|
+
for (const { path: path9, data, dataVersion } of writeRequests) {
|
|
104572
|
+
if (path9.endpointId === void 0 || path9.clusterId === void 0 || path9.attributeId === void 0) {
|
|
104573
|
+
const responses = await this.#processWildcard(path9, data);
|
|
104574
104574
|
if (responses !== void 0) {
|
|
104575
104575
|
writeResponses.push(...responses);
|
|
104576
104576
|
}
|
|
@@ -104579,7 +104579,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104579
104579
|
throw new StatusResponseError("Group writes can not be concrete paths", StatusCode.InvalidAction);
|
|
104580
104580
|
}
|
|
104581
104581
|
writeResponses.push(
|
|
104582
|
-
await this.#writeConcrete(
|
|
104582
|
+
await this.#writeConcrete(path9, data, dataVersion)
|
|
104583
104583
|
);
|
|
104584
104584
|
}
|
|
104585
104585
|
}
|
|
@@ -104617,8 +104617,8 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104617
104617
|
/**
|
|
104618
104618
|
* Validate a wildcard path and update internal state.
|
|
104619
104619
|
*/
|
|
104620
|
-
async #processWildcard(
|
|
104621
|
-
const { nodeId: nodeId3, endpointId } =
|
|
104620
|
+
async #processWildcard(path9, value) {
|
|
104621
|
+
const { nodeId: nodeId3, endpointId } = path9;
|
|
104622
104622
|
if (nodeId3 !== void 0 && nodeId3 !== this.nodeId) {
|
|
104623
104623
|
return;
|
|
104624
104624
|
}
|
|
@@ -104638,7 +104638,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104638
104638
|
if (groupEndpoints !== void 0 && !groupEndpoints.includes(endpoint2.id)) {
|
|
104639
104639
|
continue;
|
|
104640
104640
|
}
|
|
104641
|
-
const response = await this.#writeEndpointForWildcard(endpoint2,
|
|
104641
|
+
const response = await this.#writeEndpointForWildcard(endpoint2, path9, value);
|
|
104642
104642
|
if (response !== void 0) {
|
|
104643
104643
|
responses.push(response);
|
|
104644
104644
|
}
|
|
@@ -104653,7 +104653,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104653
104653
|
}
|
|
104654
104654
|
const endpoint = this.node[endpointId];
|
|
104655
104655
|
if (endpoint) {
|
|
104656
|
-
const response = await this.#writeEndpointForWildcard(endpoint,
|
|
104656
|
+
const response = await this.#writeEndpointForWildcard(endpoint, path9, value);
|
|
104657
104657
|
if (response !== void 0) {
|
|
104658
104658
|
return [response];
|
|
104659
104659
|
}
|
|
@@ -104662,17 +104662,17 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104662
104662
|
/**
|
|
104663
104663
|
* Write to a concrete path and update internal state.
|
|
104664
104664
|
*/
|
|
104665
|
-
async #writeConcrete(
|
|
104666
|
-
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } =
|
|
104665
|
+
async #writeConcrete(path9, value, version) {
|
|
104666
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } = path9;
|
|
104667
104667
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
104668
|
-
return this.#asStatus(
|
|
104668
|
+
return this.#asStatus(path9, Status2.UnsupportedNode);
|
|
104669
104669
|
}
|
|
104670
104670
|
const endpoint = this.node[endpointId];
|
|
104671
104671
|
const cluster2 = endpoint?.[clusterId3];
|
|
104672
104672
|
const attribute2 = cluster2?.type.attributes[attributeId];
|
|
104673
104673
|
let limits;
|
|
104674
104674
|
if (attribute2 === void 0) {
|
|
104675
|
-
const modelAttr = this.node.matter.member(
|
|
104675
|
+
const modelAttr = this.node.matter.member(path9.clusterId, [ElementTag.Cluster])?.member(path9.attributeId, [ElementTag.Attribute]);
|
|
104676
104676
|
if (modelAttr) {
|
|
104677
104677
|
limits = AccessControl4(modelAttr).limits;
|
|
104678
104678
|
} else {
|
|
@@ -104695,39 +104695,39 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104695
104695
|
case AccessControl4.Authority.Granted:
|
|
104696
104696
|
break;
|
|
104697
104697
|
case AccessControl4.Authority.Unauthorized:
|
|
104698
|
-
return this.#asStatus(
|
|
104698
|
+
return this.#asStatus(path9, Status2.UnsupportedAccess);
|
|
104699
104699
|
case AccessControl4.Authority.Restricted:
|
|
104700
|
-
return this.#asStatus(
|
|
104700
|
+
return this.#asStatus(path9, Status2.AccessRestricted);
|
|
104701
104701
|
default:
|
|
104702
104702
|
throw new InternalError(`Unsupported authorization state ${permission}`);
|
|
104703
104703
|
}
|
|
104704
104704
|
}
|
|
104705
104705
|
if (endpoint === void 0) {
|
|
104706
|
-
return this.#asStatus(
|
|
104706
|
+
return this.#asStatus(path9, Status2.UnsupportedEndpoint);
|
|
104707
104707
|
}
|
|
104708
104708
|
if (cluster2 === void 0) {
|
|
104709
|
-
return this.#asStatus(
|
|
104709
|
+
return this.#asStatus(path9, Status2.UnsupportedCluster);
|
|
104710
104710
|
}
|
|
104711
104711
|
if (attribute2 === void 0 || !cluster2.type.attributes[attribute2.id]) {
|
|
104712
|
-
return this.#asStatus(
|
|
104712
|
+
return this.#asStatus(path9, Status2.UnsupportedAttribute);
|
|
104713
104713
|
}
|
|
104714
104714
|
if (!limits.writable) {
|
|
104715
104715
|
this.#errorCount++;
|
|
104716
|
-
return this.#asStatus(
|
|
104716
|
+
return this.#asStatus(path9, Status2.UnsupportedWrite);
|
|
104717
104717
|
}
|
|
104718
104718
|
if (hasRemoteActor(this.session)) {
|
|
104719
104719
|
if (limits.timed && !this.session.timed) {
|
|
104720
104720
|
this.#errorCount++;
|
|
104721
|
-
return this.#asStatus(
|
|
104721
|
+
return this.#asStatus(path9, Status2.NeedsTimedInteraction);
|
|
104722
104722
|
}
|
|
104723
104723
|
if (limits.fabricScoped && !this.session.fabric) {
|
|
104724
104724
|
this.#errorCount++;
|
|
104725
|
-
return this.#asStatus(
|
|
104725
|
+
return this.#asStatus(path9, Status2.UnsupportedAccess);
|
|
104726
104726
|
}
|
|
104727
104727
|
}
|
|
104728
104728
|
if (version !== void 0 && version !== cluster2.version) {
|
|
104729
104729
|
this.#errorCount++;
|
|
104730
|
-
return this.#asStatus(
|
|
104730
|
+
return this.#asStatus(path9, Status2.DataVersionMismatch);
|
|
104731
104731
|
}
|
|
104732
104732
|
if (this.#currentEndpoint !== endpoint) {
|
|
104733
104733
|
this.#currentEndpoint = endpoint;
|
|
@@ -104735,7 +104735,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104735
104735
|
} else if (this.#currentCluster !== cluster2) {
|
|
104736
104736
|
this.#currentCluster = cluster2;
|
|
104737
104737
|
}
|
|
104738
|
-
return await this.writeValue(attribute2,
|
|
104738
|
+
return await this.writeValue(attribute2, path9, value);
|
|
104739
104739
|
}
|
|
104740
104740
|
/**
|
|
104741
104741
|
* Starts new chunk or adds to current chunk all values from {@link endpoint} selected by {@link path}.
|
|
@@ -104745,8 +104745,8 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104745
104745
|
*
|
|
104746
104746
|
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
104747
104747
|
*/
|
|
104748
|
-
#writeEndpointForWildcard(endpoint,
|
|
104749
|
-
const { clusterId: clusterId3, attributeId } =
|
|
104748
|
+
#writeEndpointForWildcard(endpoint, path9, value) {
|
|
104749
|
+
const { clusterId: clusterId3, attributeId } = path9;
|
|
104750
104750
|
if (clusterId3 === void 0 || attributeId === void 0) {
|
|
104751
104751
|
throw new StatusResponseError(
|
|
104752
104752
|
"Wildcard path write must specify a clusterId and attributeId",
|
|
@@ -104759,7 +104759,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104759
104759
|
}
|
|
104760
104760
|
const cluster2 = endpoint[clusterId3];
|
|
104761
104761
|
if (cluster2 !== void 0) {
|
|
104762
|
-
return this.#writeClusterForWildcard(cluster2,
|
|
104762
|
+
return this.#writeClusterForWildcard(cluster2, path9, value);
|
|
104763
104763
|
}
|
|
104764
104764
|
}
|
|
104765
104765
|
/**
|
|
@@ -104769,17 +104769,17 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104769
104769
|
*
|
|
104770
104770
|
* TODO - skip clusters for which subject is unauthorized
|
|
104771
104771
|
*/
|
|
104772
|
-
#writeClusterForWildcard(cluster2,
|
|
104772
|
+
#writeClusterForWildcard(cluster2, path9, value) {
|
|
104773
104773
|
if (this.#currentCluster !== cluster2) {
|
|
104774
104774
|
this.#currentCluster = cluster2;
|
|
104775
104775
|
}
|
|
104776
|
-
const { attributeId } =
|
|
104776
|
+
const { attributeId } = path9;
|
|
104777
104777
|
if (attributeId === void 0) {
|
|
104778
104778
|
throw new StatusResponseError("Wildcard path write must specify an attributeId", StatusCode.InvalidAction);
|
|
104779
104779
|
} else {
|
|
104780
104780
|
const attribute2 = cluster2.type.attributes[attributeId];
|
|
104781
104781
|
if (attribute2 !== void 0) {
|
|
104782
|
-
return this.#writeAttributeForWildcard(attribute2,
|
|
104782
|
+
return this.#writeAttributeForWildcard(attribute2, path9, value);
|
|
104783
104783
|
}
|
|
104784
104784
|
}
|
|
104785
104785
|
}
|
|
@@ -104788,7 +104788,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104788
104788
|
*
|
|
104789
104789
|
* Depends on state initialized by {@link #writeClusterForWildcard}.
|
|
104790
104790
|
*/
|
|
104791
|
-
#writeAttributeForWildcard(attribute2,
|
|
104791
|
+
#writeAttributeForWildcard(attribute2, path9, value) {
|
|
104792
104792
|
if (!this.#guardedCurrentCluster.type.attributes[attribute2.id]) {
|
|
104793
104793
|
return;
|
|
104794
104794
|
}
|
|
@@ -104806,7 +104806,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104806
104806
|
return this.writeValue(
|
|
104807
104807
|
attribute2,
|
|
104808
104808
|
{
|
|
104809
|
-
...
|
|
104809
|
+
...path9,
|
|
104810
104810
|
endpointId: this.#guardedCurrentEndpoint.id,
|
|
104811
104811
|
clusterId: this.#guardedCurrentCluster.type.id,
|
|
104812
104812
|
attributeId: attribute2.id
|
|
@@ -104817,15 +104817,15 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104817
104817
|
/**
|
|
104818
104818
|
* Add a status value.
|
|
104819
104819
|
*/
|
|
104820
|
-
#asStatus(
|
|
104820
|
+
#asStatus(path9, status3, clusterStatus) {
|
|
104821
104821
|
if (status3 !== Status2.Success) {
|
|
104822
104822
|
logger56.debug(
|
|
104823
|
-
() => `Error writing attribute ${this.node.inspectPath(
|
|
104823
|
+
() => `Error writing attribute ${this.node.inspectPath(path9)}: Status=${StatusCode[status3]}(${toHex(status3)}), ClusterStatus=${clusterStatus !== void 0 ? toHex(clusterStatus) : void 0}`
|
|
104824
104824
|
);
|
|
104825
104825
|
}
|
|
104826
104826
|
const report = {
|
|
104827
104827
|
kind: "attr-status",
|
|
104828
|
-
path:
|
|
104828
|
+
path: path9,
|
|
104829
104829
|
status: status3,
|
|
104830
104830
|
clusterStatus
|
|
104831
104831
|
};
|
|
@@ -104834,8 +104834,8 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104834
104834
|
}
|
|
104835
104835
|
return report;
|
|
104836
104836
|
}
|
|
104837
|
-
async writeValue(attribute2,
|
|
104838
|
-
const { attributeId, listIndex } =
|
|
104837
|
+
async writeValue(attribute2, path9, value) {
|
|
104838
|
+
const { attributeId, listIndex } = path9;
|
|
104839
104839
|
if (listIndex !== void 0 && listIndex !== null) {
|
|
104840
104840
|
throw new StatusResponseError(
|
|
104841
104841
|
`Unsupported Write path provided: listIndex === ${listIndex}`,
|
|
@@ -104846,7 +104846,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104846
104846
|
const { tlv } = attribute2;
|
|
104847
104847
|
if (listIndex === void 0) {
|
|
104848
104848
|
const decoded = this.#decodeWithSchema(tlv, value);
|
|
104849
|
-
logger56.debug(() => `Writing attribute ${this.node.inspectPath(
|
|
104849
|
+
logger56.debug(() => `Writing attribute ${this.node.inspectPath(path9)}=${Diagnostic.json(decoded)}`);
|
|
104850
104850
|
const writeState = await this.#guardedCurrentCluster.openForWrite(this.session);
|
|
104851
104851
|
writeState[attributeId] = decoded;
|
|
104852
104852
|
await this.session.transaction?.commit();
|
|
@@ -104860,7 +104860,7 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104860
104860
|
const writeState = await this.#guardedCurrentCluster.openForWrite(this.session);
|
|
104861
104861
|
const decoded = this.#decodeWithSchema(tlv.elementSchema, value);
|
|
104862
104862
|
logger56.debug(
|
|
104863
|
-
() => `Writing attribute chunk ${this.node.inspectPath(
|
|
104863
|
+
() => `Writing attribute chunk ${this.node.inspectPath(path9)} adding ${serialize(decoded)}`
|
|
104864
104864
|
);
|
|
104865
104865
|
writeState[attributeId].push(decoded);
|
|
104866
104866
|
await this.session.transaction?.commit();
|
|
@@ -104869,12 +104869,12 @@ var init_AttributeWriteResponse = __esm({
|
|
|
104869
104869
|
await this.session.transaction?.rollback();
|
|
104870
104870
|
if (StatusResponseError.is(error)) {
|
|
104871
104871
|
this.#errorCount++;
|
|
104872
|
-
return this.#asStatus(
|
|
104872
|
+
return this.#asStatus(path9, error.code, error.clusterCode);
|
|
104873
104873
|
}
|
|
104874
104874
|
throw error;
|
|
104875
104875
|
}
|
|
104876
104876
|
this.#successCount++;
|
|
104877
|
-
return this.#asStatus(
|
|
104877
|
+
return this.#asStatus(path9, Status2.Success);
|
|
104878
104878
|
}
|
|
104879
104879
|
#decodeWithSchema(tlv, value) {
|
|
104880
104880
|
return tlv.injectField(
|
|
@@ -104972,15 +104972,15 @@ var init_CommandInvokeResponse = __esm({
|
|
|
104972
104972
|
const _invoking = __using20(_stack, this.join("invoking"));
|
|
104973
104973
|
const multipleInvokes = invokeRequests.length > 1;
|
|
104974
104974
|
for (const command of invokeRequests) {
|
|
104975
|
-
const { commandPath:
|
|
104976
|
-
if (
|
|
104975
|
+
const { commandPath: path9, commandFields, commandRef } = command;
|
|
104976
|
+
if (path9.endpointId === void 0 || path9.clusterId === void 0 || path9.commandId === void 0) {
|
|
104977
104977
|
if (multipleInvokes) {
|
|
104978
104978
|
throw new StatusResponseError(
|
|
104979
104979
|
"Wildcard path must not be used with multiple invokes",
|
|
104980
104980
|
StatusCode.InvalidAction
|
|
104981
104981
|
);
|
|
104982
104982
|
}
|
|
104983
|
-
this.#processWildcard(
|
|
104983
|
+
this.#processWildcard(path9, commandRef, commandFields);
|
|
104984
104984
|
} else {
|
|
104985
104985
|
if (Subject.isGroup(this.session.subject)) {
|
|
104986
104986
|
throw new StatusResponseError("Group commands connot be concrete paths", StatusCode.InvalidAction);
|
|
@@ -104991,7 +104991,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
104991
104991
|
StatusCode.InvalidAction
|
|
104992
104992
|
);
|
|
104993
104993
|
}
|
|
104994
|
-
this.#processConcrete(
|
|
104994
|
+
this.#processConcrete(path9, commandRef, commandFields);
|
|
104995
104995
|
}
|
|
104996
104996
|
}
|
|
104997
104997
|
if (this.#invokers) {
|
|
@@ -105022,8 +105022,8 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105022
105022
|
/**
|
|
105023
105023
|
* Process a wildcard path and invoke commands on all endpoints that match the path.
|
|
105024
105024
|
*/
|
|
105025
|
-
#processWildcard(
|
|
105026
|
-
const { clusterId: clusterId3, endpointId, commandId: commandId3 } =
|
|
105025
|
+
#processWildcard(path9, commandRef, commandFields) {
|
|
105026
|
+
const { clusterId: clusterId3, endpointId, commandId: commandId3 } = path9;
|
|
105027
105027
|
const isGroupPath = Subject.isGroup(this.session.subject);
|
|
105028
105028
|
if (isGroupPath && endpointId !== void 0) {
|
|
105029
105029
|
throw new StatusResponseError(
|
|
@@ -105051,19 +105051,19 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105051
105051
|
if (groupEndpoints !== void 0 && !groupEndpoints.includes(endpoint.id)) {
|
|
105052
105052
|
continue;
|
|
105053
105053
|
}
|
|
105054
|
-
yield* this.#processEndpointForWildcard(endpoint,
|
|
105054
|
+
yield* this.#processEndpointForWildcard(endpoint, path9, commandRef, commandFields);
|
|
105055
105055
|
}
|
|
105056
105056
|
});
|
|
105057
105057
|
}
|
|
105058
105058
|
/**
|
|
105059
105059
|
* Invoke a command specified by a concrete path
|
|
105060
105060
|
*/
|
|
105061
|
-
#processConcrete(
|
|
105062
|
-
const { endpointId, clusterId: clusterId3, commandId: commandId3 } =
|
|
105061
|
+
#processConcrete(path9, commandRef, commandFields) {
|
|
105062
|
+
const { endpointId, clusterId: clusterId3, commandId: commandId3 } = path9;
|
|
105063
105063
|
const pathKey = `${endpointId}-${clusterId3}-${commandId3}`;
|
|
105064
105064
|
if (this.#registeredPaths.has(pathKey)) {
|
|
105065
105065
|
throw new StatusResponseError(
|
|
105066
|
-
`Duplicate concrete command path ${this.node.inspectPath(
|
|
105066
|
+
`Duplicate concrete command path ${this.node.inspectPath(path9)} on batch invoke`,
|
|
105067
105067
|
StatusCode.InvalidAction
|
|
105068
105068
|
);
|
|
105069
105069
|
}
|
|
@@ -105082,7 +105082,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105082
105082
|
const command = cluster2?.type.commands[commandId3];
|
|
105083
105083
|
let limits;
|
|
105084
105084
|
if (command === void 0) {
|
|
105085
|
-
const modelAttr = this.node.matter.member(
|
|
105085
|
+
const modelAttr = this.node.matter.member(path9.clusterId, [ElementTag.Cluster])?.member(path9.commandId, [ElementTag.Command]);
|
|
105086
105086
|
if (modelAttr) {
|
|
105087
105087
|
limits = AccessControl4(modelAttr).limits;
|
|
105088
105088
|
} else {
|
|
@@ -105105,34 +105105,34 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105105
105105
|
case AccessControl4.Authority.Granted:
|
|
105106
105106
|
break;
|
|
105107
105107
|
case AccessControl4.Authority.Unauthorized:
|
|
105108
|
-
return this.#addStatus(
|
|
105108
|
+
return this.#addStatus(path9, commandRef, Status2.UnsupportedAccess);
|
|
105109
105109
|
case AccessControl4.Authority.Restricted:
|
|
105110
|
-
return this.#addStatus(
|
|
105110
|
+
return this.#addStatus(path9, commandRef, Status2.AccessRestricted);
|
|
105111
105111
|
default:
|
|
105112
105112
|
throw new InternalError(`Unsupported authorization state ${permission}`);
|
|
105113
105113
|
}
|
|
105114
105114
|
}
|
|
105115
105115
|
if (endpoint === void 0) {
|
|
105116
|
-
return this.#addStatus(
|
|
105116
|
+
return this.#addStatus(path9, commandRef, Status2.UnsupportedEndpoint);
|
|
105117
105117
|
}
|
|
105118
105118
|
if (cluster2 === void 0) {
|
|
105119
|
-
return this.#addStatus(
|
|
105119
|
+
return this.#addStatus(path9, commandRef, Status2.UnsupportedCluster);
|
|
105120
105120
|
}
|
|
105121
105121
|
if (command === void 0 || !cluster2.type.commands[command.id]) {
|
|
105122
|
-
return this.#addStatus(
|
|
105122
|
+
return this.#addStatus(path9, commandRef, Status2.UnsupportedCommand);
|
|
105123
105123
|
}
|
|
105124
105124
|
if (hasRemoteActor(this.session)) {
|
|
105125
105125
|
if (limits.largeMessage && !this.session.largeMessage) {
|
|
105126
105126
|
this.#errorCount++;
|
|
105127
|
-
return this.#addStatus(
|
|
105127
|
+
return this.#addStatus(path9, commandRef, Status2.InvalidTransportType);
|
|
105128
105128
|
}
|
|
105129
105129
|
if (limits.fabricScoped && !this.session.fabric) {
|
|
105130
105130
|
this.#errorCount++;
|
|
105131
|
-
return this.#addStatus(
|
|
105131
|
+
return this.#addStatus(path9, commandRef, Status2.UnsupportedAccess);
|
|
105132
105132
|
}
|
|
105133
105133
|
if (limits.timed && !this.session.timed) {
|
|
105134
105134
|
this.#errorCount++;
|
|
105135
|
-
return this.#addStatus(
|
|
105135
|
+
return this.#addStatus(path9, commandRef, Status2.NeedsTimedInteraction);
|
|
105136
105136
|
}
|
|
105137
105137
|
}
|
|
105138
105138
|
this.#addInvoker(async function* invokeConcretePath() {
|
|
@@ -105143,7 +105143,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105143
105143
|
}
|
|
105144
105144
|
this.#currentEndpoint = endpoint;
|
|
105145
105145
|
}
|
|
105146
|
-
await this.#invokeCommand(command,
|
|
105146
|
+
await this.#invokeCommand(command, path9, commandRef, commandFields, cluster2.commands[command.id]);
|
|
105147
105147
|
});
|
|
105148
105148
|
}
|
|
105149
105149
|
/**
|
|
@@ -105154,8 +105154,8 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105154
105154
|
**
|
|
105155
105155
|
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
105156
105156
|
*/
|
|
105157
|
-
async *#processEndpointForWildcard(endpoint,
|
|
105158
|
-
const { clusterId: clusterId3 } =
|
|
105157
|
+
async *#processEndpointForWildcard(endpoint, path9, commandRef, commandFields) {
|
|
105158
|
+
const { clusterId: clusterId3 } = path9;
|
|
105159
105159
|
if (this.#currentEndpoint !== endpoint) {
|
|
105160
105160
|
if (this.#chunk) {
|
|
105161
105161
|
yield this.#chunk;
|
|
@@ -105165,7 +105165,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105165
105165
|
}
|
|
105166
105166
|
const cluster2 = endpoint[clusterId3];
|
|
105167
105167
|
if (cluster2 !== void 0) {
|
|
105168
|
-
const { commandId: commandId3 } =
|
|
105168
|
+
const { commandId: commandId3 } = path9;
|
|
105169
105169
|
const command = cluster2.type.commands[commandId3];
|
|
105170
105170
|
if (command !== void 0) {
|
|
105171
105171
|
if (hasRemoteActor(this.session)) {
|
|
@@ -105186,7 +105186,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105186
105186
|
await this.#invokeCommand(
|
|
105187
105187
|
command,
|
|
105188
105188
|
{
|
|
105189
|
-
...
|
|
105189
|
+
...path9,
|
|
105190
105190
|
endpointId: endpoint.id
|
|
105191
105191
|
},
|
|
105192
105192
|
commandRef,
|
|
@@ -105216,15 +105216,15 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105216
105216
|
/**
|
|
105217
105217
|
* Add a status value.
|
|
105218
105218
|
*/
|
|
105219
|
-
#addStatus(
|
|
105219
|
+
#addStatus(path9, commandRef, status3, clusterStatus) {
|
|
105220
105220
|
if (status3 !== StatusCode.Success) {
|
|
105221
105221
|
logger57.info(
|
|
105222
|
-
() => `Invoke error ${this.node.inspectPath(
|
|
105222
|
+
() => `Invoke error ${this.node.inspectPath(path9)}: Status=${StatusCode[status3]}(${status3}), ClusterStatus=${clusterStatus}`
|
|
105223
105223
|
);
|
|
105224
105224
|
}
|
|
105225
105225
|
const response = {
|
|
105226
105226
|
kind: "cmd-status",
|
|
105227
|
-
path:
|
|
105227
|
+
path: path9,
|
|
105228
105228
|
status: status3,
|
|
105229
105229
|
clusterStatus,
|
|
105230
105230
|
commandRef
|
|
@@ -105234,7 +105234,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105234
105234
|
}
|
|
105235
105235
|
this.#addResponse(response);
|
|
105236
105236
|
}
|
|
105237
|
-
async #invokeCommand(command,
|
|
105237
|
+
async #invokeCommand(command, path9, commandRef, commandFields, invoker) {
|
|
105238
105238
|
try {
|
|
105239
105239
|
const { requestTlv, responseTlv } = command;
|
|
105240
105240
|
const request = this.#decodeWithSchema(requestTlv, commandFields);
|
|
@@ -105244,12 +105244,12 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105244
105244
|
this.#successCount++;
|
|
105245
105245
|
const encodedResponse = responseTlv.encodeTlv(response);
|
|
105246
105246
|
if (encodedResponse.length === 0) {
|
|
105247
|
-
this.#addStatus(
|
|
105247
|
+
this.#addStatus(path9, commandRef, StatusCode.Success);
|
|
105248
105248
|
} else {
|
|
105249
105249
|
this.#addResponse({
|
|
105250
105250
|
kind: "cmd-response",
|
|
105251
105251
|
path: {
|
|
105252
|
-
...
|
|
105252
|
+
...path9,
|
|
105253
105253
|
commandId: command.responseId
|
|
105254
105254
|
},
|
|
105255
105255
|
data: encodedResponse,
|
|
@@ -105272,7 +105272,7 @@ var init_CommandInvokeResponse = __esm({
|
|
|
105272
105272
|
} else {
|
|
105273
105273
|
logger57.info(errorLogText);
|
|
105274
105274
|
}
|
|
105275
|
-
this.#addStatus(
|
|
105275
|
+
this.#addStatus(path9, commandRef, errorCode, error.clusterCode);
|
|
105276
105276
|
return;
|
|
105277
105277
|
}
|
|
105278
105278
|
throw error;
|
|
@@ -105338,11 +105338,11 @@ var init_EventReadResponse = __esm({
|
|
|
105338
105338
|
if (isFabricFiltered) {
|
|
105339
105339
|
this.#filteredForFabricIndex = this.session.fabric ?? FabricIndex3.NO_FABRIC;
|
|
105340
105340
|
}
|
|
105341
|
-
for (const
|
|
105342
|
-
if (
|
|
105343
|
-
this.#addWildcard(
|
|
105341
|
+
for (const path9 of eventRequests) {
|
|
105342
|
+
if (path9.endpointId === void 0 || path9.clusterId === void 0 || path9.eventId === void 0) {
|
|
105343
|
+
this.#addWildcard(path9);
|
|
105344
105344
|
} else {
|
|
105345
|
-
const status3 = this.#addConcrete(
|
|
105345
|
+
const status3 = this.#addConcrete(path9);
|
|
105346
105346
|
if (status3 !== void 0) {
|
|
105347
105347
|
yield [status3];
|
|
105348
105348
|
this.#statusCount++;
|
|
@@ -105378,8 +105378,8 @@ var init_EventReadResponse = __esm({
|
|
|
105378
105378
|
/**
|
|
105379
105379
|
* Validate a wildcard path and update the internal state.
|
|
105380
105380
|
*/
|
|
105381
|
-
#addWildcard(
|
|
105382
|
-
const { nodeId: nodeId3, clusterId: clusterId3, endpointId, eventId: eventId3 } =
|
|
105381
|
+
#addWildcard(path9) {
|
|
105382
|
+
const { nodeId: nodeId3, clusterId: clusterId3, endpointId, eventId: eventId3 } = path9;
|
|
105383
105383
|
if (clusterId3 === void 0 && eventId3 !== void 0) {
|
|
105384
105384
|
throw new StatusResponseError("Illegal read request with wildcard cluster ID", StatusCode.InvalidAction);
|
|
105385
105385
|
}
|
|
@@ -105388,29 +105388,29 @@ var init_EventReadResponse = __esm({
|
|
|
105388
105388
|
}
|
|
105389
105389
|
if (endpointId === void 0) {
|
|
105390
105390
|
for (const endpoint2 of this.node) {
|
|
105391
|
-
this.#addEndpointForWildcard(endpoint2,
|
|
105391
|
+
this.#addEndpointForWildcard(endpoint2, path9);
|
|
105392
105392
|
}
|
|
105393
105393
|
return;
|
|
105394
105394
|
}
|
|
105395
105395
|
const endpoint = this.node[endpointId];
|
|
105396
105396
|
if (endpoint) {
|
|
105397
|
-
return this.#addEndpointForWildcard(endpoint,
|
|
105397
|
+
return this.#addEndpointForWildcard(endpoint, path9);
|
|
105398
105398
|
}
|
|
105399
105399
|
}
|
|
105400
105400
|
/**
|
|
105401
105401
|
* Validate a concrete path and update the internal state.
|
|
105402
105402
|
*/
|
|
105403
|
-
#addConcrete(
|
|
105404
|
-
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, eventId: eventId3 } =
|
|
105403
|
+
#addConcrete(path9) {
|
|
105404
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, eventId: eventId3 } = path9;
|
|
105405
105405
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
105406
|
-
return this.#asStatus(
|
|
105406
|
+
return this.#asStatus(path9, Status2.UnsupportedNode);
|
|
105407
105407
|
}
|
|
105408
105408
|
const endpoint = this.node[endpointId];
|
|
105409
105409
|
const cluster2 = endpoint?.[clusterId3];
|
|
105410
105410
|
const event3 = cluster2?.type.events[eventId3];
|
|
105411
105411
|
let limits;
|
|
105412
105412
|
if (event3 === void 0) {
|
|
105413
|
-
const modelEvent = this.node.matter.member(
|
|
105413
|
+
const modelEvent = this.node.matter.member(path9.clusterId, [ElementTag.Cluster])?.member(path9.eventId, [ElementTag.Event]);
|
|
105414
105414
|
if (modelEvent) {
|
|
105415
105415
|
limits = AccessControl4(modelEvent).limits;
|
|
105416
105416
|
} else {
|
|
@@ -105433,21 +105433,21 @@ var init_EventReadResponse = __esm({
|
|
|
105433
105433
|
case AccessControl4.Authority.Granted:
|
|
105434
105434
|
break;
|
|
105435
105435
|
case AccessControl4.Authority.Unauthorized:
|
|
105436
|
-
return this.#asStatus(
|
|
105436
|
+
return this.#asStatus(path9, Status2.UnsupportedAccess);
|
|
105437
105437
|
case AccessControl4.Authority.Restricted:
|
|
105438
|
-
return this.#asStatus(
|
|
105438
|
+
return this.#asStatus(path9, Status2.AccessRestricted);
|
|
105439
105439
|
default:
|
|
105440
105440
|
throw new InternalError(`Unsupported authorization state ${permission}`);
|
|
105441
105441
|
}
|
|
105442
105442
|
}
|
|
105443
105443
|
if (endpoint === void 0) {
|
|
105444
|
-
return this.#asStatus(
|
|
105444
|
+
return this.#asStatus(path9, Status2.UnsupportedEndpoint);
|
|
105445
105445
|
}
|
|
105446
105446
|
if (cluster2 === void 0) {
|
|
105447
|
-
return this.#asStatus(
|
|
105447
|
+
return this.#asStatus(path9, Status2.UnsupportedCluster);
|
|
105448
105448
|
}
|
|
105449
105449
|
if (event3 === void 0 || !cluster2.type.events[event3.id]) {
|
|
105450
|
-
return this.#asStatus(
|
|
105450
|
+
return this.#asStatus(path9, Status2.UnsupportedEvent);
|
|
105451
105451
|
}
|
|
105452
105452
|
if (this.#currentEndpoint !== endpoint) {
|
|
105453
105453
|
this.#currentEndpoint = endpoint;
|
|
@@ -105455,7 +105455,7 @@ var init_EventReadResponse = __esm({
|
|
|
105455
105455
|
} else if (this.#currentCluster !== cluster2) {
|
|
105456
105456
|
this.#currentCluster = cluster2;
|
|
105457
105457
|
}
|
|
105458
|
-
this.#registerEventPath(
|
|
105458
|
+
this.#registerEventPath(path9);
|
|
105459
105459
|
}
|
|
105460
105460
|
/**
|
|
105461
105461
|
* Starts new chunk or adds to current chunk all values from {@link endpoint} selected by {@link path}.
|
|
@@ -105465,20 +105465,20 @@ var init_EventReadResponse = __esm({
|
|
|
105465
105465
|
*
|
|
105466
105466
|
* TODO - skip endpoints for which subject is unauthorized
|
|
105467
105467
|
*/
|
|
105468
|
-
#addEndpointForWildcard(endpoint,
|
|
105468
|
+
#addEndpointForWildcard(endpoint, path9) {
|
|
105469
105469
|
if (this.#currentEndpoint !== endpoint) {
|
|
105470
105470
|
this.#currentEndpoint = endpoint;
|
|
105471
105471
|
this.#currentCluster = void 0;
|
|
105472
105472
|
}
|
|
105473
|
-
const { clusterId: clusterId3 } =
|
|
105473
|
+
const { clusterId: clusterId3 } = path9;
|
|
105474
105474
|
if (clusterId3 === void 0) {
|
|
105475
105475
|
for (const cluster2 of endpoint) {
|
|
105476
|
-
this.#addClusterForWildcard(cluster2, { ...
|
|
105476
|
+
this.#addClusterForWildcard(cluster2, { ...path9, endpointId: endpoint.id });
|
|
105477
105477
|
}
|
|
105478
105478
|
} else {
|
|
105479
105479
|
const cluster2 = endpoint[clusterId3];
|
|
105480
105480
|
if (cluster2 !== void 0) {
|
|
105481
|
-
this.#addClusterForWildcard(cluster2, { ...
|
|
105481
|
+
this.#addClusterForWildcard(cluster2, { ...path9, endpointId: endpoint.id });
|
|
105482
105482
|
}
|
|
105483
105483
|
}
|
|
105484
105484
|
}
|
|
@@ -105489,15 +105489,15 @@ var init_EventReadResponse = __esm({
|
|
|
105489
105489
|
*
|
|
105490
105490
|
* TODO - skip endpoints for which subject is unauthorized as optimization
|
|
105491
105491
|
*/
|
|
105492
|
-
#addClusterForWildcard(cluster2,
|
|
105492
|
+
#addClusterForWildcard(cluster2, path9) {
|
|
105493
105493
|
if (this.#currentCluster !== cluster2) {
|
|
105494
105494
|
this.#currentCluster = cluster2;
|
|
105495
105495
|
}
|
|
105496
|
-
const { eventId: eventId3 } =
|
|
105496
|
+
const { eventId: eventId3 } = path9;
|
|
105497
105497
|
if (eventId3 === void 0) {
|
|
105498
105498
|
for (const event3 of cluster2.type.events) {
|
|
105499
105499
|
this.#addEventForWildcard(event3, {
|
|
105500
|
-
...
|
|
105500
|
+
...path9,
|
|
105501
105501
|
clusterId: cluster2.type.id
|
|
105502
105502
|
});
|
|
105503
105503
|
}
|
|
@@ -105505,7 +105505,7 @@ var init_EventReadResponse = __esm({
|
|
|
105505
105505
|
const event3 = cluster2.type.events[eventId3];
|
|
105506
105506
|
if (event3 !== void 0) {
|
|
105507
105507
|
this.#addEventForWildcard(event3, {
|
|
105508
|
-
...
|
|
105508
|
+
...path9,
|
|
105509
105509
|
clusterId: cluster2.type.id
|
|
105510
105510
|
});
|
|
105511
105511
|
}
|
|
@@ -105516,24 +105516,24 @@ var init_EventReadResponse = __esm({
|
|
|
105516
105516
|
*
|
|
105517
105517
|
* Depends on state initialized by {@link #addClusterForWildcard}.
|
|
105518
105518
|
*/
|
|
105519
|
-
#addEventForWildcard(event3,
|
|
105519
|
+
#addEventForWildcard(event3, path9) {
|
|
105520
105520
|
if (!this.#guardedCurrentCluster.type.events[event3.id]) {
|
|
105521
105521
|
return;
|
|
105522
105522
|
}
|
|
105523
105523
|
if (hasRemoteActor(this.session) && this.session.authorityAt(event3.limits.readLevel, this.#guardedCurrentCluster.location) !== AccessControl4.Authority.Granted) {
|
|
105524
105524
|
return;
|
|
105525
105525
|
}
|
|
105526
|
-
this.#registerEventPath({ ...
|
|
105526
|
+
this.#registerEventPath({ ...path9, eventId: event3.id });
|
|
105527
105527
|
}
|
|
105528
|
-
#createEventKey(
|
|
105529
|
-
const { endpointId, clusterId: clusterId3, eventId: eventId3 } =
|
|
105528
|
+
#createEventKey(path9) {
|
|
105529
|
+
const { endpointId, clusterId: clusterId3, eventId: eventId3 } = path9;
|
|
105530
105530
|
return `${endpointId}:${clusterId3}:${eventId3}`;
|
|
105531
105531
|
}
|
|
105532
|
-
#registerEventPath(
|
|
105533
|
-
const { eventId: eventId3 } =
|
|
105532
|
+
#registerEventPath(path9) {
|
|
105533
|
+
const { eventId: eventId3 } = path9;
|
|
105534
105534
|
this.#allowedEventPaths.set(
|
|
105535
105535
|
this.#createEventKey({
|
|
105536
|
-
...
|
|
105536
|
+
...path9,
|
|
105537
105537
|
endpointId: this.#guardedCurrentEndpoint.id,
|
|
105538
105538
|
clusterId: this.#guardedCurrentCluster.type.id,
|
|
105539
105539
|
eventId: eventId3
|
|
@@ -105563,11 +105563,11 @@ var init_EventReadResponse = __esm({
|
|
|
105563
105563
|
/**
|
|
105564
105564
|
* Add a status value.
|
|
105565
105565
|
*/
|
|
105566
|
-
#asStatus(
|
|
105567
|
-
logger58.debug(`Error reading event ${this.node.inspectPath(
|
|
105566
|
+
#asStatus(path9, status3) {
|
|
105567
|
+
logger58.debug(`Error reading event ${this.node.inspectPath(path9)}: Status=${StatusCode[status3]}(${status3})`);
|
|
105568
105568
|
const report = {
|
|
105569
105569
|
kind: "event-status",
|
|
105570
|
-
path:
|
|
105570
|
+
path: path9,
|
|
105571
105571
|
status: status3
|
|
105572
105572
|
};
|
|
105573
105573
|
return report;
|
|
@@ -109223,8 +109223,8 @@ var init_DclClient = __esm({
|
|
|
109223
109223
|
};
|
|
109224
109224
|
MatterDclResponseError = class extends MatterDclError {
|
|
109225
109225
|
response;
|
|
109226
|
-
constructor(
|
|
109227
|
-
super(`Error fetching ${
|
|
109226
|
+
constructor(path9, error, options) {
|
|
109227
|
+
super(`Error fetching ${path9} from DCL: ${error.code} - ${error.message}`, options);
|
|
109228
109228
|
this.response = error;
|
|
109229
109229
|
}
|
|
109230
109230
|
};
|
|
@@ -109234,11 +109234,11 @@ var init_DclClient = __esm({
|
|
|
109234
109234
|
this.#baseUrl = this.production ? DCL_PRODUCTION_URL : DCL_TEST_URL;
|
|
109235
109235
|
}
|
|
109236
109236
|
#baseUrl;
|
|
109237
|
-
async #fetchPaginatedJson(
|
|
109237
|
+
async #fetchPaginatedJson(path9, paginatedField, options) {
|
|
109238
109238
|
const allItems = [];
|
|
109239
109239
|
let nextKey;
|
|
109240
109240
|
do {
|
|
109241
|
-
const currentPath = nextKey !== void 0 ? `${
|
|
109241
|
+
const currentPath = nextKey !== void 0 ? `${path9}${path9.includes("?") ? "&" : "?"}pagination.key=${encodeURIComponent(nextKey)}` : path9;
|
|
109242
109242
|
const response = await this.#fetchJson(currentPath, options);
|
|
109243
109243
|
const items = response[paginatedField];
|
|
109244
109244
|
if (items && Array.isArray(items)) {
|
|
@@ -109248,8 +109248,8 @@ var init_DclClient = __esm({
|
|
|
109248
109248
|
} while (nextKey);
|
|
109249
109249
|
return allItems;
|
|
109250
109250
|
}
|
|
109251
|
-
async #fetchJson(
|
|
109252
|
-
const url2 = new URL(
|
|
109251
|
+
async #fetchJson(path9, options) {
|
|
109252
|
+
const url2 = new URL(path9, this.#baseUrl).toString();
|
|
109253
109253
|
logger70.debug(`Fetching for DCL:`, url2);
|
|
109254
109254
|
try {
|
|
109255
109255
|
const timeoutMs = options?.timeout ?? DEFAULT_DCL_TIMEOUT;
|
|
@@ -109261,13 +109261,13 @@ var init_DclClient = __esm({
|
|
|
109261
109261
|
signal: AbortSignal.timeout(timeoutMs)
|
|
109262
109262
|
});
|
|
109263
109263
|
if (!response.ok) {
|
|
109264
|
-
throw new MatterDclResponseError(
|
|
109264
|
+
throw new MatterDclResponseError(path9, await response.json());
|
|
109265
109265
|
}
|
|
109266
109266
|
return await response.json();
|
|
109267
109267
|
} catch (error) {
|
|
109268
109268
|
MatterDclResponseError.reject(error);
|
|
109269
109269
|
throw new MatterDclResponseError(
|
|
109270
|
-
|
|
109270
|
+
path9,
|
|
109271
109271
|
{
|
|
109272
109272
|
code: 500,
|
|
109273
109273
|
message: error.message ?? error,
|
|
@@ -109287,8 +109287,8 @@ var init_DclClient = __esm({
|
|
|
109287
109287
|
return certList.approvedRootCertificates.certs;
|
|
109288
109288
|
}
|
|
109289
109289
|
async fetchRootCertificateBySubject(subject, options) {
|
|
109290
|
-
const
|
|
109291
|
-
const response = await this.#fetchJson(
|
|
109290
|
+
const path9 = `/dcl/pki/certificates/${encodeURIComponent(subject.subject)}/${encodeURIComponent(subject.subjectKeyId)}`;
|
|
109291
|
+
const response = await this.#fetchJson(path9, options);
|
|
109292
109292
|
if (!response || !response.approvedCertificates || response.approvedCertificates.subject !== subject.subject || response.approvedCertificates.subjectKeyId !== subject.subjectKeyId || response.approvedCertificates.schemaVersion !== 0) {
|
|
109293
109293
|
throw new MatterDclError(
|
|
109294
109294
|
`Root certificate not found for subject: ${subject.subject}, subjectKeyId: ${subject.subjectKeyId}`
|
|
@@ -109297,24 +109297,24 @@ var init_DclClient = __esm({
|
|
|
109297
109297
|
return response.approvedCertificates.certs;
|
|
109298
109298
|
}
|
|
109299
109299
|
async fetchModelByVidPid(vid, pid, options) {
|
|
109300
|
-
const
|
|
109301
|
-
const response = await this.#fetchJson(
|
|
109300
|
+
const path9 = `/dcl/model/models/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}`;
|
|
109301
|
+
const response = await this.#fetchJson(path9, options);
|
|
109302
109302
|
if (!response || !response.model || response.model.vid !== vid || response.model.pid !== pid || response.model.schemaVersion !== 0) {
|
|
109303
109303
|
throw new MatterDclError(`Model not found for VID: ${vid}, PID: ${pid}`);
|
|
109304
109304
|
}
|
|
109305
109305
|
return response.model;
|
|
109306
109306
|
}
|
|
109307
109307
|
async fetchModelVersionsByVidPid(vid, pid, options) {
|
|
109308
|
-
const
|
|
109309
|
-
const response = await this.#fetchJson(
|
|
109308
|
+
const path9 = `/dcl/model/versions/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}`;
|
|
109309
|
+
const response = await this.#fetchJson(path9, options);
|
|
109310
109310
|
if (!response || !response.modelVersions || response.modelVersions.vid !== vid || response.modelVersions.pid !== pid || response.modelVersions.schemaVersion !== 0) {
|
|
109311
109311
|
throw new MatterDclError(`Model versions not found for VID: ${vid}, PID: ${pid}`);
|
|
109312
109312
|
}
|
|
109313
109313
|
return response.modelVersions.softwareVersions;
|
|
109314
109314
|
}
|
|
109315
109315
|
async fetchModelVersionByVidPidSoftwareVersion(vid, pid, softwareVersion, options) {
|
|
109316
|
-
const
|
|
109317
|
-
const response = await this.#fetchJson(
|
|
109316
|
+
const path9 = `/dcl/model/versions/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}/${encodeURIComponent(softwareVersion)}`;
|
|
109317
|
+
const response = await this.#fetchJson(path9, options);
|
|
109318
109318
|
if (!response || !response.modelVersion || response.modelVersion.vid !== vid || response.modelVersion.pid !== pid || response.modelVersion.softwareVersion !== softwareVersion || response.modelVersion.schemaVersion !== 0) {
|
|
109319
109319
|
throw new MatterDclError(
|
|
109320
109320
|
`Model version not found for VID: ${vid}, PID: ${pid}, Software Version: ${softwareVersion}`
|
|
@@ -116101,51 +116101,51 @@ var init_ValueCaster = __esm({
|
|
|
116101
116101
|
});
|
|
116102
116102
|
|
|
116103
116103
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behavior/state/validation/assertions.js
|
|
116104
|
-
function assertNumber(value,
|
|
116104
|
+
function assertNumber(value, path9) {
|
|
116105
116105
|
if (Number.isFinite(value)) {
|
|
116106
116106
|
return;
|
|
116107
116107
|
}
|
|
116108
|
-
throw new DatatypeError(
|
|
116108
|
+
throw new DatatypeError(path9, "a number", value);
|
|
116109
116109
|
}
|
|
116110
|
-
function assertBoolean(value,
|
|
116110
|
+
function assertBoolean(value, path9) {
|
|
116111
116111
|
if (typeof value === "boolean" || value === 0 || value === 1) {
|
|
116112
116112
|
return;
|
|
116113
116113
|
}
|
|
116114
|
-
throw new DatatypeError(
|
|
116114
|
+
throw new DatatypeError(path9, "a boolean", value);
|
|
116115
116115
|
}
|
|
116116
|
-
function assertObject(value,
|
|
116116
|
+
function assertObject(value, path9) {
|
|
116117
116117
|
if (isObject(value)) {
|
|
116118
116118
|
return;
|
|
116119
116119
|
}
|
|
116120
|
-
throw new DatatypeError(
|
|
116120
|
+
throw new DatatypeError(path9, "an object", value);
|
|
116121
116121
|
}
|
|
116122
|
-
function assertNumeric(value,
|
|
116122
|
+
function assertNumeric(value, path9) {
|
|
116123
116123
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
116124
116124
|
return;
|
|
116125
116125
|
}
|
|
116126
|
-
throw new DatatypeError(
|
|
116126
|
+
throw new DatatypeError(path9, "a number or bigint", value);
|
|
116127
116127
|
}
|
|
116128
|
-
function assertString(value,
|
|
116128
|
+
function assertString(value, path9) {
|
|
116129
116129
|
if (typeof value === "string") {
|
|
116130
116130
|
return;
|
|
116131
116131
|
}
|
|
116132
|
-
throw new DatatypeError(
|
|
116132
|
+
throw new DatatypeError(path9, "a string", value);
|
|
116133
116133
|
}
|
|
116134
|
-
function assertBytes(value,
|
|
116134
|
+
function assertBytes(value, path9) {
|
|
116135
116135
|
if (Bytes.isBytes(value)) {
|
|
116136
116136
|
return;
|
|
116137
116137
|
}
|
|
116138
|
-
throw new DatatypeError(
|
|
116138
|
+
throw new DatatypeError(path9, "a byte array", value);
|
|
116139
116139
|
}
|
|
116140
|
-
function assertSequence(value,
|
|
116140
|
+
function assertSequence(value, path9) {
|
|
116141
116141
|
if (typeof value === "string" || Bytes.isBytes(value)) {
|
|
116142
116142
|
return;
|
|
116143
116143
|
}
|
|
116144
|
-
throw new DatatypeError(
|
|
116144
|
+
throw new DatatypeError(path9, "a string or byte array", value);
|
|
116145
116145
|
}
|
|
116146
|
-
function assertArray(value,
|
|
116146
|
+
function assertArray(value, path9) {
|
|
116147
116147
|
if (!Array.isArray(value)) {
|
|
116148
|
-
throw new DatatypeError(
|
|
116148
|
+
throw new DatatypeError(path9, "an array", value);
|
|
116149
116149
|
}
|
|
116150
116150
|
}
|
|
116151
116151
|
function createIntAssertion(name, lowerBoundInclusive, upperBoundExclusive) {
|
|
@@ -116155,13 +116155,13 @@ function createIntAssertion(name, lowerBoundInclusive, upperBoundExclusive) {
|
|
|
116155
116155
|
return createVarIntAssertion(name, Number(lowerBoundInclusive), Number(upperBoundExclusive));
|
|
116156
116156
|
}
|
|
116157
116157
|
function createVarIntAssertion(name, min, max) {
|
|
116158
|
-
return function assertInt2(value,
|
|
116159
|
-
assertNumeric(value,
|
|
116158
|
+
return function assertInt2(value, path9) {
|
|
116159
|
+
assertNumeric(value, path9);
|
|
116160
116160
|
if (value < min) {
|
|
116161
|
-
throw new IntegerRangeError(
|
|
116161
|
+
throw new IntegerRangeError(path9, `Value ${value} is below the ${name} minimum of ${min}`);
|
|
116162
116162
|
}
|
|
116163
116163
|
if (value > max) {
|
|
116164
|
-
throw new IntegerRangeError(
|
|
116164
|
+
throw new IntegerRangeError(path9, `Value ${value} is above the ${name} maximum of ${max}`);
|
|
116165
116165
|
}
|
|
116166
116166
|
};
|
|
116167
116167
|
}
|
|
@@ -117266,18 +117266,18 @@ function StructPatcher(schema6, supervisor) {
|
|
|
117266
117266
|
memberArrays[key] = true;
|
|
117267
117267
|
}
|
|
117268
117268
|
}
|
|
117269
|
-
return (changes, target,
|
|
117269
|
+
return (changes, target, path9) => {
|
|
117270
117270
|
if (typeof changes !== "object" || changes === null || Array.isArray(changes)) {
|
|
117271
|
-
throw new WriteError(
|
|
117271
|
+
throw new WriteError(path9, `patch definition ${changes} is not an object`);
|
|
117272
117272
|
}
|
|
117273
117273
|
if (typeof target !== "object" || target === null || Array.isArray(target)) {
|
|
117274
|
-
throw new WriteError(
|
|
117274
|
+
throw new WriteError(path9, `cannot patch ${target} because it is not an object`);
|
|
117275
117275
|
}
|
|
117276
117276
|
for (let key in changes) {
|
|
117277
117277
|
let newValue = changes[key];
|
|
117278
117278
|
if (!(key in memberPatchers)) {
|
|
117279
117279
|
if (!(key in memberAltKeys)) {
|
|
117280
|
-
throw new WriteError(
|
|
117280
|
+
throw new WriteError(path9, `${key} is not a property of ${schema6.name}`);
|
|
117281
117281
|
}
|
|
117282
117282
|
key = memberAltKeys[key];
|
|
117283
117283
|
}
|
|
@@ -117288,17 +117288,17 @@ function StructPatcher(schema6, supervisor) {
|
|
|
117288
117288
|
}
|
|
117289
117289
|
if (memberArrays[key]) {
|
|
117290
117290
|
if (target[key] === void 0 || target[key] === null) {
|
|
117291
|
-
newValue = subpatch(newValue, [],
|
|
117291
|
+
newValue = subpatch(newValue, [], path9.at(key));
|
|
117292
117292
|
target[key] = newValue;
|
|
117293
117293
|
continue;
|
|
117294
117294
|
}
|
|
117295
117295
|
}
|
|
117296
117296
|
if (target[key] === void 0 || target[key] === null) {
|
|
117297
|
-
newValue = subpatch(newValue, { ...memberDefaults[key] },
|
|
117297
|
+
newValue = subpatch(newValue, { ...memberDefaults[key] }, path9.at(key));
|
|
117298
117298
|
target[key] = newValue;
|
|
117299
117299
|
continue;
|
|
117300
117300
|
}
|
|
117301
|
-
subpatch(newValue, target[key],
|
|
117301
|
+
subpatch(newValue, target[key], path9.at(key));
|
|
117302
117302
|
}
|
|
117303
117303
|
return target;
|
|
117304
117304
|
};
|
|
@@ -117317,28 +117317,28 @@ function ListPatcher(schema6, supervisor) {
|
|
|
117317
117317
|
if (entryMetatype === Metatype.object) {
|
|
117318
117318
|
entryDefaults = getDefaults(supervisor, entry);
|
|
117319
117319
|
}
|
|
117320
|
-
return (changes, target,
|
|
117320
|
+
return (changes, target, path9) => {
|
|
117321
117321
|
if (typeof changes !== "object" || changes === null) {
|
|
117322
|
-
throw new WriteError(
|
|
117322
|
+
throw new WriteError(path9, `patch definition ${changes} is not an object`);
|
|
117323
117323
|
}
|
|
117324
117324
|
if (!Array.isArray(target)) {
|
|
117325
|
-
throw new WriteError(
|
|
117325
|
+
throw new WriteError(path9, `patch definition ${changes} is not an object`);
|
|
117326
117326
|
}
|
|
117327
117327
|
for (const indexStr in changes) {
|
|
117328
117328
|
const index = Number.parseInt(indexStr);
|
|
117329
117329
|
if (index < 0 || !Number.isFinite(index)) {
|
|
117330
|
-
throw new WriteError(
|
|
117330
|
+
throw new WriteError(path9, `key ${index} is not a valid array index`);
|
|
117331
117331
|
}
|
|
117332
117332
|
let newValue = changes[indexStr];
|
|
117333
117333
|
if (patchEntry) {
|
|
117334
117334
|
const oldValue = index < target.length ? target[index] : void 0;
|
|
117335
117335
|
if (newValue === void 0 || newValue === null || oldValue === void 0 || oldValue === null) {
|
|
117336
117336
|
if (entryDefaults && isObject(newValue)) {
|
|
117337
|
-
newValue = patchEntry(newValue, { ...entryDefaults },
|
|
117337
|
+
newValue = patchEntry(newValue, { ...entryDefaults }, path9.at(index));
|
|
117338
117338
|
}
|
|
117339
117339
|
target[index] = newValue;
|
|
117340
117340
|
} else {
|
|
117341
|
-
patchEntry(newValue, target[index],
|
|
117341
|
+
patchEntry(newValue, target[index], path9.at(index));
|
|
117342
117342
|
}
|
|
117343
117343
|
} else {
|
|
117344
117344
|
target[index] = newValue;
|
|
@@ -117351,8 +117351,8 @@ function ListPatcher(schema6, supervisor) {
|
|
|
117351
117351
|
};
|
|
117352
117352
|
}
|
|
117353
117353
|
function PrimitivePatcher() {
|
|
117354
|
-
return (_changes, _target,
|
|
117355
|
-
throw new ImplementationError(`Cannot generate patch ${
|
|
117354
|
+
return (_changes, _target, path9) => {
|
|
117355
|
+
throw new ImplementationError(`Cannot generate patch ${path9} because it does not define not a collection`);
|
|
117356
117356
|
};
|
|
117357
117357
|
}
|
|
117358
117358
|
var defaultsCache;
|
|
@@ -121501,12 +121501,12 @@ function invokeCommand(backing, command, request, session) {
|
|
|
121501
121501
|
} else {
|
|
121502
121502
|
requestDiagnostic = Diagnostic.weak("(no payload)");
|
|
121503
121503
|
}
|
|
121504
|
-
const { path:
|
|
121504
|
+
const { path: path9, endpoint } = backing;
|
|
121505
121505
|
const context = session;
|
|
121506
121506
|
logger93.info(
|
|
121507
121507
|
"Invoke",
|
|
121508
121508
|
Mark.INBOUND,
|
|
121509
|
-
Diagnostic.strong(`${
|
|
121509
|
+
Diagnostic.strong(`${path9.toString()}.${command.name}`),
|
|
121510
121510
|
session.transaction.via,
|
|
121511
121511
|
requestDiagnostic
|
|
121512
121512
|
);
|
|
@@ -121544,7 +121544,7 @@ function invokeCommand(backing, command, request, session) {
|
|
|
121544
121544
|
logger93.info(
|
|
121545
121545
|
"Invoke",
|
|
121546
121546
|
Mark.OUTBOUND,
|
|
121547
|
-
Diagnostic.strong(`${
|
|
121547
|
+
Diagnostic.strong(`${path9.toString()}.${command.name}`),
|
|
121548
121548
|
session.transaction.via,
|
|
121549
121549
|
Diagnostic.dict(result2)
|
|
121550
121550
|
);
|
|
@@ -121556,7 +121556,7 @@ function invokeCommand(backing, command, request, session) {
|
|
|
121556
121556
|
logger93.info(
|
|
121557
121557
|
"Invoke",
|
|
121558
121558
|
Mark.OUTBOUND,
|
|
121559
|
-
Diagnostic.strong(`${
|
|
121559
|
+
Diagnostic.strong(`${path9.toString()}.${command.name}`),
|
|
121560
121560
|
session.transaction.via,
|
|
121561
121561
|
Diagnostic.dict(result)
|
|
121562
121562
|
);
|
|
@@ -121569,12 +121569,12 @@ function invokeCommand(backing, command, request, session) {
|
|
|
121569
121569
|
}
|
|
121570
121570
|
return result;
|
|
121571
121571
|
}
|
|
121572
|
-
function resolvePathForNode(node,
|
|
121573
|
-
const { endpointId, clusterId: clusterId3 } =
|
|
121574
|
-
const isUrgentString = "isUrgent" in
|
|
121575
|
-
const listIndexString = "listIndex" in
|
|
121572
|
+
function resolvePathForNode(node, path9) {
|
|
121573
|
+
const { endpointId, clusterId: clusterId3 } = path9;
|
|
121574
|
+
const isUrgentString = "isUrgent" in path9 && path9.isUrgent ? "!" : "";
|
|
121575
|
+
const listIndexString = "listIndex" in path9 && path9.listIndex === null ? "[ADD]" : "";
|
|
121576
121576
|
const postString = `${listIndexString}${isUrgentString}`;
|
|
121577
|
-
const elementId = "attributeId" in
|
|
121577
|
+
const elementId = "attributeId" in path9 ? path9.attributeId : "eventId" in path9 ? path9.eventId : "commandId" in path9 ? path9.commandId : void 0;
|
|
121578
121578
|
if (endpointId === void 0) {
|
|
121579
121579
|
return `*.${toWildcardOrHexPath("", clusterId3)}.${toWildcardOrHexPath("", elementId)}${postString}`;
|
|
121580
121580
|
}
|
|
@@ -121592,13 +121592,13 @@ function resolvePathForNode(node, path8) {
|
|
|
121592
121592
|
}
|
|
121593
121593
|
const clusterName = toWildcardOrHexPath(cluster2.type.name, clusterId3);
|
|
121594
121594
|
if (elementId !== void 0) {
|
|
121595
|
-
if ("eventId" in
|
|
121595
|
+
if ("eventId" in path9) {
|
|
121596
121596
|
const event3 = cluster2.type.events[elementId];
|
|
121597
121597
|
return `${endpointName}.${clusterName}.${toWildcardOrHexPath(event3?.name ?? "?", elementId)}${postString}`;
|
|
121598
|
-
} else if ("attributeId" in
|
|
121598
|
+
} else if ("attributeId" in path9) {
|
|
121599
121599
|
const attribute2 = cluster2.type.attributes[elementId];
|
|
121600
121600
|
return `${endpointName}.${clusterName}.${toWildcardOrHexPath(attribute2?.name ?? "?", elementId)}${postString}`;
|
|
121601
|
-
} else if ("commandId" in
|
|
121601
|
+
} else if ("commandId" in path9) {
|
|
121602
121602
|
const command = cluster2.type.commands[elementId];
|
|
121603
121603
|
return `${endpointName}.${clusterName}.${toWildcardOrHexPath(command?.name ?? "?", elementId)}${postString}`;
|
|
121604
121604
|
} else {
|
|
@@ -121699,8 +121699,8 @@ var init_ProtocolService = __esm({
|
|
|
121699
121699
|
inspect() {
|
|
121700
121700
|
return this.toString();
|
|
121701
121701
|
},
|
|
121702
|
-
inspectPath(
|
|
121703
|
-
return resolvePathForNode(this,
|
|
121702
|
+
inspectPath(path9) {
|
|
121703
|
+
return resolvePathForNode(this, path9);
|
|
121704
121704
|
}
|
|
121705
121705
|
};
|
|
121706
121706
|
}
|
|
@@ -124169,11 +124169,11 @@ var init_ServerSubscription = __esm({
|
|
|
124169
124169
|
});
|
|
124170
124170
|
|
|
124171
124171
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/node/server/InteractionServer.js
|
|
124172
|
-
function validateReadAttributesPath(
|
|
124172
|
+
function validateReadAttributesPath(path9, isGroupSession = false) {
|
|
124173
124173
|
if (isGroupSession) {
|
|
124174
124174
|
throw new StatusResponseError("Illegal read request with group session", StatusCode.InvalidAction);
|
|
124175
124175
|
}
|
|
124176
|
-
const { clusterId: clusterId3, attributeId } =
|
|
124176
|
+
const { clusterId: clusterId3, attributeId } = path9;
|
|
124177
124177
|
if (clusterId3 === void 0 && attributeId !== void 0) {
|
|
124178
124178
|
if (!GLOBAL_IDS2.has(attributeId)) {
|
|
124179
124179
|
throw new StatusResponseError(
|
|
@@ -124183,8 +124183,8 @@ function validateReadAttributesPath(path8, isGroupSession = false) {
|
|
|
124183
124183
|
}
|
|
124184
124184
|
}
|
|
124185
124185
|
}
|
|
124186
|
-
function validateReadEventPath(
|
|
124187
|
-
const { clusterId: clusterId3, eventId: eventId3 } =
|
|
124186
|
+
function validateReadEventPath(path9, isGroupSession = false) {
|
|
124187
|
+
const { clusterId: clusterId3, eventId: eventId3 } = path9;
|
|
124188
124188
|
if (clusterId3 === void 0 && eventId3 !== void 0) {
|
|
124189
124189
|
throw new StatusResponseError("Illegal read request with wildcard cluster ID", StatusCode.InvalidAction);
|
|
124190
124190
|
}
|
|
@@ -124366,8 +124366,8 @@ var init_InteractionServer = __esm({
|
|
|
124366
124366
|
exchange.via,
|
|
124367
124367
|
Diagnostic.asFlags({ fabricFiltered: isFabricFiltered }),
|
|
124368
124368
|
Diagnostic.dict({
|
|
124369
|
-
attributes: `${attributeRequests?.map((
|
|
124370
|
-
events: `${eventRequests?.map((
|
|
124369
|
+
attributes: `${attributeRequests?.map((path9) => this.#node.protocol.inspectPath(path9)).join(", ") ?? "none"}${dataVersionFilters?.length ? ` with ${dataVersionFilters?.length} filters` : ""}`,
|
|
124370
|
+
events: `${eventRequests?.map((path9) => this.#node.protocol.inspectPath(path9)).join(", ") ?? "none"}${eventFilters?.length ? `, ${eventFilters?.length} filters` : ""}`
|
|
124371
124371
|
})
|
|
124372
124372
|
]);
|
|
124373
124373
|
if (interactionModelRevision > Specification.INTERACTION_MODEL_REVISION) {
|
|
@@ -124476,22 +124476,22 @@ var init_InteractionServer = __esm({
|
|
|
124476
124476
|
currentBatch = [];
|
|
124477
124477
|
};
|
|
124478
124478
|
for (const request of writeRequests) {
|
|
124479
|
-
const { path:
|
|
124480
|
-
const listIndex =
|
|
124479
|
+
const { path: path9 } = request;
|
|
124480
|
+
const listIndex = path9.listIndex;
|
|
124481
124481
|
if (listIndex === null) {
|
|
124482
|
-
if (previousProcessedAttributePath?.endpointId !==
|
|
124482
|
+
if (previousProcessedAttributePath?.endpointId !== path9.endpointId || previousProcessedAttributePath?.clusterId !== path9.clusterId || previousProcessedAttributePath?.attributeId !== path9.attributeId) {
|
|
124483
124483
|
await processBatch();
|
|
124484
124484
|
allResponses.push({
|
|
124485
124485
|
kind: "attr-status",
|
|
124486
|
-
path:
|
|
124486
|
+
path: path9,
|
|
124487
124487
|
status: Status2.Busy
|
|
124488
124488
|
});
|
|
124489
124489
|
continue;
|
|
124490
124490
|
}
|
|
124491
124491
|
}
|
|
124492
124492
|
currentBatch.push(request);
|
|
124493
|
-
if (
|
|
124494
|
-
previousProcessedAttributePath =
|
|
124493
|
+
if (path9.endpointId !== void 0 && path9.clusterId !== void 0 && path9.attributeId !== void 0) {
|
|
124494
|
+
previousProcessedAttributePath = path9;
|
|
124495
124495
|
}
|
|
124496
124496
|
}
|
|
124497
124497
|
await processBatch();
|
|
@@ -124499,8 +124499,8 @@ var init_InteractionServer = __esm({
|
|
|
124499
124499
|
break;
|
|
124500
124500
|
}
|
|
124501
124501
|
const chunkResponse = {
|
|
124502
|
-
writeResponses: allResponses.map(({ path:
|
|
124503
|
-
path:
|
|
124502
|
+
writeResponses: allResponses.map(({ path: path9, status: status3, clusterStatus }) => ({
|
|
124503
|
+
path: path9,
|
|
124504
124504
|
status: { status: status3, clusterStatus }
|
|
124505
124505
|
})),
|
|
124506
124506
|
interactionModelRevision: Specification.INTERACTION_MODEL_REVISION
|
|
@@ -124590,16 +124590,16 @@ var init_InteractionServer = __esm({
|
|
|
124590
124590
|
Mark.INBOUND,
|
|
124591
124591
|
exchange.via,
|
|
124592
124592
|
Diagnostic.dict({
|
|
124593
|
-
attributes: attributeRequests?.length ? attributeRequests?.map((
|
|
124593
|
+
attributes: attributeRequests?.length ? attributeRequests?.map((path9) => this.#node.protocol.inspectPath(path9)).join(", ") : void 0,
|
|
124594
124594
|
dataVersionFilters: dataVersionFilters?.length ? dataVersionFilters.map(
|
|
124595
124595
|
({ path: { nodeId: nodeId3, endpointId, clusterId: clusterId3 }, dataVersion }) => `${clusterPathToId({ nodeId: nodeId3, endpointId, clusterId: clusterId3 })}=${dataVersion}`
|
|
124596
124596
|
).join(", ") : void 0,
|
|
124597
|
-
events: eventRequests?.length ? eventRequests.map((
|
|
124597
|
+
events: eventRequests?.length ? eventRequests.map((path9) => this.#node.protocol.inspectPath(path9)).join(", ") : void 0,
|
|
124598
124598
|
eventFilters: eventFilters?.length ? eventFilters.map((filter) => `${filter.nodeId}/${filter.eventMin}`).join(", ") : void 0
|
|
124599
124599
|
})
|
|
124600
124600
|
]);
|
|
124601
|
-
attributeRequests?.forEach((
|
|
124602
|
-
eventRequests?.forEach((
|
|
124601
|
+
attributeRequests?.forEach((path9) => validateReadAttributesPath(path9));
|
|
124602
|
+
eventRequests?.forEach((path9) => validateReadEventPath(path9));
|
|
124603
124603
|
if (minIntervalFloorSeconds < 0) {
|
|
124604
124604
|
throw new StatusResponseError(
|
|
124605
124605
|
"minIntervalFloorSeconds should be greater or equal to 0",
|
|
@@ -124881,9 +124881,9 @@ var init_InteractionServer = __esm({
|
|
|
124881
124881
|
break;
|
|
124882
124882
|
}
|
|
124883
124883
|
case "cmd-status": {
|
|
124884
|
-
const { path:
|
|
124884
|
+
const { path: path9, commandRef, status: status3, clusterStatus } = data;
|
|
124885
124885
|
await sendChunkIfNeeded({
|
|
124886
|
-
status: { commandPath:
|
|
124886
|
+
status: { commandPath: path9, status: { status: status3, clusterStatus }, commandRef }
|
|
124887
124887
|
});
|
|
124888
124888
|
break;
|
|
124889
124889
|
}
|
|
@@ -134966,14 +134966,14 @@ var init_ApiPath = __esm({
|
|
|
134966
134966
|
*
|
|
134967
134967
|
* So generally normal UNIX/URL semantics.
|
|
134968
134968
|
*/
|
|
134969
|
-
constructor(
|
|
134970
|
-
if (
|
|
134971
|
-
|
|
134969
|
+
constructor(path9) {
|
|
134970
|
+
if (path9 instanceof URL) {
|
|
134971
|
+
path9 = path9.pathname;
|
|
134972
134972
|
}
|
|
134973
|
-
if (!Array.isArray(
|
|
134974
|
-
|
|
134973
|
+
if (!Array.isArray(path9)) {
|
|
134974
|
+
path9 = path9.split("/").map(decodeURIComponent);
|
|
134975
134975
|
}
|
|
134976
|
-
for (const segment of
|
|
134976
|
+
for (const segment of path9) {
|
|
134977
134977
|
if (segment === "" || segment === ".") {
|
|
134978
134978
|
continue;
|
|
134979
134979
|
}
|
|
@@ -134993,20 +134993,20 @@ var init_ApiPath = __esm({
|
|
|
134993
134993
|
slice(start, end) {
|
|
134994
134994
|
return new _ApiPath(this.#segments.slice(start, end));
|
|
134995
134995
|
}
|
|
134996
|
-
at(
|
|
134996
|
+
at(path9) {
|
|
134997
134997
|
if (this.isEmpty) {
|
|
134998
|
-
return new _ApiPath(
|
|
134998
|
+
return new _ApiPath(path9);
|
|
134999
134999
|
}
|
|
135000
|
-
if (
|
|
135001
|
-
|
|
135000
|
+
if (path9 instanceof URL) {
|
|
135001
|
+
path9 = path9.pathname;
|
|
135002
135002
|
}
|
|
135003
|
-
if (Array.isArray(
|
|
135004
|
-
|
|
135003
|
+
if (Array.isArray(path9)) {
|
|
135004
|
+
path9 = path9.map(encodeURIComponent).join("/");
|
|
135005
135005
|
}
|
|
135006
|
-
if (
|
|
135007
|
-
return new _ApiPath(
|
|
135006
|
+
if (path9.startsWith("/")) {
|
|
135007
|
+
return new _ApiPath(path9);
|
|
135008
135008
|
}
|
|
135009
|
-
return new _ApiPath(`${this.toString()}/${
|
|
135009
|
+
return new _ApiPath(`${this.toString()}/${path9}`);
|
|
135010
135010
|
}
|
|
135011
135011
|
toString() {
|
|
135012
135012
|
return `${this.#segments.map(encodeURIComponent).join("/")}`;
|
|
@@ -135091,12 +135091,12 @@ var init_Envelope = __esm({
|
|
|
135091
135091
|
/**
|
|
135092
135092
|
* Validate against the schema. Casts to appropriate types if necessary.
|
|
135093
135093
|
*/
|
|
135094
|
-
validate(
|
|
135095
|
-
if (!
|
|
135096
|
-
|
|
135094
|
+
validate(path9) {
|
|
135095
|
+
if (!path9) {
|
|
135096
|
+
path9 = DataModelPath(this.#supervisor.schema.path);
|
|
135097
135097
|
}
|
|
135098
135098
|
this.#js = this.#supervisor.cast(this.#js);
|
|
135099
|
-
this.#supervisor.validate?.(this.js, LocalActorContext.ReadOnly, { path:
|
|
135099
|
+
this.#supervisor.validate?.(this.js, LocalActorContext.ReadOnly, { path: path9 });
|
|
135100
135100
|
}
|
|
135101
135101
|
/**
|
|
135102
135102
|
* Convert a {@link js} value to {@link JSON}.
|
|
@@ -135336,11 +135336,11 @@ var init_PropertyResource = __esm({
|
|
|
135336
135336
|
}
|
|
135337
135337
|
return "field";
|
|
135338
135338
|
}
|
|
135339
|
-
constructor(parent, id, supervisor,
|
|
135339
|
+
constructor(parent, id, supervisor, path9) {
|
|
135340
135340
|
super(parent);
|
|
135341
135341
|
this.id = id;
|
|
135342
135342
|
this.supervisor = supervisor;
|
|
135343
|
-
this.dataModelPath =
|
|
135343
|
+
this.dataModelPath = path9;
|
|
135344
135344
|
}
|
|
135345
135345
|
get schema() {
|
|
135346
135346
|
return this.supervisor.schema;
|
|
@@ -135976,7 +135976,7 @@ var init_Api = __esm({
|
|
|
135976
135976
|
init_ServerNodeResource();
|
|
135977
135977
|
loggers = /* @__PURE__ */ new Map();
|
|
135978
135978
|
((Api2) => {
|
|
135979
|
-
async function resourceFor(agent,
|
|
135979
|
+
async function resourceFor(agent, path9) {
|
|
135980
135980
|
let item;
|
|
135981
135981
|
if ("peers" in agent.endpoint) {
|
|
135982
135982
|
item = new ServerNodeResource(agent, void 0);
|
|
@@ -135986,7 +135986,7 @@ var init_Api = __esm({
|
|
|
135986
135986
|
item = new EndpointResource(agent, void 0);
|
|
135987
135987
|
}
|
|
135988
135988
|
const breadcrumb = [item];
|
|
135989
|
-
for (const segment of
|
|
135989
|
+
for (const segment of path9) {
|
|
135990
135990
|
const parent = breadcrumb[breadcrumb.length - 1];
|
|
135991
135991
|
const item2 = await parent.childFor(segment);
|
|
135992
135992
|
if (!item2) {
|
|
@@ -136401,12 +136401,12 @@ var init_HttpInterface = __esm({
|
|
|
136401
136401
|
let response;
|
|
136402
136402
|
try {
|
|
136403
136403
|
const address = new AppAddress(request.url);
|
|
136404
|
-
const
|
|
136405
|
-
if (!
|
|
136404
|
+
const path9 = this.root.subpathFor(new ApiPath(address));
|
|
136405
|
+
if (!path9) {
|
|
136406
136406
|
return;
|
|
136407
136407
|
}
|
|
136408
136408
|
response = await this.node.act("http", async (agent) => {
|
|
136409
|
-
const resource = await Api.resourceFor(agent,
|
|
136409
|
+
const resource = await Api.resourceFor(agent, path9);
|
|
136410
136410
|
if (resource === void 0) {
|
|
136411
136411
|
throw new StatusResponse.NotFoundError(`Path "${address.pathname}" not found`);
|
|
136412
136412
|
}
|
|
@@ -138200,8 +138200,8 @@ var init_WebSocketInterface = __esm({
|
|
|
138200
138200
|
var _stack = [];
|
|
138201
138201
|
try {
|
|
138202
138202
|
const address = new AppAddress(request.url);
|
|
138203
|
-
const
|
|
138204
|
-
if (
|
|
138203
|
+
const path9 = new ApiPath(address).toString();
|
|
138204
|
+
if (path9 !== this.root.toString()) {
|
|
138205
138205
|
return;
|
|
138206
138206
|
}
|
|
138207
138207
|
const ws2 = await Abort.race(this.abort, await upgrade());
|
|
@@ -138880,8 +138880,8 @@ var init_endpoint = __esm({
|
|
|
138880
138880
|
});
|
|
138881
138881
|
|
|
138882
138882
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/loader/load.mjs
|
|
138883
|
-
function load(
|
|
138884
|
-
return import(
|
|
138883
|
+
function load(path9) {
|
|
138884
|
+
return import(path9);
|
|
138885
138885
|
}
|
|
138886
138886
|
var init_load = __esm({
|
|
138887
138887
|
"../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/loader/load.mjs"() {
|
|
@@ -138889,8 +138889,8 @@ var init_load = __esm({
|
|
|
138889
138889
|
});
|
|
138890
138890
|
|
|
138891
138891
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/loader/loader.js
|
|
138892
|
-
function doLoad(description, exportName,
|
|
138893
|
-
const cachedResult = cache5[
|
|
138892
|
+
function doLoad(description, exportName, path9) {
|
|
138893
|
+
const cachedResult = cache5[path9];
|
|
138894
138894
|
if (cachedResult) {
|
|
138895
138895
|
return cachedResult;
|
|
138896
138896
|
}
|
|
@@ -138901,7 +138901,7 @@ function doLoad(description, exportName, path8) {
|
|
|
138901
138901
|
failure();
|
|
138902
138902
|
}
|
|
138903
138903
|
try {
|
|
138904
|
-
const module = load(
|
|
138904
|
+
const module = load(path9);
|
|
138905
138905
|
if (MaybePromise.is(module)) {
|
|
138906
138906
|
return module.then(extractExport, failure);
|
|
138907
138907
|
}
|
|
@@ -143435,11 +143435,11 @@ var init_NodeJsHttpEndpoint = __esm({
|
|
|
143435
143435
|
}
|
|
143436
143436
|
break;
|
|
143437
143437
|
case "unix":
|
|
143438
|
-
const
|
|
143438
|
+
const path9 = decodeURIComponent(address.hostname);
|
|
143439
143439
|
if (options.basePathForUnixSockets) {
|
|
143440
|
-
opts.path = resolve(options.basePathForUnixSockets, normalize(
|
|
143440
|
+
opts.path = resolve(options.basePathForUnixSockets, normalize(path9));
|
|
143441
143441
|
} else {
|
|
143442
|
-
opts.path = normalize(
|
|
143442
|
+
opts.path = normalize(path9);
|
|
143443
143443
|
}
|
|
143444
143444
|
if (existsSync(opts.path)) {
|
|
143445
143445
|
if (statSync(opts.path).isSocket()) {
|
|
@@ -143643,9 +143643,9 @@ var init_StorageBackendDisk = __esm({
|
|
|
143643
143643
|
isInitialized = false;
|
|
143644
143644
|
#writeFileBlocker = /* @__PURE__ */ new Map();
|
|
143645
143645
|
#index = {};
|
|
143646
|
-
constructor(
|
|
143646
|
+
constructor(path9, clear = false) {
|
|
143647
143647
|
super();
|
|
143648
|
-
this.#path =
|
|
143648
|
+
this.#path = path9;
|
|
143649
143649
|
this.#clear = clear;
|
|
143650
143650
|
}
|
|
143651
143651
|
get initialized() {
|
|
@@ -143908,9 +143908,9 @@ var init_StorageBackendJsonFile = __esm({
|
|
|
143908
143908
|
"../../node_modules/.pnpm/@matter+nodejs@0.16.10/node_modules/@matter/nodejs/dist/esm/storage/fs/StorageBackendJsonFile.js"() {
|
|
143909
143909
|
init_esm();
|
|
143910
143910
|
StorageBackendJsonFile = class _StorageBackendJsonFile extends StorageBackendMemory {
|
|
143911
|
-
constructor(
|
|
143911
|
+
constructor(path9) {
|
|
143912
143912
|
super();
|
|
143913
|
-
this.path =
|
|
143913
|
+
this.path = path9;
|
|
143914
143914
|
}
|
|
143915
143915
|
/** We store changes after a value was set to the storage, but not more often than this setting (in ms). */
|
|
143916
143916
|
static commitDelay = Seconds.one;
|
|
@@ -143922,8 +143922,8 @@ var init_StorageBackendJsonFile = __esm({
|
|
|
143922
143922
|
);
|
|
143923
143923
|
closed = false;
|
|
143924
143924
|
resolveCommitted;
|
|
143925
|
-
static async create(
|
|
143926
|
-
const storage2 = new this(
|
|
143925
|
+
static async create(path9) {
|
|
143926
|
+
const storage2 = new this(path9);
|
|
143927
143927
|
storage2.initialize();
|
|
143928
143928
|
return storage2;
|
|
143929
143929
|
}
|
|
@@ -144128,8 +144128,8 @@ var init_SqliteStorage = __esm({
|
|
|
144128
144128
|
*/
|
|
144129
144129
|
constructor(args) {
|
|
144130
144130
|
super();
|
|
144131
|
-
const { databaseCreator, path:
|
|
144132
|
-
this.dbPath =
|
|
144131
|
+
const { databaseCreator, path: path9, tableName, clear } = args;
|
|
144132
|
+
this.dbPath = path9 === null ? _SqliteStorage.memoryPath : path9;
|
|
144133
144133
|
this.databaseCreator = databaseCreator;
|
|
144134
144134
|
this.database = databaseCreator(this.dbPath);
|
|
144135
144135
|
this.tableName = tableName ?? _SqliteStorage.defaultTableName;
|
|
@@ -144513,10 +144513,10 @@ var init_NodeJsSqlite = __esm({
|
|
|
144513
144513
|
"../../node_modules/.pnpm/@matter+nodejs@0.16.10/node_modules/@matter/nodejs/dist/esm/storage/sqlite/platform/NodeJsSqlite.js"() {
|
|
144514
144514
|
init_SqliteStorage();
|
|
144515
144515
|
NodeJsSqlite = class extends SqliteStorage {
|
|
144516
|
-
constructor(
|
|
144516
|
+
constructor(path9, clear = false) {
|
|
144517
144517
|
super({
|
|
144518
144518
|
databaseCreator: (path22) => new DatabaseSync(path22),
|
|
144519
|
-
path:
|
|
144519
|
+
path: path9,
|
|
144520
144520
|
clear
|
|
144521
144521
|
});
|
|
144522
144522
|
}
|
|
@@ -144561,13 +144561,13 @@ var init_BunSqlite = __esm({
|
|
|
144561
144561
|
init_bun_sqlite();
|
|
144562
144562
|
init_bun();
|
|
144563
144563
|
BunSqlite = class extends SqliteStorage {
|
|
144564
|
-
constructor(
|
|
144564
|
+
constructor(path9, clear = false) {
|
|
144565
144565
|
super({
|
|
144566
144566
|
databaseCreator: (path22) => new Database(path22, {
|
|
144567
144567
|
strict: true,
|
|
144568
144568
|
create: true
|
|
144569
144569
|
}),
|
|
144570
|
-
path:
|
|
144570
|
+
path: path9,
|
|
144571
144571
|
clear
|
|
144572
144572
|
});
|
|
144573
144573
|
}
|
|
@@ -144584,16 +144584,16 @@ var init_BunSqlite = __esm({
|
|
|
144584
144584
|
});
|
|
144585
144585
|
|
|
144586
144586
|
// ../../node_modules/.pnpm/@matter+nodejs@0.16.10/node_modules/@matter/nodejs/dist/esm/storage/sqlite/platform/PlatformSqlite.js
|
|
144587
|
-
async function PlatformSqlite(
|
|
144587
|
+
async function PlatformSqlite(path9, clear = false) {
|
|
144588
144588
|
const isBun = isBunjs();
|
|
144589
144589
|
if (!isBun) {
|
|
144590
144590
|
const module2 = await Promise.resolve().then(() => (init_NodeJsSqlite(), NodeJsSqlite_exports));
|
|
144591
144591
|
const NodeJsSqlite2 = findDefaultExport(module2, "NodeJsSqlite");
|
|
144592
|
-
return new NodeJsSqlite2(
|
|
144592
|
+
return new NodeJsSqlite2(path9, clear);
|
|
144593
144593
|
}
|
|
144594
144594
|
const module = await Promise.resolve().then(() => (init_BunSqlite(), BunSqlite_exports));
|
|
144595
144595
|
const BunSqlite2 = findDefaultExport(module, "BunSqlite");
|
|
144596
|
-
return new BunSqlite2(
|
|
144596
|
+
return new BunSqlite2(path9, clear);
|
|
144597
144597
|
}
|
|
144598
144598
|
function findDefaultExport(moduleLike, name) {
|
|
144599
144599
|
return moduleLike[name] || moduleLike.default?.[name] || moduleLike.default;
|
|
@@ -144638,11 +144638,11 @@ var init_StorageFactory = __esm({
|
|
|
144638
144638
|
if (!await exists(rootDir)) {
|
|
144639
144639
|
await mkdir2(rootDir, { recursive: true });
|
|
144640
144640
|
}
|
|
144641
|
-
const
|
|
144642
|
-
if (clear || await exists(
|
|
144643
|
-
return await createRawInit(type,
|
|
144641
|
+
const path9 = getRealPath(type, rootDir, namespace3);
|
|
144642
|
+
if (clear || await exists(path9)) {
|
|
144643
|
+
return await createRawInit(type, path9, clear);
|
|
144644
144644
|
}
|
|
144645
|
-
const storage2 = await createRawInit(type,
|
|
144645
|
+
const storage2 = await createRawInit(type, path9, false);
|
|
144646
144646
|
const migrationRootDir = resolve2(rootDir, ".migrations", getResultDirName(namespace3));
|
|
144647
144647
|
for (const otherType of StorageTypes) {
|
|
144648
144648
|
if (type === otherType) {
|
|
@@ -144669,7 +144669,7 @@ var init_StorageFactory = __esm({
|
|
|
144669
144669
|
fromType: otherType,
|
|
144670
144670
|
fromPath: otherPath,
|
|
144671
144671
|
toType: type,
|
|
144672
|
-
toPath:
|
|
144672
|
+
toPath: path9,
|
|
144673
144673
|
result: migrationResult
|
|
144674
144674
|
}),
|
|
144675
144675
|
4
|
|
@@ -144692,14 +144692,14 @@ Error: ${errorMessage}`
|
|
|
144692
144692
|
const { driver, namespace: namespace3 } = args;
|
|
144693
144693
|
const rootDir = resolve2(args.rootDir);
|
|
144694
144694
|
const type = getStorageType(driver);
|
|
144695
|
-
const
|
|
144696
|
-
if (!await exists(
|
|
144695
|
+
const path9 = getRealPath(type, rootDir, namespace3);
|
|
144696
|
+
if (!await exists(path9)) {
|
|
144697
144697
|
return;
|
|
144698
144698
|
}
|
|
144699
|
-
await rm3(
|
|
144699
|
+
await rm3(path9, { recursive: true, force: true });
|
|
144700
144700
|
}
|
|
144701
144701
|
StorageFactory2.remove = remove;
|
|
144702
|
-
async function createRaw(type,
|
|
144702
|
+
async function createRaw(type, path9, clear) {
|
|
144703
144703
|
const normalizedType = type.toLowerCase();
|
|
144704
144704
|
if (normalizedType === "sqlite") {
|
|
144705
144705
|
if (!supportsSqlite()) {
|
|
@@ -144710,21 +144710,21 @@ Error: ${errorMessage}`
|
|
|
144710
144710
|
`.replace(/\n\s+/g, "\n")
|
|
144711
144711
|
);
|
|
144712
144712
|
}
|
|
144713
|
-
return await PlatformSqlite(
|
|
144713
|
+
return await PlatformSqlite(path9, clear);
|
|
144714
144714
|
}
|
|
144715
144715
|
if (normalizedType === "file") {
|
|
144716
|
-
return new StorageBackendDisk(
|
|
144716
|
+
return new StorageBackendDisk(path9, clear);
|
|
144717
144717
|
}
|
|
144718
144718
|
throw new Error(`'${type}' storage type is not implemented.`);
|
|
144719
144719
|
}
|
|
144720
|
-
async function createRawInit(type,
|
|
144721
|
-
const storage2 = await createRaw(type,
|
|
144720
|
+
async function createRawInit(type, path9, clear) {
|
|
144721
|
+
const storage2 = await createRaw(type, path9, clear);
|
|
144722
144722
|
await storage2.initialize();
|
|
144723
144723
|
return storage2;
|
|
144724
144724
|
}
|
|
144725
|
-
async function hasStorage(type,
|
|
144725
|
+
async function hasStorage(type, path9) {
|
|
144726
144726
|
try {
|
|
144727
|
-
const pathStat = await lstat(
|
|
144727
|
+
const pathStat = await lstat(path9);
|
|
144728
144728
|
switch (type) {
|
|
144729
144729
|
case "file":
|
|
144730
144730
|
return pathStat.isDirectory();
|
|
@@ -144791,9 +144791,9 @@ Error: ${errorMessage}`
|
|
|
144791
144791
|
}
|
|
144792
144792
|
return result;
|
|
144793
144793
|
}
|
|
144794
|
-
async function exists(
|
|
144794
|
+
async function exists(path9) {
|
|
144795
144795
|
try {
|
|
144796
|
-
await lstat(resolve2(
|
|
144796
|
+
await lstat(resolve2(path9));
|
|
144797
144797
|
return true;
|
|
144798
144798
|
} catch (err) {
|
|
144799
144799
|
return false;
|
|
@@ -147419,7 +147419,7 @@ BigInt.prototype.toJSON = function() {
|
|
|
147419
147419
|
};
|
|
147420
147420
|
|
|
147421
147421
|
// src/cli.ts
|
|
147422
|
-
import * as
|
|
147422
|
+
import * as path8 from "node:path";
|
|
147423
147423
|
import * as url from "node:url";
|
|
147424
147424
|
import yargs from "yargs";
|
|
147425
147425
|
import { hideBin } from "yargs/helpers";
|
|
@@ -147432,7 +147432,7 @@ import * as ws from "ws";
|
|
|
147432
147432
|
|
|
147433
147433
|
// src/api/web-api.ts
|
|
147434
147434
|
init_service();
|
|
147435
|
-
import
|
|
147435
|
+
import express14 from "express";
|
|
147436
147436
|
import basicAuth from "express-basic-auth";
|
|
147437
147437
|
import AccessControl5 from "express-ip-access-control";
|
|
147438
147438
|
import nocache from "nocache";
|
|
@@ -148057,12 +148057,153 @@ function bridgeIconApi(storageLocation) {
|
|
|
148057
148057
|
return router;
|
|
148058
148058
|
}
|
|
148059
148059
|
|
|
148060
|
+
// src/api/device-image-api.ts
|
|
148061
|
+
import fs3 from "node:fs";
|
|
148062
|
+
import path3 from "node:path";
|
|
148063
|
+
import express4 from "express";
|
|
148064
|
+
import multer3 from "multer";
|
|
148065
|
+
var ALLOWED_EXTENSIONS2 = [".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg"];
|
|
148066
|
+
var MAX_FILE_SIZE2 = 5 * 1024 * 1024;
|
|
148067
|
+
var Z2M_IMAGE_BASE = "https://www.zigbee2mqtt.io/images/devices";
|
|
148068
|
+
function sanitizeEntityId(entityId) {
|
|
148069
|
+
return entityId.replace(/[^a-z0-9._-]/gi, "_");
|
|
148070
|
+
}
|
|
148071
|
+
function findCustomImage(imagesDir, entityId) {
|
|
148072
|
+
const sanitized = sanitizeEntityId(entityId);
|
|
148073
|
+
if (!fs3.existsSync(imagesDir)) return void 0;
|
|
148074
|
+
const files = fs3.readdirSync(imagesDir);
|
|
148075
|
+
const imageFile = files.find((f) => path3.parse(f).name === sanitized);
|
|
148076
|
+
return imageFile ? path3.join(imagesDir, imageFile) : void 0;
|
|
148077
|
+
}
|
|
148078
|
+
function resolveZ2mImageUrl(haRegistry, entityId) {
|
|
148079
|
+
const entity = haRegistry.entities[entityId];
|
|
148080
|
+
if (!entity?.device_id) return void 0;
|
|
148081
|
+
const device = haRegistry.devices[entity.device_id];
|
|
148082
|
+
if (!device?.model) return void 0;
|
|
148083
|
+
return `${Z2M_IMAGE_BASE}/${encodeURIComponent(device.model)}.png`;
|
|
148084
|
+
}
|
|
148085
|
+
function deviceImageApi(storageLocation, haRegistry) {
|
|
148086
|
+
const imagesDir = path3.join(storageLocation, "device-images");
|
|
148087
|
+
if (!fs3.existsSync(imagesDir)) {
|
|
148088
|
+
fs3.mkdirSync(imagesDir, { recursive: true });
|
|
148089
|
+
}
|
|
148090
|
+
const storage2 = multer3.diskStorage({
|
|
148091
|
+
destination: (_req, _file, cb) => {
|
|
148092
|
+
cb(null, imagesDir);
|
|
148093
|
+
},
|
|
148094
|
+
filename: (req, file, cb) => {
|
|
148095
|
+
const entityId = sanitizeEntityId(req.params.entityId);
|
|
148096
|
+
const ext = path3.extname(file.originalname).toLowerCase();
|
|
148097
|
+
cb(null, `${entityId}${ext}`);
|
|
148098
|
+
}
|
|
148099
|
+
});
|
|
148100
|
+
const fileFilter = (_req, file, cb) => {
|
|
148101
|
+
const ext = path3.extname(file.originalname).toLowerCase();
|
|
148102
|
+
if (ALLOWED_EXTENSIONS2.includes(ext)) {
|
|
148103
|
+
cb(null, true);
|
|
148104
|
+
} else {
|
|
148105
|
+
cb(
|
|
148106
|
+
new Error(
|
|
148107
|
+
`Invalid file type. Allowed: ${ALLOWED_EXTENSIONS2.join(", ")}`
|
|
148108
|
+
)
|
|
148109
|
+
);
|
|
148110
|
+
}
|
|
148111
|
+
};
|
|
148112
|
+
const upload2 = multer3({
|
|
148113
|
+
storage: storage2,
|
|
148114
|
+
fileFilter,
|
|
148115
|
+
limits: { fileSize: MAX_FILE_SIZE2 }
|
|
148116
|
+
});
|
|
148117
|
+
const router = express4.Router();
|
|
148118
|
+
router.post("/resolve", (req, res) => {
|
|
148119
|
+
const { entityIds } = req.body;
|
|
148120
|
+
if (!entityIds || !Array.isArray(entityIds)) {
|
|
148121
|
+
res.status(400).json({ error: "entityIds array required" });
|
|
148122
|
+
return;
|
|
148123
|
+
}
|
|
148124
|
+
const result = {};
|
|
148125
|
+
for (const entityId of entityIds) {
|
|
148126
|
+
const custom = findCustomImage(imagesDir, entityId);
|
|
148127
|
+
if (custom) {
|
|
148128
|
+
result[entityId] = { source: "custom" };
|
|
148129
|
+
} else {
|
|
148130
|
+
const z2mUrl = resolveZ2mImageUrl(haRegistry, entityId);
|
|
148131
|
+
if (z2mUrl) {
|
|
148132
|
+
result[entityId] = { source: "z2m", z2mUrl };
|
|
148133
|
+
} else {
|
|
148134
|
+
result[entityId] = { source: "none" };
|
|
148135
|
+
}
|
|
148136
|
+
}
|
|
148137
|
+
}
|
|
148138
|
+
res.json(result);
|
|
148139
|
+
});
|
|
148140
|
+
router.post(
|
|
148141
|
+
"/:entityId",
|
|
148142
|
+
upload2.single("image"),
|
|
148143
|
+
(req, res) => {
|
|
148144
|
+
if (!req.file) {
|
|
148145
|
+
res.status(400).json({ error: "No file uploaded" });
|
|
148146
|
+
return;
|
|
148147
|
+
}
|
|
148148
|
+
const sanitized = sanitizeEntityId(req.params.entityId);
|
|
148149
|
+
const files = fs3.readdirSync(imagesDir);
|
|
148150
|
+
for (const f of files) {
|
|
148151
|
+
if (path3.parse(f).name === sanitized && f !== req.file.filename) {
|
|
148152
|
+
fs3.unlinkSync(path3.join(imagesDir, f));
|
|
148153
|
+
}
|
|
148154
|
+
}
|
|
148155
|
+
res.json({ success: true });
|
|
148156
|
+
}
|
|
148157
|
+
);
|
|
148158
|
+
router.get("/:entityId", (req, res) => {
|
|
148159
|
+
const entityId = req.params.entityId;
|
|
148160
|
+
const customImage = findCustomImage(imagesDir, entityId);
|
|
148161
|
+
if (customImage) {
|
|
148162
|
+
res.sendFile(customImage);
|
|
148163
|
+
return;
|
|
148164
|
+
}
|
|
148165
|
+
const z2mUrl = resolveZ2mImageUrl(haRegistry, entityId);
|
|
148166
|
+
if (z2mUrl) {
|
|
148167
|
+
res.redirect(z2mUrl);
|
|
148168
|
+
return;
|
|
148169
|
+
}
|
|
148170
|
+
res.status(404).json({ error: "No image available" });
|
|
148171
|
+
});
|
|
148172
|
+
router.delete("/:entityId", (req, res) => {
|
|
148173
|
+
const entityId = req.params.entityId;
|
|
148174
|
+
const customImage = findCustomImage(imagesDir, entityId);
|
|
148175
|
+
if (!customImage) {
|
|
148176
|
+
res.status(404).json({ error: "No custom image found" });
|
|
148177
|
+
return;
|
|
148178
|
+
}
|
|
148179
|
+
fs3.unlinkSync(customImage);
|
|
148180
|
+
res.json({ success: true });
|
|
148181
|
+
});
|
|
148182
|
+
router.head("/:entityId", (req, res) => {
|
|
148183
|
+
const entityId = req.params.entityId;
|
|
148184
|
+
const customImage = findCustomImage(imagesDir, entityId);
|
|
148185
|
+
if (customImage) {
|
|
148186
|
+
res.setHeader("X-Image-Source", "custom");
|
|
148187
|
+
res.status(200).end();
|
|
148188
|
+
return;
|
|
148189
|
+
}
|
|
148190
|
+
const z2mUrl = resolveZ2mImageUrl(haRegistry, entityId);
|
|
148191
|
+
if (z2mUrl) {
|
|
148192
|
+
res.setHeader("X-Image-Source", "z2m");
|
|
148193
|
+
res.status(200).end();
|
|
148194
|
+
return;
|
|
148195
|
+
}
|
|
148196
|
+
res.status(404).end();
|
|
148197
|
+
});
|
|
148198
|
+
return router;
|
|
148199
|
+
}
|
|
148200
|
+
|
|
148060
148201
|
// src/api/diagnostic-api.ts
|
|
148061
148202
|
import os from "node:os";
|
|
148062
|
-
import
|
|
148203
|
+
import express6 from "express";
|
|
148063
148204
|
|
|
148064
148205
|
// src/api/logs-api.ts
|
|
148065
|
-
import
|
|
148206
|
+
import express5 from "express";
|
|
148066
148207
|
var logBuffer = {
|
|
148067
148208
|
entries: [],
|
|
148068
148209
|
maxSize: 1e3
|
|
@@ -148074,7 +148215,7 @@ function addLogEntry(entry) {
|
|
|
148074
148215
|
}
|
|
148075
148216
|
}
|
|
148076
148217
|
function logsApi(_logger) {
|
|
148077
|
-
const router =
|
|
148218
|
+
const router = express5.Router();
|
|
148078
148219
|
router.get("/", (req, res) => {
|
|
148079
148220
|
const { level, search, limit = "100", offset = "0" } = req.query;
|
|
148080
148221
|
const limitNum = Math.min(
|
|
@@ -148178,7 +148319,7 @@ function anonymizeLogMessage(message) {
|
|
|
148178
148319
|
return result;
|
|
148179
148320
|
}
|
|
148180
148321
|
function diagnosticApi(bridgeService, haClient, haRegistry, version, startTime) {
|
|
148181
|
-
const router =
|
|
148322
|
+
const router = express6.Router();
|
|
148182
148323
|
router.get("/export", (req, res) => {
|
|
148183
148324
|
const anonymize = req.query.anonymize !== "false";
|
|
148184
148325
|
const logLimit = Math.min(
|
|
@@ -148257,9 +148398,9 @@ function diagnosticApi(bridgeService, haClient, haRegistry, version, startTime)
|
|
|
148257
148398
|
}
|
|
148258
148399
|
|
|
148259
148400
|
// src/api/entity-mapping-api.ts
|
|
148260
|
-
import
|
|
148401
|
+
import express7 from "express";
|
|
148261
148402
|
function entityMappingApi(mappingStorage) {
|
|
148262
|
-
const router =
|
|
148403
|
+
const router = express7.Router();
|
|
148263
148404
|
router.get("/:bridgeId", (req, res) => {
|
|
148264
148405
|
const { bridgeId } = req.params;
|
|
148265
148406
|
const mappings = mappingStorage.getMappingsForBridge(bridgeId);
|
|
@@ -148313,9 +148454,9 @@ function entityMappingApi(mappingStorage) {
|
|
|
148313
148454
|
}
|
|
148314
148455
|
|
|
148315
148456
|
// src/api/health-api.ts
|
|
148316
|
-
import
|
|
148457
|
+
import express8 from "express";
|
|
148317
148458
|
function healthApi(bridgeService, haClient, version, startTime) {
|
|
148318
|
-
const router =
|
|
148459
|
+
const router = express8.Router();
|
|
148319
148460
|
const getBridgeStats = () => {
|
|
148320
148461
|
const bridges = bridgeService.bridges;
|
|
148321
148462
|
return {
|
|
@@ -148405,9 +148546,9 @@ function healthApi(bridgeService, haClient, version, startTime) {
|
|
|
148405
148546
|
}
|
|
148406
148547
|
|
|
148407
148548
|
// src/api/home-assistant-api.ts
|
|
148408
|
-
import
|
|
148549
|
+
import express9 from "express";
|
|
148409
148550
|
function homeAssistantApi(haRegistry, haClient) {
|
|
148410
|
-
const router =
|
|
148551
|
+
const router = express9.Router();
|
|
148411
148552
|
router.get("/stats", (_, res) => {
|
|
148412
148553
|
const entities = Object.values(haRegistry.entities);
|
|
148413
148554
|
const devices = Object.values(haRegistry.devices);
|
|
@@ -148731,7 +148872,7 @@ function lockCredentialApi(lockCredentialStorage) {
|
|
|
148731
148872
|
// src/api/matter-api.ts
|
|
148732
148873
|
init_dist();
|
|
148733
148874
|
import { Ajv } from "ajv";
|
|
148734
|
-
import
|
|
148875
|
+
import express10 from "express";
|
|
148735
148876
|
|
|
148736
148877
|
// src/services/bridges/matcher/matches-entity-filter.ts
|
|
148737
148878
|
function testMatchers(matchers, device, entity, mode = "any", entityState, labels) {
|
|
@@ -148877,7 +149018,7 @@ function endpointToJson(endpoint, parentId) {
|
|
|
148877
149018
|
// src/api/matter-api.ts
|
|
148878
149019
|
var ajv = new Ajv();
|
|
148879
149020
|
function matterApi(bridgeService, haRegistry) {
|
|
148880
|
-
const router =
|
|
149021
|
+
const router = express10.Router();
|
|
148881
149022
|
router.get("/", (_, res) => {
|
|
148882
149023
|
res.status(200).json({});
|
|
148883
149024
|
});
|
|
@@ -149249,9 +149390,9 @@ function matterApi(bridgeService, haRegistry) {
|
|
|
149249
149390
|
}
|
|
149250
149391
|
|
|
149251
149392
|
// src/api/metrics-api.ts
|
|
149252
|
-
import
|
|
149393
|
+
import express11 from "express";
|
|
149253
149394
|
function metricsApi(bridgeService, haClient, haRegistry, startTime) {
|
|
149254
|
-
const router =
|
|
149395
|
+
const router = express11.Router();
|
|
149255
149396
|
router.get("/", (_, res) => {
|
|
149256
149397
|
const memoryUsage = process.memoryUsage();
|
|
149257
149398
|
const bridges = bridgeService.bridges;
|
|
@@ -149381,7 +149522,7 @@ function metricsApi(bridgeService, haClient, haRegistry, startTime) {
|
|
|
149381
149522
|
}
|
|
149382
149523
|
|
|
149383
149524
|
// src/api/proxy-support.ts
|
|
149384
|
-
import
|
|
149525
|
+
import path4 from "node:path";
|
|
149385
149526
|
var ingressPath = "x-ingress-path";
|
|
149386
149527
|
var forwardedPrefix = "x-forwarded-prefix";
|
|
149387
149528
|
function supportIngress(req, _, next) {
|
|
@@ -149420,7 +149561,7 @@ function supportProxyLocation(req, res, next) {
|
|
|
149420
149561
|
next();
|
|
149421
149562
|
}
|
|
149422
149563
|
function buildPath(...paths) {
|
|
149423
|
-
let result =
|
|
149564
|
+
let result = path4.posix.join(...paths);
|
|
149424
149565
|
if (!result.startsWith("/")) {
|
|
149425
149566
|
result = `/${result}`;
|
|
149426
149567
|
}
|
|
@@ -149494,7 +149635,7 @@ import { exec } from "node:child_process";
|
|
|
149494
149635
|
import os2 from "node:os";
|
|
149495
149636
|
import { promisify } from "node:util";
|
|
149496
149637
|
import v8 from "node:v8";
|
|
149497
|
-
import
|
|
149638
|
+
import express12 from "express";
|
|
149498
149639
|
var execAsync = promisify(exec);
|
|
149499
149640
|
function detectEnvironment2() {
|
|
149500
149641
|
if (process.env.SUPERVISOR_TOKEN || process.env.HASSIO_TOKEN) {
|
|
@@ -149504,8 +149645,8 @@ function detectEnvironment2() {
|
|
|
149504
149645
|
return "Docker";
|
|
149505
149646
|
}
|
|
149506
149647
|
try {
|
|
149507
|
-
const
|
|
149508
|
-
if (
|
|
149648
|
+
const fs8 = __require("node:fs");
|
|
149649
|
+
if (fs8.existsSync("/.dockerenv")) {
|
|
149509
149650
|
return "Docker";
|
|
149510
149651
|
}
|
|
149511
149652
|
} catch {
|
|
@@ -149513,7 +149654,7 @@ function detectEnvironment2() {
|
|
|
149513
149654
|
return "Standalone";
|
|
149514
149655
|
}
|
|
149515
149656
|
function systemApi(version) {
|
|
149516
|
-
const router =
|
|
149657
|
+
const router = express12.Router();
|
|
149517
149658
|
router.get("/info", async (_req, res) => {
|
|
149518
149659
|
try {
|
|
149519
149660
|
const totalMem = os2.totalmem();
|
|
@@ -149622,9 +149763,9 @@ function getDataPath() {
|
|
|
149622
149763
|
}
|
|
149623
149764
|
return process.cwd();
|
|
149624
149765
|
}
|
|
149625
|
-
async function getWindowsStorageInfo(
|
|
149766
|
+
async function getWindowsStorageInfo(path9) {
|
|
149626
149767
|
try {
|
|
149627
|
-
const drive = `${
|
|
149768
|
+
const drive = `${path9.split(":")[0]}:`;
|
|
149628
149769
|
const { stdout } = await execAsync(
|
|
149629
149770
|
`powershell -Command "Get-PSDrive -Name '${drive.replace(":", "")}' | Select-Object Used,Free | ConvertTo-Json"`
|
|
149630
149771
|
);
|
|
@@ -149635,7 +149776,7 @@ async function getWindowsStorageInfo(path8) {
|
|
|
149635
149776
|
return { total, used, free };
|
|
149636
149777
|
} catch {
|
|
149637
149778
|
try {
|
|
149638
|
-
const drive = `${
|
|
149779
|
+
const drive = `${path9.split(":")[0]}:`;
|
|
149639
149780
|
const { stdout } = await execAsync(
|
|
149640
149781
|
`wmic logicaldisk where "DeviceID='${drive}'" get Size,FreeSpace /format:csv`
|
|
149641
149782
|
);
|
|
@@ -149652,9 +149793,9 @@ async function getWindowsStorageInfo(path8) {
|
|
|
149652
149793
|
return { total: 0, used: 0, free: 0 };
|
|
149653
149794
|
}
|
|
149654
149795
|
}
|
|
149655
|
-
async function getUnixStorageInfo(
|
|
149796
|
+
async function getUnixStorageInfo(path9) {
|
|
149656
149797
|
try {
|
|
149657
|
-
const { stdout } = await execAsync(`df -Pk "${
|
|
149798
|
+
const { stdout } = await execAsync(`df -Pk "${path9}" 2>/dev/null`);
|
|
149658
149799
|
const lines = stdout.trim().split("\n");
|
|
149659
149800
|
if (lines.length >= 2) {
|
|
149660
149801
|
const parts = lines[1].split(/\s+/);
|
|
@@ -149671,16 +149812,16 @@ async function getUnixStorageInfo(path8) {
|
|
|
149671
149812
|
}
|
|
149672
149813
|
|
|
149673
149814
|
// src/api/web-ui.ts
|
|
149674
|
-
import
|
|
149675
|
-
import
|
|
149676
|
-
import
|
|
149815
|
+
import fs4 from "node:fs";
|
|
149816
|
+
import path5 from "node:path";
|
|
149817
|
+
import express13 from "express";
|
|
149677
149818
|
function webUi(dist) {
|
|
149678
|
-
const router =
|
|
149819
|
+
const router = express13.Router();
|
|
149679
149820
|
if (dist) {
|
|
149680
149821
|
const index = replaceBase(dist);
|
|
149681
149822
|
router.get("/", index);
|
|
149682
149823
|
router.get("/index.html", index);
|
|
149683
|
-
router.use(
|
|
149824
|
+
router.use(express13.static(dist));
|
|
149684
149825
|
router.get(/.*/, index);
|
|
149685
149826
|
}
|
|
149686
149827
|
return router;
|
|
@@ -149691,7 +149832,7 @@ function replaceBase(dist) {
|
|
|
149691
149832
|
if (!baseUrl.endsWith("/")) {
|
|
149692
149833
|
baseUrl += "/";
|
|
149693
149834
|
}
|
|
149694
|
-
const content =
|
|
149835
|
+
const content = fs4.readFileSync(path5.join(dist, "index.html"), "utf8").replace(
|
|
149695
149836
|
/<!-- BASE -->[\s\S]*<!-- \/BASE -->/,
|
|
149696
149837
|
`<base href='${baseUrl}' />`
|
|
149697
149838
|
);
|
|
@@ -149859,8 +150000,8 @@ var WebApi = class extends Service {
|
|
|
149859
150000
|
return this.wsApi;
|
|
149860
150001
|
}
|
|
149861
150002
|
async initialize() {
|
|
149862
|
-
const api =
|
|
149863
|
-
api.use(
|
|
150003
|
+
const api = express14.Router();
|
|
150004
|
+
api.use(express14.json()).use(nocache()).use("/matter", matterApi(this.bridgeService, this.haRegistry)).use(
|
|
149864
150005
|
"/health",
|
|
149865
150006
|
healthApi(
|
|
149866
150007
|
this.bridgeService,
|
|
@@ -149868,7 +150009,10 @@ var WebApi = class extends Service {
|
|
|
149868
150009
|
this.props.version,
|
|
149869
150010
|
this.startTime
|
|
149870
150011
|
)
|
|
149871
|
-
).use("/bridges", bridgeExportApi(this.bridgeStorage)).use("/bridge-icons", bridgeIconApi(this.props.storageLocation)).use(
|
|
150012
|
+
).use("/bridges", bridgeExportApi(this.bridgeStorage)).use("/bridge-icons", bridgeIconApi(this.props.storageLocation)).use(
|
|
150013
|
+
"/device-images",
|
|
150014
|
+
deviceImageApi(this.props.storageLocation, this.haRegistry)
|
|
150015
|
+
).use("/entity-mappings", entityMappingApi(this.mappingStorage)).use("/lock-credentials", lockCredentialApi(this.lockCredentialStorage)).use("/settings", settingsApi(this.settingsStorage, this.props.auth)).use(
|
|
149872
150016
|
"/backup",
|
|
149873
150017
|
backupApi(
|
|
149874
150018
|
this.bridgeStorage,
|
|
@@ -149917,7 +150061,7 @@ var WebApi = class extends Service {
|
|
|
149917
150061
|
})
|
|
149918
150062
|
);
|
|
149919
150063
|
}
|
|
149920
|
-
this.app =
|
|
150064
|
+
this.app = express14().use(...middlewares).use("/api", api).use(webUi(this.props.webUiDist));
|
|
149921
150065
|
}
|
|
149922
150066
|
async dispose() {
|
|
149923
150067
|
this.wsApi.close();
|
|
@@ -150161,14 +150305,14 @@ function mdns(env, options) {
|
|
|
150161
150305
|
|
|
150162
150306
|
// src/core/app/storage.ts
|
|
150163
150307
|
init_esm7();
|
|
150164
|
-
import
|
|
150308
|
+
import fs6 from "node:fs";
|
|
150165
150309
|
import os3 from "node:os";
|
|
150166
|
-
import
|
|
150310
|
+
import path6 from "node:path";
|
|
150167
150311
|
|
|
150168
150312
|
// src/core/app/storage/custom-storage.ts
|
|
150169
150313
|
init_dist();
|
|
150170
150314
|
init_esm6();
|
|
150171
|
-
import
|
|
150315
|
+
import fs5 from "node:fs";
|
|
150172
150316
|
import { forEach } from "lodash-es";
|
|
150173
150317
|
|
|
150174
150318
|
// src/core/app/storage/legacy-custom-storage.ts
|
|
@@ -150176,8 +150320,8 @@ init_dist();
|
|
|
150176
150320
|
init_esm6();
|
|
150177
150321
|
import { pickBy } from "lodash-es";
|
|
150178
150322
|
var LegacyCustomStorage = class extends StorageBackendJsonFile {
|
|
150179
|
-
constructor(log,
|
|
150180
|
-
super(
|
|
150323
|
+
constructor(log, path9) {
|
|
150324
|
+
super(path9);
|
|
150181
150325
|
this.log = log;
|
|
150182
150326
|
const parser = this;
|
|
150183
150327
|
const serialize2 = parser.toJson.bind(parser);
|
|
@@ -150191,7 +150335,7 @@ var LegacyCustomStorage = class extends StorageBackendJsonFile {
|
|
|
150191
150335
|
return this.removeClusters(object, Object.values(ClusterId2));
|
|
150192
150336
|
} catch (e) {
|
|
150193
150337
|
this.log.error(
|
|
150194
|
-
`Failed to parse json file '${
|
|
150338
|
+
`Failed to parse json file '${path9}' with content:
|
|
150195
150339
|
|
|
150196
150340
|
${json}
|
|
150197
150341
|
|
|
@@ -150205,7 +150349,7 @@ ${json}
|
|
|
150205
150349
|
this.removeClusters(object, [ClusterId2.homeAssistantEntity])
|
|
150206
150350
|
);
|
|
150207
150351
|
if (json.trim().length === 0) {
|
|
150208
|
-
throw new Error(`Tried to write empty storage to ${
|
|
150352
|
+
throw new Error(`Tried to write empty storage to ${path9}`);
|
|
150209
150353
|
}
|
|
150210
150354
|
return json;
|
|
150211
150355
|
};
|
|
@@ -150223,14 +150367,14 @@ ${json}
|
|
|
150223
150367
|
|
|
150224
150368
|
// src/core/app/storage/custom-storage.ts
|
|
150225
150369
|
var CustomStorage = class extends StorageBackendDisk {
|
|
150226
|
-
constructor(log,
|
|
150227
|
-
super(
|
|
150370
|
+
constructor(log, path9) {
|
|
150371
|
+
super(path9);
|
|
150228
150372
|
this.log = log;
|
|
150229
|
-
this.path =
|
|
150373
|
+
this.path = path9;
|
|
150230
150374
|
}
|
|
150231
150375
|
async initialize() {
|
|
150232
150376
|
await super.initialize();
|
|
150233
|
-
if (
|
|
150377
|
+
if (fs5.existsSync(`${this.path}.json`)) {
|
|
150234
150378
|
await this.migrateLegacyStorage();
|
|
150235
150379
|
}
|
|
150236
150380
|
}
|
|
@@ -150243,11 +150387,11 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
150243
150387
|
return await super.keys(contexts);
|
|
150244
150388
|
}
|
|
150245
150389
|
async migrateLegacyStorage() {
|
|
150246
|
-
const
|
|
150390
|
+
const path9 = this.path;
|
|
150247
150391
|
this.log.warn(
|
|
150248
|
-
`Migrating legacy storage (JSON file) to new storage (directory): ${
|
|
150392
|
+
`Migrating legacy storage (JSON file) to new storage (directory): ${path9}`
|
|
150249
150393
|
);
|
|
150250
|
-
const legacyStorage = new LegacyCustomStorage(this.log, `${
|
|
150394
|
+
const legacyStorage = new LegacyCustomStorage(this.log, `${path9}.json`);
|
|
150251
150395
|
legacyStorage.initialize();
|
|
150252
150396
|
forEach(legacyStorage.data, (values4, context) => {
|
|
150253
150397
|
forEach(values4, (value, key) => {
|
|
@@ -150255,7 +150399,7 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
150255
150399
|
});
|
|
150256
150400
|
});
|
|
150257
150401
|
await legacyStorage.close();
|
|
150258
|
-
|
|
150402
|
+
fs5.renameSync(`${path9}.json`, `${path9}/backup.alpha-69.json`);
|
|
150259
150403
|
}
|
|
150260
150404
|
};
|
|
150261
150405
|
|
|
@@ -150263,14 +150407,14 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
150263
150407
|
function storage(environment, options) {
|
|
150264
150408
|
const logger192 = environment.get(LoggerService).get("CustomStorage");
|
|
150265
150409
|
const location2 = resolveStorageLocation(options.location);
|
|
150266
|
-
|
|
150410
|
+
fs6.mkdirSync(location2, { recursive: true });
|
|
150267
150411
|
const storageService = environment.get(StorageService);
|
|
150268
150412
|
storageService.location = location2;
|
|
150269
|
-
storageService.factory = (ns) => new CustomStorage(logger192,
|
|
150413
|
+
storageService.factory = (ns) => new CustomStorage(logger192, path6.resolve(location2, ns));
|
|
150270
150414
|
}
|
|
150271
150415
|
function resolveStorageLocation(storageLocation) {
|
|
150272
150416
|
const homedir = os3.homedir();
|
|
150273
|
-
return storageLocation ?
|
|
150417
|
+
return storageLocation ? path6.resolve(storageLocation.replace(/^~\//, `${homedir}/`)) : path6.join(homedir, ".home-assistant-matter-hub");
|
|
150274
150418
|
}
|
|
150275
150419
|
|
|
150276
150420
|
// src/core/app/configure-default-environment.ts
|
|
@@ -150290,7 +150434,7 @@ function configureDefaultEnvironment(options) {
|
|
|
150290
150434
|
init_esm7();
|
|
150291
150435
|
import { createRequire } from "node:module";
|
|
150292
150436
|
import os4 from "node:os";
|
|
150293
|
-
import
|
|
150437
|
+
import path7 from "node:path";
|
|
150294
150438
|
function resolveAppVersion() {
|
|
150295
150439
|
if (process.env.APP_VERSION) {
|
|
150296
150440
|
return process.env.APP_VERSION;
|
|
@@ -150353,7 +150497,7 @@ var Options = class {
|
|
|
150353
150497
|
resolveStorageLocation() {
|
|
150354
150498
|
const storageLocation = notEmpty(this.startOptions.storageLocation);
|
|
150355
150499
|
const homedir = os4.homedir();
|
|
150356
|
-
return storageLocation ?
|
|
150500
|
+
return storageLocation ? path7.resolve(storageLocation.replace(/^~\//, `${homedir}/`)) : path7.join(homedir, ".home-assistant-matter-hub");
|
|
150357
150501
|
}
|
|
150358
150502
|
get bridgeService() {
|
|
150359
150503
|
return {
|
|
@@ -165960,6 +166104,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
165960
166104
|
if (this.state.maxLevel == null) {
|
|
165961
166105
|
this.state.maxLevel = 254;
|
|
165962
166106
|
}
|
|
166107
|
+
this.state.onLevel = null;
|
|
165963
166108
|
logger157.debug(`initialize: calling super.initialize()`);
|
|
165964
166109
|
try {
|
|
165965
166110
|
await super.initialize();
|
|
@@ -176715,7 +176860,7 @@ async function startHandler(startOptions, webUiDist) {
|
|
|
176715
176860
|
}
|
|
176716
176861
|
|
|
176717
176862
|
// src/commands/start/start-options-builder.ts
|
|
176718
|
-
import
|
|
176863
|
+
import fs7 from "node:fs";
|
|
176719
176864
|
function startOptionsBuilder(yargs2) {
|
|
176720
176865
|
return yargs2.env("HAMH").version(false).config(
|
|
176721
176866
|
"config",
|
|
@@ -176724,10 +176869,10 @@ function startOptionsBuilder(yargs2) {
|
|
|
176724
176869
|
if (configPath.trim() === "") {
|
|
176725
176870
|
return {};
|
|
176726
176871
|
}
|
|
176727
|
-
if (!
|
|
176872
|
+
if (!fs7.existsSync(configPath)) {
|
|
176728
176873
|
throw new Error(`Config file '${configPath}' does not exist!`);
|
|
176729
176874
|
}
|
|
176730
|
-
return JSON.parse(
|
|
176875
|
+
return JSON.parse(fs7.readFileSync(configPath, "utf-8"));
|
|
176731
176876
|
}
|
|
176732
176877
|
).option("log-level", {
|
|
176733
176878
|
type: "string",
|
|
@@ -176786,7 +176931,7 @@ function startCommand(webDist) {
|
|
|
176786
176931
|
// src/cli.ts
|
|
176787
176932
|
var dirname = import.meta.dirname ?? url.fileURLToPath(new URL(".", import.meta.url));
|
|
176788
176933
|
async function cli(argv) {
|
|
176789
|
-
const webDist = process.env.NODE_ENV === "development" ? void 0 :
|
|
176934
|
+
const webDist = process.env.NODE_ENV === "development" ? void 0 : path8.join(dirname, "../frontend");
|
|
176790
176935
|
const cli2 = yargs(hideBin(argv));
|
|
176791
176936
|
cli2.scriptName("home-assistant-matter-hub").version().strict().recommendCommands().detectLocale(false).help().command(startCommand(webDist)).demandCommand().wrap(Math.min(140, cli2.terminalWidth())).parse();
|
|
176792
176937
|
}
|