@mega-yfue/eufy-sdk 0.4.0-beta.9 → 0.4.0
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 +18 -2
- package/dist/client/types.d.ts +25 -0
- package/dist/core/contracts.d.ts +43 -0
- package/dist/index.js +1064 -547
- package/dist/index.js.map +4 -4
- package/dist/model/capabilities/camera.d.ts +14 -9
- package/dist/model/capabilities/doorbell.d.ts +8 -9
- package/dist/model/capabilities/index.d.ts +1 -1
- package/dist/model/capabilities/manifest.d.ts +18 -2
- package/dist/model/capabilities/members.d.ts +2 -0
- package/dist/model/capabilities/motion.d.ts +3 -4
- package/dist/model/capabilities/siren.d.ts +1 -1
- package/dist/model/capabilities/types.d.ts +2 -0
- 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/p2p/codec.d.ts +13 -0
- package/dist/transport/p2p/command-router.d.ts +36 -6
- package/dist/transport/p2p/live-trace.d.ts +5 -0
- package/dist/transport/p2p/p2p-session.d.ts +51 -14
- package/dist/transport/p2p/recording-download.d.ts +54 -0
- package/dist/transport/p2p/video.d.ts +2 -0
- package/dist/transport/stored-image-cache.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type RecordingDownload } from "../../core/contracts.js";
|
|
2
|
+
import type { P2PSession } from "./p2p-session.js";
|
|
3
|
+
/** Data type a station sends a recording's frames on: the binary channel (`0xd1 0x03`), not live video's. */
|
|
4
|
+
export declare const RECORDING_DATA_TYPE = 3;
|
|
5
|
+
/**
|
|
6
|
+
* Most frame bytes a transfer holds. The station sends faster than real time, so the time bounds alone do
|
|
7
|
+
* not bound memory; an event recording is far below this.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_TRANSFER_BYTES: number;
|
|
10
|
+
/** One recording frame as received, in arrival order. */
|
|
11
|
+
export interface RecordingFrame {
|
|
12
|
+
commandId: number;
|
|
13
|
+
signCode: number;
|
|
14
|
+
raw: Buffer;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The path a HomeBase 2 stores a camera's recording under: the camera's channel, two digits, and the
|
|
18
|
+
* recording name the event push carries. Answers `undefined` for a name that is not the station's
|
|
19
|
+
* fourteen-digit `yyyyMMddHHmmss` form. The name comes from a push, so the test stays anchored and
|
|
20
|
+
* digits-only: no `..`, slash or other character that could reach another path on the station gets through.
|
|
21
|
+
*/
|
|
22
|
+
export declare function homeBase2RecordingPath(channel: number, recording: string): string | undefined;
|
|
23
|
+
/** One recording transfer on a station session. */
|
|
24
|
+
export interface RecordingTransfer {
|
|
25
|
+
/** The recording's frames, in arrival order. Rejects as {@link receiveRecording} describes. */
|
|
26
|
+
frames: Promise<RecordingFrame[]>;
|
|
27
|
+
/** Resolves once the station has stopped sending this recording, which can be after `frames` rejected. */
|
|
28
|
+
drained: Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Request one recording and collect its frames until `CMD_DOWNLOAD_FINISH`. Only frames on
|
|
32
|
+
* {@link RECORDING_DATA_TYPE} tagged with the camera's channel belong to it, so a live stream open on the same
|
|
33
|
+
* station is never mixed in. The finish frame is taken on the camera's channel or channel 0.
|
|
34
|
+
*
|
|
35
|
+
* `frames` rejects with {@link RecordingDownloadError}: `no-data` when nothing arrives within
|
|
36
|
+
* {@link FIRST_FRAME_WAIT_MS}, and `incomplete` when the transfer ends without its finish frame, on a
|
|
37
|
+
* {@link IDLE_END_MS} silence, on `timeoutMs` or on {@link MAX_TRANSFER_BYTES}. An abort rejects it at once
|
|
38
|
+
* with the signal's reason. After a time bound, the byte ceiling or an abort, the transfer stops collecting
|
|
39
|
+
* but keeps listening until the station finishes or goes quiet, and only then resolves `drained`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function receiveRecording(session: P2PSession, request: {
|
|
42
|
+
path: string;
|
|
43
|
+
accountId: string;
|
|
44
|
+
channel: number;
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}): RecordingTransfer;
|
|
48
|
+
/**
|
|
49
|
+
* Decode a recording's frames, in arrival order, into elementary streams. Keyframes go through one
|
|
50
|
+
* {@link VideoFrameDecoder}, whose media key then opens the audio; a keyframe that does not open under
|
|
51
|
+
* `eccPrivateKeyHex`, and every audio frame before the first media key, are dropped. Rejects with
|
|
52
|
+
* {@link RecordingDownloadError} `undecodable` when no video frame decodes.
|
|
53
|
+
*/
|
|
54
|
+
export declare function decodeRecording(frames: readonly RecordingFrame[], eccPrivateKeyHex: string): RecordingDownload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.4.0
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "One typed TypeScript client for the Anker eufy v6 cloud — capability-driven devices, realtime events over P2P/MQTT/push, and live media",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "mega-yfue",
|