@mega-yfue/eufy-sdk 0.6.0-beta.27 → 0.6.0-beta.29

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.
@@ -327,7 +335,8 @@ export declare class EufyMega extends EventEmitter {
327
335
  * receives nothing until a command dials it again. The first reopen runs at once; one that fails is
328
336
  * retried after {@link STATION_REOPEN_MIN_MS}, doubling up to {@link STATION_REOPEN_MAX_MS}, until the
329
337
  * session connects or the generation ends. One reopen is pending per station at a time, and each failure
330
- * is reported once, by {@link P2PCommandRouter.ensureStation}.
338
+ * is reported once, by {@link P2PCommandRouter.ensureStation}. A HomeBase S1 Pro (T9000) answers no P2P
339
+ * lookup, so it is never reopened.
331
340
  */
332
341
  private reopenWiredStation;
333
342
  /**
@@ -771,8 +780,9 @@ export declare class EufyMega extends EventEmitter {
771
780
  */
772
781
  keepStationWarm(stationSn: string): () => void;
773
782
  /** Eagerly open P2P sessions for WIRED stations only (persistent — they don't drain). Battery
774
- * stations stay closed until an on-demand open. Best-effort per station: one that fails is handed to
775
- * {@link reopenWiredStation}. */
783
+ * stations stay closed until an on-demand open, and a HomeBase S1 Pro (T9000), which answers no P2P
784
+ * lookup and is driven over RTC, is never opened here. Best-effort per station: one that fails is
785
+ * handed to {@link reopenWiredStation}. */
776
786
  private warmWiredP2P;
777
787
  /**
778
788
  * A station's power tier for the P2P lifecycle: a HomeBase/station is `"wired"` (persistent); a
@@ -788,10 +798,11 @@ export declare class EufyMega extends EventEmitter {
788
798
  * semantic event in — so a stream or talkback opened right after a doorbell ring or a detection starts
789
799
  * warm instead of paying a cold open.
790
800
  *
791
- * Four gates. `autoRealtime: false` means the SDK opens nothing on its own initiative at all;
801
+ * Five gates. `autoRealtime: false` means the SDK opens nothing on its own initiative at all;
792
802
  * {@link EufyMegaOptions.prewarmEvents} must name the event, and it names none by default, which is
793
- * what makes pre-warm opt-in; the station must be one the account actually reports; and its power tier
794
- * must be one {@link EufyMegaOptions.prewarmTiers} allows.
803
+ * what makes pre-warm opt-in; the station must be one the account actually reports; it must not be a
804
+ * HomeBase S1 Pro (T9000), which answers no P2P lookup and is driven over RTC; and its power tier must
805
+ * be one {@link EufyMegaOptions.prewarmTiers} allows.
795
806
  *
796
807
  * The tier is resolved for the STATION whose session would open, which is why an attached camera is
797
808
  * judged by its base — {@link P2PCommandRouter.stationKeyOf} is the single source of that mapping, and
package/dist/index.js CHANGED
@@ -29572,7 +29572,7 @@ function readinessSnapshot(readiness, state = readiness.state) {
29572
29572
  wiredP2p: Object.freeze({ ...readiness.wiredP2p })
29573
29573
  });
29574
29574
  }
29575
- var EufyMega = class extends EventEmitter14 {
29575
+ var EufyMega = class _EufyMega extends EventEmitter14 {
29576
29576
  opts;
29577
29577
  mega;
29578
29578
  /**
@@ -29669,9 +29669,24 @@ var EufyMega = class extends EventEmitter14 {
29669
29669
  * {@link disconnect}.
29670
29670
  */
29671
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
+ }
29672
29686
  constructor(opts) {
29673
29687
  super();
29674
29688
  this.opts = opts;
29689
+ _EufyMega.assertCountryOption(opts);
29675
29690
  this.prewarmEvents = new Set(opts.prewarmEvents ?? []);
29676
29691
  this.prewarmTiers = new Set(opts.prewarmTiers ?? DEFAULT_PREWARM_TIERS);
29677
29692
  this.mega = new MegaHttpClient(opts);
@@ -30194,7 +30209,8 @@ var EufyMega = class extends EventEmitter14 {
30194
30209
  * receives nothing until a command dials it again. The first reopen runs at once; one that fails is
30195
30210
  * retried after {@link STATION_REOPEN_MIN_MS}, doubling up to {@link STATION_REOPEN_MAX_MS}, until the
30196
30211
  * session connects or the generation ends. One reopen is pending per station at a time, and each failure
30197
- * is reported once, by {@link P2PCommandRouter.ensureStation}.
30212
+ * is reported once, by {@link P2PCommandRouter.ensureStation}. A HomeBase S1 Pro (T9000) answers no P2P
30213
+ * lookup, so it is never reopened.
30198
30214
  */
30199
30215
  reopenWiredStation(sn) {
30200
30216
  const generation = this.realtimeGeneration;
@@ -30202,7 +30218,7 @@ var EufyMega = class extends EventEmitter14 {
30202
30218
  return;
30203
30219
  if (this.p2p.stationKeyOf(sn) !== sn || !this.registry.p2pDevices().some((d) => d.sn === sn))
30204
30220
  return;
30205
- if (this.stationPower(sn) !== "wired")
30221
+ if (this.stationPower(sn) !== "wired" || this.stationOf(sn).t9000)
30206
30222
  return;
30207
30223
  const reopen = this.stationReopens.get(sn) ?? { timer: new Timer(), delayMs: 0 };
30208
30224
  this.stationReopens.set(sn, reopen);
@@ -31162,13 +31178,14 @@ var EufyMega = class extends EventEmitter14 {
31162
31178
  return this.rtc.keepWarm(route);
31163
31179
  }
31164
31180
  /** Eagerly open P2P sessions for WIRED stations only (persistent — they don't drain). Battery
31165
- * stations stay closed until an on-demand open. Best-effort per station: one that fails is handed to
31166
- * {@link reopenWiredStation}. */
31181
+ * stations stay closed until an on-demand open, and a HomeBase S1 Pro (T9000), which answers no P2P
31182
+ * lookup and is driven over RTC, is never opened here. Best-effort per station: one that fails is
31183
+ * handed to {@link reopenWiredStation}. */
31167
31184
  async warmWiredP2P(readiness = createPlaneReadiness(), signal) {
31168
31185
  const wired = /* @__PURE__ */ new Set();
31169
31186
  for (const d of this.registry.p2pDevices()) {
31170
31187
  const key = this.p2p.stationKeyOf(d.sn);
31171
- if (this.stationPower(key) === "wired")
31188
+ if (this.stationPower(key) === "wired" && !this.stationOf(key).t9000)
31172
31189
  wired.add(key);
31173
31190
  }
31174
31191
  readiness.required = wired.size;
@@ -31213,10 +31230,11 @@ var EufyMega = class extends EventEmitter14 {
31213
31230
  * semantic event in — so a stream or talkback opened right after a doorbell ring or a detection starts
31214
31231
  * warm instead of paying a cold open.
31215
31232
  *
31216
- * Four gates. `autoRealtime: false` means the SDK opens nothing on its own initiative at all;
31233
+ * Five gates. `autoRealtime: false` means the SDK opens nothing on its own initiative at all;
31217
31234
  * {@link EufyMegaOptions.prewarmEvents} must name the event, and it names none by default, which is
31218
- * what makes pre-warm opt-in; the station must be one the account actually reports; and its power tier
31219
- * must be one {@link EufyMegaOptions.prewarmTiers} allows.
31235
+ * what makes pre-warm opt-in; the station must be one the account actually reports; it must not be a
31236
+ * HomeBase S1 Pro (T9000), which answers no P2P lookup and is driven over RTC; and its power tier must
31237
+ * be one {@link EufyMegaOptions.prewarmTiers} allows.
31220
31238
  *
31221
31239
  * The tier is resolved for the STATION whose session would open, which is why an attached camera is
31222
31240
  * judged by its base — {@link P2PCommandRouter.stationKeyOf} is the single source of that mapping, and
@@ -31236,6 +31254,8 @@ var EufyMega = class extends EventEmitter14 {
31236
31254
  const station = this.p2p.stationKeyOf(deviceSn);
31237
31255
  if (!this.registry.list().some((device) => device.sn === station))
31238
31256
  return;
31257
+ if (this.stationOf(station).t9000)
31258
+ return;
31239
31259
  if (!this.prewarmTiers.has(this.stationPower(station)))
31240
31260
  return;
31241
31261
  void this.p2p.prewarm(station, this.opts.prewarmMs);