/** * Node status view model. * * Decodes a size-prefixed `NodeStatusSet` FlatBuffer (file identifier `$NST`, * emitted by the node's `/ws/status` feed) into a plain, JSON-friendly view * model. The wire schema uses UPPER_SNAKE_CASE field accessors (generated by * the FlatBuffers compiler); this module normalizes them to camelCase for * consumption by the status dashboard UI. * * The generated code under `./generated` is produced by the schema task and is * never edited here. */ import { NodeStatus, NodeStatusSet } from './generated/nst.js'; /** A single node in the status view. */ export interface NodeStatusView { /** libp2p peer ID (base58). */ peerId: string; /** Distinguished name from the node's EPM. */ dn: string; /** Organization / legal name from the node's EPM. */ org: string; /** Full vCard 4.0 text derived from the peer's EPM (empty if unresolved). */ vcard: string; /** GeoIP-resolved latitude (0 = unresolved). */ lat: number; /** GeoIP-resolved longitude (0 = unresolved). */ lon: number; /** Human-readable "City, Country" label (empty if unresolved). */ geoLabel: string; /** True when the peer currently has a live connection. */ online: boolean; /** True on the node emitting this set. */ isSelf: boolean; /** Agent version string reported by the peer. */ agent: string; /** Seconds since the emitting process started (self only; 0 otherwise). */ uptimeS: number; /** Unix seconds of last observation (0 = never). */ lastSeen: number; /** Multiaddrs the peer is known by. */ addrs: string[]; /** Trust level from the node's EPM. */ trustLevel: string; /** Role the node advertises (e.g. bootstrap, relay). */ role: string; /** Round-trip latency to the peer, milliseconds (0 = unknown). */ latencyMs: number; /** SDN suite version reported by the peer. */ suiteVersion: string; /** spacedatastandards.org version reported by the peer. */ standardsVersion: string; /** * PROVENANCE — why this row is on the board, so the page can answer "how did * this get here?" without devtools. Exactly one of: * 'config' — declared in the node's config file (peers.trusted_peers) * 'pinned' — pinned by an operator through the pin API * 'connected' — seen right now on a live connection * Empty on the self row. The feed admits pinned-or-connected and nothing * else, so no other value can reach a client. */ source: string; /** True for config and operator pins; a pinned peer keeps its seat offline. */ pinned: boolean; /** * For source==='config', the real file and key an operator can edit. For * source==='pinned', the operator's own note. Never a manufactured label. */ pinNote: string; } /** The decoded status set as a plain view model. */ export interface NodeStatusSetView { /** All nodes known to the emitting node (self first by convention). */ nodes: NodeStatusView[]; /** Unix milliseconds when this set was generated. */ generatedAt: number; /** Peer ID of the emitting node. */ sourcePeerId: string; } /** * Map a single decoded `NodeStatus` FlatBuffer table to the plain view model. */ export declare function nodeStatusToView(node: NodeStatus): NodeStatusView; /** * Map a decoded `NodeStatusSet` FlatBuffer table to the plain view model. */ export declare function nodeStatusSetToView(set: NodeStatusSet): NodeStatusSetView; /** * Decode size-prefixed `NodeStatusSet` bytes (as delivered over `/ws/status`) * into the plain view model. * * @throws if the bytes are not a valid size-prefixed `$NST` buffer. */ export declare function decodeNodeStatusSet(bytes: Uint8Array): NodeStatusSetView; /** * Decode a non-size-prefixed `NodeStatusSet` buffer into the view model. Used * when the caller has already stripped the 4-byte size prefix. */ export declare function decodeNodeStatusSetRoot(bytes: Uint8Array): NodeStatusSetView; //# sourceMappingURL=view-model.d.ts.map