@camstack/addon-provider-reolink 1.2.150 → 1.2.155

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
@@ -151531,32 +151531,6 @@ var reolinkDebugActions = defineCustomActions({ debugRawRead: customAction(RawRe
151531
151531
  auth: "admin"
151532
151532
  }) });
151533
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
151560
151534
  //#region src/battery-charging.ts
151561
151535
  /**
151562
151536
  * Da `adapterStatus` + `chargeStatus` alla sorgente di alimentazione.
@@ -155178,6 +155152,12 @@ var RefreshSettingsResultSchema = object({
155178
155152
  capsWarmed: number(),
155179
155153
  capsTotal: number()
155180
155154
  });
155155
+ /** The uid out of a device's metadata bag, or nothing. Never a cast. */
155156
+ function metaUid(metadata) {
155157
+ if (metadata === null) return void 0;
155158
+ const uid = metadata["uid"];
155159
+ return typeof uid === "string" ? uid : void 0;
155160
+ }
155181
155161
  var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155182
155162
  type = DeviceType.Camera;
155183
155163
  /**
@@ -155546,7 +155526,6 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155546
155526
  meta: { error: err instanceof Error ? err.message : String(err) }
155547
155527
  });
155548
155528
  });
155549
- this.metadataUid = await readDeviceMetaUid(this.ctx.api, this.id);
155550
155529
  await this.refreshNetworkLinkFromApi(api, "probe");
155551
155530
  }
155552
155531
  /**
@@ -155995,22 +155974,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155995
155974
  async wakeForClipCatalogRefresh() {
155996
155975
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155997
155976
  }
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;
156007
155977
  getClipDeviceRef() {
156008
155978
  const configUid = this.config.get("uid");
156009
155979
  return {
156010
155980
  deviceId: this.id,
156011
155981
  channel: this.getChannel(),
156012
155982
  uid: resolveCameraUid({
156013
- metadataUid: this.metadataUid,
155983
+ metadataUid: metaUid(this.ctx.deviceMeta.metadata),
156014
155984
  configUid: typeof configUid === "string" ? configUid : void 0
156015
155985
  }),
156016
155986
  isHubChild: this.isHubChild(),
package/dist/addon.mjs CHANGED
@@ -151526,32 +151526,6 @@ var reolinkDebugActions = defineCustomActions({ debugRawRead: customAction(RawRe
151526
151526
  auth: "admin"
151527
151527
  }) });
151528
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
151555
151529
  //#region src/battery-charging.ts
151556
151530
  /**
151557
151531
  * Da `adapterStatus` + `chargeStatus` alla sorgente di alimentazione.
@@ -155173,6 +155147,12 @@ var RefreshSettingsResultSchema = object({
155173
155147
  capsWarmed: number(),
155174
155148
  capsTotal: number()
155175
155149
  });
155150
+ /** The uid out of a device's metadata bag, or nothing. Never a cast. */
155151
+ function metaUid(metadata) {
155152
+ if (metadata === null) return void 0;
155153
+ const uid = metadata["uid"];
155154
+ return typeof uid === "string" ? uid : void 0;
155155
+ }
155176
155156
  var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155177
155157
  type = DeviceType.Camera;
155178
155158
  /**
@@ -155541,7 +155521,6 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155541
155521
  meta: { error: err instanceof Error ? err.message : String(err) }
155542
155522
  });
155543
155523
  });
155544
- this.metadataUid = await readDeviceMetaUid(this.ctx.api, this.id);
155545
155524
  await this.refreshNetworkLinkFromApi(api, "probe");
155546
155525
  }
155547
155526
  /**
@@ -155990,22 +155969,13 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155990
155969
  async wakeForClipCatalogRefresh() {
155991
155970
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155992
155971
  }
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;
156002
155972
  getClipDeviceRef() {
156003
155973
  const configUid = this.config.get("uid");
156004
155974
  return {
156005
155975
  deviceId: this.id,
156006
155976
  channel: this.getChannel(),
156007
155977
  uid: resolveCameraUid({
156008
- metadataUid: this.metadataUid,
155978
+ metadataUid: metaUid(this.ctx.deviceMeta.metadata),
156009
155979
  configUid: typeof configUid === "string" ? configUid : void 0
156010
155980
  }),
156011
155981
  isHubChild: this.isHubChild(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.150",
3
+ "version": "1.2.155",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",