unifi-protect 4.28.0 → 5.0.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.
Files changed (400) hide show
  1. package/README.md +124 -55
  2. package/dist/client/client.d.ts +286 -0
  3. package/dist/client/client.d.ts.map +1 -0
  4. package/dist/client/client.js +508 -0
  5. package/dist/client/client.js.map +1 -0
  6. package/dist/client/connection.d.ts +175 -0
  7. package/dist/client/connection.d.ts.map +1 -0
  8. package/dist/client/connection.js +445 -0
  9. package/dist/client/connection.js.map +1 -0
  10. package/dist/client/livestream-pool.d.ts +213 -0
  11. package/dist/client/livestream-pool.d.ts.map +1 -0
  12. package/dist/client/livestream-pool.js +812 -0
  13. package/dist/client/livestream-pool.js.map +1 -0
  14. package/dist/clock.d.ts +67 -0
  15. package/dist/clock.d.ts.map +1 -0
  16. package/dist/clock.js +22 -0
  17. package/dist/clock.js.map +1 -0
  18. package/dist/devices/camera.d.ts +144 -0
  19. package/dist/devices/camera.d.ts.map +1 -0
  20. package/dist/devices/camera.js +169 -0
  21. package/dist/devices/camera.js.map +1 -0
  22. package/dist/devices/chime.d.ts +60 -0
  23. package/dist/devices/chime.d.ts.map +1 -0
  24. package/dist/devices/chime.js +50 -0
  25. package/dist/devices/chime.js.map +1 -0
  26. package/dist/devices/context.d.ts +34 -0
  27. package/dist/devices/context.d.ts.map +1 -0
  28. package/dist/devices/context.js +2 -0
  29. package/dist/devices/context.js.map +1 -0
  30. package/dist/devices/device.d.ts +156 -0
  31. package/dist/devices/device.d.ts.map +1 -0
  32. package/dist/devices/device.js +183 -0
  33. package/dist/devices/device.js.map +1 -0
  34. package/dist/devices/endpoints.d.ts +15 -0
  35. package/dist/devices/endpoints.d.ts.map +1 -0
  36. package/dist/devices/endpoints.js +29 -0
  37. package/dist/devices/endpoints.js.map +1 -0
  38. package/dist/devices/fob.d.ts +15 -0
  39. package/dist/devices/fob.d.ts.map +1 -0
  40. package/dist/devices/fob.js +16 -0
  41. package/dist/devices/fob.js.map +1 -0
  42. package/dist/devices/light.d.ts +14 -0
  43. package/dist/devices/light.d.ts.map +1 -0
  44. package/dist/devices/light.js +15 -0
  45. package/dist/devices/light.js.map +1 -0
  46. package/dist/devices/nvr.d.ts +43 -0
  47. package/dist/devices/nvr.d.ts.map +1 -0
  48. package/dist/devices/nvr.js +57 -0
  49. package/dist/devices/nvr.js.map +1 -0
  50. package/dist/devices/registry.d.ts +57 -0
  51. package/dist/devices/registry.d.ts.map +1 -0
  52. package/dist/devices/registry.js +102 -0
  53. package/dist/devices/registry.js.map +1 -0
  54. package/dist/devices/relay.d.ts +28 -0
  55. package/dist/devices/relay.d.ts.map +1 -0
  56. package/dist/devices/relay.js +29 -0
  57. package/dist/devices/relay.js.map +1 -0
  58. package/dist/devices/sensor.d.ts +14 -0
  59. package/dist/devices/sensor.d.ts.map +1 -0
  60. package/dist/devices/sensor.js +15 -0
  61. package/dist/devices/sensor.js.map +1 -0
  62. package/dist/devices/viewer.d.ts +14 -0
  63. package/dist/devices/viewer.d.ts.map +1 -0
  64. package/dist/devices/viewer.js +15 -0
  65. package/dist/devices/viewer.js.map +1 -0
  66. package/dist/diagnostics.d.ts +315 -0
  67. package/dist/diagnostics.d.ts.map +1 -0
  68. package/dist/diagnostics.js +82 -0
  69. package/dist/diagnostics.js.map +1 -0
  70. package/dist/errors.d.ts +314 -0
  71. package/dist/errors.d.ts.map +1 -0
  72. package/dist/errors.js +327 -0
  73. package/dist/errors.js.map +1 -0
  74. package/dist/event-bus.d.ts +86 -0
  75. package/dist/event-bus.d.ts.map +1 -0
  76. package/dist/event-bus.js +113 -0
  77. package/dist/event-bus.js.map +1 -0
  78. package/dist/index.d.ts +35 -6
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +34 -7
  81. package/dist/index.js.map +1 -1
  82. package/dist/logging.d.ts +32 -0
  83. package/dist/logging.d.ts.map +1 -0
  84. package/dist/logging.js +21 -0
  85. package/dist/logging.js.map +1 -0
  86. package/dist/protocol/events.d.ts +254 -0
  87. package/dist/protocol/events.d.ts.map +1 -0
  88. package/dist/protocol/events.js +307 -0
  89. package/dist/protocol/events.js.map +1 -0
  90. package/dist/protocol/packet.d.ts +52 -0
  91. package/dist/protocol/packet.d.ts.map +1 -0
  92. package/dist/protocol/packet.js +206 -0
  93. package/dist/protocol/packet.js.map +1 -0
  94. package/dist/protocol/reducer.d.ts +110 -0
  95. package/dist/protocol/reducer.d.ts.map +1 -0
  96. package/dist/protocol/reducer.js +265 -0
  97. package/dist/protocol/reducer.js.map +1 -0
  98. package/dist/settings.d.ts +21 -0
  99. package/dist/settings.d.ts.map +1 -0
  100. package/dist/settings.js +100 -0
  101. package/dist/settings.js.map +1 -1
  102. package/dist/state/selectors.d.ts +563 -0
  103. package/dist/state/selectors.d.ts.map +1 -0
  104. package/dist/state/selectors.js +330 -0
  105. package/dist/state/selectors.js.map +1 -0
  106. package/dist/state/store.d.ts +71 -0
  107. package/dist/state/store.d.ts.map +1 -0
  108. package/dist/state/store.js +250 -0
  109. package/dist/state/store.js.map +1 -0
  110. package/dist/transport/auth.d.ts +77 -0
  111. package/dist/transport/auth.d.ts.map +1 -0
  112. package/dist/transport/auth.js +164 -0
  113. package/dist/transport/auth.js.map +1 -0
  114. package/dist/transport/events-stream.d.ts +133 -0
  115. package/dist/transport/events-stream.d.ts.map +1 -0
  116. package/dist/transport/events-stream.js +357 -0
  117. package/dist/transport/events-stream.js.map +1 -0
  118. package/dist/transport/http.d.ts +212 -0
  119. package/dist/transport/http.d.ts.map +1 -0
  120. package/dist/transport/http.js +405 -0
  121. package/dist/transport/http.js.map +1 -0
  122. package/dist/transport/livestream-session.d.ts +211 -0
  123. package/dist/transport/livestream-session.d.ts.map +1 -0
  124. package/dist/transport/livestream-session.js +470 -0
  125. package/dist/transport/livestream-session.js.map +1 -0
  126. package/dist/transport/talkback-session.d.ts +85 -0
  127. package/dist/transport/talkback-session.d.ts.map +1 -0
  128. package/dist/transport/talkback-session.js +322 -0
  129. package/dist/transport/talkback-session.js.map +1 -0
  130. package/dist/transport/ws-endpoint.d.ts +49 -0
  131. package/dist/transport/ws-endpoint.d.ts.map +1 -0
  132. package/dist/transport/ws-endpoint.js +83 -0
  133. package/dist/transport/ws-endpoint.js.map +1 -0
  134. package/dist/transport/ws.d.ts +88 -0
  135. package/dist/transport/ws.d.ts.map +1 -0
  136. package/dist/transport/ws.js +24 -0
  137. package/dist/transport/ws.js.map +1 -0
  138. package/dist/types/base.d.ts +134 -0
  139. package/dist/types/base.d.ts.map +1 -0
  140. package/dist/types/base.js +2 -0
  141. package/dist/types/base.js.map +1 -0
  142. package/dist/types/camera.d.ts +688 -0
  143. package/dist/types/camera.d.ts.map +1 -0
  144. package/dist/types/camera.js +2 -0
  145. package/dist/types/camera.js.map +1 -0
  146. package/dist/types/chime.d.ts +49 -0
  147. package/dist/types/chime.d.ts.map +1 -0
  148. package/dist/types/chime.js +2 -0
  149. package/dist/types/chime.js.map +1 -0
  150. package/dist/types/common.d.ts +17 -0
  151. package/dist/types/common.d.ts.map +1 -0
  152. package/dist/types/common.js +6 -0
  153. package/dist/types/common.js.map +1 -0
  154. package/dist/types/events.d.ts +110 -0
  155. package/dist/types/events.d.ts.map +1 -0
  156. package/dist/types/events.js +2 -0
  157. package/dist/types/events.js.map +1 -0
  158. package/dist/types/fob.d.ts +26 -0
  159. package/dist/types/fob.d.ts.map +1 -0
  160. package/dist/types/fob.js +2 -0
  161. package/dist/types/fob.js.map +1 -0
  162. package/dist/types/index.d.ts +49 -0
  163. package/dist/types/index.d.ts.map +1 -0
  164. package/dist/types/index.js +6 -0
  165. package/dist/types/index.js.map +1 -0
  166. package/dist/types/light.d.ts +40 -0
  167. package/dist/types/light.d.ts.map +1 -0
  168. package/dist/types/light.js +2 -0
  169. package/dist/types/light.js.map +1 -0
  170. package/dist/types/nvr.d.ts +519 -0
  171. package/dist/types/nvr.d.ts.map +1 -0
  172. package/dist/types/nvr.js +2 -0
  173. package/dist/types/nvr.js.map +1 -0
  174. package/dist/types/relay.d.ts +57 -0
  175. package/dist/types/relay.d.ts.map +1 -0
  176. package/dist/types/relay.js +2 -0
  177. package/dist/types/relay.js.map +1 -0
  178. package/dist/types/sensor.d.ts +200 -0
  179. package/dist/types/sensor.d.ts.map +1 -0
  180. package/dist/types/sensor.js +2 -0
  181. package/dist/types/sensor.js.map +1 -0
  182. package/dist/types/shapes.d.ts +69 -0
  183. package/dist/types/shapes.d.ts.map +1 -0
  184. package/dist/types/shapes.js +2 -0
  185. package/dist/types/shapes.js.map +1 -0
  186. package/dist/types/viewer.d.ts +34 -0
  187. package/dist/types/viewer.d.ts.map +1 -0
  188. package/dist/types/viewer.js +2 -0
  189. package/dist/types/viewer.js.map +1 -0
  190. package/dist/util/cli/client.d.ts +49 -0
  191. package/dist/util/cli/client.d.ts.map +1 -0
  192. package/dist/util/cli/client.js +71 -0
  193. package/dist/util/cli/client.js.map +1 -0
  194. package/dist/util/cli/commands/camera-flashlight.d.ts +3 -0
  195. package/dist/util/cli/commands/camera-flashlight.d.ts.map +1 -0
  196. package/dist/util/cli/commands/camera-flashlight.js +112 -0
  197. package/dist/util/cli/commands/camera-flashlight.js.map +1 -0
  198. package/dist/util/cli/commands/camera-snapshot.d.ts +3 -0
  199. package/dist/util/cli/commands/camera-snapshot.d.ts.map +1 -0
  200. package/dist/util/cli/commands/camera-snapshot.js +138 -0
  201. package/dist/util/cli/commands/camera-snapshot.js.map +1 -0
  202. package/dist/util/cli/commands/camera-talkback.d.ts +3 -0
  203. package/dist/util/cli/commands/camera-talkback.d.ts.map +1 -0
  204. package/dist/util/cli/commands/camera-talkback.js +147 -0
  205. package/dist/util/cli/commands/camera-talkback.js.map +1 -0
  206. package/dist/util/cli/commands/camera-unlock.d.ts +3 -0
  207. package/dist/util/cli/commands/camera-unlock.d.ts.map +1 -0
  208. package/dist/util/cli/commands/camera-unlock.js +110 -0
  209. package/dist/util/cli/commands/camera-unlock.js.map +1 -0
  210. package/dist/util/cli/commands/camera.d.ts +3 -0
  211. package/dist/util/cli/commands/camera.d.ts.map +1 -0
  212. package/dist/util/cli/commands/camera.js +57 -0
  213. package/dist/util/cli/commands/camera.js.map +1 -0
  214. package/dist/util/cli/commands/chime-play-buzzer.d.ts +3 -0
  215. package/dist/util/cli/commands/chime-play-buzzer.d.ts.map +1 -0
  216. package/dist/util/cli/commands/chime-play-buzzer.js +110 -0
  217. package/dist/util/cli/commands/chime-play-buzzer.js.map +1 -0
  218. package/dist/util/cli/commands/chime-play-speaker.d.ts +3 -0
  219. package/dist/util/cli/commands/chime-play-speaker.d.ts.map +1 -0
  220. package/dist/util/cli/commands/chime-play-speaker.js +128 -0
  221. package/dist/util/cli/commands/chime-play-speaker.js.map +1 -0
  222. package/dist/util/cli/commands/chime.d.ts +3 -0
  223. package/dist/util/cli/commands/chime.d.ts.map +1 -0
  224. package/dist/util/cli/commands/chime.js +49 -0
  225. package/dist/util/cli/commands/chime.js.map +1 -0
  226. package/dist/util/cli/commands/decode.d.ts +3 -0
  227. package/dist/util/cli/commands/decode.d.ts.map +1 -0
  228. package/dist/util/cli/commands/decode.js +70 -0
  229. package/dist/util/cli/commands/decode.js.map +1 -0
  230. package/dist/util/cli/commands/diagnostics.d.ts +3 -0
  231. package/dist/util/cli/commands/diagnostics.d.ts.map +1 -0
  232. package/dist/util/cli/commands/diagnostics.js +163 -0
  233. package/dist/util/cli/commands/diagnostics.js.map +1 -0
  234. package/dist/util/cli/commands/doctor.d.ts +3 -0
  235. package/dist/util/cli/commands/doctor.d.ts.map +1 -0
  236. package/dist/util/cli/commands/doctor.js +287 -0
  237. package/dist/util/cli/commands/doctor.js.map +1 -0
  238. package/dist/util/cli/commands/info.d.ts +3 -0
  239. package/dist/util/cli/commands/info.d.ts.map +1 -0
  240. package/dist/util/cli/commands/info.js +219 -0
  241. package/dist/util/cli/commands/info.js.map +1 -0
  242. package/dist/util/cli/commands/reboot.d.ts +3 -0
  243. package/dist/util/cli/commands/reboot.d.ts.map +1 -0
  244. package/dist/util/cli/commands/reboot.js +188 -0
  245. package/dist/util/cli/commands/reboot.js.map +1 -0
  246. package/dist/util/cli/commands/relay-toggle.d.ts +3 -0
  247. package/dist/util/cli/commands/relay-toggle.d.ts.map +1 -0
  248. package/dist/util/cli/commands/relay-toggle.js +134 -0
  249. package/dist/util/cli/commands/relay-toggle.js.map +1 -0
  250. package/dist/util/cli/commands/relay.d.ts +3 -0
  251. package/dist/util/cli/commands/relay.d.ts.map +1 -0
  252. package/dist/util/cli/commands/relay.js +47 -0
  253. package/dist/util/cli/commands/relay.js.map +1 -0
  254. package/dist/util/cli/commands/update.d.ts +3 -0
  255. package/dist/util/cli/commands/update.d.ts.map +1 -0
  256. package/dist/util/cli/commands/update.js +137 -0
  257. package/dist/util/cli/commands/update.js.map +1 -0
  258. package/dist/util/cli/commands/watch-events.d.ts +3 -0
  259. package/dist/util/cli/commands/watch-events.d.ts.map +1 -0
  260. package/dist/util/cli/commands/watch-events.js +250 -0
  261. package/dist/util/cli/commands/watch-events.js.map +1 -0
  262. package/dist/util/cli/commands/watch-livestream.d.ts +3 -0
  263. package/dist/util/cli/commands/watch-livestream.d.ts.map +1 -0
  264. package/dist/util/cli/commands/watch-livestream.js +242 -0
  265. package/dist/util/cli/commands/watch-livestream.js.map +1 -0
  266. package/dist/util/cli/commands/watch-raw.d.ts +3 -0
  267. package/dist/util/cli/commands/watch-raw.d.ts.map +1 -0
  268. package/dist/util/cli/commands/watch-raw.js +211 -0
  269. package/dist/util/cli/commands/watch-raw.js.map +1 -0
  270. package/dist/util/cli/commands/watch-state.d.ts +3 -0
  271. package/dist/util/cli/commands/watch-state.d.ts.map +1 -0
  272. package/dist/util/cli/commands/watch-state.js +215 -0
  273. package/dist/util/cli/commands/watch-state.js.map +1 -0
  274. package/dist/util/cli/commands/watch.d.ts +3 -0
  275. package/dist/util/cli/commands/watch.d.ts.map +1 -0
  276. package/dist/util/cli/commands/watch.js +51 -0
  277. package/dist/util/cli/commands/watch.js.map +1 -0
  278. package/dist/util/cli/credentials.d.ts +36 -0
  279. package/dist/util/cli/credentials.d.ts.map +1 -0
  280. package/dist/util/cli/credentials.js +94 -0
  281. package/dist/util/cli/credentials.js.map +1 -0
  282. package/dist/util/cli/diagnostics-feed.d.ts +31 -0
  283. package/dist/util/cli/diagnostics-feed.d.ts.map +1 -0
  284. package/dist/util/cli/diagnostics-feed.js +57 -0
  285. package/dist/util/cli/diagnostics-feed.js.map +1 -0
  286. package/dist/util/cli/index.d.ts +3 -0
  287. package/dist/util/cli/index.d.ts.map +1 -0
  288. package/dist/util/cli/index.js +137 -0
  289. package/dist/util/cli/index.js.map +1 -0
  290. package/dist/util/cli/lookup.d.ts +127 -0
  291. package/dist/util/cli/lookup.d.ts.map +1 -0
  292. package/dist/util/cli/lookup.js +187 -0
  293. package/dist/util/cli/lookup.js.map +1 -0
  294. package/dist/util/cli/output/colors.d.ts +46 -0
  295. package/dist/util/cli/output/colors.d.ts.map +1 -0
  296. package/dist/util/cli/output/colors.js +59 -0
  297. package/dist/util/cli/output/colors.js.map +1 -0
  298. package/dist/util/cli/output/format.d.ts +139 -0
  299. package/dist/util/cli/output/format.d.ts.map +1 -0
  300. package/dist/util/cli/output/format.js +215 -0
  301. package/dist/util/cli/output/format.js.map +1 -0
  302. package/dist/util/cli/shared.d.ts +322 -0
  303. package/dist/util/cli/shared.d.ts.map +1 -0
  304. package/dist/util/cli/shared.js +401 -0
  305. package/dist/util/cli/shared.js.map +1 -0
  306. package/package.json +33 -25
  307. package/src/client/client.ts +741 -0
  308. package/src/client/connection.ts +722 -0
  309. package/src/client/livestream-pool.ts +1257 -0
  310. package/src/clock.ts +79 -0
  311. package/src/devices/camera.ts +264 -0
  312. package/src/devices/chime.ts +91 -0
  313. package/src/devices/context.ts +35 -0
  314. package/src/devices/device.ts +249 -0
  315. package/src/devices/endpoints.ts +38 -0
  316. package/src/devices/fob.ts +25 -0
  317. package/src/devices/light.ts +24 -0
  318. package/src/devices/nvr.ts +76 -0
  319. package/src/devices/registry.ts +145 -0
  320. package/src/devices/relay.ts +40 -0
  321. package/src/devices/sensor.ts +24 -0
  322. package/src/devices/viewer.ts +24 -0
  323. package/src/diagnostics.ts +381 -0
  324. package/src/errors.ts +421 -0
  325. package/src/event-bus.ts +139 -0
  326. package/src/index.ts +124 -0
  327. package/src/logging.ts +45 -0
  328. package/src/protocol/events.ts +533 -0
  329. package/src/protocol/packet.ts +304 -0
  330. package/src/protocol/reducer.ts +436 -0
  331. package/src/settings.ts +135 -0
  332. package/src/state/selectors.ts +500 -0
  333. package/src/state/store.ts +348 -0
  334. package/src/transport/auth.ts +254 -0
  335. package/src/transport/events-stream.ts +524 -0
  336. package/src/transport/http.ts +620 -0
  337. package/src/transport/livestream-session.ts +782 -0
  338. package/src/transport/talkback-session.ts +459 -0
  339. package/src/transport/ws-endpoint.ts +99 -0
  340. package/src/transport/ws.ts +118 -0
  341. package/src/types/base.ts +164 -0
  342. package/src/types/camera.ts +758 -0
  343. package/src/types/chime.ts +59 -0
  344. package/src/types/common.ts +28 -0
  345. package/src/types/events.ts +133 -0
  346. package/src/types/fob.ts +33 -0
  347. package/src/types/index.ts +57 -0
  348. package/src/types/light.ts +53 -0
  349. package/src/types/nvr.ts +598 -0
  350. package/src/types/relay.ts +70 -0
  351. package/src/types/sensor.ts +235 -0
  352. package/src/types/shapes.ts +92 -0
  353. package/src/types/viewer.ts +42 -0
  354. package/src/util/cli/client.ts +110 -0
  355. package/src/util/cli/commands/camera-flashlight.ts +64 -0
  356. package/src/util/cli/commands/camera-snapshot.ts +99 -0
  357. package/src/util/cli/commands/camera-talkback.ts +111 -0
  358. package/src/util/cli/commands/camera-unlock.ts +62 -0
  359. package/src/util/cli/commands/camera.ts +72 -0
  360. package/src/util/cli/commands/chime-play-buzzer.ts +62 -0
  361. package/src/util/cli/commands/chime-play-speaker.ts +83 -0
  362. package/src/util/cli/commands/chime.ts +64 -0
  363. package/src/util/cli/commands/decode.ts +98 -0
  364. package/src/util/cli/commands/diagnostics.ts +116 -0
  365. package/src/util/cli/commands/doctor.ts +339 -0
  366. package/src/util/cli/commands/info.ts +216 -0
  367. package/src/util/cli/commands/reboot.ts +179 -0
  368. package/src/util/cli/commands/relay-toggle.ts +91 -0
  369. package/src/util/cli/commands/relay.ts +62 -0
  370. package/src/util/cli/commands/update.ts +100 -0
  371. package/src/util/cli/commands/watch-events.ts +263 -0
  372. package/src/util/cli/commands/watch-livestream.ts +231 -0
  373. package/src/util/cli/commands/watch-raw.ts +195 -0
  374. package/src/util/cli/commands/watch-state.ts +227 -0
  375. package/src/util/cli/commands/watch.ts +66 -0
  376. package/src/util/cli/credentials.ts +160 -0
  377. package/src/util/cli/diagnostics-feed.ts +81 -0
  378. package/src/util/cli/index.ts +182 -0
  379. package/src/util/cli/lookup.ts +260 -0
  380. package/src/util/cli/output/colors.ts +98 -0
  381. package/src/util/cli/output/format.ts +297 -0
  382. package/src/util/cli/shared.ts +660 -0
  383. package/dist/protect-api-events.d.ts +0 -108
  384. package/dist/protect-api-events.js +0 -122
  385. package/dist/protect-api-events.js.map +0 -1
  386. package/dist/protect-api-livestream.d.ts +0 -152
  387. package/dist/protect-api-livestream.js +0 -512
  388. package/dist/protect-api-livestream.js.map +0 -1
  389. package/dist/protect-api.d.ts +0 -1164
  390. package/dist/protect-api.js +0 -1840
  391. package/dist/protect-api.js.map +0 -1
  392. package/dist/protect-logging.d.ts +0 -20
  393. package/dist/protect-logging.js +0 -6
  394. package/dist/protect-logging.js.map +0 -1
  395. package/dist/protect-types.d.ts +0 -1279
  396. package/dist/protect-types.js +0 -6
  397. package/dist/protect-types.js.map +0 -1
  398. package/dist/util/ufp.d.ts +0 -2
  399. package/dist/util/ufp.js +0 -936
  400. package/dist/util/ufp.js.map +0 -1
