@mega-yfue/eufy-sdk 0.4.0-beta.2 → 0.4.0-beta.21
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/eufy-mega.d.ts +22 -3
- package/dist/client/types.d.ts +25 -0
- package/dist/core/contracts.d.ts +45 -2
- package/dist/index.js +1204 -681
- package/dist/index.js.map +4 -4
- package/dist/model/capabilities/camera.d.ts +1 -0
- package/dist/model/capabilities/doorbell.d.ts +8 -9
- package/dist/model/capabilities/manifest.d.ts +18 -2
- package/dist/model/capabilities/motion.d.ts +3 -4
- package/dist/model/capabilities/siren.d.ts +1 -1
- package/dist/model/param-dictionary.d.ts +3 -3
- package/dist/model/types.d.ts +10 -11
- package/dist/transport/http/passport.d.ts +21 -0
- package/dist/transport/http/solix-client.d.ts +5 -6
- package/dist/transport/mqtt/secure-mqtt.d.ts +20 -13
- package/dist/transport/p2p/adts.d.ts +6 -0
- package/dist/transport/p2p/codec.d.ts +13 -0
- package/dist/transport/p2p/command-router.d.ts +29 -0
- package/dist/transport/p2p/p2p-session.d.ts +60 -13
- package/dist/transport/p2p/recording-download.d.ts +54 -0
- package/dist/transport/p2p/shared-live-source.d.ts +1 -1
- package/dist/transport/p2p/video.d.ts +2 -0
- package/dist/transport/stored-image-cache.d.ts +2 -0
- package/package.json +1 -1
|
@@ -20,8 +20,8 @@ import { type P2PSession } from "../transport/p2p/p2p-session.js";
|
|
|
20
20
|
import { type CleanRecordPage } from "../model/clean-records.js";
|
|
21
21
|
import { type AvailabilityObservation, type EufyDevice } from "../core/types.js";
|
|
22
22
|
import { Device, type DeviceInspection } from "../model/index.js";
|
|
23
|
-
import type { EufyMegaOptions, EufyMegaEvent, EufyMegaEventMap, DeviceState, RealtimeReadiness, WaitForRealtimeOptions } from "./types.js";
|
|
24
|
-
export type { EufyMegaOptions, EufyMegaEvent, EufyMegaEventMap, AnyDeviceEvent, DeviceState, RealtimePlaneReadiness, RealtimeReadiness, WaitForRealtimeOptions, } from "./types.js";
|
|
23
|
+
import type { EufyMegaOptions, EufyMegaEvent, EufyMegaEventMap, DeviceState, RealtimeReadiness, StationFace, StationFacesOptions, WaitForRealtimeOptions } from "./types.js";
|
|
24
|
+
export type { EufyMegaOptions, EufyMegaEvent, EufyMegaEventMap, AnyDeviceEvent, DeviceState, RealtimePlaneReadiness, RealtimeReadiness, StationFace, StationFacesOptions, WaitForRealtimeOptions, } from "./types.js";
|
|
25
25
|
export interface EufyMega {
|
|
26
26
|
on<E extends EufyMegaEvent>(event: E, listener: (...args: EufyMegaEventMap[E]) => void): this;
|
|
27
27
|
once<E extends EufyMegaEvent>(event: E, listener: (...args: EufyMegaEventMap[E]) => void): this;
|
|
@@ -764,6 +764,22 @@ export declare class EufyMega extends EventEmitter {
|
|
|
764
764
|
* every event the station's own session already delivers.
|
|
765
765
|
*/
|
|
766
766
|
getP2pSessions(): Map<string, P2PSession>;
|
|
767
|
+
/**
|
|
768
|
+
* The people enrolled on a station, read from its own `person_basic_info` table over P2P.
|
|
769
|
+
*
|
|
770
|
+
* The cloud roster (`api.getFaces()`) answers empty for an account that keeps its faces on the
|
|
771
|
+
* station, because they were never uploaded — the station holds them.
|
|
772
|
+
*
|
|
773
|
+
* Resolves with the rows the station returned. Rejects on a station that cannot be reached, on a
|
|
774
|
+
* record stating no `admin_user_id`, and on the reply not arriving whole in time. Assembling that
|
|
775
|
+
* reply is `P2PSession.readDatabase`'s; this resolves which station and which account id.
|
|
776
|
+
*
|
|
777
|
+
* `stranger<n>` names are the station's own placeholders for a face nobody has named, and are
|
|
778
|
+
* returned as they arrive; a caller that wants only named people filters them.
|
|
779
|
+
*/
|
|
780
|
+
getStationFaces(stationSn: string, opts?: StationFacesOptions): Promise<StationFace[]>;
|
|
781
|
+
/** The station's own `admin_user_id`, which its database refuses the query without. */
|
|
782
|
+
private adminUserIdOf;
|
|
767
783
|
/**
|
|
768
784
|
* The liveness facts for one device — see {@link DeviceState}. Facts, not an `online` verdict: "how
|
|
769
785
|
* long is too long" is a threshold that belongs to the caller, and it differs per device class.
|
|
@@ -871,7 +887,10 @@ export declare class EufyMega extends EventEmitter {
|
|
|
871
887
|
* one — so this never overwrites a channel a later login already brought up.
|
|
872
888
|
*/
|
|
873
889
|
private startPush;
|
|
874
|
-
/**
|
|
890
|
+
/**
|
|
891
|
+
* Admit only exact, account-known devices with resolved snapshot evidence into the passive store; a
|
|
892
|
+
* station-only candidate is admitted under the event's device serial.
|
|
893
|
+
*/
|
|
875
894
|
private observeStoredImage;
|
|
876
895
|
/**
|
|
877
896
|
* Tear down every realtime channel: close the secure-MQTT transport, all P2P sessions, and the FCM
|
package/dist/client/types.d.ts
CHANGED
|
@@ -221,6 +221,31 @@ export interface DeviceState {
|
|
|
221
221
|
*/
|
|
222
222
|
lastSeenMs?: number;
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* One person enrolled on a station, as its `person_basic_info` table states them.
|
|
226
|
+
*
|
|
227
|
+
* The station's own table, not the cloud's: an account that keeps its faces on the station never
|
|
228
|
+
* uploaded them, so the cloud roster answers empty for it while this answers the household.
|
|
229
|
+
*
|
|
230
|
+
* `person_id` is the id an `IDENTITY_PERSON_DETECTION` push carries, which is what makes a detection
|
|
231
|
+
* nameable. Every field is optional because the row is the station's to shape — an absent one is a
|
|
232
|
+
* column that row did not carry, never a default — and unrecognised columns are kept verbatim, so a
|
|
233
|
+
* station that states more than this is not truncated by it. Keys are the table's own, uncased.
|
|
234
|
+
*/
|
|
235
|
+
export interface StationFace {
|
|
236
|
+
person_id?: number;
|
|
237
|
+
/** The name this person was enrolled under. `stranger<n>` is the station's own placeholder. */
|
|
238
|
+
name?: string;
|
|
239
|
+
relation?: number | string;
|
|
240
|
+
group_id?: number | string;
|
|
241
|
+
[column: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
/** How long to wait for a station's database reply, and how to give up early. */
|
|
244
|
+
export interface StationFacesOptions {
|
|
245
|
+
/** Default 15s. A full table is a handful of frames; a station that will not answer says nothing. */
|
|
246
|
+
timeoutMs?: number;
|
|
247
|
+
signal?: AbortSignal;
|
|
248
|
+
}
|
|
224
249
|
/**
|
|
225
250
|
* A single semantic event tagged with its name — the payload of the catch-all `"event"` listener.
|
|
226
251
|
* A discriminated union over {@link DeviceEventMap}, so switching on `e.eventName` narrows `e` to that
|
package/dist/core/contracts.d.ts
CHANGED
|
@@ -150,6 +150,39 @@ export declare class DeviceChannelUnresolvedError extends Error {
|
|
|
150
150
|
cause?: unknown;
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Why {@link MediaProvider.downloadRecording} returned no recording.
|
|
155
|
+
*
|
|
156
|
+
* - `invalid-recording` — the recording name is not one the station could hold.
|
|
157
|
+
* - `key-unavailable` — the key the recording was stored under could not be obtained.
|
|
158
|
+
* - `no-data` — the station sent nothing within the wait.
|
|
159
|
+
* - `incomplete` — the transfer ended before the station's finish frame.
|
|
160
|
+
* - `undecodable` — data arrived but no video frame could be decoded from it.
|
|
161
|
+
*/
|
|
162
|
+
export type RecordingDownloadFailureReason = "invalid-recording" | "key-unavailable" | "no-data" | "incomplete" | "undecodable";
|
|
163
|
+
/** Thrown by {@link MediaProvider.downloadRecording} when no recording could be returned. */
|
|
164
|
+
export declare class RecordingDownloadError extends Error {
|
|
165
|
+
readonly reason: RecordingDownloadFailureReason;
|
|
166
|
+
constructor(reason: RecordingDownloadFailureReason, message: string, options?: {
|
|
167
|
+
cause?: unknown;
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A recording downloaded from the station, as elementary streams.
|
|
172
|
+
*
|
|
173
|
+
* `video` is Annex-B H.264 in decode order, `audio` AAC-LC 16 kHz mono in ADTS framing (absent when the
|
|
174
|
+
* recording carried none that could be decoded). `frames` counts the distinct video frames received,
|
|
175
|
+
* `missingFrames` the ones the camera numbered but that never arrived, and `durationMs` spans the first
|
|
176
|
+
* to the last received frame by the camera's own timestamps; `fps` is derived from those two stamps.
|
|
177
|
+
*/
|
|
178
|
+
export interface RecordingDownload {
|
|
179
|
+
video: Buffer;
|
|
180
|
+
audio?: Buffer;
|
|
181
|
+
frames: number;
|
|
182
|
+
missingFrames: number;
|
|
183
|
+
durationMs: number;
|
|
184
|
+
fps: number;
|
|
185
|
+
}
|
|
153
186
|
/**
|
|
154
187
|
* How a live stream ended before its first video keyframe: the warm-up deadline elapsed, the source
|
|
155
188
|
* reported an error, or the source ended on its own.
|
|
@@ -684,8 +717,8 @@ export interface SharedSourceHints {
|
|
|
684
717
|
*/
|
|
685
718
|
powered?: "wired" | "battery";
|
|
686
719
|
/**
|
|
687
|
-
* Seconds of already-captured media the pull retains for a later drain; `0`, absent, non-finite
|
|
688
|
-
* negative
|
|
720
|
+
* Seconds of already-captured media the pull retains for a later drain; `0`, absent, non-finite,
|
|
721
|
+
* negative, and windows longer than 2,147,483,647 ms retain none.
|
|
689
722
|
*
|
|
690
723
|
* Retention costs memory on every frame and only a caller knows whether anything will drain it, so it
|
|
691
724
|
* is never assumed. Media can only be retained while the pull is running, so a window answers "what did
|
|
@@ -804,6 +837,16 @@ export interface MediaProvider {
|
|
|
804
837
|
talkback?(opts?: {
|
|
805
838
|
encoder?: AacEncoder;
|
|
806
839
|
} & SharedSourceHints): Promise<TalkbackHandle>;
|
|
840
|
+
/**
|
|
841
|
+
* Download one recording the camera's station stored, identified by the recording name and cipher id of
|
|
842
|
+
* the event. One download runs at a time per station. Rejects with {@link RecordingDownloadError}.
|
|
843
|
+
* Optional, and absent on a camera whose station's recording download is unverified.
|
|
844
|
+
*/
|
|
845
|
+
downloadRecording?(opts: {
|
|
846
|
+
recording: string;
|
|
847
|
+
cipherId: number;
|
|
848
|
+
timeoutMs?: number;
|
|
849
|
+
} & AbortableCall): Promise<RecordingDownload>;
|
|
807
850
|
/**
|
|
808
851
|
* Generic P2P request/reply query: send a `SET_PAYLOAD` sub-command and resolve with the reply
|
|
809
852
|
* frame's `payload` (the reply whose `cmd` echoes `subCmd`). Transport-only — the caller owns the
|