@mega-yfue/eufy-sdk 0.5.0-beta.31 → 0.5.0-beta.33

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
@@ -196,6 +196,11 @@ var ConsoleLogger = class {
196
196
  }
197
197
  };
198
198
 
199
+ // dist/transport/token-echo.js
200
+ function withoutTokenEcho(text2) {
201
+ return text2.replace(/token\s*[=:]\s*"?[A-Za-z0-9._-]{8,}"?/gi, "token = <redacted>");
202
+ }
203
+
199
204
  // dist/transport/http/media-download.js
200
205
  import { lookup } from "node:dns/promises";
201
206
  import { BlockList, isIP } from "node:net";
@@ -1557,9 +1562,6 @@ var CONTENDED_SESSION_HINT = "the token was rejected again soon after it was las
1557
1562
  function tokenRejected(code, msg) {
1558
1563
  return code === EufyCloudErrorCode.SESSION_KICKED || /user_id is empty|invalid[^,]*\btoken\b|\btoken\b[^,]*(expired|error|not exist)|kicked|(?:\btoken\b|\bsession\b)[^,]*does not exist|unauthor/i.test(msg ?? "");
1559
1564
  }
1560
- function withoutTokenEcho(text2) {
1561
- return text2.replace(/token\s*[=:]\s*"?[A-Za-z0-9._-]{8,}"?/gi, "token = <redacted>");
1562
- }
1563
1565
  var MegaHttpClient = class {
1564
1566
  cfg;
1565
1567
  region;
@@ -23505,7 +23507,7 @@ var RtcSignalingClient = class extends EventEmitter9 {
23505
23507
  });
23506
23508
  const body = await res.json().catch(() => ({})) ?? {};
23507
23509
  if (!res.ok || body.code !== 0 || !body.data) {
23508
- throw new Error(`RTC sign for ${this.opts.stationSn} refused: HTTP ${res.status} code ${body.code ?? "?"} ${body.msg ?? ""}`.trim());
23510
+ throw new Error(`RTC sign for ${this.opts.stationSn} refused: HTTP ${res.status} code ${body.code ?? "?"} ${withoutTokenEcho(body.msg ?? "")}`.trim());
23509
23511
  }
23510
23512
  this.sign = body.data;
23511
23513
  return body.data;