Files
dataforge c9fd4aa84c feat: enrichers, panel de ingest y menu contextual en el grafo
- Añade enricher.go + directorio enrichers/ para enriquecer entidades con fuentes externas.
- Nuevos componentes frontend: IngestPanel (panel de ingesta de datos) y NodeContextMenu (menu contextual sobre nodos del grafo).
- Retira SearchBar y lib/utils.ts; la busqueda se integra dentro de los paneles existentes.
- Ajusta tipos (types.go, types.ts, wailsjs/go) y theming (postcss + app.css + Mantine).
- Actualiza app.go y wails.json para exponer las nuevas capacidades.
- Añade directorio projects/ con estado inicial.
- Rebuild del frontend (dist actualizado).
2026-04-13 23:32:55 +02:00

123 lines
4.9 KiB
Go

package main
// EntityTypePreset defines an entity type with its visual properties and suggested metadata fields.
type EntityTypePreset struct {
TypeRef string `json:"type_ref"` // short type name
Label string `json:"label"` // human-readable
Color string `json:"color"` // hex color for graph nodes
MetadataFields []string `json:"metadata_fields"` // suggested metadata keys
}
// GraphData matches the frontend-lib GraphData interface for sigma.js rendering.
type GraphData struct {
Nodes []GraphNode `json:"nodes"`
Edges []GraphEdge `json:"edges"`
}
// GraphNode matches the frontend-lib GraphNode interface.
type GraphNode struct {
ID string `json:"id"`
Label string `json:"label"`
Type string `json:"type"`
Color string `json:"color"`
Size float64 `json:"size"`
X float64 `json:"x"`
Y float64 `json:"y"`
// Extra fields from entity metadata (flattened)
Extra map[string]any `json:"extra,omitempty"`
}
// GraphEdge matches the frontend-lib GraphEdge interface.
type GraphEdge struct {
ID string `json:"id"`
Source string `json:"source"`
Target string `json:"target"`
Label string `json:"label"`
Color string `json:"color"`
Size float64 `json:"size"`
Type string `json:"type"` // "arrow"
}
// ProjectInfo describes a project directory.
type ProjectInfo struct {
Name string `json:"name"`
Description string `json:"description"`
EntityCount int `json:"entity_count"`
RelCount int `json:"relation_count"`
}
// EntityInput is the DTO for creating/updating entities from the frontend.
type EntityInput struct {
Name string `json:"name"`
TypeRef string `json:"type_ref"`
Description string `json:"description"`
Tags []string `json:"tags"`
Metadata map[string]any `json:"metadata"`
Notes string `json:"notes"`
}
// RelationInput is the DTO for creating/updating relations from the frontend.
type RelationInputDTO struct {
Name string `json:"name"`
FromEntity string `json:"from_entity"`
ToEntity string `json:"to_entity"`
Description string `json:"description"`
Weight *float64 `json:"weight"`
Tags []string `json:"tags"`
Notes string `json:"notes"`
}
// AssertionInput is the DTO for creating assertions from the frontend.
type AssertionInput struct {
EntityID string `json:"entity_id"`
Name string `json:"name"`
Kind string `json:"kind"`
Rule string `json:"rule"`
Severity string `json:"severity"`
Description string `json:"description"`
}
// Color map for entity types (short names aligned with registry)
var entityTypeColors = map[string]string{
"person": "#e74c3c",
"organization": "#3498db",
"crypto_wallet": "#f39c12",
"ip_address": "#2ecc71",
"domain": "#9b59b6",
"email": "#1abc9c",
"phone": "#e67e22",
"malware": "#c0392b",
"vulnerability": "#8e44ad",
"social_media": "#2980b9",
"document": "#7f8c8d",
"event": "#d35400",
"location": "#27ae60",
"text": "#78909c",
"url": "#8bc34a",
}
var entityTypePresets = []EntityTypePreset{
{"person", "Person", "#e74c3c", []string{"full_name", "alias", "nationality", "dob", "gender", "risk_score"}},
{"organization", "Organization", "#3498db", []string{"legal_name", "country", "sector", "founded", "risk_score"}},
{"crypto_wallet", "Crypto Wallet", "#f39c12", []string{"address", "blockchain", "balance", "first_seen", "last_seen"}},
{"ip_address", "IP Address", "#2ecc71", []string{"ip", "asn", "country", "isp", "geolocation", "last_seen"}},
{"domain", "Domain", "#9b59b6", []string{"fqdn", "registrar", "created_date", "expires_date", "name_servers"}},
{"email", "Email", "#1abc9c", []string{"address", "provider", "verified", "breached"}},
{"phone", "Phone", "#e67e22", []string{"number", "country_code", "carrier", "phone_type"}},
{"malware", "Malware", "#c0392b", []string{"family", "hash_sha256", "first_seen", "last_seen", "threat_level"}},
{"vulnerability", "Vulnerability", "#8e44ad", []string{"cve_id", "cvss", "affected_product", "published", "exploited"}},
{"social_media", "Social Media", "#2980b9", []string{"platform", "username", "url", "followers", "verified"}},
{"document", "Document", "#7f8c8d", []string{"title", "format", "classification", "file_path", "source"}},
{"event", "Event", "#d35400", []string{"event_type", "date", "location", "description", "severity"}},
{"location", "Location", "#27ae60", []string{"lat", "lon", "address", "country", "city"}},
{"text", "Text", "#78909c", []string{"content_preview", "source", "char_count"}},
{"url", "URL", "#8bc34a", []string{"url", "domain", "status_code"}},
}
var relationPresets = []string{
"funds", "employs", "communicates_with", "owns", "operates",
"controls", "affiliated_with", "located_at", "resolves_to",
"registered_by", "hosts", "exploits", "attributed_to", "related_to",
"extracted_from", "contains", "fetched_from",
}