@camstack/addon-provider-reolink 0.1.1
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/assets/icon.svg +1 -0
- package/dist/addon.d.mts +72 -0
- package/dist/addon.d.ts +72 -0
- package/dist/addon.js +7115 -0
- package/dist/addon.js.map +1 -0
- package/dist/addon.mjs +7 -0
- package/dist/addon.mjs.map +1 -0
- package/dist/chunk-QQBDPNVO.mjs +7146 -0
- package/dist/chunk-QQBDPNVO.mjs.map +1 -0
- package/dist/index.d.mts +924 -0
- package/dist/index.d.ts +924 -0
- package/dist/index.js +7121 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +84 -0
package/assets/icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" id="Layer_1" x="0" y="0" version="1.1" viewBox="0 0 512 512"><style>.st0{fill:#1ea2e9}</style><path d="M62.9 87.7C155.8-18.8 317.5-29.9 424.1 63.1c37.7 32.9 65 76.1 78.4 124.4 35 126-30.7 258.1-152.2 306.3-32.5 12.7-67.1 18.9-101.9 18.2-82.7-1.2-165.5 0-248.2-1.1V252.5c.5-60.7 22.7-119.1 62.7-164.8m72 47.7c-32.2 32.2-50.2 75.9-50.1 121.4-.3 56.3 0 112.7 0 169 50.5 1.5 100.9 0 151.4 1.1 27.2.7 54.9-1.1 80.3-11.5 88.2-33.5 132.6-132.1 99.1-220.3S283.4 62.6 195.2 96c-22.7 8.6-43.3 22-60.4 39.2z" class="st0"/><path d="M182.9 158.9c53.3-40.6 129.5-30.3 170.1 23s30.3 129.5-23 170.1c-20 15.3-44.3 23.9-69.4 24.8-42 .5-84-.9-126.1-.5v-124c.9-36.9 18.8-71.3 48.4-93.4" class="st0"/></svg>
|
package/dist/addon.d.mts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseDeviceProvider, DeviceType, DeviceConstructor, IDevice, ProviderRegistration, ConfigUISchema, CreateDeviceSpec, FieldProbeResult } from '@camstack/types';
|
|
2
|
+
|
|
3
|
+
declare class ReolinkProviderAddon extends BaseDeviceProvider {
|
|
4
|
+
protected readonly addonId = "provider-reolink";
|
|
5
|
+
protected readonly providerName = "Reolink";
|
|
6
|
+
protected readonly deviceClasses: Partial<Record<DeviceType, DeviceConstructor<IDevice>>>;
|
|
7
|
+
/**
|
|
8
|
+
* Short-lived cache that bridges `testCreationField` and
|
|
9
|
+
* `onCreateDevice` — Slice 15 socket reuse. Both code paths key off
|
|
10
|
+
* `AutodetectCache.keyFor({host, username, password, uid, transport})`
|
|
11
|
+
* so a Test click and the subsequent Save share one Baichuan login.
|
|
12
|
+
*/
|
|
13
|
+
private readonly autodetectCache;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Reolink stableId derivation — uniform `mac → host(IP)` chain for
|
|
17
|
+
* every device type (camera, NVR, Home Hub).
|
|
18
|
+
*
|
|
19
|
+
* Priority:
|
|
20
|
+
* 1. mac — hardware MAC from post-login `getNetworkInfo` (cmd 76+93,
|
|
21
|
+
* no channel → host's interface). Durable across firmware
|
|
22
|
+
* updates + DHCP renewals. Persisted in `deviceCache.mac`
|
|
23
|
+
* by `onCreateDevice` AFTER `enrichHostIdentifiersFromLiveApi`.
|
|
24
|
+
* 2. host — operator-typed IP/hostname (DHCP-reservable). Always
|
|
25
|
+
* present on Reolink adds (`onCreateDevice` validates
|
|
26
|
+
* `persistHost` is non-empty before this code path).
|
|
27
|
+
*
|
|
28
|
+
* The legacy uid / serialNumber / autodetect deviceInfo data are NOT
|
|
29
|
+
* used for the stable key — they're often unreliable on the lib's
|
|
30
|
+
* TCP path (e.g. Home Hub returns `serialNumber: "00000000000000"`
|
|
31
|
+
* sentinel + the lib substitutes channel-0 data into `deviceInfo`
|
|
32
|
+
* when host probes flap mid-handshake). The mac/host chain is uniform
|
|
33
|
+
* and works on every Reolink device the lib supports.
|
|
34
|
+
*
|
|
35
|
+
* Re-adopt safety: re-adding the same physical device with its mac
|
|
36
|
+
* resolved reuses the same row. If the mac wasn't resolved (rare —
|
|
37
|
+
* `getNetworkInfo` works on every Reolink firmware we've tested),
|
|
38
|
+
* the host fallback at least gives a stable row per IP — operator
|
|
39
|
+
* can DHCP-reserve to make this durable.
|
|
40
|
+
*/
|
|
41
|
+
protected generateStableId(_type: DeviceType, config?: Record<string, unknown>): string;
|
|
42
|
+
protected onShutdown(): Promise<void>;
|
|
43
|
+
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Handle a broker-issued source-refresh request. With the lazy-publish
|
|
46
|
+
* model the broker always emits this on first dial of a
|
|
47
|
+
* `lazy:rfc4571:` placeholder URL — and re-emits it whenever the
|
|
48
|
+
* upstream rfc4571 socket idle-tears-down between consumer windows.
|
|
49
|
+
* We respond by materializing ONLY the requested camStream's upstream
|
|
50
|
+
* Baichuan session (`materializeStreamSocket`) — never republishing
|
|
51
|
+
* the full stream list. That keeps the firmware-side session count at
|
|
52
|
+
* "one per actively-watched (channel, profile) tuple" and avoids
|
|
53
|
+
* burning sessions on unrelated streams.
|
|
54
|
+
*
|
|
55
|
+
* The legacy fallback (when `camStreamId` is missing) re-publishes
|
|
56
|
+
* the full lazy stream list — the broker can then re-issue refresh
|
|
57
|
+
* for whichever stream needs it.
|
|
58
|
+
*/
|
|
59
|
+
private refreshDeviceStreams;
|
|
60
|
+
protected onGetCreationSchema(type: DeviceType): Promise<ConfigUISchema | null>;
|
|
61
|
+
protected onCreateDevice(type: DeviceType, config: Record<string, unknown>): Promise<CreateDeviceSpec>;
|
|
62
|
+
private applyNvrCgiSanityCheck;
|
|
63
|
+
testCreationField(input: {
|
|
64
|
+
type: DeviceType;
|
|
65
|
+
key: string;
|
|
66
|
+
value: unknown;
|
|
67
|
+
formValues?: Record<string, unknown>;
|
|
68
|
+
}): Promise<FieldProbeResult>;
|
|
69
|
+
private republishAll;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { ReolinkProviderAddon };
|
package/dist/addon.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { BaseDeviceProvider, DeviceType, DeviceConstructor, IDevice, ProviderRegistration, ConfigUISchema, CreateDeviceSpec, FieldProbeResult } from '@camstack/types';
|
|
2
|
+
|
|
3
|
+
declare class ReolinkProviderAddon extends BaseDeviceProvider {
|
|
4
|
+
protected readonly addonId = "provider-reolink";
|
|
5
|
+
protected readonly providerName = "Reolink";
|
|
6
|
+
protected readonly deviceClasses: Partial<Record<DeviceType, DeviceConstructor<IDevice>>>;
|
|
7
|
+
/**
|
|
8
|
+
* Short-lived cache that bridges `testCreationField` and
|
|
9
|
+
* `onCreateDevice` — Slice 15 socket reuse. Both code paths key off
|
|
10
|
+
* `AutodetectCache.keyFor({host, username, password, uid, transport})`
|
|
11
|
+
* so a Test click and the subsequent Save share one Baichuan login.
|
|
12
|
+
*/
|
|
13
|
+
private readonly autodetectCache;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Reolink stableId derivation — uniform `mac → host(IP)` chain for
|
|
17
|
+
* every device type (camera, NVR, Home Hub).
|
|
18
|
+
*
|
|
19
|
+
* Priority:
|
|
20
|
+
* 1. mac — hardware MAC from post-login `getNetworkInfo` (cmd 76+93,
|
|
21
|
+
* no channel → host's interface). Durable across firmware
|
|
22
|
+
* updates + DHCP renewals. Persisted in `deviceCache.mac`
|
|
23
|
+
* by `onCreateDevice` AFTER `enrichHostIdentifiersFromLiveApi`.
|
|
24
|
+
* 2. host — operator-typed IP/hostname (DHCP-reservable). Always
|
|
25
|
+
* present on Reolink adds (`onCreateDevice` validates
|
|
26
|
+
* `persistHost` is non-empty before this code path).
|
|
27
|
+
*
|
|
28
|
+
* The legacy uid / serialNumber / autodetect deviceInfo data are NOT
|
|
29
|
+
* used for the stable key — they're often unreliable on the lib's
|
|
30
|
+
* TCP path (e.g. Home Hub returns `serialNumber: "00000000000000"`
|
|
31
|
+
* sentinel + the lib substitutes channel-0 data into `deviceInfo`
|
|
32
|
+
* when host probes flap mid-handshake). The mac/host chain is uniform
|
|
33
|
+
* and works on every Reolink device the lib supports.
|
|
34
|
+
*
|
|
35
|
+
* Re-adopt safety: re-adding the same physical device with its mac
|
|
36
|
+
* resolved reuses the same row. If the mac wasn't resolved (rare —
|
|
37
|
+
* `getNetworkInfo` works on every Reolink firmware we've tested),
|
|
38
|
+
* the host fallback at least gives a stable row per IP — operator
|
|
39
|
+
* can DHCP-reserve to make this durable.
|
|
40
|
+
*/
|
|
41
|
+
protected generateStableId(_type: DeviceType, config?: Record<string, unknown>): string;
|
|
42
|
+
protected onShutdown(): Promise<void>;
|
|
43
|
+
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Handle a broker-issued source-refresh request. With the lazy-publish
|
|
46
|
+
* model the broker always emits this on first dial of a
|
|
47
|
+
* `lazy:rfc4571:` placeholder URL — and re-emits it whenever the
|
|
48
|
+
* upstream rfc4571 socket idle-tears-down between consumer windows.
|
|
49
|
+
* We respond by materializing ONLY the requested camStream's upstream
|
|
50
|
+
* Baichuan session (`materializeStreamSocket`) — never republishing
|
|
51
|
+
* the full stream list. That keeps the firmware-side session count at
|
|
52
|
+
* "one per actively-watched (channel, profile) tuple" and avoids
|
|
53
|
+
* burning sessions on unrelated streams.
|
|
54
|
+
*
|
|
55
|
+
* The legacy fallback (when `camStreamId` is missing) re-publishes
|
|
56
|
+
* the full lazy stream list — the broker can then re-issue refresh
|
|
57
|
+
* for whichever stream needs it.
|
|
58
|
+
*/
|
|
59
|
+
private refreshDeviceStreams;
|
|
60
|
+
protected onGetCreationSchema(type: DeviceType): Promise<ConfigUISchema | null>;
|
|
61
|
+
protected onCreateDevice(type: DeviceType, config: Record<string, unknown>): Promise<CreateDeviceSpec>;
|
|
62
|
+
private applyNvrCgiSanityCheck;
|
|
63
|
+
testCreationField(input: {
|
|
64
|
+
type: DeviceType;
|
|
65
|
+
key: string;
|
|
66
|
+
value: unknown;
|
|
67
|
+
formValues?: Record<string, unknown>;
|
|
68
|
+
}): Promise<FieldProbeResult>;
|
|
69
|
+
private republishAll;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { ReolinkProviderAddon };
|