@camstack/addon-provider-reolink 1.2.149 → 1.2.150

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/addon.js CHANGED
@@ -147939,6 +147939,21 @@ var ClipArtifactStore = class {
147939
147939
  };
147940
147940
  //#endregion
147941
147941
  //#region src/clips/clip-addressing.ts
147942
+ /**
147943
+ * The camera's uid, from the fresh copy where there is one.
147944
+ *
147945
+ * An empty or whitespace-only value is ABSENT, never a uid: it is how a
147946
+ * cleared settings field arrives, and passed on it addresses no camera at all
147947
+ * while making the refusal name the wrong cause.
147948
+ */
147949
+ function resolveCameraUid(sources) {
147950
+ return usable(sources.metadataUid) ?? usable(sources.configUid);
147951
+ }
147952
+ function usable(value) {
147953
+ if (typeof value !== "string") return void 0;
147954
+ const trimmed = value.trim();
147955
+ return trimmed.length === 0 ? void 0 : trimmed;
147956
+ }
147942
147957
  /** Does addressing this camera's catalog REQUIRE a persisted uid? */
147943
147958
  function uidIsRequired(subject) {
147944
147959
  return subject.isHubChild;
@@ -151516,6 +151531,32 @@ var reolinkDebugActions = defineCustomActions({ debugRawRead: customAction(RawRe
151516
151531
  auth: "admin"
151517
151532
  }) });
151518
151533
  //#endregion
151534
+ //#region src/device-meta-uid.ts
151535
+ function asDeviceMetaApi(api) {
151536
+ return typeof api === "object" && api !== null ? api : void 0;
151537
+ }
151538
+ function metadataUidOf(device) {
151539
+ if (typeof device !== "object" || device === null) return void 0;
151540
+ const metadata = device.metadata;
151541
+ if (typeof metadata !== "object" || metadata === null) return void 0;
151542
+ const uid = metadata.uid;
151543
+ return typeof uid === "string" ? uid : void 0;
151544
+ }
151545
+ /**
151546
+ * This device's `metadata.uid`, or `undefined` for every way of not having
151547
+ * one — absent, not a string, the RPC refused, the route missing. Never
151548
+ * throws.
151549
+ */
151550
+ async function readDeviceMetaUid(api, deviceId) {
151551
+ const query = asDeviceMetaApi(api)?.deviceManager?.getDevice?.query;
151552
+ if (query === void 0) return void 0;
151553
+ try {
151554
+ return metadataUidOf(await query({ deviceId }));
151555
+ } catch {
151556
+ return;
151557
+ }
151558
+ }
151559
+ //#endregion
151519
151560
  //#region src/battery-charging.ts
