@grafana/plugin-compat 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/apps.cjs +0 -7
  3. package/dist/cjs/apps.cjs.map +1 -1
  4. package/dist/cjs/datasources/getDataSourceInstance.cjs +0 -4
  5. package/dist/cjs/datasources/getDataSourceInstance.cjs.map +1 -1
  6. package/dist/cjs/datasources/getDataSourceInstanceList.cjs +0 -4
  7. package/dist/cjs/datasources/getDataSourceInstanceList.cjs.map +1 -1
  8. package/dist/cjs/datasources/getDataSourceInstanceSettings.cjs +0 -4
  9. package/dist/cjs/datasources/getDataSourceInstanceSettings.cjs.map +1 -1
  10. package/dist/cjs/datasources/getDefaultDataSourceInstanceListItem.cjs +0 -4
  11. package/dist/cjs/datasources/getDefaultDataSourceInstanceListItem.cjs.map +1 -1
  12. package/dist/cjs/datasources/registerRuntimeDataSourceInstance.cjs +0 -4
  13. package/dist/cjs/datasources/registerRuntimeDataSourceInstance.cjs.map +1 -1
  14. package/dist/cjs/datasources/useDataSourceInstance.cjs +1 -2
  15. package/dist/cjs/datasources/useDataSourceInstance.cjs.map +1 -1
  16. package/dist/cjs/datasources/useDataSourceInstanceList.cjs +1 -2
  17. package/dist/cjs/datasources/useDataSourceInstanceList.cjs.map +1 -1
  18. package/dist/cjs/datasources/useDefaultDataSourceInstanceListItem.cjs +1 -2
  19. package/dist/cjs/datasources/useDefaultDataSourceInstanceListItem.cjs.map +1 -1
  20. package/dist/esm/apps.mjs +0 -7
  21. package/dist/esm/apps.mjs.map +1 -1
  22. package/dist/esm/datasources/getDataSourceInstance.mjs +0 -4
  23. package/dist/esm/datasources/getDataSourceInstance.mjs.map +1 -1
  24. package/dist/esm/datasources/getDataSourceInstanceList.mjs +0 -4
  25. package/dist/esm/datasources/getDataSourceInstanceList.mjs.map +1 -1
  26. package/dist/esm/datasources/getDataSourceInstanceSettings.mjs +0 -4
  27. package/dist/esm/datasources/getDataSourceInstanceSettings.mjs.map +1 -1
  28. package/dist/esm/datasources/getDefaultDataSourceInstanceListItem.mjs +0 -4
  29. package/dist/esm/datasources/getDefaultDataSourceInstanceListItem.mjs.map +1 -1
  30. package/dist/esm/datasources/registerRuntimeDataSourceInstance.mjs +0 -4
  31. package/dist/esm/datasources/registerRuntimeDataSourceInstance.mjs.map +1 -1
  32. package/dist/esm/datasources/useDataSourceInstance.mjs +1 -2
  33. package/dist/esm/datasources/useDataSourceInstance.mjs.map +1 -1
  34. package/dist/esm/datasources/useDataSourceInstanceList.mjs +1 -2
  35. package/dist/esm/datasources/useDataSourceInstanceList.mjs.map +1 -1
  36. package/dist/esm/datasources/useDefaultDataSourceInstanceListItem.mjs +1 -2
  37. package/dist/esm/datasources/useDefaultDataSourceInstanceListItem.mjs.map +1 -1
  38. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.8.0 (2026-11-06)
2
+
3
+ Fix plugins that bundle `@grafana/plugin-compat` failing to load on Grafana older than 11.6. Every earlier release (`0.1.0` to `0.7.0`) imported `@grafana/runtime/unstable`, which those hosts don't provide, so the plugin failed to load even if it never called the affected function. Update to `0.8.0` and rebuild the plugin to pick up the fix.
4
+
5
+ Each function now uses the host's stable `@grafana/runtime` export when it exists and the legacy `getDataSourceSrv()` or `getBackendSrv()` API otherwise. This changes behavior on Grafana 13.1 and 13.2, which only expose the async APIs under `unstable`: they now take the legacy path, so `registerRuntimeDataSourceInstance` registers into the legacy registry there.
6
+
1
7
  # 0.7.0 (2026-11-03)
2
8
 
3
9
  Add `getAppPluginHealth` function.
package/dist/cjs/apps.cjs CHANGED
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  async function getPluginSettings(pluginId, showErrorAlert = false) {
10
9
  if (typeof runtime.getPluginSettings === "function") {
11
10
  return runtime.getPluginSettings(pluginId, showErrorAlert);
12
11
  }
13
- if (typeof unstable.getPluginSettings === "function") {
14
- return unstable.getPluginSettings(pluginId, showErrorAlert);
15
- }
16
12
  return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);
17
13
  }
