@camstack/addon-provider-reolink 1.2.225 → 1.2.226

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.226] - 2026-11-05
11
+
12
+ ### Changed
13
+
14
+ - Cameras whose host reports an unknown time zone (Etc/Unknown) no longer fail the clip catalog refresh; it falls back to the camera's offset or UTC.
15
+
10
16
  ## [1.2.225] - 2026-11-05
11
17
 
12
18
  ### Changed
package/dist/addon.js CHANGED
@@ -206809,6 +206809,46 @@ var IntercomFailureReport = class {
206809
206809
  /** The process-wide instance every camera in this addon notes into. */
206810
206810
  var intercomFailureReport = new IntercomFailureReport();
206811
206811
  //#endregion
206812
+ //#region src/clips/clip-time-zone.ts
206813
+ function isUsableTimeZone(timeZone) {
206814
+ try {
206815
+ new Intl.DateTimeFormat("en-US", { timeZone });
206816
+ return true;
206817
+ } catch {
206818
+ return false;
206819
+ }
206820
+ }
206821
+ /**
206822
+ * @param candidate the zone the process reports
206823
+ * @param cameraZone a zone derived from the camera's reported UTC offset, if any
206824
+ */
206825
+ function resolveClipTimeZone(candidate, cameraZone) {
206826
+ if (isUsableTimeZone(candidate)) return { timeZone: candidate };
206827
+ if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
206828
+ timeZone: cameraZone,
206829
+ rejected: candidate
206830
+ };
206831
+ return {
206832
+ timeZone: "UTC",
206833
+ rejected: candidate
206834
+ };
206835
+ }
206836
+ /** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
206837
+ function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
206838
+ const res = resolveClipTimeZone(candidate, cameraZone);
206839
+ if (res.rejected !== void 0 && !warned.done) {
206840
+ warned.done = true;
206841
+ logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
206842
+ tags: { deviceId },
206843
+ meta: {
206844
+ rejectedTimeZone: res.rejected,
206845
+ fallbackTimeZone: res.timeZone
206846
+ }
206847
+ });
206848
+ }
206849
+ return res.timeZone;
206850
+ }
206851
+ //#endregion
206812
206852
  //#region src/baichuan-webhook-shared.ts
206813
206853
  /** The data-plane prefix this addon serves the camera push on: `/addon/<addonId>/webhook/<stableId>`. */
206814
206854
  var BAICHUAN_WEBHOOK_PREFIX = "webhook";
@@ -213268,6 +213308,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
213268
213308
  async wakeForClipCatalogRefresh() {
213269
213309
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
213270
213310
  }
213311
+ clipTimeZoneWarned = { done: false };
213271
213312
  getClipDeviceRef() {
213272
213313
  const configUid = this.config.get("uid");
213273
213314
  return {
@@ -213280,7 +213321,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
213280
213321
  isHubChild: this.isHubChild(),
213281
213322
  isBattery: this.isBattery,
213282
213323
  sleeping: this.sleeping,
213283
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
213324
+ timeZone: resolveClipTimeZoneOnce(Intl.DateTimeFormat().resolvedOptions().timeZone, reolinkTimeZoneToIana(this.config.get("deviceCache")?.systemGeneralSnapshot?.timeZone), this.ctx.logger, this.id, this.clipTimeZoneWarned),
213284
213325
  hostKey: String(this.config.get("host") ?? `device-${this.id}`),
213285
213326
  getApi: () => this.ensureApi()
213286
213327
  };
package/dist/addon.mjs CHANGED
@@ -206801,6 +206801,46 @@ var IntercomFailureReport = class {
206801
206801
  /** The process-wide instance every camera in this addon notes into. */
206802
206802
  var intercomFailureReport = new IntercomFailureReport();
206803
206803
  //#endregion
206804
+ //#region src/clips/clip-time-zone.ts
206805
+ function isUsableTimeZone(timeZone) {
206806
+ try {
206807
+ new Intl.DateTimeFormat("en-US", { timeZone });
206808
+ return true;
206809
+ } catch {
206810
+ return false;
206811
+ }
206812
+ }
206813
+ /**
206814
+ * @param candidate the zone the process reports
206815
+ * @param cameraZone a zone derived from the camera's reported UTC offset, if any
206816
+ */
206817
+ function resolveClipTimeZone(candidate, cameraZone) {
206818
+ if (isUsableTimeZone(candidate)) return { timeZone: candidate };
206819
+ if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
206820
+ timeZone: cameraZone,
206821
+ rejected: candidate
206822
+ };
206823
+ return {
206824
+ timeZone: "UTC",
206825
+ rejected: candidate
206826
+ };
206827
+ }
206828
+ /** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
206829
+ function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
206830
+ const res = resolveClipTimeZone(candidate, cameraZone);
206831
+ if (res.rejected !== void 0 && !warned.done) {
206832
+ warned.done = true;
206833
+ logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
206834
+ tags: { deviceId },
206835
+ meta: {
206836
+ rejectedTimeZone: res.rejected,
206837
+ fallbackTimeZone: res.timeZone
206838
+ }
206839
+ });
206840
+ }
206841
+ return res.timeZone;
206842
+ }
206843
+ //#endregion
206804
206844
  //#region src/baichuan-webhook-shared.ts
206805
206845
  /** The data-plane prefix this addon serves the camera push on: `/addon/<addonId>/webhook/<stableId>`. */
206806
206846
  var BAICHUAN_WEBHOOK_PREFIX = "webhook";
@@ -213260,6 +213300,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
213260
213300
  async wakeForClipCatalogRefresh() {
213261
213301
  if (!await this.wakeIfSleeping()) throw new Error(`ReolinkCamera ${this.id}: the authorised clip-refresh wake did not bring the camera up`);
213262
213302
  }
213303
+ clipTimeZoneWarned = { done: false };
213263
213304
  getClipDeviceRef() {
213264
213305
  const configUid = this.config.get("uid");
213265
213306
  return {
@@ -213272,7 +213313,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
213272
213313
  isHubChild: this.isHubChild(),
213273
213314
  isBattery: this.isBattery,
213274
213315
  sleeping: this.sleeping,
213275
- timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
213316
+ timeZone: resolveClipTimeZoneOnce(Intl.DateTimeFormat().resolvedOptions().timeZone, reolinkTimeZoneToIana(this.config.get("deviceCache")?.systemGeneralSnapshot?.timeZone), this.ctx.logger, this.id, this.clipTimeZoneWarned),
213276
213317
  hostKey: String(this.config.get("host") ?? `device-${this.id}`),
213277
213318
  getApi: () => this.ensureApi()
213278
213319
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.225",
3
+ "version": "1.2.226",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",
@@ -96,7 +96,7 @@
96
96
  "werift"
97
97
  ],
98
98
  "requires": {
99
- "server": ">=1.2.770"
99
+ "server": ">=1.2.771"
100
100
  }
101
101
  },
102
102
  "files": [