{"version":3,"file":"datasource.cjs","sources":["../../../src/types/datasource.ts"],"sourcesContent":["import { ComponentType } from 'react';\nimport { Observable } from 'rxjs';\n\nimport { DataSourceRef } from '@grafana/schema';\n\nimport { deprecationWarning } from '../utils/deprecationWarning';\nimport { makeClassES5Compatible } from '../utils/makeClassES5Compatible';\nimport { throwIfAngular } from '../utils/throwIfAngular';\n\nimport { ScopedVars } from './ScopedVars';\nimport { WithAccessControlMetadata } from './accesscontrol';\nimport { AnnotationEvent, AnnotationQuery, AnnotationSupport } from './annotations';\nimport { CoreApp } from './app';\nimport { KeyValue, LoadingState, TableData, TimeSeries } from './data';\nimport { DataFrame, DataFrameDTO } from './dataFrame';\nimport { PanelData } from './panel';\nimport { GrafanaPlugin, PluginMeta } from './plugin';\nimport { DataQuery } from './query';\nimport { Scope } from './scopes';\nimport { AdHocVariableFilter } from './templateVars';\nimport { RawTimeRange, TimeRange } from './time';\nimport { UserStorage } from './userStorage';\nimport { CustomVariableSupport, DataSourceVariableSupport, StandardVariableSupport } from './variables';\n\nexport interface DataSourceConfigValidationAPI {\n  registerValidation: (validator: () => Promise<boolean> | boolean) => () => void;\n  validate: () => Promise<boolean>;\n  isValid: () => boolean;\n  getErrors: () => Record<string, string>;\n  setError: (field: string, message: string) => void;\n  clearError: (field: string) => void;\n}\nexport interface DataSourcePluginOptionsEditorProps<\n  JSONData extends DataSourceJsonData = DataSourceJsonData,\n  SecureJSONData = {},\n> {\n  options: DataSourceSettings<JSONData, SecureJSONData>;\n  onOptionsChange: (options: DataSourceSettings<JSONData, SecureJSONData>) => void;\n  validation?: DataSourceConfigValidationAPI;\n}\n\n// Utility type to extract the query type TQuery from a class extending DataSourceApi<TQuery, TOptions>\nexport type DataSourceQueryType<DSType> = DSType extends DataSourceApi<infer TQuery, any> ? TQuery : never;\n\n// Utility type to extract the options type TOptions from a class extending DataSourceApi<TQuery, TOptions>\nexport type DataSourceOptionsType<DSType> = DSType extends DataSourceApi<any, infer TOptions> ? TOptions : never;\n\nexport class DataSourcePlugin<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataSourceQueryType<DSType>,\n  TOptions extends DataSourceJsonData = DataSourceOptionsType<DSType>,\n  TSecureOptions = {},\n> extends GrafanaPlugin<DataSourcePluginMeta<TOptions>> {\n  components: DataSourcePluginComponents<DSType, TQuery, TOptions, TSecureOptions> = {};\n\n  constructor(public DataSourceClass: DataSourceConstructor<DSType, TQuery, TOptions>) {\n    super();\n  }\n\n  setConfigEditor(editor: ComponentType<DataSourcePluginOptionsEditorProps<TOptions, TSecureOptions>>) {\n    this.components.ConfigEditor = editor;\n    return this;\n  }\n\n  /** @deprecated it will be removed in a future release */\n  setConfigCtrl(ConfigCtrl: any) {\n    deprecationWarning('DataSourcePlugin', 'setConfigCtrl');\n    this.angularConfigCtrl = ConfigCtrl;\n    return this;\n  }\n\n  /** @deprecated it will be removed in a future release */\n  setQueryCtrl(QueryCtrl: any) {\n    deprecationWarning('DataSourcePlugin', 'setQueryCtrl');\n    this.components.QueryCtrl = QueryCtrl;\n    return this;\n  }\n\n  /** @deprecated -- register the annotation support in the instance constructor */\n  setAnnotationQueryCtrl(AnnotationsQueryCtrl: any) {\n    this.components.AnnotationsQueryCtrl = AnnotationsQueryCtrl;\n    return this;\n  }\n\n  setQueryEditor(QueryEditor: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n    this.components.QueryEditor = QueryEditor;\n    return this;\n  }\n\n  /** @deprecated Use `setQueryEditor` instead. When using Explore `props.app` is equal to `CoreApp.Explore` */\n  setExploreQueryField(ExploreQueryField: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n    this.components.ExploreQueryField = ExploreQueryField;\n    return this;\n  }\n\n  /** @deprecated Use `setQueryEditor` instead. */\n  setExploreMetricsQueryField(ExploreQueryField: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n    this.components.ExploreMetricsQueryField = ExploreQueryField;\n    return this;\n  }\n\n  /** @deprecated Use `setQueryEditor` instead. */\n  setExploreLogsQueryField(ExploreQueryField: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>) {\n    this.components.ExploreLogsQueryField = ExploreQueryField;\n    return this;\n  }\n\n  setQueryEditorHelp(QueryEditorHelp: ComponentType<QueryEditorHelpProps<TQuery>>) {\n    this.components.QueryEditorHelp = QueryEditorHelp;\n    return this;\n  }\n\n  /**\n   * @deprecated prefer using `setQueryEditorHelp`\n   */\n  setExploreStartPage(ExploreStartPage: ComponentType<QueryEditorHelpProps<TQuery>>) {\n    return this.setQueryEditorHelp(ExploreStartPage);\n  }\n\n  /**\n   * @deprecated -- prefer using {@link StandardVariableSupport} or {@link CustomVariableSupport} or {@link DataSourceVariableSupport} in data source instead\n   */\n  setVariableQueryEditor(VariableQueryEditor: any) {\n    this.components.VariableQueryEditor = VariableQueryEditor;\n    return this;\n  }\n\n  setMetadataInspector(MetadataInspector: ComponentType<MetadataInspectorProps<DSType, TQuery, TOptions>>) {\n    this.components.MetadataInspector = MetadataInspector;\n    return this;\n  }\n\n  setComponentsFromLegacyExports(pluginExports: System.Module) {\n    throwIfAngular(pluginExports);\n\n    this.components.QueryCtrl = pluginExports.QueryCtrl;\n    this.components.AnnotationsQueryCtrl = pluginExports.AnnotationsQueryCtrl;\n    this.components.ExploreQueryField = pluginExports.ExploreQueryField;\n    this.components.QueryEditor = pluginExports.QueryEditor;\n    this.components.QueryEditorHelp = pluginExports.QueryEditorHelp;\n    this.components.VariableQueryEditor = pluginExports.VariableQueryEditor;\n  }\n}\n\nexport interface DataSourcePluginMeta<T extends KeyValue = {}> extends PluginMeta<T> {\n  builtIn?: boolean; // Is this for all\n  metrics?: boolean;\n  logs?: boolean;\n  annotations?: boolean;\n  alerting?: boolean;\n  tracing?: boolean;\n  mixed?: boolean;\n  hasQueryHelp?: boolean;\n  category?: string;\n  queryOptions?: PluginMetaQueryOptions;\n  sort?: number;\n  streaming?: boolean;\n  unlicensed?: boolean;\n  backend?: boolean;\n  isBackend?: boolean;\n  multiValueFilterOperators?: boolean;\n}\n\ninterface PluginMetaQueryOptions {\n  cacheTimeout?: boolean;\n  maxDataPoints?: boolean;\n  minInterval?: boolean;\n}\ninterface PluginQueryCachingConfig {\n  enabled?: boolean;\n  TTLMs?: number;\n}\n\nexport interface DataSourcePluginComponents<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n  TSecureOptions = {},\n> {\n  /** @deprecated it will be removed in a future release */\n  QueryCtrl?: any;\n  /** @deprecated it will be removed in a future release */\n  AnnotationsQueryCtrl?: any;\n  VariableQueryEditor?: any;\n  QueryEditor?: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>;\n  /** @deprecated it will be removed in a future release and `QueryEditor` will be used instead. */\n  ExploreQueryField?: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>;\n  /** @deprecated it will be removed in a future release and `QueryEditor` will be used instead. */\n  ExploreMetricsQueryField?: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>;\n  /** @deprecated it will be removed in a future release and `QueryEditor` will be used instead. */\n  ExploreLogsQueryField?: ComponentType<QueryEditorProps<DSType, TQuery, TOptions>>;\n  QueryEditorHelp?: ComponentType<QueryEditorHelpProps<TQuery>>;\n  ConfigEditor?: ComponentType<DataSourcePluginOptionsEditorProps<TOptions, TSecureOptions>>;\n  MetadataInspector?: ComponentType<MetadataInspectorProps<DSType, TQuery, TOptions>>;\n}\n\n// Only exported for tests\nexport interface DataSourceConstructor<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n> {\n  new (instanceSettings: DataSourceInstanceSettings<TOptions>, ...args: any[]): DSType;\n}\n\n// VariableSupport is hoisted up to its own type to fix the wonky intermittent\n// 'variables is references directly or indirectly' error\ntype VariableSupport<TQuery extends DataQuery, TOptions extends DataSourceJsonData> =\n  | StandardVariableSupport<DataSourceApi<TQuery, TOptions>>\n  | CustomVariableSupport<DataSourceApi<TQuery, TOptions>>\n  | DataSourceVariableSupport<DataSourceApi<TQuery, TOptions>>;\n\n/**\n * The main data source abstraction interface, represents an instance of a data source\n */\nabstract class DataSourceApi<\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n  TQueryImportConfiguration extends Record<string, object> = {},\n> {\n  /**\n   *  Set in constructor\n   */\n  readonly name: string;\n\n  /**\n   * Internal ID, this will be removed in G13\n   *\n   * @deprecated\n   */\n  readonly id?: number;\n\n  /**\n   *  Set in constructor\n   */\n  readonly type: string;\n\n  /**\n   *  Set in constructor\n   */\n  readonly uid: string;\n\n  /**\n   *  Set in constructor\n   */\n  readonly apiVersion?: string;\n\n  /**\n   *  min interval range\n   */\n  interval?: string;\n\n  /**\n   * Initialized in datasource_srv.ts\n   */\n  userStorage?: UserStorage;\n\n  constructor(instanceSettings: DataSourceInstanceSettings<TOptions>) {\n    this.name = instanceSettings.name;\n    this.id = instanceSettings.id;\n    this.type = instanceSettings.type;\n    this.meta = instanceSettings.meta;\n    this.cachingConfig = instanceSettings.cachingConfig;\n    this.uid = instanceSettings.uid;\n    this.apiVersion = instanceSettings.apiVersion;\n  }\n\n  /**\n   * @deprecated use DataSourceWithQueryImportSupport and DataSourceWithQueryExportSupport\n   */\n  async importQueries?(queries: DataQuery[], originDataSource: DataSourceApi<DataQuery>): Promise<TQuery[]>;\n\n  /**\n   * Returns configuration for importing queries from other data sources\n   */\n  getImportQueryConfiguration?(): TQueryImportConfiguration;\n\n  /**\n   * Initializes a datasource after instantiation\n   */\n  init?: () => void;\n\n  /**\n   * Query for data, and optionally stream results\n   */\n  abstract query(request: DataQueryRequest<TQuery>): Promise<DataQueryResponse> | Observable<DataQueryResponse>;\n\n  /**\n   * Test & verify datasource settings & connection details (returning TestingStatus)\n   *\n   * When verification fails - errors specific to the data source should be handled here and converted to\n   * a TestingStatus object. Unknown errors and HTTP errors can be re-thrown and will be handled here:\n   * public/app/features/datasources/state/actions.ts\n   */\n  abstract testDatasource(): Promise<TestDataSourceResponse>;\n\n  /**\n   * Optionally, you can implement this method to prevent certain queries from being executed.\n   * Return false to prevent the query from being executed.\n   */\n  filterQuery?(query: TQuery): boolean {\n    return true;\n  }\n\n  /**\n   *  Get hints for query improvements\n   */\n  getQueryHints?(query: TQuery, results: any[], ...rest: any): QueryHint[];\n\n  /**\n   * Convert a query to a simple text string\n   */\n  getQueryDisplayText?(query: TQuery): string;\n\n  /**\n   * Variable query action.\n   */\n  metricFindQuery?(query: any, options?: LegacyMetricFindQueryOptions): Promise<MetricFindValue[]>;\n\n  /**\n   * Verify adhoc filters and groupBy keys applicability based on queries and current selected values\n   */\n  getDrilldownsApplicability?(\n    options?: DataSourceGetDrilldownsApplicabilityOptions<TQuery>\n  ): Promise<DrilldownsApplicability[]>;\n\n  /**\n   * Get recommended drilldowns for a dashboard\n   */\n  getRecommendedDrilldowns?(\n    options?: DataSourceGetRecommendedDrilldownsOptions<TQuery>\n  ): Promise<DrilldownRecommendation>;\n\n  /**\n   * Get tag keys for adhoc filters\n   */\n  getTagKeys?(options?: DataSourceGetTagKeysOptions<TQuery>): Promise<GetTagResponse> | Promise<MetricFindValue[]>;\n\n  /**\n   * Get tag values for adhoc filters\n   */\n  getTagValues?(options: DataSourceGetTagValuesOptions<TQuery>): Promise<GetTagResponse> | Promise<MetricFindValue[]>;\n\n  /**\n   * Set after constructor call, as the data source instance is the most common thing to pass around\n   * we attach the components to this instance for easy access\n   */\n  components?: DataSourcePluginComponents<DataSourceApi<TQuery, TOptions>, TQuery, TOptions>;\n\n  /**\n   * static information about the datasource\n   */\n  meta: DataSourcePluginMeta;\n\n  /**\n   * Information about the datasource's query caching configuration\n   * When the caching feature is disabled, this config will always be falsy\n   */\n  cachingConfig?: PluginQueryCachingConfig;\n\n  /**\n   * Used by alerting to check if query contains template variables\n   */\n  targetContainsTemplate?(query: TQuery): boolean;\n\n  /**\n   * Used in explore\n   */\n  modifyQuery?(query: TQuery, action: QueryFixAction): TQuery;\n\n  /** Get an identifier object for this datasource instance */\n  getRef(): DataSourceRef {\n    const ref: DataSourceRef = { type: this.type, uid: this.uid };\n    if (this.apiVersion) {\n      ref.apiVersion = this.apiVersion;\n    }\n    return ref;\n  }\n\n  /**\n   * Used in explore\n   */\n  languageProvider?: any;\n\n  getVersion?(optionalOptions?: any): Promise<string>;\n\n  interpolateVariablesInQueries?(queries: TQuery[], scopedVars: ScopedVars, filters?: AdHocVariableFilter[]): TQuery[];\n\n  /**\n   * An annotation processor allows explicit control for how annotations are managed.\n   *\n   * It is only necessary to configure an annotation processor if the default behavior is not desirable\n   */\n  annotations?: AnnotationSupport<TQuery>;\n\n  /**\n   * Can be optionally implemented to allow datasource to be a source of annotations for dashboard.\n   * This function will only be called if an angular {@link AnnotationsQueryCtrl} is configured and\n   * the {@link annotations} is undefined\n   *\n   * @deprecated -- prefer using {@link AnnotationSupport}\n   */\n  annotationQuery?(options: AnnotationQueryRequest<TQuery>): Promise<AnnotationEvent[]>;\n\n  /**\n   * Defines new variable support\n   * @alpha -- experimental\n   */\n  variables?: VariableSupport<TQuery, TOptions>;\n\n  /*\n   * Optionally, use this method to set default values for a query\n   * @alpha -- experimental\n   */\n  getDefaultQuery?(app: CoreApp): Partial<TQuery>;\n}\n\n/**\n * Base options shared across datasource filtering operations.\n */\nexport interface DataSourceFilteringRequestOptions<TQuery extends DataQuery = DataQuery> {\n  /**\n   * Context time range. New in v10.3\n   */\n  timeRange?: TimeRange;\n  queries?: TQuery[];\n  scopes?: Scope[] | undefined;\n}\n\n/**\n * Options argument to DataSourceAPI.getTagKeys\n */\nexport interface DataSourceGetTagKeysOptions<TQuery extends DataQuery = DataQuery>\n  extends DataSourceFilteringRequestOptions<TQuery> {\n  /**\n   * The other existing filters or base filters. New in v10.3\n   */\n  filters: AdHocVariableFilter[];\n}\n\n/**\n * Options argument to DataSourceAPI.getTagValues\n */\nexport interface DataSourceGetTagValuesOptions<TQuery extends DataQuery = DataQuery>\n  extends DataSourceFilteringRequestOptions<TQuery> {\n  key: string;\n  /**\n   * The other existing filters or base filters. New in v10.3\n   */\n  filters: AdHocVariableFilter[];\n}\n\nexport interface MetadataInspectorProps<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n> {\n  datasource: DSType;\n\n  // All Data from this DataSource\n  data: DataFrame[];\n}\n\nexport interface LegacyMetricFindQueryOptions {\n  searchFilter?: string;\n  scopedVars?: ScopedVars;\n  range?: TimeRange;\n  variable?: { name: string };\n}\n\nexport interface QueryEditorProps<\n  DSType extends DataSourceApi<TQuery, TOptions>,\n  TQuery extends DataQuery = DataQuery,\n  TOptions extends DataSourceJsonData = DataSourceJsonData,\n  TVQuery extends DataQuery = TQuery,\n> {\n  datasource: DSType;\n  query: TVQuery;\n  onRunQuery: () => void;\n  onChange: (value: TVQuery) => void;\n  onBlur?: () => void;\n  onAddQuery?: (query: TQuery) => void;\n  /**\n   * Contains query response filtered by refId of QueryResultBase and possible query error\n   */\n  data?: PanelData;\n  range?: TimeRange;\n  history?: Array<HistoryItem<TQuery>>;\n  queries?: DataQuery[];\n  app?: CoreApp;\n}\n\n// TODO: not really needed but used as type in some data sources and in DataQueryRequest\nexport enum ExploreMode {\n  Logs = 'Logs',\n  Metrics = 'Metrics',\n  Tracing = 'Tracing',\n}\n\nexport interface QueryEditorHelpProps<TQuery extends DataQuery = DataQuery> {\n  datasource: DataSourceApi<TQuery>;\n  query: TQuery;\n  onClickExample: (query: TQuery) => void;\n  exploreId?: any;\n}\n\n/**\n * Starting in v6.2 DataFrame can represent both TimeSeries and TableData\n */\nexport type LegacyResponseData = TimeSeries | TableData | any;\n\nexport type DataQueryResponseData = DataFrame | DataFrameDTO | LegacyResponseData;\n\nexport interface DataQueryResponse {\n  /**\n   * The response data.  When streaming, this may be empty\n   * or a partial result set\n   */\n  data: DataQueryResponseData[];\n\n  /**\n   * When returning multiple partial responses or streams\n   * Use this key to inform Grafana how to combine the partial responses\n   * Multiple responses with same key are replaced (latest used)\n   */\n  key?: string;\n\n  /**\n   * Optionally include error info along with the response data\n   * @deprecated use errors instead -- will be removed in Grafana 10+\n   */\n  error?: DataQueryError;\n\n  /**\n   * Optionally include multiple errors for different targets\n   */\n  errors?: DataQueryError[];\n\n  /**\n   * Use this to control which state the response should have\n   * Defaults to LoadingState.Done if state is not defined\n   */\n  state?: LoadingState;\n\n  /**\n   * traceIds related to the response, if available\n   */\n  traceIds?: string[];\n}\n\nexport interface TestDataSourceResponse {\n  status: string;\n  message: string;\n  error?: Error;\n  details?: { message?: string; verboseMessage?: string };\n}\n\nexport enum DataQueryErrorType {\n  Cancelled = 'cancelled',\n  Timeout = 'timeout',\n  Unknown = 'unknown',\n}\n\nexport interface DataQueryError {\n  data?: {\n    /**\n     * Short information about the error\n     */\n    message?: string;\n    /**\n     * Detailed information about the error. Only returned when app_mode is development.\n     */\n    error?: string;\n  };\n  message?: string;\n  status?: number;\n  statusText?: string;\n  refId?: string;\n  traceId?: string;\n  type?: DataQueryErrorType;\n}\n\nexport interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {\n  requestId: string; // Used to identify results and optionally cancel the request in backendSrv\n\n  interval: string;\n  intervalMs: number;\n  maxDataPoints?: number;\n  range: TimeRange;\n  scopedVars: ScopedVars;\n  targets: TQuery[];\n  timezone: string;\n  app: CoreApp | string;\n\n  cacheTimeout?: string | null;\n  queryCachingTTL?: number | null;\n  skipQueryCache?: boolean;\n  rangeRaw?: RawTimeRange;\n  timeInfo?: string; // The query time description (blue text in the upper right)\n  panelId?: number;\n  panelName?: string;\n  panelPluginId?: string;\n  dashboardUID?: string;\n  dashboardTitle?: string;\n  headers?: Record<string, string>;\n\n  /** Filters to dynamically apply to all queries */\n  filters?: AdHocVariableFilter[];\n  groupByKeys?: string[];\n\n  // Request Timing\n  startTime: number;\n  endTime?: number;\n\n  // Explore state used by various datasources\n  liveStreaming?: boolean;\n\n  // Make it possible to hide support queries from the inspector\n  hideFromInspector?: boolean;\n\n  // Used to correlate multiple related requests\n  queryGroupId?: string;\n\n  scopes?: Scope[] | undefined;\n}\n\nexport interface DataQueryTimings {\n  dataProcessingTime: number;\n}\n\nexport interface QueryFix {\n  title?: string;\n  label: string;\n  action?: QueryFixAction;\n}\n\nexport type QueryFixType = 'ADD_FILTER' | 'ADD_FILTER_OUT' | 'ADD_STRING_FILTER' | 'ADD_STRING_FILTER_OUT';\nexport interface QueryFixAction {\n  query?: string;\n  preventSubmit?: boolean;\n  /**\n   * The type of action to perform. Will be passed to the data source to handle.\n   */\n  type: QueryFixType | string;\n  /**\n   * A key value map of options that will be passed. Usually used to pass e.g. the label and value.\n   */\n  options?: KeyValue<string>;\n  /**\n   * An optional single row data frame containing the row that triggered the QueryFixAction.\n   */\n  frame?: DataFrame;\n}\n\nexport interface QueryHint {\n  type: string;\n  label: string;\n  fix?: QueryFix;\n}\n\nexport interface MetricFindValue {\n  text: string;\n  value?: string | number;\n  group?: string;\n  expandable?: boolean;\n  properties?: Record<string, string>;\n}\n\nexport interface DataSourceGetDrilldownsApplicabilityOptions<TQuery extends DataQuery = DataQuery>\n  extends DataSourceFilteringRequestOptions<TQuery> {\n  filters?: AdHocVariableFilter[];\n  groupByKeys?: string[];\n}\n\nexport interface DataSourceGetRecommendedDrilldownsOptions<TQuery extends DataQuery = DataQuery>\n  extends DataSourceFilteringRequestOptions<TQuery> {\n  dashboardUid?: string;\n  filters?: AdHocVariableFilter[];\n  groupByKeys?: string[];\n}\n\nexport interface DrilldownRecommendation {\n  filters?: AdHocVariableFilter[];\n  groupByKeys?: string[];\n}\n\nexport interface DrilldownsApplicability {\n  key: string;\n  applicable: boolean;\n  // message explaining why the filter is not applicable\n  reason?: string;\n  // needed to differentiate between filters with same key\n  // but different origin\n  origin?: string;\n}\n\nexport interface DataSourceJsonData {\n  authType?: string;\n  defaultRegion?: string;\n  profile?: string;\n  manageAlerts?: boolean;\n  allowAsRecordingRulesTarget?: boolean;\n  alertmanagerUid?: string;\n  disableGrafanaCache?: boolean;\n}\n\n/**\n * Data Source instance edit model.  This is returned from:\n *  /api/datasources\n */\nexport interface DataSourceSettings<T extends DataSourceJsonData = DataSourceJsonData, S = {}>\n  extends WithAccessControlMetadata {\n  id: number;\n  uid: string;\n  orgId: number;\n  name: string;\n  typeLogoUrl: string;\n  type: string;\n  typeName: string;\n  access: string;\n  url: string;\n  user: string;\n  /**\n   *  @deprecated -- use jsonData to store information related to database.\n   *  This field should only be used by Elasticsearch and Influxdb.\n   */\n  database: string;\n  basicAuth: boolean;\n  basicAuthUser: string;\n  isDefault: boolean;\n  jsonData: T;\n  secureJsonData?: S;\n  secureJsonFields: KeyValue<boolean>;\n  readOnly: boolean;\n  withCredentials: boolean;\n  version?: number;\n  apiVersion?: string;\n}\n\n/**\n * Frontend settings model that is passed to Datasource constructor. This differs a bit from the model above\n * as this data model is available to every user who has access to a data source (Viewers+).  This is loaded\n * in bootData (on page load), or from: /api/frontend/settings\n */\nexport interface DataSourceInstanceSettings<T extends DataSourceJsonData = DataSourceJsonData> {\n  /**\n   * @deprecated will be removed in G13\n   */\n  id?: number;\n  uid: string;\n  type: string;\n  name: string;\n  apiVersion?: string;\n  meta: DataSourcePluginMeta;\n  cachingConfig?: PluginQueryCachingConfig;\n  readOnly: boolean;\n  url?: string;\n  jsonData: T;\n  username?: string;\n  password?: string; // when access is direct, for some legacy datasources\n  /**\n   *  @deprecated -- use jsonData to store information related to database.\n   *  This field should only be used by Elasticsearch and Influxdb.\n   */\n  database?: string;\n  isDefault?: boolean;\n  access: 'direct' | 'proxy'; // Currently we support 2 options - direct (browser) and proxy (server)\n\n  /**\n   * This is the full Authorization header if basic auth is enabled.\n   * Only available here when access is Browser (direct), when access is Server (proxy)\n   * The basic auth header, username & password is never exposed to browser/Frontend\n   * so this will be empty then.\n   */\n  basicAuth?: string;\n  withCredentials?: boolean;\n\n  /** When the name+uid are based on template variables, maintain access to the real values */\n  rawRef?: DataSourceRef;\n}\n\n/**\n * Options passed to the datasource.annotationQuery method. See docs/plugins/developing/datasource.md\n *\n * @deprecated -- use {@link AnnotationSupport}\n */\nexport interface AnnotationQueryRequest<MoreOptions = {}> {\n  range: TimeRange;\n  rangeRaw: RawTimeRange;\n  // Should be DataModel but cannot import that here from the main app. Needs to be moved to package first.\n  dashboard: any;\n  annotation: AnnotationQuery;\n}\n\nexport interface HistoryItem<TQuery extends DataQuery = DataQuery> {\n  ts: number;\n  query: TQuery;\n}\n\nexport interface GetTagResponse {\n  data: MetricFindValue[];\n  error?: DataQueryError;\n}\n\nabstract class LanguageProvider {\n  abstract datasource: DataSourceApi<any, any>;\n  abstract request: (url: string, params?: any) => Promise<any>;\n\n  /**\n   * Returns startTask that resolves with a task list when main syntax is loaded.\n   * Task list consists of secondary promises that load more detailed language features.\n   */\n  abstract start: (timeRange?: TimeRange) => Promise<Array<Promise<any>>>;\n  startTask?: Promise<any[]>;\n}\n\n//@ts-ignore\nLanguageProvider = makeClassES5Compatible(LanguageProvider);\nexport { LanguageProvider };\n\n//@ts-ignore\nDataSourceApi = makeClassES5Compatible(DataSourceApi);\n\nexport { DataSourceApi };\n"],"names":["GrafanaPlugin","deprecationWarning","throwIfAngular","ExploreMode","DataQueryErrorType","makeClassES5Compatible"],"mappings":";;;;;;;;;;AA+CO,MAAM,yBAKHA,oBAAA,CAA8C;AAAA,EAGtD,YAAmB,eAAA,EAAkE;AACnF,IAAA,KAAA,EAAM;AADW,IAAA,IAAA,CAAA,eAAA,GAAA,eAAA;AAFnB,IAAA,IAAA,CAAA,UAAA,GAAmF,EAAC;AAAA,EAIpF;AAAA,EAEA,gBAAgB,MAAA,EAAqF;AACnG,IAAA,IAAA,CAAK,WAAW,YAAA,GAAe,MAAA;AAC/B,IAAA,OAAO,IAAA;AAAA,EACT;AAAA;AAAA,EAGA,cAAc,UAAA,EAAiB;AAC7B,IAAAC,qCAAA,CAAmB,oBAAoB,eAAe,CAAA;AACtD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