/** * NetBox API Types * Based on NetBox REST API responses */ import type { LegendSettings, LinkBandwidth, LinkType } from '@shumoku/core/models'; export interface NetBoxTag { slug: string; name: string; } export interface NetBoxDeviceType { model: string; manufacturer?: { name: string; slug: string; }; } export interface NetBoxDeviceStatus { value: 'active' | 'planned' | 'staged' | 'failed' | 'offline' | 'inventory' | 'decommissioning'; label: string; } export interface NetBoxDevice { id: number; name: string | null; tags: NetBoxTag[]; device_type?: NetBoxDeviceType; primary_ip4?: { address: string; }; primary_ip6?: { address: string; }; serial?: string; status?: NetBoxDeviceStatus; role?: { name: string; slug: string; }; site?: { id: number; name: string; slug: string; }; location?: { id: number; name: string; slug: string; }; rack?: { id: number; name: string; }; } export interface NetBoxDeviceResponse { count: number; next: string | null; previous: string | null; results: NetBoxDevice[]; } export interface NetBoxVlan { vid: number; name: string; } export interface NetBoxInterface { id: number; name: string; device: { id: number; name: string; }; type?: { value: string; label: string; }; enabled: boolean; mac_address?: string; mtu?: number; mode?: { value: string; label: string; }; untagged_vlan: NetBoxVlan | null; tagged_vlans: NetBoxVlan[]; speed: number | null; duplex?: { value: string; label: string; } | null; description?: string; cable?: { id: number; label: string; }; connected_endpoints?: Array<{ id: number; name: string; device: { id: number; name: string; }; }>; } export interface NetBoxInterfaceResponse { count: number; next: string | null; previous: string | null; results: NetBoxInterface[]; } export interface NetBoxTermination { object: { name: string; device: { id: number; name: string | null; }; }; } export interface NetBoxCable { id: number; type: string; a_terminations: NetBoxTermination[]; b_terminations: NetBoxTermination[]; status?: { value: string; label: string; }; label?: string; color?: string; length?: number; length_unit?: { value: string; label: string; }; description?: string; } export interface NetBoxCableResponse { count: number; next: string | null; previous: string | null; results: NetBoxCable[]; } export interface NetBoxCluster { id: number; name: string; slug: string; } export interface NetBoxVirtualMachineStatus { value: 'active' | 'planned' | 'staged' | 'failed' | 'offline' | 'decommissioning'; label: string; } export interface NetBoxVirtualMachine { id: number; name: string; status: NetBoxVirtualMachineStatus; cluster?: NetBoxCluster; primary_ip4?: { address: string; }; primary_ip6?: { address: string; }; vcpus?: number; memory?: number; disk?: number; role?: { id: number; name: string; slug: string; }; tags: NetBoxTag[]; } export interface NetBoxVirtualMachineResponse { count: number; next: string | null; previous: string | null; results: NetBoxVirtualMachine[]; } export interface NetBoxVMInterface { id: number; name: string; virtual_machine: { id: number; name: string; }; enabled: boolean; mac_address?: string; untagged_vlan?: NetBoxVlan; tagged_vlans: NetBoxVlan[]; } export interface NetBoxVMInterfaceResponse { count: number; next: string | null; previous: string | null; results: NetBoxVMInterface[]; } export interface NetBoxPrefix { id: number; prefix: string; site?: { id: number; name: string; slug: string; }; vlan?: NetBoxVlan; role?: { id: number; name: string; slug: string; }; description: string; is_pool: boolean; status: { value: 'active' | 'reserved' | 'deprecated' | 'container'; label: string; }; } export interface NetBoxPrefixResponse { count: number; next: string | null; previous: string | null; results: NetBoxPrefix[]; } export interface NetBoxIPAddress { id: number; address: string; status: { value: 'active' | 'reserved' | 'deprecated' | 'dhcp' | 'slaac'; label: string; }; assigned_object?: { id: number; name: string; device?: { id: number; name: string; }; virtual_machine?: { id: number; name: string; }; }; dns_name?: string; } export interface NetBoxIPAddressResponse { count: number; next: string | null; previous: string | null; results: NetBoxIPAddress[]; } export interface NetBoxSite { id: number; name: string; slug: string; status: { value: string; label: string; }; region?: { id: number; name: string; slug: string; }; description: string; } export interface NetBoxSiteResponse { count: number; next: string | null; previous: string | null; results: NetBoxSite[]; } export interface NetBoxLocation { id: number; name: string; slug: string; site: { id: number; name: string; slug: string; }; parent?: { id: number; name: string; slug: string; }; description: string; } export interface NetBoxLocationResponse { count: number; next: string | null; previous: string | null; results: NetBoxLocation[]; } export type DeviceTypeString = 'router' | 'l3-switch' | 'l2-switch' | 'server' | 'access-point' | 'firewall' | 'load-balancer' | 'generic'; export interface TagMapping { type: DeviceTypeString; level: number; subgraph: string; } /** * Default tag to device type/level mapping * Based on network-topology hierarchy */ export declare const DEFAULT_TAG_MAPPING: Record; /** * Tag priority order for resolving primary tag */ export declare const TAG_PRIORITY: string[]; export interface CableStyle { color: string; type?: LinkType; } /** * Cable type to style mapping * Based on fiber/copper standards */ export declare const CABLE_STYLES: Record; export declare const CABLE_COLORS: Record; /** * Convert interface speed (kbps) to LinkBandwidth * @param speedKbps Speed in kbps from NetBox * @returns LinkBandwidth or undefined */ export declare function convertSpeedToBandwidth(speedKbps: number | null): LinkBandwidth | undefined; /** * Map NetBox device role slugs to Shumoku device types */ export declare const ROLE_TO_TYPE: Record; /** * Generate a color for a VLAN ID * Uses HSL color space for visual variety */ export declare function getVlanColor(vid: number): string; export type DeviceStatusValue = 'active' | 'planned' | 'staged' | 'failed' | 'offline' | 'inventory' | 'decommissioning'; export interface DeviceStatusStyle { fill?: string; stroke?: string; strokeDasharray?: string; opacity?: number; } /** * Status-based device styling * - active: default (no special styling) * - planned: dashed border, light gray * - staged: yellow tint * - failed: red tint * - offline: gray, reduced opacity * - inventory: blue tint (in stock) * - decommissioning: orange tint */ export declare const DEVICE_STATUS_STYLES: Record; export interface DeviceData { name: string; primaryTag: string; ports: Set; portVlans: Map; portSpeeds: Map; model?: string; manufacturer?: string; ip?: string; role?: string; site?: string; location?: string; status?: DeviceStatusValue; } export interface ConnectionData { srcDev: string; srcPort: string; srcLevel: number; dstDev: string; dstPort: string; dstLevel: number; dstTag: string; cableType: string; cableColor?: string; cableLabel?: string; cableLength?: string; speed: number | null; vlans: number[]; } export type GroupBy = 'tag' | 'site' | 'location' | 'prefix' | 'none'; export interface ConverterOptions { /** * Custom tag mapping (merged with defaults) */ tagMapping?: Record; /** * Theme for generated diagram */ theme?: 'light' | 'dark'; /** * Show port names on links */ showPorts?: boolean; /** * Show VLAN information on links */ showVlans?: boolean; /** * Color links by cable type */ colorByCableType?: boolean; /** * Group devices by tag into subgraphs * @deprecated Use groupBy instead */ groupByTag?: boolean; /** * How to group devices into subgraphs * - 'tag': Group by NetBox tags (default) * - 'site': Group by NetBox site * - 'location': Group by NetBox location * - 'none': No grouping */ groupBy?: GroupBy; /** * Use device role as fallback for type detection * When enabled, if no matching tag is found, the device role is used */ useRoleForType?: boolean; /** * Color devices based on their status * - active: default color * - planned: dashed border * - staged: yellow * - failed: red * - offline: gray */ colorByStatus?: boolean; /** * Include virtual machines in the topology * VMs are rendered as server nodes with dashed borders */ includeVMs?: boolean; /** * Group VMs by cluster into subgraphs */ groupVMsByCluster?: boolean; /** * Show legend in the diagram * - true: Show legend with default settings * - LegendSettings: Customize legend position and content */ legend?: boolean | LegendSettings; } export interface NetBoxClientOptions { /** * NetBox API URL (e.g., "https://netbox.example.com") */ url: string; /** * NetBox API token */ token: string; /** * Request timeout in milliseconds (default: 30000) */ timeout?: number; /** * Enable debug output for API requests/responses */ debug?: boolean; } //# sourceMappingURL=types.d.ts.map