1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Reactive data layer between `unifly-api` and UI consumers (CLI / TUI).
//!
//! This crate owns the business logic, domain model, and reactive data
//! infrastructure for the UniFi CLI workspace:
//!
//! - **[`Controller`]** — Central facade managing the full lifecycle:
//! [`connect()`](Controller::connect) authenticates, fetches an initial data
//! snapshot, then spawns background tasks for periodic refresh and command
//! processing. [`Controller::oneshot()`](Controller::oneshot) provides a
//! lightweight fire-and-forget mode for single CLI invocations.
//!
//! - **[`DataStore`]** — Lock-free reactive storage built on
//! `EntityCollection<T>` (`DashMap` + `tokio::sync::watch` channels). Merges
//! Integration and Legacy API responses into canonical domain types.
//!
//! - **[`EntityStream<T>`]** — Subscription handle vended by the `DataStore`.
//! Exposes `current()` / `latest()` / `changed()` for TUI reactive rendering.
//!
//! - **[`Command`]** — Typed mutation requests routed through an `mpsc` channel
//! to the controller's command processor. Reads bypass the channel via
//! direct `DataStore` snapshots or ad-hoc API queries.
//!
//! - **Domain model** ([`model`]) — Canonical types (`Device`, `Client`,
//! `Network`, `FirewallPolicy`, `Event`, etc.) with [`EntityId`] supporting
//! both UUID (Integration API) and string-based (Legacy API) identifiers.
// ── Primary re-exports ──────────────────────────────────────────────
pub use *;
pub use ;
pub use ;
pub use ;
pub use CoreError;
pub use DataStore;
pub use EntityStream;
// Re-export model types at the crate root for ergonomics.
pub use ;