package/README.md CHANGED
@@ -8,73 +8,134 @@
8
8
  [![Downloads](https://img.shields.io/npm/dt/unifi-protect?color=%230559C9&logo=icloud&logoColor=%23FFFFFF&style=for-the-badge)](https://www.npmjs.com/package/unifi-protect)
9
9
  [![Version](https://img.shields.io/npm/v/unifi-protect?color=%230559C9&label=UniFi%20Protect%20API&logo=ubiquiti&logoColor=%23FFFFFF&style=for-the-badge)](https://www.npmjs.com/package/unifi-protect)
10
10
 
11
- ## A complete UniFi Protect API implementation.
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 enabled you to connect to and communicate with the Ubiquiti UniFi Protect API and ecosystem. [UniFi Protect](https://ui.com/camera-security) is [Ubiquiti's](https://www.ui.com) next-generation video security platform, with rich camera, doorbell, and NVR controller hardware options for you to choose from, as well as an app which you can use to view, configure and manage your video camera and doorbells.
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
- ## Why use this library for UniFi Protect support?
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
- In addition, 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. Note: this is **not** the RTSP URLs that are provided by UniFi Protect controllers, but rather, true access to the H.264 datastream for any camera connected to the Protect controller.
19
+ ## Installation
21
20
 
22
- 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 using this library, 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.
21
+ To use this library in Node, install it from the command line:
23
22
 
24
- ### <A NAME="protect-contribute"></A>How you can contribute and make this library even better
25
- This implementation is largely feature complete. I strive to add support for meaningful features to a broad groups of people in order to avoid any unnecessary cruft and technical debt that may accrue over time.
23
+ ```sh
24
+ npm install unifi-protect
25
+ ```
26
26
 
27
- 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.
27
+ ## Getting started
28
28
 
29
- ### Features
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
- ## Changelog
36
- * [Changelog](https://github.com/hjdhjd/unifi-protect/blob/main/docs/Changelog.md): changes and release history of this library.
31
+ ```ts
32
+ import { ProtectClient } from "unifi-protect";
37
33
 
38
- ## Installation
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
- ```sh
42
- npm install unifi-protect
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
- ## Documentation
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
- Documentation and examples for using this library to access UniFi Protect controllers is [available here](https://github.com/hjdhjd/unifi-protect/blob/main/docs/ProtectApi.md). Additionally, if you'd like to see all this in action in a well-documented, real-world example, please take a good look at my [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect) project. It relies heavily on this library for the core functionality it provides.
47
+ ## The realtime firehose
48
48
 
49
- ## UniFi Protect Realtime Events API
50
- 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.
49
+ `client.events()` is an async iterable of every typed event the controller emits, ending cleanly when its signal aborts:
51
50
 
52
- Reverse engineering the realtime events API is a bit more difficult than the system events API because it's based on a binary protocol. The Protect system events API is a steady stream of JSONs published on all UniFi OS controllers over the `system` websocket. It's used by more than just UniFi Protect, which makes it interesting for future exploration.
51
+ ```ts
52
+ for await (const event of client.events({ signal })) {
53
53
 
54
- The Protect realtime events API, however, is a binary protocol published over the `updates` websocket, and until now has been undocumented. I spent time analyzing what's happening in the Protect browser webUI as well as observing the controller and various Protect versions themselves to reverse engineer what's going on. Pouring through obfuscated code is like solving a puzzle with all the pieces in front of you - you know it's all there, you're just not always sure how it fits together.
54
+ switch(event.kind) {
55
55
 
56
- For the impatient, you can take a look at the code for how to decode and read the binary protocol here in [protect-updates-api.ts](https://github.com/hjdhjd/unifi-protect/blob/master/src/protect-api-events.ts) and the interface information located in [protect-types.ts](https://github.com/hjdhjd/unifi-protect/blob/master/src/protect-types.ts) as well.
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
+ }
61
+ ```
57
62
 
58
- 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.
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.
59
64
 
60
- #### Non-Ubiquiti Apps Using the Protect API
61
- This list represents all known apps that are using the realtime events API for UniFi Protect. If you're using the information you discovered on this page for your own UniFi Protect-based solution, please open an issue and I'm happy to add a link to it below. I hope this can serve as a repository of sorts for UniFi Protect-based apps and solutions in the community.
65
+ ## Typed errors: recoverable vs fatal
62
66
 
63
- * [homebridge-unifi-protect](https://github.com/hjdhjd/homebridge-unifi-protect): Seamless integration of UniFi Protect into HomeKit with support for cameras, doorbells, and more.
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
+
69
+ ```ts
70
+ import { ProtectAuthorizationError, RecoverableError } from "unifi-protect";
71
+
72
+ try {
73
+
74
+ const jpeg = await client.camera(id)?.snapshot({ signal, width: 1920 });
75
+ } catch(error) {
76
+
77
+ if(error instanceof ProtectAuthorizationError) {
78
+
79
+ return; // 403 - the account lacks the rights; not retryable.
80
+ }
81
+
82
+ if(error instanceof RecoverableError) {
83
+
84
+ return deferAndRetry(); // throttle, timeout, network, abort, stall - defer and retry.
85
+ }
86
+
87
+ throw error;
88
+ }
89
+ ```
90
+
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`.
92
+
93
+ ## Livestreaming
94
+
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.
64
96
 
65
- #### Connecting
66
- * 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/master/src/protect-api.ts) for a better understanding of the Protect login process and how to obtain the bootstrap JSON.
67
- * Open the websocket to the updates URL. The URL is: `wss://protect-nvr-ip/proxy/protect/ws/updates?lastUpdateId?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/src/protect-api.ts#L225).
68
- * Then you're ready to listen to messages. You can see an [example of this in protect-nvr.ts](https://github.com/hjdhjd/unifi-protect/blob/src/protect-nvr.ts#L408).
97
+ ```ts
98
+ await using live = client.camera(id)?.livestream({ channel: 0, signal });
69
99
 
70
- Those are the basics and gets us up and running. Now, to explain how the updates API works...
100
+ for await (const segment of live) {
71
101
 
72
- #### Updates Websocket Binary Format
73
- 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.
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.
74
119
 
75
- The `updates` websocket is used by the UniFi Protect webUI and native applications to provide realtime events back to the controller. UniFi cameras and doorbells also use a websocket to provide those same updates to the Protect controller. The `updates` websocket uses a binary protocol to encode data largely to minimize bandwidth requirements, and provide access to more than JSON data, if needed.
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.
76
121
 
77
- So how does it all work? Cameras continuously stream updates to the UniFi Protect controller containing things like camera health, statistics, and - crucially for us - events such as motion and doorbell ring. A complete update packet is composed of four frames:
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:
78
139
 
79
140
  ```sh
80
141
  Header Frame (8 bytes)
@@ -86,12 +147,9 @@ So how does it all work? Cameras continuously stream updates to the UniFi Protec
86
147
  Data Frame
87
148
  ```
88
149
 
89
- Let's look at each of these.
90
-
91
150
  ##### Header Frame
92
- The header frame is required overhead since websockets provide only a transport medium. It's purpose is to tell us what's coming in the frame that follows.
93
151
 
94
- A packet header is composed of 8 bytes in this order:
152
+ The header frame is overhead that tells us what's coming in the frame that follows. It is 8 bytes:
95
153
 
96
154
  | Byte Offset | Description | Bits | Values
97
155
  |----------------|-----------------|---------|-----------------------------------------
@@ -101,35 +159,46 @@ A packet header is composed of 8 bytes in this order:
101
159
  | 3 | Unknown | 8 | Always 0. Possibly reserved for future use by Ubiquiti?
102
160
  | 4-7 | Payload Size | 32 | Size of payload in network-byte order (big endian).
103
161
 
104
- If the header has marked the payload as deflated (compressed), you'll need to inflate (uncompress) the payload before you can use it.
162
+ If the header marks the payload as deflated, inflate it before use.
105
163
 
106
164
  ##### Action Frame
107
- The action frame identifies what the action and category that the update contains:
165
+
166
+ The action frame identifies the action and category the update contains:
108
167
 
109
168
  | Property | Description
110
169
  |-------------|------------------------------------------------------------------------------------
111
170
  | action | What action is being taken. Known actions are `add` and `update`.
112
171
  | id | The identifier for the device we're updating.
113
172
  | modelKey | The device model category that we're updating.
114
- | newUpdateId | A new UUID generated on a per-update basis. This can be safely ignored it seems.
173
+ | newUpdateId | A new UUID generated per update. This can be safely ignored, it seems.
115
174
 
116
175
  ##### Data Frame
117
- The final part of the update packet is the data frame. The data frame can be three different types of data - although in practice, JSONs are all that come across, I've found. Those types are:
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:
118
178
 
119
179
  | Payload Type | Description
120
180
  |--------------|------------------------------------------------------------------------------------
121
- | 1 | JSON. If the action frame's `action` property is set to `update` and the `modelKey` property is not set to `event` (e.g. `camera`), this will **always** a subset of the [configuration bootstrap JSON](https://github.com/hjdhjd/unifi-protect/blob/src/protect-types.ts#L6).
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.
122
182
  | 2 | A UTF8-encoded string.
123
183
  | 3 | Node Buffer.
124
184
 
125
- #### Tips
126
- * `update` actions are always tied to any valid modelKey that exists in the bootstrap JSON. The exception is `events` which is tied to the Protect events history list that it maintains. The supported modelKeys from the bootstrap JSON are: `bridge`, `camera`, `group`, `light`, `liveview`, `nvr`, `sensor`, `user`, and `viewer`.
127
- * `add` actions are always tied to the `event` modelKey and indicate the beginning of an event item in the Protect events list. A subsequent `update` action is sent signaling the end of the event capture, and it's confidence score for motion detection.
128
- * This is **not** the same thing as motion detection. If you want to detect motion, you should watch the `update` action for `camera` modelKeys, and look for a JSON that updates `lastMotion`. For doorbell rings, `lastRing`. The Protect events list is useful for the Protect app, but it's of limited utility to HomeKit, and it's slow relative to just looking for the `lastMotion` JSON that tends to be much more timely in its delivery. If you want true realtime events, you want to look at the `update` action.
129
- * JSONs are only payload type that seems to be sent, although the protocol is designed to accept all three.
130
- * With the exception of `update` actions with a `modelKey` of `event`, JSONs are always a subset of the bootstrap JSON, indexed off of `modelKey`. So for a `modelKey` of `camera`, the data payload is always a subset of ProtectCameraConfigInterface (see [protect-types.ts](https://github.com/hjdhjd/unifi-protect/blob/src/protect-types.ts#L108)).
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.
131
199
 
132
200
  ## Library Development Dashboard
201
+
133
202
  This is mostly of interest to the true developer nerds amongst us.
134
203
 
135
204
  [![License](https://img.shields.io/npm/l/unifi-protect?color=%230559C9&logo=open%20source%20initiative&logoColor=%23FFFFFF&style=for-the-badge)](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,C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