export enum QueryType { DIRECT = 'direct', GRAFANA = 'grafana', } export enum DatasourceType { INFLUXDB = 'influxdb', GRAPHITE = 'graphite', PROMETHEUS = 'prometheus', POSTGRES = 'postgres', ELASTICSEARCH = 'elasticsearch', MYSQL = 'mysql', } export declare type Datasource = { url: string; type: DatasourceType; params?: { db: string; q: string; epoch: string; }; data?: any; datasourceId?: string; }; export type DatasourceQuery = { url: string; method: string; schema: any; headers?: any; } export type DataTable = { values: (number | null)[][]; columns: string[]; } export abstract class DatasourceConnector { constructor( public datasource: Datasource, // TODO: Target type public targets: any[], ) {}; /* from / to - timestamp in ms limit - max number of items in result offset - number of items to skip from timerange start */ abstract getQuery(from: number, to: number, limit: number, offset: number): DatasourceQuery; abstract parseResponse(res): DataTable; }