/** * The UNS backend over HTTP (uns-backend-server; one per region). Nodes, search, bindings, and the UNS's own * time-series reads — `/timeseries/latest` and `/timeseries/range` take UNS node ids, never device or sensor ids. * The caller's IOSense bearer is forwarded; the UNS authorizes (requirement §29: the browser is not the boundary). */ export interface UnsNode { id: string; /** Workspace id (`ws_…`). */ unsId: string; type: string; name: string; /** Slug path, e.g. `fleet/uav-12/latitude`. */ path: string; parentId: string | null; childCount: number; metadata: Record; tags: string[]; } export interface UnsWorkspace { id: string; name: string; } export interface UnsLatest { nodeId: string; ok: boolean; value?: number; /** Epoch ms. */ time?: number; unit?: string; error?: string; } export interface UnsRange { nodeId: string; unit?: string; points: Array<{ time: number; value: number; }>; } export interface UnsClientOptions { /** e.g. https://uns-backend-server.us.iosense.io */ baseUrl: string; /** The IOSense bearer (without "Bearer "), read on every call so a refreshed session is used at once. */ token: () => string | null; fetch?: typeof fetch; } export declare class UnsHttpError extends Error { readonly status: number; readonly path: string; constructor(status: number, path: string, message: string); } export declare function toNode(raw: unknown, wsId: string): UnsNode | null; export declare class UnsClient { private readonly opts; private readonly f; /** A token handed over by the map engine (setAuth); wins over the session's own while set. */ private tokenOverride; constructor(opts: UnsClientOptions); setToken(token: string | null): void; private call; workspaces(signal?: AbortSignal): Promise; children(wsId: string, parentId?: string, signal?: AbortSignal): Promise; search(wsId: string, q: string, opts?: { type?: string; limit?: number; signal?: AbortSignal; }): Promise; node(wsId: string, nodeId: string, signal?: AbortSignal): Promise; /** A node and everything under it, full rows with metadata, root first (one call for a whole branch). */ subtree(wsId: string, rootId: string, signal?: AbortSignal): Promise; /** Latest values of tags, by UNS node id. */ latest(wsId: string, nodeIds: string[], signal?: AbortSignal): Promise; /** A tag's points over a window (epoch ms). */ range(wsId: string, nodeId: string, startMs: number, endMs: number, signal?: AbortSignal): Promise; }