18
14
  async function backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert = false) {
@@ -25,9 +21,6 @@ async function updateAppPluginSettings(pluginId, data) {
25
21
  if (typeof runtime.updateAppPluginSettings === "function") {
26
22
  return runtime.updateAppPluginSettings(pluginId, data);
27
23
  }
28
- if (typeof unstable.updateAppPluginSettings === "function") {
29
- return unstable.updateAppPluginSettings(pluginId, data);
30
- }
31
24
  return backwardsCompatibleUpdatePluginSettings(pluginId, data);
32
25
  }
33
26
  async function backwardsCompatibleUpdatePluginSettings(pluginId, data) {
@@ -1 +1 @@
1
- {"version":3,"file":"apps.cjs","sources":["../../src/apps.ts"],"sourcesContent":["import { type PluginMeta } from '@grafana/data';\nimport {\n getBackendSrv,\n getPluginSettings as stableGetPluginSettings,\n getAppPluginHealth as stableGetAppPluginHealth,\n updateAppPluginSettings as stableUpdateAppPluginSettings,\n type HealthCheckResult,\n HealthStatus,\n isFetchError,\n} from '@grafana/runtime';\nimport {\n getPluginSettings as unstableGetPluginSettings,\n updateAppPluginSettings as unstableUpdateAppPluginSettings,\n} from '@grafana/runtime/unstable';\n\nexport async function getPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n if (typeof stableGetPluginSettings === 'function') {\n return stableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n if (typeof unstableGetPluginSettings === 'function') {\n return unstableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);\n}\n\nasync function backwardsCompatibleGetPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n return getBackendSrv().get(`/api/plugins/${pluginId}/settings`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n });\n}\n\nexport async function updateAppPluginSettings(pluginId: string, data: Partial<PluginMeta>): Promise<PluginMeta> {\n if (typeof stableUpdateAppPluginSettings === 'function') {\n return stableUpdateAppPluginSettings(pluginId, data);\n }\n\n if (typeof unstableUpdateAppPluginSettings === 'function') {\n return unstableUpdateAppPluginSettings(pluginId, data);\n }\n\n return backwardsCompatibleUpdatePluginSettings(pluginId, data);\n}\n\nasync function backwardsCompatibleUpdatePluginSettings(\n pluginId: string,\n data: Partial<PluginMeta>\n): Promise<PluginMeta> {\n await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });\n return backwardsCompatibleGetPluginSettings(pluginId);\n}\n\nexport async function getAppPluginHealth(\n pluginId: string,\n showErrorAlert = false,\n apiVersion?: string\n): Promise<HealthCheckResult | undefined> {\n if (typeof stableGetAppPluginHealth === 'function') {\n return stableGetAppPluginHealth(pluginId, showErrorAlert, apiVersion);\n }\n\n return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);\n}\n\nfunction isLegacyUnhealthyHealthCheckError(err: unknown): boolean {\n return (\n isFetchError<HealthCheckResult>(err) &&\n err.status === 400 &&\n (err.data?.status === HealthStatus.Error || err.data?.status === HealthStatus.Unknown)\n );\n}\n\nasync function backwardsCompatibleGetAppPluginHealth(\n pluginId: string,\n showErrorAlert = false\n): Promise<HealthCheckResult> {\n return getBackendSrv()\n .get<HealthCheckResult>(`/api/plugins/${pluginId}/health`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n })\n .catch((err) => {\n if (isFetchError(err) && (err.status === 401 || err.status === 403)) {\n err.isHandled = true;\n return Promise.reject(err);\n }\n\n if (isLegacyUnhealthyHealthCheckError(err)) {\n return err.data;\n }\n\n return Promise.reject(err);\n });\n}\n"],"names":["stableGetPluginSettings","unstableGetPluginSettings","getBackendSrv","stableUpdateAppPluginSettings","unstableUpdateAppPluginSettings","stableGetAppPluginHealth","isFetchError","HealthStatus"],"mappings":";;;;;;;;AAeA,eAAsB,iBAAA,CAAkB,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACrG,EAAA,IAAI,OAAOA,8BAA4B,UAAA,EAAY;AACjD,IAAA,OAAOA,yBAAA,CAAwB,UAAU,cAAc,CAAA;AAAA,EACzD;AAEA,EAAA,IAAI,OAAOC,+BAA8B,UAAA,EAAY;AACnD,IAAA,OAAOA,0BAAA,CAA0B,UAAU,cAAc,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,oCAAA,CAAqC,UAAU,cAAc,CAAA;AACtE;AAEA,eAAe,oCAAA,CAAqC,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACjH,EAAA,OAAOC,uBAAc,CAAE,GAAA,CAAI,gBAAgB,QAAQ,CAAA,SAAA,CAAA,EAAa,QAAW,KAAA,CAAA,EAAW;AAAA,IACpF,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA;AACH;AAEA,eAAsB,uBAAA,CAAwB,UAAkB,IAAA,EAAgD;AAC9G,EAAA,IAAI,OAAOC,oCAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,+BAAA,CAA8B,UAAU,IAAI,CAAA;AAAA,EACrD;AAEA,EAAA,IAAI,OAAOC,qCAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,gCAAA,CAAgC,UAAU,IAAI,CAAA;AAAA,EACvD;AAEA,EAAA,OAAO,uCAAA,CAAwC,UAAU,IAAI,CAAA;AAC/D;AAEA,eAAe,uCAAA,CACb,UACA,IAAA,EACqB;AACrB,EAAA,MAAMF,qBAAA,EAAc,CAAE,IAAA,CAAK,CAAA,aAAA,EAAgB,QAAQ,aAAa,IAAA,EAAM,EAAE,YAAA,EAAc,IAAA,EAAM,CAAA;AAC5F,EAAA,OAAO,qCAAqC,QAAQ,CAAA;AACtD;AAEA,eAAsB,kBAAA,CACpB,QAAA,EACA,cAAA,GAAiB,KAAA,EACjB,UAAA,EACwC;AACxC,EAAA,IAAI,OAAOG,+BAA6B,UAAA,EAAY;AAClD,IAAA,OAAOA,0BAAA,CAAyB,QAAA,EAAU,cAAA,EAAgB,UAAU,CAAA;AAAA,EACtE;AAEA,EAAA,OAAO,qCAAA,CAAsC,UAAU,cAAc,CAAA;AACvE;AAEA,SAAS,kCAAkC,GAAA,EAAuB;AAlElE,EAAA,IAAA,EAAA,EAAA,EAAA;AAmEE,EAAA,OACEC,qBAAgC,GAAG,CAAA,IACnC,GAAA,CAAI,MAAA,KAAW,UACd,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,MAAA,MAAWC,qBAAa,KAAA,IAAA,CAAA,CAAS,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,YAAWA,oBAAA,CAAa,OAAA,CAAA;AAElF;AAEA,eAAe,qCAAA,CACb,QAAA,EACA,cAAA,GAAiB,KAAA,EACW;AAC5B,EAAA,OAAOL,uBAAc,CAClB,GAAA,CAAuB,gBAAgB,QAAQ,CAAA,OAAA,CAAA,EAAW,QAAW,KAAA,CAAA,EAAW;AAAA,IAC/E,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA,CACA,KAAA,CAAM,CAAC,GAAA,KAAQ;AACd,IAAA,IAAII,oBAAA,CAAa,GAAG,CAAA,KAAM,GAAA,CAAI,WAAW,GAAA,IAAO,GAAA,CAAI,WAAW,GAAA,CAAA,EAAM;AACnE,MAAA,GAAA,CAAI,SAAA,GAAY,IAAA;AAChB,MAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,IAC3B;AAEA,IAAA,IAAI,iCAAA,CAAkC,GAAG,CAAA,EAAG;AAC1C,MAAA,OAAO,GAAA,CAAI,IAAA;AAAA,IACb;AAEA,IAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,EAC3B,CAAC,CAAA;AACL;;;;;;"}
1
+ {"version":3,"file":"apps.cjs","sources":["../../src/apps.ts"],"sourcesContent":["import { type PluginMeta } from '@grafana/data';\nimport {\n getBackendSrv,\n getPluginSettings as stableGetPluginSettings,\n getAppPluginHealth as stableGetAppPluginHealth,\n updateAppPluginSettings as stableUpdateAppPluginSettings,\n type HealthCheckResult,\n HealthStatus,\n isFetchError,\n} from '@grafana/runtime';\n\nexport async function getPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n if (typeof stableGetPluginSettings === 'function') {\n return stableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);\n}\n\nasync function backwardsCompatibleGetPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n return getBackendSrv().get(`/api/plugins/${pluginId}/settings`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n });\n}\n\nexport async function updateAppPluginSettings(pluginId: string, data: Partial<PluginMeta>): Promise<PluginMeta> {\n if (typeof stableUpdateAppPluginSettings === 'function') {\n return stableUpdateAppPluginSettings(pluginId, data);\n }\n\n return backwardsCompatibleUpdatePluginSettings(pluginId, data);\n}\n\nasync function backwardsCompatibleUpdatePluginSettings(\n pluginId: string,\n data: Partial<PluginMeta>\n): Promise<PluginMeta> {\n await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });\n return backwardsCompatibleGetPluginSettings(pluginId);\n}\n\nexport async function getAppPluginHealth(\n pluginId: string,\n showErrorAlert = false,\n apiVersion?: string\n): Promise<HealthCheckResult | undefined> {\n if (typeof stableGetAppPluginHealth === 'function') {\n return stableGetAppPluginHealth(pluginId, showErrorAlert, apiVersion);\n }\n\n return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);\n}\n\nfunction isLegacyUnhealthyHealthCheckError(err: unknown): boolean {\n return (\n isFetchError<HealthCheckResult>(err) &&\n err.status === 400 &&\n (err.data?.status === HealthStatus.Error || err.data?.status === HealthStatus.Unknown)\n );\n}\n\nasync function backwardsCompatibleGetAppPluginHealth(\n pluginId: string,\n showErrorAlert = false\n): Promise<HealthCheckResult> {\n return getBackendSrv()\n .get<HealthCheckResult>(`/api/plugins/${pluginId}/health`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n })\n .catch((err) => {\n if (isFetchError(err) && (err.status === 401 || err.status === 403)) {\n err.isHandled = true;\n return Promise.reject(err);\n }\n\n if (isLegacyUnhealthyHealthCheckError(err)) {\n return err.data;\n }\n\n return Promise.reject(err);\n });\n}\n"],"names":["stableGetPluginSettings","getBackendSrv","stableUpdateAppPluginSettings","stableGetAppPluginHealth","isFetchError","HealthStatus"],"mappings":";;;;;;;AAWA,eAAsB,iBAAA,CAAkB,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACrG,EAAA,IAAI,OAAOA,8BAA4B,UAAA,EAAY;AACjD,IAAA,OAAOA,yBAAA,CAAwB,UAAU,cAAc,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,oCAAA,CAAqC,UAAU,cAAc,CAAA;AACtE;AAEA,eAAe,oCAAA,CAAqC,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACjH,EAAA,OAAOC,uBAAc,CAAE,GAAA,CAAI,gBAAgB,QAAQ,CAAA,SAAA,CAAA,EAAa,QAAW,KAAA,CAAA,EAAW;AAAA,IACpF,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA;AACH;AAEA,eAAsB,uBAAA,CAAwB,UAAkB,IAAA,EAAgD;AAC9G,EAAA,IAAI,OAAOC,oCAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,+BAAA,CAA8B,UAAU,IAAI,CAAA;AAAA,EACrD;AAEA,EAAA,OAAO,uCAAA,CAAwC,UAAU,IAAI,CAAA;AAC/D;AAEA,eAAe,uCAAA,CACb,UACA,IAAA,EACqB;AACrB,EAAA,MAAMD,qBAAA,EAAc,CAAE,IAAA,CAAK,CAAA,aAAA,EAAgB,QAAQ,aAAa,IAAA,EAAM,EAAE,YAAA,EAAc,IAAA,EAAM,CAAA;AAC5F,EAAA,OAAO,qCAAqC,QAAQ,CAAA;AACtD;AAEA,eAAsB,kBAAA,CACpB,QAAA,EACA,cAAA,GAAiB,KAAA,EACjB,UAAA,EACwC;AACxC,EAAA,IAAI,OAAOE,+BAA6B,UAAA,EAAY;AAClD,IAAA,OAAOA,0BAAA,CAAyB,QAAA,EAAU,cAAA,EAAgB,UAAU,CAAA;AAAA,EACtE;AAEA,EAAA,OAAO,qCAAA,CAAsC,UAAU,cAAc,CAAA;AACvE;AAEA,SAAS,kCAAkC,GAAA,EAAuB;AAtDlE,EAAA,IAAA,EAAA,EAAA,EAAA;AAuDE,EAAA,OACEC,qBAAgC,GAAG,CAAA,IACnC,GAAA,CAAI,MAAA,KAAW,UACd,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,MAAA,MAAWC,qBAAa,KAAA,IAAA,CAAA,CAAS,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,YAAWA,oBAAA,CAAa,OAAA,CAAA;AAElF;AAEA,eAAe,qCAAA,CACb,QAAA,EACA,cAAA,GAAiB,KAAA,EACW;AAC5B,EAAA,OAAOJ,uBAAc,CAClB,GAAA,CAAuB,gBAAgB,QAAQ,CAAA,OAAA,CAAA,EAAW,QAAW,KAAA,CAAA,EAAW;AAAA,IAC/E,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA,CACA,KAAA,CAAM,CAAC,GAAA,KAAQ;AACd,IAAA,IAAIG,oBAAA,CAAa,GAAG,CAAA,KAAM,GAAA,CAAI,WAAW,GAAA,IAAO,GAAA,CAAI,WAAW,GAAA,CAAA,EAAM;AACnE,MAAA,GAAA,CAAI,SAAA,GAAY,IAAA;AAChB,MAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,IAC3B;AAEA,IAAA,IAAI,iCAAA,CAAkC,GAAG,CAAA,EAAG;AAC1C,MAAA,OAAO,GAAA,CAAI,IAAA;AAAA,IACb;AAEA,IAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,EAC3B,CAAC,CAAA;AACL;;;;;;"}
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  async function getDataSourceInstance(ref, scopedVars) {
10
9
  if (typeof runtime.getDataSourceInstance === "function") {
11
10
  return runtime.getDataSourceInstance(ref, scopedVars);
12
11
  }
13
- if (typeof unstable.getDataSourceInstance === "function") {
14
- return unstable.getDataSourceInstance(ref, scopedVars);
15
- }
16
12
  return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);
17
13
  }
18
14
  async function backwardsCompatibleGetDataSourceInstance(ref, scopedVars) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstance.cjs","sources":["../../../src/datasources/getDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceApi, type ScopedVars } from '@grafana/data';\nimport { getDataSourceSrv, getDataSourceInstance as stableGetDataSourceInstance } from '@grafana/runtime';\nimport { getDataSourceInstance as unstableGetDataSourceInstance } from '@grafana/runtime/unstable';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n if (typeof stableGetDataSourceInstance === 'function') {\n return stableGetDataSourceInstance(ref, scopedVars);\n }\n\n if (typeof unstableGetDataSourceInstance === 'function') {\n return unstableGetDataSourceInstance(ref, scopedVars);\n }\n\n return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);\n}\n\nasync function backwardsCompatibleGetDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n return getDataSourceSrv().get(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstance","unstableGetDataSourceInstance","getDataSourceSrv"],"mappings":";;;;;;;;AAOA,eAAsB,qBAAA,CAAsB,KAAW,UAAA,EAAiD;AACtG,EAAA,IAAI,OAAOA,kCAAgC,UAAA,EAAY;AACrD,IAAA,OAAOA,6BAAA,CAA4B,KAAK,UAAU,CAAA;AAAA,EACpD;AAEA,EAAA,IAAI,OAAOC,mCAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,8BAAA,CAA8B,KAAK,UAAU,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,wCAAA,CAAyC,KAAK,UAAU,CAAA;AACjE;AAEA,eAAe,wCAAA,CAAyC,KAAW,UAAA,EAAiD;AAClH,EAAA,OAAOC,wBAAA,EAAiB,CAAE,GAAA,CAAI,GAAA,EAAK,UAAU,CAAA;AAC/C;;;;"}
1
+ {"version":3,"file":"getDataSourceInstance.cjs","sources":["../../../src/datasources/getDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceApi, type ScopedVars } from '@grafana/data';\nimport { getDataSourceSrv, getDataSourceInstance as stableGetDataSourceInstance } from '@grafana/runtime';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n if (typeof stableGetDataSourceInstance === 'function') {\n return stableGetDataSourceInstance(ref, scopedVars);\n }\n\n return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);\n}\n\nasync function backwardsCompatibleGetDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n return getDataSourceSrv().get(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstance","getDataSourceSrv"],"mappings":";;;;;;;AAMA,eAAsB,qBAAA,CAAsB,KAAW,UAAA,EAAiD;AACtG,EAAA,IAAI,OAAOA,kCAAgC,UAAA,EAAY;AACrD,IAAA,OAAOA,6BAAA,CAA4B,KAAK,UAAU,CAAA;AAAA,EACpD;AAEA,EAAA,OAAO,wCAAA,CAAyC,KAAK,UAAU,CAAA;AACjE;AAEA,eAAe,wCAAA,CAAyC,KAAW,UAAA,EAAiD;AAClH,EAAA,OAAOC,wBAAA,EAAiB,CAAE,GAAA,CAAI,GAAA,EAAK,UAAU,CAAA;AAC/C;;;;"}
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  async function getDataSourceInstanceList(filters) {
10
9
  if (typeof runtime.getDataSourceInstanceList === "function") {
11
10
  return runtime.getDataSourceInstanceList(filters);
12
11
  }
13
- if (typeof unstable.getDataSourceInstanceList === "function") {
14
- return unstable.getDataSourceInstanceList(filters);
15
- }
16
12
  return backwardsCompatibleGetDataSourceInstanceList(filters);
17
13
  }
18
14
  async function backwardsCompatibleGetDataSourceInstanceList(filters) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstanceList.cjs","sources":["../../../src/datasources/getDataSourceInstanceList.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n type GetDataSourceListFilters,\n getDataSourceSrv,\n getDataSourceInstanceList as stableGetDataSourceInstanceList,\n} from '@grafana/runtime';\nimport { getDataSourceInstanceList as unstableGetDataSourceInstanceList } from '@grafana/runtime/unstable';\n\nimport { type GetDataSourceInstanceListFilters } from './types';\n\nexport async function getDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n if (typeof stableGetDataSourceInstanceList === 'function') {\n return stableGetDataSourceInstanceList(filters);\n }\n\n if (typeof unstableGetDataSourceInstanceList === 'function') {\n return unstableGetDataSourceInstanceList(filters);\n }\n\n return backwardsCompatibleGetDataSourceInstanceList(filters);\n}\n\nasync function backwardsCompatibleGetDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n const { filter, ...rest } = filters ?? {};\n const legacyFilters: GetDataSourceListFilters = filter\n ? { ...rest, filter: (item) => filter(toDataSourceInstanceListItem(item)) }\n : { ...rest };\n\n return getDataSourceSrv().getList(legacyFilters).map(toDataSourceInstanceListItem);\n}\n\nfunction toDataSourceInstanceListItem(item: DataSourceInstanceSettings): DataSourceInstanceListItem {\n return {\n meta: { ...item.meta },\n name: item.name,\n type: item.type,\n uid: item.uid,\n };\n}\n"],"names":["stableGetDataSourceInstanceList","unstableGetDataSourceInstanceList","getDataSourceSrv"],"mappings":";;;;;;;;AAWA,eAAsB,0BACpB,OAAA,EACuC;AACvC,EAAA,IAAI,OAAOA,sCAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,kCAAgC,OAAO,CAAA;AAAA,EAChD;AAEA,EAAA,IAAI,OAAOC,uCAAsC,UAAA,EAAY;AAC3D,IAAA,OAAOA,mCAAkC,OAAO,CAAA;AAAA,EAClD;AAEA,EAAA,OAAO,6CAA6C,OAAO,CAAA;AAC7D;AAEA,eAAe,6CACb,OAAA,EACuC;AACvC,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AACxC,EAAA,MAAM,gBAA0C,MAAA,GAC5C,EAAE,GAAG,IAAA,EAAM,QAAQ,CAAC,IAAA,KAAS,MAAA,CAAO,4BAAA,CAA6B,IAAI,CAAC,CAAA,EAAE,GACxE,EAAE,GAAG,IAAA,EAAK;AAEd,EAAA,OAAOC,0BAAiB,CAAE,OAAA,CAAQ,aAAa,CAAA,CAAE,IAAI,4BAA4B,CAAA;AACnF;AAEA,SAAS,6BAA6B,IAAA,EAA8D;AAClG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,GAAG,IAAA,CAAK,IAAA,EAAK;AAAA,IACrB,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,KAAK,IAAA,CAAK;AAAA,GACZ;AACF;;;;"}
1
+ {"version":3,"file":"getDataSourceInstanceList.cjs","sources":["../../../src/datasources/getDataSourceInstanceList.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n type GetDataSourceListFilters,\n getDataSourceSrv,\n getDataSourceInstanceList as stableGetDataSourceInstanceList,\n} from '@grafana/runtime';\n\nimport { type GetDataSourceInstanceListFilters } from './types';\n\nexport async function getDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n if (typeof stableGetDataSourceInstanceList === 'function') {\n return stableGetDataSourceInstanceList(filters);\n }\n\n return backwardsCompatibleGetDataSourceInstanceList(filters);\n}\n\nasync function backwardsCompatibleGetDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n const { filter, ...rest } = filters ?? {};\n const legacyFilters: GetDataSourceListFilters = filter\n ? { ...rest, filter: (item) => filter(toDataSourceInstanceListItem(item)) }\n : { ...rest };\n\n return getDataSourceSrv().getList(legacyFilters).map(toDataSourceInstanceListItem);\n}\n\nfunction toDataSourceInstanceListItem(item: DataSourceInstanceSettings): DataSourceInstanceListItem {\n return {\n meta: { ...item.meta },\n name: item.name,\n type: item.type,\n uid: item.uid,\n };\n}\n"],"names":["stableGetDataSourceInstanceList","getDataSourceSrv"],"mappings":";;;;;;;AAUA,eAAsB,0BACpB,OAAA,EACuC;AACvC,EAAA,IAAI,OAAOA,sCAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,kCAAgC,OAAO,CAAA;AAAA,EAChD;AAEA,EAAA,OAAO,6CAA6C,OAAO,CAAA;AAC7D;AAEA,eAAe,6CACb,OAAA,EACuC;AACvC,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AACxC,EAAA,MAAM,gBAA0C,MAAA,GAC5C,EAAE,GAAG,IAAA,EAAM,QAAQ,CAAC,IAAA,KAAS,MAAA,CAAO,4BAAA,CAA6B,IAAI,CAAC,CAAA,EAAE,GACxE,EAAE,GAAG,IAAA,EAAK;AAEd,EAAA,OAAOC,0BAAiB,CAAE,OAAA,CAAQ,aAAa,CAAA,CAAE,IAAI,4BAA4B,CAAA;AACnF;AAEA,SAAS,6BAA6B,IAAA,EAA8D;AAClG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,GAAG,IAAA,CAAK,IAAA,EAAK;AAAA,IACrB,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,KAAK,IAAA,CAAK;AAAA,GACZ;AACF;;;;"}
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  async function getDataSourceInstanceSettings(ref, scopedVars) {
10
9
  if (typeof runtime.getDataSourceInstanceSettings === "function") {
11
10
  return runtime.getDataSourceInstanceSettings(ref, scopedVars);
12
11
  }
13
- if (typeof unstable.getDataSourceInstanceSettings === "function") {
14
- return unstable.getDataSourceInstanceSettings(ref, scopedVars);
15
- }
16
12
  return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);
