@perses-dev/plugin-system 0.8.0 → 0.9.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/dist/cjs/components/PluginRegistry/PluginRegistry.js +43 -29
- package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +114 -38
- package/dist/cjs/components/PluginRegistry/index.js +17 -18
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +23 -20
- package/dist/cjs/components/PluginRegistry/plugin-registry-model.js +17 -7
- package/dist/cjs/components/PluginRegistry/test-plugins/bert/index.js +22 -12
- package/dist/cjs/components/PluginRegistry/test-plugins/ernie/index.js +20 -8
- package/dist/cjs/components/PluginRegistry/test-plugins/index.js +59 -39
- package/dist/cjs/components/index.js +17 -20
- package/dist/cjs/index.js +19 -20
- package/dist/cjs/model/datasource.js +16 -0
- package/dist/cjs/model/index.js +21 -21
- package/dist/cjs/model/panels.js +4 -21
- package/dist/cjs/model/plugins.js +4 -7
- package/dist/cjs/model/time-series-queries.js +16 -0
- package/dist/cjs/model/variables.js +5 -17
- package/dist/cjs/model/visual-editing.js +10 -2
- package/dist/cjs/runtime/datasources.js +20 -13
- package/dist/cjs/runtime/index.js +22 -21
- package/dist/cjs/runtime/plugins.js +25 -22
- package/dist/cjs/runtime/query-string.js +17 -10
- package/dist/cjs/runtime/template-variables.js +34 -16
- package/dist/cjs/runtime/time-range.js +17 -10
- package/dist/cjs/runtime/time-series-queries.js +58 -0
- package/dist/cjs/test/render.js +32 -13
- package/dist/cjs/test/setup-tests.js +4 -10
- package/dist/cjs/utils/cache-keys.js +8 -7
- package/dist/components/PluginRegistry/PluginRegistry.js +81 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.js +142 -1
- package/dist/components/PluginRegistry/PluginRegistry.test.js.map +1 -0
- package/dist/components/PluginRegistry/index.js +16 -1
- package/dist/components/PluginRegistry/index.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.js +66 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-registry-model.d.ts +1 -2
- package/dist/components/PluginRegistry/plugin-registry-model.d.ts.map +1 -1
- package/dist/components/PluginRegistry/plugin-registry-model.js +23 -1
- package/dist/components/PluginRegistry/plugin-registry-model.js.map +1 -0
- package/dist/components/PluginRegistry/test-plugins/bert/index.js +25 -1
- package/dist/components/PluginRegistry/test-plugins/bert/index.js.map +1 -0
- package/dist/components/PluginRegistry/test-plugins/ernie/index.d.ts.map +1 -1
- package/dist/components/PluginRegistry/test-plugins/ernie/index.js +30 -1
- package/dist/components/PluginRegistry/test-plugins/ernie/index.js.map +1 -0
- package/dist/components/PluginRegistry/test-plugins/index.js +35 -1
- package/dist/components/PluginRegistry/test-plugins/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +15 -1
- package/dist/components/index.js.map +1 -0
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -0
- package/dist/model/datasource.d.ts +9 -0
- package/dist/model/datasource.d.ts.map +1 -0
- package/dist/model/datasource.js +15 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/index.d.ts +2 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +20 -1
- package/dist/model/index.js.map +1 -0
- package/dist/model/panels.d.ts +7 -11
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js +15 -1
- package/dist/model/panels.js.map +1 -0
- package/dist/model/plugins.d.ts +16 -25
- package/dist/model/plugins.d.ts.map +1 -1
- package/dist/model/plugins.js +15 -1
- package/dist/model/plugins.js.map +1 -0
- package/dist/model/time-series-queries.d.ts +28 -0
- package/dist/model/time-series-queries.d.ts.map +1 -0
- package/dist/model/time-series-queries.js +15 -0
- package/dist/model/time-series-queries.js.map +1 -0
- package/dist/model/variables.d.ts +16 -11
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js +15 -1
- package/dist/model/variables.js.map +1 -0
- package/dist/model/visual-editing.d.ts +5 -6
- package/dist/model/visual-editing.d.ts.map +1 -1
- package/dist/model/visual-editing.js +15 -1
- package/dist/model/visual-editing.js.map +1 -0
- package/dist/runtime/datasources.d.ts +5 -9
- package/dist/runtime/datasources.d.ts.map +1 -1
- package/dist/runtime/datasources.js +23 -1
- package/dist/runtime/datasources.js.map +1 -0
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +20 -1
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/plugins.d.ts +5 -14
- package/dist/runtime/plugins.d.ts.map +1 -1
- package/dist/runtime/plugins.js +33 -1
- package/dist/runtime/plugins.js.map +1 -0
- package/dist/runtime/query-string.js +25 -1
- package/dist/runtime/query-string.js.map +1 -0
- package/dist/runtime/template-variables.d.ts +10 -1
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +44 -1
- package/dist/runtime/template-variables.js.map +1 -0
- package/dist/runtime/time-range.js +25 -1
- package/dist/runtime/time-range.js.map +1 -0
- package/dist/runtime/time-series-queries.d.ts +14 -0
- package/dist/runtime/time-series-queries.d.ts.map +1 -0
- package/dist/runtime/time-series-queries.js +54 -0
- package/dist/runtime/time-series-queries.js.map +1 -0
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +42 -1
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +16 -1
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/utils/cache-keys.js +19 -1
- package/dist/utils/cache-keys.js.map +1 -0
- package/package.json +11 -8
- package/dist/cjs/components/PluginBoundary.js +0 -14
- package/dist/cjs/components/PluginLoadingBoundary/PluginLoader.js +0 -39
- package/dist/cjs/components/PluginLoadingBoundary/PluginLoadingBoundary.js +0 -85
- package/dist/cjs/components/PluginLoadingBoundary/index.js +0 -29
- package/dist/cjs/components/PluginRegistry/legacy/PluginRegistry.js +0 -57
- package/dist/cjs/components/PluginRegistry/legacy/index.js +0 -29
- package/dist/cjs/components/PluginRegistry/legacy/registry-state.js +0 -97
- package/dist/cjs/components/PluginRegistry/test-plugins/bert/plugin.json +0 -32
- package/dist/cjs/components/PluginRegistry/test-plugins/ernie/plugin.json +0 -24
- package/dist/cjs/model/graph-queries.js +0 -28
- package/dist/components/PluginBoundary.d.ts +0 -13
- package/dist/components/PluginBoundary.d.ts.map +0 -1
- package/dist/components/PluginBoundary.js +0 -1
- package/dist/components/PluginLoadingBoundary/PluginLoader.d.ts +0 -11
- package/dist/components/PluginLoadingBoundary/PluginLoader.d.ts.map +0 -1
- package/dist/components/PluginLoadingBoundary/PluginLoader.js +0 -1
- package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.d.ts +0 -27
- package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.d.ts.map +0 -1
- package/dist/components/PluginLoadingBoundary/PluginLoadingBoundary.js +0 -1
- package/dist/components/PluginLoadingBoundary/index.d.ts +0 -2
- package/dist/components/PluginLoadingBoundary/index.d.ts.map +0 -1
- package/dist/components/PluginLoadingBoundary/index.js +0 -1
- package/dist/components/PluginRegistry/legacy/PluginRegistry.d.ts +0 -29
- package/dist/components/PluginRegistry/legacy/PluginRegistry.d.ts.map +0 -1
- package/dist/components/PluginRegistry/legacy/PluginRegistry.js +0 -1
- package/dist/components/PluginRegistry/legacy/index.d.ts +0 -2
- package/dist/components/PluginRegistry/legacy/index.d.ts.map +0 -1
- package/dist/components/PluginRegistry/legacy/index.js +0 -1
- package/dist/components/PluginRegistry/legacy/registry-state.d.ts +0 -18
- package/dist/components/PluginRegistry/legacy/registry-state.d.ts.map +0 -1
- package/dist/components/PluginRegistry/legacy/registry-state.js +0 -1
- package/dist/components/PluginRegistry/test-plugins/bert/plugin.json +0 -32
- package/dist/components/PluginRegistry/test-plugins/ernie/plugin.json +0 -24
- package/dist/model/graph-queries.d.ts +0 -36
- package/dist/model/graph-queries.d.ts.map +0 -1
- package/dist/model/graph-queries.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-indexes.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { useEvent } from '@perses-dev/core';\nimport { useCallback, useRef } from 'react';\nimport { PluginMetadata, PluginModuleResource } from '../../model';\nimport { getTypeAndKindKey } from '../../utils/cache-keys';\n\nexport type GetInstalledPlugins = () => Promise<PluginModuleResource[]>;\n\nexport interface PluginIndexes {\n // Plugin resources by plugin type and kind (i.e. look up what module a plugin type and kind is in)\n pluginResourcesByTypeAndKind: Map<string, PluginModuleResource>;\n // Plugin metadata by plugin type\n pluginMetadataByType: Map<string, PluginMetadata[]>;\n}\n\n/**\n * Returns an async callback for getting indexes of the installed plugin data.\n */\nexport function usePluginIndexes(getInstalledPlugins: GetInstalledPlugins) {\n // Creates indexes from the installed plugins data (does useEvent because this accesses the getInstalledPlugins prop\n // and we want a stable reference for the callback below)\n const createPluginIndexes = useEvent(async (): Promise<PluginIndexes> => {\n const installedPlugins = await getInstalledPlugins();\n\n // Create the two indexes from the installed plugins\n const pluginResourcesByTypeAndKind = new Map<string, PluginModuleResource>();\n const pluginMetadataByType = new Map<string, PluginMetadata[]>();\n\n for (const resource of installedPlugins) {\n for (const pluginMetadata of resource.spec.plugins) {\n const { pluginType, kind } = pluginMetadata;\n\n // Index the plugin by type and kind to point at the module that contains it\n const key = getTypeAndKindKey(pluginType, kind);\n if (pluginResourcesByTypeAndKind.has(key)) {\n console.warn(`Got more than one ${pluginType} plugin for kind ${kind}`);\n }\n pluginResourcesByTypeAndKind.set(key, resource);\n\n // Index the metadata by plugin type\n let list = pluginMetadataByType.get(pluginType);\n if (list === undefined) {\n list = [];\n pluginMetadataByType.set(pluginType, list);\n }\n list.push(pluginMetadata);\n }\n }\n\n return {\n pluginResourcesByTypeAndKind,\n pluginMetadataByType,\n };\n });\n\n // De-dupe creating plugin indexes (i.e. requests to get installed plugins)\n const pluginIndexesCache = useRef<Promise<PluginIndexes> | undefined>(undefined);\n const getPluginIndexes = useCallback(() => {\n let request = pluginIndexesCache.current;\n if (request === undefined) {\n request = createPluginIndexes();\n pluginIndexesCache.current = request;\n\n // Remove failed requests from the cache so they can potentially be retried\n request.catch(() => pluginIndexesCache.current === undefined);\n }\n return request;\n }, [createPluginIndexes]);\n\n return getPluginIndexes;\n}\n"],"names":["useEvent","useCallback","useRef","getTypeAndKindKey","usePluginIndexes","getInstalledPlugins","createPluginIndexes","installedPlugins","pluginResourcesByTypeAndKind","Map","pluginMetadataByType","resource","pluginMetadata","spec","plugins","pluginType","kind","key","has","console","warn","set","list","get","undefined","push","pluginIndexesCache","getPluginIndexes","request","current","catch"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,QAAQ,kBAAkB,CAAC;AAC5C,SAASC,WAAW,EAAEC,MAAM,QAAQ,OAAO,CAAC;AAE5C,SAASC,iBAAiB,QAAQ,wBAAwB,CAAC;AAW3D;;CAEC,GACD,OAAO,SAASC,gBAAgB,CAACC,mBAAwC,EAAE;IACzE,oHAAoH;IACpH,yDAAyD;IACzD,MAAMC,mBAAmB,GAAGN,QAAQ,CAAC,UAAoC;QACvE,MAAMO,gBAAgB,GAAG,MAAMF,mBAAmB,EAAE,AAAC;QAErD,oDAAoD;QACpD,MAAMG,4BAA4B,GAAG,IAAIC,GAAG,EAAgC,AAAC;QAC7E,MAAMC,oBAAoB,GAAG,IAAID,GAAG,EAA4B,AAAC;QAEjE,KAAK,MAAME,QAAQ,IAAIJ,gBAAgB,CAAE;YACvC,KAAK,MAAMK,cAAc,IAAID,QAAQ,CAACE,IAAI,CAACC,OAAO,CAAE;gBAClD,MAAM,EAAEC,UAAU,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGJ,cAAc,AAAC;gBAE5C,4EAA4E;gBAC5E,MAAMK,GAAG,GAAGd,iBAAiB,CAACY,UAAU,EAAEC,IAAI,CAAC,AAAC;gBAChD,IAAIR,4BAA4B,CAACU,GAAG,CAACD,GAAG,CAAC,EAAE;oBACzCE,OAAO,CAACC,IAAI,CAAC,CAAC,kBAAkB,EAAEL,UAAU,CAAC,iBAAiB,EAAEC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC;gBACDR,4BAA4B,CAACa,GAAG,CAACJ,GAAG,EAAEN,QAAQ,CAAC,CAAC;gBAEhD,oCAAoC;gBACpC,IAAIW,IAAI,GAAGZ,oBAAoB,CAACa,GAAG,CAACR,UAAU,CAAC,AAAC;gBAChD,IAAIO,IAAI,KAAKE,SAAS,EAAE;oBACtBF,IAAI,GAAG,EAAE,CAAC;oBACVZ,oBAAoB,CAACW,GAAG,CAACN,UAAU,EAAEO,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACDA,IAAI,CAACG,IAAI,CAACb,cAAc,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO;YACLJ,4BAA4B;YAC5BE,oBAAoB;SACrB,CAAC;IACJ,CAAC,CAAC,AAAC;IAEH,2EAA2E;IAC3E,MAAMgB,kBAAkB,GAAGxB,MAAM,CAAqCsB,SAAS,CAAC,AAAC;IACjF,MAAMG,gBAAgB,GAAG1B,WAAW,CAAC,IAAM;QACzC,IAAI2B,OAAO,GAAGF,kBAAkB,CAACG,OAAO,AAAC;QACzC,IAAID,OAAO,KAAKJ,SAAS,EAAE;YACzBI,OAAO,GAAGtB,mBAAmB,EAAE,CAAC;YAChCoB,kBAAkB,CAACG,OAAO,GAAGD,OAAO,CAAC;YAErC,2EAA2E;YAC3EA,OAAO,CAACE,KAAK,CAAC,IAAMJ,kBAAkB,CAACG,OAAO,KAAKL,SAAS,CAAC,CAAC;QAChE,CAAC;QACD,OAAOI,OAAO,CAAC;IACjB,CAAC,EAAE;QAACtB,mBAAmB;KAAC,CAAC,AAAC;IAE1B,OAAOqB,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { JsonObject } from '@perses-dev/core';
|
|
3
2
|
import { PluginImplementation, PluginMetadata, PluginType } from '../../model';
|
|
4
3
|
export interface PluginRegistryContextType {
|
|
5
|
-
getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T
|
|
4
|
+
getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;
|
|
6
5
|
listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;
|
|
7
6
|
}
|
|
8
7
|
export declare const PluginRegistryContext: import("react").Context<PluginRegistryContextType | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry-model.d.ts","sourceRoot":"","sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"plugin-registry-model.d.ts","sourceRoot":"","sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/E,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,qBAAqB,gEAAkE,CAAC;AAErG,wBAAgB,iBAAiB,8BAMhC"}
|
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { createContext, useContext } from 'react';
|
|
14
|
+
export const PluginRegistryContext = createContext(undefined);
|
|
15
|
+
export function usePluginRegistry() {
|
|
16
|
+
const ctx = useContext(PluginRegistryContext);
|
|
17
|
+
if (ctx === undefined) {
|
|
18
|
+
throw new Error('PluginRegistryContext not found. Did you forget a provider?');
|
|
19
|
+
}
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=plugin-registry-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/PluginRegistry/plugin-registry-model.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, useContext } from 'react';\nimport { PluginImplementation, PluginMetadata, PluginType } from '../../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(pluginType: T, kind: string): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginType: PluginType): Promise<PluginMetadata[]>;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\nexport function usePluginRegistry() {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n"],"names":["createContext","useContext","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO,CAAC;AAQlD,OAAO,MAAMC,qBAAqB,GAAGF,aAAa,CAAwCG,SAAS,CAAC,CAAC;AAErG,OAAO,SAASC,iBAAiB,GAAG;IAClC,MAAMC,GAAG,GAAGJ,UAAU,CAACC,qBAAqB,CAAC,AAAC;IAC9C,IAAIG,GAAG,KAAKF,SAAS,EAAE;QACrB,MAAM,IAAIG,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IACD,OAAOD,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
// Dummy plugins to test loading
|
|
14
|
+
export const BertPanel1 = {
|
|
15
|
+
PanelComponent: ()=>null,
|
|
16
|
+
OptionsEditorComponent: ()=>null,
|
|
17
|
+
createInitialOptions: ()=>({})
|
|
18
|
+
};
|
|
19
|
+
export const BertPanel2 = {
|
|
20
|
+
PanelComponent: ()=>null,
|
|
21
|
+
OptionsEditorComponent: ()=>null,
|
|
22
|
+
createInitialOptions: ()=>({})
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/PluginRegistry/test-plugins/bert/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelPlugin } from '../../../../model';\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin = {\n PanelComponent: () => null,\n OptionsEditorComponent: () => null,\n createInitialOptions: () => ({}),\n};\n\nexport const BertPanel2: PanelPlugin = {\n PanelComponent: () => null,\n OptionsEditorComponent: () => null,\n createInitialOptions: () => ({}),\n};\n"],"names":["BertPanel1","PanelComponent","OptionsEditorComponent","createInitialOptions","BertPanel2"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,gCAAgC;AAChC,OAAO,MAAMA,UAAU,GAAgB;IACrCC,cAAc,EAAE,IAAM,IAAI;IAC1BC,sBAAsB,EAAE,IAAM,IAAI;IAClCC,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,CAAC;AAEF,OAAO,MAAMC,UAAU,GAAgB;IACrCH,cAAc,EAAE,IAAM,IAAI;IAC1BC,sBAAsB,EAAE,IAAM,IAAI;IAClCC,oBAAoB,EAAE,IAAO,CAAA,EAAE,CAAA,AAAC;CACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AAQnE,eAAO,MAAM,aAAa,EAAE,cAE3B,CAAC"}
|
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
const data = [
|
|
14
|
+
{
|
|
15
|
+
label: 'Grover',
|
|
16
|
+
value: 'Grover'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Snuffleupagus',
|
|
20
|
+
value: 'Snuffleupagus'
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
// Dummy plugin to test loading
|
|
24
|
+
export const ErnieVariable = {
|
|
25
|
+
getVariableOptions: async ()=>({
|
|
26
|
+
data
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/PluginRegistry/test-plugins/ernie/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariablePlugin, VariableOption } from '../../../../model';\n\nconst data: VariableOption[] = [\n { label: 'Grover', value: 'Grover' },\n { label: 'Snuffleupagus', value: 'Snuffleupagus' },\n];\n\n// Dummy plugin to test loading\nexport const ErnieVariable: VariablePlugin = {\n getVariableOptions: async () => ({ data }),\n};\n"],"names":["data","label","value","ErnieVariable","getVariableOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,MAAMA,IAAI,GAAqB;IAC7B;QAAEC,KAAK,EAAE,QAAQ;QAAEC,KAAK,EAAE,QAAQ;KAAE;IACpC;QAAED,KAAK,EAAE,eAAe;QAAEC,KAAK,EAAE,eAAe;KAAE;CACnD,AAAC;AAEF,+BAA+B;AAC/B,OAAO,MAAMC,aAAa,GAAmB;IAC3CC,kBAAkB,EAAE,UAAa,CAAA;YAAEJ,IAAI;SAAE,CAAA,AAAC;CAC3C,CAAC"}
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import bertResource from './bert/plugin.json';
|
|
14
|
+
import ernieResource from './ernie/plugin.json';
|
|
15
|
+
// Put all the test plugins into a Map
|
|
16
|
+
const testPlugins = new Map();
|
|
17
|
+
testPlugins.set(bertResource, ()=>import('./bert'));
|
|
18
|
+
testPlugins.set(ernieResource, ()=>import('./ernie'));
|
|
19
|
+
/**
|
|
20
|
+
* Some props for testing the PluginRegistry that use the test plugins/metadata in this folder.
|
|
21
|
+
*/ export const testRegistryProps = {
|
|
22
|
+
getInstalledPlugins: ()=>{
|
|
23
|
+
const resources = Array.from(testPlugins.keys());
|
|
24
|
+
return Promise.resolve(resources);
|
|
25
|
+
},
|
|
26
|
+
importPluginModule: (resource)=>{
|
|
27
|
+
const importFn = testPlugins.get(resource);
|
|
28
|
+
if (importFn === undefined) {
|
|
29
|
+
throw new Error('Plugin not found');
|
|
30
|
+
}
|
|
31
|
+
return importFn();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/PluginRegistry/test-plugins/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PluginModuleResource } from '../../../model';\nimport { PluginRegistryProps } from '../PluginRegistry';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n// Put all the test plugins into a Map\nconst testPlugins = new Map<PluginModuleResource, () => Promise<unknown>>();\ntestPlugins.set(bertResource as PluginModuleResource, () => import('./bert'));\ntestPlugins.set(ernieResource as PluginModuleResource, () => import('./ernie'));\n\n/**\n * Some props for testing the PluginRegistry that use the test plugins/metadata in this folder.\n */\nexport const testRegistryProps: Omit<PluginRegistryProps, 'children'> = {\n getInstalledPlugins: () => {\n const resources = Array.from(testPlugins.keys());\n return Promise.resolve(resources);\n },\n importPluginModule: (resource) => {\n const importFn = testPlugins.get(resource);\n if (importFn === undefined) {\n throw new Error('Plugin not found');\n }\n return importFn();\n },\n};\n"],"names":["bertResource","ernieResource","testPlugins","Map","set","testRegistryProps","getInstalledPlugins","resources","Array","from","keys","Promise","resolve","importPluginModule","resource","importFn","get","undefined","Error"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAOA,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAOC,aAAa,MAAM,qBAAqB,CAAC;AAEhD,sCAAsC;AACtC,MAAMC,WAAW,GAAG,IAAIC,GAAG,EAAgD,AAAC;AAC5ED,WAAW,CAACE,GAAG,CAACJ,YAAY,EAA0B,IAAM,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC9EE,WAAW,CAACE,GAAG,CAACH,aAAa,EAA0B,IAAM,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;AAEhF;;CAEC,GACD,OAAO,MAAMI,iBAAiB,GAA0C;IACtEC,mBAAmB,EAAE,IAAM;QACzB,MAAMC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAACP,WAAW,CAACQ,IAAI,EAAE,CAAC,AAAC;QACjD,OAAOC,OAAO,CAACC,OAAO,CAACL,SAAS,CAAC,CAAC;IACpC,CAAC;IACDM,kBAAkB,EAAE,CAACC,QAAQ,GAAK;QAChC,MAAMC,QAAQ,GAAGb,WAAW,CAACc,GAAG,CAACF,QAAQ,CAAC,AAAC;QAC3C,IAAIC,QAAQ,KAAKE,SAAS,EAAE;YAC1B,MAAM,IAAIC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,OAAOH,QAAQ,EAAE,CAAC;IACpB,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './PluginRegistry';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './PluginRegistry';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './components';
|
|
14
|
+
export * from './model';
|
|
15
|
+
export * from './runtime';
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './components';\nexport * from './model';\nexport * from './runtime';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InitialOptionsCallback, OptionsEditor } from './visual-editing';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin that defines options for an external system that Perses talks to for data.
|
|
4
|
+
*/
|
|
5
|
+
export interface DatasourcePlugin<Spec = unknown> {
|
|
6
|
+
OptionsEditorComponent: OptionsEditor<Spec>;
|
|
7
|
+
createInitialOptions: InitialOptionsCallback<Spec>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=datasource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,IAAI,GAAG,OAAO;IAC9C,sBAAsB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,oBAAoB,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;CACpD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=datasource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { InitialOptionsCallback, OptionsEditor } from './visual-editing';\n\n/**\n * Plugin that defines options for an external system that Perses talks to for data.\n */\nexport interface DatasourcePlugin<Spec = unknown> {\n OptionsEditorComponent: OptionsEditor<Spec>;\n createInitialOptions: InitialOptionsCallback<Spec>;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAQC"}
|
package/dist/model/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './datasource';
|
|
2
2
|
export * from './panels';
|
|
3
3
|
export * from './plugins';
|
|
4
|
+
export * from './time-series-queries';
|
|
4
5
|
export * from './variables';
|
|
5
6
|
export * from './visual-editing';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/model/index.js
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export * from './datasource';
|
|
14
|
+
export * from './panels';
|
|
15
|
+
export * from './plugins';
|
|
16
|
+
export * from './time-series-queries';
|
|
17
|
+
export * from './variables';
|
|
18
|
+
export * from './visual-editing';
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './datasource';\nexport * from './panels';\nexport * from './plugins';\nexport * from './time-series-queries';\nexport * from './variables';\nexport * from './visual-editing';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/model/panels.d.ts
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { PanelDefinition } from '@perses-dev/core';
|
|
3
3
|
import { InitialOptionsCallback, OptionsEditor } from './visual-editing';
|
|
4
4
|
/**
|
|
5
5
|
* Plugin the provides custom visualizations inside of a Panel.
|
|
6
6
|
*/
|
|
7
|
-
export interface PanelPlugin<
|
|
8
|
-
PanelComponent: React.ComponentType<PanelProps<
|
|
9
|
-
OptionsEditorComponent: OptionsEditor<
|
|
10
|
-
createInitialOptions: InitialOptionsCallback<
|
|
7
|
+
export interface PanelPlugin<Spec = unknown> {
|
|
8
|
+
PanelComponent: React.ComponentType<PanelProps<Spec>>;
|
|
9
|
+
OptionsEditorComponent: OptionsEditor<Spec>;
|
|
10
|
+
createInitialOptions: InitialOptionsCallback<Spec>;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The props provided by Perses to a panel plugin's PanelComponent.
|
|
14
14
|
*/
|
|
15
|
-
export interface PanelProps<
|
|
16
|
-
definition: PanelDefinition<
|
|
15
|
+
export interface PanelProps<Spec> {
|
|
16
|
+
definition: PanelDefinition<Spec>;
|
|
17
17
|
contentDimensions?: {
|
|
18
18
|
width: number;
|
|
19
19
|
height: number;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Hook for using a panel plugin at runtime.
|
|
24
|
-
*/
|
|
25
|
-
export declare function usePanelPlugin(kind: string): PanelPlugin<JsonObject>;
|
|
26
22
|
//# sourceMappingURL=panels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,GAAG,OAAO;IACzC,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,sBAAsB,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,oBAAoB,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,IAAI;IAC9B,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAClC,iBAAiB,CAAC,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
package/dist/model/panels.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=panels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/panels.tsx"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelDefinition } from '@perses-dev/core';\nimport { InitialOptionsCallback, OptionsEditor } from './visual-editing';\n\n/**\n * Plugin the provides custom visualizations inside of a Panel.\n */\nexport interface PanelPlugin<Spec = unknown> {\n PanelComponent: React.ComponentType<PanelProps<Spec>>;\n OptionsEditorComponent: OptionsEditor<Spec>;\n createInitialOptions: InitialOptionsCallback<Spec>;\n}\n\n/**\n * The props provided by Perses to a panel plugin's PanelComponent.\n */\nexport interface PanelProps<Spec> {\n definition: PanelDefinition<Spec>;\n contentDimensions?: {\n width: number;\n height: number;\n };\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAqBC"}
|
package/dist/model/plugins.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Metadata } from '@perses-dev/core';
|
|
2
|
+
import { TimeSeriesQueryPlugin } from './time-series-queries';
|
|
3
3
|
import { PanelPlugin } from './panels';
|
|
4
4
|
import { VariablePlugin } from './variables';
|
|
5
|
+
import { DatasourcePlugin } from './datasource';
|
|
5
6
|
/**
|
|
6
7
|
* Information about a module/package that contains plugins.
|
|
7
8
|
*/
|
|
8
9
|
export interface PluginModuleResource {
|
|
9
10
|
kind: 'PluginModule';
|
|
10
|
-
metadata:
|
|
11
|
+
metadata: Metadata;
|
|
11
12
|
spec: PluginSpec;
|
|
12
13
|
}
|
|
13
14
|
export interface PluginSpec {
|
|
@@ -25,36 +26,26 @@ export interface PluginMetadata {
|
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* All supported plugin
|
|
29
|
+
* All supported plugin types.
|
|
29
30
|
*/
|
|
30
|
-
export declare
|
|
31
|
+
export declare type PluginType = keyof SupportedPlugins;
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Map of plugin type key/string -> implementation type
|
|
33
34
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Panel: {
|
|
41
|
-
Def: PanelDefinition<Options>;
|
|
42
|
-
Impl: PanelPlugin<Options>;
|
|
43
|
-
};
|
|
44
|
-
GraphQuery: {
|
|
45
|
-
Def: GraphQueryDefinition<Options>;
|
|
46
|
-
Impl: GraphQueryPlugin<Options>;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
35
|
+
export interface SupportedPlugins {
|
|
36
|
+
Variable: VariablePlugin;
|
|
37
|
+
Panel: PanelPlugin;
|
|
38
|
+
TimeSeriesQuery: TimeSeriesQueryPlugin;
|
|
39
|
+
Datasource: DatasourcePlugin;
|
|
40
|
+
}
|
|
49
41
|
/**
|
|
50
42
|
* Union type of all available plugin implementations.
|
|
51
43
|
*/
|
|
52
|
-
export declare type Plugin
|
|
53
|
-
[Type in PluginType]: PluginImplementation<Type
|
|
44
|
+
export declare type Plugin = {
|
|
45
|
+
[Type in PluginType]: PluginImplementation<Type>;
|
|
54
46
|
}[PluginType];
|
|
55
47
|
/**
|
|
56
48
|
* The implementation for a given plugin type.
|
|
57
49
|
*/
|
|
58
|
-
export declare type PluginImplementation<Type extends PluginType
|
|
59
|
-
export {};
|
|
50
|
+
export declare type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];
|
|
60
51
|
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/model/plugins.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;GAEG;AACH,oBAAY,UAAU,GAAG,MAAM,gBAAgB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED;;GAEG;AACH,oBAAY,MAAM,GAAG;KAClB,IAAI,IAAI,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC;CACjD,CAAC,UAAU,CAAC,CAAC;AAEd;;GAEG;AACH,oBAAY,oBAAoB,CAAC,IAAI,SAAS,UAAU,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/model/plugins.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/plugins.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Metadata } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin } from './time-series-queries';\nimport { PanelPlugin } from './panels';\nimport { VariablePlugin } from './variables';\nimport { DatasourcePlugin } from './datasource';\n\n/**\n * Information about a module/package that contains plugins.\n */\nexport interface PluginModuleResource {\n kind: 'PluginModule';\n metadata: Metadata;\n spec: PluginSpec;\n}\n\nexport interface PluginSpec {\n plugins: PluginMetadata[];\n}\n\n/**\n * Metadata about an individual plugin that's part of a PluginModule.\n */\nexport interface PluginMetadata {\n pluginType: PluginType;\n kind: string;\n display: {\n name: string;\n description?: string;\n };\n}\n\n/**\n * All supported plugin types.\n */\nexport type PluginType = keyof SupportedPlugins;\n\n/**\n * Map of plugin type key/string -> implementation type\n */\nexport interface SupportedPlugins {\n Variable: VariablePlugin;\n Panel: PanelPlugin;\n TimeSeriesQuery: TimeSeriesQueryPlugin;\n Datasource: DatasourcePlugin;\n}\n\n/**\n * Union type of all available plugin implementations.\n */\nexport type Plugin = {\n [Type in PluginType]: PluginImplementation<Type>;\n}[PluginType];\n\n/**\n * The implementation for a given plugin type.\n */\nexport type PluginImplementation<Type extends PluginType> = SupportedPlugins[Type];\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WAwDmF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbsoluteTimeRange, UnixTimeMs } from '@perses-dev/core';
|
|
2
|
+
import { DatasourceStore, VariableStateMap } from '../runtime';
|
|
3
|
+
/**
|
|
4
|
+
* A plugin for running graph queries.
|
|
5
|
+
*/
|
|
6
|
+
export interface TimeSeriesQueryPlugin<Spec = unknown> {
|
|
7
|
+
getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Context available to TimeSeriesQuery plugins at runtime.
|
|
11
|
+
*/
|
|
12
|
+
export interface TimeSeriesQueryContext {
|
|
13
|
+
suggestedStepMs?: number;
|
|
14
|
+
timeRange: AbsoluteTimeRange;
|
|
15
|
+
variableState: VariableStateMap;
|
|
16
|
+
datasourceStore: DatasourceStore;
|
|
17
|
+
}
|
|
18
|
+
export interface TimeSeriesData {
|
|
19
|
+
timeRange: AbsoluteTimeRange;
|
|
20
|
+
stepMs: number;
|
|
21
|
+
series: Iterable<TimeSeries>;
|
|
22
|
+
}
|
|
23
|
+
export interface TimeSeries {
|
|
24
|
+
name: string;
|
|
25
|
+
values: Iterable<TimeSeriesValueTuple>;
|
|
26
|
+
}
|
|
27
|
+
export declare type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number];
|
|
28
|
+
//# sourceMappingURL=time-series-queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/model/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI,GAAG,OAAO;IACnD,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACzF;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;CACxC;AAED,oBAAY,oBAAoB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2022 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=time-series-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/time-series-queries.ts"],"sourcesContent":["// Copyright 2022 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { AbsoluteTimeRange, UnixTimeMs } from '@perses-dev/core';\nimport { DatasourceStore, VariableStateMap } from '../runtime';\n\n/**\n * A plugin for running graph queries.\n */\nexport interface TimeSeriesQueryPlugin<Spec = unknown> {\n getTimeSeriesData: (spec: Spec, ctx: TimeSeriesQueryContext) => Promise<TimeSeriesData>;\n}\n\n/**\n * Context available to TimeSeriesQuery plugins at runtime.\n */\nexport interface TimeSeriesQueryContext {\n suggestedStepMs?: number;\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\nexport interface TimeSeriesData {\n timeRange: AbsoluteTimeRange;\n stepMs: number;\n series: Iterable<TimeSeries>;\n}\n\nexport interface TimeSeries {\n name: string;\n values: Iterable<TimeSeriesValueTuple>;\n}\n\nexport type TimeSeriesValueTuple = [timestamp: UnixTimeMs, value: number];\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,WA+B0E"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VariableStateMap } from '../runtime';
|
|
2
|
+
import { DatasourceStore } from '../runtime';
|
|
3
|
+
export declare type VariableOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export interface GetVariableOptionsContext {
|
|
8
|
+
variables: VariableStateMap;
|
|
9
|
+
datasourceStore: DatasourceStore;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Plugin for handling custom VariableDefinitions.
|
|
4
13
|
*/
|
|
5
|
-
export interface VariablePlugin<
|
|
6
|
-
|
|
14
|
+
export interface VariablePlugin<Spec = unknown> {
|
|
15
|
+
getVariableOptions: GetVariableOptions<Spec>;
|
|
16
|
+
/** Returns a list of variables name this variable depends on. Used to optimize fetching */
|
|
17
|
+
dependsOn?: (definition: Spec) => string[];
|
|
7
18
|
}
|
|
8
19
|
/**
|
|
9
20
|
* Plugin hook responsible for getting the options of a custom variable
|
|
10
21
|
* definition.
|
|
11
22
|
*/
|
|
12
|
-
export declare type
|
|
23
|
+
export declare type GetVariableOptions<Spec> = (definition: Spec, ctx: GetVariableOptionsContext) => Promise<{
|
|
13
24
|
data: VariableOption[];
|
|
14
|
-
|
|
15
|
-
error?: Error;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Use the variable options from a variable plugin at runtime.
|
|
19
|
-
*/
|
|
20
|
-
export declare const useVariableOptions: VariablePlugin['useVariableOptions'];
|
|
25
|
+
}>;
|
|
21
26
|
//# sourceMappingURL=variables.d.ts.map
|