@grafana/plugin-compat 0.6.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.
- package/CHANGELOG.md +10 -0
- package/README.md +5 -4
- package/dist/cjs/apps.cjs +26 -7
- package/dist/cjs/apps.cjs.map +1 -1
- package/dist/cjs/datasources/getDataSourceInstance.cjs +0 -4
- package/dist/cjs/datasources/getDataSourceInstance.cjs.map +1 -1
- package/dist/cjs/datasources/getDataSourceInstanceList.cjs +0 -4
- package/dist/cjs/datasources/getDataSourceInstanceList.cjs.map +1 -1
- package/dist/cjs/datasources/getDataSourceInstanceSettings.cjs +0 -4
- package/dist/cjs/datasources/getDataSourceInstanceSettings.cjs.map +1 -1
- package/dist/cjs/datasources/getDefaultDataSourceInstanceListItem.cjs +0 -4
- package/dist/cjs/datasources/getDefaultDataSourceInstanceListItem.cjs.map +1 -1
- package/dist/cjs/datasources/registerRuntimeDataSourceInstance.cjs +0 -4
- package/dist/cjs/datasources/registerRuntimeDataSourceInstance.cjs.map +1 -1
- package/dist/cjs/datasources/useDataSourceInstance.cjs +1 -2
- package/dist/cjs/datasources/useDataSourceInstance.cjs.map +1 -1
- package/dist/cjs/datasources/useDataSourceInstanceList.cjs +1 -2
- package/dist/cjs/datasources/useDataSourceInstanceList.cjs.map +1 -1
- package/dist/cjs/datasources/useDefaultDataSourceInstanceListItem.cjs +1 -2
- package/dist/cjs/datasources/useDefaultDataSourceInstanceListItem.cjs.map +1 -1
- package/dist/esm/apps.mjs +27 -9
- package/dist/esm/apps.mjs.map +1 -1
- package/dist/esm/datasources/getDataSourceInstance.mjs +0 -4
- package/dist/esm/datasources/getDataSourceInstance.mjs.map +1 -1
- package/dist/esm/datasources/getDataSourceInstanceList.mjs +0 -4
- package/dist/esm/datasources/getDataSourceInstanceList.mjs.map +1 -1
- package/dist/esm/datasources/getDataSourceInstanceSettings.mjs +0 -4
- package/dist/esm/datasources/getDataSourceInstanceSettings.mjs.map +1 -1
- package/dist/esm/datasources/getDefaultDataSourceInstanceListItem.mjs +0 -4
- package/dist/esm/datasources/getDefaultDataSourceInstanceListItem.mjs.map +1 -1
- package/dist/esm/datasources/registerRuntimeDataSourceInstance.mjs +0 -4
- package/dist/esm/datasources/registerRuntimeDataSourceInstance.mjs.map +1 -1
- package/dist/esm/datasources/useDataSourceInstance.mjs +1 -2
- package/dist/esm/datasources/useDataSourceInstance.mjs.map +1 -1
- package/dist/esm/datasources/useDataSourceInstanceList.mjs +1 -2
- package/dist/esm/datasources/useDataSourceInstanceList.mjs.map +1 -1
- package/dist/esm/datasources/useDefaultDataSourceInstanceListItem.mjs +1 -2
- package/dist/esm/datasources/useDefaultDataSourceInstanceListItem.mjs.map +1 -1
- package/dist/types/apps.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
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
|
+
|
|
7
|
+
# 0.7.0 (2026-11-03)
|
|
8
|
+
|
|
9
|
+
Add `getAppPluginHealth` function.
|
|
10
|
+
|
|
1
11
|
# 0.6.0 (2026-10-22)
|
|
2
12
|
|
|
3
13
|
Add `useDataSourceInstanceList` and the `GetDataSourceInstanceListFilters` type to `@grafana/plugin-compat/datasources`. The hook uses the host's stable `@grafana/runtime` hook when available, then `@grafana/runtime/unstable`, then fetches through `getDataSourceInstanceList`, so it works on hosts without the async data source hooks.
|
package/README.md
CHANGED
|
@@ -21,9 +21,7 @@ Ships both ESM and CommonJS builds, so it works with `import` and `require`.
|
|
|
21
21
|
`useDefaultDataSourceInstanceListItem` hook, `useDataSourceInstanceList`, and
|
|
22
22
|
`registerRuntimeDataSourceInstance`. Replacements for `getDataSourceSrv()`
|
|
23
23
|
methods.
|
|
24
|
-
- `@grafana/plugin-compat/apps` — `getPluginSettings`,
|
|
25
|
-
`updateAppPluginSettings`. Replacements for the `getBackendSrv()`
|
|
26
|
-
plugin-settings endpoints.
|
|
24
|
+
- `@grafana/plugin-compat/apps` — `getPluginSettings`, `updateAppPluginSettings`, `getAppPluginHealth`. Replacements for the `getBackendSrv()` plugin-settings and app-health endpoints.
|
|
27
25
|
|
|
28
26
|
## Usage
|
|
29
27
|
|
|
@@ -35,10 +33,11 @@ import {
|
|
|
35
33
|
registerRuntimeDataSourceInstance,
|
|
36
34
|
useDefaultDataSourceInstanceListItem,
|
|
37
35
|
} from '@grafana/plugin-compat/datasources';
|
|
38
|
-
import { getPluginSettings } from '@grafana/plugin-compat/apps';
|
|
36
|
+
import { getAppPluginHealth, getPluginSettings } from '@grafana/plugin-compat/apps';
|
|
39
37
|
|
|
40
38
|
const ds = await getDataSourceInstance({ uid: 'my-uid' });
|
|
41
39
|
const settings = await getPluginSettings('my-plugin-id');
|
|
40
|
+
const health = await getAppPluginHealth('my-plugin-id');
|
|
42
41
|
|
|
43
42
|
// `undefined` unless the org default is one of the items.
|
|
44
43
|
const items = await getDataSourceInstanceList({ type: 'prometheus' });
|
|
@@ -50,5 +49,7 @@ const { isLoading, error, item } = useDefaultDataSourceInstanceListItem(items);
|
|
|
50
49
|
registerRuntimeDataSourceInstance({ dataSource: new MyRuntimeDataSource('my-plugin-id', 'my-uid') });
|
|
51
50
|
```
|
|
52
51
|
|
|
52
|
+
`getAppPluginHealth` resolves with the health result for both healthy and unhealthy responses. Inspect `health?.status`; authentication, transport, and other non-health failures reject. The k8s path defaults an omitted message to an empty string; legacy health responses are returned unchanged. Known non-app plugins return `undefined` when k8s metadata is available.
|
|
53
|
+
|
|
53
54
|
On hosts with the async APIs, a data source registered this way is not visible
|
|
54
55
|
to `getDataSourceSrv()`. Look it up with `getDataSourceInstance` instead.
|
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,16 +21,39 @@ 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) {
|
|
34
27
|
await runtime.getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });
|
|
35
28
|
return backwardsCompatibleGetPluginSettings(pluginId);
|
|
36
29
|
}
|
|
30
|
+
async function getAppPluginHealth(pluginId, showErrorAlert = false, apiVersion) {
|
|
31
|
+
if (typeof runtime.getAppPluginHealth === "function") {
|
|
32
|
+
return runtime.getAppPluginHealth(pluginId, showErrorAlert, apiVersion);
|
|
33
|
+
}
|
|
34
|
+
return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);
|
|
35
|
+
}
|
|
36
|
+
function isLegacyUnhealthyHealthCheckError(err) {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
return runtime.isFetchError(err) && err.status === 400 && (((_a = err.data) == null ? void 0 : _a.status) === runtime.HealthStatus.Error || ((_b = err.data) == null ? void 0 : _b.status) === runtime.HealthStatus.Unknown);
|
|
39
|
+
}
|
|
40
|
+
async function backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert = false) {
|
|
41
|
+
return runtime.getBackendSrv().get(`/api/plugins/${pluginId}/health`, void 0, void 0, {
|
|
42
|
+
showErrorAlert,
|
|
43
|
+
validatePath: true
|
|
44
|
+
}).catch((err) => {
|
|
45
|
+
if (runtime.isFetchError(err) && (err.status === 401 || err.status === 403)) {
|
|
46
|
+
err.isHandled = true;
|
|
47
|
+
return Promise.reject(err);
|
|
48
|
+
}
|
|
49
|
+
if (isLegacyUnhealthyHealthCheckError(err)) {
|
|
50
|
+
return err.data;
|
|
51
|
+
}
|
|
52
|
+
return Promise.reject(err);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
37
55
|
|
|
56
|
+
exports.getAppPluginHealth = getAppPluginHealth;
|
|
38
57
|
exports.getPluginSettings = getPluginSettings;
|
|
39
58
|
exports.updateAppPluginSettings = updateAppPluginSettings;
|
|
40
59
|
//# sourceMappingURL=apps.cjs.map
|
package/dist/cjs/apps.cjs.map
CHANGED
|
@@ -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
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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
|
-
import { getPluginSettings as getPluginSettings$1, getBackendSrv, updateAppPluginSettings as updateAppPluginSettings$1 } from '@grafana/runtime';
|
|
2
|
-
import { getPluginSettings as getPluginSettings$2, updateAppPluginSettings as updateAppPluginSettings$2 } from '@grafana/runtime/unstable';
|
|
1
|
+
import { getPluginSettings as getPluginSettings$1, getBackendSrv, updateAppPluginSettings as updateAppPluginSettings$1, getAppPluginHealth as getAppPluginHealth$1, isFetchError, HealthStatus } from '@grafana/runtime';
|
|
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,15 +17,37 @@ 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) {
|
|
30
23
|
await getBackendSrv().post(`/api/plugins/${pluginId}/settings`, data, { validatePath: true });
|
|
31
24
|
return backwardsCompatibleGetPluginSettings(pluginId);
|
|
32
25
|
}
|
|
26
|
+
async function getAppPluginHealth(pluginId, showErrorAlert = false, apiVersion) {
|
|
27
|
+
if (typeof getAppPluginHealth$1 === "function") {
|
|
28
|
+
return getAppPluginHealth$1(pluginId, showErrorAlert, apiVersion);
|
|
29
|
+
}
|
|
30
|
+
return backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert);
|
|
31
|
+
}
|
|
32
|
+
function isLegacyUnhealthyHealthCheckError(err) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return isFetchError(err) && err.status === 400 && (((_a = err.data) == null ? void 0 : _a.status) === HealthStatus.Error || ((_b = err.data) == null ? void 0 : _b.status) === HealthStatus.Unknown);
|
|
35
|
+
}
|
|
36
|
+
async function backwardsCompatibleGetAppPluginHealth(pluginId, showErrorAlert = false) {
|
|
37
|
+
return getBackendSrv().get(`/api/plugins/${pluginId}/health`, void 0, void 0, {
|
|
38
|
+
showErrorAlert,
|
|
39
|
+
validatePath: true
|
|
40
|
+
}).catch((err) => {
|
|
41
|
+
if (isFetchError(err) && (err.status === 401 || err.status === 403)) {
|
|
42
|
+
err.isHandled = true;
|
|
43
|
+
return Promise.reject(err);
|
|
44
|
+
}
|
|
45
|
+
if (isLegacyUnhealthyHealthCheckError(err)) {
|
|
46
|
+
return err.data;
|
|
47
|
+
}
|
|
48
|
+
return Promise.reject(err);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
33
51
|
|
|
34
|
-
export { getPluginSettings, updateAppPluginSettings };
|
|
52
|
+
export { getAppPluginHealth, getPluginSettings, updateAppPluginSettings };
|
|
35
53
|
//# sourceMappingURL=apps.mjs.map
|
package/dist/esm/apps.mjs.map
CHANGED
|
@@ -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
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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 :
|
|
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';\
|
|
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/dist/types/apps.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type PluginMeta } from '@grafana/data';
|
|
2
|
+
import { type HealthCheckResult } from '@grafana/runtime';
|
|
2
3
|
export declare function getPluginSettings(pluginId: string, showErrorAlert?: boolean): Promise<PluginMeta>;
|
|
3
4
|
export declare function updateAppPluginSettings(pluginId: string, data: Partial<PluginMeta>): Promise<PluginMeta>;
|
|
5
|
+
export declare function getAppPluginHealth(pluginId: string, showErrorAlert?: boolean, apiVersion?: string): Promise<HealthCheckResult | undefined>;
|
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.
|
|
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": "
|
|
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",
|