@apocaliss92/nodelink-js 0.4.33 → 0.4.34

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.
@@ -31253,6 +31253,17 @@ async function discoverViaUdpBroadcast(options) {
31253
31253
  }
31254
31254
 
31255
31255
  // src/reolink/autodetect.ts
31256
+ var ALL_UDP_DISCOVERY_METHODS = [
31257
+ "local-direct",
31258
+ "local-broadcast",
31259
+ "remote",
31260
+ "relay",
31261
+ "map"
31262
+ ];
31263
+ function selectViableUdpMethods(hasUid, methods = ALL_UDP_DISCOVERY_METHODS) {
31264
+ if (hasUid) return [...methods];
31265
+ return methods.filter((m) => m === "local-direct");
31266
+ }
31256
31267
  function normalizeUid(uid) {
31257
31268
  const v = uid?.trim();
31258
31269
  return v ? v : void 0;
@@ -31744,7 +31755,7 @@ async function autoDetectDeviceType(inputs) {
31744
31755
  }
31745
31756
  if (!normalizedUid) {
31746
31757
  logger?.log?.(
31747
- `[AutoDetect] UID discovery failed; will try local-direct without UID first.`
31758
+ `[AutoDetect] UID discovery failed; only local-direct can run without a UID. If the camera is sleeping or on a different subnet, supply its UID to enable BCUDP P2P fallback (remote/relay/map) which can wake it via Reolink's servers.`
31748
31759
  );
31749
31760
  }
31750
31761
  }
@@ -31797,8 +31808,7 @@ async function autoDetectDeviceType(inputs) {
31797
31808
  api: udpApi
31798
31809
  };
31799
31810
  };
31800
- const methodsToTry = ["local-direct", "local-broadcast", "remote", "relay", "map"];
31801
- const viableMethods = normalizedUid ? methodsToTry : methodsToTry.filter((m) => m === "local-direct" || m === "local-broadcast");
31811
+ const viableMethods = selectViableUdpMethods(Boolean(normalizedUid));
31802
31812
  return await runUdpMethodsParallel(
31803
31813
  viableMethods,
31804
31814
  async (m, isAborted) => {