@mega-yfue/eufy-sdk 0.1.0 → 0.1.1-beta.1
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/README.md +17 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,11 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
> [!IMPORTANT]
|
|
27
|
-
> **Not usable yet.** This repository is being set up: the scaffold, the CI gate and the docs pipeline
|
|
28
|
-
> are in place, the library source lands next. `0.0.1` exists on npm only to prove the release
|
|
29
|
-
> pipeline works — it is an empty package. Wait for `0.1.0`.
|
|
30
|
-
|
|
31
26
|
## What it is
|
|
32
27
|
|
|
33
28
|
A TypeScript SDK for the Anker eufy cloud that the current eufy app speaks. It logs in (captcha and 2FA
|
|
@@ -37,14 +32,18 @@ you drive through a **typed, fluent API**:
|
|
|
37
32
|
```ts
|
|
38
33
|
const dev = await eufy.getDevice(sn);
|
|
39
34
|
|
|
40
|
-
const stored = await dev.camera()?.snapshotStored?.(); // latest retained push JPEG
|
|
41
|
-
const fresh = await dev.camera()?.snapshotLive(); // explicit fresh live capture
|
|
42
|
-
await dev.
|
|
43
|
-
await dev.light()?.setBrightness(60);
|
|
35
|
+
const stored = await dev.camera?.()?.snapshotStored?.(); // latest retained push JPEG
|
|
36
|
+
const fresh = await dev.camera?.()?.snapshotLive?.(); // explicit fresh live capture
|
|
37
|
+
await dev.ptz?.()?.rotate(PtzDirection.left);
|
|
38
|
+
await dev.light?.()?.setBrightness(60);
|
|
44
39
|
|
|
45
|
-
eufy.on("motion", (e) => console.log(e.
|
|
40
|
+
eufy.on("motion", (e) => console.log(e.deviceSn, "saw something"));
|
|
46
41
|
```
|
|
47
42
|
|
|
43
|
+
Accessors and methods are optional because both are **evidence-gated**: a device exposes exactly the
|
|
44
|
+
features it reported, so the optionality states that one may be absent. An **unverified write path
|
|
45
|
+
throws** rather than send a frame it cannot stand behind.
|
|
46
|
+
|
|
48
47
|
Realtime arrives over **P2P** (cameras and HomeBases), **secure MQTT** (appliances) and **push**
|
|
49
48
|
(events), all surfaced as typed semantic events. Live **video streaming** works, with one shared pull
|
|
50
49
|
fanned out to every consumer.
|
|
@@ -56,12 +55,10 @@ code path and an unlisted or future device resolves the same way as a known one.
|
|
|
56
55
|
## Install
|
|
57
56
|
|
|
58
57
|
```bash
|
|
59
|
-
npm install @mega-yfue/eufy-sdk
|
|
58
|
+
npm install @mega-yfue/eufy-sdk # latest stable
|
|
59
|
+
npm install @mega-yfue/eufy-sdk@beta # the prerelease of the version in review
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
Releases go to **npmjs**, published from CI with provenance. Prereleases ship on the `beta` channel
|
|
63
|
-
(`npm install @mega-yfue/eufy-sdk@beta`) while a version is still under review.
|
|
64
|
-
|
|
65
62
|
**Node.js ≥ 24.5.0** is required, not just recommended (see [`.nvmrc`](./.nvmrc)). `ffmpeg` is
|
|
66
63
|
optional — only the live JPEG snapshot and one-shot mp4 record paths use it,
|
|
67
64
|
and a host that ships its own build names it with `new EufyMega({ ffmpegPath })` rather than needing
|
|
@@ -69,34 +66,13 @@ one on `PATH`.
|
|
|
69
66
|
|
|
70
67
|
## Documentation
|
|
71
68
|
|
|
72
|
-
The guides at **<https://mega-yfue.github.io/>**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
in [`examples/`](./examples/).
|
|
76
|
-
|
|
77
|
-
## Design
|
|
78
|
-
|
|
79
|
-
Four layers, one dependency direction — `core` → `transport` → `model` → `client`:
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
src/
|
|
83
|
-
core/ shared floor: crypto, cross-layer contracts, value types, session store
|
|
84
|
-
transport/ every byte-on-a-wire module: http, mqtt, p2p, push, tuya
|
|
85
|
-
model/ Device + one self-contained module per capability
|
|
86
|
-
client/ the facade: login, device registry, event fan-out
|
|
87
|
-
index.ts public surface — one `export *` per layer barrel
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**Capability ↔ transport decorrelation is a hard, CI-enforced rule:** `model/` never imports
|
|
91
|
-
`transport/` and vice versa. A capability describes what a value MEANS; a transport moves bytes and
|
|
92
|
-
never names a feature. Anything genuinely shared is a contract in `core/`. That rule and the rest of
|
|
93
|
-
the code practice are in [AGENTS.md](./AGENTS.md).
|
|
94
|
-
|
|
95
|
-
Three runtime dependencies — `mqtt`, `protobufjs`, `jpeg-js` — and that is deliberate. HTTP is native
|
|
96
|
-
`fetch`, hashing and ciphers are `node:crypto`, 64-bit integers are `BigInt`.
|
|
69
|
+
The guides at **<https://mega-yfue.github.io/>** cover installing and logging in, devices and
|
|
70
|
+
capabilities, events and realtime transports, consuming live media, and the generated API reference.
|
|
71
|
+
Runnable, typechecked samples live in [`examples/`](./examples/).
|
|
97
72
|
|
|
98
|
-
|
|
99
|
-
|
|
73
|
+
The architecture — four layers with one dependency direction, and the CI-enforced rule that keeps
|
|
74
|
+
capabilities and transports from importing each other — is in [AGENTS.md](./AGENTS.md), with the rest of
|
|
75
|
+
the code practice.
|
|
100
76
|
|
|
101
77
|
## Develop
|
|
102
78
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mega-yfue/eufy-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-beta.1",
|
|
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",
|