/** * Graph Database Connection Interfaces * * Types for graph database configuration and connection management * Based on Ductape Graph API documentation (getting-started.md, overview.md) */ import { GraphType } from './enums'; import type { Redis as IORedisClient } from 'ioredis'; /** * Graph database environment configuration * As documented in getting-started.md */ export interface IGraphEnvConfig { /** Environment identifier (e.g., 'dev', 'staging', 'prd') */ slug: string; /** Graph database connection string */ connection_url: string; /** Description of this environment configuration */ description?: string; /** Database name (ArangoDB) */ database?: string; /** Graph name (ArangoDB) */ graphName?: string; /** AWS region (Neptune) */ region?: string; /** Neptune IAM database authentication */ iamAuth?: boolean; authMode?: 'manual' | 'cloud_connection'; /** Workspace cloud connection tag */ cloud?: string; cloudConnectionId?: string; /** Cloud resource id when linking via cloud (provision on save) */ instance?: string; /** Username for authentication for NEO4J */ username?: string; /** Password for authentication for NEO4J */ password?: string; } /** * Graph database configuration for registration * As documented in getting-started.md */ export interface IGraphConfig { /** Human-readable display name */ name: string; /** Unique identifier for the graph database */ tag: string; /** Database type: 'neo4j', 'neptune', 'arangodb', or 'memgraph' */ type: GraphType | string; /** Description of what the graph stores */ description?: string; /** Environment-specific connection configurations */ envs: IGraphEnvConfig[]; } /** * Connection options for establishing graph database connection * As documented in getting-started.md */ export interface IGraphConnectionConfig { /** Environment to connect to (e.g., 'dev', 'staging', 'prd') */ env: string; /** Product tag */ product: string; /** Graph database tag */ graph: string; /** Optional connection options */ options?: IGraphConnectionOptions; } /** * Additional connection options */ export interface IGraphConnectionOptions { /** Connection timeout in milliseconds */ connectionTimeout?: number; /** Query timeout in milliseconds */ queryTimeout?: number; /** Maximum pool size */ maxPoolSize?: number; /** Enable encryption */ encrypted?: boolean; /** Trust strategy for TLS */ trustStrategy?: 'TRUST_ALL_CERTIFICATES' | 'TRUST_SYSTEM_CA_SIGNED_CERTIFICATES' | 'TRUST_CUSTOM_CA_SIGNED_CERTIFICATES'; /** Custom CA certificates */ trustedCertificates?: string[]; } /** * Connection result returned after connecting * As documented in getting-started.md */ export interface IGraphConnectionResult { /** Whether connection was successful */ connected: boolean; /** Graph database type */ type: GraphType | string; /** Database version if available */ version?: string; /** Connection latency in milliseconds */ latency?: number; /** Error message if connection failed */ error?: string; } /** * Connection context tracking current connection state */ export interface IGraphConnectionContext { /** Graph database tag */ graph: string; /** Environment slug */ env: string; /** Graph database type */ type: GraphType; /** Connection URL */ connectionUrl: string; /** Whether currently connected */ connected: boolean; /** Product tag */ product?: string; /** Graph name */ name?: string; /** Description */ description?: string; /** Database name (ArangoDB) */ database?: string; /** Graph name within database (ArangoDB) */ graphName?: string; /** Username for authentication (Neo4j) */ username?: string; /** Password for authentication (Neo4j) */ password?: string; /** AWS region (Neptune) */ region?: string; /** Neptune IAM authentication */ iamAuth?: boolean; authMode?: 'manual' | 'cloud_connection'; /** Workspace cloud connection tag */ cloud?: string; cloudConnectionId?: string; } /** * Graph service configuration */ export interface IGraphServiceConfig { /** Workspace ID */ workspace_id: string; /** Public key */ public_key: string; /** User ID */ user_id: string; /** Authentication token */ token: string; /** Environment type */ env_type: string; /** Optional Redis client for caching */ redis_client?: IORedisClient; default_product?: string; default_env?: string; } /** * Test connection result * As documented in getting-started.md */ export interface IGraphTestConnectionResult extends IGraphConnectionResult { /** Server time if available */ serverTime?: Date; /** Available features */ features?: string[]; }