17
13
  }
18
14
  async function backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstanceSettings.cjs","sources":["../../../src/datasources/getDataSourceInstanceSettings.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type ScopedVars, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDataSourceInstanceSettings as stableGetDataSourceInstanceSettings,\n} from '@grafana/runtime';\nimport { getDataSourceInstanceSettings as unstableGetDataSourceInstanceSettings } from '@grafana/runtime/unstable';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n if (typeof stableGetDataSourceInstanceSettings === 'function') {\n return stableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n if (typeof unstableGetDataSourceInstanceSettings === 'function') {\n return unstableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);\n}\n\nasync function backwardsCompatibleDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n return getDataSourceSrv().getInstanceSettings(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstanceSettings","unstableGetDataSourceInstanceSettings","getDataSourceSrv"],"mappings":";;;;;;;;AAUA,eAAsB,6BAAA,CACpB,KACA,UAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,0CAAwC,UAAA,EAAY;AAC7D,IAAA,OAAOA,qCAAA,CAAoC,KAAK,UAAU,CAAA;AAAA,EAC5D;AAEA,EAAA,IAAI,OAAOC,2CAA0C,UAAA,EAAY;AAC/D,IAAA,OAAOA,sCAAA,CAAsC,KAAK,UAAU,CAAA;AAAA,EAC9D;AAEA,EAAA,OAAO,6CAAA,CAA8C,KAAK,UAAU,CAAA;AACtE;AAEA,eAAe,6CAAA,CACb,KACA,UAAA,EACiD;AACjD,EAAA,OAAOC,wBAAA,EAAiB,CAAE,mBAAA,CAAoB,GAAA,EAAK,UAAU,CAAA;AAC/D;;;;"}
1
+ {"version":3,"file":"getDataSourceInstanceSettings.cjs","sources":["../../../src/datasources/getDataSourceInstanceSettings.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type ScopedVars, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDataSourceInstanceSettings as stableGetDataSourceInstanceSettings,\n} from '@grafana/runtime';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n if (typeof stableGetDataSourceInstanceSettings === 'function') {\n return stableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);\n}\n\nasync function backwardsCompatibleDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n return getDataSourceSrv().getInstanceSettings(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstanceSettings","getDataSourceSrv"],"mappings":";;;;;;;AASA,eAAsB,6BAAA,CACpB,KACA,UAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,0CAAwC,UAAA,EAAY;AAC7D,IAAA,OAAOA,qCAAA,CAAoC,KAAK,UAAU,CAAA;AAAA,EAC5D;AAEA,EAAA,OAAO,6CAAA,CAA8C,KAAK,UAAU,CAAA;AACtE;AAEA,eAAe,6CAAA,CACb,KACA,UAAA,EACiD;AACjD,EAAA,OAAOC,wBAAA,EAAiB,CAAE,mBAAA,CAAoB,GAAA,EAAK,UAAU,CAAA;AAC/D;;;;"}
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  async function getDefaultDataSourceInstanceListItem(items) {
10
9
  if (typeof runtime.getDefaultDataSourceInstanceListItem === "function") {
11
10
  return runtime.getDefaultDataSourceInstanceListItem(items);
12
11
  }
13
- if (typeof unstable.getDefaultDataSourceInstanceListItem === "function") {
14
- return unstable.getDefaultDataSourceInstanceListItem(items);
15
- }
16
12
  return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);
17
13
  }
18
14
  function backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultDataSourceInstanceListItem.cjs","sources":["../../../src/datasources/getDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDefaultDataSourceInstanceListItem as stableGetDefaultDataSourceInstanceListItem,\n} from '@grafana/runtime';\nimport { getDefaultDataSourceInstanceListItem as unstableGetDefaultDataSourceInstanceListItem } from '@grafana/runtime/unstable';\n\n/**\n * Resolve the item whose data source is the org default, or `undefined` when the list holds none.\n *\n * At most one instance per org carries the flag, so a filtered list need not contain it.\n */\nexport async function getDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): Promise<DataSourceInstanceListItem | undefined> {\n if (typeof stableGetDefaultDataSourceInstanceListItem === 'function') {\n return stableGetDefaultDataSourceInstanceListItem(items);\n }\n\n if (typeof unstableGetDefaultDataSourceInstanceListItem === 'function') {\n return unstableGetDefaultDataSourceInstanceListItem(items);\n }\n\n return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);\n}\n\nexport function backwardsCompatibleGetDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): DataSourceInstanceListItem | undefined {\n return items.find((item) => item && getDataSourceSrv().getInstanceSettings(item.uid)?.isDefault);\n}\n"],"names":["stableGetDefaultDataSourceInstanceListItem","unstableGetDefaultDataSourceInstanceListItem"],"mappings":";;;;;;;;AAaA,eAAsB,qCACpB,KAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,iDAA+C,UAAA,EAAY;AACpE,IAAA,OAAOA,6CAA2C,KAAK,CAAA;AAAA,EACzD;AAEA,EAAA,IAAI,OAAOC,kDAAiD,UAAA,EAAY;AACtE,IAAA,OAAOA,8CAA6C,KAAK,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,wDAAwD,KAAK,CAAA;AACtE;AAEO,SAAS,wDACd,KAAA,EACwC;AACxC,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,IAAA,KAAM;AA9B3B,IAAA,IAAA,EAAA;AA8B8B,IAAA,OAAA,IAAA,KAAA,CAAQ,+BAAiB,CAAE,mBAAA,CAAoB,IAAA,CAAK,GAAG,MAA/C,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkD,SAAA,CAAA;AAAA,EAAA,CAAS,CAAA;AACjG;;;;;"}
1
+ {"version":3,"file":"getDefaultDataSourceInstanceListItem.cjs","sources":["../../../src/datasources/getDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDefaultDataSourceInstanceListItem as stableGetDefaultDataSourceInstanceListItem,\n} from '@grafana/runtime';\n\n/**\n * Resolve the item whose data source is the org default, or `undefined` when the list holds none.\n *\n * At most one instance per org carries the flag, so a filtered list need not contain it.\n */\nexport async function getDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): Promise<DataSourceInstanceListItem | undefined> {\n if (typeof stableGetDefaultDataSourceInstanceListItem === 'function') {\n return stableGetDefaultDataSourceInstanceListItem(items);\n }\n\n return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);\n}\n\nexport function backwardsCompatibleGetDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): DataSourceInstanceListItem | undefined {\n return items.find((item) => item && getDataSourceSrv().getInstanceSettings(item.uid)?.isDefault);\n}\n"],"names":["stableGetDefaultDataSourceInstanceListItem"],"mappings":";;;;;;;AAYA,eAAsB,qCACpB,KAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,iDAA+C,UAAA,EAAY;AACpE,IAAA,OAAOA,6CAA2C,KAAK,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,wDAAwD,KAAK,CAAA;AACtE;AAEO,SAAS,wDACd,KAAA,EACwC;AACxC,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,IAAA,KAAM;AAzB3B,IAAA,IAAA,EAAA;AAyB8B,IAAA,OAAA,IAAA,KAAA,CAAQ,+BAAiB,CAAE,mBAAA,CAAoB,IAAA,CAAK,GAAG,MAA/C,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkD,SAAA,CAAA;AAAA,EAAA,CAAS,CAAA;AACjG;;;;;"}
@@ -3,16 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
 
8
7
  "use strict";
9
8
  function registerRuntimeDataSourceInstance(entry) {
10
9
  if (typeof runtime.registerRuntimeDataSourceInstance === "function") {
11
10
  return runtime.registerRuntimeDataSourceInstance(entry);
12
11
  }
13
- if (typeof unstable.registerRuntimeDataSourceInstance === "function") {
14
- return unstable.registerRuntimeDataSourceInstance(entry);
15
- }
16
12
  return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);
17
13
  }
18
14
  function backwardsCompatibleRegisterRuntimeDataSourceInstance(entry) {
@@ -1 +1 @@
1
- {"version":3,"file":"registerRuntimeDataSourceInstance.cjs","sources":["../../../src/datasources/registerRuntimeDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport {\n getDataSourceSrv,\n type RuntimeDataSourceRegistration,\n registerRuntimeDataSourceInstance as stableRegisterRuntimeDataSourceInstance,\n} from '@grafana/runtime';\nimport { registerRuntimeDataSourceInstance as unstableRegisterRuntimeDataSourceInstance } from '@grafana/runtime/unstable';\n\nexport function registerRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n if (typeof stableRegisterRuntimeDataSourceInstance === 'function') {\n return stableRegisterRuntimeDataSourceInstance(entry);\n }\n\n if (typeof unstableRegisterRuntimeDataSourceInstance === 'function') {\n return unstableRegisterRuntimeDataSourceInstance(entry);\n }\n\n return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);\n}\n\nfunction backwardsCompatibleRegisterRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n return getDataSourceSrv().registerRuntimeDataSource(entry);\n}\n"],"names":["stableRegisterRuntimeDataSourceInstance","unstableRegisterRuntimeDataSourceInstance","getDataSourceSrv"],"mappings":";;;;;;;;AAQO,SAAS,kCAAkC,KAAA,EAA4C;AAC5F,EAAA,IAAI,OAAOA,8CAA4C,UAAA,EAAY;AACjE,IAAA,OAAOA,0CAAwC,KAAK,CAAA;AAAA,EACtD;AAEA,EAAA,IAAI,OAAOC,+CAA8C,UAAA,EAAY;AACnE,IAAA,OAAOA,2CAA0C,KAAK,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,qDAAqD,KAAK,CAAA;AACnE;AAEA,SAAS,qDAAqD,KAAA,EAA4C;AACxG,EAAA,OAAOC,wBAAA,EAAiB,CAAE,yBAAA,CAA0B,KAAK,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"registerRuntimeDataSourceInstance.cjs","sources":["../../../src/datasources/registerRuntimeDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport {\n getDataSourceSrv,\n type RuntimeDataSourceRegistration,\n registerRuntimeDataSourceInstance as stableRegisterRuntimeDataSourceInstance,\n} from '@grafana/runtime';\n\nexport function registerRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n if (typeof stableRegisterRuntimeDataSourceInstance === 'function') {\n return stableRegisterRuntimeDataSourceInstance(entry);\n }\n\n return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);\n}\n\nfunction backwardsCompatibleRegisterRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n return getDataSourceSrv().registerRuntimeDataSource(entry);\n}\n"],"names":["stableRegisterRuntimeDataSourceInstance","getDataSourceSrv"],"mappings":";;;;;;;AAOO,SAAS,kCAAkC,KAAA,EAA4C;AAC5F,EAAA,IAAI,OAAOA,8CAA4C,UAAA,EAAY;AACjE,IAAA,OAAOA,0CAAwC,KAAK,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,qDAAqD,KAAK,CAAA;AACnE;AAEA,SAAS,qDAAqD,KAAA,EAA4C;AACxG,EAAA,OAAOC,wBAAA,EAAiB,CAAE,yBAAA,CAA0B,KAAK,CAAA;AAC3D;;;;"}
@@ -4,11 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  var runtime = require('@grafana/runtime');
7
- var unstable = require('@grafana/runtime/unstable');
8
7
  var getDataSourceInstance = require('./getDataSourceInstance.cjs');
9
8
 
10
9
  "use strict";
