unifi-protect 4.29.0 → 5.1.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/README.md +117 -65
- package/dist/client/client.d.ts +286 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +508 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/connection.d.ts +175 -0
- package/dist/client/connection.d.ts.map +1 -0
- package/dist/client/connection.js +445 -0
- package/dist/client/connection.js.map +1 -0
- package/dist/client/livestream-pool.d.ts +244 -0
- package/dist/client/livestream-pool.d.ts.map +1 -0
- package/dist/client/livestream-pool.js +845 -0
- package/dist/client/livestream-pool.js.map +1 -0
- package/dist/clock.d.ts +67 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +22 -0
- package/dist/clock.js.map +1 -0
- package/dist/devices/camera.d.ts +134 -0
- package/dist/devices/camera.d.ts.map +1 -0
- package/dist/devices/camera.js +165 -0
- package/dist/devices/camera.js.map +1 -0
- package/dist/devices/chime.d.ts +60 -0
- package/dist/devices/chime.d.ts.map +1 -0
- package/dist/devices/chime.js +50 -0
- package/dist/devices/chime.js.map +1 -0
- package/dist/devices/context.d.ts +34 -0
- package/dist/devices/context.d.ts.map +1 -0
- package/dist/devices/context.js +2 -0
- package/dist/devices/context.js.map +1 -0
- package/dist/devices/device.d.ts +156 -0
- package/dist/devices/device.d.ts.map +1 -0
- package/dist/devices/device.js +183 -0
- package/dist/devices/device.js.map +1 -0
- package/dist/devices/endpoints.d.ts +15 -0
- package/dist/devices/endpoints.d.ts.map +1 -0
- package/dist/devices/endpoints.js +29 -0
- package/dist/devices/endpoints.js.map +1 -0
- package/dist/devices/fob.d.ts +15 -0
- package/dist/devices/fob.d.ts.map +1 -0
- package/dist/devices/fob.js +16 -0
- package/dist/devices/fob.js.map +1 -0
- package/dist/devices/light.d.ts +14 -0
- package/dist/devices/light.d.ts.map +1 -0
- package/dist/devices/light.js +15 -0
- package/dist/devices/light.js.map +1 -0
- package/dist/devices/nvr.d.ts +43 -0
- package/dist/devices/nvr.d.ts.map +1 -0
- package/dist/devices/nvr.js +57 -0
- package/dist/devices/nvr.js.map +1 -0
- package/dist/devices/registry.d.ts +57 -0
- package/dist/devices/registry.d.ts.map +1 -0
- package/dist/devices/registry.js +102 -0
- package/dist/devices/registry.js.map +1 -0
- package/dist/devices/relay.d.ts +28 -0
- package/dist/devices/relay.d.ts.map +1 -0
- package/dist/devices/relay.js +29 -0
- package/dist/devices/relay.js.map +1 -0
- package/dist/devices/sensor.d.ts +14 -0
- package/dist/devices/sensor.d.ts.map +1 -0
- package/dist/devices/sensor.js +15 -0
- package/dist/devices/sensor.js.map +1 -0
- package/dist/devices/viewer.d.ts +14 -0
- package/dist/devices/viewer.d.ts.map +1 -0
- package/dist/devices/viewer.js +15 -0
- package/dist/devices/viewer.js.map +1 -0
- package/dist/diagnostics.d.ts +332 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +85 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/errors.d.ts +314 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +327 -0
- package/dist/errors.js.map +1 -0
- package/dist/event-bus.d.ts +86 -0
- package/dist/event-bus.d.ts.map +1 -0
- package/dist/event-bus.js +113 -0
- package/dist/event-bus.js.map +1 -0
- package/dist/index.d.ts +35 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -7
- package/dist/index.js.map +1 -1
- package/dist/logging.d.ts +32 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +21 -0
- package/dist/logging.js.map +1 -0
- package/dist/protocol/events.d.ts +254 -0
- package/dist/protocol/events.d.ts.map +1 -0
- package/dist/protocol/events.js +307 -0
- package/dist/protocol/events.js.map +1 -0
- package/dist/protocol/packet.d.ts +52 -0
- package/dist/protocol/packet.d.ts.map +1 -0
- package/dist/protocol/packet.js +206 -0
- package/dist/protocol/packet.js.map +1 -0
- package/dist/protocol/reducer.d.ts +165 -0
- package/dist/protocol/reducer.d.ts.map +1 -0
- package/dist/protocol/reducer.js +413 -0
- package/dist/protocol/reducer.js.map +1 -0
- package/dist/settings.d.ts +21 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +100 -0
- package/dist/settings.js.map +1 -1
- package/dist/state/selectors.d.ts +565 -0
- package/dist/state/selectors.d.ts.map +1 -0
- package/dist/state/selectors.js +332 -0
- package/dist/state/selectors.js.map +1 -0
- package/dist/state/store.d.ts +71 -0
- package/dist/state/store.d.ts.map +1 -0
- package/dist/state/store.js +339 -0
- package/dist/state/store.js.map +1 -0
- package/dist/transport/auth.d.ts +77 -0
- package/dist/transport/auth.d.ts.map +1 -0
- package/dist/transport/auth.js +164 -0
- package/dist/transport/auth.js.map +1 -0
- package/dist/transport/events-stream.d.ts +133 -0
- package/dist/transport/events-stream.d.ts.map +1 -0
- package/dist/transport/events-stream.js +369 -0
- package/dist/transport/events-stream.js.map +1 -0
- package/dist/transport/http.d.ts +212 -0
- package/dist/transport/http.d.ts.map +1 -0
- package/dist/transport/http.js +405 -0
- package/dist/transport/http.js.map +1 -0
- package/dist/transport/livestream-session.d.ts +211 -0
- package/dist/transport/livestream-session.d.ts.map +1 -0
- package/dist/transport/livestream-session.js +470 -0
- package/dist/transport/livestream-session.js.map +1 -0
- package/dist/transport/talkback-session.d.ts +86 -0
- package/dist/transport/talkback-session.d.ts.map +1 -0
- package/dist/transport/talkback-session.js +331 -0
- package/dist/transport/talkback-session.js.map +1 -0
- package/dist/transport/ws-endpoint.d.ts +49 -0
- package/dist/transport/ws-endpoint.d.ts.map +1 -0
- package/dist/transport/ws-endpoint.js +83 -0
- package/dist/transport/ws-endpoint.js.map +1 -0
- package/dist/transport/ws.d.ts +88 -0
- package/dist/transport/ws.d.ts.map +1 -0
- package/dist/transport/ws.js +24 -0
- package/dist/transport/ws.js.map +1 -0
- package/dist/types/base.d.ts +134 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/types/base.js +2 -0
- package/dist/types/base.js.map +1 -0
- package/dist/types/camera.d.ts +688 -0
- package/dist/types/camera.d.ts.map +1 -0
- package/dist/types/camera.js +2 -0
- package/dist/types/camera.js.map +1 -0
- package/dist/types/chime.d.ts +49 -0
- package/dist/types/chime.d.ts.map +1 -0
- package/dist/types/chime.js +2 -0
- package/dist/types/chime.js.map +1 -0
- package/dist/types/common.d.ts +17 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/events.d.ts +110 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/fob.d.ts +26 -0
- package/dist/types/fob.d.ts.map +1 -0
- package/dist/types/fob.js +2 -0
- package/dist/types/fob.js.map +1 -0
- package/dist/types/index.d.ts +49 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/light.d.ts +40 -0
- package/dist/types/light.d.ts.map +1 -0
- package/dist/types/light.js +2 -0
- package/dist/types/light.js.map +1 -0
- package/dist/types/nvr.d.ts +519 -0
- package/dist/types/nvr.d.ts.map +1 -0
- package/dist/types/nvr.js +2 -0
- package/dist/types/nvr.js.map +1 -0
- package/dist/types/relay.d.ts +57 -0
- package/dist/types/relay.d.ts.map +1 -0
- package/dist/types/relay.js +2 -0
- package/dist/types/relay.js.map +1 -0
- package/dist/types/sensor.d.ts +200 -0
- package/dist/types/sensor.d.ts.map +1 -0
- package/dist/types/sensor.js +2 -0
- package/dist/types/sensor.js.map +1 -0
- package/dist/types/shapes.d.ts +69 -0
- package/dist/types/shapes.d.ts.map +1 -0
- package/dist/types/shapes.js +2 -0
- package/dist/types/shapes.js.map +1 -0
- package/dist/types/viewer.d.ts +34 -0
- package/dist/types/viewer.d.ts.map +1 -0
- package/dist/types/viewer.js +2 -0
- package/dist/types/viewer.js.map +1 -0
- package/dist/util/cli/client.d.ts +49 -0
- package/dist/util/cli/client.d.ts.map +1 -0
- package/dist/util/cli/client.js +71 -0
- package/dist/util/cli/client.js.map +1 -0
- package/dist/util/cli/commands/camera-flashlight.d.ts +3 -0
- package/dist/util/cli/commands/camera-flashlight.d.ts.map +1 -0
- package/dist/util/cli/commands/camera-flashlight.js +112 -0
- package/dist/util/cli/commands/camera-flashlight.js.map +1 -0
- package/dist/util/cli/commands/camera-snapshot.d.ts +3 -0
- package/dist/util/cli/commands/camera-snapshot.d.ts.map +1 -0
- package/dist/util/cli/commands/camera-snapshot.js +138 -0
- package/dist/util/cli/commands/camera-snapshot.js.map +1 -0
- package/dist/util/cli/commands/camera-talkback.d.ts +3 -0
- package/dist/util/cli/commands/camera-talkback.d.ts.map +1 -0
- package/dist/util/cli/commands/camera-talkback.js +147 -0
- package/dist/util/cli/commands/camera-talkback.js.map +1 -0
- package/dist/util/cli/commands/camera-unlock.d.ts +3 -0
- package/dist/util/cli/commands/camera-unlock.d.ts.map +1 -0
- package/dist/util/cli/commands/camera-unlock.js +110 -0
- package/dist/util/cli/commands/camera-unlock.js.map +1 -0
- package/dist/util/cli/commands/camera.d.ts +3 -0
- package/dist/util/cli/commands/camera.d.ts.map +1 -0
- package/dist/util/cli/commands/camera.js +57 -0
- package/dist/util/cli/commands/camera.js.map +1 -0
- package/dist/util/cli/commands/chime-play-buzzer.d.ts +3 -0
- package/dist/util/cli/commands/chime-play-buzzer.d.ts.map +1 -0
- package/dist/util/cli/commands/chime-play-buzzer.js +110 -0
- package/dist/util/cli/commands/chime-play-buzzer.js.map +1 -0
- package/dist/util/cli/commands/chime-play-speaker.d.ts +3 -0
- package/dist/util/cli/commands/chime-play-speaker.d.ts.map +1 -0
- package/dist/util/cli/commands/chime-play-speaker.js +128 -0
- package/dist/util/cli/commands/chime-play-speaker.js.map +1 -0
- package/dist/util/cli/commands/chime.d.ts +3 -0
- package/dist/util/cli/commands/chime.d.ts.map +1 -0
- package/dist/util/cli/commands/chime.js +49 -0
- package/dist/util/cli/commands/chime.js.map +1 -0
- package/dist/util/cli/commands/decode.d.ts +3 -0
- package/dist/util/cli/commands/decode.d.ts.map +1 -0
- package/dist/util/cli/commands/decode.js +70 -0
- package/dist/util/cli/commands/decode.js.map +1 -0
- package/dist/util/cli/commands/diagnostics.d.ts +3 -0
- package/dist/util/cli/commands/diagnostics.d.ts.map +1 -0
- package/dist/util/cli/commands/diagnostics.js +163 -0
- package/dist/util/cli/commands/diagnostics.js.map +1 -0
- package/dist/util/cli/commands/doctor.d.ts +3 -0
- package/dist/util/cli/commands/doctor.d.ts.map +1 -0
- package/dist/util/cli/commands/doctor.js +287 -0
- package/dist/util/cli/commands/doctor.js.map +1 -0
- package/dist/util/cli/commands/info.d.ts +3 -0
- package/dist/util/cli/commands/info.d.ts.map +1 -0
- package/dist/util/cli/commands/info.js +219 -0
- package/dist/util/cli/commands/info.js.map +1 -0
- package/dist/util/cli/commands/reboot.d.ts +3 -0
- package/dist/util/cli/commands/reboot.d.ts.map +1 -0
- package/dist/util/cli/commands/reboot.js +188 -0
- package/dist/util/cli/commands/reboot.js.map +1 -0
- package/dist/util/cli/commands/relay-toggle.d.ts +3 -0
- package/dist/util/cli/commands/relay-toggle.d.ts.map +1 -0
- package/dist/util/cli/commands/relay-toggle.js +134 -0
- package/dist/util/cli/commands/relay-toggle.js.map +1 -0
- package/dist/util/cli/commands/relay.d.ts +3 -0
- package/dist/util/cli/commands/relay.d.ts.map +1 -0
- package/dist/util/cli/commands/relay.js +47 -0
- package/dist/util/cli/commands/relay.js.map +1 -0
- package/dist/util/cli/commands/update.d.ts +3 -0
- package/dist/util/cli/commands/update.d.ts.map +1 -0
- package/dist/util/cli/commands/update.js +137 -0
- package/dist/util/cli/commands/update.js.map +1 -0
- package/dist/util/cli/commands/watch-events.d.ts +3 -0
- package/dist/util/cli/commands/watch-events.d.ts.map +1 -0
- package/dist/util/cli/commands/watch-events.js +250 -0
- package/dist/util/cli/commands/watch-events.js.map +1 -0
- package/dist/util/cli/commands/watch-livestream.d.ts +3 -0
- package/dist/util/cli/commands/watch-livestream.d.ts.map +1 -0
- package/dist/util/cli/commands/watch-livestream.js +242 -0
- package/dist/util/cli/commands/watch-livestream.js.map +1 -0
- package/dist/util/cli/commands/watch-raw.d.ts +3 -0
- package/dist/util/cli/commands/watch-raw.d.ts.map +1 -0
- package/dist/util/cli/commands/watch-raw.js +211 -0
- package/dist/util/cli/commands/watch-raw.js.map +1 -0
- package/dist/util/cli/commands/watch-state.d.ts +3 -0
- package/dist/util/cli/commands/watch-state.d.ts.map +1 -0
- package/dist/util/cli/commands/watch-state.js +215 -0
- package/dist/util/cli/commands/watch-state.js.map +1 -0
- package/dist/util/cli/commands/watch.d.ts +3 -0
- package/dist/util/cli/commands/watch.d.ts.map +1 -0
- package/dist/util/cli/commands/watch.js +51 -0
- package/dist/util/cli/commands/watch.js.map +1 -0
- package/dist/util/cli/credentials.d.ts +36 -0
- package/dist/util/cli/credentials.d.ts.map +1 -0
- package/dist/util/cli/credentials.js +94 -0
- package/dist/util/cli/credentials.js.map +1 -0
- package/dist/util/cli/diagnostics-feed.d.ts +31 -0
- package/dist/util/cli/diagnostics-feed.d.ts.map +1 -0
- package/dist/util/cli/diagnostics-feed.js +57 -0
- package/dist/util/cli/diagnostics-feed.js.map +1 -0
- package/dist/util/cli/index.d.ts +3 -0
- package/dist/util/cli/index.d.ts.map +1 -0
- package/dist/util/cli/index.js +137 -0
- package/dist/util/cli/index.js.map +1 -0
- package/dist/util/cli/lookup.d.ts +127 -0
- package/dist/util/cli/lookup.d.ts.map +1 -0
- package/dist/util/cli/lookup.js +187 -0
- package/dist/util/cli/lookup.js.map +1 -0
- package/dist/util/cli/output/colors.d.ts +46 -0
- package/dist/util/cli/output/colors.d.ts.map +1 -0
- package/dist/util/cli/output/colors.js +59 -0
- package/dist/util/cli/output/colors.js.map +1 -0
- package/dist/util/cli/output/format.d.ts +139 -0
- package/dist/util/cli/output/format.d.ts.map +1 -0
- package/dist/util/cli/output/format.js +215 -0
- package/dist/util/cli/output/format.js.map +1 -0
- package/dist/util/cli/shared.d.ts +322 -0
- package/dist/util/cli/shared.d.ts.map +1 -0
- package/dist/util/cli/shared.js +401 -0
- package/dist/util/cli/shared.js.map +1 -0
- package/package.json +33 -22
- package/src/client/client.ts +741 -0
- package/src/client/connection.ts +722 -0
- package/src/client/livestream-pool.ts +1335 -0
- package/src/clock.ts +79 -0
- package/src/devices/camera.ts +251 -0
- package/src/devices/chime.ts +91 -0
- package/src/devices/context.ts +35 -0
- package/src/devices/device.ts +249 -0
- package/src/devices/endpoints.ts +38 -0
- package/src/devices/fob.ts +25 -0
- package/src/devices/light.ts +24 -0
- package/src/devices/nvr.ts +76 -0
- package/src/devices/registry.ts +145 -0
- package/src/devices/relay.ts +40 -0
- package/src/devices/sensor.ts +24 -0
- package/src/devices/viewer.ts +24 -0
- package/src/diagnostics.ts +406 -0
- package/src/errors.ts +421 -0
- package/src/event-bus.ts +139 -0
- package/src/index.ts +125 -0
- package/src/logging.ts +45 -0
- package/src/protocol/events.ts +533 -0
- package/src/protocol/packet.ts +304 -0
- package/src/protocol/reducer.ts +658 -0
- package/src/settings.ts +135 -0
- package/src/state/selectors.ts +502 -0
- package/src/state/store.ts +519 -0
- package/src/transport/auth.ts +254 -0
- package/src/transport/events-stream.ts +539 -0
- package/src/transport/http.ts +620 -0
- package/src/transport/livestream-session.ts +782 -0
- package/src/transport/talkback-session.ts +469 -0
- package/src/transport/ws-endpoint.ts +99 -0
- package/src/transport/ws.ts +118 -0
- package/src/types/base.ts +164 -0
- package/src/types/camera.ts +758 -0
- package/src/types/chime.ts +59 -0
- package/src/types/common.ts +28 -0
- package/src/types/events.ts +133 -0
- package/src/types/fob.ts +33 -0
- package/src/types/index.ts +57 -0
- package/src/types/light.ts +53 -0
- package/src/types/nvr.ts +598 -0
- package/src/types/relay.ts +70 -0
- package/src/types/sensor.ts +235 -0
- package/src/types/shapes.ts +92 -0
- package/src/types/viewer.ts +42 -0
- package/src/util/cli/client.ts +110 -0
- package/src/util/cli/commands/camera-flashlight.ts +64 -0
- package/src/util/cli/commands/camera-snapshot.ts +99 -0
- package/src/util/cli/commands/camera-talkback.ts +111 -0
- package/src/util/cli/commands/camera-unlock.ts +62 -0
- package/src/util/cli/commands/camera.ts +72 -0
- package/src/util/cli/commands/chime-play-buzzer.ts +62 -0
- package/src/util/cli/commands/chime-play-speaker.ts +83 -0
- package/src/util/cli/commands/chime.ts +64 -0
- package/src/util/cli/commands/decode.ts +98 -0
- package/src/util/cli/commands/diagnostics.ts +116 -0
- package/src/util/cli/commands/doctor.ts +339 -0
- package/src/util/cli/commands/info.ts +216 -0
- package/src/util/cli/commands/reboot.ts +179 -0
- package/src/util/cli/commands/relay-toggle.ts +91 -0
- package/src/util/cli/commands/relay.ts +62 -0
- package/src/util/cli/commands/update.ts +100 -0
- package/src/util/cli/commands/watch-events.ts +263 -0
- package/src/util/cli/commands/watch-livestream.ts +231 -0
- package/src/util/cli/commands/watch-raw.ts +195 -0
- package/src/util/cli/commands/watch-state.ts +227 -0
- package/src/util/cli/commands/watch.ts +66 -0
- package/src/util/cli/credentials.ts +160 -0
- package/src/util/cli/diagnostics-feed.ts +81 -0
- package/src/util/cli/index.ts +182 -0
- package/src/util/cli/lookup.ts +260 -0
- package/src/util/cli/output/colors.ts +98 -0
- package/src/util/cli/output/format.ts +297 -0
- package/src/util/cli/shared.ts +660 -0
- package/dist/protect-api-events.d.ts +0 -104
- package/dist/protect-api-events.js +0 -122
- package/dist/protect-api-events.js.map +0 -1
- package/dist/protect-api-livestream.d.ts +0 -155
- package/dist/protect-api-livestream.js +0 -516
- package/dist/protect-api-livestream.js.map +0 -1
- package/dist/protect-api.d.ts +0 -1163
- package/dist/protect-api.js +0 -1814
- package/dist/protect-api.js.map +0 -1
- package/dist/protect-logging.d.ts +0 -20
- package/dist/protect-logging.js +0 -6
- package/dist/protect-logging.js.map +0 -1
- package/dist/protect-types.d.ts +0 -1436
- package/dist/protect-types.js +0 -6
- package/dist/protect-types.js.map +0 -1
- package/dist/util/ufp.d.ts +0 -2
- package/dist/util/ufp.js +0 -939
- package/dist/util/ufp.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,90 +8,134 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/unifi-protect)
|
|
9
9
|
[](https://www.npmjs.com/package/unifi-protect)
|
|
10
10
|
|
|
11
|
-
## A complete UniFi Protect API
|
|
11
|
+
## A complete, modern TypeScript implementation of the UniFi Protect API.
|
|
12
12
|
</DIV>
|
|
13
13
|
</SPAN>
|
|
14
14
|
|
|
15
|
-
`unifi-protect` is a library that
|
|
15
|
+
`unifi-protect` is a TypeScript library that connects to and communicates with the Ubiquiti UniFi Protect API and ecosystem. [UniFi Protect](https://ui.com/camera-security) is [Ubiquiti's](https://www.ui.com) video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app you can use to view, configure, and manage your cameras and doorbells.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
In short - because I use it every day to support a very popular [Homebridge](https://homebridge.io) plugin named [homebridge-unifi-protect](https://www.npmjs.com/package/homebridge-unifi-protect) that I maintain. I have been occasionally asked if I would consider packaging the core API library separately from the plugin so that other open source projects can take advantage of the work that's been done here to understand and decode the UniFi Protect API.
|
|
17
|
+
It is ESM-only, Node 22.18+, and built around a single insight: the controller's state is a reducer over a typed realtime packet stream, with a periodic re-bootstrap as a permanent failsafe. You connect once, then read live device projections, observe state as it changes, subscribe to a typed event firehose, and stream cameras through a shared livestream pool - all with typed errors and `await using` resource cleanup.
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
## Installation
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
To use this library in Node, install it from the command line:
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
```sh
|
|
24
|
+
npm install unifi-protect
|
|
25
|
+
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Getting started
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
- Full access to the UniFi Protect NVR JSON.
|
|
31
|
-
- The ability to retrieve the JSON details, including status, of any supported UniFi Protect device.
|
|
32
|
-
- The ability to modify the Protect NVR JSON or Protect devices.
|
|
33
|
-
- The ability to programmatically access the H.264 livestream for any camera. This is useful when you want lightweight access to the full camera feed without resorting to RTSP. For example, this is how [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect) implements HomeKit Secure Video capabilities, resulting in a lighter weight solution than trying to read the RTSP streams for each camera from the Protect controller.
|
|
29
|
+
`ProtectClient.connect()` is the one entry point. It logs in, fetches the initial bootstrap, opens the realtime events channel, and returns a fully-ready client - or throws a typed error. There is no half-constructed client to clean up on failure, and every long-lived object is an `AsyncDisposable`, so `await using` tears everything down at scope exit.
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
```ts
|
|
32
|
+
import { ProtectClient } from "unifi-protect";
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
To use this library in Node, install it from the command line:
|
|
34
|
+
await using client = await ProtectClient.connect({ host: "192.168.1.1", password: "password", username: "protect-user" });
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
console.log("Connected to", client.controllerName, "with", client.cameras.length, "cameras.");
|
|
37
|
+
|
|
38
|
+
// Devices are live projections over the current state - hold one for hours; its getters always reflect the latest state.
|
|
39
|
+
for(const camera of client.cameras) {
|
|
40
|
+
|
|
41
|
+
console.log(camera.name, camera.isOnline ? "online" : "offline");
|
|
42
|
+
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
When the scope exits - including on a thrown error - `await using` closes the events stream, every livestream session, the refresh failsafe, and the connection pool. There is no `.stop()` to forget.
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
import { ProtectApi } from "unifi-protect";
|
|
47
|
+
## The realtime firehose
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
`client.events()` is an async iterable of every typed event the controller emits, ending cleanly when its signal aborts:
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
await
|
|
51
|
+
```ts
|
|
52
|
+
for await (const event of client.events({ signal })) {
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
const cameras = protect.bootstrap?.cameras ?? [];
|
|
54
|
+
switch(event.kind) {
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
case "motionDetected": onMotion(event.cameraId); break;
|
|
57
|
+
case "smartDetect": onSmartDetect(event.cameraId, event.objectTypes); break;
|
|
58
|
+
case "doorbellRing": onRing(event.cameraId); break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
60
61
|
```
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
To track a slice of state instead of the raw firehose, observe a selector: `client.state.observe(selector)` yields the selector's output only when it changes.
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
## Typed errors: recoverable vs fatal
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
So...how does UniFi Protect provide realtime events? On UniFi OS-based controllers, it uses a websocket called `updates`. This connection provides a realtime stream of health, status, and events that the cameras encounter - including motion events and doorbell ring events.
|
|
67
|
+
Every failure is a typed `ProtectError`, classified by the only universal question - can the caller retry? Catch the abstract base for policy, the concrete class for specifics.
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
```ts
|
|
70
|
+
import { ProtectAuthorizationError, RecoverableError } from "unifi-protect";
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
try {
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
const jpeg = await client.camera(id)?.snapshot({ signal, width: 1920 });
|
|
75
|
+
} catch(error) {
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
if(error instanceof ProtectAuthorizationError) {
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
return; // 403 - the account lacks the rights; not retryable.
|
|
80
|
+
}
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
if(error instanceof RecoverableError) {
|
|
83
|
+
|
|
84
|
+
return deferAndRetry(); // throttle, timeout, network, abort, stall - defer and retry.
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
* Login to the UniFi Protect controller and obtain the bootstrap JSON. The URL is: `https://protect-nvr-ip/proxy/protect/api/bootstrap`. You can look through [protect-api.ts](https://github.com/hjdhjd/unifi-protect/blob/main/src/protect-api.ts) for a better understanding of the Protect login process and how to obtain the bootstrap JSON.
|
|
84
|
-
* Open the websocket to the updates URL. The URL is: `wss://protect-nvr-ip/proxy/protect/ws/updates?lastUpdateId=X`. You can grab lastUpdateId from the bootstrap JSON in the prior step. You can [see an example in protect-api.ts](https://github.com/hjdhjd/unifi-protect/blob/main/src/protect-api.ts).
|
|
85
|
-
* Then you're ready to listen to messages. You can see an [example of this in protect-api.ts](https://github.com/hjdhjd/unifi-protect/blob/main/src/protect-api.ts).
|
|
91
|
+
`RecoverableError` (throttle, timeout, network, abort, stall, lag) means "you may retry or defer"; `FatalError` (auth, authorization, request, protocol, bootstrap) means "propagate." Connection health - throttling, controller reboots, automatic recovery after an outage - is observable on `client.connection`.
|
|
86
92
|
|
|
87
|
-
|
|
93
|
+
## Livestreaming
|
|
88
94
|
|
|
89
|
-
|
|
90
|
-
UniFi OS update data packets are used to provide a realtime stream of updates to Protect. It differs from the system events API in that the system events API appears to be shared across other applications (Network, Access, etc.) while the updates events API appears to only be utilized by Protect and not shared by other applications, although the protocol is shared.
|
|
95
|
+
`camera.livestream()` returns a `LivestreamSubscription` - an async iterable of fMP4 segments. The library pools sessions: two subscriptions with identical parameters share one underlying WebSocket, and a late joiner is replayed the cached init segment. This is true access to the camera's encoded video datastream (H.264, HEVC, or AV1), not the RTSP URLs.
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
```ts
|
|
98
|
+
await using live = client.camera(id)?.livestream({ channel: 0, signal });
|
|
93
99
|
|
|
94
|
-
|
|
100
|
+
for await (const segment of live) {
|
|
101
|
+
|
|
102
|
+
ffmpeg.stdin.write(segment.data);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Guides
|
|
107
|
+
|
|
108
|
+
- **[Recipes](https://github.com/hjdhjd/unifi-protect/blob/main/docs/guides/recipes.md)** - the common composition patterns: streaming, observing state changes, RTSP enablement, qualified names, privilege gating, typed errors, and connection health.
|
|
109
|
+
- **[Diagnostics](https://github.com/hjdhjd/unifi-protect/blob/main/docs/guides/diagnostics.md)** - the `node:diagnostics_channel` observability surface: every named channel, its payload shape, and how to subscribe.
|
|
110
|
+
- **[Migrating from v4](https://github.com/hjdhjd/unifi-protect/blob/main/docs/guides/migrating-from-v4.md)** - a complete v4-to-v5 API mapping: what moved, what changed shape, and what was removed (and what to do instead).
|
|
111
|
+
|
|
112
|
+
The [`ufp` CLI](https://github.com/hjdhjd/unifi-protect/tree/main/src/util/cli) is the canonical reference consumer - it exercises every API surface against real hardware using the exact idioms in the guides (`await using`, `AbortSignal` for Ctrl-C, typed errors, async iteration). Read it alongside the guides; `ufp doctor` is also the quickest "is my install healthy?" probe.
|
|
113
|
+
|
|
114
|
+
## Why use this library for UniFi Protect support?
|
|
115
|
+
|
|
116
|
+
In short - because I use it every day to support a very popular [Homebridge](https://homebridge.io) plugin named [homebridge-unifi-protect](https://www.npmjs.com/package/homebridge-unifi-protect) that I maintain. I package the core API library separately from the plugin so that other open source projects can take advantage of the work that's been done here to understand and decode the UniFi Protect API.
|
|
117
|
+
|
|
118
|
+
This implementation is unique: it's the first complete open source implementation of the realtime UniFi Protect update API, enabling instantaneous updates to Protect-related events. It's also the first (and to my knowledge only) complete implementation of the livestream API provided by UniFi Protect - true access to the encoded video datastream (H.264, HEVC, or AV1) for any camera connected to the Protect controller, not the RTSP URLs the controller exposes.
|
|
119
|
+
|
|
120
|
+
Finally - the most significant reason that you should use this library: it's very well-tested, it is modern, and most importantly, *it just works*. It's quite easy to add support for UniFi Protect in your project, and you can rely on the fact that the code is used by a significant population of users out there who ensure its continued robustness.
|
|
121
|
+
|
|
122
|
+
### How you can contribute and make this library even better
|
|
123
|
+
|
|
124
|
+
This implementation is largely feature complete. I strive to add support for meaningful features for a broad group of people in order to avoid any unnecessary cruft and technical debt that may accrue over time.
|
|
125
|
+
|
|
126
|
+
The UniFi Protect API is undocumented, and implementing a library like this one is the result of many hours of trial and error as well as community support.
|
|
127
|
+
|
|
128
|
+
## Changelog
|
|
129
|
+
|
|
130
|
+
* [Changelog](https://github.com/hjdhjd/unifi-protect/blob/main/docs/Changelog.md): changes and release history of this library.
|
|
131
|
+
|
|
132
|
+
## The UniFi Protect realtime events API
|
|
133
|
+
|
|
134
|
+
So...how does UniFi Protect provide realtime events? On UniFi OS-based controllers, it uses a websocket called `updates`. This connection provides a realtime stream of health, status, and events that the cameras encounter - including motion events and doorbell ring events.
|
|
135
|
+
|
|
136
|
+
The library handles this for you: `ProtectClient.connect()` opens the websocket, and `client.events()` hands you a typed, decoded event stream. The notes below document the binary protocol the library decodes, for the curious and for anyone exploring the API themselves. The decoder lives in [`src/protocol/packet.ts`](https://github.com/hjdhjd/unifi-protect/blob/main/src/protocol/packet.ts), the event classifier in [`src/protocol/events.ts`](https://github.com/hjdhjd/unifi-protect/blob/main/src/protocol/events.ts), and the wire/configuration types in [`src/types.ts`](https://github.com/hjdhjd/unifi-protect/blob/main/src/types.ts).
|
|
137
|
+
|
|
138
|
+
The `updates` websocket uses a binary protocol to encode data, largely to minimize bandwidth and to allow more than JSON data if needed. Cameras continuously stream updates to the controller containing camera health, statistics, and - crucially - events such as motion and doorbell rings. A complete update packet is composed of four frames:
|
|
95
139
|
|
|
96
140
|
```sh
|
|
97
141
|
Header Frame (8 bytes)
|
|
@@ -103,12 +147,9 @@ So how does it all work? Cameras continuously stream updates to the UniFi Protec
|
|
|
103
147
|
Data Frame
|
|
104
148
|
```
|
|
105
149
|
|
|
106
|
-
Let's look at each of these.
|
|
107
|
-
|
|
108
150
|
##### Header Frame
|
|
109
|
-
The header frame is required overhead since websockets provide only a transport medium. Its purpose is to tell us what's coming in the frame that follows.
|
|
110
151
|
|
|
111
|
-
|
|
152
|
+
The header frame is overhead that tells us what's coming in the frame that follows. It is 8 bytes:
|
|
112
153
|
|
|
113
154
|
| Byte Offset | Description | Bits | Values
|
|
114
155
|
|----------------|-----------------|---------|-----------------------------------------
|
|
@@ -118,35 +159,46 @@ A packet header is composed of 8 bytes in this order:
|
|
|
118
159
|
| 3 | Unknown | 8 | Always 0. Possibly reserved for future use by Ubiquiti?
|
|
119
160
|
| 4-7 | Payload Size | 32 | Size of payload in network-byte order (big endian).
|
|
120
161
|
|
|
121
|
-
If the header
|
|
162
|
+
If the header marks the payload as deflated, inflate it before use.
|
|
122
163
|
|
|
123
164
|
##### Action Frame
|
|
124
|
-
|
|
165
|
+
|
|
166
|
+
The action frame identifies the action and category the update contains:
|
|
125
167
|
|
|
126
168
|
| Property | Description
|
|
127
169
|
|-------------|------------------------------------------------------------------------------------
|
|
128
170
|
| action | What action is being taken. Known actions are `add` and `update`.
|
|
129
171
|
| id | The identifier for the device we're updating.
|
|
130
172
|
| modelKey | The device model category that we're updating.
|
|
131
|
-
| newUpdateId | A new UUID generated
|
|
173
|
+
| newUpdateId | A new UUID generated per update. This can be safely ignored, it seems.
|
|
132
174
|
|
|
133
175
|
##### Data Frame
|
|
134
|
-
|
|
176
|
+
|
|
177
|
+
The final part of the update packet is the data frame. It can be three types - although in practice JSONs are all that come across:
|
|
135
178
|
|
|
136
179
|
| Payload Type | Description
|
|
137
180
|
|--------------|------------------------------------------------------------------------------------
|
|
138
|
-
| 1 | JSON.
|
|
181
|
+
| 1 | JSON. For an `update` action whose `modelKey` is not `event` (e.g. `camera`), this is **always** a subset of the configuration bootstrap JSON.
|
|
139
182
|
| 2 | A UTF8-encoded string.
|
|
140
183
|
| 3 | Node Buffer.
|
|
141
184
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
* `
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* With the exception of `update` actions with a `modelKey` of `event`, JSONs are always a subset of the bootstrap JSON, indexed off of `modelKey`.
|
|
185
|
+
##### Notes
|
|
186
|
+
|
|
187
|
+
* `update` actions are tied to any modelKey that exists in the bootstrap JSON. The exception is `event`, which is tied to the Protect events history list. The library recognizes these modelKeys on the wire: `camera`, `chime`, `light`, `sensor`, `viewer`, `nvr`, `user`, `liveview`, `group`, `bridge`, `event`, `activeSessionStat`, `aiport`, `aiprocessor`, `linkstation`, `relay`, and `smartDetectObject`. It reduces a subset of these into its canonical state (the devices, the NVR, and the `user` roster); the rest are recognized but not modeled, so a genuinely novel modelKey surfaces on the `unifi-protect:schema:unknownModelKey` diagnostics channel rather than being silently absorbed.
|
|
188
|
+
* `add` actions are tied to the `event` modelKey and mark the beginning of an item in the Protect events list. A subsequent `update` action signals the end of the event capture and its confidence score.
|
|
189
|
+
* This is **not** the same as motion detection. To detect motion, the library watches `update` actions for `camera` modelKeys (a JSON updating `lastMotion`); for doorbell rings, `lastRing`. The events list is useful for the Protect app but slower than watching the `lastMotion` JSON, which tends to be more timely.
|
|
190
|
+
* With the exception of `update` actions with a `modelKey` of `event`, JSONs are always a subset of the bootstrap JSON, indexed off of `modelKey`.
|
|
191
|
+
|
|
192
|
+
I welcome any additions or corrections to the protocol for the benefit of the community. I hope this helps others launch their own exploration and create new and interesting Protect-enabled capabilities.
|
|
193
|
+
|
|
194
|
+
#### Non-Ubiquiti Apps Using the Protect API
|
|
195
|
+
|
|
196
|
+
This list represents all known apps using the realtime events API for UniFi Protect. If you're using the information you discovered here for your own UniFi Protect-based solution, please open an issue and I'm happy to add a link below.
|
|
197
|
+
|
|
198
|
+
* [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect): Seamless integration of UniFi Protect into HomeKit with support for cameras, doorbells, and more.
|
|
148
199
|
|
|
149
200
|
## Library Development Dashboard
|
|
201
|
+
|
|
150
202
|
This is mostly of interest to the true developer nerds amongst us.
|
|
151
203
|
|
|
152
204
|
[](https://github.com/hjdhjd/unifi-protect/blob/main/LICENSE.md)
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The consumer-facing entry point and composition root. {@link ProtectClient.connect} is the one way in: it performs login and the initial bootstrap as a single atomic
|
|
3
|
+
* operation, returning a fully-ready client or throwing a typed `FatalError`. There is no half-constructed state - a failure at any stage tears down what was built (no
|
|
4
|
+
* leaked connection pool) before the error propagates.
|
|
5
|
+
*
|
|
6
|
+
* The client *composes* its subsystems rather than inheriting from any of them. It owns a {@link Transport}, an {@link AuthSession}, a {@link StateStore}, a {@link
|
|
7
|
+
* DeviceRegistry}, and a private {@link EventBus} - and exposes a deliberately small surface over them:
|
|
8
|
+
*
|
|
9
|
+
* - `state` is the data layer: synchronous `snapshot()` and live `observe(selector)` over config records.
|
|
10
|
+
* - `cameras` / `camera(id)` (and the other device accessors) are the device layer: live {@link DeviceProjection} handles built by the registry. They live on the
|
|
11
|
+
* client, not on `state`, because a projection is Layer 3 - it needs the client - while `state` stays a pure generic engine.
|
|
12
|
+
* - `transport` is the documented escape hatch for raw API calls the typed surface does not yet cover.
|
|
13
|
+
* - `on` / `once` / `stream` are the rail-based event surface, delegated to the private bus; the realtime firehose rides the `packet` rail (see `events()`).
|
|
14
|
+
*
|
|
15
|
+
* @module ProtectClient
|
|
16
|
+
*/
|
|
17
|
+
import type { ProtectNvrLiveviewConfig, ProtectRingtoneConfig } from "../types/index.ts";
|
|
18
|
+
import type { Camera } from "../devices/camera.ts";
|
|
19
|
+
import type { Chime } from "../devices/chime.ts";
|
|
20
|
+
import type { Clock } from "../clock.ts";
|
|
21
|
+
import { ConnectionMonitor } from "./connection.ts";
|
|
22
|
+
import type { Dispatcher } from "undici";
|
|
23
|
+
import type { Fob } from "../devices/fob.ts";
|
|
24
|
+
import type { Light } from "../devices/light.ts";
|
|
25
|
+
import type { Nvr } from "../devices/nvr.ts";
|
|
26
|
+
import type { ProtectLogging } from "../logging.ts";
|
|
27
|
+
import type { ProtectWebSocket } from "../transport/ws.ts";
|
|
28
|
+
import type { RawPacket } from "../protocol/packet.ts";
|
|
29
|
+
import type { RecoveryPolicy } from "./livestream-pool.ts";
|
|
30
|
+
import type { Relay } from "../devices/relay.ts";
|
|
31
|
+
import type { Sensor } from "../devices/sensor.ts";
|
|
32
|
+
import { StateStore } from "../state/store.ts";
|
|
33
|
+
import type { StreamOptions } from "../event-bus.ts";
|
|
34
|
+
import { Transport } from "../transport/http.ts";
|
|
35
|
+
import type { TypedEvent } from "../protocol/events.ts";
|
|
36
|
+
import type { Viewer } from "../devices/viewer.ts";
|
|
37
|
+
/**
|
|
38
|
+
* Options for {@link ProtectClient.connect}. `host`, `username`, and `password` are the required controller address and credentials; the rest are optional injected
|
|
39
|
+
* seams, each defaulted at the composition root:
|
|
40
|
+
*
|
|
41
|
+
* - `clock` is the time source threaded into every subsystem (transport, store, event stream, livestream pool); it defaults to the wall clock, and tests inject a
|
|
42
|
+
* fake to drive timers deterministically.
|
|
43
|
+
* - `dispatcher` is an undici `Dispatcher` for the transport's connection pool; when omitted the transport builds and owns its own pool.
|
|
44
|
+
* - `log` is the structured logger; it defaults to a no-op sink.
|
|
45
|
+
* - `recoveryPolicy` is the per-stream livestream recovery decision authority handed to the livestream pool; it defaults to {@link
|
|
46
|
+
* defaultLivestreamRecoveryPolicy}.
|
|
47
|
+
* - `refreshIntervalMs` sets the {@link StateStore}'s bootstrap-refresh failsafe cadence; it defaults to the store's interval, and passing `false` disables the
|
|
48
|
+
* failsafe entirely so the consumer relies solely on the realtime event stream.
|
|
49
|
+
* - `signal` cancels the initial login and bootstrap fetch; it is bound only to connect, never to a later recovery relaunch.
|
|
50
|
+
* - `webSocket` is the receive-direction {@link ProtectWebSocket} factory used by the events stream and livestream pool; it defaults to a real socket and is the
|
|
51
|
+
* socket-injection seam for tests. It does not apply to the write-direction talkback socket.
|
|
52
|
+
*
|
|
53
|
+
* @category Client
|
|
54
|
+
*/
|
|
55
|
+
export interface ConnectOptions {
|
|
56
|
+
clock?: Clock;
|
|
57
|
+
dispatcher?: Dispatcher;
|
|
58
|
+
host: string;
|
|
59
|
+
log?: ProtectLogging;
|
|
60
|
+
password: string;
|
|
61
|
+
recoveryPolicy?: RecoveryPolicy;
|
|
62
|
+
refreshIntervalMs?: number | false;
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
username: string;
|
|
65
|
+
webSocket?: (url: string) => ProtectWebSocket;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The events the {@link ProtectClient} publishes. `packet` is the realtime event firehose - the same `TypedEvent` stream that feeds the reducer, fanned out to consumers.
|
|
69
|
+
* It is produced by the realtime events WebSocket and bridged here at the composition root: each decoded event is dispatched into the store and then emitted on this rail
|
|
70
|
+
* from the one bridge subscription, so there is a single decode path for both the state model and the firehose.
|
|
71
|
+
*
|
|
72
|
+
* `rawPacket` is the raw observability firehose - the decoded {@link RawPacket} of every frame, including the valid-but-unmodeled ones the classifier drops (so `packet`
|
|
73
|
+
* never sees them). It is bridged from the same single decode site, one step before classification, and is pure observability: never dispatched into the store, no
|
|
74
|
+
* state-ordering guarantee. Consumers use it for protocol exploration and capture; the modeled state and event model still flow through `packet`.
|
|
75
|
+
*
|
|
76
|
+
* @category Client
|
|
77
|
+
*/
|
|
78
|
+
export interface ProtectClientEvents {
|
|
79
|
+
packet: [event: TypedEvent];
|
|
80
|
+
rawPacket: [packet: RawPacket];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The UniFi Protect client. Construct via {@link ProtectClient.connect}.
|
|
84
|
+
*
|
|
85
|
+
* @category Client
|
|
86
|
+
*/
|
|
87
|
+
export declare class ProtectClient implements AsyncDisposable {
|
|
88
|
+
#private;
|
|
89
|
+
private constructor();
|
|
90
|
+
/**
|
|
91
|
+
* Connect to a Protect controller. Logs in, fetches the initial bootstrap, seeds the reducer, and wires the periodic refresh failsafe - all as one atomic operation.
|
|
92
|
+
*
|
|
93
|
+
* @param opts - The controller address, credentials, and optional seams (logger, clock, refresh interval, injected dispatcher, abort signal).
|
|
94
|
+
*
|
|
95
|
+
* @returns A fully-ready client.
|
|
96
|
+
*
|
|
97
|
+
* @throws {@link ProtectAuthError} on bad credentials, {@link ProtectNetworkError} when the controller is unreachable, {@link ProtectBootstrapError} when the
|
|
98
|
+
* bootstrap cannot be fetched or parsed - and any other typed `FatalError` the login or fetch surfaces. No partial client escapes a failure.
|
|
99
|
+
*/
|
|
100
|
+
static connect(opts: ConnectOptions): Promise<ProtectClient>;
|
|
101
|
+
/**
|
|
102
|
+
* Decode a raw realtime packet's bytes into a {@link RawPacket} - the validated wire header plus the data-frame payload, *before* classification. A static, pure,
|
|
103
|
+
* connection-independent operation: it is the offline counterpart of the {@link ProtectClient.rawPackets} rail (which is this same decode applied to the live socket),
|
|
104
|
+
* and it is a `static` rather than an instance method precisely because decoding needs no client - it reads no connection state. Pair it with {@link
|
|
105
|
+
* ProtectClient.classifyPacket} to reproduce the live pipeline (`classifyPacket(decodePacket(bytes))`) over captured bytes.
|
|
106
|
+
*
|
|
107
|
+
* @param buf - The raw packet bytes (a `Buffer` included; read without copying).
|
|
108
|
+
*
|
|
109
|
+
* @returns The decoded raw packet.
|
|
110
|
+
*
|
|
111
|
+
* @throws {@link ProtectProtocolError} if the bytes are not a well-formed packet.
|
|
112
|
+
*/
|
|
113
|
+
static decodePacket(buf: Uint8Array): RawPacket;
|
|
114
|
+
/**
|
|
115
|
+
* Classify a decoded {@link RawPacket} into a {@link TypedEvent}, or `null` when the packet is valid but describes something the library does not model. The static,
|
|
116
|
+
* pure, connection-independent counterpart of the {@link ProtectClient.events} rail (which is this same classification applied to the live socket). Takes the output of
|
|
117
|
+
* {@link ProtectClient.decodePacket}, so the two compose to turn captured bytes into a typed event exactly as the realtime path does - one decode/classify
|
|
118
|
+
* implementation, reached the same way live and offline.
|
|
119
|
+
*
|
|
120
|
+
* @param packet - The decoded raw packet.
|
|
121
|
+
*
|
|
122
|
+
* @returns The classified event, or `null` for a valid-but-unmodeled packet.
|
|
123
|
+
*/
|
|
124
|
+
static classifyPacket(packet: RawPacket): TypedEvent | null;
|
|
125
|
+
/**
|
|
126
|
+
* The id(s) of the record(s) a {@link TypedEvent} concerns - a camera for a camera activity signal, the access device for an access occurrence, the reduced
|
|
127
|
+
* record for a state transition, none for the synthetic bootstrap. The static, pure counterpart that attributes any firehose event to its device(s) without a
|
|
128
|
+
* consumer re-deriving the mapping - the single source of truth the CLI's `--device` filter and event rendering both read, surfaced on the object model exactly
|
|
129
|
+
* like {@link ProtectClient.classifyPacket}. Total and exhaustive: it cannot silently lag a new event kind.
|
|
130
|
+
*
|
|
131
|
+
* @param event - Any {@link TypedEvent}, e.g. from {@link ProtectClient.events} or {@link ProtectClient.classifyPacket}.
|
|
132
|
+
*
|
|
133
|
+
* @returns The subject record id(s), possibly empty.
|
|
134
|
+
*/
|
|
135
|
+
static eventSubjects(event: TypedEvent): readonly string[];
|
|
136
|
+
/** The data layer: synchronous `snapshot()` and live `observe(selector)` over the reduced controller state. */
|
|
137
|
+
get state(): StateStore;
|
|
138
|
+
/** The HTTP transport - the documented escape hatch for raw API calls the typed surface does not cover. */
|
|
139
|
+
get transport(): Transport;
|
|
140
|
+
/** The connection monitor: the observable connection-state FSM, reboot detection, throttle/stall folding, and auto-recovery of the realtime events channel. */
|
|
141
|
+
get connection(): ConnectionMonitor;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the authenticated session holds Super Admin (camera-write) privileges. Sync sugar over {@link selectIsAdmin} of the current snapshot, for the hot-path read
|
|
144
|
+
* where awaiting an iterator is overkill; consumers `observe` the selector instead. Re-evaluated from state, so a role change surfaces on the next refresh.
|
|
145
|
+
*/
|
|
146
|
+
get isAdmin(): boolean;
|
|
147
|
+
/** The controller's display name, or `null` before the first bootstrap. Sync sugar over {@link selectControllerName} of the current snapshot. */
|
|
148
|
+
get controllerName(): string | null;
|
|
149
|
+
/**
|
|
150
|
+
* The NVR configuration as a read-only, observable projection. A singleton sibling of the device projections: `client.nvr` always returns a handle (the NVR is a
|
|
151
|
+
* singleton, so there is no `undefined` lookup), whose read-through getters (`host`, `rtspPort`, `name`, `marketName`) and `observe()` reflect the live reduced state.
|
|
152
|
+
* It bears no commands - NVR config writes are out of scope and controller reboot is {@link ProtectClient.reboot}. The getters throw only before the first bootstrap,
|
|
153
|
+
* which a connected client never reaches (`connect()` awaits it).
|
|
154
|
+
*/
|
|
155
|
+
get nvr(): Nvr;
|
|
156
|
+
/**
|
|
157
|
+
* The controller's saved liveviews, as read-only config records. Sync sugar over {@link selectLiveviews} of the current snapshot - the common "list them" read; for a
|
|
158
|
+
* by-id lookup use `selectLiveview(id)`, and for reactivity `client.state.observe(selectLiveviews)`. Liveviews are read-only config (no commands), so they are bare
|
|
159
|
+
* records rather than a command-bearing projection, and a top-level collection rather than a child of `client.nvr` - they ride the realtime wire exactly as devices do.
|
|
160
|
+
*/
|
|
161
|
+
get liveviews(): readonly ProtectNvrLiveviewConfig[];
|
|
162
|
+
/**
|
|
163
|
+
* The controller's ringtone library, as read-only config records. Sync sugar over {@link selectRingtones} of the current snapshot; for a by-id lookup use
|
|
164
|
+
* `selectRingtone(id)`, and for reactivity `client.state.observe(selectRingtones)`. Surfaced identically to {@link liveviews} - the difference is only in lifecycle
|
|
165
|
+
* (ringtones advance on the bootstrap refresh, as the controller broadcasts no realtime ringtone delta), which is invisible at this read-through surface.
|
|
166
|
+
*/
|
|
167
|
+
get ringtones(): readonly ProtectRingtoneConfig[];
|
|
168
|
+
/** Every camera in the current state, as live projections. */
|
|
169
|
+
get cameras(): readonly Camera[];
|
|
170
|
+
/** Every chime in the current state, as live projections. */
|
|
171
|
+
get chimes(): readonly Chime[];
|
|
172
|
+
/** Every fob in the current state, as live projections. */
|
|
173
|
+
get fobs(): readonly Fob[];
|
|
174
|
+
/** Every light in the current state, as live projections. */
|
|
175
|
+
get lights(): readonly Light[];
|
|
176
|
+
/** Every relay in the current state, as live projections. */
|
|
177
|
+
get relays(): readonly Relay[];
|
|
178
|
+
/** Every sensor in the current state, as live projections. */
|
|
179
|
+
get sensors(): readonly Sensor[];
|
|
180
|
+
/** Every viewer in the current state, as live projections. */
|
|
181
|
+
get viewers(): readonly Viewer[];
|
|
182
|
+
/** Look up a camera by id, or `undefined` when no such camera is in the current state. */
|
|
183
|
+
camera(id: string): Camera | undefined;
|
|
184
|
+
/** Look up a chime by id, or `undefined` when absent. */
|
|
185
|
+
chime(id: string): Chime | undefined;
|
|
186
|
+
/** Look up a fob by id, or `undefined` when absent. */
|
|
187
|
+
fob(id: string): Fob | undefined;
|
|
188
|
+
/** Look up a light by id, or `undefined` when absent. */
|
|
189
|
+
light(id: string): Light | undefined;
|
|
190
|
+
/** Look up a relay by id, or `undefined` when absent. */
|
|
191
|
+
relay(id: string): Relay | undefined;
|
|
192
|
+
/** Look up a sensor by id, or `undefined` when absent. */
|
|
193
|
+
sensor(id: string): Sensor | undefined;
|
|
194
|
+
/** Look up a viewer by id, or `undefined` when absent. */
|
|
195
|
+
viewer(id: string): Viewer | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Subscribe to a client event. Returns a `Disposable`; prefer `using sub = client.on(...)` so the listener detaches at scope exit.
|
|
198
|
+
*
|
|
199
|
+
* @param event - The event to listen for.
|
|
200
|
+
* @param handler - Invoked on each emission.
|
|
201
|
+
*
|
|
202
|
+
* @returns A `Disposable` that removes the listener when disposed.
|
|
203
|
+
*/
|
|
204
|
+
on<K extends keyof ProtectClientEvents>(event: K, handler: (...args: ProtectClientEvents[K]) => void): Disposable;
|
|
205
|
+
/**
|
|
206
|
+
* Wait for the next emission of a client event.
|
|
207
|
+
*
|
|
208
|
+
* @param event - The event to await.
|
|
209
|
+
* @param opts - Optional abort signal.
|
|
210
|
+
*
|
|
211
|
+
* @returns A promise resolving to the event's argument tuple.
|
|
212
|
+
*/
|
|
213
|
+
once<K extends keyof ProtectClientEvents>(event: K, opts?: {
|
|
214
|
+
signal?: AbortSignal;
|
|
215
|
+
}): Promise<ProtectClientEvents[K]>;
|
|
216
|
+
/**
|
|
217
|
+
* Stream every subsequent emission of a client event until the signal aborts.
|
|
218
|
+
*
|
|
219
|
+
* @param event - The event to stream.
|
|
220
|
+
* @param opts - Stream options, including the abort signal.
|
|
221
|
+
*
|
|
222
|
+
* @returns An async iterable of the event's argument tuples.
|
|
223
|
+
*/
|
|
224
|
+
stream<K extends keyof ProtectClientEvents>(event: K, opts?: StreamOptions): AsyncIterable<ProtectClientEvents[K]>;
|
|
225
|
+
/**
|
|
226
|
+
* The realtime event firehose: every {@link TypedEvent} the controller emits, until the signal aborts or the client is disposed. Sugar over `stream("packet")` that
|
|
227
|
+
* unwraps the single-element argument tuple. Each event has already been dispatched into the store by the time it reaches here, so reading `client.state` inside the
|
|
228
|
+
* loop observes the post-event state.
|
|
229
|
+
*
|
|
230
|
+
* @param opts - Optional abort signal that terminates the iteration.
|
|
231
|
+
*
|
|
232
|
+
* @returns An async iterable of typed events.
|
|
233
|
+
*/
|
|
234
|
+
events(opts?: {
|
|
235
|
+
signal?: AbortSignal;
|
|
236
|
+
}): AsyncGenerator<TypedEvent>;
|
|
237
|
+
/**
|
|
238
|
+
* The raw realtime firehose: every decoded {@link RawPacket} the controller emits - header plus payload, *before* classification - until the signal aborts or the
|
|
239
|
+
* client is disposed. Unlike {@link ProtectClient.events}, this carries the valid-but-unmodeled frames the classifier drops (an unrecognized model key, an unhandled
|
|
240
|
+
* action, a non-self-describing `event`), so it is the surface for protocol exploration and capture rather than the modeled state/event model. It is pure
|
|
241
|
+
* observability: a raw packet is never dispatched into the store, so reading `client.state` inside this loop carries no ordering guarantee relative to the frame. Sugar
|
|
242
|
+
* over `stream("rawPacket")` that unwraps the single-element argument tuple and smooths the caller's own abort into a clean return.
|
|
243
|
+
*
|
|
244
|
+
* @param opts - Optional abort signal that terminates the iteration.
|
|
245
|
+
*
|
|
246
|
+
* @returns An async iterable of raw packets.
|
|
247
|
+
*/
|
|
248
|
+
rawPackets(opts?: {
|
|
249
|
+
signal?: AbortSignal;
|
|
250
|
+
}): AsyncGenerator<RawPacket>;
|
|
251
|
+
/**
|
|
252
|
+
* Fetch the controller bootstrap on demand and return the untouched parsed JSON. The library does not *retain* the raw bootstrap - it is consumed once at connect (and
|
|
253
|
+
* on each refresh / recovery re-bootstrap) as a synthetic `bootstrapLoaded` event, and only the reduced state survives - so this is a fresh GET over the single shared
|
|
254
|
+
* bootstrap-fetch path, returning the controller's response verbatim *without* dispatching it into the store. It is a faithful raw dump for diagnostics, not a cached
|
|
255
|
+
* blob; the reduced, observable model remains `client.state`. The return type is `unknown` deliberately: this is whatever the controller sent, not the curated model.
|
|
256
|
+
*
|
|
257
|
+
* @param opts - Optional abort signal.
|
|
258
|
+
*
|
|
259
|
+
* @returns The raw bootstrap JSON as returned by the controller.
|
|
260
|
+
*
|
|
261
|
+
* @throws {@link ProtectBootstrapError} when the bootstrap cannot be fetched or parsed, or a transport-level `ProtectError`.
|
|
262
|
+
*/
|
|
263
|
+
fetchBootstrap(opts?: {
|
|
264
|
+
signal?: AbortSignal;
|
|
265
|
+
}): Promise<unknown>;
|
|
266
|
+
/**
|
|
267
|
+
* Reboot the UniFi OS controller hosting Protect. This is a controller-level operation - a UniFi-OS call (`POST /api/system/reboot`), distinct from a device's {@link
|
|
268
|
+
* DeviceProjection.reboot}: it restarts the whole console, so every device drops and re-adopts. It lives on the client, not a projection, because it is out of the
|
|
269
|
+
* Protect device model. The connection monitor observes the resulting outage and recovers automatically, firing `controllerLost` / `controllerRecovered` and - on the
|
|
270
|
+
* controller's new boot time - `controllerRebooted`.
|
|
271
|
+
*
|
|
272
|
+
* @param opts - Optional abort signal.
|
|
273
|
+
*
|
|
274
|
+
* @throws The classified `FatalError` on a non-2xx (e.g. {@link ProtectAuthorizationError} when the account lacks reboot rights), or a transport-level `ProtectError`.
|
|
275
|
+
*/
|
|
276
|
+
reboot(opts?: {
|
|
277
|
+
signal?: AbortSignal;
|
|
278
|
+
}): Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Dispose the client: tear down the connection monitor (stopping recovery and closing the events stream), close every livestream session in the pool, stop the refresh
|
|
281
|
+
* failsafe and terminate observers, end the session, and destroy the connection pool - in that order, so ingestion stops before the state and transport it feeds.
|
|
282
|
+
* Idempotent and the canonical teardown via `await using client = await ProtectClient.connect(...)`.
|
|
283
|
+
*/
|
|
284
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAuB,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK9G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;A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