@mega-yfue/eufy-sdk 0.1.2 → 0.2.0-beta.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.
Files changed (2) hide show
  1. package/README.md +41 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,6 +23,11 @@
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
+
26
31
  ## What it is
27
32
 
28
33
  A TypeScript SDK for the Anker eufy cloud that the current eufy app speaks. It logs in (captcha and 2FA
@@ -32,18 +37,14 @@ you drive through a **typed, fluent API**:
32
37
  ```ts
33
38
  const dev = await eufy.getDevice(sn);
34
39
 
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);
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.panTilt()?.rotate(PtzDirection.left);
43
+ await dev.light()?.setBrightness(60);
39
44
 
40
- eufy.on("motion", (e) => console.log(e.deviceSn, "saw something"));
45
+ eufy.on("motion", (e) => console.log(e.device.name, "saw something"));
41
46
  ```
42
47
 
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
-
47
48
  Realtime arrives over **P2P** (cameras and HomeBases), **secure MQTT** (appliances) and **push**
48
49
  (events), all surfaced as typed semantic events. Live **video streaming** works, with one shared pull
49
50
  fanned out to every consumer.
@@ -55,10 +56,12 @@ code path and an unlisted or future device resolves the same way as a known one.
55
56
  ## Install
56
57
 
57
58
  ```bash
58
- npm install @mega-yfue/eufy-sdk # latest stable
59
- npm install @mega-yfue/eufy-sdk@beta # the prerelease of the version in review
59
+ npm install @mega-yfue/eufy-sdk
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
+
62
65
  **Node.js ≥ 24.5.0** is required, not just recommended (see [`.nvmrc`](./.nvmrc)). `ffmpeg` is
63
66
  optional — only the live JPEG snapshot and one-shot mp4 record paths use it,
64
67
  and a host that ships its own build names it with `new EufyMega({ ffmpegPath })` rather than needing
@@ -66,13 +69,34 @@ one on `PATH`.
66
69
 
67
70
  ## Documentation
68
71
 
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/).
72
+ The guides at **<https://mega-yfue.github.io/>** are the source of truth; this README stays a thin
73
+ landing page. They cover installing and logging in, devices and capabilities, events and realtime
74
+ transports, consuming live media, and the generated API reference. Runnable, typechecked samples live
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`.
72
97
 
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.
98
+ **Unverified write paths throw rather than guess.** Some writes are fire-and-forget, so a guessed
99
+ frame looks exactly like success; the SDK refuses instead of pretending.
76
100
 
77
101
  ## Develop
78
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.2.0-beta.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",