unifi-protect 5.0.0 → 5.2.0
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/client/client.d.ts +1 -1
- package/dist/client/client.js +1 -1
- package/dist/client/connection.d.ts +1 -1
- package/dist/client/connection.js +3 -3
- package/dist/client/connection.js.map +1 -1
- package/dist/client/livestream-pool.d.ts +43 -12
- package/dist/client/livestream-pool.d.ts.map +1 -1
- package/dist/client/livestream-pool.js +54 -13
- package/dist/client/livestream-pool.js.map +1 -1
- package/dist/devices/camera.d.ts +5 -15
- package/dist/devices/camera.d.ts.map +1 -1
- package/dist/devices/camera.js +5 -9
- package/dist/devices/camera.js.map +1 -1
- package/dist/devices/chime.js +2 -2
- package/dist/devices/chime.js.map +1 -1
- package/dist/devices/device.d.ts +6 -5
- package/dist/devices/device.d.ts.map +1 -1
- package/dist/devices/device.js +1 -1
- package/dist/devices/device.js.map +1 -1
- package/dist/devices/fob.js +2 -2
- package/dist/devices/fob.js.map +1 -1
- package/dist/devices/light.js +2 -2
- package/dist/devices/light.js.map +1 -1
- package/dist/devices/registry.d.ts.map +1 -1
- package/dist/devices/registry.js +32 -21
- package/dist/devices/registry.js.map +1 -1
- package/dist/devices/relay.js +2 -2
- package/dist/devices/relay.js.map +1 -1
- package/dist/devices/sensor.js +2 -2
- package/dist/devices/sensor.js.map +1 -1
- package/dist/devices/viewer.js +2 -2
- package/dist/devices/viewer.js.map +1 -1
- package/dist/diagnostics.d.ts +36 -9
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +7 -4
- package/dist/diagnostics.js.map +1 -1
- package/dist/errors.d.ts +4 -4
- package/dist/errors.js +4 -4
- package/dist/errors.js.map +1 -1
- package/dist/event-bus.d.ts +1 -1
- package/dist/event-bus.js +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/protocol/events.d.ts +15 -8
- package/dist/protocol/events.d.ts.map +1 -1
- package/dist/protocol/events.js +13 -9
- package/dist/protocol/events.js.map +1 -1
- package/dist/protocol/packet.js +3 -3
- package/dist/protocol/packet.js.map +1 -1
- package/dist/protocol/reducer.d.ts +61 -6
- package/dist/protocol/reducer.d.ts.map +1 -1
- package/dist/protocol/reducer.js +168 -20
- package/dist/protocol/reducer.js.map +1 -1
- package/dist/state/selectors.d.ts +50 -353
- package/dist/state/selectors.d.ts.map +1 -1
- package/dist/state/selectors.js +36 -57
- package/dist/state/selectors.js.map +1 -1
- package/dist/state/store.d.ts +18 -4
- package/dist/state/store.d.ts.map +1 -1
- package/dist/state/store.js +132 -27
- package/dist/state/store.js.map +1 -1
- package/dist/transport/events-stream.d.ts +9 -9
- package/dist/transport/events-stream.d.ts.map +1 -1
- package/dist/transport/events-stream.js +20 -8
- package/dist/transport/events-stream.js.map +1 -1
- package/dist/transport/http.d.ts +1 -1
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +7 -6
- package/dist/transport/http.js.map +1 -1
- package/dist/transport/livestream-session.d.ts +13 -4
- package/dist/transport/livestream-session.d.ts.map +1 -1
- package/dist/transport/livestream-session.js +35 -14
- package/dist/transport/livestream-session.js.map +1 -1
- package/dist/transport/talkback-session.d.ts +5 -4
- package/dist/transport/talkback-session.d.ts.map +1 -1
- package/dist/transport/talkback-session.js +18 -9
- package/dist/transport/talkback-session.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/util/cli/commands/watch-events.js +1 -1
- package/dist/util/cli/commands/watch-state.d.ts.map +1 -1
- package/dist/util/cli/commands/watch-state.js +8 -8
- package/dist/util/cli/commands/watch-state.js.map +1 -1
- package/dist/util/cli/lookup.d.ts.map +1 -1
- package/dist/util/cli/lookup.js +1 -0
- package/dist/util/cli/lookup.js.map +1 -1
- package/dist/util/cli/shared.d.ts +1 -1
- package/package.json +4 -4
- package/src/client/client.ts +1 -1
- package/src/client/connection.ts +3 -3
- package/src/client/livestream-pool.ts +105 -17
- package/src/devices/camera.ts +9 -22
- package/src/devices/chime.ts +2 -2
- package/src/devices/device.ts +6 -7
- package/src/devices/fob.ts +2 -2
- package/src/devices/light.ts +2 -2
- package/src/devices/registry.ts +47 -25
- package/src/devices/relay.ts +2 -2
- package/src/devices/sensor.ts +2 -2
- package/src/devices/viewer.ts +2 -2
- package/src/diagnostics.ts +40 -4
- package/src/errors.ts +5 -5
- package/src/event-bus.ts +1 -1
- package/src/index.ts +21 -15
- package/src/protocol/events.ts +24 -12
- package/src/protocol/packet.ts +3 -3
- package/src/protocol/reducer.ts +250 -28
- package/src/state/selectors.ts +62 -83
- package/src/state/store.ts +196 -7
- package/src/transport/events-stream.ts +28 -13
- package/src/transport/http.ts +8 -7
- package/src/transport/livestream-session.ts +51 -19
- package/src/transport/talkback-session.ts +20 -10
- package/src/types/index.ts +2 -2
- package/src/util/cli/commands/watch-events.ts +1 -1
- package/src/util/cli/commands/watch-state.ts +8 -10
- package/src/util/cli/lookup.ts +8 -2
- package/src/util/cli/shared.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/devices/camera.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"camera.js","sourceRoot":"","sources":["../../src/devices/camera.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAgCxD;;;;;;GAMG;AACH,MAAM,OAAO,MAAO,SAAQ,gBAAqC;IAEtD,QAAQ,GAAG,QAAQ,CAAC;IAE7B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;;;O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EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/J,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAiC,EAAE;QAEhD,kKAAkK;QAClK,iGAAiG;QACjG,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAExD,IAAG,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;YAE5B,MAAM,IAAI,uBAAuB,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,EAAE,GAAG,oDAAoD,EACzI,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF"}
|
package/dist/devices/chime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A chime projection. Inherits the read-through getters, live `observe`, and write-through `update` from {@link DeviceProjection}; chime *configuration* (default
|
|
5
5
|
* volume, per-camera ringtone assignment) is expressed through `update` payloads, while the things a chime can be told to *do* are first-class commands.
|
|
@@ -13,7 +13,7 @@ import { selectChime } from "../state/selectors.js";
|
|
|
13
13
|
export class Chime extends DeviceProjection {
|
|
14
14
|
modelKey = "chime";
|
|
15
15
|
constructor(ctx, id) {
|
|
16
|
-
super(ctx, id,
|
|
16
|
+
super(ctx, id, deviceSelectors.chime.byId);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Play a ringtone through the chime's speaker. Write-through: the command is issued and the method returns; it does not fold any response into the store. With no
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chime.js","sourceRoot":"","sources":["../../src/devices/chime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"chime.js","sourceRoot":"","sources":["../../src/devices/chime.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA2BxD;;;;;;;;;GASG;AACH,MAAM,OAAO,KAAM,SAAQ,gBAAoC;IAEpD,QAAQ,GAAG,OAAO,CAAC;IAE5B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,CAAC,OAA2B,EAAE;QAE7C,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAEzD,mKAAmK;QACnK,2IAA2I;QAC3I,MAAM,OAAO,GAAmE;YAE9E,GAAG,CAAC,CAAC,WAAW,KAAK,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;YACnD,GAAG,CAAC,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC;YACjD,GAAG,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;SAC1C,CAAC;QAEF,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,OAAiC,EAAE;QAElD,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
package/dist/devices/device.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DeviceCollectionKey, DeviceModelKey } from "../protocol/events.ts";
|
|
2
2
|
import type { HttpMethod, ProtectResponse } from "../transport/http.ts";
|
|
3
|
+
import type { DeepPartial } from "../types/index.ts";
|
|
3
4
|
import type { DeviceContext } from "./context.ts";
|
|
4
|
-
import type {
|
|
5
|
+
import type { ProtectDeviceConfigMap } from "../state/selectors.ts";
|
|
5
6
|
import type { ProtectState } from "../protocol/reducer.ts";
|
|
6
7
|
/**
|
|
7
8
|
* The config-record union a device projection can wrap - every modeled device except the NVR singleton.
|
|
8
9
|
*
|
|
9
10
|
* @category Devices
|
|
10
11
|
*/
|
|
11
|
-
export type ProtectDeviceConfig =
|
|
12
|
+
export type ProtectDeviceConfig = ProtectDeviceConfigMap[DeviceCollectionKey];
|
|
12
13
|
/**
|
|
13
14
|
* The read-only core every projection shares - whether it is a command-bearing device ({@link DeviceProjection}) or the read-only NVR singleton (`Nvr`). A projection is
|
|
14
15
|
* **a live view, not a cached entity**: it holds only its context and a stable selector, and every property access reads through to the current store snapshot. Holding a
|
|
@@ -73,7 +74,7 @@ export declare abstract class Projection<TConfig> {
|
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* The shared base of every *device* projection (`Camera`, `Chime`, `Fob`, `Light`, `Relay`, `Sensor`, `Viewer`). It extends the read-only {@link Projection} core with
|
|
76
|
-
* what every device category adds: a stable `id`, the `modelKey`
|
|
77
|
+
* what every device category adds: a stable `id`, the `modelKey` tag, the `name` / `isOnline` getters, and the write-through `update` and `reboot` commands
|
|
77
78
|
* (every Protect device type exposes a reboot endpoint).
|
|
78
79
|
*
|
|
79
80
|
* Commands are **write-through**: `update` PATCHes the controller and returns the same live handle, but does *not* fold the response into the store. State advances
|
|
@@ -88,7 +89,7 @@ export declare abstract class Projection<TConfig> {
|
|
|
88
89
|
export declare abstract class DeviceProjection<TConfig extends ProtectDeviceConfig> extends Projection<TConfig> {
|
|
89
90
|
/** The device's stable id. */
|
|
90
91
|
readonly id: string;
|
|
91
|
-
/** The device category
|
|
92
|
+
/** The device category tag, fixed by the concrete subclass. */
|
|
92
93
|
abstract readonly modelKey: DeviceModelKey;
|
|
93
94
|
protected constructor(ctx: DeviceContext, id: string, select: (id: string) => (state: ProtectState) => TConfig | undefined);
|
|
94
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,8BAAsB,UAAU,CAAC,OAAO;;IAEtC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAMtC,SAAS,aAAa,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,KAAK,EAA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E,WAAW,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/F;;;;;;;OAOG;IACG,MAAM,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhE,SAAS,CAAC,cAAc,IAAI,MAAM;CAInC"}
|
package/dist/devices/device.js
CHANGED
|
@@ -81,7 +81,7 @@ export class Projection {
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* The shared base of every *device* projection (`Camera`, `Chime`, `Fob`, `Light`, `Relay`, `Sensor`, `Viewer`). It extends the read-only {@link Projection} core with
|
|
84
|
-
* what every device category adds: a stable `id`, the `modelKey`
|
|
84
|
+
* what every device category adds: a stable `id`, the `modelKey` tag, the `name` / `isOnline` getters, and the write-through `update` and `reboot` commands
|
|
85
85
|
* (every Protect device type exposes a reboot endpoint).
|
|
86
86
|
*
|
|
87
87
|
* Commands are **write-through**: `update` PATCHes the controller and returns the same live handle, but does *not* fold the response into the store. State advances
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/devices/device.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AASvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAgB,UAAU;IAEX,GAAG,CAAgB;IAEtC,oKAAoK;IACpK,mFAAmF;IAC1E,OAAO,CAA+C;IAE/D,YAAsB,GAAkB,EAAE,MAAoD;QAE5F,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI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AAI,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,OAAiC,EAAE;QAE9C,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,yEAAyE;IAC/D,cAAc;QAEtB,OAAO,SAAS,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,QAAQ,GAAG,iDAAiD,CAAC;IACxG,CAAC;CACF"}
|
package/dist/devices/fob.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A fob projection. Inherits the read-through getters, live `observe`, and write-through `update` / `reboot` from {@link DeviceProjection}. A fob is an input device: its
|
|
5
5
|
* security-action button presses arrive as occurrences on the event firehose, and its away/arm state is read through the device record (`awayState`, `pendingActionType`,
|
|
@@ -10,7 +10,7 @@ import { selectFob } from "../state/selectors.js";
|
|
|
10
10
|
export class Fob extends DeviceProjection {
|
|
11
11
|
modelKey = "fob";
|
|
12
12
|
constructor(ctx, id) {
|
|
13
|
-
super(ctx, id,
|
|
13
|
+
super(ctx, id, deviceSelectors.fob.byId);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=fob.js.map
|
package/dist/devices/fob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fob.js","sourceRoot":"","sources":["../../src/devices/fob.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"fob.js","sourceRoot":"","sources":["../../src/devices/fob.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,OAAO,GAAI,SAAQ,gBAAkC;IAEhD,QAAQ,GAAG,KAAK,CAAC;IAE1B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/devices/light.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A light projection. Inherits the read-through getters, live `observe`, and write-through `update` from {@link DeviceProjection}; light-specific behavior (level,
|
|
5
5
|
* motion activation) is expressed through `update` payloads rather than bespoke methods.
|
|
@@ -9,7 +9,7 @@ import { selectLight } from "../state/selectors.js";
|
|
|
9
9
|
export class Light extends DeviceProjection {
|
|
10
10
|
modelKey = "light";
|
|
11
11
|
constructor(ctx, id) {
|
|
12
|
-
super(ctx, id,
|
|
12
|
+
super(ctx, id, deviceSelectors.light.byId);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=light.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"light.js","sourceRoot":"","sources":["../../src/devices/light.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"light.js","sourceRoot":"","sources":["../../src/devices/light.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,KAAM,SAAQ,gBAAoC;IAEpD,QAAQ,GAAG,OAAO,CAAC;IAE5B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/devices/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/devices/registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA6BrC;;;;;;;;;GASG;AACH,qBAAa,cAAc;;gBAIb,GAAG,EAAE,aAAa;IAK9B,0FAA0F;IAC1F,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKtC,yDAAyD;IACzD,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAKpC,uDAAuD;IACvD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS;IAKhC,yDAAyD;IACzD,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAKpC,yDAAyD;IACzD,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAKpC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKtC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKtC;;;OAGG;IACH,GAAG,IAAI,GAAG;IAKV,8DAA8D;IAC9D,OAAO,IAAI,SAAS,MAAM,EAAE;IAK5B,6DAA6D;IAC7D,MAAM,IAAI,SAAS,KAAK,EAAE;IAK1B,2DAA2D;IAC3D,IAAI,IAAI,SAAS,GAAG,EAAE;IAKtB,6DAA6D;IAC7D,MAAM,IAAI,SAAS,KAAK,EAAE;IAK1B,6DAA6D;IAC7D,MAAM,IAAI,SAAS,KAAK,EAAE;IAK1B,8DAA8D;IAC9D,OAAO,IAAI,SAAS,MAAM,EAAE;IAK5B,8DAA8D;IAC9D,OAAO,IAAI,SAAS,MAAM,EAAE;CAiB7B"}
|
package/dist/devices/registry.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
*
|
|
3
3
|
* registry.ts: The projection factory - typed device lookup and iteration over the current state.
|
|
4
4
|
*/
|
|
5
|
-
import { selectCamera, selectCameras, selectChime, selectChimes, selectFob, selectFobs, selectLight, selectLights, selectRelay, selectRelays, selectSensor, selectSensors, selectViewer, selectViewers } from "../state/selectors.js";
|
|
6
5
|
import { Camera } from "./camera.js";
|
|
7
6
|
import { Chime } from "./chime.js";
|
|
8
7
|
import { Fob } from "./fob.js";
|
|
@@ -11,6 +10,18 @@ import { Nvr } from "./nvr.js";
|
|
|
11
10
|
import { Relay } from "./relay.js";
|
|
12
11
|
import { Sensor } from "./sensor.js";
|
|
13
12
|
import { Viewer } from "./viewer.js";
|
|
13
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
14
|
+
// The projection constructor for each category, keyed by the collection vocabulary. The mapped type pins each entry to its category's class, so the generic #lookup and
|
|
15
|
+
// #all can construct over an abstract key while every public accessor keeps its exact projection return type; a missing or transposed row is a compile error.
|
|
16
|
+
const PROJECTIONS = {
|
|
17
|
+
camera: Camera,
|
|
18
|
+
chime: Chime,
|
|
19
|
+
fob: Fob,
|
|
20
|
+
light: Light,
|
|
21
|
+
relay: Relay,
|
|
22
|
+
sensor: Sensor,
|
|
23
|
+
viewer: Viewer
|
|
24
|
+
};
|
|
14
25
|
/**
|
|
15
26
|
* The projection factory the client composes. It turns ids into live {@link DeviceProjection} handles for every device category - looked up by id or iterated as a
|
|
16
27
|
* collection against the current store snapshot - plus the id-free NVR singleton handle. This is where projection construction lives - at Layer 3 - so `StateStore`
|
|
@@ -28,31 +39,31 @@ export class DeviceRegistry {
|
|
|
28
39
|
}
|
|
29
40
|
/** Look up a camera by id, or `undefined` when no such camera is in the current state. */
|
|
30
41
|
camera(id) {
|
|
31
|
-
return this.#lookup(
|
|
42
|
+
return this.#lookup("camera", id);
|
|
32
43
|
}
|
|
33
44
|
/** Look up a chime by id, or `undefined` when absent. */
|
|
34
45
|
chime(id) {
|
|
35
|
-
return this.#lookup(
|
|
46
|
+
return this.#lookup("chime", id);
|
|
36
47
|
}
|
|
37
48
|
/** Look up a fob by id, or `undefined` when absent. */
|
|
38
49
|
fob(id) {
|
|
39
|
-
return this.#lookup(
|
|
50
|
+
return this.#lookup("fob", id);
|
|
40
51
|
}
|
|
41
52
|
/** Look up a light by id, or `undefined` when absent. */
|
|
42
53
|
light(id) {
|
|
43
|
-
return this.#lookup(
|
|
54
|
+
return this.#lookup("light", id);
|
|
44
55
|
}
|
|
45
56
|
/** Look up a relay by id, or `undefined` when absent. */
|
|
46
57
|
relay(id) {
|
|
47
|
-
return this.#lookup(
|
|
58
|
+
return this.#lookup("relay", id);
|
|
48
59
|
}
|
|
49
60
|
/** Look up a sensor by id, or `undefined` when absent. */
|
|
50
61
|
sensor(id) {
|
|
51
|
-
return this.#lookup(
|
|
62
|
+
return this.#lookup("sensor", id);
|
|
52
63
|
}
|
|
53
64
|
/** Look up a viewer by id, or `undefined` when absent. */
|
|
54
65
|
viewer(id) {
|
|
55
|
-
return this.#lookup(
|
|
66
|
+
return this.#lookup("viewer", id);
|
|
56
67
|
}
|
|
57
68
|
/**
|
|
58
69
|
* The NVR singleton projection. Unlike the device lookups there is no id and no `undefined`: the NVR is a singleton, so this always returns a handle. Its getters throw
|
|
@@ -63,40 +74,40 @@ export class DeviceRegistry {
|
|
|
63
74
|
}
|
|
64
75
|
/** Every camera in the current state, as live projections. */
|
|
65
76
|
cameras() {
|
|
66
|
-
return this.#all(
|
|
77
|
+
return this.#all("camera");
|
|
67
78
|
}
|
|
68
79
|
/** Every chime in the current state, as live projections. */
|
|
69
80
|
chimes() {
|
|
70
|
-
return this.#all(
|
|
81
|
+
return this.#all("chime");
|
|
71
82
|
}
|
|
72
83
|
/** Every fob in the current state, as live projections. */
|
|
73
84
|
fobs() {
|
|
74
|
-
return this.#all(
|
|
85
|
+
return this.#all("fob");
|
|
75
86
|
}
|
|
76
87
|
/** Every light in the current state, as live projections. */
|
|
77
88
|
lights() {
|
|
78
|
-
return this.#all(
|
|
89
|
+
return this.#all("light");
|
|
79
90
|
}
|
|
80
91
|
/** Every relay in the current state, as live projections. */
|
|
81
92
|
relays() {
|
|
82
|
-
return this.#all(
|
|
93
|
+
return this.#all("relay");
|
|
83
94
|
}
|
|
84
95
|
/** Every sensor in the current state, as live projections. */
|
|
85
96
|
sensors() {
|
|
86
|
-
return this.#all(
|
|
97
|
+
return this.#all("sensor");
|
|
87
98
|
}
|
|
88
99
|
/** Every viewer in the current state, as live projections. */
|
|
89
100
|
viewers() {
|
|
90
|
-
return this.#all(
|
|
101
|
+
return this.#all("viewer");
|
|
91
102
|
}
|
|
92
|
-
// Build one projection if its id is present in the current snapshot, else undefined. The presence check reads through the by-id selector so lookup and the
|
|
93
|
-
// share one notion of "exists".
|
|
94
|
-
#lookup(
|
|
95
|
-
return (byId(id)(this.#ctx.store.snapshot()) !== undefined) ? new
|
|
103
|
+
// Build one projection if its id is present in the current snapshot, else undefined. The presence check reads through the category's by-id selector so lookup and the
|
|
104
|
+
// projection share one notion of "exists"; the key correlates the selector and the constructor through PROJECTIONS, so a mismatched pair cannot compile.
|
|
105
|
+
#lookup(key, id) {
|
|
106
|
+
return (deviceSelectors[key].byId(id)(this.#ctx.store.snapshot()) !== undefined) ? new PROJECTIONS[key](this.#ctx, id) : undefined;
|
|
96
107
|
}
|
|
97
108
|
// Map the memoized config array for a collection to fresh projection handles. One helper for every device collection keeps the construction logic single-source.
|
|
98
|
-
#all(
|
|
99
|
-
return all(this.#ctx.store.snapshot()).map((config) => new
|
|
109
|
+
#all(key) {
|
|
110
|
+
return deviceSelectors[key].all(this.#ctx.store.snapshot()).map((config) => new PROJECTIONS[key](this.#ctx, config.id));
|
|
100
111
|
}
|
|
101
112
|
}
|
|
102
113
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/devices/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/devices/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAexD,wKAAwK;AACxK,8JAA8J;AAC9J,MAAM,WAAW,GAA8G;IAE7H,MAAM,EAAE,MAAM;IACd,KAAK,E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,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1H,CAAC;CACF"}
|
package/dist/devices/relay.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A relay projection. Inherits the read-through getters, live `observe`, and write-through `update` / `reboot` from {@link DeviceProjection}, and adds the one
|
|
5
5
|
* relay-specific command: {@link Relay.toggleOutput}, the faithful primitive over the controller's per-output activate endpoint.
|
|
@@ -9,7 +9,7 @@ import { selectRelay } from "../state/selectors.js";
|
|
|
9
9
|
export class Relay extends DeviceProjection {
|
|
10
10
|
modelKey = "relay";
|
|
11
11
|
constructor(ctx, id) {
|
|
12
|
-
super(ctx, id,
|
|
12
|
+
super(ctx, id, deviceSelectors.relay.byId);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Toggle one of the relay's outputs. The controller exposes a single latching toggle per output: each call flips that output's `state` (off becomes on, on becomes off)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay.js","sourceRoot":"","sources":["../../src/devices/relay.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"relay.js","sourceRoot":"","sources":["../../src/devices/relay.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,KAAM,SAAQ,gBAAoC;IAEpD,QAAQ,GAAG,OAAO,CAAC;IAE5B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,OAAiC,EAAE;QAEtE,MAAM,IAAI,CAAC,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,QAAQ,EAAE,GAAG,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;CACF"}
|
package/dist/devices/sensor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A sensor projection. Inherits the read-through getters, live `observe`, and write-through `update` from {@link DeviceProjection}; sensor-specific behavior
|
|
5
5
|
* (sensitivity, mount type, thresholds) is expressed through `update` payloads.
|
|
@@ -9,7 +9,7 @@ import { selectSensor } from "../state/selectors.js";
|
|
|
9
9
|
export class Sensor extends DeviceProjection {
|
|
10
10
|
modelKey = "sensor";
|
|
11
11
|
constructor(ctx, id) {
|
|
12
|
-
super(ctx, id,
|
|
12
|
+
super(ctx, id, deviceSelectors.sensor.byId);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=sensor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensor.js","sourceRoot":"","sources":["../../src/devices/sensor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sensor.js","sourceRoot":"","sources":["../../src/devices/sensor.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,gBAAqC;IAEtD,QAAQ,GAAG,QAAQ,CAAC;IAE7B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/devices/viewer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeviceProjection } from "./device.js";
|
|
2
|
-
import {
|
|
2
|
+
import { deviceSelectors } from "../state/selectors.js";
|
|
3
3
|
/**
|
|
4
4
|
* A viewer projection. Inherits the read-through getters, live `observe`, and write-through `update` from {@link DeviceProjection}; viewer-specific behavior
|
|
5
5
|
* (assigned liveview) is expressed through `update` payloads.
|
|
@@ -9,7 +9,7 @@ import { selectViewer } from "../state/selectors.js";
|
|
|
9
9
|
export class Viewer extends DeviceProjection {
|
|
10
10
|
modelKey = "viewer";
|
|
11
11
|
constructor(ctx, id) {
|
|
12
|
-
super(ctx, id,
|
|
12
|
+
super(ctx, id, deviceSelectors.viewer.byId);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=viewer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../src/devices/viewer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../src/devices/viewer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,gBAAqC;IAEtD,QAAQ,GAAG,QAAQ,CAAC;IAE7B,YAAY,GAAkB,EAAE,EAAU;QAExC,KAAK,CAAC,GAAG,EAAE,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LivestreamSubscriptionStats } from "./client/livestream-pool.ts";
|
|
1
2
|
import diagnosticsChannel from "node:diagnostics_channel";
|
|
2
3
|
/**
|
|
3
4
|
* The library's observability surface, expressed as `node:diagnostics_channel` publishers.
|
|
@@ -18,6 +19,13 @@ import diagnosticsChannel from "node:diagnostics_channel";
|
|
|
18
19
|
* @category Diagnostics
|
|
19
20
|
*/
|
|
20
21
|
export declare const channels: {
|
|
22
|
+
/** A device record asserted that another controller has adopted it while naming this controller as its owner - the two cannot both be true, so the model corrected the
|
|
23
|
+
* record to keep the device adopted here. Published by the StateStore from its dispatch chokepoint on the first edge of each episode per device (a device is one
|
|
24
|
+
* `modelKey:id`), driven by what the wire explicitly asserts: a fresh assertion of the contradiction publishes, and the same device re-asserting it on the next refresh
|
|
25
|
+
* publishes nothing until the controller retracts it (or the device leaves). A G2-generation controller defect surfaces this on 4-hour anchors and holds until a
|
|
26
|
+
* reboot; the signal exists so a consumer sees the anomaly explicitly rather than the model silently absorbing it.
|
|
27
|
+
*/
|
|
28
|
+
readonly adoptionContradiction: diagnosticsChannel.Channel<AdoptionContradictionPayload, AdoptionContradictionPayload>;
|
|
21
29
|
/** The 401-triggered relogin ran. The only visibility into mid-session session recovery, which is otherwise silent (it has no return value a consumer sees); the
|
|
22
30
|
* payload's `success` reports whether the session was recovered. Connect-time login is deliberately not channelled - the `connect()` result and the `http:request:*`
|
|
23
31
|
* channels already are its single source.
|
|
@@ -75,6 +83,19 @@ export declare const channels: {
|
|
|
75
83
|
/** A talkback (two-way audio) session opened a WebSocket to a camera's speaker. */
|
|
76
84
|
readonly talkbackSessionOpened: diagnosticsChannel.Channel<TalkbackSessionOpenedPayload, TalkbackSessionOpenedPayload>;
|
|
77
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Payload published on {@link channels.adoptionContradiction}. `modelKey` and `id` identify the device whose record was self-contradictory; `mac` is the device's own
|
|
88
|
+
* hardware address; `nvrMac` is the owning-controller address the record asserted, which equals this controller's own MAC (that equality is what makes the
|
|
89
|
+
* adopted-by-another claim provably false). The library corrects the record and publishes this once per episode; consumers building dashboards add their own counters.
|
|
90
|
+
*
|
|
91
|
+
* @category Diagnostics
|
|
92
|
+
*/
|
|
93
|
+
export interface AdoptionContradictionPayload {
|
|
94
|
+
id: string;
|
|
95
|
+
mac: string;
|
|
96
|
+
modelKey: string;
|
|
97
|
+
nvrMac: string;
|
|
98
|
+
}
|
|
78
99
|
/**
|
|
79
100
|
* Payload published on {@link channels.authRelogin}. `success` is `true` when the relogin re-established the session, `false` when it could not (no retained credentials,
|
|
80
101
|
* or the handshake failed).
|
|
@@ -114,7 +135,7 @@ export interface EventsClosedPayload {
|
|
|
114
135
|
reason: string;
|
|
115
136
|
}
|
|
116
137
|
/**
|
|
117
|
-
* Payload published on {@link channels.eventsPacket}. `kind` is a `TypedEvent`
|
|
138
|
+
* Payload published on {@link channels.eventsPacket}. `kind` is a `TypedEvent` tag; `modelKey` and `id` are present for device-scoped events.
|
|
118
139
|
*
|
|
119
140
|
* @category Diagnostics
|
|
120
141
|
*/
|
|
@@ -140,6 +161,11 @@ export interface EventsReconnectingPayload {
|
|
|
140
161
|
export interface HttpRequestEndPayload {
|
|
141
162
|
durationMs: number;
|
|
142
163
|
error?: string;
|
|
164
|
+
/**
|
|
165
|
+
* The controller address this client was built against, verbatim as supplied to `ProtectClient.connect()`. The structured identity that scopes a payload to one
|
|
166
|
+
* controller on the process-global diagnostics channel, mirroring `cameraId` on the livestream payloads.
|
|
167
|
+
*/
|
|
168
|
+
host: string;
|
|
143
169
|
method: string;
|
|
144
170
|
requestId: string;
|
|
145
171
|
statusCode?: number;
|
|
@@ -151,6 +177,11 @@ export interface HttpRequestEndPayload {
|
|
|
151
177
|
* @category Diagnostics
|
|
152
178
|
*/
|
|
153
179
|
export interface HttpRequestStartPayload {
|
|
180
|
+
/**
|
|
181
|
+
* The controller address this client was built against, verbatim as supplied to `ProtectClient.connect()`. The structured identity that scopes a payload to one
|
|
182
|
+
* controller on the process-global diagnostics channel, mirroring `cameraId` on the livestream payloads.
|
|
183
|
+
*/
|
|
184
|
+
host: string;
|
|
154
185
|
method: string;
|
|
155
186
|
requestId: string;
|
|
156
187
|
url: string;
|
|
@@ -253,22 +284,18 @@ export interface LivestreamSubscriptionCreatedPayload {
|
|
|
253
284
|
subscriptionId: string;
|
|
254
285
|
}
|
|
255
286
|
/**
|
|
256
|
-
* Payload published on {@link channels.livestreamSubscriptionDisposed}. `stats` carries the subscription's final delivery counters
|
|
287
|
+
* Payload published on {@link channels.livestreamSubscriptionDisposed}. `stats` carries the subscription's final delivery counters, including any segments discarded on
|
|
288
|
+
* disposal.
|
|
257
289
|
*
|
|
258
290
|
* @category Diagnostics
|
|
259
291
|
*/
|
|
260
292
|
export interface LivestreamSubscriptionDisposedPayload {
|
|
261
293
|
key: string;
|
|
262
|
-
stats:
|
|
263
|
-
delivered: number;
|
|
264
|
-
lastSegmentAt: number;
|
|
265
|
-
peakQueueDepth: number;
|
|
266
|
-
queueDepth: number;
|
|
267
|
-
};
|
|
294
|
+
stats: LivestreamSubscriptionStats;
|
|
268
295
|
subscriptionId: string;
|
|
269
296
|
}
|
|
270
297
|
/**
|
|
271
|
-
* Payload published on {@link channels.schemaUnknownModelKey}. `action` and `exampleId` are the
|
|
298
|
+
* Payload published on {@link channels.schemaUnknownModelKey}. `action` and `exampleId` are the identifying fields from the offending packet's header so a consumer
|
|
272
299
|
* can correlate the drift signal with concrete wire activity (e.g., "modelKey 'garage' first seen at action 'add' with id <uuid>"). The library does not accumulate or
|
|
273
300
|
* aggregate beyond the first-occurrence dedup; consumers building dashboards add their own counters from this channel.
|
|
274
301
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAIA,OAAO,kBAAkB,MAAM,0BAA0B,CAA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AC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,4BAA4B;IAE3C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAE3C,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/* Copyright(C) 2019-2026, HJD (https://github.com/hjdhjd). All rights reserved.
|
|
2
|
-
*
|
|
3
|
-
* diagnostics.ts: Named node:diagnostics_channel publishers for the UniFi Protect library.
|
|
4
|
-
*/
|
|
5
1
|
import diagnosticsChannel from "node:diagnostics_channel";
|
|
6
2
|
/**
|
|
7
3
|
* The library's observability surface, expressed as `node:diagnostics_channel` publishers.
|
|
@@ -22,6 +18,13 @@ import diagnosticsChannel from "node:diagnostics_channel";
|
|
|
22
18
|
* @category Diagnostics
|
|
23
19
|
*/
|
|
24
20
|
export const channels = {
|
|
21
|
+
/** A device record asserted that another controller has adopted it while naming this controller as its owner - the two cannot both be true, so the model corrected the
|
|
22
|
+
* record to keep the device adopted here. Published by the StateStore from its dispatch chokepoint on the first edge of each episode per device (a device is one
|
|
23
|
+
* `modelKey:id`), driven by what the wire explicitly asserts: a fresh assertion of the contradiction publishes, and the same device re-asserting it on the next refresh
|
|
24
|
+
* publishes nothing until the controller retracts it (or the device leaves). A G2-generation controller defect surfaces this on 4-hour anchors and holds until a
|
|
25
|
+
* reboot; the signal exists so a consumer sees the anomaly explicitly rather than the model silently absorbing it.
|
|
26
|
+
*/
|
|
27
|
+
adoptionContradiction: diagnosticsChannel.channel("unifi-protect:adoption:contradiction"),
|
|
25
28
|
/** The 401-triggered relogin ran. The only visibility into mid-session session recovery, which is otherwise silent (it has no return value a consumer sees); the
|
|
26
29
|
* payload's `success` reports whether the session was recovered. Connect-time login is deliberately not channelled - the `connect()` result and the `http:request:*`
|
|
27
30
|
* channels already are its single source.
|
package/dist/diagnostics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAKA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEtB;;;;;OAKG;IACH,qBAAqB,EAAE,kBAAkB,CAAC,OAAO,CAA+B,sCAAsC,CAAC;IAEvH;;;OAGG;IACH,WAAW,EAAE,kBAAkB,CAAC,OAAO,CAAqB,4BAA4B,CAAC;IAEzF,qHAAqH;IACrH,wBAAwB,EAAE,kBAAkB,CAAC,OAAO,CAAkC,yCAAyC,CAAC;IAEhI,qDAAqD;IACrD,oBAAoB,EAAE,kBAAkB,CAAC,OAAO,CAA8B,qCAAqC,CAAC;IAEpH,4CAA4C;IAC5C,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAAsB,6BAA6B,CAAC;IAE5F,6DAA6D;IAC7D,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAAsB,6BAA6B,CAAC;IAE5F,qDAAqD;IACrD,kBAAkB,EAAE,kBAAkB,CAAC,OAAO,CAA4B,mCAAmC,CAAC;IAE9G,sDAAsD;IACtD,cAAc,EAAE,kBAAkB,CAAC,OAAO,CAAwB,gCAAgC,CAAC;IAEnG,sCAAsC;IACtC,gBAAgB,EAAE,kBAAkB,CAAC,OAAO,CAA0B,kCAAkC,CAAC;IAEzG,oGAAoG;IACpG,mBAAmB,EAAE,kBAAkB,CAAC,OAAO,CAA6B,qCAAqC,CAAC;IAElH,6EAA6E;IAC7E,kBAAkB,EAAE,kBAAkB,CAAC,OAAO,CAAwB,oCAAoC,CAAC;IAE3G,4JAA4J;IAC5J,sBAAsB,EAAE,kBAAkB,CAAC,OAAO,CAAgC,wCAAwC,CAAC;IAE3H,uKAAuK;IACvK,2BAA2B,EAAE,kBAAkB,CAAC,OAAO,CAAqC,6CAA6C,CAAC;IAE1I,gFAAgF;IAChF,2BAA2B,EAAE,kBAAkB,CAAC,OAAO,CAAqC,6CAA6C,CAAC;IAE1I,4FAA4F;IAC5F,yBAAyB,EAAE,kBAAkB,CAAC,OAAO,CAAmC,2CAA2C,CAAC;IAEpI,gFAAgF;IAChF,uBAAuB,EAAE,kBAAkB,CAAC,OAAO,CAAiC,yCAAyC,CAAC;IAE9H,qEAAqE;IACrE,uBAAuB,EAAE,kBAAkB,CAAC,OAAO,CAAiC,yCAAyC,CAAC;IAE9H,6EAA6E;IAC7E,uBAAuB,EAAE,kBAAkB,CAAC,OAAO,CAAiC,yCAAyC,CAAC;IAE9H,4DAA4D;IAC5D,6BAA6B,EAAE,kBAAkB,CAAC,OAAO,CAAuC,+CAA+C,CAAC;IAEhJ,uDAAuD;IACvD,8BAA8B,EAAE,kBAAkB,CAAC,OAAO,CAAwC,gDAAgD,CAAC;IAEnJ;;;OAGG;IACH,qBAAqB,EAAE,kBAAkB,CAAC,OAAO,CAA+B,sCAAsC,CAAC;IAEvH;;;;OAIG;IACH,yBAAyB,EAAE,kBAAkB,CAAC,OAAO,CAAmC,0CAA0C,CAAC;IAEnI,4EAA4E;IAC5E,qBAAqB,EAAE,kBAAkB,CAAC,OAAO,CAA+B,uCAAuC,CAAC;IAExH,mFAAmF;IACnF,qBAAqB,EAAE,kBAAkB,CAAC,OAAO,CAA+B,uCAAuC,CAAC;CAChH,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -180,13 +180,13 @@ export declare class ProtectProtocolError extends FatalError {
|
|
|
180
180
|
*
|
|
181
181
|
* @returns Never returns - always throws.
|
|
182
182
|
*
|
|
183
|
-
* @throws {@link ProtectProtocolError} always, naming the unhandled variant's
|
|
183
|
+
* @throws {@link ProtectProtocolError} always, naming the unhandled variant's tag.
|
|
184
184
|
*
|
|
185
185
|
* @category Errors
|
|
186
186
|
*/
|
|
187
187
|
export declare function assertNever(value: never): never;
|
|
188
188
|
/**
|
|
189
|
-
* The bootstrap sequence failed while fetching or parsing the controller bootstrap document. `stage`
|
|
189
|
+
* The bootstrap sequence failed while fetching or parsing the controller bootstrap document. `stage` marks which - `"fetch"` when the bootstrap endpoint returns
|
|
190
190
|
* a non-2xx status or the transport fails reaching it, `"parse"` when the body cannot be decoded - so the caller and the diagnostics surface can report the precise point
|
|
191
191
|
* of failure rather than a generic "connect failed." A login or reachability failure is not wrapped here; it propagates as its own typed fatal.
|
|
192
192
|
*
|
|
@@ -201,7 +201,7 @@ export declare class ProtectBootstrapError extends FatalError {
|
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
|
-
* The stages of the `connect()` sequence, used to
|
|
204
|
+
* The stages of the `connect()` sequence, used to tag a {@link ProtectBootstrapError}. The sequence authenticates, fetches the bootstrap document, parses it,
|
|
205
205
|
* then subscribes to the realtime stream; only the fetch and parse stages are wrapped as a bootstrap error, because a login or reachability failure already propagates as
|
|
206
206
|
* its own typed fatal (`ProtectAuthError` / `ProtectNetworkError`).
|
|
207
207
|
*
|
|
@@ -228,7 +228,7 @@ export declare class ProtectCodecChangeError extends FatalError {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
|
-
* A pooled livestream's recovery policy gave up. The `phase`
|
|
231
|
+
* A pooled livestream's recovery policy gave up. The `phase` names which of the two regimes the pool runs: `establishing` means the first segment never arrived within
|
|
232
232
|
* the bounded establishment deadline (the stream that never produced media), and `recovering` means a previously-live stream could not be re-established and the policy
|
|
233
233
|
* elected to stop. Fatal because the policy - the single authority over whether to keep trying - has declared the stream unrecoverable; the consumer re-subscribes if it
|
|
234
234
|
* still wants the stream. `attempts` carries how many consecutive reconnect attempts the episode made before the policy returned `giveUp`.
|
package/dist/errors.js
CHANGED
|
@@ -183,19 +183,19 @@ export class ProtectProtocolError extends FatalError {
|
|
|
183
183
|
*
|
|
184
184
|
* @returns Never returns - always throws.
|
|
185
185
|
*
|
|
186
|
-
* @throws {@link ProtectProtocolError} always, naming the unhandled variant's
|
|
186
|
+
* @throws {@link ProtectProtocolError} always, naming the unhandled variant's tag.
|
|
187
187
|
*
|
|
188
188
|
* @category Errors
|
|
189
189
|
*/
|
|
190
190
|
export function assertNever(value) {
|
|
191
|
-
// `value` is statically `never`, so we read its runtime shape defensively: an object variant surfaces its `kind`
|
|
191
|
+
// `value` is statically `never`, so we read its runtime shape defensively: an object variant surfaces its `kind` tag, anything else (a bare string such as a
|
|
192
192
|
// modelKey) surfaces its string form.
|
|
193
193
|
const variant = value;
|
|
194
194
|
const detail = ((typeof variant === "object") && (variant !== null) && ("kind" in variant)) ? String(variant.kind) : String(variant);
|
|
195
195
|
throw new ProtectProtocolError("Encountered an unhandled variant in an exhaustive switch: " + detail + ".");
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
|
-
* The bootstrap sequence failed while fetching or parsing the controller bootstrap document. `stage`
|
|
198
|
+
* The bootstrap sequence failed while fetching or parsing the controller bootstrap document. `stage` marks which - `"fetch"` when the bootstrap endpoint returns
|
|
199
199
|
* a non-2xx status or the transport fails reaching it, `"parse"` when the body cannot be decoded - so the caller and the diagnostics surface can report the precise point
|
|
200
200
|
* of failure rather than a generic "connect failed." A login or reachability failure is not wrapped here; it propagates as its own typed fatal.
|
|
201
201
|
*
|
|
@@ -229,7 +229,7 @@ export class ProtectCodecChangeError extends FatalError {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
|
-
* A pooled livestream's recovery policy gave up. The `phase`
|
|
232
|
+
* A pooled livestream's recovery policy gave up. The `phase` names which of the two regimes the pool runs: `establishing` means the first segment never arrived within
|
|
233
233
|
* the bounded establishment deadline (the stream that never produced media), and `recovering` means a previously-live stream could not be re-established and the policy
|
|
234
234
|
* elected to stop. Fatal because the policy - the single authority over whether to keep trying - has declared the stream unrecoverable; the consumer re-subscribes if it
|
|
235
235
|
* still wants the stream. `attempts` carries how many consecutive reconnect attempts the episode made before the policy returned `giveUp`.
|