@mega-yfue/eufy-sdk 0.6.0-beta.43 → 0.6.0-beta.45

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.
@@ -1,4 +1,4 @@
1
- import type { CapabilityModule, CommandContext } from "./types.js";
1
+ import type { CapabilityModule, CommandContext, AvailabilityContext } from "./types.js";
2
2
  import { type Surface } from "./members.js";
3
3
  import type { Command } from "../../core/contracts.js";
4
4
  /**
@@ -54,10 +54,10 @@ export type AutoSpotlightOptions = {
54
54
  * is written out below.
55
55
  */
56
56
  export type LightActions = Surface<typeof LIGHT_MEMBERS> & {
57
- /** Turn the light on. Throws if this model's switch wire is unverified. */
58
- on(): Promise<void>;
59
- /** Turn the light off. Throws if this model's switch wire is unverified. */
60
- off(): Promise<void>;
57
+ /** Turn the light on. Absent on a model whose switch wire is unverified. */
58
+ on?(): Promise<void>;
59
+ /** Turn the light off. Absent on a model whose switch wire is unverified. */
60
+ off?(): Promise<void>;
61
61
  /**
62
62
  * Enable/disable the **motion-activated light** (auto-spotlight): the spotlight lights up when the
63
63
  * camera detects motion.
@@ -93,9 +93,8 @@ export declare const LIGHT_MEMBERS: {
93
93
  * So it reads on whenever any client is watching. The setting a user changes and expects to persist
94
94
  * is {@link spotlightEnabled}.
95
95
  *
96
- * The switch refuses for a reason a value check cannot give — this model's frame SHAPE is unconfirmed —
97
- * so `switchFrame` throws that reason and `bindMembers` turns it into the rejection, rather than
98
- * letting the generated "not a valid value" blame a boolean that was never the problem.
96
+ * The switch frame SHAPE is per family ({@link lightSwitchWire}), and the write is `unverifiedFor` the
97
+ * families it has no shape for.
99
98
  */
100
99
  readonly isOn: {
101
100
  readonly param: 1400;
@@ -104,7 +103,8 @@ export declare const LIGHT_MEMBERS: {
104
103
  readonly kind: "boolean";
105
104
  readonly provenance: "verified";
106
105
  readonly description: string;
107
- readonly write: (v: string | number | boolean, ctx: CommandContext) => Command;
106
+ readonly write: (v: string | number | boolean, ctx: CommandContext) => Command | undefined;
107
+ readonly unverifiedFor: (ctx: AvailabilityContext) => boolean;
108
108
  readonly writeAs: "set";
109
109
  readonly aliases: {
110
110
  readonly on: true;
@@ -142,6 +142,13 @@ export interface ValueMember {
142
142
  * distinction the intent path answers with rather than a generic "not supported".
143
143
  */
144
144
  unverified?: true;
145
+ /**
146
+ * {@link unverified}, decided per device: the write wire is confirmed on some families and not on the
147
+ * one this predicate answers `true` for. There the setter is not installed and the intent path throws,
148
+ * exactly as for a member that is unverified everywhere. Like `available`, a member that declares this
149
+ * lands its setter OPTIONAL on the surface, because whether it exists is a runtime fact.
150
+ */
151
+ unverifiedFor?: (ctx: AvailabilityContext) => boolean;
145
152
  /**
146
153
  * Extra names the intent path should route here, taking the caller's value as-is. Unlike
147
154
  * {@link aliases}, no value is supplied: it is the same write under a second name.
@@ -469,9 +476,13 @@ export type UnverifiedKeys<M extends Members> = {
469
476
  /**
470
477
  * Members whose presence is a runtime fact, so the surface must make a caller check: a write installed
471
478
  * only on the devices that prove they speak it ({@link ValueMember.requires}), or one whose wire is not
472
- * captured ({@link ValueMember.unverified}).
479
+ * captured ({@link ValueMember.unverified}) everywhere or on some families ({@link ValueMember.unverifiedFor}).
473
480
  */
474
481
  export type ConditionalKeys<M extends Members> = UnverifiedKeys<M> | {
482
+ [K in keyof M]: M[K] extends {
483
+ unverifiedFor: unknown;
484
+ } ? K : never;
485
+ }[keyof M] | {
475
486
  [K in keyof M]: M[K] extends {
476
487
  requires: readonly number[];
477
488
  } ? K : never;
@@ -632,8 +643,9 @@ export declare function kindRoutable(kind: Command["kind"], ctx: AvailabilityCon
632
643
  * identity and says so by throwing) and a method returning `Promise<void>` must not surprise a caller
633
644
  * chaining `.catch()`. Caught here once rather than in each module's own wrapper.
634
645
  *
635
- * A getter is skipped for a `writeOnly` or `unexposed` member, and a setter for an `unverified` one —
636
- * declared so the capability documents the device, never installed.
646
+ * A getter is skipped for a `writeOnly` or `unexposed` member, and a setter for an `unverified` one, or
647
+ * one whose `unverifiedFor` holds for this device — declared so the capability documents the device,
648
+ * never installed.
637
649
  */
638
650
  export declare function bindMembers<M extends Members>(members: M, deps: MemberDeps): Surface<M>;
639
651
  /**
@@ -178,6 +178,12 @@ export interface EventClaim {
178
178
  * and ignored where that is absent.
179
179
  */
180
180
  homeBaseAttached?: boolean;
181
+ /**
182
+ * Thing-description property identifiers whose presence is the evidence: the product's description,
183
+ * resolved for this device, lists at least one of them. Compared against
184
+ * {@link AvailabilityContext.things}, and ignored where that is absent.
185
+ */
186
+ things?: readonly string[];
181
187
  }
182
188
  /**
183
189
  * A decoded inbound event a capability wants surfaced on the SDK. `event` is the EufyMega event
@@ -86,6 +86,8 @@ export declare class Device {
86
86
  * answers a caller has to be able to tell apart.
87
87
  */
88
88
  private bound;
89
+ /** The product's thing description resolved for this device, as {@link bindActions} was given it. */
90
+ private things?;
89
91
  /**
90
92
  * Read-through freshness policy (injected by the facade via {@link setFreshnessPolicy}; the model
91
93
  * stays transport-free — it only calls the supplied `refresh`). Default: caching OFF
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mega-yfue/eufy-sdk",
3
- "version": "0.6.0-beta.43",
3
+ "version": "0.6.0-beta.45",
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",