11
- const useDataSourceInstance = typeof runtime.useDataSourceInstance === "function" ? runtime.useDataSourceInstance : typeof unstable.useDataSourceInstance === "function" ? unstable.useDataSourceInstance : useBackwardsCompatibleDataSourceInstance;
10
+ const useDataSourceInstance = typeof runtime.useDataSourceInstance === "function" ? runtime.useDataSourceInstance : useBackwardsCompatibleDataSourceInstance;
12
11
  function useBackwardsCompatibleDataSourceInstance(ref) {
13
12
  const [result, setResult] = react.useState({ isLoading: true });
14
13
  const refKey = JSON.stringify(ref != null ? ref : null);
@@ -1 +1 @@
1
- {"version":3,"file":"useDataSourceInstance.cjs","sources":["../../../src/datasources/useDataSourceInstance.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { type DataSourceApi } from '@grafana/data';\nimport { useDataSourceInstance as stableUseDataSourceInstance } from '@grafana/runtime';\nimport { useDataSourceInstance as unstableUseDataSourceInstance } from '@grafana/runtime/unstable';\n\nimport { getDataSourceInstance } from './getDataSourceInstance';\nimport { type Ref } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceResult {\n isLoading: boolean;\n error?: Error;\n dataSource?: DataSourceApi;\n}\n\n/**\n * Uses the host hook when available. The fallback re-resolves only when `ref` changes, not on data source cache\n * changes. Picked once at load so the hook order stays stable.\n */\nexport const useDataSourceInstance: (ref?: Ref) => UseDataSourceInstanceResult =\n typeof stableUseDataSourceInstance === 'function'\n ? stableUseDataSourceInstance\n : typeof unstableUseDataSourceInstance === 'function'\n ? unstableUseDataSourceInstance\n : useBackwardsCompatibleDataSourceInstance;\n\nfunction useBackwardsCompatibleDataSourceInstance(ref?: Ref): UseDataSourceInstanceResult {\n const [result, setResult] = useState<UseDataSourceInstanceResult>({ isLoading: true });\n // Same key as the host hook, so inline ref objects don't refetch and `null` matches `undefined`.\n const refKey = JSON.stringify(ref ?? null);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstance(ref).then(\n (dataSource) => isCurrent && setResult({ isLoading: false, dataSource }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstance","unstableUseDataSourceInstance","useState","useEffect","getDataSourceInstance"],"mappings":";;;;;;;;;;AAoBO,MAAM,qBAAA,GACX,OAAOA,6BAAA,KAAgC,UAAA,GACnCA,gCACA,OAAOC,8BAAA,KAAkC,aACvCA,8BAAA,GACA;AAER,SAAS,yCAAyC,GAAA,EAAwC;AACxF,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAIC,eAAsC,EAAE,SAAA,EAAW,MAAM,CAAA;AAErF,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,SAAA,CAAU,GAAA,IAAA,IAAA,GAAA,GAAA,GAAO,IAAI,CAAA;AAEzC,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAAC,2CAAA,CAAsB,GAAG,CAAA,CAAE,IAAA;AAAA,MACzB,CAAC,eAAe,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AAAA,MACvE,CAAC,UAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO;AAAA,KACtE;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"useDataSourceInstance.cjs","sources":["../../../src/datasources/useDataSourceInstance.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { type DataSourceApi } from '@grafana/data';\nimport { useDataSourceInstance as stableUseDataSourceInstance } from '@grafana/runtime';\n\nimport { getDataSourceInstance } from './getDataSourceInstance';\nimport { type Ref } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceResult {\n isLoading: boolean;\n error?: Error;\n dataSource?: DataSourceApi;\n}\n\n/**\n * Uses the host hook when available. The fallback re-resolves only when `ref` changes, not on data source cache\n * changes. Picked once at load so the hook order stays stable.\n */\nexport const useDataSourceInstance: (ref?: Ref) => UseDataSourceInstanceResult =\n typeof stableUseDataSourceInstance === 'function'\n ? stableUseDataSourceInstance\n : useBackwardsCompatibleDataSourceInstance;\n\nfunction useBackwardsCompatibleDataSourceInstance(ref?: Ref): UseDataSourceInstanceResult {\n const [result, setResult] = useState<UseDataSourceInstanceResult>({ isLoading: true });\n // Same key as the host hook, so inline ref objects don't refetch and `null` matches `undefined`.\n const refKey = JSON.stringify(ref ?? null);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstance(ref).then(\n (dataSource) => isCurrent && setResult({ isLoading: false, dataSource }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstance","useState","useEffect","getDataSourceInstance"],"mappings":";;;;;;;;;AAmBO,MAAM,qBAAA,GACX,OAAOA,6BAAA,KAAgC,UAAA,GACnCA,6BAAA,GACA;AAEN,SAAS,yCAAyC,GAAA,EAAwC;AACxF,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAIC,eAAsC,EAAE,SAAA,EAAW,MAAM,CAAA;AAErF,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,SAAA,CAAU,GAAA,IAAA,IAAA,GAAA,GAAA,GAAO,IAAI,CAAA;AAEzC,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAAC,2CAAA,CAAsB,GAAG,CAAA,CAAE,IAAA;AAAA,MACzB,CAAC,eAAe,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AAAA,MACvE,CAAC,UAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO;AAAA,KACtE;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -4,11 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  var runtime = require('@grafana/runtime');
7
- var unstable = require('@grafana/runtime/unstable');
8
7
  var getDataSourceInstanceList = require('./getDataSourceInstanceList.cjs');
9
8
 
10
9
  "use strict";
11
- const useDataSourceInstanceList = typeof runtime.useDataSourceInstanceList === "function" ? runtime.useDataSourceInstanceList : typeof unstable.useDataSourceInstanceList === "function" ? unstable.useDataSourceInstanceList : useBackwardsCompatibleDataSourceInstanceList;
10
+ const useDataSourceInstanceList = typeof runtime.useDataSourceInstanceList === "function" ? runtime.useDataSourceInstanceList : useBackwardsCompatibleDataSourceInstanceList;
12
11
  function useBackwardsCompatibleDataSourceInstanceList(filters) {
13
12
  const emptyItems = react.useMemo(() => [], []);
14
13
  const [result, setResult] = react.useState({ isLoading: true, items: emptyItems });
@@ -1 +1 @@
1
- {"version":3,"file":"useDataSourceInstanceList.cjs","sources":["../../../src/datasources/useDataSourceInstanceList.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDataSourceInstanceList as stableUseDataSourceInstanceList } from '@grafana/runtime';\nimport { useDataSourceInstanceList as unstableUseDataSourceInstanceList } from '@grafana/runtime/unstable';\n\nimport { getDataSourceInstanceList } from './getDataSourceInstanceList';\nimport { type GetDataSourceInstanceListFilters } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceListResult {\n isLoading: boolean;\n error?: Error;\n items: DataSourceInstanceListItem[];\n}\n\n/**\n * Uses the host hook when available. The fallback re-fetches only when `filters` changes by value or the\n * `filter` function reference changes, not on data source cache changes. Picked once at load so the hook\n * order stays stable.\n */\nexport const useDataSourceInstanceList: (\n filters?: GetDataSourceInstanceListFilters\n) => UseDataSourceInstanceListResult =\n typeof stableUseDataSourceInstanceList === 'function'\n ? stableUseDataSourceInstanceList\n : typeof unstableUseDataSourceInstanceList === 'function'\n ? unstableUseDataSourceInstanceList\n : useBackwardsCompatibleDataSourceInstanceList;\n\nfunction useBackwardsCompatibleDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): UseDataSourceInstanceListResult {\n // One empty array per hook instance, like the host hook, so callers can rely on its identity.\n const emptyItems = useMemo<DataSourceInstanceListItem[]>(() => [], []);\n const [result, setResult] = useState<UseDataSourceInstanceListResult>({ isLoading: true, items: emptyItems });\n const { filter, ...rest } = filters ?? {};\n // Same key as the host hook, so equal inline filters don't refetch. The `filter` function is compared by reference.\n const filtersKey = JSON.stringify(rest);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstanceList(filters).then(\n (items) => isCurrent && setResult({ isLoading: false, items }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error, items: emptyItems })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filtersKey, filter]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstanceList","unstableUseDataSourceInstanceList","useMemo","useState","useEffect","getDataSourceInstanceList"],"mappings":";;;;;;;;;;AAqBO,MAAM,yBAAA,GAGX,OAAOA,iCAAA,KAAoC,UAAA,GACvCA,oCACA,OAAOC,kCAAA,KAAsC,aAC3CA,kCAAA,GACA;AAER,SAAS,6CACP,OAAA,EACiC;AAEjC,EAAA,MAAM,aAAaC,aAAA,CAAsC,MAAM,EAAC,EAAG,EAAE,CAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIC,cAAA,CAA0C,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5G,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AAExC,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAEtC,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAAC,mDAAA,CAA0B,OAAO,CAAA,CAAE,IAAA;AAAA,MACjC,CAAC,UAAU,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO,CAAA;AAAA,MAC7D,CAAC,KAAA,KAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,WAAW,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY;AAAA,KACzF;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,UAAA,EAAY,MAAM,CAAC,CAAA;AAEvB,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"useDataSourceInstanceList.cjs","sources":["../../../src/datasources/useDataSourceInstanceList.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDataSourceInstanceList as stableUseDataSourceInstanceList } from '@grafana/runtime';\n\nimport { getDataSourceInstanceList } from './getDataSourceInstanceList';\nimport { type GetDataSourceInstanceListFilters } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceListResult {\n isLoading: boolean;\n error?: Error;\n items: DataSourceInstanceListItem[];\n}\n\n/**\n * Uses the host hook when available. The fallback re-fetches only when `filters` changes by value or the\n * `filter` function reference changes, not on data source cache changes. Picked once at load so the hook\n * order stays stable.\n */\nexport const useDataSourceInstanceList: (\n filters?: GetDataSourceInstanceListFilters\n) => UseDataSourceInstanceListResult =\n typeof stableUseDataSourceInstanceList === 'function'\n ? stableUseDataSourceInstanceList\n : useBackwardsCompatibleDataSourceInstanceList;\n\nfunction useBackwardsCompatibleDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): UseDataSourceInstanceListResult {\n // One empty array per hook instance, like the host hook, so callers can rely on its identity.\n const emptyItems = useMemo<DataSourceInstanceListItem[]>(() => [], []);\n const [result, setResult] = useState<UseDataSourceInstanceListResult>({ isLoading: true, items: emptyItems });\n const { filter, ...rest } = filters ?? {};\n // Same key as the host hook, so equal inline filters don't refetch. The `filter` function is compared by reference.\n const filtersKey = JSON.stringify(rest);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstanceList(filters).then(\n (items) => isCurrent && setResult({ isLoading: false, items }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error, items: emptyItems })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filtersKey, filter]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstanceList","useMemo","useState","useEffect","getDataSourceInstanceList"],"mappings":";;;;;;;;;AAoBO,MAAM,yBAAA,GAGX,OAAOA,iCAAA,KAAoC,UAAA,GACvCA,iCAAA,GACA;AAEN,SAAS,6CACP,OAAA,EACiC;AAEjC,EAAA,MAAM,aAAaC,aAAA,CAAsC,MAAM,EAAC,EAAG,EAAE,CAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAIC,cAAA,CAA0C,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5G,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AAExC,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAEtC,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAAC,mDAAA,CAA0B,OAAO,CAAA,CAAE,IAAA;AAAA,MACjC,CAAC,UAAU,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO,CAAA;AAAA,MAC7D,CAAC,KAAA,KAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,WAAW,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY;AAAA,KACzF;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,UAAA,EAAY,MAAM,CAAC,CAAA;AAEvB,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -3,11 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var runtime = require('@grafana/runtime');
6
- var unstable = require('@grafana/runtime/unstable');
7
6
  var getDefaultDataSourceInstanceListItem = require('./getDefaultDataSourceInstanceListItem.cjs');
8
7
 
9
8
  "use strict";
10
- const useDefaultDataSourceInstanceListItem = typeof runtime.useDefaultDataSourceInstanceListItem === "function" ? runtime.useDefaultDataSourceInstanceListItem : typeof unstable.useDefaultDataSourceInstanceListItem === "function" ? unstable.useDefaultDataSourceInstanceListItem : useBackwardsCompatibleDefaultDataSourceInstanceListItem;
9
+ const useDefaultDataSourceInstanceListItem = typeof runtime.useDefaultDataSourceInstanceListItem === "function" ? runtime.useDefaultDataSourceInstanceListItem : useBackwardsCompatibleDefaultDataSourceInstanceListItem;
11
10
  function useBackwardsCompatibleDefaultDataSourceInstanceListItem(items) {
12
11
  return { isLoading: false, item: getDefaultDataSourceInstanceListItem.backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };
13
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useDefaultDataSourceInstanceListItem.cjs","sources":["../../../src/datasources/useDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["import { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDefaultDataSourceInstanceListItem as stableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime';\nimport { useDefaultDataSourceInstanceListItem as unstableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime/unstable';\n\nimport { backwardsCompatibleGetDefaultDataSourceInstanceListItem } from './getDefaultDataSourceInstanceListItem';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDefaultDataSourceInstanceListItemResult {\n isLoading: boolean;\n error?: Error;\n item?: DataSourceInstanceListItem;\n}\n\n/**\n * Uses the host hook when available, which also re-resolves on data source cache changes; otherwise\n * resolves synchronously on every render. Picked once at load so the hook order stays stable.\n */\nexport const useDefaultDataSourceInstanceListItem: (\n items: DataSourceInstanceListItem[]\n) => UseDefaultDataSourceInstanceListItemResult =\n typeof stableUseDefaultDataSourceInstanceListItem === 'function'\n ? stableUseDefaultDataSourceInstanceListItem\n : typeof unstableUseDefaultDataSourceInstanceListItem === 'function'\n ? unstableUseDefaultDataSourceInstanceListItem\n : useBackwardsCompatibleDefaultDataSourceInstanceListItem;\n\nfunction useBackwardsCompatibleDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): UseDefaultDataSourceInstanceListItemResult {\n return { isLoading: false, item: backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };\n}\n"],"names":["stableUseDefaultDataSourceInstanceListItem","unstableUseDefaultDataSourceInstanceListItem","backwardsCompatibleGetDefaultDataSourceInstanceListItem"],"mappings":";;;;;;;;;AAiBO,MAAM,oCAAA,GAGX,OAAOA,4CAAA,KAA+C,UAAA,GAClDA,+CACA,OAAOC,6CAAA,KAAiD,aACtDA,6CAAA,GACA;AAER,SAAS,wDACP,KAAA,EAC4C;AAC5C,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,IAAA,EAAMC,4FAAA,CAAwD,KAAK,CAAA,EAAE;AAClG;;;;"}
1
+ {"version":3,"file":"useDefaultDataSourceInstanceListItem.cjs","sources":["../../../src/datasources/useDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["import { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDefaultDataSourceInstanceListItem as stableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime';\n\nimport { backwardsCompatibleGetDefaultDataSourceInstanceListItem } from './getDefaultDataSourceInstanceListItem';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDefaultDataSourceInstanceListItemResult {\n isLoading: boolean;\n error?: Error;\n item?: DataSourceInstanceListItem;\n}\n\n/**\n * Uses the host hook when available, which also re-resolves on data source cache changes; otherwise\n * resolves synchronously on every render. Picked once at load so the hook order stays stable.\n */\nexport const useDefaultDataSourceInstanceListItem: (\n items: DataSourceInstanceListItem[]\n) => UseDefaultDataSourceInstanceListItemResult =\n typeof stableUseDefaultDataSourceInstanceListItem === 'function'\n ? stableUseDefaultDataSourceInstanceListItem\n : useBackwardsCompatibleDefaultDataSourceInstanceListItem;\n\nfunction useBackwardsCompatibleDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): UseDefaultDataSourceInstanceListItemResult {\n return { isLoading: false, item: backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };\n}\n"],"names":["stableUseDefaultDataSourceInstanceListItem","backwardsCompatibleGetDefaultDataSourceInstanceListItem"],"mappings":";;;;;;;;AAgBO,MAAM,oCAAA,GAGX,OAAOA,4CAAA,KAA+C,UAAA,GAClDA,4CAAA,GACA;AAEN,SAAS,wDACP,KAAA,EAC4C;AAC5C,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,IAAA,EAAMC,4FAAA,CAAwD,KAAK,CAAA,EAAE;AAClG;;;;"}
package/dist/esm/apps.mjs CHANGED
@@ -1,14 +1,10 @@
1
1
  import { getPluginSettings as getPluginSettings$1, getBackendSrv, updateAppPluginSettings as updateAppPluginSettings$1, getAppPluginHealth as getAppPluginHealth$1, isFetchError, HealthStatus } from '@grafana/runtime';
2
- import { getPluginSettings as getPluginSettings$2, updateAppPluginSettings as updateAppPluginSettings$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  async function getPluginSettings(pluginId, showErrorAlert = false) {
6
5
  if (typeof getPluginSettings$1 === "function") {
7
6
  return getPluginSettings$1(pluginId, showErrorAlert);
8
7
  }
9
- if (typeof getPluginSettings$2 === "function") {
10
- return getPluginSettings$2(pluginId, showErrorAlert);
11
- }
12
8
  return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);
13
9
  }
14
10
  async function backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert = false) {
@@ -21,9 +17,6 @@ async function updateAppPluginSettings(pluginId, data) {
21
17
  if (typeof updateAppPluginSettings$1 === "function") {
22
18
  return updateAppPluginSettings$1(pluginId, data);
23
19
  }
24
- if (typeof updateAppPluginSettings$2 === "function") {
25
- return updateAppPluginSettings$2(pluginId, data);
26
- }
27
20
  return backwardsCompatibleUpdatePluginSettings(pluginId, data);
28
21
  }
29
22
  async function backwardsCompatibleUpdatePluginSettings(pluginId, data) {
@@ -1 +1 @@
1
- {"version":3,"file":"apps.mjs","sources":["../../src/apps.ts"],"sourcesContent":["import { type PluginMeta } from '@grafana/data';\nimport {\n getBackendSrv,\n getPluginSettings as stableGetPluginSettings,\n getAppPluginHealth as stableGetAppPluginHealth,\n updateAppPluginSettings as stableUpdateAppPluginSettings,\n type HealthCheckResult,\n HealthStatus,\n isFetchError,\n} from '@grafana/runtime';\nimport {\n getPluginSettings as unstableGetPluginSettings,\n updateAppPluginSettings as unstableUpdateAppPluginSettings,\n} from '@grafana/runtime/unstable';\n\nexport async function getPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n if (typeof stableGetPluginSettings === 'function') {\n return stableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n if (typeof unstableGetPluginSettings === 'function') {\n return unstableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);\n}\n\nasync function backwardsCompatibleGetPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n return getBackendSrv().get(`/api/plugins/${pluginId}/settings`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n });\n}\n\nexport async function updateAppPluginSettings(pluginId: string, data: Partial<PluginMeta>): Promise<PluginMeta> {\n if (typeof stableUpdateAppPluginSettings === 'function') {\n return stableUpdateAppPluginSettings(pluginId, data);\n }\n\n if (typeof unstableUpdateAppPluginSettings === 'function') {\n return unstableUpdateAppPluginSettings(pluginId, data);\n }\n\n return backwardsCompatibleUpdatePluginSettings(pluginId, data);\n}\n\nasync function backwardsCompatibleUpdatePluginSettings(\n pluginId: string,\n data: Partial<PluginMeta>\n): Promise<PluginMeta> {\n await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });\n return backwardsCompatibleGetPluginSettings(pluginId);\n}\n\nexport async function getAppPluginHealth(\n pluginId: string,\n showErrorAlert = false,\n apiVersion?: string\n): Promise<HealthCheckResult | undefined> {\n if (typeof stableGetAppPluginHealth === 'function') {\n return stableGetAppPluginHealth(pluginId, showErrorAlert, apiVersion);\n }\n\n return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);\n}\n\nfunction isLegacyUnhealthyHealthCheckError(err: unknown): boolean {\n return (\n isFetchError<HealthCheckResult>(err) &&\n err.status === 400 &&\n (err.data?.status === HealthStatus.Error || err.data?.status === HealthStatus.Unknown)\n );\n}\n\nasync function backwardsCompatibleGetAppPluginHealth(\n pluginId: string,\n showErrorAlert = false\n): Promise<HealthCheckResult> {\n return getBackendSrv()\n .get<HealthCheckResult>(`/api/plugins/${pluginId}/health`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n })\n .catch((err) => {\n if (isFetchError(err) && (err.status === 401 || err.status === 403)) {\n err.isHandled = true;\n return Promise.reject(err);\n }\n\n if (isLegacyUnhealthyHealthCheckError(err)) {\n return err.data;\n }\n\n return Promise.reject(err);\n });\n}\n"],"names":["stableGetPluginSettings","unstableGetPluginSettings","stableUpdateAppPluginSettings","unstableUpdateAppPluginSettings","stableGetAppPluginHealth"],"mappings":";;;;AAeA,eAAsB,iBAAA,CAAkB,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACrG,EAAA,IAAI,OAAOA,wBAA4B,UAAA,EAAY;AACjD,IAAA,OAAOA,mBAAA,CAAwB,UAAU,cAAc,CAAA;AAAA,EACzD;AAEA,EAAA,IAAI,OAAOC,wBAA8B,UAAA,EAAY;AACnD,IAAA,OAAOA,mBAAA,CAA0B,UAAU,cAAc,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,oCAAA,CAAqC,UAAU,cAAc,CAAA;AACtE;AAEA,eAAe,oCAAA,CAAqC,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACjH,EAAA,OAAO,eAAc,CAAE,GAAA,CAAI,gBAAgB,QAAQ,CAAA,SAAA,CAAA,EAAa,QAAW,KAAA,CAAA,EAAW;AAAA,IACpF,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA;AACH;AAEA,eAAsB,uBAAA,CAAwB,UAAkB,IAAA,EAAgD;AAC9G,EAAA,IAAI,OAAOC,8BAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,yBAAA,CAA8B,UAAU,IAAI,CAAA;AAAA,EACrD;AAEA,EAAA,IAAI,OAAOC,8BAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,yBAAA,CAAgC,UAAU,IAAI,CAAA;AAAA,EACvD;AAEA,EAAA,OAAO,uCAAA,CAAwC,UAAU,IAAI,CAAA;AAC/D;AAEA,eAAe,uCAAA,CACb,UACA,IAAA,EACqB;AACrB,EAAA,MAAM,aAAA,EAAc,CAAE,IAAA,CAAK,CAAA,aAAA,EAAgB,QAAQ,aAAa,IAAA,EAAM,EAAE,YAAA,EAAc,IAAA,EAAM,CAAA;AAC5F,EAAA,OAAO,qCAAqC,QAAQ,CAAA;AACtD;AAEA,eAAsB,kBAAA,CACpB,QAAA,EACA,cAAA,GAAiB,KAAA,EACjB,UAAA,EACwC;AACxC,EAAA,IAAI,OAAOC,yBAA6B,UAAA,EAAY;AAClD,IAAA,OAAOA,oBAAA,CAAyB,QAAA,EAAU,cAAA,EAAgB,UAAU,CAAA;AAAA,EACtE;AAEA,EAAA,OAAO,qCAAA,CAAsC,UAAU,cAAc,CAAA;AACvE;AAEA,SAAS,kCAAkC,GAAA,EAAuB;AAlElE,EAAA,IAAA,EAAA,EAAA,EAAA;AAmEE,EAAA,OACE,aAAgC,GAAG,CAAA,IACnC,GAAA,CAAI,MAAA,KAAW,UACd,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,MAAA,MAAW,aAAa,KAAA,IAAA,CAAA,CAAS,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,YAAW,YAAA,CAAa,OAAA,CAAA;AAElF;AAEA,eAAe,qCAAA,CACb,QAAA,EACA,cAAA,GAAiB,KAAA,EACW;AAC5B,EAAA,OAAO,eAAc,CAClB,GAAA,CAAuB,gBAAgB,QAAQ,CAAA,OAAA,CAAA,EAAW,QAAW,KAAA,CAAA,EAAW;AAAA,IAC/E,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA,CACA,KAAA,CAAM,CAAC,GAAA,KAAQ;AACd,IAAA,IAAI,YAAA,CAAa,GAAG,CAAA,KAAM,GAAA,CAAI,WAAW,GAAA,IAAO,GAAA,CAAI,WAAW,GAAA,CAAA,EAAM;AACnE,MAAA,GAAA,CAAI,SAAA,GAAY,IAAA;AAChB,MAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,IAC3B;AAEA,IAAA,IAAI,iCAAA,CAAkC,GAAG,CAAA,EAAG;AAC1C,MAAA,OAAO,GAAA,CAAI,IAAA;AAAA,IACb;AAEA,IAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,EAC3B,CAAC,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"apps.mjs","sources":["../../src/apps.ts"],"sourcesContent":["import { type PluginMeta } from '@grafana/data';\nimport {\n getBackendSrv,\n getPluginSettings as stableGetPluginSettings,\n getAppPluginHealth as stableGetAppPluginHealth,\n updateAppPluginSettings as stableUpdateAppPluginSettings,\n type HealthCheckResult,\n HealthStatus,\n isFetchError,\n} from '@grafana/runtime';\n\nexport async function getPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n if (typeof stableGetPluginSettings === 'function') {\n return stableGetPluginSettings(pluginId, showErrorAlert);\n }\n\n return backwardsCompatibleGetPluginSettings(pluginId, showErrorAlert);\n}\n\nasync function backwardsCompatibleGetPluginSettings(pluginId: string, showErrorAlert = false): Promise<PluginMeta> {\n return getBackendSrv().get(`/api/plugins/${pluginId}/settings`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n });\n}\n\nexport async function updateAppPluginSettings(pluginId: string, data: Partial<PluginMeta>): Promise<PluginMeta> {\n if (typeof stableUpdateAppPluginSettings === 'function') {\n return stableUpdateAppPluginSettings(pluginId, data);\n }\n\n return backwardsCompatibleUpdatePluginSettings(pluginId, data);\n}\n\nasync function backwardsCompatibleUpdatePluginSettings(\n pluginId: string,\n data: Partial<PluginMeta>\n): Promise<PluginMeta> {\n await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });\n return backwardsCompatibleGetPluginSettings(pluginId);\n}\n\nexport async function getAppPluginHealth(\n pluginId: string,\n showErrorAlert = false,\n apiVersion?: string\n): Promise<HealthCheckResult | undefined> {\n if (typeof stableGetAppPluginHealth === 'function') {\n return stableGetAppPluginHealth(pluginId, showErrorAlert, apiVersion);\n }\n\n return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);\n}\n\nfunction isLegacyUnhealthyHealthCheckError(err: unknown): boolean {\n return (\n isFetchError<HealthCheckResult>(err) &&\n err.status === 400 &&\n (err.data?.status === HealthStatus.Error || err.data?.status === HealthStatus.Unknown)\n );\n}\n\nasync function backwardsCompatibleGetAppPluginHealth(\n pluginId: string,\n showErrorAlert = false\n): Promise<HealthCheckResult> {\n return getBackendSrv()\n .get<HealthCheckResult>(`/api/plugins/${pluginId}/health`, undefined, undefined, {\n showErrorAlert,\n validatePath: true,\n })\n .catch((err) => {\n if (isFetchError(err) && (err.status === 401 || err.status === 403)) {\n err.isHandled = true;\n return Promise.reject(err);\n }\n\n if (isLegacyUnhealthyHealthCheckError(err)) {\n return err.data;\n }\n\n return Promise.reject(err);\n });\n}\n"],"names":["stableGetPluginSettings","stableUpdateAppPluginSettings","stableGetAppPluginHealth"],"mappings":";;;AAWA,eAAsB,iBAAA,CAAkB,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACrG,EAAA,IAAI,OAAOA,wBAA4B,UAAA,EAAY;AACjD,IAAA,OAAOA,mBAAA,CAAwB,UAAU,cAAc,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,oCAAA,CAAqC,UAAU,cAAc,CAAA;AACtE;AAEA,eAAe,oCAAA,CAAqC,QAAA,EAAkB,cAAA,GAAiB,KAAA,EAA4B;AACjH,EAAA,OAAO,eAAc,CAAE,GAAA,CAAI,gBAAgB,QAAQ,CAAA,SAAA,CAAA,EAAa,QAAW,KAAA,CAAA,EAAW;AAAA,IACpF,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA;AACH;AAEA,eAAsB,uBAAA,CAAwB,UAAkB,IAAA,EAAgD;AAC9G,EAAA,IAAI,OAAOC,8BAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,yBAAA,CAA8B,UAAU,IAAI,CAAA;AAAA,EACrD;AAEA,EAAA,OAAO,uCAAA,CAAwC,UAAU,IAAI,CAAA;AAC/D;AAEA,eAAe,uCAAA,CACb,UACA,IAAA,EACqB;AACrB,EAAA,MAAM,aAAA,EAAc,CAAE,IAAA,CAAK,CAAA,aAAA,EAAgB,QAAQ,aAAa,IAAA,EAAM,EAAE,YAAA,EAAc,IAAA,EAAM,CAAA;AAC5F,EAAA,OAAO,qCAAqC,QAAQ,CAAA;AACtD;AAEA,eAAsB,kBAAA,CACpB,QAAA,EACA,cAAA,GAAiB,KAAA,EACjB,UAAA,EACwC;AACxC,EAAA,IAAI,OAAOC,yBAA6B,UAAA,EAAY;AAClD,IAAA,OAAOA,oBAAA,CAAyB,QAAA,EAAU,cAAA,EAAgB,UAAU,CAAA;AAAA,EACtE;AAEA,EAAA,OAAO,qCAAA,CAAsC,UAAU,cAAc,CAAA;AACvE;AAEA,SAAS,kCAAkC,GAAA,EAAuB;AAtDlE,EAAA,IAAA,EAAA,EAAA,EAAA;AAuDE,EAAA,OACE,aAAgC,GAAG,CAAA,IACnC,GAAA,CAAI,MAAA,KAAW,UACd,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,MAAA,MAAW,aAAa,KAAA,IAAA,CAAA,CAAS,EAAA,GAAA,GAAA,CAAI,IAAA,KAAJ,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAU,YAAW,YAAA,CAAa,OAAA,CAAA;AAElF;AAEA,eAAe,qCAAA,CACb,QAAA,EACA,cAAA,GAAiB,KAAA,EACW;AAC5B,EAAA,OAAO,eAAc,CAClB,GAAA,CAAuB,gBAAgB,QAAQ,CAAA,OAAA,CAAA,EAAW,QAAW,KAAA,CAAA,EAAW;AAAA,IAC/E,cAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA,CACA,KAAA,CAAM,CAAC,GAAA,KAAQ;AACd,IAAA,IAAI,YAAA,CAAa,GAAG,CAAA,KAAM,GAAA,CAAI,WAAW,GAAA,IAAO,GAAA,CAAI,WAAW,GAAA,CAAA,EAAM;AACnE,MAAA,GAAA,CAAI,SAAA,GAAY,IAAA;AAChB,MAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,IAC3B;AAEA,IAAA,IAAI,iCAAA,CAAkC,GAAG,CAAA,EAAG;AAC1C,MAAA,OAAO,GAAA,CAAI,IAAA;AAAA,IACb;AAEA,IAAA,OAAO,OAAA,CAAQ,OAAO,GAAG,CAAA;AAAA,EAC3B,CAAC,CAAA;AACL;;;;"}
@@ -1,14 +1,10 @@
1
1
  import { getDataSourceInstance as getDataSourceInstance$1, getDataSourceSrv } from '@grafana/runtime';
2
- import { getDataSourceInstance as getDataSourceInstance$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  async function getDataSourceInstance(ref, scopedVars) {
6
5
  if (typeof getDataSourceInstance$1 === "function") {
7
6
  return getDataSourceInstance$1(ref, scopedVars);
8
7
  }
9
- if (typeof getDataSourceInstance$2 === "function") {
10
- return getDataSourceInstance$2(ref, scopedVars);
11
- }
12
8
  return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);
13
9
  }
14
10
  async function backwardsCompatibleGetDataSourceInstance(ref, scopedVars) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstance.mjs","sources":["../../../src/datasources/getDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceApi, type ScopedVars } from '@grafana/data';\nimport { getDataSourceSrv, getDataSourceInstance as stableGetDataSourceInstance } from '@grafana/runtime';\nimport { getDataSourceInstance as unstableGetDataSourceInstance } from '@grafana/runtime/unstable';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n if (typeof stableGetDataSourceInstance === 'function') {\n return stableGetDataSourceInstance(ref, scopedVars);\n }\n\n if (typeof unstableGetDataSourceInstance === 'function') {\n return unstableGetDataSourceInstance(ref, scopedVars);\n }\n\n return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);\n}\n\nasync function backwardsCompatibleGetDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n return getDataSourceSrv().get(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstance","unstableGetDataSourceInstance"],"mappings":";;;;AAOA,eAAsB,qBAAA,CAAsB,KAAW,UAAA,EAAiD;AACtG,EAAA,IAAI,OAAOA,4BAAgC,UAAA,EAAY;AACrD,IAAA,OAAOA,uBAAA,CAA4B,KAAK,UAAU,CAAA;AAAA,EACpD;AAEA,EAAA,IAAI,OAAOC,4BAAkC,UAAA,EAAY;AACvD,IAAA,OAAOA,uBAAA,CAA8B,KAAK,UAAU,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,wCAAA,CAAyC,KAAK,UAAU,CAAA;AACjE;AAEA,eAAe,wCAAA,CAAyC,KAAW,UAAA,EAAiD;AAClH,EAAA,OAAO,gBAAA,EAAiB,CAAE,GAAA,CAAI,GAAA,EAAK,UAAU,CAAA;AAC/C;;;;"}
1
+ {"version":3,"file":"getDataSourceInstance.mjs","sources":["../../../src/datasources/getDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceApi, type ScopedVars } from '@grafana/data';\nimport { getDataSourceSrv, getDataSourceInstance as stableGetDataSourceInstance } from '@grafana/runtime';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n if (typeof stableGetDataSourceInstance === 'function') {\n return stableGetDataSourceInstance(ref, scopedVars);\n }\n\n return backwardsCompatibleGetDataSourceInstance(ref, scopedVars);\n}\n\nasync function backwardsCompatibleGetDataSourceInstance(ref?: Ref, scopedVars?: ScopedVars): Promise<DataSourceApi> {\n return getDataSourceSrv().get(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstance"],"mappings":";;;AAMA,eAAsB,qBAAA,CAAsB,KAAW,UAAA,EAAiD;AACtG,EAAA,IAAI,OAAOA,4BAAgC,UAAA,EAAY;AACrD,IAAA,OAAOA,uBAAA,CAA4B,KAAK,UAAU,CAAA;AAAA,EACpD;AAEA,EAAA,OAAO,wCAAA,CAAyC,KAAK,UAAU,CAAA;AACjE;AAEA,eAAe,wCAAA,CAAyC,KAAW,UAAA,EAAiD;AAClH,EAAA,OAAO,gBAAA,EAAiB,CAAE,GAAA,CAAI,GAAA,EAAK,UAAU,CAAA;AAC/C;;;;"}
@@ -1,14 +1,10 @@
1
1
  import { getDataSourceInstanceList as getDataSourceInstanceList$1, getDataSourceSrv } from '@grafana/runtime';
2
- import { getDataSourceInstanceList as getDataSourceInstanceList$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  async function getDataSourceInstanceList(filters) {
6
5
  if (typeof getDataSourceInstanceList$1 === "function") {
7
6
  return getDataSourceInstanceList$1(filters);
8
7
  }
9
- if (typeof getDataSourceInstanceList$2 === "function") {
10
- return getDataSourceInstanceList$2(filters);
11
- }
12
8
  return backwardsCompatibleGetDataSourceInstanceList(filters);
13
9
  }
14
10
  async function backwardsCompatibleGetDataSourceInstanceList(filters) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstanceList.mjs","sources":["../../../src/datasources/getDataSourceInstanceList.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n type GetDataSourceListFilters,\n getDataSourceSrv,\n getDataSourceInstanceList as stableGetDataSourceInstanceList,\n} from '@grafana/runtime';\nimport { getDataSourceInstanceList as unstableGetDataSourceInstanceList } from '@grafana/runtime/unstable';\n\nimport { type GetDataSourceInstanceListFilters } from './types';\n\nexport async function getDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n if (typeof stableGetDataSourceInstanceList === 'function') {\n return stableGetDataSourceInstanceList(filters);\n }\n\n if (typeof unstableGetDataSourceInstanceList === 'function') {\n return unstableGetDataSourceInstanceList(filters);\n }\n\n return backwardsCompatibleGetDataSourceInstanceList(filters);\n}\n\nasync function backwardsCompatibleGetDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n const { filter, ...rest } = filters ?? {};\n const legacyFilters: GetDataSourceListFilters = filter\n ? { ...rest, filter: (item) => filter(toDataSourceInstanceListItem(item)) }\n : { ...rest };\n\n return getDataSourceSrv().getList(legacyFilters).map(toDataSourceInstanceListItem);\n}\n\nfunction toDataSourceInstanceListItem(item: DataSourceInstanceSettings): DataSourceInstanceListItem {\n return {\n meta: { ...item.meta },\n name: item.name,\n type: item.type,\n uid: item.uid,\n };\n}\n"],"names":["stableGetDataSourceInstanceList","unstableGetDataSourceInstanceList"],"mappings":";;;;AAWA,eAAsB,0BACpB,OAAA,EACuC;AACvC,EAAA,IAAI,OAAOA,gCAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,4BAAgC,OAAO,CAAA;AAAA,EAChD;AAEA,EAAA,IAAI,OAAOC,gCAAsC,UAAA,EAAY;AAC3D,IAAA,OAAOA,4BAAkC,OAAO,CAAA;AAAA,EAClD;AAEA,EAAA,OAAO,6CAA6C,OAAO,CAAA;AAC7D;AAEA,eAAe,6CACb,OAAA,EACuC;AACvC,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AACxC,EAAA,MAAM,gBAA0C,MAAA,GAC5C,EAAE,GAAG,IAAA,EAAM,QAAQ,CAAC,IAAA,KAAS,MAAA,CAAO,4BAAA,CAA6B,IAAI,CAAC,CAAA,EAAE,GACxE,EAAE,GAAG,IAAA,EAAK;AAEd,EAAA,OAAO,kBAAiB,CAAE,OAAA,CAAQ,aAAa,CAAA,CAAE,IAAI,4BAA4B,CAAA;AACnF;AAEA,SAAS,6BAA6B,IAAA,EAA8D;AAClG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,GAAG,IAAA,CAAK,IAAA,EAAK;AAAA,IACrB,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,KAAK,IAAA,CAAK;AAAA,GACZ;AACF;;;;"}
