@camstack/addon-provider-reolink 1.1.14 → 1.1.15

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
@@ -223228,6 +223228,47 @@ function buildCreationFormSchema() {
223228
223228
  ] };
223229
223229
  }
223230
223230
  //#endregion
223231
+ //#region src/reolink-discovery-map.ts
223232
+ /**
223233
+ * Flatten a host (IP / hostname) into a flat row-key slug — shared by `generateStableId` and the
223234
+ * discovery candidate mapping so a host-keyed camera is detected as already onboarded on re-scan.
223235
+ */
223236
+ function slugifyReolinkHost(host) {
223237
+ return host.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
223238
+ }
223239
+ /**
223240
+ * Map discovered Reolink hosts to adoption {@link DiscoveryCandidate}s, de-duplicated by host (the
223241
+ * same camera can answer on more than one discovery method — UDP broadcast, ONVIF, HTTP scan). The
223242
+ * first responder for a host wins. Pure: no I/O.
223243
+ *
223244
+ * The authoritative stableId is `mac-<mac>` (learned during autodetect at adopt time), which discovery
223245
+ * can't produce — so a re-scan of a MAC-keyed camera may still show as addable. The `host-` key still
223246
+ * lets host-added cameras be detected as onboarded on re-scan.
223247
+ */
223248
+ function mapReolinkDiscoveryToCandidates(devices, credentials) {
223249
+ const username = credentials.username?.trim() ?? "";
223250
+ const password = credentials.password ?? "";
223251
+ const byHost = /* @__PURE__ */ new Map();
223252
+ for (const d of devices) if (!byHost.has(d.host)) byHost.set(d.host, d);
223253
+ return [...byHost.values()].map((d) => {
223254
+ const displayName = d.name ?? d.model ?? d.host;
223255
+ return {
223256
+ stableId: `host-${slugifyReolinkHost(d.host)}`,
223257
+ type: DeviceType.Camera,
223258
+ suggestedName: displayName,
223259
+ prefilledConfig: {
223260
+ name: displayName,
223261
+ host: d.host,
223262
+ transport: "auto",
223263
+ ...d.httpPort !== void 0 ? { port: d.httpPort } : {},
223264
+ ...d.uid ? { uid: d.uid } : {},
223265
+ ...username ? { username } : {},
223266
+ ...password ? { password } : {}
223267
+ }
223268
+ };
223269
+ });
223270
+ }
223271
+ //#endregion
223231
223272
  //#region src/autodetect-cache.ts
223232
223273
  var DEFAULT_TTL_MS = 6e4;
