@mega-yfue/eufy-sdk 0.6.0-beta.26 → 0.6.0-beta.28

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.
@@ -135,6 +135,14 @@ export declare class EufyMega extends EventEmitter {
135
135
  * {@link disconnect}.
136
136
  */
137
137
  private readonly stationReopens;
138
+ /**
139
+ * Refuse the one misnamed option that misroutes silently. `country` is not read — the account country
140
+ * is {@link EufyMegaOptions.countryCode}, which defaults to `"US"` — so a caller that passes `country`
141
+ * has it ignored. We throw only for the case that changes routing: a non-`"US"` `country` with no
142
+ * `countryCode`, which would run on the US shard (login succeeds, but the house list comes back an empty
143
+ * placeholder). `country: "US"` already matches the default route, so it is left to pass through.
144
+ */
145
+ private static assertCountryOption;
138
146
  constructor(opts: EufyMegaOptions);
139
147
  /**
140
148
  * Builds the inbound listener that converts ThingClips DP maps to realtime capability state.
package/dist/index.js CHANGED
@@ -4779,6 +4779,9 @@ var BATTERY_MEMBERS = cellGated({
4779
4779
  * The headline percentage, and this capability's detection evidence: reporting 1101 is what proves a
4780
4780
  * device is battery-powered, which is also the fact `MediaProvider` reads to decide a stream needs a
4781
4781
  * power budget. Published flat as `battery` — `level` alone is claimed by `suction` too.
4782
+ *
4783
+ * Withheld on a device that resolved `lock`, whose own `battery` member reads the same param 1101 and
4784
+ * owns the `battery` property there, so the two do not both claim it.
4782
4785
  */
4783
4786
  level: {
4784
4787
  param: BATTERY_PARAM.BATTERY,
@@ -4787,6 +4790,7 @@ var BATTERY_MEMBERS = cellGated({
4787
4790
  unit: "%",
4788
4791
  kind: "percent",
4789
4792
  provenance: "verified",
4793
+ available: (ctx) => !hasCapability(ctx, "lock"),
4790
4794
  description: "Battery level 0-100 (verified: param 1101)."
4791
4795
  },
4792
4796
  /**
@@ -29568,7 +29572,7 @@ function readinessSnapshot(readiness, state = readiness.state) {
29568
29572
  wiredP2p: Object.freeze({ ...readiness.wiredP2p })
29569
29573
  });
29570
29574
  }
29571
- var EufyMega = class extends EventEmitter14 {
29575
+ var EufyMega = class _EufyMega extends EventEmitter14 {
29572
29576
  opts;
29573
29577
  mega;
29574
29578
  /**
@@ -29665,9 +29669,24 @@ var EufyMega = class extends EventEmitter14 {
29665
29669
  * {@link disconnect}.
29666
29670
  */
29667
29671
  stationReopens = /* @__PURE__ */ new Map();
29672
+ /**
29673
+ * Refuse the one misnamed option that misroutes silently. `country` is not read — the account country
29674
+ * is {@link EufyMegaOptions.countryCode}, which defaults to `"US"` — so a caller that passes `country`
29675
+ * has it ignored. We throw only for the case that changes routing: a non-`"US"` `country` with no
29676
+ * `countryCode`, which would run on the US shard (login succeeds, but the house list comes back an empty
29677
+ * placeholder). `country: "US"` already matches the default route, so it is left to pass through.
29678
+ */
29679
+ static assertCountryOption(opts) {
29680
+ if (!("country" in opts) || opts.countryCode !== void 0)
29681
+ return;
29682
+ if (String(opts.country ?? "").toUpperCase() === "US")
29683
+ return;
29684
+ throw new TypeError(`option "country" is not read; the account country is "countryCode". With "country" set and no "countryCode", this client would silently run as "US" \u2014 pass "countryCode" instead.`);
29685
+ }
29668
29686
  constructor(opts) {
29669
29687
  super();
29670
29688
  this.opts = opts;
29689
+ _EufyMega.assertCountryOption(opts);
29671
29690
  this.prewarmEvents = new Set(opts.prewarmEvents ?? []);
29672
29691
  this.prewarmTiers = new Set(opts.prewarmTiers ?? DEFAULT_PREWARM_TIERS);
29673
29692
  this.mega = new MegaHttpClient(opts);