export type WithSort = T & { sortField?: string; sortDesc?: boolean }; export type WithPagination = T & { perPage: number; page: number }; export type WithSortPagination = WithPagination>; export type Credentials = | { username: string; password: string; host: string; type: string; port: string; database: string; ssl: string; } | { connectionString: string; }; export interface Driver { getAllDatabases(credentials: Credentials): Promise; getAllTables( credentials: Credentials, args: WithSort<{ dbName: string }>, ): Promise; getTableData( credentials: Credentials, args: WithSortPagination<{ tableName: string; dbName: string; whereQuery?: string; }>, ): Promise<{ count: number; data: Record[]; }>; getTableColumns( credentials: Credentials, args: { dbName: string; tableName: string }, ): Promise; getTableIndexes( credentials: Credentials, args: { dbName: string; tableName: string }, ): Promise; getTableForeignKeys( credentials: Credentials, args: { dbName: string; tableName: string }, ): Promise; executeQuery( credentials: Credentials, query: string, ): Promise<{ count: number; data: Record[]; }>; }