1
+ {"version":3,"file":"getDataSourceInstanceList.mjs","sources":["../../../src/datasources/getDataSourceInstanceList.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n type GetDataSourceListFilters,\n getDataSourceSrv,\n getDataSourceInstanceList as stableGetDataSourceInstanceList,\n} from '@grafana/runtime';\n\nimport { type GetDataSourceInstanceListFilters } from './types';\n\nexport async function getDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n if (typeof stableGetDataSourceInstanceList === 'function') {\n return stableGetDataSourceInstanceList(filters);\n }\n\n return backwardsCompatibleGetDataSourceInstanceList(filters);\n}\n\nasync function backwardsCompatibleGetDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): Promise<DataSourceInstanceListItem[]> {\n const { filter, ...rest } = filters ?? {};\n const legacyFilters: GetDataSourceListFilters = filter\n ? { ...rest, filter: (item) => filter(toDataSourceInstanceListItem(item)) }\n : { ...rest };\n\n return getDataSourceSrv().getList(legacyFilters).map(toDataSourceInstanceListItem);\n}\n\nfunction toDataSourceInstanceListItem(item: DataSourceInstanceSettings): DataSourceInstanceListItem {\n return {\n meta: { ...item.meta },\n name: item.name,\n type: item.type,\n uid: item.uid,\n };\n}\n"],"names":["stableGetDataSourceInstanceList"],"mappings":";;;AAUA,eAAsB,0BACpB,OAAA,EACuC;AACvC,EAAA,IAAI,OAAOA,gCAAoC,UAAA,EAAY;AACzD,IAAA,OAAOA,4BAAgC,OAAO,CAAA;AAAA,EAChD;AAEA,EAAA,OAAO,6CAA6C,OAAO,CAAA;AAC7D;AAEA,eAAe,6CACb,OAAA,EACuC;AACvC,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AACxC,EAAA,MAAM,gBAA0C,MAAA,GAC5C,EAAE,GAAG,IAAA,EAAM,QAAQ,CAAC,IAAA,KAAS,MAAA,CAAO,4BAAA,CAA6B,IAAI,CAAC,CAAA,EAAE,GACxE,EAAE,GAAG,IAAA,EAAK;AAEd,EAAA,OAAO,kBAAiB,CAAE,OAAA,CAAQ,aAAa,CAAA,CAAE,IAAI,4BAA4B,CAAA;AACnF;AAEA,SAAS,6BAA6B,IAAA,EAA8D;AAClG,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,EAAE,GAAG,IAAA,CAAK,IAAA,EAAK;AAAA,IACrB,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,KAAK,IAAA,CAAK;AAAA,GACZ;AACF;;;;"}
@@ -1,14 +1,10 @@
1
1
  import { getDataSourceInstanceSettings as getDataSourceInstanceSettings$1, getDataSourceSrv } from '@grafana/runtime';
