feat: add TypeScript types for network diagrams

Adds all interfaces for network diagrams and device types including
DiagramNode, DiagramEdge, DeviceProperties, NetworkDiagramResponse,
AI generate request/response, import/export shapes, and list item types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-04-04 07:48:00 +00:00
parent 074548678f
commit b9e37ecdfb
2 changed files with 131 additions and 0 deletions

View File

@@ -98,3 +98,4 @@ export * from './script-builder'
export * from './integrations'
export * from './notification'
export type * from './public-templates'
export * from './network-diagram'

View File

@@ -0,0 +1,130 @@
export interface DeviceProperties {
hostname: string | null
ip: string | null
subnet: string | null
vendor: string | null
model: string | null
role: string | null
vlan: string | null
notes: string | null
status: 'unknown' | 'online' | 'offline' | 'degraded'
}
export interface DiagramNode {
id: string
type: string
label: string
position: { x: number; y: number }
properties: DeviceProperties
}
export interface DiagramEdge {
id: string
source: string
target: string
label: string | null
connectionType: string
speed: string | null
notes: string | null
}
export interface DeviceTypeResponse {
id: string
slug: string
label: string
category: string
is_system: boolean
team_id: string | null
sort_order: number
created_at: string
}
export interface DeviceTypeCreate {
slug: string
label: string
category: string
sort_order?: number
}
export interface NetworkDiagramResponse {
id: string
team_id: string
name: string
client_name: string | null
asset_name: string | null
description: string | null
nodes: DiagramNode[]
edges: DiagramEdge[]
thumbnail_url: string | null
is_archived: boolean
created_by: string | null
created_at: string
updated_at: string
}
export interface NetworkDiagramListItem {
id: string
name: string
client_name: string | null
description: string | null
node_count: number
created_by: string | null
created_at: string
updated_at: string
}
export interface NetworkDiagramCreate {
name: string
client_name?: string | null
asset_name?: string | null
description?: string | null
nodes?: DiagramNode[]
edges?: DiagramEdge[]
}
export interface NetworkDiagramUpdate {
name?: string
client_name?: string | null
asset_name?: string | null
description?: string | null
nodes?: DiagramNode[]
edges?: DiagramEdge[]
}
export interface AIGenerateRequest {
description: string
client_name?: string | null
mode: 'replace' | 'merge'
existingBounds?: { minX: number; maxX: number; minY: number; maxY: number } | null
}
export interface AIGenerateResponse {
nodes: DiagramNode[]
edges: DiagramEdge[]
suggestedName: string | null
notes: string | null
}
export interface DiagramImportData {
schemaVersion: number
name: string
client_name?: string | null
description?: string | null
nodes: DiagramNode[]
edges: DiagramEdge[]
}
export interface DiagramImportResponse {
diagram: NetworkDiagramResponse
warnings: string[]
}
export interface DiagramExportResponse {
schemaVersion: number
name: string
client_name: string | null
description: string | null
nodes: DiagramNode[]
edges: DiagramEdge[]
exportedAt: string
}