223233
223274
  var AutodetectCache = class {
@@ -223740,11 +223781,6 @@ function isMeaningfulIdentifier(s) {
223740
223781
  if (!s || s.length < 6) return false;
223741
223782
  return new Set(s.toLowerCase().split("").filter((c) => c !== "0" && c !== "f")).size >= 1;
223742
223783
  }
223743
- /** Flatten a host (IP / hostname) into a flat row-key slug — shared by `generateStableId` and the
223744
- * discovery candidate mapping so a host-keyed camera is detected as already onboarded on re-scan. */
223745
- function slugifyReolinkHost(host) {
223746
- return host.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
223747
- }
223748
223784
  /**
223749
223785
  * Patch `detection.deviceInfo` + `hostNetworkInfo` in-place with the
223750
223786
  * post-login HOST identifiers. Two distinct gaps to fill:
@@ -224039,24 +224075,9 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
224039
224075
  networkCidr: networkCidr || "local",
224040
224076
  enableOnvif
224041
224077
  } });
224042
- const byHost = /* @__PURE__ */ new Map();
224043
- for (const d of devices) if (!byHost.has(d.host)) byHost.set(d.host, d);
224044
- return [...byHost.values()].map((d) => {
224045
- const displayName = d.name ?? d.model ?? d.host;
224046
- return {
224047
- stableId: `host-${slugifyReolinkHost(d.host)}`,
224048
- type: DeviceType.Camera,
224049
- suggestedName: displayName,
224050
- prefilledConfig: {
224051
- name: displayName,
224052
- host: d.host,
224053
- transport: "auto",
224054
- ...d.httpPort !== void 0 ? { port: d.httpPort } : {},
224055
- ...d.uid ? { uid: d.uid } : {},
224056
- ...username ? { username } : {},
224057
- ...password ? { password } : {}
224058
- }
224059
- };
224078
+ return mapReolinkDiscoveryToCandidates(devices, {
224079
+ username,
224080
+ password
224060
224081
  });
224061
224082
  }
224062
224083
  async adoptDiscoveredDevice(input) {
package/dist/addon.mjs CHANGED
@@ -223208,6 +223208,47 @@ function buildCreationFormSchema() {
223208
223208
  ] };
223209
223209
  }
223210
223210
  //#endregion
223211
+ //#region src/reolink-discovery-map.ts
223212
+ /**
223213
+ * Flatten a host (IP / hostname) into a flat row-key slug — shared by `generateStableId` and the
223214
+ * discovery candidate mapping so a host-keyed camera is detected as already onboarded on re-scan.
223215
+ */
223216
+ function slugifyReolinkHost(host) {
223217
+ return host.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
223218
+ }
223219
+ /**
223220
+ * Map discovered Reolink hosts to adoption {@link DiscoveryCandidate}s, de-duplicated by host (the
223221
+ * same camera can answer on more than one discovery method — UDP broadcast, ONVIF, HTTP scan). The
223222
+ * first responder for a host wins. Pure: no I/O.
223223
+ *
223224
+ * The authoritative stableId is `mac-<mac>` (learned during autodetect at adopt time), which discovery
223225
+ * can't produce — so a re-scan of a MAC-keyed camera may still show as addable. The `host-` key still
223226
+ * lets host-added cameras be detected as onboarded on re-scan.
223227
+ */
223228
+ function mapReolinkDiscoveryToCandidates(devices, credentials) {
223229
+ const username = credentials.username?.trim() ?? "";
223230
+ const password = credentials.password ?? "";
223231
+ const byHost = /* @__PURE__ */ new Map();
223232
+ for (const d of devices) if (!byHost.has(d.host)) byHost.set(d.host, d);
223233
+ return [...byHost.values()].map((d) => {
223234
+ const displayName = d.name ?? d.model ?? d.host;
223235
+ return {
223236
+ stableId: `host-${slugifyReolinkHost(d.host)}`,
223237
+ type: DeviceType.Camera,
223238
+ suggestedName: displayName,
223239
+ prefilledConfig: {
223240
+ name: displayName,
223241
+ host: d.host,
223242
+ transport: "auto",
223243
+ ...d.httpPort !== void 0 ? { port: d.httpPort } : {},
223244
+ ...d.uid ? { uid: d.uid } : {},
223245
+ ...username ? { username } : {},
223246
+ ...password ? { password } : {}
223247
+ }
223248
+ };
223249
+ });
223250
+ }
223251
+ //#endregion
223211
223252
  //#region src/autodetect-cache.ts
223212
223253
  var DEFAULT_TTL_MS = 6e4;
223213
223254
  var AutodetectCache = class {
@@ -223720,11 +223761,6 @@ function isMeaningfulIdentifier(s) {
223720
223761
  if (!s || s.length < 6) return false;
223721
223762
  return new Set(s.toLowerCase().split("").filter((c) => c !== "0" && c !== "f")).size >= 1;
223722
223763
  }
223723
- /** Flatten a host (IP / hostname) into a flat row-key slug — shared by `generateStableId` and the
223724
- * discovery candidate mapping so a host-keyed camera is detected as already onboarded on re-scan. */
223725
- function slugifyReolinkHost(host) {
223726
- return host.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
223727
- }
223728
223764
  /**
223729
223765
  * Patch `detection.deviceInfo` + `hostNetworkInfo` in-place with the
223730
223766
  * post-login HOST identifiers. Two distinct gaps to fill:
@@ -224019,24 +224055,9 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
224019
224055
  networkCidr: networkCidr || "local",
224020
224056
  enableOnvif
224021
224057
  } });
224022
- const byHost = /* @__PURE__ */ new Map();
224023
- for (const d of devices) if (!byHost.has(d.host)) byHost.set(d.host, d);
224024
- return [...byHost.values()].map((d) => {
224025
- const displayName = d.name ?? d.model ?? d.host;
224026
- return {
224027
- stableId: `host-${slugifyReolinkHost(d.host)}`,
224028
- type: DeviceType.Camera,
224029
- suggestedName: displayName,
224030
- prefilledConfig: {
224031
- name: displayName,
224032
- host: d.host,
224033
- transport: "auto",
224034
- ...d.httpPort !== void 0 ? { port: d.httpPort } : {},
224035
- ...d.uid ? { uid: d.uid } : {},
224036
- ...username ? { username } : {},
224037
- ...password ? { password } : {}
224038
- }
224039
- };
224058
+ return mapReolinkDiscoveryToCandidates(devices, {
224059
+ username,
224060
+ password
224040
224061
  });
224041
224062
  }
224042
224063
  async adoptDiscoveredDevice(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.1.14",
3
+ "version": "1.1.15",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",