151520
151561
  /**
151521
151562
  * Da `adapterStatus` + `chargeStatus` alla sorgente di alimentazione.
@@ -155505,6 +155546,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155505
155546
  meta: { error: err instanceof Error ? err.message : String(err) }
155506
155547
  });
155507
155548
  });
155549
+ this.metadataUid = await readDeviceMetaUid(this.ctx.api, this.id);
155508
155550
  await this.refreshNetworkLinkFromApi(api, "probe");
155509
155551
  }
155510
155552
  /**
@@ -155953,12 +155995,24 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155953
155995
  async wakeForClipCatalogRefresh() {
155954
155996
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155955
155997
  }
155998
+ /**
155999
+ * `deviceMeta.metadata.uid`, read once per addon start in {@link onProbe}.
156000
+ *
156001
+ * In memory, never persisted: a third copy of a fact the device manager
156002
+ * already owns is the very thing that produced this defect (D224). A
156003
+ * physical camera's uid does not change, so one read per process is enough,
156004
+ * and until it lands the adoption copy is what answers.
156005
+ */
156006
+ metadataUid = void 0;
155956
156007
  getClipDeviceRef() {
155957
- const uid = this.config.get("uid");
156008
+ const configUid = this.config.get("uid");
155958
156009
  return {
155959
156010
  deviceId: this.id,
155960
156011
  channel: this.getChannel(),
155961
- uid: typeof uid === "string" && uid.length > 0 ? uid : void 0,
156012
+ uid: resolveCameraUid({
156013
+ metadataUid: this.metadataUid,
156014
+ configUid: typeof configUid === "string" ? configUid : void 0
156015
+ }),
155962
156016
  isHubChild: this.isHubChild(),
155963
156017
  isBattery: this.isBattery,
155964
156018
  sleeping: this.sleeping,
package/dist/addon.mjs CHANGED
@@ -147934,6 +147934,21 @@ var ClipArtifactStore = class {
147934
147934
  };
147935
147935
  //#endregion
147936
147936
  //#region src/clips/clip-addressing.ts
147937
+ /**
147938
+ * The camera's uid, from the fresh copy where there is one.
147939
+ *
147940
+ * An empty or whitespace-only value is ABSENT, never a uid: it is how a
147941
+ * cleared settings field arrives, and passed on it addresses no camera at all
147942
+ * while making the refusal name the wrong cause.
147943
+ */
147944
+ function resolveCameraUid(sources) {
147945
+ return usable(sources.metadataUid) ?? usable(sources.configUid);
147946
+ }
147947
+ function usable(value) {
147948
+ if (typeof value !== "string") return void 0;
147949
+ const trimmed = value.trim();
147950
+ return trimmed.length === 0 ? void 0 : trimmed;
147951
+ }
147937
147952
  /** Does addressing this camera's catalog REQUIRE a persisted uid? */
147938
147953
  function uidIsRequired(subject) {
147939
147954
  return subject.isHubChild;
@@ -151511,6 +151526,32 @@ var reolinkDebugActions = defineCustomActions({ debugRawRead: customAction(RawRe
151511
151526
  auth: "admin"
151512
151527
  }) });
151513
151528
  //#endregion
151529
+ //#region src/device-meta-uid.ts
151530
+ function asDeviceMetaApi(api) {
151531
+ return typeof api === "object" && api !== null ? api : void 0;
151532
+ }
151533
+ function metadataUidOf(device) {
151534
+ if (typeof device !== "object" || device === null) return void 0;
151535
+ const metadata = device.metadata;
151536
+ if (typeof metadata !== "object" || metadata === null) return void 0;
151537
+ const uid = metadata.uid;
151538
+ return typeof uid === "string" ? uid : void 0;
151539
+ }
151540
+ /**
151541
+ * This device's `metadata.uid`, or `undefined` for every way of not having
151542
+ * one — absent, not a string, the RPC refused, the route missing. Never
151543
+ * throws.
151544
+ */
151545
+ async function readDeviceMetaUid(api, deviceId) {
151546
+ const query = asDeviceMetaApi(api)?.deviceManager?.getDevice?.query;
151547
+ if (query === void 0) return void 0;
151548
+ try {
151549
+ return metadataUidOf(await query({ deviceId }));
151550
+ } catch {
151551
+ return;
151552
+ }
151553
+ }
151554
+ //#endregion
151514
151555
  //#region src/battery-charging.ts
151515
151556
  /**
151516
151557
  * Da `adapterStatus` + `chargeStatus` alla sorgente di alimentazione.
@@ -155500,6 +155541,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155500
155541
  meta: { error: err instanceof Error ? err.message : String(err) }
155501
155542
  });
155502
155543
  });
155544
+ this.metadataUid = await readDeviceMetaUid(this.ctx.api, this.id);
155503
155545
  await this.refreshNetworkLinkFromApi(api, "probe");
155504
155546
  }
155505
155547
  /**
@@ -155948,12 +155990,24 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155948
155990
  async wakeForClipCatalogRefresh() {
155949
155991
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155950
155992
  }
155993
+ /**
155994
+ * `deviceMeta.metadata.uid`, read once per addon start in {@link onProbe}.
155995
+ *
155996
+ * In memory, never persisted: a third copy of a fact the device manager
155997
+ * already owns is the very thing that produced this defect (D224). A
155998
+ * physical camera's uid does not change, so one read per process is enough,
155999
+ * and until it lands the adoption copy is what answers.
156000
+ */
156001
+ metadataUid = void 0;
155951
156002
  getClipDeviceRef() {
155952
- const uid = this.config.get("uid");
156003
+ const configUid = this.config.get("uid");
155953
156004
  return {
155954
156005
  deviceId: this.id,
155955
156006
  channel: this.getChannel(),
155956
- uid: typeof uid === "string" && uid.length > 0 ? uid : void 0,
156007
+ uid: resolveCameraUid({
156008
+ metadataUid: this.metadataUid,
156009
+ configUid: typeof configUid === "string" ? configUid : void 0
156010
+ }),
155957
156011
  isHubChild: this.isHubChild(),
155958
156012
  isBattery: this.isBattery,
155959
156013
  sleeping: this.sleeping,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.149",
3
+ "version": "1.2.150",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",