@apocaliss92/nodedreame 1.12.3 → 1.12.4
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/index.cjs +31 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/support/version.ts
|
|
2
2
|
var LIBRARY_NAME = "nodedreame";
|
|
3
|
-
var LIBRARY_VERSION = "1.12.
|
|
3
|
+
var LIBRARY_VERSION = "1.12.4";
|
|
4
4
|
|
|
5
5
|
// src/transport/errors.ts
|
|
6
6
|
var DreameError = class extends Error {
|
|
@@ -2751,34 +2751,6 @@ var VACUUM_ACTIONS = {
|
|
|
2751
2751
|
autoEmpty: { siid: 15, aiid: 1 }
|
|
2752
2752
|
};
|
|
2753
2753
|
|
|
2754
|
-
// src/video/monitor/vendor.ts
|
|
2755
|
-
function videoVendorSwitchParams(vendor) {
|
|
2756
|
-
return { vendor };
|
|
2757
|
-
}
|
|
2758
|
-
function parseVideoVendorStatus(raw) {
|
|
2759
|
-
const text = typeof raw === "string" ? raw : typeof raw === "object" && raw !== null ? null : null;
|
|
2760
|
-
const source = text === null ? raw : safeJson(text);
|
|
2761
|
-
if (typeof source !== "object" || source === null) {
|
|
2762
|
-
return { vendor: null, initStatus: null };
|
|
2763
|
-
}
|
|
2764
|
-
const v = Reflect.get(source, "vendor");
|
|
2765
|
-
const s = Reflect.get(source, "initStatus");
|
|
2766
|
-
return {
|
|
2767
|
-
vendor: v === "ali" || v === "tx" ? v : null,
|
|
2768
|
-
initStatus: typeof s === "number" ? s : null
|
|
2769
|
-
};
|
|
2770
|
-
}
|
|
2771
|
-
function safeJson(text) {
|
|
2772
|
-
try {
|
|
2773
|
-
return JSON.parse(text);
|
|
2774
|
-
} catch {
|
|
2775
|
-
return null;
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
function vendorSwitchSettled(status, wanted) {
|
|
2779
|
-
return status.vendor === wanted && status.initStatus === 1;
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
2754
|
// src/video/monitor/protocol.ts
|
|
2783
2755
|
import { createHash as createHash3 } from "crypto";
|
|
2784
2756
|
function makeMonitorSession(accountId, now = Date.now()) {
|
|
@@ -2855,6 +2827,34 @@ function firstOutValue(res) {
|
|
|
2855
2827
|
return Array.isArray(out) && out.length > 0 ? out[0]?.value : void 0;
|
|
2856
2828
|
}
|
|
2857
2829
|
|
|
2830
|
+
// src/video/monitor/vendor.ts
|
|
2831
|
+
function videoVendorSwitchParams(vendor) {
|
|
2832
|
+
return { vendor };
|
|
2833
|
+
}
|
|
2834
|
+
function parseVideoVendorStatus(raw) {
|
|
2835
|
+
const text = typeof raw === "string" ? raw : typeof raw === "object" && raw !== null ? null : null;
|
|
2836
|
+
const source = text === null ? raw : safeJson(text);
|
|
2837
|
+
if (typeof source !== "object" || source === null) {
|
|
2838
|
+
return { vendor: null, initStatus: null };
|
|
2839
|
+
}
|
|
2840
|
+
const v = Reflect.get(source, "vendor");
|
|
2841
|
+
const s = Reflect.get(source, "initStatus");
|
|
2842
|
+
return {
|
|
2843
|
+
vendor: v === "ali" || v === "tx" ? v : null,
|
|
2844
|
+
initStatus: typeof s === "number" ? s : null
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
function safeJson(text) {
|
|
2848
|
+
try {
|
|
2849
|
+
return JSON.parse(text);
|
|
2850
|
+
} catch {
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
function vendorSwitchSettled(status, wanted) {
|
|
2855
|
+
return status.vendor === wanted && status.initStatus === 1;
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
2858
|
// src/video/monitor/controller.ts
|
|
2859
2859
|
var DEFAULT_KEEP_ALIVE_MS = 1e4;
|
|
2860
2860
|
var DEFAULT_AREA = "4";
|
|
@@ -5471,8 +5471,9 @@ var VacuumDevice = class _VacuumDevice extends BaseDevice {
|
|
|
5471
5471
|
if (vendorSwitchSettled(already, vendor)) {
|
|
5472
5472
|
return already;
|
|
5473
5473
|
}
|
|
5474
|
+
const session = makeMonitorSession(this.currentSession().uid);
|
|
5474
5475
|
await this.callAction(MONITOR_SIID, MONITOR_AIID.VIDEO_VENDOR, [
|
|
5475
|
-
|
|
5476
|
+
buildActionInput(MONITOR_PIID.VIDEO_VENDOR_STATUS, videoVendorSwitchParams(vendor), session)
|
|
5476
5477
|
]);
|
|
5477
5478
|
const every = opts?.pollIntervalMs ?? 5e3;
|
|
5478
5479
|
const deadline = Date.now() + (opts?.timeoutMs ?? every * 10);
|