@mega-yfue/eufy-sdk 0.6.0-beta.41 → 0.6.0-beta.43
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/client/device-registry.d.ts +22 -0
- package/dist/index.js +666 -214
- package/dist/index.js.map +4 -4
- package/dist/model/capabilities/index.d.ts +1 -0
- package/dist/model/capabilities/members.d.ts +18 -3
- package/dist/model/capabilities/rtsp.d.ts +1 -10
- package/dist/model/capabilities/thing-description.d.ts +135 -0
- package/dist/model/capabilities/types.d.ts +9 -0
- package/dist/model/inspect.d.ts +3 -0
- package/dist/model/types.d.ts +3 -0
- package/dist/transport/http/mega-client.d.ts +12 -0
- package/dist/transport/rtc/command-router.d.ts +7 -0
- package/package.json +3 -2
|
@@ -11,6 +11,13 @@ import { MegaHttpClient } from "../transport/http/mega-client.js";
|
|
|
11
11
|
import { type Logger } from "../core/logger.js";
|
|
12
12
|
import { type EufyDevice } from "../core/types.js";
|
|
13
13
|
import { type Capability, type DeviceInspection } from "../model/index.js";
|
|
14
|
+
import { type ThingDescription } from "../model/capabilities/thing-description.js";
|
|
15
|
+
/**
|
|
16
|
+
* Read a non-empty string field off a raw device record, tolerating the app's `deviceParams` nesting
|
|
17
|
+
* (the v6 app resolves e.g. firmware as `record.deviceParams?.main_sw_version ?? record.main_sw_version`).
|
|
18
|
+
* Returns `undefined` for a missing or empty value, so a blank firmware never surfaces as `""`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function recordString(raw: Record<string, unknown>, key: string): string | undefined;
|
|
14
21
|
/** The device-record shape {@link EufyMega.getDevice}/`commandContext` resolve a serial to. */
|
|
15
22
|
export interface DeviceRecord {
|
|
16
23
|
deviceType?: number;
|
|
@@ -35,6 +42,8 @@ export interface DeviceRecord {
|
|
|
35
42
|
* capabilities a device is judged to have.
|
|
36
43
|
*/
|
|
37
44
|
dpParams?: Record<number, string>;
|
|
45
|
+
/** The product's thing description (see {@link CloudRecord.things}). */
|
|
46
|
+
things?: ThingDescription;
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* One param that changed value between two polls — the input the facade turns into a
|
|
@@ -97,6 +106,8 @@ export declare class DeviceRegistry {
|
|
|
97
106
|
private readonly deviceCapsCache;
|
|
98
107
|
/** Per-serial cloud data points of an AIoT robot, joined beneath the params in {@link record} — see {@link loadCloudDps}. */
|
|
99
108
|
private readonly cloudDps;
|
|
109
|
+
/** Per-product-code thing description — see {@link loadThings}; `undefined` for a code the cloud returned none for. */
|
|
110
|
+
private readonly things;
|
|
100
111
|
/** Per-serial realtime state, keyed by param id in the device's own namespace (see {@link DeviceRecord.dpParams}). */
|
|
101
112
|
private readonly dpParams;
|
|
102
113
|
/** Callers blocked in {@link awaitRealtimeState}, released by the device's first report. */
|
|
@@ -202,6 +213,17 @@ export declare class DeviceRegistry {
|
|
|
202
213
|
* DP numbers their realtime reports use.
|
|
203
214
|
*/
|
|
204
215
|
private loadCloudDps;
|
|
216
|
+
/**
|
|
217
|
+
* The device's product description resolved for this device ({@link resolveThing}): against its serial
|
|
218
|
+
* and firmware (`main_sw_version`), the station it is reached through and that station's firmware, the
|
|
219
|
+
* account's country and its reported params.
|
|
220
|
+
*/
|
|
221
|
+
private thingsFor;
|
|
222
|
+
/**
|
|
223
|
+
* Fetch, once per start, the thing description of each product code the account has, in one
|
|
224
|
+
* `get_things_list` call. A failed call is logged and asked again on the next refresh.
|
|
225
|
+
*/
|
|
226
|
+
private loadThings;
|
|
205
227
|
/**
|
|
206
228
|
* Resolve a serial to a {@link DeviceRecord} with current params: starts from the device-list params, then
|
|
207
229
|
* overlays a fresh `get_device_param_list` when that call is available to this account. An AIoT robot's
|