UNPKG

@dataql/node

Version:

DataQL core SDK for unified data management with MongoDB and GraphQL - Production Multi-Cloud Ready

67 lines (66 loc) 1.72 kB
/** * Database introspection types and interfaces */ export interface DatabaseConnection { url: string; name?: string; options?: Record<string, any>; } export interface IntrospectionOptions { sampleSize?: number; maxDepth?: number; includeIndexes?: boolean; excludeCollections?: string[]; includeCollections?: string[]; } export interface FieldAnalysis { type: string; required?: boolean; enum?: string[]; examples?: any[]; nullable?: boolean; format?: string; nested?: Record<string, FieldAnalysis>; items?: FieldAnalysis; } export interface CollectionIntrospection { name: string; documentCount: number; sampleSize: number; fields: Record<string, FieldAnalysis>; indexes?: IndexIntrospection[]; relationships?: RelationshipIntrospection[]; } export interface IndexIntrospection { name: string; fields: Record<string, 1 | -1>; unique?: boolean; sparse?: boolean; partialFilterExpression?: any; } export interface RelationshipIntrospection { field: string; targetCollection: string; type: "one-to-one" | "one-to-many" | "many-to-many"; foreignKey?: string; } export interface DatabaseIntrospection { databaseName: string; databaseType: string; collections: CollectionIntrospection[]; schemas: Record<string, any>; totalDocuments: number; introspectionTime: Date; statistics: { collectionsAnalyzed: number; documentsAnalyzed: number; fieldsDiscovered: number; indexesFound: number; }; } export interface IntrospectionResult { success: boolean; data?: DatabaseIntrospection; error?: string; warnings?: string[]; }