2
- import { getDataSourceInstanceSettings as getDataSourceInstanceSettings$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  async function getDataSourceInstanceSettings(ref, scopedVars) {
6
5
  if (typeof getDataSourceInstanceSettings$1 === "function") {
7
6
  return getDataSourceInstanceSettings$1(ref, scopedVars);
8
7
  }
9
- if (typeof getDataSourceInstanceSettings$2 === "function") {
10
- return getDataSourceInstanceSettings$2(ref, scopedVars);
11
- }
12
8
  return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);
13
9
  }
14
10
  async function backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDataSourceInstanceSettings.mjs","sources":["../../../src/datasources/getDataSourceInstanceSettings.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type ScopedVars, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDataSourceInstanceSettings as stableGetDataSourceInstanceSettings,\n} from '@grafana/runtime';\nimport { getDataSourceInstanceSettings as unstableGetDataSourceInstanceSettings } from '@grafana/runtime/unstable';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n if (typeof stableGetDataSourceInstanceSettings === 'function') {\n return stableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n if (typeof unstableGetDataSourceInstanceSettings === 'function') {\n return unstableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);\n}\n\nasync function backwardsCompatibleDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n return getDataSourceSrv().getInstanceSettings(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstanceSettings","unstableGetDataSourceInstanceSettings"],"mappings":";;;;AAUA,eAAsB,6BAAA,CACpB,KACA,UAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,oCAAwC,UAAA,EAAY;AAC7D,IAAA,OAAOA,+BAAA,CAAoC,KAAK,UAAU,CAAA;AAAA,EAC5D;AAEA,EAAA,IAAI,OAAOC,oCAA0C,UAAA,EAAY;AAC/D,IAAA,OAAOA,+BAAA,CAAsC,KAAK,UAAU,CAAA;AAAA,EAC9D;AAEA,EAAA,OAAO,6CAAA,CAA8C,KAAK,UAAU,CAAA;AACtE;AAEA,eAAe,6CAAA,CACb,KACA,UAAA,EACiD;AACjD,EAAA,OAAO,gBAAA,EAAiB,CAAE,mBAAA,CAAoB,GAAA,EAAK,UAAU,CAAA;AAC/D;;;;"}
1
+ {"version":3,"file":"getDataSourceInstanceSettings.mjs","sources":["../../../src/datasources/getDataSourceInstanceSettings.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type ScopedVars, type DataSourceInstanceSettings } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDataSourceInstanceSettings as stableGetDataSourceInstanceSettings,\n} from '@grafana/runtime';\n\nimport { type Ref } from './types';\n\nexport async function getDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n if (typeof stableGetDataSourceInstanceSettings === 'function') {\n return stableGetDataSourceInstanceSettings(ref, scopedVars);\n }\n\n return backwardsCompatibleDataSourceInstanceSettings(ref, scopedVars);\n}\n\nasync function backwardsCompatibleDataSourceInstanceSettings(\n ref?: Ref,\n scopedVars?: ScopedVars\n): Promise<DataSourceInstanceSettings | undefined> {\n return getDataSourceSrv().getInstanceSettings(ref, scopedVars);\n}\n"],"names":["stableGetDataSourceInstanceSettings"],"mappings":";;;AASA,eAAsB,6BAAA,CACpB,KACA,UAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,oCAAwC,UAAA,EAAY;AAC7D,IAAA,OAAOA,+BAAA,CAAoC,KAAK,UAAU,CAAA;AAAA,EAC5D;AAEA,EAAA,OAAO,6CAAA,CAA8C,KAAK,UAAU,CAAA;AACtE;AAEA,eAAe,6CAAA,CACb,KACA,UAAA,EACiD;AACjD,EAAA,OAAO,gBAAA,EAAiB,CAAE,mBAAA,CAAoB,GAAA,EAAK,UAAU,CAAA;AAC/D;;;;"}
@@ -1,14 +1,10 @@
1
1
  import { getDefaultDataSourceInstanceListItem as getDefaultDataSourceInstanceListItem$1, getDataSourceSrv } from '@grafana/runtime';
2
- import { getDefaultDataSourceInstanceListItem as getDefaultDataSourceInstanceListItem$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  async function getDefaultDataSourceInstanceListItem(items) {
6
5
  if (typeof getDefaultDataSourceInstanceListItem$1 === "function") {
7
6
  return getDefaultDataSourceInstanceListItem$1(items);
8
7
  }
9
- if (typeof getDefaultDataSourceInstanceListItem$2 === "function") {
10
- return getDefaultDataSourceInstanceListItem$2(items);
11
- }
12
8
  return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);
13
9
  }
14
10
  function backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) {
@@ -1 +1 @@
1
- {"version":3,"file":"getDefaultDataSourceInstanceListItem.mjs","sources":["../../../src/datasources/getDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDefaultDataSourceInstanceListItem as stableGetDefaultDataSourceInstanceListItem,\n} from '@grafana/runtime';\nimport { getDefaultDataSourceInstanceListItem as unstableGetDefaultDataSourceInstanceListItem } from '@grafana/runtime/unstable';\n\n/**\n * Resolve the item whose data source is the org default, or `undefined` when the list holds none.\n *\n * At most one instance per org carries the flag, so a filtered list need not contain it.\n */\nexport async function getDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): Promise<DataSourceInstanceListItem | undefined> {\n if (typeof stableGetDefaultDataSourceInstanceListItem === 'function') {\n return stableGetDefaultDataSourceInstanceListItem(items);\n }\n\n if (typeof unstableGetDefaultDataSourceInstanceListItem === 'function') {\n return unstableGetDefaultDataSourceInstanceListItem(items);\n }\n\n return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);\n}\n\nexport function backwardsCompatibleGetDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): DataSourceInstanceListItem | undefined {\n return items.find((item) => item && getDataSourceSrv().getInstanceSettings(item.uid)?.isDefault);\n}\n"],"names":["stableGetDefaultDataSourceInstanceListItem","unstableGetDefaultDataSourceInstanceListItem"],"mappings":";;;;AAaA,eAAsB,qCACpB,KAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,2CAA+C,UAAA,EAAY;AACpE,IAAA,OAAOA,uCAA2C,KAAK,CAAA;AAAA,EACzD;AAEA,EAAA,IAAI,OAAOC,2CAAiD,UAAA,EAAY;AACtE,IAAA,OAAOA,uCAA6C,KAAK,CAAA;AAAA,EAC3D;AAEA,EAAA,OAAO,wDAAwD,KAAK,CAAA;AACtE;AAEO,SAAS,wDACd,KAAA,EACwC;AACxC,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,IAAA,KAAM;AA9B3B,IAAA,IAAA,EAAA;AA8B8B,IAAA,OAAA,IAAA,KAAA,CAAQ,uBAAiB,CAAE,mBAAA,CAAoB,IAAA,CAAK,GAAG,MAA/C,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkD,SAAA,CAAA;AAAA,EAAA,CAAS,CAAA;AACjG;;;;"}
1
+ {"version":3,"file":"getDefaultDataSourceInstanceListItem.mjs","sources":["../../../src/datasources/getDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport {\n getDataSourceSrv,\n getDefaultDataSourceInstanceListItem as stableGetDefaultDataSourceInstanceListItem,\n} from '@grafana/runtime';\n\n/**\n * Resolve the item whose data source is the org default, or `undefined` when the list holds none.\n *\n * At most one instance per org carries the flag, so a filtered list need not contain it.\n */\nexport async function getDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): Promise<DataSourceInstanceListItem | undefined> {\n if (typeof stableGetDefaultDataSourceInstanceListItem === 'function') {\n return stableGetDefaultDataSourceInstanceListItem(items);\n }\n\n return backwardsCompatibleGetDefaultDataSourceInstanceListItem(items);\n}\n\nexport function backwardsCompatibleGetDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): DataSourceInstanceListItem | undefined {\n return items.find((item) => item && getDataSourceSrv().getInstanceSettings(item.uid)?.isDefault);\n}\n"],"names":["stableGetDefaultDataSourceInstanceListItem"],"mappings":";;;AAYA,eAAsB,qCACpB,KAAA,EACiD;AACjD,EAAA,IAAI,OAAOA,2CAA+C,UAAA,EAAY;AACpE,IAAA,OAAOA,uCAA2C,KAAK,CAAA;AAAA,EACzD;AAEA,EAAA,OAAO,wDAAwD,KAAK,CAAA;AACtE;AAEO,SAAS,wDACd,KAAA,EACwC;AACxC,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,CAAC,IAAA,KAAM;AAzB3B,IAAA,IAAA,EAAA;AAyB8B,IAAA,OAAA,IAAA,KAAA,CAAQ,uBAAiB,CAAE,mBAAA,CAAoB,IAAA,CAAK,GAAG,MAA/C,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAkD,SAAA,CAAA;AAAA,EAAA,CAAS,CAAA;AACjG;;;;"}
@@ -1,14 +1,10 @@
1
1
  import { registerRuntimeDataSourceInstance as registerRuntimeDataSourceInstance$1, getDataSourceSrv } from '@grafana/runtime';
2
- import { registerRuntimeDataSourceInstance as registerRuntimeDataSourceInstance$2 } from '@grafana/runtime/unstable';
3
2
 
4
3
  "use strict";
5
4
  function registerRuntimeDataSourceInstance(entry) {
6
5
  if (typeof registerRuntimeDataSourceInstance$1 === "function") {
7
6
  return registerRuntimeDataSourceInstance$1(entry);
8
7
  }
9
- if (typeof registerRuntimeDataSourceInstance$2 === "function") {
10
- return registerRuntimeDataSourceInstance$2(entry);
11
- }
12
8
  return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);
13
9
  }
