@riddix/hamh 2.1.0-alpha.479 → 2.1.0-alpha.481
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
|
@@ -1290,8 +1290,8 @@ var init_DiagnosticPresentation = __esm({
|
|
|
1290
1290
|
// ../../node_modules/.pnpm/@matter+general@0.16.10/node_modules/@matter/general/dist/esm/util/Promises.js
|
|
1291
1291
|
function createPromise() {
|
|
1292
1292
|
let resolver, rejecter;
|
|
1293
|
-
const promise = new Promise((
|
|
1294
|
-
resolver =
|
|
1293
|
+
const promise = new Promise((resolve6, reject) => {
|
|
1294
|
+
resolver = resolve6;
|
|
1295
1295
|
rejecter = reject;
|
|
1296
1296
|
});
|
|
1297
1297
|
if (!resolver || !rejecter) {
|
|
@@ -1304,7 +1304,7 @@ function createPromise() {
|
|
|
1304
1304
|
};
|
|
1305
1305
|
}
|
|
1306
1306
|
function anyPromise(promises) {
|
|
1307
|
-
return new Promise((
|
|
1307
|
+
return new Promise((resolve6, reject) => {
|
|
1308
1308
|
let numberRejected = 0;
|
|
1309
1309
|
let wasResolved = false;
|
|
1310
1310
|
for (const entry of promises) {
|
|
@@ -1312,7 +1312,7 @@ function anyPromise(promises) {
|
|
|
1312
1312
|
promise.then((value) => {
|
|
1313
1313
|
if (!wasResolved) {
|
|
1314
1314
|
wasResolved = true;
|
|
1315
|
-
|
|
1315
|
+
resolve6(value);
|
|
1316
1316
|
}
|
|
1317
1317
|
}).catch((reason) => {
|
|
1318
1318
|
numberRejected++;
|
|
@@ -1335,7 +1335,7 @@ async function withTimeout(timeout, promise, cancel) {
|
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
1337
|
let cancelTimer;
|
|
1338
|
-
const timedOut = new Promise((
|
|
1338
|
+
const timedOut = new Promise((resolve6, reject) => {
|
|
1339
1339
|
const timer = Time.getTimer("promise-timeout", timeout, () => {
|
|
1340
1340
|
try {
|
|
1341
1341
|
cancelFn();
|
|
@@ -1346,7 +1346,7 @@ async function withTimeout(timeout, promise, cancel) {
|
|
|
1346
1346
|
});
|
|
1347
1347
|
cancelTimer = () => {
|
|
1348
1348
|
timer.stop();
|
|
1349
|
-
|
|
1349
|
+
resolve6();
|
|
1350
1350
|
};
|
|
1351
1351
|
timer.start();
|
|
1352
1352
|
});
|
|
@@ -1383,7 +1383,7 @@ var init_Promises = __esm({
|
|
|
1383
1383
|
* Chained MaybePromise. Invokes the resolve function immediately if the {@link MaybePromise} is not a
|
|
1384
1384
|
* {@link Promise}, otherwise the same as a normal {@link Promise.then}.
|
|
1385
1385
|
*/
|
|
1386
|
-
then(producer,
|
|
1386
|
+
then(producer, resolve6, reject) {
|
|
1387
1387
|
let rejected = false;
|
|
1388
1388
|
try {
|
|
1389
1389
|
let value;
|
|
@@ -1394,15 +1394,15 @@ var init_Promises = __esm({
|
|
|
1394
1394
|
}
|
|
1395
1395
|
if (MaybePromise.is(value)) {
|
|
1396
1396
|
return value.then(
|
|
1397
|
-
|
|
1397
|
+
resolve6,
|
|
1398
1398
|
reject ? (error) => {
|
|
1399
1399
|
rejected = true;
|
|
1400
1400
|
return reject?.(error);
|
|
1401
1401
|
} : void 0
|
|
1402
1402
|
);
|
|
1403
1403
|
}
|
|
1404
|
-
if (
|
|
1405
|
-
return
|
|
1404
|
+
if (resolve6) {
|
|
1405
|
+
return resolve6(value);
|
|
1406
1406
|
}
|
|
1407
1407
|
} catch (e) {
|
|
1408
1408
|
if (reject && !rejected) {
|
|
@@ -1467,13 +1467,13 @@ var init_Promises = __esm({
|
|
|
1467
1467
|
#isResolved = false;
|
|
1468
1468
|
#isRejected = false;
|
|
1469
1469
|
constructor() {
|
|
1470
|
-
let
|
|
1470
|
+
let resolve6;
|
|
1471
1471
|
let reject;
|
|
1472
1472
|
this.#promise = new Promise((res, rej) => {
|
|
1473
|
-
|
|
1473
|
+
resolve6 = res;
|
|
1474
1474
|
reject = rej;
|
|
1475
1475
|
});
|
|
1476
|
-
this.#resolve =
|
|
1476
|
+
this.#resolve = resolve6;
|
|
1477
1477
|
this.#reject = reject;
|
|
1478
1478
|
}
|
|
1479
1479
|
/**
|
|
@@ -1505,8 +1505,8 @@ var init_Promises = __esm({
|
|
|
1505
1505
|
return;
|
|
1506
1506
|
}
|
|
1507
1507
|
this.#isResolved = this.#isRejected = false;
|
|
1508
|
-
this.#promise = new Promise((
|
|
1509
|
-
this.#resolve =
|
|
1508
|
+
this.#promise = new Promise((resolve6, reject) => {
|
|
1509
|
+
this.#resolve = resolve6;
|
|
1510
1510
|
this.#reject = reject;
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
@@ -1531,8 +1531,8 @@ var init_Promises = __esm({
|
|
|
1531
1531
|
this.#isRejected = true;
|
|
1532
1532
|
this.#reject(cause);
|
|
1533
1533
|
}
|
|
1534
|
-
then(
|
|
1535
|
-
return this.#promise.then(
|
|
1534
|
+
then(resolve6, reject) {
|
|
1535
|
+
return this.#promise.then(resolve6, reject);
|
|
1536
1536
|
}
|
|
1537
1537
|
catch(reject) {
|
|
1538
1538
|
return this.#promise.catch(reject);
|
|
@@ -1548,16 +1548,16 @@ var init_Promises = __esm({
|
|
|
1548
1548
|
let listener;
|
|
1549
1549
|
let registered2;
|
|
1550
1550
|
let disposables;
|
|
1551
|
-
let race2 = new Promise((
|
|
1552
|
-
listener = { resolve:
|
|
1551
|
+
let race2 = new Promise((resolve6, reject) => {
|
|
1552
|
+
listener = { resolve: resolve6, reject };
|
|
1553
1553
|
for (const value of values4) {
|
|
1554
1554
|
if (!MaybePromise.is(value)) {
|
|
1555
|
-
Promise.resolve(value).then(
|
|
1555
|
+
Promise.resolve(value).then(resolve6, reject);
|
|
1556
1556
|
continue;
|
|
1557
1557
|
}
|
|
1558
1558
|
if ("use" in value && "off" in value && typeof value.use === "function" && typeof value.off === "function") {
|
|
1559
1559
|
if ("value" in value && value.value) {
|
|
1560
|
-
Promise.resolve(value.value).then(
|
|
1560
|
+
Promise.resolve(value.value).then(resolve6, reject);
|
|
1561
1561
|
continue;
|
|
1562
1562
|
}
|
|
1563
1563
|
if (!disposables) {
|
|
@@ -1567,19 +1567,19 @@ var init_Promises = __esm({
|
|
|
1567
1567
|
if ("value" in value) {
|
|
1568
1568
|
observer = (value2) => {
|
|
1569
1569
|
if (value2) {
|
|
1570
|
-
|
|
1570
|
+
resolve6(value2);
|
|
1571
1571
|
}
|
|
1572
1572
|
};
|
|
1573
1573
|
disposables.push(value.useError(reject));
|
|
1574
1574
|
} else {
|
|
1575
|
-
observer =
|
|
1575
|
+
observer = resolve6;
|
|
1576
1576
|
}
|
|
1577
1577
|
disposables.push(value.use(observer));
|
|
1578
1578
|
continue;
|
|
1579
1579
|
}
|
|
1580
1580
|
const settlement = settlementOf(value);
|
|
1581
1581
|
if (settlement.isSettled) {
|
|
1582
|
-
value.then(
|
|
1582
|
+
value.then(resolve6, reject);
|
|
1583
1583
|
continue;
|
|
1584
1584
|
}
|
|
1585
1585
|
settlement.listeners.add(listener);
|
|
@@ -1664,7 +1664,7 @@ var init_Cancelable = __esm({
|
|
|
1664
1664
|
if (onCancel !== void 0) {
|
|
1665
1665
|
this.onCancel = onCancel;
|
|
1666
1666
|
}
|
|
1667
|
-
this.#promise = new Promise((
|
|
1667
|
+
this.#promise = new Promise((resolve6, reject) => {
|
|
1668
1668
|
this.#reject = (reason) => {
|
|
1669
1669
|
this.#isSettled = true;
|
|
1670
1670
|
reject(errorOf(reason));
|
|
@@ -1675,7 +1675,7 @@ var init_Cancelable = __esm({
|
|
|
1675
1675
|
return;
|
|
1676
1676
|
}
|
|
1677
1677
|
this.#isSettled = true;
|
|
1678
|
-
|
|
1678
|
+
resolve6(value);
|
|
1679
1679
|
},
|
|
1680
1680
|
(reason) => {
|
|
1681
1681
|
if (this.#isSettled) {
|
|
@@ -1870,9 +1870,9 @@ var init_Time = __esm({
|
|
|
1870
1870
|
let timer;
|
|
1871
1871
|
let resolver;
|
|
1872
1872
|
return new CancelablePromise(
|
|
1873
|
-
(
|
|
1874
|
-
resolver =
|
|
1875
|
-
timer = _Time.getTimer(name, duration3, () =>
|
|
1873
|
+
(resolve6) => {
|
|
1874
|
+
resolver = resolve6;
|
|
1875
|
+
timer = _Time.getTimer(name, duration3, () => resolve6());
|
|
1876
1876
|
timer.start();
|
|
1877
1877
|
},
|
|
1878
1878
|
() => {
|
|
@@ -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: path13, 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 (path13) {
|
|
2237
|
+
diagnostic.push(Diagnostic2.squash(path13, ":"));
|
|
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 path13;
|
|
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: path13 } = 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: path13 };
|
|
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: path13, stack, stackLines };
|
|
2407
2407
|
}
|
|
2408
2408
|
Diagnostic2.messageAndStackFor = messageAndStackFor;
|
|
2409
2409
|
})(Diagnostic || (Diagnostic = {}));
|
|
@@ -3788,7 +3788,7 @@ var init_Abort = __esm({
|
|
|
3788
3788
|
}
|
|
3789
3789
|
async then(onfulfilled, onrejected) {
|
|
3790
3790
|
if (!this.#aborted) {
|
|
3791
|
-
this.#aborted = new Promise((
|
|
3791
|
+
this.#aborted = new Promise((resolve6) => this.#resolve = resolve6);
|
|
3792
3792
|
this.addEventListener("abort", () => this.#resolve(asError(this.signal.reason)));
|
|
3793
3793
|
}
|
|
3794
3794
|
return await this.#aborted.then(onfulfilled, onrejected);
|
|
@@ -3820,8 +3820,8 @@ var init_Abort = __esm({
|
|
|
3820
3820
|
signal = signal.signal;
|
|
3821
3821
|
}
|
|
3822
3822
|
let off;
|
|
3823
|
-
const aborted = new Promise((
|
|
3824
|
-
const onabort = () =>
|
|
3823
|
+
const aborted = new Promise((resolve6) => {
|
|
3824
|
+
const onabort = () => resolve6();
|
|
3825
3825
|
signal.addEventListener("abort", onabort);
|
|
3826
3826
|
off = () => signal.removeEventListener("abort", onabort);
|
|
3827
3827
|
});
|
|
@@ -3848,8 +3848,8 @@ var init_Abort = __esm({
|
|
|
3848
3848
|
Abort2.attempt = attempt;
|
|
3849
3849
|
function sleep(description, abort, duration3) {
|
|
3850
3850
|
let timer;
|
|
3851
|
-
const rested = new Promise((
|
|
3852
|
-
timer = Time.getTimer(description, duration3, () =>
|
|
3851
|
+
const rested = new Promise((resolve6) => {
|
|
3852
|
+
timer = Time.getTimer(description, duration3, () => resolve6());
|
|
3853
3853
|
});
|
|
3854
3854
|
return race(abort, rested).finally(timer.stop.bind(timer));
|
|
3855
3855
|
}
|
|
@@ -4645,9 +4645,9 @@ var init_Observable = __esm({
|
|
|
4645
4645
|
this.#once.add(observer);
|
|
4646
4646
|
}
|
|
4647
4647
|
then(onfulfilled, onrejected) {
|
|
4648
|
-
return new Promise((
|
|
4648
|
+
return new Promise((resolve6) => {
|
|
4649
4649
|
this.once((...payload) => {
|
|
4650
|
-
|
|
4650
|
+
resolve6(payload[0]);
|
|
4651
4651
|
});
|
|
4652
4652
|
}).then(onfulfilled, onrejected);
|
|
4653
4653
|
}
|
|
@@ -4690,14 +4690,14 @@ var init_Observable = __esm({
|
|
|
4690
4690
|
if (this.#joinIteration) {
|
|
4691
4691
|
return this.#joinIteration();
|
|
4692
4692
|
}
|
|
4693
|
-
let
|
|
4693
|
+
let resolve6;
|
|
4694
4694
|
let iteratorCount = 1;
|
|
4695
4695
|
function newPromise() {
|
|
4696
|
-
return new Promise((r) =>
|
|
4696
|
+
return new Promise((r) => resolve6 = r);
|
|
4697
4697
|
}
|
|
4698
4698
|
let promise = newPromise();
|
|
4699
4699
|
function observer(...args) {
|
|
4700
|
-
const oldResolve =
|
|
4700
|
+
const oldResolve = resolve6;
|
|
4701
4701
|
promise = newPromise();
|
|
4702
4702
|
oldResolve({ value: args[0], promise });
|
|
4703
4703
|
}
|
|
@@ -4713,7 +4713,7 @@ var init_Observable = __esm({
|
|
|
4713
4713
|
};
|
|
4714
4714
|
this.#stopIteration = () => {
|
|
4715
4715
|
this.off(observer);
|
|
4716
|
-
|
|
4716
|
+
resolve6(void 0);
|
|
4717
4717
|
this.#stopIteration = void 0;
|
|
4718
4718
|
this.#removeIterator = void 0;
|
|
4719
4719
|
};
|
|
@@ -4773,11 +4773,11 @@ var init_Observable = __esm({
|
|
|
4773
4773
|
if (this.#value) {
|
|
4774
4774
|
return Promise.resolve(this.#value).then(onfulfilled, onrejected);
|
|
4775
4775
|
}
|
|
4776
|
-
return new Promise((
|
|
4776
|
+
return new Promise((resolve6, reject) => {
|
|
4777
4777
|
if (!this.#awaiters) {
|
|
4778
4778
|
this.#awaiters = [];
|
|
4779
4779
|
}
|
|
4780
|
-
this.#awaiters.push({ resolve:
|
|
4780
|
+
this.#awaiters.push({ resolve: resolve6, reject });
|
|
4781
4781
|
}).then(onfulfilled, onrejected);
|
|
4782
4782
|
}
|
|
4783
4783
|
catch(onrejected) {
|
|
@@ -5265,8 +5265,8 @@ function Construction(subject, initializer) {
|
|
|
5265
5265
|
const handleRejection = onrejected ? () => onrejected?.(crashedError()) : void 0;
|
|
5266
5266
|
if (status3 === Lifecycle.Status.Inactive || status3 === Lifecycle.Status.Initializing) {
|
|
5267
5267
|
if (!awaiterPromise) {
|
|
5268
|
-
awaiterPromise = new Promise((
|
|
5269
|
-
awaiterResolve =
|
|
5268
|
+
awaiterPromise = new Promise((resolve6, reject) => {
|
|
5269
|
+
awaiterResolve = resolve6;
|
|
5270
5270
|
awaiterReject = reject;
|
|
5271
5271
|
});
|
|
5272
5272
|
}
|
|
@@ -5429,8 +5429,8 @@ function Construction(subject, initializer) {
|
|
|
5429
5429
|
},
|
|
5430
5430
|
get closed() {
|
|
5431
5431
|
if (closedPromise === void 0) {
|
|
5432
|
-
closedPromise = new Promise((
|
|
5433
|
-
closedResolve =
|
|
5432
|
+
closedPromise = new Promise((resolve6, reject) => {
|
|
5433
|
+
closedResolve = resolve6;
|
|
5434
5434
|
closedReject = reject;
|
|
5435
5435
|
});
|
|
5436
5436
|
}
|
|
@@ -5512,9 +5512,9 @@ function Construction(subject, initializer) {
|
|
|
5512
5512
|
setStatus(Lifecycle.Status.Active);
|
|
5513
5513
|
}
|
|
5514
5514
|
if (awaiterResolve) {
|
|
5515
|
-
const
|
|
5515
|
+
const resolve6 = awaiterResolve;
|
|
5516
5516
|
awaiterResolve = awaiterReject = void 0;
|
|
5517
|
-
|
|
5517
|
+
resolve6(subject);
|
|
5518
5518
|
}
|
|
5519
5519
|
}
|
|
5520
5520
|
function rejected(cause) {
|
|
@@ -6387,16 +6387,16 @@ var init_Heap = __esm({
|
|
|
6387
6387
|
return;
|
|
6388
6388
|
}
|
|
6389
6389
|
}
|
|
6390
|
-
let
|
|
6391
|
-
const ready = new Promise((r) =>
|
|
6390
|
+
let resolve6;
|
|
6391
|
+
const ready = new Promise((r) => resolve6 = r);
|
|
6392
6392
|
try {
|
|
6393
|
-
this.added.once(
|
|
6393
|
+
this.added.once(resolve6);
|
|
6394
6394
|
await Abort.race(abort, ready);
|
|
6395
6395
|
if (Abort.is(abort)) {
|
|
6396
6396
|
return;
|
|
6397
6397
|
}
|
|
6398
6398
|
} finally {
|
|
6399
|
-
this.added.off(
|
|
6399
|
+
this.added.off(resolve6);
|
|
6400
6400
|
}
|
|
6401
6401
|
}
|
|
6402
6402
|
}
|
|
@@ -7050,10 +7050,10 @@ var init_Mutex = __esm({
|
|
|
7050
7050
|
if (this.#closed) {
|
|
7051
7051
|
throw new MutexClosedError();
|
|
7052
7052
|
}
|
|
7053
|
-
return new Promise((
|
|
7053
|
+
return new Promise((resolve6, reject) => {
|
|
7054
7054
|
this.run(async () => {
|
|
7055
7055
|
try {
|
|
7056
|
-
|
|
7056
|
+
resolve6(await task());
|
|
7057
7057
|
} catch (e) {
|
|
7058
7058
|
reject(asError(e));
|
|
7059
7059
|
}
|
|
@@ -8733,11 +8733,11 @@ var init_RuntimeService = __esm({
|
|
|
8733
8733
|
if (!this.#workers.size) {
|
|
8734
8734
|
return Promise.resolve();
|
|
8735
8735
|
}
|
|
8736
|
-
return new Promise((
|
|
8736
|
+
return new Promise((resolve6) => {
|
|
8737
8737
|
const listener = () => {
|
|
8738
8738
|
if (!this.#workers.size) {
|
|
8739
8739
|
this.#workerDeleted.off(listener);
|
|
8740
|
-
|
|
8740
|
+
resolve6();
|
|
8741
8741
|
}
|
|
8742
8742
|
};
|
|
8743
8743
|
this.#workerDeleted.on(listener);
|
|
@@ -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, path13, value) {
|
|
8822
|
+
if (!path13.length) {
|
|
8823
8823
|
return;
|
|
8824
8824
|
}
|
|
8825
|
-
const firstPathEntry =
|
|
8825
|
+
const firstPathEntry = path13[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 (path13.length === 1) {
|
|
8831
8831
|
if (current === void 0) {
|
|
8832
8832
|
into[firstPathEntry] = value;
|
|
8833
8833
|
}
|
|
@@ -8836,7 +8836,7 @@ function addVariable(into, path12, value) {
|
|
|
8836
8836
|
if (typeof current !== "object") {
|
|
8837
8837
|
current = into[firstPathEntry] = {};
|
|
8838
8838
|
}
|
|
8839
|
-
addVariable(current,
|
|
8839
|
+
addVariable(current, path13.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 path13 = 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
|
+
path13.push(name);
|
|
9040
9040
|
add(val);
|
|
9041
|
-
|
|
9041
|
+
path13.pop();
|
|
9042
9042
|
} else {
|
|
9043
|
-
this.set([...
|
|
9043
|
+
this.set([...path13, 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 path13 = definition.path ?? "/";
|
|
11049
|
+
definition = `${protocol}://${host}${path13}`;
|
|
11050
11050
|
}
|
|
11051
11051
|
try {
|
|
11052
11052
|
super(definition);
|
|
@@ -14290,13 +14290,13 @@ var init_Tx = __esm({
|
|
|
14290
14290
|
describeList("and", ...[...others].map((other) => other.via))
|
|
14291
14291
|
);
|
|
14292
14292
|
this.#waitingOn = others;
|
|
14293
|
-
return new Promise((
|
|
14293
|
+
return new Promise((resolve6) => {
|
|
14294
14294
|
for (const other of others) {
|
|
14295
14295
|
other.onShared(() => {
|
|
14296
14296
|
others.delete(other);
|
|
14297
14297
|
if (!others.size) {
|
|
14298
14298
|
this.#waitingOn = void 0;
|
|
14299
|
-
|
|
14299
|
+
resolve6();
|
|
14300
14300
|
}
|
|
14301
14301
|
}, true);
|
|
14302
14302
|
}
|
|
@@ -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(path13, message) {
|
|
16445
|
+
super(`Definition of ${path13.path ?? path13}: ${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 path13 = type.split(".");
|
|
38187
|
+
if (path13.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), path13[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), path13, tag3);
|
|
38198
38198
|
if (found) {
|
|
38199
38199
|
return found;
|
|
38200
38200
|
}
|
|
@@ -38335,7 +38335,7 @@ var init_ModelTraversal = __esm({
|
|
|
38335
38335
|
return;
|
|
38336
38336
|
}
|
|
38337
38337
|
const bounds = {};
|
|
38338
|
-
const
|
|
38338
|
+
const resolve6 = (field22) => {
|
|
38339
38339
|
const value = constraint[field22];
|
|
38340
38340
|
const name = FieldValue.referenced(value);
|
|
38341
38341
|
if (name === void 0) {
|
|
@@ -38354,11 +38354,11 @@ var init_ModelTraversal = __esm({
|
|
|
38354
38354
|
}
|
|
38355
38355
|
};
|
|
38356
38356
|
if (field2) {
|
|
38357
|
-
|
|
38357
|
+
resolve6(field2);
|
|
38358
38358
|
} else {
|
|
38359
|
-
|
|
38360
|
-
|
|
38361
|
-
|
|
38359
|
+
resolve6("value");
|
|
38360
|
+
resolve6("min");
|
|
38361
|
+
resolve6("max");
|
|
38362
38362
|
}
|
|
38363
38363
|
if (Object.keys(bounds).length) {
|
|
38364
38364
|
constraint = constraint.extend(Constraint.create(bounds));
|
|
@@ -38489,22 +38489,22 @@ 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, path13, tag3) {
|
|
38493
38493
|
if (!scope) {
|
|
38494
38494
|
return;
|
|
38495
38495
|
}
|
|
38496
|
-
function
|
|
38497
|
-
if (position ===
|
|
38498
|
-
return scope2.children.select(
|
|
38496
|
+
function resolve6(scope2, position = 0) {
|
|
38497
|
+
if (position === path13.length - 1) {
|
|
38498
|
+
return scope2.children.select(path13[position], tag3);
|
|
38499
38499
|
}
|
|
38500
|
-
for (const subscope of scope2.children.selectAll(
|
|
38501
|
-
const result =
|
|
38500
|
+
for (const subscope of scope2.children.selectAll(path13[position])) {
|
|
38501
|
+
const result = resolve6(subscope, position + 1);
|
|
38502
38502
|
if (result) {
|
|
38503
38503
|
return result;
|
|
38504
38504
|
}
|
|
38505
38505
|
}
|
|
38506
|
-
if (position === 0 && scope2.tag === ElementTag.Matter &&
|
|
38507
|
-
const result =
|
|
38506
|
+
if (position === 0 && scope2.tag === ElementTag.Matter && path13[0] === "Matter") {
|
|
38507
|
+
const result = resolve6(scope2, position + 1);
|
|
38508
38508
|
if (result) {
|
|
38509
38509
|
return result;
|
|
38510
38510
|
}
|
|
@@ -38513,7 +38513,7 @@ var init_ModelTraversal = __esm({
|
|
|
38513
38513
|
return this.operation(() => {
|
|
38514
38514
|
const queue = Array(scope);
|
|
38515
38515
|
for (scope = queue.shift(); scope; scope = queue.shift()) {
|
|
38516
|
-
const resolved =
|
|
38516
|
+
const resolved = resolve6(scope);
|
|
38517
38517
|
if (resolved) {
|
|
38518
38518
|
return resolved;
|
|
38519
38519
|
}
|
|
@@ -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: path13, schema: schema6, payload, dataVersion } = attributeData;
|
|
91494
91494
|
return TlvAttributeReport.encodeTlv({
|
|
91495
|
-
attributeData: { path:
|
|
91495
|
+
attributeData: { path: path13, 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: path13,
|
|
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: path13,
|
|
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: path13, 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: { ...path13, 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: { ...path13, 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: path13, value: payload, version: dataVersion, tlv: schema6 } = report;
|
|
92078
92078
|
if (schema6 === void 0) {
|
|
92079
|
-
throw new InternalError(`Attribute ${
|
|
92079
|
+
throw new InternalError(`Attribute ${path13.clusterId}/${path13.attributeId} not found`);
|
|
92080
92080
|
}
|
|
92081
92081
|
const data = {
|
|
92082
92082
|
attributeData: {
|
|
92083
|
-
path:
|
|
92083
|
+
path: path13,
|
|
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: path13, status: status3, clusterStatus } = report;
|
|
92095
92095
|
const statusReport = {
|
|
92096
92096
|
attributeStatus: {
|
|
92097
|
-
path:
|
|
92097
|
+
path: path13,
|
|
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: path13,
|
|
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: path13,
|
|
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: path13, status: status3, clusterStatus } = report;
|
|
92132
92132
|
const statusReport = {
|
|
92133
92133
|
eventStatus: {
|
|
92134
|
-
path:
|
|
92134
|
+
path: path13,
|
|
92135
92135
|
status: { status: status3 }
|
|
92136
92136
|
},
|
|
92137
92137
|
hasFabricSensitiveData: false
|
|
@@ -99181,14 +99181,14 @@ var init_Advertisement = __esm({
|
|
|
99181
99181
|
#sleep;
|
|
99182
99182
|
#cancelReason;
|
|
99183
99183
|
constructor(executor) {
|
|
99184
|
-
let
|
|
99184
|
+
let resolve6, reject;
|
|
99185
99185
|
super((res, rej) => {
|
|
99186
|
-
|
|
99186
|
+
resolve6 = res;
|
|
99187
99187
|
reject = rej;
|
|
99188
99188
|
});
|
|
99189
|
-
executor(this).then(
|
|
99189
|
+
executor(this).then(resolve6, (cause) => {
|
|
99190
99190
|
if (cause instanceof CanceledError) {
|
|
99191
|
-
|
|
99191
|
+
resolve6();
|
|
99192
99192
|
} else {
|
|
99193
99193
|
reject(cause);
|
|
99194
99194
|
}
|
|
@@ -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: path13, data: tlvData } = attributeData;
|
|
101114
|
+
if (path13.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: path13 } = value;
|
|
101140
|
+
if (path13.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 (path13.nodeId === void 0 && lastPath.nodeId !== void 0) path13.nodeId = lastPath.nodeId;
|
|
101143
|
+
if (path13.endpointId === void 0) path13.endpointId = lastPath.endpointId;
|
|
101144
|
+
if (path13.clusterId === void 0) path13.clusterId = lastPath.clusterId;
|
|
101145
|
+
if (path13.attributeId === void 0) path13.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 (path13.endpointId !== void 0 && path13.clusterId !== void 0 && path13.attributeId !== void 0) {
|
|
101149
101149
|
lastPath = {
|
|
101150
|
-
nodeId:
|
|
101151
|
-
endpointId:
|
|
101152
|
-
clusterId:
|
|
101153
|
-
attributeId:
|
|
101150
|
+
nodeId: path13.nodeId,
|
|
101151
|
+
endpointId: path13.endpointId,
|
|
101152
|
+
clusterId: path13.clusterId,
|
|
101153
|
+
attributeId: path13.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(path13));
|
|
101158
101158
|
}
|
|
101159
101159
|
});
|
|
101160
101160
|
return data;
|
|
@@ -101852,11 +101852,11 @@ var init_SustainedSubscription = __esm({
|
|
|
101852
101852
|
if (this.#request.updated) {
|
|
101853
101853
|
request.updated = this.#request.updated.bind(request);
|
|
101854
101854
|
}
|
|
101855
|
-
const closed = new Promise((
|
|
101855
|
+
const closed = new Promise((resolve6) => {
|
|
101856
101856
|
request.closed = () => {
|
|
101857
101857
|
this.#subscription = void 0;
|
|
101858
101858
|
this.subscriptionId = ClientSubscription.NO_SUBSCRIPTION;
|
|
101859
|
-
|
|
101859
|
+
resolve6();
|
|
101860
101860
|
};
|
|
101861
101861
|
});
|
|
101862
101862
|
for (const retry of this.#retries) {
|
|
@@ -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, path13, message, code) {
|
|
103081
|
+
const text = `${prefix} ${path13.path ?? path13}: ${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(path13, message, code) {
|
|
103088
|
+
super("Reading", path13, message, code ?? Status2.UnsupportedRead);
|
|
103089
103089
|
}
|
|
103090
103090
|
};
|
|
103091
103091
|
WriteError = class extends SchemaViolationError {
|
|
103092
|
-
constructor(
|
|
103093
|
-
super("Writing",
|
|
103092
|
+
constructor(path13, message, code) {
|
|
103093
|
+
super("Writing", path13, message, code ?? Status2.UnsupportedWrite);
|
|
103094
103094
|
}
|
|
103095
103095
|
};
|
|
103096
103096
|
InvokeError = class extends SchemaViolationError {
|
|
103097
|
-
constructor(
|
|
103098
|
-
super("Invoking",
|
|
103097
|
+
constructor(path13, message, code) {
|
|
103098
|
+
super("Invoking", path13, message, code ?? Status2.UnsupportedAccess);
|
|
103099
103099
|
}
|
|
103100
103100
|
};
|
|
103101
103101
|
ValidateError = class extends SchemaViolationError {
|
|
103102
|
-
constructor(
|
|
103103
|
-
super("Validating",
|
|
103102
|
+
constructor(path13, message, code) {
|
|
103103
|
+
super("Validating", path13, message, code ?? Status2.InvalidDataType);
|
|
103104
103104
|
}
|
|
103105
103105
|
};
|
|
103106
103106
|
DatatypeError = class extends ValidateError {
|
|
103107
|
-
constructor(
|
|
103107
|
+
constructor(path13, 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(path13, `Value "${str}" is not ${type}`, code);
|
|
103113
103113
|
}
|
|
103114
103114
|
};
|
|
103115
103115
|
ConstraintError = class extends ValidateError {
|
|
103116
|
-
constructor(schema6,
|
|
103117
|
-
super(
|
|
103116
|
+
constructor(schema6, path13, message) {
|
|
103117
|
+
super(path13, `Constraint "${schema6.constraint}": ${message}`, Status2.ConstraintError);
|
|
103118
103118
|
}
|
|
103119
103119
|
};
|
|
103120
103120
|
IntegerRangeError = class extends ValidateError {
|
|
103121
|
-
constructor(
|
|
103122
|
-
super(
|
|
103121
|
+
constructor(path13, message) {
|
|
103122
|
+
super(path13, message, Status2.ConstraintError);
|
|
103123
103123
|
}
|
|
103124
103124
|
};
|
|
103125
103125
|
UnknownEnumValueError = class extends ValidateError {
|
|
103126
|
-
constructor(
|
|
103127
|
-
super(
|
|
103126
|
+
constructor(path13, message) {
|
|
103127
|
+
super(path13, message, Status2.ConstraintError);
|
|
103128
103128
|
}
|
|
103129
103129
|
};
|
|
103130
103130
|
ConformanceError = class extends ValidateError {
|
|
103131
|
-
constructor(schema6,
|
|
103131
|
+
constructor(schema6, path13, 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(path13, `${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(path13) {
|
|
103145
|
+
super("Referencing", path13, "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(path13) {
|
|
103150
|
+
super("Referencing", path13, "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((path13) => resolvePathForSpecifier(path13)).join(", ") : void 0,
|
|
103187
|
+
events: eventRequests?.length ? selectors.filter(({ kind }) => kind === "event").map((path13) => resolvePathForSpecifier(path13)).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(path13) {
|
|
103361
|
+
const { clusterId: clusterId3, attributeId } = path13;
|
|
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: path13, 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 = path13.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, path13.clusterId), "cluster");
|
|
103526
|
+
if ("attributeId" in path13) {
|
|
103527
|
+
base = base.at("state").at(identityOf(cluster2, AttributeModel, path13.attributeId));
|
|
103528
|
+
if (path13.listIndex) {
|
|
103529
|
+
return base.at(path13.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 path13) {
|
|
103534
|
+
return base.at(identityOf(cluster2, CommandModel, path13.commandId));
|
|
103535
103535
|
}
|
|
103536
|
-
if ("eventId" in
|
|
103537
|
-
return base.at("events").at(identityOf(cluster2, EventModel,
|
|
103536
|
+
if ("eventId" in path13) {
|
|
103537
|
+
return base.at("events").at(identityOf(cluster2, EventModel, path13.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: path13, 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 = path13;
|
|
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 path13 = ExpandedPath({ ...attr, kind: "attribute" });
|
|
103655
103655
|
const status3 = new ExpandedStatus(attr);
|
|
103656
|
-
return new PathError({ path:
|
|
103656
|
+
return new PathError({ path: path13, 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 path13 of attributeRequests) {
|
|
104109
|
+
if (path13.endpointId === void 0 || path13.clusterId === void 0 || path13.attributeId === void 0) {
|
|
104110
|
+
this.addWildcard(path13);
|
|
104111
104111
|
} else {
|
|
104112
|
-
this.addConcrete(
|
|
104112
|
+
this.addConcrete(path13);
|
|
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(path13) {
|
|
104154
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId, wildcardPathFlags } = path13;
|
|
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, path13);
|
|
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, path13);
|
|
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(path13) {
|
|
104186
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } = path13;
|
|
104187
104187
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
104188
|
-
this.addStatus(
|
|
104188
|
+
this.addStatus(path13, 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(path13.clusterId, [ElementTag.Cluster])?.member(path13.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(path13, Status2.UnsupportedAccess);
|
|
104220
104220
|
return;
|
|
104221
104221
|
case AccessControl4.Authority.Restricted:
|
|
104222
|
-
this.addStatus(
|
|
104222
|
+
this.addStatus(path13, 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(path13, Status2.UnsupportedEndpoint);
|
|
104230
104230
|
return;
|
|
104231
104231
|
}
|
|
104232
104232
|
if (cluster2 === void 0) {
|
|
104233
|
-
this.addStatus(
|
|
104233
|
+
this.addStatus(path13, Status2.UnsupportedCluster);
|
|
104234
104234
|
return;
|
|
104235
104235
|
}
|
|
104236
104236
|
if (attribute2 === void 0 || !cluster2.type.attributes[attribute2.id]) {
|
|
104237
|
-
this.addStatus(
|
|
104237
|
+
this.addStatus(path13, Status2.UnsupportedAttribute);
|
|
104238
104238
|
return;
|
|
104239
104239
|
}
|
|
104240
104240
|
if (!limits.readable) {
|
|
104241
|
-
this.addStatus(
|
|
104241
|
+
this.addStatus(path13, Status2.UnsupportedRead);
|
|
104242
104242
|
return;
|
|
104243
104243
|
}
|
|
104244
|
-
const skipVersion = this.#versions?.[
|
|
104244
|
+
const skipVersion = this.#versions?.[path13.endpointId]?.[path13.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(path13)}=${serialize(value)} (version=${version})`
|
|
104268
104268
|
);
|
|
104269
|
-
this.#addValue(
|
|
104269
|
+
this.#addValue(path13, 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, path13) {
|
|
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 } = path13;
|
|
104295
104295
|
if (clusterId3 === void 0) {
|
|
104296
104296
|
for (const cluster2 of endpoint) {
|
|
104297
|
-
this.readClusterForWildcard(cluster2,
|
|
104297
|
+
this.readClusterForWildcard(cluster2, path13);
|
|
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, path13);
|
|
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, path13) {
|
|
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 } = path13;
|
|
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, path13);
|
|
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, path13);
|
|
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, path13) {
|
|
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(path13)} defined and enabled but has no value.`);
|
|
104368
104368
|
return;
|
|
104369
104369
|
}
|
|
104370
104370
|
this.#addValue(
|
|
104371
104371
|
{
|
|
104372
|
-
...
|
|
104372
|
+
...path13,
|
|
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(path13, status3) {
|
|
104403
104403
|
logger55.debug(
|
|
104404
|
-
() => `Error reading attribute ${this.node.inspectPath(
|
|
104404
|
+
() => `Error reading attribute ${this.node.inspectPath(path13)}: Status=${StatusCode[status3]}(${status3})`
|
|
104405
104405
|
);
|
|
104406
104406
|
const report = {
|
|
104407
104407
|
kind: "attr-status",
|
|
104408
|
-
path:
|
|
104408
|
+
path: path13,
|
|
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(path13, value, version, tlv) {
|
|
104418
104418
|
const report = {
|
|
104419
104419
|
kind: "attr-value",
|
|
104420
|
-
path:
|
|
104420
|
+
path: path13,
|
|
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(path13) {
|
|
104464
|
+
const { endpointId, clusterId: clusterId3, attributeId } = path13;
|
|
104465
104465
|
if (this.#dirty[endpointId]?.[clusterId3]?.has(attributeId) === void 0) {
|
|
104466
104466
|
return;
|
|
104467
104467
|
}
|
|
104468
|
-
super.addConcrete(
|
|
104468
|
+
super.addConcrete(path13);
|
|
104469
104469
|
}
|
|
104470
|
-
*readEndpointForWildcard(endpoint,
|
|
104470
|
+
*readEndpointForWildcard(endpoint, path13) {
|
|
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, path13);
|
|
104476
104476
|
}
|
|
104477
|
-
readClusterForWildcard(cluster2,
|
|
104477
|
+
readClusterForWildcard(cluster2, path13) {
|
|
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, path13);
|
|
104483
104483
|
}
|
|
104484
|
-
readAttributeForWildcard(attribute2,
|
|
104484
|
+
readAttributeForWildcard(attribute2, path13) {
|
|
104485
104485
|
if (!this.currentClusterDirty.has(attribute2.id)) {
|
|
104486
104486
|
return;
|
|
104487
104487
|
}
|
|
104488
|
-
super.readAttributeForWildcard(attribute2,
|
|
104488
|
+
super.readAttributeForWildcard(attribute2, path13);
|
|
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: path13, data, dataVersion } of writeRequests) {
|
|
104572
|
+
if (path13.endpointId === void 0 || path13.clusterId === void 0 || path13.attributeId === void 0) {
|
|
104573
|
+
const responses = await this.#processWildcard(path13, 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(path13, 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(path13, value) {
|
|
104621
|
+
const { nodeId: nodeId3, endpointId } = path13;
|
|
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, path13, 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, path13, 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(path13, value, version) {
|
|
104666
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, attributeId } = path13;
|
|
104667
104667
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
104668
|
-
return this.#asStatus(
|
|
104668
|
+
return this.#asStatus(path13, 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(path13.clusterId, [ElementTag.Cluster])?.member(path13.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(path13, Status2.UnsupportedAccess);
|
|
104699
104699
|
case AccessControl4.Authority.Restricted:
|
|
104700
|
-
return this.#asStatus(
|
|
104700
|
+
return this.#asStatus(path13, 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(path13, Status2.UnsupportedEndpoint);
|
|
104707
104707
|
}
|
|
104708
104708
|
if (cluster2 === void 0) {
|
|
104709
|
-
return this.#asStatus(
|
|
104709
|
+
return this.#asStatus(path13, Status2.UnsupportedCluster);
|
|
104710
104710
|
}
|
|
104711
104711
|
if (attribute2 === void 0 || !cluster2.type.attributes[attribute2.id]) {
|
|
104712
|
-
return this.#asStatus(
|
|
104712
|
+
return this.#asStatus(path13, Status2.UnsupportedAttribute);
|
|
104713
104713
|
}
|
|
104714
104714
|
if (!limits.writable) {
|
|
104715
104715
|
this.#errorCount++;
|
|
104716
|
-
return this.#asStatus(
|
|
104716
|
+
return this.#asStatus(path13, 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(path13, Status2.NeedsTimedInteraction);
|
|
104722
104722
|
}
|
|
104723
104723
|
if (limits.fabricScoped && !this.session.fabric) {
|
|
104724
104724
|
this.#errorCount++;
|
|
104725
|
-
return this.#asStatus(
|
|
104725
|
+
return this.#asStatus(path13, 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(path13, 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, path13, 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, path13, value) {
|
|
104749
|
+
const { clusterId: clusterId3, attributeId } = path13;
|
|
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, path13, 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, path13, value) {
|
|
104773
104773
|
if (this.#currentCluster !== cluster2) {
|
|
104774
104774
|
this.#currentCluster = cluster2;
|
|
104775
104775
|
}
|
|
104776
|
-
const { attributeId } =
|
|
104776
|
+
const { attributeId } = path13;
|
|
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, path13, 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, path13, 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
|
+
...path13,
|
|
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(path13, 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(path13)}: 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: path13,
|
|
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, path13, value) {
|
|
104838
|
+
const { attributeId, listIndex } = path13;
|
|
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(path13)}=${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(path13)} 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(path13, error.code, error.clusterCode);
|
|
104873
104873
|
}
|
|
104874
104874
|
throw error;
|
|
104875
104875
|
}
|
|
104876
104876
|
this.#successCount++;
|
|
104877
|
-
return this.#asStatus(
|
|
104877
|
+
return this.#asStatus(path13, 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: path13, commandFields, commandRef } = command;
|
|
104976
|
+
if (path13.endpointId === void 0 || path13.clusterId === void 0 || path13.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(path13, 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(path13, 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(path13, commandRef, commandFields) {
|
|
105026
|
+
const { clusterId: clusterId3, endpointId, commandId: commandId3 } = path13;
|
|
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, path13, 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(path13, commandRef, commandFields) {
|
|
105062
|
+
const { endpointId, clusterId: clusterId3, commandId: commandId3 } = path13;
|
|
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(path13)} 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(path13.clusterId, [ElementTag.Cluster])?.member(path13.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(path13, commandRef, Status2.UnsupportedAccess);
|
|
105109
105109
|
case AccessControl4.Authority.Restricted:
|
|
105110
|
-
return this.#addStatus(
|
|
105110
|
+
return this.#addStatus(path13, 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(path13, commandRef, Status2.UnsupportedEndpoint);
|
|
105117
105117
|
}
|
|
105118
105118
|
if (cluster2 === void 0) {
|
|
105119
|
-
return this.#addStatus(
|
|
105119
|
+
return this.#addStatus(path13, commandRef, Status2.UnsupportedCluster);
|
|
105120
105120
|
}
|
|
105121
105121
|
if (command === void 0 || !cluster2.type.commands[command.id]) {
|
|
105122
|
-
return this.#addStatus(
|
|
105122
|
+
return this.#addStatus(path13, 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(path13, 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(path13, 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(path13, 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, path13, 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, path13, commandRef, commandFields) {
|
|
105158
|
+
const { clusterId: clusterId3 } = path13;
|
|
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 } = path13;
|
|
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
|
+
...path13,
|
|
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(path13, 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(path13)}: Status=${StatusCode[status3]}(${status3}), ClusterStatus=${clusterStatus}`
|
|
105223
105223
|
);
|
|
105224
105224
|
}
|
|
105225
105225
|
const response = {
|
|
105226
105226
|
kind: "cmd-status",
|
|
105227
|
-
path:
|
|
105227
|
+
path: path13,
|
|
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, path13, 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(path13, commandRef, StatusCode.Success);
|
|
105248
105248
|
} else {
|
|
105249
105249
|
this.#addResponse({
|
|
105250
105250
|
kind: "cmd-response",
|
|
105251
105251
|
path: {
|
|
105252
|
-
...
|
|
105252
|
+
...path13,
|
|
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(path13, 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 path13 of eventRequests) {
|
|
105342
|
+
if (path13.endpointId === void 0 || path13.clusterId === void 0 || path13.eventId === void 0) {
|
|
105343
|
+
this.#addWildcard(path13);
|
|
105344
105344
|
} else {
|
|
105345
|
-
const status3 = this.#addConcrete(
|
|
105345
|
+
const status3 = this.#addConcrete(path13);
|
|
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(path13) {
|
|
105382
|
+
const { nodeId: nodeId3, clusterId: clusterId3, endpointId, eventId: eventId3 } = path13;
|
|
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, path13);
|
|
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, path13);
|
|
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(path13) {
|
|
105404
|
+
const { nodeId: nodeId3, endpointId, clusterId: clusterId3, eventId: eventId3 } = path13;
|
|
105405
105405
|
if (nodeId3 !== void 0 && this.nodeId !== nodeId3) {
|
|
105406
|
-
return this.#asStatus(
|
|
105406
|
+
return this.#asStatus(path13, 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(path13.clusterId, [ElementTag.Cluster])?.member(path13.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(path13, Status2.UnsupportedAccess);
|
|
105437
105437
|
case AccessControl4.Authority.Restricted:
|
|
105438
|
-
return this.#asStatus(
|
|
105438
|
+
return this.#asStatus(path13, 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(path13, Status2.UnsupportedEndpoint);
|
|
105445
105445
|
}
|
|
105446
105446
|
if (cluster2 === void 0) {
|
|
105447
|
-
return this.#asStatus(
|
|
105447
|
+
return this.#asStatus(path13, Status2.UnsupportedCluster);
|
|
105448
105448
|
}
|
|
105449
105449
|
if (event3 === void 0 || !cluster2.type.events[event3.id]) {
|
|
105450
|
-
return this.#asStatus(
|
|
105450
|
+
return this.#asStatus(path13, 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(path13);
|
|
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, path13) {
|
|
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 } = path13;
|
|
105474
105474
|
if (clusterId3 === void 0) {
|
|
105475
105475
|
for (const cluster2 of endpoint) {
|
|
105476
|
-
this.#addClusterForWildcard(cluster2, { ...
|
|
105476
|
+
this.#addClusterForWildcard(cluster2, { ...path13, 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, { ...path13, 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, path13) {
|
|
105493
105493
|
if (this.#currentCluster !== cluster2) {
|
|
105494
105494
|
this.#currentCluster = cluster2;
|
|
105495
105495
|
}
|
|
105496
|
-
const { eventId: eventId3 } =
|
|
105496
|
+
const { eventId: eventId3 } = path13;
|
|
105497
105497
|
if (eventId3 === void 0) {
|
|
105498
105498
|
for (const event3 of cluster2.type.events) {
|
|
105499
105499
|
this.#addEventForWildcard(event3, {
|
|
105500
|
-
...
|
|
105500
|
+
...path13,
|
|
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
|
+
...path13,
|
|
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, path13) {
|
|
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({ ...path13, eventId: event3.id });
|
|
105527
105527
|
}
|
|
105528
|
-
#createEventKey(
|
|
105529
|
-
const { endpointId, clusterId: clusterId3, eventId: eventId3 } =
|
|
105528
|
+
#createEventKey(path13) {
|
|
105529
|
+
const { endpointId, clusterId: clusterId3, eventId: eventId3 } = path13;
|
|
105530
105530
|
return `${endpointId}:${clusterId3}:${eventId3}`;
|
|
105531
105531
|
}
|
|
105532
|
-
#registerEventPath(
|
|
105533
|
-
const { eventId: eventId3 } =
|
|
105532
|
+
#registerEventPath(path13) {
|
|
105533
|
+
const { eventId: eventId3 } = path13;
|
|
105534
105534
|
this.#allowedEventPaths.set(
|
|
105535
105535
|
this.#createEventKey({
|
|
105536
|
-
...
|
|
105536
|
+
...path13,
|
|
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(path13, status3) {
|
|
105567
|
+
logger58.debug(`Error reading event ${this.node.inspectPath(path13)}: Status=${StatusCode[status3]}(${status3})`);
|
|
105568
105568
|
const report = {
|
|
105569
105569
|
kind: "event-status",
|
|
105570
|
-
path:
|
|
105570
|
+
path: path13,
|
|
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(path13, error, options) {
|
|
109227
|
+
super(`Error fetching ${path13} 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(path13, 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 ? `${path13}${path13.includes("?") ? "&" : "?"}pagination.key=${encodeURIComponent(nextKey)}` : path13;
|
|
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(path13, options) {
|
|
109252
|
+
const url2 = new URL(path13, 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(path13, 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
|
+
path13,
|
|
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 path13 = `/dcl/pki/certificates/${encodeURIComponent(subject.subject)}/${encodeURIComponent(subject.subjectKeyId)}`;
|
|
109291
|
+
const response = await this.#fetchJson(path13, 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 path13 = `/dcl/model/models/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}`;
|
|
109301
|
+
const response = await this.#fetchJson(path13, 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 path13 = `/dcl/model/versions/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}`;
|
|
109309
|
+
const response = await this.#fetchJson(path13, 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 path13 = `/dcl/model/versions/${encodeURIComponent(vid)}/${encodeURIComponent(pid)}/${encodeURIComponent(softwareVersion)}`;
|
|
109317
|
+
const response = await this.#fetchJson(path13, 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, path13) {
|
|
116105
116105
|
if (Number.isFinite(value)) {
|
|
116106
116106
|
return;
|
|
116107
116107
|
}
|
|
116108
|
-
throw new DatatypeError(
|
|
116108
|
+
throw new DatatypeError(path13, "a number", value);
|
|
116109
116109
|
}
|
|
116110
|
-
function assertBoolean(value,
|
|
116110
|
+
function assertBoolean(value, path13) {
|
|
116111
116111
|
if (typeof value === "boolean" || value === 0 || value === 1) {
|
|
116112
116112
|
return;
|
|
116113
116113
|
}
|
|
116114
|
-
throw new DatatypeError(
|
|
116114
|
+
throw new DatatypeError(path13, "a boolean", value);
|
|
116115
116115
|
}
|
|
116116
|
-
function assertObject(value,
|
|
116116
|
+
function assertObject(value, path13) {
|
|
116117
116117
|
if (isObject(value)) {
|
|
116118
116118
|
return;
|
|
116119
116119
|
}
|
|
116120
|
-
throw new DatatypeError(
|
|
116120
|
+
throw new DatatypeError(path13, "an object", value);
|
|
116121
116121
|
}
|
|
116122
|
-
function assertNumeric(value,
|
|
116122
|
+
function assertNumeric(value, path13) {
|
|
116123
116123
|
if (typeof value === "number" || typeof value === "bigint") {
|
|
116124
116124
|
return;
|
|
116125
116125
|
}
|
|
116126
|
-
throw new DatatypeError(
|
|
116126
|
+
throw new DatatypeError(path13, "a number or bigint", value);
|
|
116127
116127
|
}
|
|
116128
|
-
function assertString(value,
|
|
116128
|
+
function assertString(value, path13) {
|
|
116129
116129
|
if (typeof value === "string") {
|
|
116130
116130
|
return;
|
|
116131
116131
|
}
|
|
116132
|
-
throw new DatatypeError(
|
|
116132
|
+
throw new DatatypeError(path13, "a string", value);
|
|
116133
116133
|
}
|
|
116134
|
-
function assertBytes(value,
|
|
116134
|
+
function assertBytes(value, path13) {
|
|
116135
116135
|
if (Bytes.isBytes(value)) {
|
|
116136
116136
|
return;
|
|
116137
116137
|
}
|
|
116138
|
-
throw new DatatypeError(
|
|
116138
|
+
throw new DatatypeError(path13, "a byte array", value);
|
|
116139
116139
|
}
|
|
116140
|
-
function assertSequence(value,
|
|
116140
|
+
function assertSequence(value, path13) {
|
|
116141
116141
|
if (typeof value === "string" || Bytes.isBytes(value)) {
|
|
116142
116142
|
return;
|
|
116143
116143
|
}
|
|
116144
|
-
throw new DatatypeError(
|
|
116144
|
+
throw new DatatypeError(path13, "a string or byte array", value);
|
|
116145
116145
|
}
|
|
116146
|
-
function assertArray(value,
|
|
116146
|
+
function assertArray(value, path13) {
|
|
116147
116147
|
if (!Array.isArray(value)) {
|
|
116148
|
-
throw new DatatypeError(
|
|
116148
|
+
throw new DatatypeError(path13, "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, path13) {
|
|
116159
|
+
assertNumeric(value, path13);
|
|
116160
116160
|
if (value < min) {
|
|
116161
|
-
throw new IntegerRangeError(
|
|
116161
|
+
throw new IntegerRangeError(path13, `Value ${value} is below the ${name} minimum of ${min}`);
|
|
116162
116162
|
}
|
|
116163
116163
|
if (value > max) {
|
|
116164
|
-
throw new IntegerRangeError(
|
|
116164
|
+
throw new IntegerRangeError(path13, `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, path13) => {
|
|
117270
117270
|
if (typeof changes !== "object" || changes === null || Array.isArray(changes)) {
|
|
117271
|
-
throw new WriteError(
|
|
117271
|
+
throw new WriteError(path13, `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(path13, `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(path13, `${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, [], path13.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] }, path13.at(key));
|
|
117298
117298
|
target[key] = newValue;
|
|
117299
117299
|
continue;
|
|
117300
117300
|
}
|
|
117301
|
-
subpatch(newValue, target[key],
|
|
117301
|
+
subpatch(newValue, target[key], path13.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, path13) => {
|
|
117321
117321
|
if (typeof changes !== "object" || changes === null) {
|
|
117322
|
-
throw new WriteError(
|
|
117322
|
+
throw new WriteError(path13, `patch definition ${changes} is not an object`);
|
|
117323
117323
|
}
|
|
117324
117324
|
if (!Array.isArray(target)) {
|
|
117325
|
-
throw new WriteError(
|
|
117325
|
+
throw new WriteError(path13, `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(path13, `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 }, path13.at(index));
|
|
117338
117338
|
}
|
|
117339
117339
|
target[index] = newValue;
|
|
117340
117340
|
} else {
|
|
117341
|
-
patchEntry(newValue, target[index],
|
|
117341
|
+
patchEntry(newValue, target[index], path13.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, path13) => {
|
|
117355
|
+
throw new ImplementationError(`Cannot generate patch ${path13} 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: path13, endpoint } = backing;
|
|
121505
121505
|
const context = session;
|
|
121506
121506
|
logger93.info(
|
|
121507
121507
|
"Invoke",
|
|
121508
121508
|
Mark.INBOUND,
|
|
121509
|
-
Diagnostic.strong(`${
|
|
121509
|
+
Diagnostic.strong(`${path13.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(`${path13.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(`${path13.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, path13) {
|
|
121573
|
+
const { endpointId, clusterId: clusterId3 } = path13;
|
|
121574
|
+
const isUrgentString = "isUrgent" in path13 && path13.isUrgent ? "!" : "";
|
|
121575
|
+
const listIndexString = "listIndex" in path13 && path13.listIndex === null ? "[ADD]" : "";
|
|
121576
121576
|
const postString = `${listIndexString}${isUrgentString}`;
|
|
121577
|
-
const elementId = "attributeId" in
|
|
121577
|
+
const elementId = "attributeId" in path13 ? path13.attributeId : "eventId" in path13 ? path13.eventId : "commandId" in path13 ? path13.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, path12) {
|
|
|
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 path13) {
|
|
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 path13) {
|
|
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 path13) {
|
|
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(path13) {
|
|
121703
|
+
return resolvePathForNode(this, path13);
|
|
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(path13, 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 } = path13;
|
|
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(path12, isGroupSession = false) {
|
|
|
124183
124183
|
}
|
|
124184
124184
|
}
|
|
124185
124185
|
}
|
|
124186
|
-
function validateReadEventPath(
|
|
124187
|
-
const { clusterId: clusterId3, eventId: eventId3 } =
|
|
124186
|
+
function validateReadEventPath(path13, isGroupSession = false) {
|
|
124187
|
+
const { clusterId: clusterId3, eventId: eventId3 } = path13;
|
|
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((path13) => this.#node.protocol.inspectPath(path13)).join(", ") ?? "none"}${dataVersionFilters?.length ? ` with ${dataVersionFilters?.length} filters` : ""}`,
|
|
124370
|
+
events: `${eventRequests?.map((path13) => this.#node.protocol.inspectPath(path13)).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: path13 } = request;
|
|
124480
|
+
const listIndex = path13.listIndex;
|
|
124481
124481
|
if (listIndex === null) {
|
|
124482
|
-
if (previousProcessedAttributePath?.endpointId !==
|
|
124482
|
+
if (previousProcessedAttributePath?.endpointId !== path13.endpointId || previousProcessedAttributePath?.clusterId !== path13.clusterId || previousProcessedAttributePath?.attributeId !== path13.attributeId) {
|
|
124483
124483
|
await processBatch();
|
|
124484
124484
|
allResponses.push({
|
|
124485
124485
|
kind: "attr-status",
|
|
124486
|
-
path:
|
|
124486
|
+
path: path13,
|
|
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 (path13.endpointId !== void 0 && path13.clusterId !== void 0 && path13.attributeId !== void 0) {
|
|
124494
|
+
previousProcessedAttributePath = path13;
|
|
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: path13, status: status3, clusterStatus }) => ({
|
|
124503
|
+
path: path13,
|
|
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((path13) => this.#node.protocol.inspectPath(path13)).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((path13) => this.#node.protocol.inspectPath(path13)).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((path13) => validateReadAttributesPath(path13));
|
|
124602
|
+
eventRequests?.forEach((path13) => validateReadEventPath(path13));
|
|
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: path13, commandRef, status: status3, clusterStatus } = data;
|
|
124885
124885
|
await sendChunkIfNeeded({
|
|
124886
|
-
status: { commandPath:
|
|
124886
|
+
status: { commandPath: path13, status: { status: status3, clusterStatus }, commandRef }
|
|
124887
124887
|
});
|
|
124888
124888
|
break;
|
|
124889
124889
|
}
|
|
@@ -134597,15 +134597,15 @@ var init_Discovery = __esm({
|
|
|
134597
134597
|
#settled;
|
|
134598
134598
|
#resolveSettled;
|
|
134599
134599
|
constructor(owner, options) {
|
|
134600
|
-
let
|
|
134600
|
+
let resolve6, reject;
|
|
134601
134601
|
super((resolver, rejecter) => {
|
|
134602
|
-
|
|
134602
|
+
resolve6 = resolver;
|
|
134603
134603
|
reject = rejecter;
|
|
134604
134604
|
});
|
|
134605
134605
|
this.#resolve = (result) => {
|
|
134606
134606
|
this.#isStopped = true;
|
|
134607
134607
|
this.#owner.env.get(ActiveDiscoveries).delete(this);
|
|
134608
|
-
|
|
134608
|
+
resolve6(result);
|
|
134609
134609
|
this.#resolveSettled?.();
|
|
134610
134610
|
};
|
|
134611
134611
|
this.#reject = (cause) => {
|
|
@@ -134621,7 +134621,7 @@ var init_Discovery = __esm({
|
|
|
134621
134621
|
}
|
|
134622
134622
|
get settled() {
|
|
134623
134623
|
if (this.#settled === void 0) {
|
|
134624
|
-
this.#settled = new Promise((
|
|
134624
|
+
this.#settled = new Promise((resolve6) => this.#resolveSettled = resolve6);
|
|
134625
134625
|
}
|
|
134626
134626
|
return this.#settled;
|
|
134627
134627
|
}
|
|
@@ -134724,7 +134724,7 @@ var init_Discovery = __esm({
|
|
|
134724
134724
|
const scanners = this.#owner.env.get(ScannerSet);
|
|
134725
134725
|
const factory = this.#owner.env.get(ClientNodeFactory);
|
|
134726
134726
|
const promises = new Array();
|
|
134727
|
-
const cancelSignal = new Promise((
|
|
134727
|
+
const cancelSignal = new Promise((resolve6) => this.#stopDiscovery = resolve6);
|
|
134728
134728
|
for (const scanner of scanners) {
|
|
134729
134729
|
promises.push(
|
|
134730
134730
|
scanner.findCommissionableDevicesContinuously(
|
|
@@ -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(path13) {
|
|
134970
|
+
if (path13 instanceof URL) {
|
|
134971
|
+
path13 = path13.pathname;
|
|
134972
134972
|
}
|
|
134973
|
-
if (!Array.isArray(
|
|
134974
|
-
|
|
134973
|
+
if (!Array.isArray(path13)) {
|
|
134974
|
+
path13 = path13.split("/").map(decodeURIComponent);
|
|
134975
134975
|
}
|
|
134976
|
-
for (const segment of
|
|
134976
|
+
for (const segment of path13) {
|
|
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(path13) {
|
|
134997
134997
|
if (this.isEmpty) {
|
|
134998
|
-
return new _ApiPath(
|
|
134998
|
+
return new _ApiPath(path13);
|
|
134999
134999
|
}
|
|
135000
|
-
if (
|
|
135001
|
-
|
|
135000
|
+
if (path13 instanceof URL) {
|
|
135001
|
+
path13 = path13.pathname;
|
|
135002
135002
|
}
|
|
135003
|
-
if (Array.isArray(
|
|
135004
|
-
|
|
135003
|
+
if (Array.isArray(path13)) {
|
|
135004
|
+
path13 = path13.map(encodeURIComponent).join("/");
|
|
135005
135005
|
}
|
|
135006
|
-
if (
|
|
135007
|
-
return new _ApiPath(
|
|
135006
|
+
if (path13.startsWith("/")) {
|
|
135007
|
+
return new _ApiPath(path13);
|
|
135008
135008
|
}
|
|
135009
|
-
return new _ApiPath(`${this.toString()}/${
|
|
135009
|
+
return new _ApiPath(`${this.toString()}/${path13}`);
|
|
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(path13) {
|
|
135095
|
+
if (!path13) {
|
|
135096
|
+
path13 = 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: path13 });
|
|
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, path13) {
|
|
135340
135340
|
super(parent);
|
|
135341
135341
|
this.id = id;
|
|
135342
135342
|
this.supervisor = supervisor;
|
|
135343
|
-
this.dataModelPath =
|
|
135343
|
+
this.dataModelPath = path13;
|
|
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, path13) {
|
|
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 path13) {
|
|
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 path13 = this.root.subpathFor(new ApiPath(address));
|
|
136405
|
+
if (!path13) {
|
|
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, path13);
|
|
136410
136410
|
if (resource === void 0) {
|
|
136411
136411
|
throw new StatusResponse.NotFoundError(`Path "${address.pathname}" not found`);
|
|
136412
136412
|
}
|
|
@@ -136609,7 +136609,7 @@ var init_Reactors = __esm({
|
|
|
136609
136609
|
await reactor.close();
|
|
136610
136610
|
}
|
|
136611
136611
|
if (this.#backings.size) {
|
|
136612
|
-
return new Promise((
|
|
136612
|
+
return new Promise((resolve6) => this.#destructionComplete = resolve6);
|
|
136613
136613
|
}
|
|
136614
136614
|
}
|
|
136615
136615
|
add(observable, reactor, options) {
|
|
@@ -136681,9 +136681,9 @@ var init_Reactors = __esm({
|
|
|
136681
136681
|
this.#nodeActivity = this.#endpoint.env.get(NodeActivity);
|
|
136682
136682
|
}
|
|
136683
136683
|
this.#activity = this.#nodeActivity.begin(this.toString());
|
|
136684
|
-
this.#trampoline = new Promise((
|
|
136684
|
+
this.#trampoline = new Promise((resolve6) => {
|
|
136685
136685
|
this.#resolveTrampoline = () => {
|
|
136686
|
-
|
|
136686
|
+
resolve6();
|
|
136687
136687
|
this.#trampoline = void 0;
|
|
136688
136688
|
};
|
|
136689
136689
|
});
|
|
@@ -136817,11 +136817,11 @@ var init_Reactors = __esm({
|
|
|
136817
136817
|
* regardless of the emitter and listener because by necessity they do not act immediately.
|
|
136818
136818
|
*/
|
|
136819
136819
|
#reactDeferred(args) {
|
|
136820
|
-
return new Promise((
|
|
136820
|
+
return new Promise((resolve6, reject) => {
|
|
136821
136821
|
const deferredReaction = async () => {
|
|
136822
136822
|
try {
|
|
136823
136823
|
const result = await this.#react(args);
|
|
136824
|
-
|
|
136824
|
+
resolve6(result);
|
|
136825
136825
|
} catch (e) {
|
|
136826
136826
|
reject(asError(e));
|
|
136827
136827
|
}
|
|
@@ -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 path13 = new ApiPath(address).toString();
|
|
138204
|
+
if (path13 !== 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(path13) {
|
|
138884
|
+
return import(path13);
|
|
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, path13) {
|
|
138893
|
+
const cachedResult = cache5[path13];
|
|
138894
138894
|
if (cachedResult) {
|
|
138895
138895
|
return cachedResult;
|
|
138896
138896
|
}
|
|
@@ -138901,7 +138901,7 @@ function doLoad(description, exportName, path12) {
|
|
|
138901
138901
|
failure();
|
|
138902
138902
|
}
|
|
138903
138903
|
try {
|
|
138904
|
-
const module = load(
|
|
138904
|
+
const module = load(path13);
|
|
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 path13 = decodeURIComponent(address.hostname);
|
|
143439
143439
|
if (options.basePathForUnixSockets) {
|
|
143440
|
-
opts.path = resolve(options.basePathForUnixSockets, normalize(
|
|
143440
|
+
opts.path = resolve(options.basePathForUnixSockets, normalize(path13));
|
|
143441
143441
|
} else {
|
|
143442
|
-
opts.path = normalize(
|
|
143442
|
+
opts.path = normalize(path13);
|
|
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(path13, clear = false) {
|
|
143647
143647
|
super();
|
|
143648
|
-
this.#path =
|
|
143648
|
+
this.#path = path13;
|
|
143649
143649
|
this.#clear = clear;
|
|
143650
143650
|
}
|
|
143651
143651
|
get initialized() {
|
|
@@ -143799,7 +143799,7 @@ var init_StorageBackendDisk = __esm({
|
|
|
143799
143799
|
const { value: chunk, done } = await reader.read();
|
|
143800
143800
|
if (chunk) {
|
|
143801
143801
|
if (!writer.write(chunk)) {
|
|
143802
|
-
await new Promise((
|
|
143802
|
+
await new Promise((resolve6) => writer.once("drain", resolve6));
|
|
143803
143803
|
}
|
|
143804
143804
|
}
|
|
143805
143805
|
if (done) {
|
|
@@ -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(path13) {
|
|
143912
143912
|
super();
|
|
143913
|
-
this.path =
|
|
143913
|
+
this.path = path13;
|
|
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(path13) {
|
|
143926
|
+
const storage2 = new this(path13);
|
|
143927
143927
|
storage2.initialize();
|
|
143928
143928
|
return storage2;
|
|
143929
143929
|
}
|
|
@@ -143941,8 +143941,8 @@ var init_StorageBackendJsonFile = __esm({
|
|
|
143941
143941
|
}
|
|
143942
143942
|
triggerCommit() {
|
|
143943
143943
|
if (!this.commitTimer.isRunning) {
|
|
143944
|
-
this.committed = new Promise((
|
|
143945
|
-
this.resolveCommitted =
|
|
143944
|
+
this.committed = new Promise((resolve6) => {
|
|
143945
|
+
this.resolveCommitted = resolve6;
|
|
143946
143946
|
});
|
|
143947
143947
|
this.commitTimer.start();
|
|
143948
143948
|
}
|
|
@@ -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: path13, tableName, clear } = args;
|
|
144132
|
+
this.dbPath = path13 === null ? _SqliteStorage.memoryPath : path13;
|
|
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(path13, clear = false) {
|
|
144517
144517
|
super({
|
|
144518
144518
|
databaseCreator: (path22) => new DatabaseSync(path22),
|
|
144519
|
-
path:
|
|
144519
|
+
path: path13,
|
|
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(path13, 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: path13,
|
|
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(path13, 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(path13, 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(path13, 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 path13 = getRealPath(type, rootDir, namespace3);
|
|
144642
|
+
if (clear || await exists(path13)) {
|
|
144643
|
+
return await createRawInit(type, path13, clear);
|
|
144644
144644
|
}
|
|
144645
|
-
const storage2 = await createRawInit(type,
|
|
144645
|
+
const storage2 = await createRawInit(type, path13, 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: path13,
|
|
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 path13 = getRealPath(type, rootDir, namespace3);
|
|
144696
|
+
if (!await exists(path13)) {
|
|
144697
144697
|
return;
|
|
144698
144698
|
}
|
|
144699
|
-
await rm3(
|
|
144699
|
+
await rm3(path13, { recursive: true, force: true });
|
|
144700
144700
|
}
|
|
144701
144701
|
StorageFactory2.remove = remove;
|
|
144702
|
-
async function createRaw(type,
|
|
144702
|
+
async function createRaw(type, path13, 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(path13, clear);
|
|
144714
144714
|
}
|
|
144715
144715
|
if (normalizedType === "file") {
|
|
144716
|
-
return new StorageBackendDisk(
|
|
144716
|
+
return new StorageBackendDisk(path13, 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, path13, clear) {
|
|
144721
|
+
const storage2 = await createRaw(type, path13, clear);
|
|
144722
144722
|
await storage2.initialize();
|
|
144723
144723
|
return storage2;
|
|
144724
144724
|
}
|
|
144725
|
-
async function hasStorage(type,
|
|
144725
|
+
async function hasStorage(type, path13) {
|
|
144726
144726
|
try {
|
|
144727
|
-
const pathStat = await lstat(
|
|
144727
|
+
const pathStat = await lstat(path13);
|
|
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(path13) {
|
|
144795
144795
|
try {
|
|
144796
|
-
await lstat(resolve2(
|
|
144796
|
+
await lstat(resolve2(path13));
|
|
144797
144797
|
return true;
|
|
144798
144798
|
} catch (err) {
|
|
144799
144799
|
return false;
|
|
@@ -144816,7 +144816,7 @@ var init_storage4 = __esm({
|
|
|
144816
144816
|
import * as dgram from "node:dgram";
|
|
144817
144817
|
function createDgramSocket(host, port, options) {
|
|
144818
144818
|
const socket = dgram.createSocket(options);
|
|
144819
|
-
return new Promise((
|
|
144819
|
+
return new Promise((resolve6, reject) => {
|
|
144820
144820
|
const handleBindError = (error) => {
|
|
144821
144821
|
try {
|
|
144822
144822
|
socket.close();
|
|
@@ -144850,7 +144850,7 @@ function createDgramSocket(host, port, options) {
|
|
|
144850
144850
|
);
|
|
144851
144851
|
socket.removeListener("error", handleBindError);
|
|
144852
144852
|
socket.on("error", (error) => logger138.error(error));
|
|
144853
|
-
|
|
144853
|
+
resolve6(socket);
|
|
144854
144854
|
});
|
|
144855
144855
|
});
|
|
144856
144856
|
}
|
|
@@ -145103,7 +145103,7 @@ var init_NodeJsUdpChannel = __esm({
|
|
|
145103
145103
|
try {
|
|
145104
145104
|
const _closing = __using38(_stack, this.#lifetime.closing());
|
|
145105
145105
|
try {
|
|
145106
|
-
await new Promise((
|
|
145106
|
+
await new Promise((resolve6) => this.#socket.close(resolve6));
|
|
145107
145107
|
} catch (error) {
|
|
145108
145108
|
if (!(error instanceof Error) || error.message !== "Not running") {
|
|
145109
145109
|
logger138.debug("Error on closing socket", error);
|
|
@@ -145640,11 +145640,11 @@ var init_service = __esm({
|
|
|
145640
145640
|
constructor(serviceName) {
|
|
145641
145641
|
this.serviceName = serviceName;
|
|
145642
145642
|
}
|
|
145643
|
-
construction = new Promise((
|
|
145643
|
+
construction = new Promise((resolve6) => {
|
|
145644
145644
|
setImmediate(() => {
|
|
145645
145645
|
const init = this.initialize?.bind(this) ?? (async () => {
|
|
145646
145646
|
});
|
|
145647
|
-
init().then(
|
|
145647
|
+
init().then(resolve6);
|
|
145648
145648
|
});
|
|
145649
145649
|
});
|
|
145650
145650
|
};
|
|
@@ -146701,12 +146701,6 @@ var init_bridge_config_schema = __esm({
|
|
|
146701
146701
|
type: "boolean",
|
|
146702
146702
|
default: false
|
|
146703
146703
|
},
|
|
146704
|
-
alexaPreserveBrightnessOnTurnOn: {
|
|
146705
|
-
title: "Alexa: Preserve Brightness on Turn-On (Deprecated)",
|
|
146706
|
-
description: "This workaround is now always active and this setting has no effect. The bridge automatically ignores brightness commands that set lights to 100% immediately after a turn-on command.",
|
|
146707
|
-
type: "boolean",
|
|
146708
|
-
default: true
|
|
146709
|
-
},
|
|
146710
146704
|
serverMode: {
|
|
146711
146705
|
title: "Server Mode (for Robot Vacuums)",
|
|
146712
146706
|
description: "Expose the device as a standalone Matter device instead of a bridged device. This is required for Apple Home to properly support Siri voice commands for Robot Vacuums. IMPORTANT: Only ONE device should be in this bridge when server mode is enabled.",
|
|
@@ -146747,12 +146741,6 @@ var init_bridge_config_schema = __esm({
|
|
|
146747
146741
|
title: "Vacuum: Include OnOff Cluster (Alexa)",
|
|
146748
146742
|
description: "Add an OnOff cluster to robot vacuum endpoints. Alexa REQUIRES this (PowerController) to show robotic vacuums in the app. Without it, Alexa commissions the device but never displays it. In Server Mode this is enabled automatically \u2014 only check this for bridge mode. WARNING: OnOff is NOT part of the Matter RVC device type specification. Enabling this may break Apple Home (shows 'Updating') and Google Home.",
|
|
146749
146743
|
type: "boolean"
|
|
146750
|
-
},
|
|
146751
|
-
vacuumMinimalClusters: {
|
|
146752
|
-
title: "Vacuum: Minimal Clusters (Alexa troubleshooting)",
|
|
146753
|
-
description: "Strip the vacuum endpoint to only the clusters required by the Matter RVC spec. Removes PowerSource (battery) and the default ServiceArea placeholder. Enable this if Alexa commissions the vacuum but the device never appears in the app. Trade-off: battery percentage will not be reported to Matter controllers.",
|
|
146754
|
-
type: "boolean",
|
|
146755
|
-
default: false
|
|
146756
146744
|
}
|
|
146757
146745
|
},
|
|
146758
146746
|
additionalProperties: false
|
|
@@ -147154,7 +147142,7 @@ async function withRetry(fn, options = {}) {
|
|
|
147154
147142
|
opts.maxDelayMs
|
|
147155
147143
|
);
|
|
147156
147144
|
opts.onRetry?.(attempt, error, delayMs);
|
|
147157
|
-
await new Promise((
|
|
147145
|
+
await new Promise((resolve6) => setTimeout(resolve6, delayMs));
|
|
147158
147146
|
}
|
|
147159
147147
|
}
|
|
147160
147148
|
throw lastError;
|
|
@@ -147450,7 +147438,7 @@ BigInt.prototype.toJSON = function() {
|
|
|
147450
147438
|
};
|
|
147451
147439
|
|
|
147452
147440
|
// src/cli.ts
|
|
147453
|
-
import * as
|
|
147441
|
+
import * as path12 from "node:path";
|
|
147454
147442
|
import * as url from "node:url";
|
|
147455
147443
|
import yargs from "yargs";
|
|
147456
147444
|
import { hideBin } from "yargs/helpers";
|
|
@@ -149838,6 +149826,7 @@ function metricsApi(bridgeService, haClient, haRegistry, startTime) {
|
|
|
149838
149826
|
}
|
|
149839
149827
|
|
|
149840
149828
|
// src/api/plugin-api.ts
|
|
149829
|
+
import * as nodePath from "node:path";
|
|
149841
149830
|
import express13 from "express";
|
|
149842
149831
|
|
|
149843
149832
|
// src/plugins/plugin-installer.ts
|
|
@@ -149886,7 +149875,7 @@ var PluginInstaller = class {
|
|
|
149886
149875
|
};
|
|
149887
149876
|
}
|
|
149888
149877
|
logger142.info(`Installing plugin: ${packageName}`);
|
|
149889
|
-
return new Promise((
|
|
149878
|
+
return new Promise((resolve6) => {
|
|
149890
149879
|
execFile(
|
|
149891
149880
|
"npm",
|
|
149892
149881
|
["install", packageName, "--save"],
|
|
@@ -149901,7 +149890,7 @@ var PluginInstaller = class {
|
|
|
149901
149890
|
`Failed to install ${packageName}:`,
|
|
149902
149891
|
stderr || error.message
|
|
149903
149892
|
);
|
|
149904
|
-
|
|
149893
|
+
resolve6({
|
|
149905
149894
|
success: false,
|
|
149906
149895
|
packageName,
|
|
149907
149896
|
error: stderr || error.message
|
|
@@ -149912,7 +149901,7 @@ var PluginInstaller = class {
|
|
|
149912
149901
|
logger142.info(
|
|
149913
149902
|
`Successfully installed ${packageName}@${version || "unknown"}`
|
|
149914
149903
|
);
|
|
149915
|
-
|
|
149904
|
+
resolve6({
|
|
149916
149905
|
success: true,
|
|
149917
149906
|
packageName,
|
|
149918
149907
|
version: version ?? void 0
|
|
@@ -149930,7 +149919,7 @@ var PluginInstaller = class {
|
|
|
149930
149919
|
};
|
|
149931
149920
|
}
|
|
149932
149921
|
logger142.info(`Uninstalling plugin: ${packageName}`);
|
|
149933
|
-
return new Promise((
|
|
149922
|
+
return new Promise((resolve6) => {
|
|
149934
149923
|
execFile(
|
|
149935
149924
|
"npm",
|
|
149936
149925
|
["uninstall", packageName, "--save"],
|
|
@@ -149944,7 +149933,7 @@ var PluginInstaller = class {
|
|
|
149944
149933
|
`Failed to uninstall ${packageName}:`,
|
|
149945
149934
|
stderr || error.message
|
|
149946
149935
|
);
|
|
149947
|
-
|
|
149936
|
+
resolve6({
|
|
149948
149937
|
success: false,
|
|
149949
149938
|
packageName,
|
|
149950
149939
|
error: stderr || error.message
|
|
@@ -149952,7 +149941,7 @@ var PluginInstaller = class {
|
|
|
149952
149941
|
return;
|
|
149953
149942
|
}
|
|
149954
149943
|
logger142.info(`Successfully uninstalled ${packageName}`);
|
|
149955
|
-
|
|
149944
|
+
resolve6({ success: true, packageName });
|
|
149956
149945
|
}
|
|
149957
149946
|
);
|
|
149958
149947
|
});
|
|
@@ -149985,7 +149974,20 @@ var PluginInstaller = class {
|
|
|
149985
149974
|
const tgzPath = path4.join(this.pluginDir, `.upload-${Date.now()}.tgz`);
|
|
149986
149975
|
try {
|
|
149987
149976
|
fs4.writeFileSync(tgzPath, tgzBuffer);
|
|
149988
|
-
|
|
149977
|
+
const depsBefore = new Set(Object.keys(this.readDeps()));
|
|
149978
|
+
const result = await this.installFromNpm(tgzPath);
|
|
149979
|
+
if (!result.success) return result;
|
|
149980
|
+
const depsAfter = this.readDeps();
|
|
149981
|
+
for (const name of Object.keys(depsAfter)) {
|
|
149982
|
+
if (!depsBefore.has(name)) {
|
|
149983
|
+
return {
|
|
149984
|
+
success: true,
|
|
149985
|
+
packageName: name,
|
|
149986
|
+
version: this.getInstalledVersion(name) ?? String(depsAfter[name])
|
|
149987
|
+
};
|
|
149988
|
+
}
|
|
149989
|
+
}
|
|
149990
|
+
return result;
|
|
149989
149991
|
} catch (e) {
|
|
149990
149992
|
const msg = e instanceof Error ? e.message : String(e);
|
|
149991
149993
|
logger142.error("Failed to install from tgz:", msg);
|
|
@@ -149998,7 +150000,7 @@ var PluginInstaller = class {
|
|
|
149998
150000
|
}
|
|
149999
150001
|
}
|
|
150000
150002
|
installFromNpm(target) {
|
|
150001
|
-
return new Promise((
|
|
150003
|
+
return new Promise((resolve6) => {
|
|
150002
150004
|
execFile(
|
|
150003
150005
|
"npm",
|
|
150004
150006
|
["install", target, "--save"],
|
|
@@ -150009,24 +150011,31 @@ var PluginInstaller = class {
|
|
|
150009
150011
|
},
|
|
150010
150012
|
(error, _stdout, stderr) => {
|
|
150011
150013
|
if (error) {
|
|
150012
|
-
|
|
150014
|
+
resolve6({
|
|
150013
150015
|
success: false,
|
|
150014
150016
|
packageName: path4.basename(target),
|
|
150015
150017
|
error: stderr || error.message
|
|
150016
150018
|
});
|
|
150017
150019
|
return;
|
|
150018
150020
|
}
|
|
150019
|
-
|
|
150020
|
-
const latest = installed[installed.length - 1];
|
|
150021
|
-
resolve5({
|
|
150021
|
+
resolve6({
|
|
150022
150022
|
success: true,
|
|
150023
|
-
packageName:
|
|
150024
|
-
version: latest?.version
|
|
150023
|
+
packageName: path4.basename(target)
|
|
150025
150024
|
});
|
|
150026
150025
|
}
|
|
150027
150026
|
);
|
|
150028
150027
|
});
|
|
150029
150028
|
}
|
|
150029
|
+
readDeps() {
|
|
150030
|
+
try {
|
|
150031
|
+
const pkgJson = path4.join(this.pluginDir, "package.json");
|
|
150032
|
+
if (!fs4.existsSync(pkgJson)) return {};
|
|
150033
|
+
const pkg = JSON.parse(fs4.readFileSync(pkgJson, "utf-8"));
|
|
150034
|
+
return pkg.dependencies ?? {};
|
|
150035
|
+
} catch {
|
|
150036
|
+
return {};
|
|
150037
|
+
}
|
|
150038
|
+
}
|
|
150030
150039
|
installFromLocal(localPath) {
|
|
150031
150040
|
const resolvedPath = path4.resolve(localPath);
|
|
150032
150041
|
if (!fs4.existsSync(resolvedPath)) {
|
|
@@ -150180,6 +150189,19 @@ var PluginRegistry = class {
|
|
|
150180
150189
|
};
|
|
150181
150190
|
|
|
150182
150191
|
// src/api/plugin-api.ts
|
|
150192
|
+
var MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
|
|
150193
|
+
var BLOCKED_PREFIXES = [
|
|
150194
|
+
"/bin",
|
|
150195
|
+
"/sbin",
|
|
150196
|
+
"/usr",
|
|
150197
|
+
"/etc",
|
|
150198
|
+
"/var",
|
|
150199
|
+
"/sys",
|
|
150200
|
+
"/proc",
|
|
150201
|
+
"/dev",
|
|
150202
|
+
"/boot",
|
|
150203
|
+
"/root"
|
|
150204
|
+
];
|
|
150183
150205
|
function pluginApi(bridgeService, storageLocation) {
|
|
150184
150206
|
const router = express13.Router();
|
|
150185
150207
|
const installer = new PluginInstaller(storageLocation);
|
|
@@ -150340,8 +150362,17 @@ function pluginApi(bridgeService, storageLocation) {
|
|
|
150340
150362
|
router.post("/upload", async (req, res) => {
|
|
150341
150363
|
try {
|
|
150342
150364
|
const chunks = [];
|
|
150365
|
+
let totalSize = 0;
|
|
150343
150366
|
for await (const chunk of req) {
|
|
150344
|
-
|
|
150367
|
+
const buf = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
150368
|
+
totalSize += buf.length;
|
|
150369
|
+
if (totalSize > MAX_UPLOAD_BYTES) {
|
|
150370
|
+
res.status(413).json({
|
|
150371
|
+
error: `Upload exceeds ${MAX_UPLOAD_BYTES / 1024 / 1024}MB limit`
|
|
150372
|
+
});
|
|
150373
|
+
return;
|
|
150374
|
+
}
|
|
150375
|
+
chunks.push(buf);
|
|
150345
150376
|
}
|
|
150346
150377
|
const tgzBuffer = Buffer.concat(chunks);
|
|
150347
150378
|
if (tgzBuffer.length === 0) {
|
|
@@ -150375,6 +150406,11 @@ function pluginApi(bridgeService, storageLocation) {
|
|
|
150375
150406
|
res.status(400).json({ error: "path is required" });
|
|
150376
150407
|
return;
|
|
150377
150408
|
}
|
|
150409
|
+
const resolved = nodePath.resolve(localPath);
|
|
150410
|
+
if (BLOCKED_PREFIXES.some((p) => resolved.startsWith(p))) {
|
|
150411
|
+
res.status(400).json({ error: "Path is inside a restricted system directory" });
|
|
150412
|
+
return;
|
|
150413
|
+
}
|
|
150378
150414
|
try {
|
|
150379
150415
|
const result = installer.installFromLocal(localPath);
|
|
150380
150416
|
if (!result.success) {
|
|
@@ -150526,8 +150562,8 @@ function detectEnvironment2() {
|
|
|
150526
150562
|
return "Docker";
|
|
150527
150563
|
}
|
|
150528
150564
|
try {
|
|
150529
|
-
const
|
|
150530
|
-
if (
|
|
150565
|
+
const fs12 = __require("node:fs");
|
|
150566
|
+
if (fs12.existsSync("/.dockerenv")) {
|
|
150531
150567
|
return "Docker";
|
|
150532
150568
|
}
|
|
150533
150569
|
} catch {
|
|
@@ -150674,9 +150710,9 @@ function getDataPath() {
|
|
|
150674
150710
|
}
|
|
150675
150711
|
return process.cwd();
|
|
150676
150712
|
}
|
|
150677
|
-
async function getWindowsStorageInfo(
|
|
150713
|
+
async function getWindowsStorageInfo(path13) {
|
|
150678
150714
|
try {
|
|
150679
|
-
const drive = `${
|
|
150715
|
+
const drive = `${path13.split(":")[0]}:`;
|
|
150680
150716
|
const { stdout } = await execAsync(
|
|
150681
150717
|
`powershell -Command "Get-PSDrive -Name '${drive.replace(":", "")}' | Select-Object Used,Free | ConvertTo-Json"`
|
|
150682
150718
|
);
|
|
@@ -150687,7 +150723,7 @@ async function getWindowsStorageInfo(path12) {
|
|
|
150687
150723
|
return { total, used, free };
|
|
150688
150724
|
} catch {
|
|
150689
150725
|
try {
|
|
150690
|
-
const drive = `${
|
|
150726
|
+
const drive = `${path13.split(":")[0]}:`;
|
|
150691
150727
|
const { stdout } = await execAsync(
|
|
150692
150728
|
`wmic logicaldisk where "DeviceID='${drive}'" get Size,FreeSpace /format:csv`
|
|
150693
150729
|
);
|
|
@@ -150704,9 +150740,9 @@ async function getWindowsStorageInfo(path12) {
|
|
|
150704
150740
|
return { total: 0, used: 0, free: 0 };
|
|
150705
150741
|
}
|
|
150706
150742
|
}
|
|
150707
|
-
async function getUnixStorageInfo(
|
|
150743
|
+
async function getUnixStorageInfo(path13) {
|
|
150708
150744
|
try {
|
|
150709
|
-
const { stdout } = await execAsync(`df -Pk "${
|
|
150745
|
+
const { stdout } = await execAsync(`df -Pk "${path13}" 2>/dev/null`);
|
|
150710
150746
|
const lines = stdout.trim().split("\n");
|
|
150711
150747
|
if (lines.length >= 2) {
|
|
150712
150748
|
const parts = lines[1].split(/\s+/);
|
|
@@ -150988,12 +151024,12 @@ var WebApi = class extends Service {
|
|
|
150988
151024
|
}
|
|
150989
151025
|
async dispose() {
|
|
150990
151026
|
this.wsApi.close();
|
|
150991
|
-
await new Promise((
|
|
151027
|
+
await new Promise((resolve6, reject) => {
|
|
150992
151028
|
this.server?.close((error) => {
|
|
150993
151029
|
if (error) {
|
|
150994
151030
|
reject(error);
|
|
150995
151031
|
} else {
|
|
150996
|
-
|
|
151032
|
+
resolve6();
|
|
150997
151033
|
}
|
|
150998
151034
|
});
|
|
150999
151035
|
});
|
|
@@ -151015,12 +151051,12 @@ var WebApi = class extends Service {
|
|
|
151015
151051
|
if (this.server) {
|
|
151016
151052
|
return;
|
|
151017
151053
|
}
|
|
151018
|
-
this.server = await new Promise((
|
|
151054
|
+
this.server = await new Promise((resolve6) => {
|
|
151019
151055
|
const server = this.app.listen(this.props.port, () => {
|
|
151020
151056
|
this.log.info(
|
|
151021
151057
|
`HTTP server (API ${this.props.webUiDist ? "& Web App" : "only"}) listening on port ${this.props.port}`
|
|
151022
151058
|
);
|
|
151023
|
-
|
|
151059
|
+
resolve6(server);
|
|
151024
151060
|
});
|
|
151025
151061
|
});
|
|
151026
151062
|
this.wsApi.attach(this.server, this.props.basePath);
|
|
@@ -151243,8 +151279,8 @@ init_dist();
|
|
|
151243
151279
|
init_esm6();
|
|
151244
151280
|
import { pickBy } from "lodash-es";
|
|
151245
151281
|
var LegacyCustomStorage = class extends StorageBackendJsonFile {
|
|
151246
|
-
constructor(log,
|
|
151247
|
-
super(
|
|
151282
|
+
constructor(log, path13) {
|
|
151283
|
+
super(path13);
|
|
151248
151284
|
this.log = log;
|
|
151249
151285
|
const parser = this;
|
|
151250
151286
|
const serialize2 = parser.toJson.bind(parser);
|
|
@@ -151258,7 +151294,7 @@ var LegacyCustomStorage = class extends StorageBackendJsonFile {
|
|
|
151258
151294
|
return this.removeClusters(object, Object.values(ClusterId2));
|
|
151259
151295
|
} catch (e) {
|
|
151260
151296
|
this.log.error(
|
|
151261
|
-
`Failed to parse json file '${
|
|
151297
|
+
`Failed to parse json file '${path13}' with content:
|
|
151262
151298
|
|
|
151263
151299
|
${json}
|
|
151264
151300
|
|
|
@@ -151272,7 +151308,7 @@ ${json}
|
|
|
151272
151308
|
this.removeClusters(object, [ClusterId2.homeAssistantEntity])
|
|
151273
151309
|
);
|
|
151274
151310
|
if (json.trim().length === 0) {
|
|
151275
|
-
throw new Error(`Tried to write empty storage to ${
|
|
151311
|
+
throw new Error(`Tried to write empty storage to ${path13}`);
|
|
151276
151312
|
}
|
|
151277
151313
|
return json;
|
|
151278
151314
|
};
|
|
@@ -151290,10 +151326,10 @@ ${json}
|
|
|
151290
151326
|
|
|
151291
151327
|
// src/core/app/storage/custom-storage.ts
|
|
151292
151328
|
var CustomStorage = class extends StorageBackendDisk {
|
|
151293
|
-
constructor(log,
|
|
151294
|
-
super(
|
|
151329
|
+
constructor(log, path13) {
|
|
151330
|
+
super(path13);
|
|
151295
151331
|
this.log = log;
|
|
151296
|
-
this.path =
|
|
151332
|
+
this.path = path13;
|
|
151297
151333
|
}
|
|
151298
151334
|
async initialize() {
|
|
151299
151335
|
await super.initialize();
|
|
@@ -151310,11 +151346,11 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
151310
151346
|
return await super.keys(contexts);
|
|
151311
151347
|
}
|
|
151312
151348
|
async migrateLegacyStorage() {
|
|
151313
|
-
const
|
|
151349
|
+
const path13 = this.path;
|
|
151314
151350
|
this.log.warn(
|
|
151315
|
-
`Migrating legacy storage (JSON file) to new storage (directory): ${
|
|
151351
|
+
`Migrating legacy storage (JSON file) to new storage (directory): ${path13}`
|
|
151316
151352
|
);
|
|
151317
|
-
const legacyStorage = new LegacyCustomStorage(this.log, `${
|
|
151353
|
+
const legacyStorage = new LegacyCustomStorage(this.log, `${path13}.json`);
|
|
151318
151354
|
legacyStorage.initialize();
|
|
151319
151355
|
forEach(legacyStorage.data, (values4, context) => {
|
|
151320
151356
|
forEach(values4, (value, key) => {
|
|
@@ -151322,7 +151358,7 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
151322
151358
|
});
|
|
151323
151359
|
});
|
|
151324
151360
|
await legacyStorage.close();
|
|
151325
|
-
fs7.renameSync(`${
|
|
151361
|
+
fs7.renameSync(`${path13}.json`, `${path13}/backup.alpha-69.json`);
|
|
151326
151362
|
}
|
|
151327
151363
|
};
|
|
151328
151364
|
|
|
@@ -151724,7 +151760,7 @@ var HomeAssistantClient = class extends Service {
|
|
|
151724
151760
|
url: props.url,
|
|
151725
151761
|
retryDelayMs: 5e3
|
|
151726
151762
|
});
|
|
151727
|
-
await new Promise((
|
|
151763
|
+
await new Promise((resolve6) => setTimeout(resolve6, 5e3));
|
|
151728
151764
|
return this.createConnection(props);
|
|
151729
151765
|
}
|
|
151730
151766
|
if (reason === ERR_INVALID_AUTH) {
|
|
@@ -151762,7 +151798,7 @@ var HomeAssistantClient = class extends Service {
|
|
|
151762
151798
|
};
|
|
151763
151799
|
let state;
|
|
151764
151800
|
while (state !== "RUNNING") {
|
|
151765
|
-
await new Promise((
|
|
151801
|
+
await new Promise((resolve6) => setTimeout(resolve6, 5e3));
|
|
151766
151802
|
state = await getState();
|
|
151767
151803
|
}
|
|
151768
151804
|
this.log.infoCtx("Home Assistant is up and running", { state });
|
|
@@ -164279,6 +164315,8 @@ var ServerModeServerNode = class extends ServerNode {
|
|
|
164279
164315
|
|
|
164280
164316
|
// src/plugins/plugin-manager.ts
|
|
164281
164317
|
init_esm();
|
|
164318
|
+
import * as fs10 from "node:fs";
|
|
164319
|
+
import * as path11 from "node:path";
|
|
164282
164320
|
|
|
164283
164321
|
// src/plugins/plugin-device-factory.ts
|
|
164284
164322
|
init_esm();
|
|
@@ -165768,8 +165806,24 @@ var PluginManager = class {
|
|
|
165768
165806
|
*/
|
|
165769
165807
|
async loadExternal(packagePath, config10) {
|
|
165770
165808
|
try {
|
|
165809
|
+
const pkgJsonPath = path11.join(packagePath, "package.json");
|
|
165810
|
+
if (!fs10.existsSync(pkgJsonPath)) {
|
|
165811
|
+
throw new Error(`Plugin at ${packagePath} has no package.json`);
|
|
165812
|
+
}
|
|
165813
|
+
let manifest;
|
|
165814
|
+
try {
|
|
165815
|
+
manifest = JSON.parse(fs10.readFileSync(pkgJsonPath, "utf-8"));
|
|
165816
|
+
} catch {
|
|
165817
|
+
throw new Error(`Plugin at ${packagePath} has invalid package.json`);
|
|
165818
|
+
}
|
|
165819
|
+
if (!manifest.name || typeof manifest.name !== "string") {
|
|
165820
|
+
throw new Error(`Plugin at ${packagePath} package.json missing "name"`);
|
|
165821
|
+
}
|
|
165822
|
+
if (!manifest.main || typeof manifest.main !== "string") {
|
|
165823
|
+
throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
|
|
165824
|
+
}
|
|
165771
165825
|
const module = await this.runner.run(
|
|
165772
|
-
|
|
165826
|
+
manifest.name,
|
|
165773
165827
|
"import",
|
|
165774
165828
|
() => import(packagePath),
|
|
165775
165829
|
15e3
|
|
@@ -165849,7 +165903,13 @@ var PluginManager = class {
|
|
|
165849
165903
|
);
|
|
165850
165904
|
}
|
|
165851
165905
|
};
|
|
165852
|
-
this.instances.set(plugin.name, {
|
|
165906
|
+
this.instances.set(plugin.name, {
|
|
165907
|
+
plugin,
|
|
165908
|
+
context,
|
|
165909
|
+
metadata,
|
|
165910
|
+
devices,
|
|
165911
|
+
started: false
|
|
165912
|
+
});
|
|
165853
165913
|
logger162.info(
|
|
165854
165914
|
`Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
|
|
165855
165915
|
);
|
|
@@ -165875,6 +165935,8 @@ var PluginManager = class {
|
|
|
165875
165935
|
);
|
|
165876
165936
|
if (this.runner.isDisabled(name)) {
|
|
165877
165937
|
instance.metadata.enabled = false;
|
|
165938
|
+
} else if (this.runner.getState(name).failures === 0) {
|
|
165939
|
+
instance.started = true;
|
|
165878
165940
|
}
|
|
165879
165941
|
}
|
|
165880
165942
|
}
|
|
@@ -165901,13 +165963,14 @@ var PluginManager = class {
|
|
|
165901
165963
|
*/
|
|
165902
165964
|
async shutdownAll(reason) {
|
|
165903
165965
|
for (const [name, instance] of this.instances) {
|
|
165904
|
-
if (instance.plugin.onShutdown) {
|
|
165966
|
+
if (instance.started && instance.plugin.onShutdown) {
|
|
165905
165967
|
await this.runner.run(
|
|
165906
165968
|
name,
|
|
165907
165969
|
"onShutdown",
|
|
165908
165970
|
() => instance.plugin.onShutdown(reason)
|
|
165909
165971
|
);
|
|
165910
165972
|
}
|
|
165973
|
+
instance.started = false;
|
|
165911
165974
|
logger162.info(`Plugin "${name}" shut down`);
|
|
165912
165975
|
}
|
|
165913
165976
|
this.instances.clear();
|
|
@@ -176534,7 +176597,7 @@ var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
176534
176597
|
HomeAssistantEntityBehavior,
|
|
176535
176598
|
VacuumRvcOperationalStateServer
|
|
176536
176599
|
);
|
|
176537
|
-
function VacuumDevice(homeAssistantEntity, includeOnOff = false,
|
|
176600
|
+
function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOptions) {
|
|
176538
176601
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
176539
176602
|
return void 0;
|
|
176540
176603
|
}
|
|
@@ -176555,9 +176618,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
176555
176618
|
logger196.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
176556
176619
|
device = device.with(VacuumOnOffServer);
|
|
176557
176620
|
}
|
|
176558
|
-
|
|
176559
|
-
device = device.with(VacuumPowerSourceServer);
|
|
176560
|
-
}
|
|
176621
|
+
device = device.with(VacuumPowerSourceServer);
|
|
176561
176622
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
176562
176623
|
const rooms = parseVacuumRooms(attributes7);
|
|
176563
176624
|
logger196.info(
|
|
@@ -176573,11 +176634,9 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
176573
176634
|
device = device.with(
|
|
176574
176635
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
176575
176636
|
);
|
|
176576
|
-
} else
|
|
176637
|
+
} else {
|
|
176577
176638
|
logger196.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
176578
176639
|
device = device.with(createDefaultServiceAreaServer());
|
|
176579
|
-
} else {
|
|
176580
|
-
logger196.info(`${entityId}: Skipping ServiceArea (minimal clusters mode)`);
|
|
176581
176640
|
}
|
|
176582
176641
|
const fanSpeedList = resolveFanSpeedList(
|
|
176583
176642
|
attributes7,
|
|
@@ -176807,7 +176866,6 @@ function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
|
176807
176866
|
type = VacuumDevice(
|
|
176808
176867
|
{ entity, customName, mapping },
|
|
176809
176868
|
options?.vacuumOnOff,
|
|
176810
|
-
options?.vacuumMinimalClusters,
|
|
176811
176869
|
options?.cleaningModeOptions
|
|
176812
176870
|
);
|
|
176813
176871
|
} else {
|
|
@@ -177230,7 +177288,6 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177230
177288
|
const areaName = registry2.getAreaName(entityId);
|
|
177231
177289
|
const type = createLegacyEndpointType(payload, effectiveMapping, areaName, {
|
|
177232
177290
|
vacuumOnOff: registry2.isVacuumOnOffEnabled(),
|
|
177233
|
-
vacuumMinimalClusters: registry2.isVacuumMinimalClustersEnabled(),
|
|
177234
177291
|
cleaningModeOptions
|
|
177235
177292
|
});
|
|
177236
177293
|
if (!type) {
|
|
@@ -177517,7 +177574,7 @@ var EntityIsolationService = new EntityIsolationServiceImpl();
|
|
|
177517
177574
|
// src/services/bridges/bridge-endpoint-manager.ts
|
|
177518
177575
|
var MAX_ENTITY_ID_LENGTH = 150;
|
|
177519
177576
|
var BridgeEndpointManager = class extends Service {
|
|
177520
|
-
constructor(client, registry2, mappingStorage, bridgeId, log, pluginManager,
|
|
177577
|
+
constructor(client, registry2, mappingStorage, bridgeId, log, pluginManager, pluginRegistry, pluginInstaller) {
|
|
177521
177578
|
super("BridgeEndpointManager");
|
|
177522
177579
|
this.client = client;
|
|
177523
177580
|
this.registry = registry2;
|
|
@@ -177525,7 +177582,8 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177525
177582
|
this.bridgeId = bridgeId;
|
|
177526
177583
|
this.log = log;
|
|
177527
177584
|
this.pluginManager = pluginManager;
|
|
177528
|
-
this.
|
|
177585
|
+
this.pluginRegistry = pluginRegistry;
|
|
177586
|
+
this.pluginInstaller = pluginInstaller;
|
|
177529
177587
|
this.root = new AggregatorEndpoint2("aggregator");
|
|
177530
177588
|
EntityIsolationService.registerIsolationCallback(
|
|
177531
177589
|
bridgeId,
|
|
@@ -177646,13 +177704,12 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177646
177704
|
await this.pluginManager.configureAll();
|
|
177647
177705
|
}
|
|
177648
177706
|
async loadRegisteredPlugins() {
|
|
177649
|
-
if (!this.pluginManager || !this.
|
|
177650
|
-
|
|
177651
|
-
const
|
|
177652
|
-
const registered2 = pluginRegistry.getAll();
|
|
177707
|
+
if (!this.pluginManager || !this.pluginRegistry || !this.pluginInstaller)
|
|
177708
|
+
return;
|
|
177709
|
+
const registered2 = this.pluginRegistry.getAll();
|
|
177653
177710
|
for (const entry of registered2) {
|
|
177654
177711
|
if (!entry.autoLoad) continue;
|
|
177655
|
-
const packagePath =
|
|
177712
|
+
const packagePath = this.pluginInstaller.getPluginPath(entry.packageName);
|
|
177656
177713
|
try {
|
|
177657
177714
|
await this.pluginManager.loadExternal(packagePath, entry.config);
|
|
177658
177715
|
this.log.info(
|
|
@@ -178180,9 +178237,6 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
178180
178237
|
isServerModeVacuumOnOffEnabled() {
|
|
178181
178238
|
return this.dataProvider.featureFlags?.vacuumOnOff === true;
|
|
178182
178239
|
}
|
|
178183
|
-
isVacuumMinimalClustersEnabled() {
|
|
178184
|
-
return this.dataProvider.featureFlags?.vacuumMinimalClusters === true;
|
|
178185
|
-
}
|
|
178186
178240
|
/**
|
|
178187
178241
|
* Auto-detect vacuum-related select entities on the same HA device.
|
|
178188
178242
|
* HA integrations (Dreame, Roborock, Ecovacs, Valetudo, etc.) expose vacuum
|
|
@@ -178898,7 +178952,7 @@ var ServerModeVacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
|
178898
178952
|
HomeAssistantEntityBehavior,
|
|
178899
178953
|
VacuumRvcOperationalStateServer
|
|
178900
178954
|
);
|
|
178901
|
-
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false,
|
|
178955
|
+
function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOptions) {
|
|
178902
178956
|
if (homeAssistantEntity.entity.state === void 0) {
|
|
178903
178957
|
return void 0;
|
|
178904
178958
|
}
|
|
@@ -178909,9 +178963,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
178909
178963
|
if (includeOnOff) {
|
|
178910
178964
|
device = device.with(VacuumOnOffServer);
|
|
178911
178965
|
}
|
|
178912
|
-
|
|
178913
|
-
device = device.with(VacuumPowerSourceServer);
|
|
178914
|
-
}
|
|
178966
|
+
device = device.with(VacuumPowerSourceServer);
|
|
178915
178967
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
178916
178968
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
178917
178969
|
const rooms = parseVacuumRooms(attributes7);
|
|
@@ -178921,7 +178973,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
178921
178973
|
device = device.with(
|
|
178922
178974
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
178923
178975
|
);
|
|
178924
|
-
} else
|
|
178976
|
+
} else {
|
|
178925
178977
|
device = device.with(createDefaultServiceAreaServer());
|
|
178926
178978
|
}
|
|
178927
178979
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -179086,7 +179138,6 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
179086
179138
|
mapping: effectiveMapping
|
|
179087
179139
|
},
|
|
179088
179140
|
registry2.isServerModeVacuumOnOffEnabled(),
|
|
179089
|
-
registry2.isVacuumMinimalClustersEnabled(),
|
|
179090
179141
|
cleaningModeOptions
|
|
179091
179142
|
);
|
|
179092
179143
|
if (!endpointType) {
|
|
@@ -179414,8 +179465,12 @@ var BridgeEnvironment = class _BridgeEnvironment extends EnvironmentBase {
|
|
|
179414
179465
|
this.set(EntityStateProvider, new EntityStateProvider(haRegistry));
|
|
179415
179466
|
const bridgeId = this.get(BridgeDataProvider).id;
|
|
179416
179467
|
let pluginManager;
|
|
179468
|
+
let pluginRegistry;
|
|
179469
|
+
let pluginInstaller;
|
|
179417
179470
|
if (this.storageLocation) {
|
|
179418
179471
|
pluginManager = new PluginManager(bridgeId, this.storageLocation);
|
|
179472
|
+
pluginRegistry = new PluginRegistry(this.storageLocation);
|
|
179473
|
+
pluginInstaller = new PluginInstaller(this.storageLocation);
|
|
179419
179474
|
}
|
|
179420
179475
|
this.set(
|
|
179421
179476
|
BridgeEndpointManager,
|
|
@@ -179426,7 +179481,8 @@ var BridgeEnvironment = class _BridgeEnvironment extends EnvironmentBase {
|
|
|
179426
179481
|
bridgeId,
|
|
179427
179482
|
this.endpointManagerLogger,
|
|
179428
179483
|
pluginManager,
|
|
179429
|
-
|
|
179484
|
+
pluginRegistry,
|
|
179485
|
+
pluginInstaller
|
|
179430
179486
|
)
|
|
179431
179487
|
);
|
|
179432
179488
|
}
|
|
@@ -179727,7 +179783,7 @@ async function startHandler(startOptions, webUiDist) {
|
|
|
179727
179783
|
try {
|
|
179728
179784
|
await Promise.race([
|
|
179729
179785
|
bridgeService.dispose(),
|
|
179730
|
-
new Promise((
|
|
179786
|
+
new Promise((resolve6) => setTimeout(resolve6, 1e4))
|
|
179731
179787
|
]);
|
|
179732
179788
|
} catch (e) {
|
|
179733
179789
|
console.warn("Error during graceful shutdown:", e);
|
|
@@ -179743,7 +179799,7 @@ async function startHandler(startOptions, webUiDist) {
|
|
|
179743
179799
|
}
|
|
179744
179800
|
|
|
179745
179801
|
// src/commands/start/start-options-builder.ts
|
|
179746
|
-
import
|
|
179802
|
+
import fs11 from "node:fs";
|
|
179747
179803
|
function startOptionsBuilder(yargs2) {
|
|
179748
179804
|
return yargs2.env("HAMH").version(false).config(
|
|
179749
179805
|
"config",
|
|
@@ -179752,10 +179808,10 @@ function startOptionsBuilder(yargs2) {
|
|
|
179752
179808
|
if (configPath.trim() === "") {
|
|
179753
179809
|
return {};
|
|
179754
179810
|
}
|
|
179755
|
-
if (!
|
|
179811
|
+
if (!fs11.existsSync(configPath)) {
|
|
179756
179812
|
throw new Error(`Config file '${configPath}' does not exist!`);
|
|
179757
179813
|
}
|
|
179758
|
-
return JSON.parse(
|
|
179814
|
+
return JSON.parse(fs11.readFileSync(configPath, "utf-8"));
|
|
179759
179815
|
}
|
|
179760
179816
|
).option("log-level", {
|
|
179761
179817
|
type: "string",
|
|
@@ -179817,7 +179873,7 @@ function startCommand(webDist) {
|
|
|
179817
179873
|
// src/cli.ts
|
|
179818
179874
|
var dirname4 = import.meta.dirname ?? url.fileURLToPath(new URL(".", import.meta.url));
|
|
179819
179875
|
async function cli(argv) {
|
|
179820
|
-
const webDist = process.env.NODE_ENV === "development" ? void 0 :
|
|
179876
|
+
const webDist = process.env.NODE_ENV === "development" ? void 0 : path12.join(dirname4, "../frontend");
|
|
179821
179877
|
const cli2 = yargs(hideBin(argv));
|
|
179822
179878
|
cli2.scriptName("home-assistant-matter-hub").version().strict().recommendCommands().detectLocale(false).help().command(startCommand(webDist)).demandCommand().wrap(Math.min(140, cli2.terminalWidth())).parse();
|
|
179823
179879
|
}
|