@mega-yfue/eufy-sdk 0.2.0-beta.7 → 0.2.0-beta.8

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.
@@ -4,11 +4,11 @@
4
4
  * Cloud APIs: the eufy v6 cloud (+ legacy, planned)
5
5
  * Realtime: secure MQTT (appliances) + P2P (cameras/HomeBases)
6
6
  *
7
- * const eufy = new EufyMega({ email, password, region: "eu" });
7
+ * const eufy = new EufyMega({ email, password, region: "eu-pr" });
8
8
  * await eufy.login(); // → LoginResult; on success the SDK auto-starts realtime (push/MQTT/wired P2P)
9
9
  * eufy.on("motion", (e) => console.log(e.deviceSn)); // typed semantic events — flowing already
10
10
  * const dev = await eufy.getDevice((await eufy.getDevices())[0].sn);
11
- * await dev.camera()?.snapshotStored();
11
+ * await dev.camera?.()?.snapshotStored?.();
12
12
  *
13
13
  * Connectivity is SDK-managed: the host calls no `connect*`. P2P to a battery camera is opened only
14
14
  * when a command/stream/doorbell-ring needs it and closed when idle, so the camera can sleep.
@@ -346,8 +346,8 @@ export declare class EufyMega extends EventEmitter {
346
346
  * @example
347
347
  * ```ts
348
348
  * const res = await eufy.login();
349
- * if (res.status === "captcha") await eufy.solveCaptcha(await ask(res.image));
350
- * else if (res.status === "2fa") await eufy.submitVerifyCode(await ask());
349
+ * if (res.status === "captcha") await eufy.solveCaptcha(await promptUser(res.image));
350
+ * else if (res.status === "2fa") await eufy.submitVerifyCode(await promptUser());
351
351
  * ```
352
352
  */
353
353
  login(opts?: {
@@ -493,7 +493,7 @@ export declare class EufyMega extends EventEmitter {
493
493
  * @example
494
494
  * ```ts
495
495
  * const dev = await eufy.getDevice(sn);
496
- * if (dev.has("camera")) await dev.camera()?.snapshotStored();
496
+ * if (dev.has("camera")) await dev.camera?.()?.snapshotStored?.();
497
497
  * console.log(dev.getProperty("battery"));
498
498
  * ```
499
499
  */
@@ -758,9 +758,9 @@ export interface MediaProvider {
758
758
  *
759
759
  * @example
760
760
  * ```ts
761
- * const stream = await cam.live();
762
- * stream.on("video", (frame) => write(frame.data)); // Annex-B
763
- * stream.stop(); // detach this consumer
761
+ * const stream = await cam.live?.();
762
+ * stream?.on("video", (frame) => sink.write(frame.data)); // Annex-B
763
+ * stream?.stop(); // detach this consumer
764
764
  * ```
765
765
  */
766
766
  live(opts?: SharedSourceHints & AbortableCall & Record<string, unknown>): Promise<LiveStreamConsumer>;
@@ -19,7 +19,9 @@ export type LogLevel = "debug" | "info" | "warn" | "error";
19
19
  * ```ts
20
20
  * // A custom sink (or pass a tslog / winston instance directly — they already match this shape):
21
21
  * const eufy = new EufyMega({
22
- * logger: { debug: (m, ...a) => log.debug(m, ...a), info: () => {}, warn: console.warn, error: console.error },
22
+ * email,
23
+ * password,
24
+ * logger: { debug: (m, ...a) => myLog.debug(m, ...a), info: () => {}, warn: console.warn, error: console.error },
23
25
  * });
24
26
  * ```
25
27
  */
@@ -38,8 +40,8 @@ export declare const noopLogger: Logger;
38
40
  *
39
41
  * @example
40
42
  * ```ts
41
- * const eufy = new EufyMega({ logger: new ConsoleLogger() }); // verbose
42
- * const quiet = new EufyMega({ logger: new ConsoleLogger("warn") }); // warn + error only
43
+ * const eufy = new EufyMega({ email, password, logger: new ConsoleLogger() }); // verbose
44
+ * const quiet = new EufyMega({ email, password, logger: new ConsoleLogger("warn") }); // warn + error only
43
45
  * ```
44
46
  */
45
47
  export declare class ConsoleLogger implements Logger {
package/dist/index.js CHANGED
@@ -24284,8 +24284,8 @@ var EufyMega = class extends EventEmitter9 {
24284
24284
  * @example
24285
24285
  * ```ts
24286
24286
  * const res = await eufy.login();
24287
- * if (res.status === "captcha") await eufy.solveCaptcha(await ask(res.image));
24288
- * else if (res.status === "2fa") await eufy.submitVerifyCode(await ask());
24287
+ * if (res.status === "captcha") await eufy.solveCaptcha(await promptUser(res.image));
24288
+ * else if (res.status === "2fa") await eufy.submitVerifyCode(await promptUser());
24289
24289
  * ```
24290
24290
  */
24291
24291
  async login(opts = {}) {
@@ -24610,7 +24610,7 @@ var EufyMega = class extends EventEmitter9 {
24610
24610
  * @example
24611
24611
  * ```ts
24612
24612
  * const dev = await eufy.getDevice(sn);
24613
- * if (dev.has("camera")) await dev.camera()?.snapshotStored();
24613
+ * if (dev.has("camera")) await dev.camera?.()?.snapshotStored?.();
24614
24614
  * console.log(dev.getProperty("battery"));
24615
24615
  * ```
24616
24616
  */