@camstack/addon-provider-reolink 1.2.149 → 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
@@ -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;
@@ -155137,6 +155152,12 @@ var RefreshSettingsResultSchema = object({
155137
155152
  capsWarmed: number(),
155138
155153
  capsTotal: number()
155139
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
+ }
155140
155161
  var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155141
155162
  type = DeviceType.Camera;
155142
155163
  /**
@@ -155954,11 +155975,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155954
155975
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155955
155976
  }
155956
155977
  getClipDeviceRef() {
155957
- const uid = this.config.get("uid");
155978
+ const configUid = this.config.get("uid");
155958
155979
  return {
155959
155980
  deviceId: this.id,
155960
155981
  channel: this.getChannel(),
155961
- uid: typeof uid === "string" && uid.length > 0 ? uid : void 0,
155982
+ uid: resolveCameraUid({
155983
+ metadataUid: metaUid(this.ctx.deviceMeta.metadata),
155984
+ configUid: typeof configUid === "string" ? configUid : void 0
155985
+ }),
155962
155986
  isHubChild: this.isHubChild(),
155963
155987
  isBattery: this.isBattery,
155964
155988
  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;
@@ -155132,6 +155147,12 @@ var RefreshSettingsResultSchema = object({
155132
155147
  capsWarmed: number(),
155133
155148
  capsTotal: number()
155134
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
+ }
155135
155156
  var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155136
155157
  type = DeviceType.Camera;
155137
155158
  /**
@@ -155949,11 +155970,14 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
155949
155970
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
155950
155971
  }
155951
155972
  getClipDeviceRef() {
155952
- const uid = this.config.get("uid");
155973
+ const configUid = this.config.get("uid");
155953
155974
  return {
155954
155975
  deviceId: this.id,
155955
155976
  channel: this.getChannel(),
155956
- uid: typeof uid === "string" && uid.length > 0 ? uid : void 0,
155977
+ uid: resolveCameraUid({
155978
+ metadataUid: metaUid(this.ctx.deviceMeta.metadata),
155979
+ configUid: typeof configUid === "string" ? configUid : void 0
155980
+ }),
155957
155981
  isHubChild: this.isHubChild(),
155958
155982
  isBattery: this.isBattery,
155959
155983
  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.155",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",