14
10
  function backwardsCompatibleRegisterRuntimeDataSourceInstance(entry) {
@@ -1 +1 @@
1
- {"version":3,"file":"registerRuntimeDataSourceInstance.mjs","sources":["../../../src/datasources/registerRuntimeDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport {\n getDataSourceSrv,\n type RuntimeDataSourceRegistration,\n registerRuntimeDataSourceInstance as stableRegisterRuntimeDataSourceInstance,\n} from '@grafana/runtime';\nimport { registerRuntimeDataSourceInstance as unstableRegisterRuntimeDataSourceInstance } from '@grafana/runtime/unstable';\n\nexport function registerRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n if (typeof stableRegisterRuntimeDataSourceInstance === 'function') {\n return stableRegisterRuntimeDataSourceInstance(entry);\n }\n\n if (typeof unstableRegisterRuntimeDataSourceInstance === 'function') {\n return unstableRegisterRuntimeDataSourceInstance(entry);\n }\n\n return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);\n}\n\nfunction backwardsCompatibleRegisterRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n return getDataSourceSrv().registerRuntimeDataSource(entry);\n}\n"],"names":["stableRegisterRuntimeDataSourceInstance","unstableRegisterRuntimeDataSourceInstance"],"mappings":";;;;AAQO,SAAS,kCAAkC,KAAA,EAA4C;AAC5F,EAAA,IAAI,OAAOA,wCAA4C,UAAA,EAAY;AACjE,IAAA,OAAOA,oCAAwC,KAAK,CAAA;AAAA,EACtD;AAEA,EAAA,IAAI,OAAOC,wCAA8C,UAAA,EAAY;AACnE,IAAA,OAAOA,oCAA0C,KAAK,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,qDAAqD,KAAK,CAAA;AACnE;AAEA,SAAS,qDAAqD,KAAA,EAA4C;AACxG,EAAA,OAAO,gBAAA,EAAiB,CAAE,yBAAA,CAA0B,KAAK,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"registerRuntimeDataSourceInstance.mjs","sources":["../../../src/datasources/registerRuntimeDataSourceInstance.ts"],"sourcesContent":["/* eslint-disable @grafana/no-get-data-source-srv */\nimport {\n getDataSourceSrv,\n type RuntimeDataSourceRegistration,\n registerRuntimeDataSourceInstance as stableRegisterRuntimeDataSourceInstance,\n} from '@grafana/runtime';\n\nexport function registerRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n if (typeof stableRegisterRuntimeDataSourceInstance === 'function') {\n return stableRegisterRuntimeDataSourceInstance(entry);\n }\n\n return backwardsCompatibleRegisterRuntimeDataSourceInstance(entry);\n}\n\nfunction backwardsCompatibleRegisterRuntimeDataSourceInstance(entry: RuntimeDataSourceRegistration): void {\n return getDataSourceSrv().registerRuntimeDataSource(entry);\n}\n"],"names":["stableRegisterRuntimeDataSourceInstance"],"mappings":";;;AAOO,SAAS,kCAAkC,KAAA,EAA4C;AAC5F,EAAA,IAAI,OAAOA,wCAA4C,UAAA,EAAY;AACjE,IAAA,OAAOA,oCAAwC,KAAK,CAAA;AAAA,EACtD;AAEA,EAAA,OAAO,qDAAqD,KAAK,CAAA;AACnE;AAEA,SAAS,qDAAqD,KAAA,EAA4C;AACxG,EAAA,OAAO,gBAAA,EAAiB,CAAE,yBAAA,CAA0B,KAAK,CAAA;AAC3D;;;;"}
@@ -1,10 +1,9 @@
1
1
  import { useState, useEffect } from 'react';
2
2
  import { useDataSourceInstance as useDataSourceInstance$1 } from '@grafana/runtime';
3
- import { useDataSourceInstance as useDataSourceInstance$2 } from '@grafana/runtime/unstable';
4
3
  import { getDataSourceInstance } from './getDataSourceInstance.mjs';
5
4
 
6
5
  "use strict";
7
- const useDataSourceInstance = typeof useDataSourceInstance$1 === "function" ? useDataSourceInstance$1 : typeof useDataSourceInstance$2 === "function" ? useDataSourceInstance$2 : useBackwardsCompatibleDataSourceInstance;
6
+ const useDataSourceInstance = typeof useDataSourceInstance$1 === "function" ? useDataSourceInstance$1 : useBackwardsCompatibleDataSourceInstance;
8
7
  function useBackwardsCompatibleDataSourceInstance(ref) {
9
8
  const [result, setResult] = useState({ isLoading: true });
10
9
  const refKey = JSON.stringify(ref != null ? ref : null);
@@ -1 +1 @@
1
- {"version":3,"file":"useDataSourceInstance.mjs","sources":["../../../src/datasources/useDataSourceInstance.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { type DataSourceApi } from '@grafana/data';\nimport { useDataSourceInstance as stableUseDataSourceInstance } from '@grafana/runtime';\nimport { useDataSourceInstance as unstableUseDataSourceInstance } from '@grafana/runtime/unstable';\n\nimport { getDataSourceInstance } from './getDataSourceInstance';\nimport { type Ref } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceResult {\n isLoading: boolean;\n error?: Error;\n dataSource?: DataSourceApi;\n}\n\n/**\n * Uses the host hook when available. The fallback re-resolves only when `ref` changes, not on data source cache\n * changes. Picked once at load so the hook order stays stable.\n */\nexport const useDataSourceInstance: (ref?: Ref) => UseDataSourceInstanceResult =\n typeof stableUseDataSourceInstance === 'function'\n ? stableUseDataSourceInstance\n : typeof unstableUseDataSourceInstance === 'function'\n ? unstableUseDataSourceInstance\n : useBackwardsCompatibleDataSourceInstance;\n\nfunction useBackwardsCompatibleDataSourceInstance(ref?: Ref): UseDataSourceInstanceResult {\n const [result, setResult] = useState<UseDataSourceInstanceResult>({ isLoading: true });\n // Same key as the host hook, so inline ref objects don't refetch and `null` matches `undefined`.\n const refKey = JSON.stringify(ref ?? null);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstance(ref).then(\n (dataSource) => isCurrent && setResult({ isLoading: false, dataSource }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstance","unstableUseDataSourceInstance"],"mappings":";;;;;;AAoBO,MAAM,qBAAA,GACX,OAAOA,uBAAA,KAAgC,UAAA,GACnCA,0BACA,OAAOC,uBAAA,KAAkC,aACvCA,uBAAA,GACA;AAER,SAAS,yCAAyC,GAAA,EAAwC;AACxF,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAI,SAAsC,EAAE,SAAA,EAAW,MAAM,CAAA;AAErF,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,SAAA,CAAU,GAAA,IAAA,IAAA,GAAA,GAAA,GAAO,IAAI,CAAA;AAEzC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAA,qBAAA,CAAsB,GAAG,CAAA,CAAE,IAAA;AAAA,MACzB,CAAC,eAAe,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AAAA,MACvE,CAAC,UAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO;AAAA,KACtE;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"useDataSourceInstance.mjs","sources":["../../../src/datasources/useDataSourceInstance.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { type DataSourceApi } from '@grafana/data';\nimport { useDataSourceInstance as stableUseDataSourceInstance } from '@grafana/runtime';\n\nimport { getDataSourceInstance } from './getDataSourceInstance';\nimport { type Ref } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceResult {\n isLoading: boolean;\n error?: Error;\n dataSource?: DataSourceApi;\n}\n\n/**\n * Uses the host hook when available. The fallback re-resolves only when `ref` changes, not on data source cache\n * changes. Picked once at load so the hook order stays stable.\n */\nexport const useDataSourceInstance: (ref?: Ref) => UseDataSourceInstanceResult =\n typeof stableUseDataSourceInstance === 'function'\n ? stableUseDataSourceInstance\n : useBackwardsCompatibleDataSourceInstance;\n\nfunction useBackwardsCompatibleDataSourceInstance(ref?: Ref): UseDataSourceInstanceResult {\n const [result, setResult] = useState<UseDataSourceInstanceResult>({ isLoading: true });\n // Same key as the host hook, so inline ref objects don't refetch and `null` matches `undefined`.\n const refKey = JSON.stringify(ref ?? null);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstance(ref).then(\n (dataSource) => isCurrent && setResult({ isLoading: false, dataSource }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [refKey]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstance"],"mappings":";;;;;AAmBO,MAAM,qBAAA,GACX,OAAOA,uBAAA,KAAgC,UAAA,GACnCA,uBAAA,GACA;AAEN,SAAS,yCAAyC,GAAA,EAAwC;AACxF,EAAA,MAAM,CAAC,QAAQ,SAAS,CAAA,GAAI,SAAsC,EAAE,SAAA,EAAW,MAAM,CAAA;AAErF,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,SAAA,CAAU,GAAA,IAAA,IAAA,GAAA,GAAA,GAAO,IAAI,CAAA;AAEzC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAA,qBAAA,CAAsB,GAAG,CAAA,CAAE,IAAA;AAAA,MACzB,CAAC,eAAe,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,YAAY,CAAA;AAAA,MACvE,CAAC,UAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO;AAAA,KACtE;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -1,10 +1,9 @@
1
1
  import { useMemo, useState, useEffect } from 'react';
2
2
  import { useDataSourceInstanceList as useDataSourceInstanceList$1 } from '@grafana/runtime';
3
- import { useDataSourceInstanceList as useDataSourceInstanceList$2 } from '@grafana/runtime/unstable';
4
3
  import { getDataSourceInstanceList } from './getDataSourceInstanceList.mjs';
5
4
 
6
5
  "use strict";
7
- const useDataSourceInstanceList = typeof useDataSourceInstanceList$1 === "function" ? useDataSourceInstanceList$1 : typeof useDataSourceInstanceList$2 === "function" ? useDataSourceInstanceList$2 : useBackwardsCompatibleDataSourceInstanceList;
6
+ const useDataSourceInstanceList = typeof useDataSourceInstanceList$1 === "function" ? useDataSourceInstanceList$1 : useBackwardsCompatibleDataSourceInstanceList;
8
7
  function useBackwardsCompatibleDataSourceInstanceList(filters) {
9
8
  const emptyItems = useMemo(() => [], []);
10
9
  const [result, setResult] = useState({ isLoading: true, items: emptyItems });
@@ -1 +1 @@
1
- {"version":3,"file":"useDataSourceInstanceList.mjs","sources":["../../../src/datasources/useDataSourceInstanceList.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDataSourceInstanceList as stableUseDataSourceInstanceList } from '@grafana/runtime';\nimport { useDataSourceInstanceList as unstableUseDataSourceInstanceList } from '@grafana/runtime/unstable';\n\nimport { getDataSourceInstanceList } from './getDataSourceInstanceList';\nimport { type GetDataSourceInstanceListFilters } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceListResult {\n isLoading: boolean;\n error?: Error;\n items: DataSourceInstanceListItem[];\n}\n\n/**\n * Uses the host hook when available. The fallback re-fetches only when `filters` changes by value or the\n * `filter` function reference changes, not on data source cache changes. Picked once at load so the hook\n * order stays stable.\n */\nexport const useDataSourceInstanceList: (\n filters?: GetDataSourceInstanceListFilters\n) => UseDataSourceInstanceListResult =\n typeof stableUseDataSourceInstanceList === 'function'\n ? stableUseDataSourceInstanceList\n : typeof unstableUseDataSourceInstanceList === 'function'\n ? unstableUseDataSourceInstanceList\n : useBackwardsCompatibleDataSourceInstanceList;\n\nfunction useBackwardsCompatibleDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): UseDataSourceInstanceListResult {\n // One empty array per hook instance, like the host hook, so callers can rely on its identity.\n const emptyItems = useMemo<DataSourceInstanceListItem[]>(() => [], []);\n const [result, setResult] = useState<UseDataSourceInstanceListResult>({ isLoading: true, items: emptyItems });\n const { filter, ...rest } = filters ?? {};\n // Same key as the host hook, so equal inline filters don't refetch. The `filter` function is compared by reference.\n const filtersKey = JSON.stringify(rest);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstanceList(filters).then(\n (items) => isCurrent && setResult({ isLoading: false, items }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error, items: emptyItems })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filtersKey, filter]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstanceList","unstableUseDataSourceInstanceList"],"mappings":";;;;;;AAqBO,MAAM,yBAAA,GAGX,OAAOA,2BAAA,KAAoC,UAAA,GACvCA,8BACA,OAAOC,2BAAA,KAAsC,aAC3CA,2BAAA,GACA;AAER,SAAS,6CACP,OAAA,EACiC;AAEjC,EAAA,MAAM,aAAa,OAAA,CAAsC,MAAM,EAAC,EAAG,EAAE,CAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,QAAA,CAA0C,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5G,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AAExC,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAA,yBAAA,CAA0B,OAAO,CAAA,CAAE,IAAA;AAAA,MACjC,CAAC,UAAU,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO,CAAA;AAAA,MAC7D,CAAC,KAAA,KAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,WAAW,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY;AAAA,KACzF;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,UAAA,EAAY,MAAM,CAAC,CAAA;AAEvB,EAAA,OAAO,MAAA;AACT;;;;"}
1
+ {"version":3,"file":"useDataSourceInstanceList.mjs","sources":["../../../src/datasources/useDataSourceInstanceList.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\n\nimport { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDataSourceInstanceList as stableUseDataSourceInstanceList } from '@grafana/runtime';\n\nimport { getDataSourceInstanceList } from './getDataSourceInstanceList';\nimport { type GetDataSourceInstanceListFilters } from './types';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDataSourceInstanceListResult {\n isLoading: boolean;\n error?: Error;\n items: DataSourceInstanceListItem[];\n}\n\n/**\n * Uses the host hook when available. The fallback re-fetches only when `filters` changes by value or the\n * `filter` function reference changes, not on data source cache changes. Picked once at load so the hook\n * order stays stable.\n */\nexport const useDataSourceInstanceList: (\n filters?: GetDataSourceInstanceListFilters\n) => UseDataSourceInstanceListResult =\n typeof stableUseDataSourceInstanceList === 'function'\n ? stableUseDataSourceInstanceList\n : useBackwardsCompatibleDataSourceInstanceList;\n\nfunction useBackwardsCompatibleDataSourceInstanceList(\n filters?: GetDataSourceInstanceListFilters\n): UseDataSourceInstanceListResult {\n // One empty array per hook instance, like the host hook, so callers can rely on its identity.\n const emptyItems = useMemo<DataSourceInstanceListItem[]>(() => [], []);\n const [result, setResult] = useState<UseDataSourceInstanceListResult>({ isLoading: true, items: emptyItems });\n const { filter, ...rest } = filters ?? {};\n // Same key as the host hook, so equal inline filters don't refetch. The `filter` function is compared by reference.\n const filtersKey = JSON.stringify(rest);\n\n useEffect(() => {\n let isCurrent = true;\n setResult((previous) => ({ ...previous, isLoading: true }));\n\n getDataSourceInstanceList(filters).then(\n (items) => isCurrent && setResult({ isLoading: false, items }),\n (error: Error) => isCurrent && setResult({ isLoading: false, error, items: emptyItems })\n );\n\n return () => {\n isCurrent = false;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [filtersKey, filter]);\n\n return result;\n}\n"],"names":["stableUseDataSourceInstanceList"],"mappings":";;;;;AAoBO,MAAM,yBAAA,GAGX,OAAOA,2BAAA,KAAoC,UAAA,GACvCA,2BAAA,GACA;AAEN,SAAS,6CACP,OAAA,EACiC;AAEjC,EAAA,MAAM,aAAa,OAAA,CAAsC,MAAM,EAAC,EAAG,EAAE,CAAA;AACrE,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,QAAA,CAA0C,EAAE,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,UAAA,EAAY,CAAA;AAC5G,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,IAAA,EAAK,GAAI,4BAAW,EAAC;AAExC,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAEtC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAA,GAAY,IAAA;AAChB,IAAA,SAAA,CAAU,CAAC,QAAA,MAAc,EAAE,GAAG,QAAA,EAAU,SAAA,EAAW,MAAK,CAAE,CAAA;AAE1D,IAAA,yBAAA,CAA0B,OAAO,CAAA,CAAE,IAAA;AAAA,MACjC,CAAC,UAAU,SAAA,IAAa,SAAA,CAAU,EAAE,SAAA,EAAW,KAAA,EAAO,OAAO,CAAA;AAAA,MAC7D,CAAC,KAAA,KAAiB,SAAA,IAAa,SAAA,CAAU,EAAE,WAAW,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,UAAA,EAAY;AAAA,KACzF;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,SAAA,GAAY,KAAA;AAAA,IACd,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,UAAA,EAAY,MAAM,CAAC,CAAA;AAEvB,EAAA,OAAO,MAAA;AACT;;;;"}
@@ -1,9 +1,8 @@
1
1
  import { useDefaultDataSourceInstanceListItem as useDefaultDataSourceInstanceListItem$1 } from '@grafana/runtime';
2
- import { useDefaultDataSourceInstanceListItem as useDefaultDataSourceInstanceListItem$2 } from '@grafana/runtime/unstable';
3
2
  import { backwardsCompatibleGetDefaultDataSourceInstanceListItem } from './getDefaultDataSourceInstanceListItem.mjs';
4
3
 
5
4
  "use strict";
6
- const useDefaultDataSourceInstanceListItem = typeof useDefaultDataSourceInstanceListItem$1 === "function" ? useDefaultDataSourceInstanceListItem$1 : typeof useDefaultDataSourceInstanceListItem$2 === "function" ? useDefaultDataSourceInstanceListItem$2 : useBackwardsCompatibleDefaultDataSourceInstanceListItem;
5
+ const useDefaultDataSourceInstanceListItem = typeof useDefaultDataSourceInstanceListItem$1 === "function" ? useDefaultDataSourceInstanceListItem$1 : useBackwardsCompatibleDefaultDataSourceInstanceListItem;
7
6
  function useBackwardsCompatibleDefaultDataSourceInstanceListItem(items) {
8
7
  return { isLoading: false, item: backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };
9
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useDefaultDataSourceInstanceListItem.mjs","sources":["../../../src/datasources/useDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["import { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDefaultDataSourceInstanceListItem as stableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime';\nimport { useDefaultDataSourceInstanceListItem as unstableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime/unstable';\n\nimport { backwardsCompatibleGetDefaultDataSourceInstanceListItem } from './getDefaultDataSourceInstanceListItem';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDefaultDataSourceInstanceListItemResult {\n isLoading: boolean;\n error?: Error;\n item?: DataSourceInstanceListItem;\n}\n\n/**\n * Uses the host hook when available, which also re-resolves on data source cache changes; otherwise\n * resolves synchronously on every render. Picked once at load so the hook order stays stable.\n */\nexport const useDefaultDataSourceInstanceListItem: (\n items: DataSourceInstanceListItem[]\n) => UseDefaultDataSourceInstanceListItemResult =\n typeof stableUseDefaultDataSourceInstanceListItem === 'function'\n ? stableUseDefaultDataSourceInstanceListItem\n : typeof unstableUseDefaultDataSourceInstanceListItem === 'function'\n ? unstableUseDefaultDataSourceInstanceListItem\n : useBackwardsCompatibleDefaultDataSourceInstanceListItem;\n\nfunction useBackwardsCompatibleDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): UseDefaultDataSourceInstanceListItemResult {\n return { isLoading: false, item: backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };\n}\n"],"names":["stableUseDefaultDataSourceInstanceListItem","unstableUseDefaultDataSourceInstanceListItem"],"mappings":";;;;;AAiBO,MAAM,oCAAA,GAGX,OAAOA,sCAAA,KAA+C,UAAA,GAClDA,yCACA,OAAOC,sCAAA,KAAiD,aACtDA,sCAAA,GACA;AAER,SAAS,wDACP,KAAA,EAC4C;AAC5C,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,IAAA,EAAM,uDAAA,CAAwD,KAAK,CAAA,EAAE;AAClG;;;;"}
1
+ {"version":3,"file":"useDefaultDataSourceInstanceListItem.mjs","sources":["../../../src/datasources/useDefaultDataSourceInstanceListItem.ts"],"sourcesContent":["import { type DataSourceInstanceListItem } from '@grafana/data';\nimport { useDefaultDataSourceInstanceListItem as stableUseDefaultDataSourceInstanceListItem } from '@grafana/runtime';\n\nimport { backwardsCompatibleGetDefaultDataSourceInstanceListItem } from './getDefaultDataSourceInstanceListItem';\n\n/** Declared here because `@grafana/runtime` lacks it on older supported hosts. */\nexport interface UseDefaultDataSourceInstanceListItemResult {\n isLoading: boolean;\n error?: Error;\n item?: DataSourceInstanceListItem;\n}\n\n/**\n * Uses the host hook when available, which also re-resolves on data source cache changes; otherwise\n * resolves synchronously on every render. Picked once at load so the hook order stays stable.\n */\nexport const useDefaultDataSourceInstanceListItem: (\n items: DataSourceInstanceListItem[]\n) => UseDefaultDataSourceInstanceListItemResult =\n typeof stableUseDefaultDataSourceInstanceListItem === 'function'\n ? stableUseDefaultDataSourceInstanceListItem\n : useBackwardsCompatibleDefaultDataSourceInstanceListItem;\n\nfunction useBackwardsCompatibleDefaultDataSourceInstanceListItem(\n items: DataSourceInstanceListItem[]\n): UseDefaultDataSourceInstanceListItemResult {\n return { isLoading: false, item: backwardsCompatibleGetDefaultDataSourceInstanceListItem(items) };\n}\n"],"names":["stableUseDefaultDataSourceInstanceListItem"],"mappings":";;;;AAgBO,MAAM,oCAAA,GAGX,OAAOA,sCAAA,KAA+C,UAAA,GAClDA,sCAAA,GACA;AAEN,SAAS,wDACP,KAAA,EAC4C;AAC5C,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,IAAA,EAAM,uDAAA,CAAwD,KAAK,CAAA,EAAE;AAClG;;;;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Grafana Labs",
3
3
  "license": "Apache-2.0",
4
4
  "name": "@grafana/plugin-compat",
5
- "version": "0.7.0",
5
+ "version": "0.8.0",
6
6
  "description": "Compatibility shims that let Grafana plugins adopt new Grafana host APIs across a range of host versions",
7
7
  "keywords": [
8
8
  "grafana",
@@ -64,7 +64,7 @@
64
64
  "@grafana/schema": ">=12.0.0",
65
65
  "react": ">=18"
66
66
  },
67
- "gitHead": "16d2470a4ef8f86171fd6e24dbffb706a8451292",
67
+ "gitHead": "a94e8f9511a6ee25f9a8fec20bb72f31a45ff2c4",
68
68
  "scripts": {
69
69
  "build": "tsc -p ./tsconfig.build.json && rollup -c rollup.config.ts --configPlugin esbuild",
70
70
  "bundle": "rollup -c rollup.config.ts --configPlugin esbuild",