@mega-yfue/eufy-sdk 0.2.0-beta.13 → 0.2.0-beta.14

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.
package/dist/index.js CHANGED
@@ -14876,6 +14876,11 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
14876
14876
  if (host && !this.closed)
14877
14877
  this.selfAddress = { host, port: boundPort };
14878
14878
  });
14879
+ this.trace({
14880
+ phase: "lookup-channels",
14881
+ local: !this.cfg.noBroadcast || this.cfg.localAddress !== void 0,
14882
+ cloud: this.cfg.dskKey !== void 0 && (this.cfg.cloudAddresses?.length ?? 0) > 0
14883
+ });
14879
14884
  this.sendLookups();
14880
14885
  this.lookupTimer = setInterval(() => this.sendLookups(), LOOKUP_RETRY_MS);
14881
14886
  this.connectTimer = setTimeout(() => {
@@ -14958,8 +14963,6 @@ var P2PSession = class _P2PSession extends EventEmitter2 {
14958
14963
  for (const addr of this.cfg.cloudAddresses)
14959
14964
  this.send(addr, type, payload);
14960
14965
  this.logger.debug(`[p2p] ${this.cfg.stationSn} sendLookups: cloud -> ${this.cfg.cloudAddresses.map((a) => `${a.host}:${a.port}`).join(", ")} self=${this.selfAddress?.host}:${this.selfAddress?.port}`);
14961
- } else {
14962
- this.logger.debug(`[p2p] ${this.cfg.stationSn} sendLookups: NO cloud lookup sent (dskKey=${!!this.cfg.dskKey} cloudAddresses=${this.cfg.cloudAddresses?.length ?? 0})`);
14963
14966
  }
14964
14967
  }
14965
14968
  /**
@@ -19392,7 +19395,6 @@ var FragmentRecording = class extends EventEmitter6 {
19392
19395
 
19393
19396
  // dist/transport/p2p/command-router.js
19394
19397
  var DIRECT_CMD_SENDS = 5;
19395
- var CONNECT_WAIT_MS = 2e4;
19396
19398
  function abortable(work, signal) {
19397
19399
  if (!signal)
19398
19400
  return work;
@@ -19407,7 +19409,7 @@ function abortable(work, signal) {
19407
19409
  var LEVEL2_GRACE_MS = 25e3;
19408
19410
  var LEVEL2_SETTLE_MS = 8e3;
19409
19411
  var P2P_STATION_WAITS = {
19410
- connect: CONNECT_WAIT_MS,
19412
+ connect: CONNECT_TIMEOUT_MS,
19411
19413
  level2Grace: LEVEL2_GRACE_MS,
19412
19414
  level2Settle: LEVEL2_SETTLE_MS
19413
19415
  };
@@ -20578,12 +20580,20 @@ var P2PCommandRouter = class _P2PCommandRouter {
20578
20580
  this.manager.bumpCommand(parentSn, parentSn);
20579
20581
  const channel = typeof raw.device_channel === "number" ? raw.device_channel : 0;
20580
20582
  const stationAdminId = raw.member?.admin_user_id;
20583
+ const stationModel = this.recordFor(parentSn)?.model;
20581
20584
  const accountId = stationAdminId ?? this.deps.mega.auth?.userId ?? "";
20585
+ this.traceOnStation(session, {
20586
+ phase: "station-resolved",
20587
+ topology: homeBaseAttached ? "attached" : "own",
20588
+ channel,
20589
+ stationAdmin: typeof stationAdminId !== "string" ? "unstated" : stationAdminId === this.deps.mega.auth?.userId ? "self" : "other",
20590
+ ...stationModel ? { stationModel } : {}
20591
+ });
20582
20592
  const t0 = Date.now();
20583
20593
  let waitedMs = 0;
20584
20594
  if (!session.isConnected) {
20585
- this.traceOnStation(session, { phase: "session-connect-wait", waitMs: CONNECT_WAIT_MS });
20586
- while (!session.isConnected && Date.now() - t0 < CONNECT_WAIT_MS) {
20595
+ this.traceOnStation(session, { phase: "session-connect-wait", waitMs: P2P_STATION_WAITS.connect });
20596
+ while (!session.isConnected && Date.now() - t0 < P2P_STATION_WAITS.connect) {
20587
20597
  opts.signal?.throwIfAborted();
20588
20598
  await sleep2(200);
20589
20599
  }
@@ -20593,12 +20603,6 @@ var P2PCommandRouter = class _P2PCommandRouter {
20593
20603
  opts.signal?.throwIfAborted();
20594
20604
  if (!session.isConnected)
20595
20605
  throw new StationUnreachableError(parentSn, waitedMs);
20596
- this.traceOnStation(session, {
20597
- phase: "station-resolved",
20598
- topology: homeBaseAttached ? "attached" : "own",
20599
- channel,
20600
- stationAdmin: typeof stationAdminId !== "string" ? "unstated" : stationAdminId === this.deps.mega.auth?.userId ? "self" : "other"
20601
- });
20602
20606
  if (opts.waitLevel2) {
20603
20607
  if (opts.waitLevel2 === "settle") {
20604
20608
  await abortable(session.awaitLevel2Key(LEVEL2_SETTLE_MS, "session"), opts.signal);
@@ -26616,6 +26620,7 @@ export {
26616
26620
  CLEAN_EXTENTS,
26617
26621
  CLEAN_FINISH_REASONS,
26618
26622
  CLEAN_PARAMS,
26623
+ CONNECT_TIMEOUT_MS,
26619
26624
  CONTACT_MEMBERS,
26620
26625
  CO_MEMBERS,
26621
26626
  CameraDisabledError,