import type { DatasourceSpec, HTTPProxy, UnknownSpec } from '@perses-dev/spec'; import type { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from './datasource'; /** * Parameters for building a datasource proxy URL */ export interface BuildDatasourceProxyUrlParams { project?: string; dashboard?: string; /** Omit to generate an unsaved-datasource proxy URL */ name?: string; } /** * Function type for building datasource proxy URLs */ export type BuildDatasourceProxyUrlFunc = (params: BuildDatasourceProxyUrlParams) => string; /** * Builds a proxy URL for a datasource. When name is omitted the URL targets the * unsaved-datasource proxy endpoint (used for testing connectivity before saving). * Reads api_prefix from window.PERSES_APP_CONFIG if available. */ export declare function buildProxyUrl({ project, dashboard, name }: BuildDatasourceProxyUrlParams): string; export declare function hasHTTPProxy(spec: UnknownSpec): spec is { proxy: HTTPProxy; }; /** * Creates a function that tests connectivity for an unsaved datasource. * Supports directUrl (direct mode) and HTTPProxy (proxy mode). * Throws for any spec that does not match either shape. */ export declare function createTestDatasourceConnection({ project, dashboard }?: { project?: string; dashboard?: string; }): (spec: DatasourceSpec, healthCheckPath: string) => Promise; /** * The external API contract for fetching datasource resources. * This defines the interface that must be implemented to provide * datasource functionality to the dashboard. */ export interface DatasourceApi { /** * Optional function to build proxy URLs for datasources */ buildProxyUrl?: BuildDatasourceProxyUrlFunc; /** * Get a datasource resource for a specific project */ getDatasource: (project: string, selector: DatasourceSelector) => Promise; /** * Get a global datasource resource */ getGlobalDatasource: (selector: DatasourceSelector) => Promise; /** * List all datasources for a project, optionally filtered by plugin kind */ listDatasources: (project: string, pluginKind?: string) => Promise; /** * List all global datasources, optionally filtered by plugin kind */ listGlobalDatasources: (pluginKind?: string) => Promise; } //# sourceMappingURL=datasource-api.d.ts.map