@perses-dev/plugin-system 0.0.0-snapshot-time-range-height-80d08fc
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/LICENSE +201 -0
- package/dist/cjs/components/CalculationSelector/CalculationSelector.js +52 -0
- package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +65 -0
- package/dist/cjs/components/CalculationSelector/index.js +28 -0
- package/dist/cjs/components/DatasourceSelect.js +76 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +102 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +167 -0
- package/dist/cjs/components/OptionsEditorTabs/TabPanel.js +37 -0
- package/dist/cjs/components/OptionsEditorTabs/index.js +28 -0
- package/dist/cjs/components/PluginEditor/PluginEditor.js +67 -0
- package/dist/cjs/components/PluginEditor/PluginEditor.test.js +150 -0
- package/dist/cjs/components/PluginEditor/index.js +29 -0
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +101 -0
- package/dist/cjs/components/PluginKindSelect.js +41 -0
- package/dist/cjs/components/PluginKindSelect.test.js +86 -0
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +85 -0
- package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +144 -0
- package/dist/cjs/components/PluginRegistry/index.js +28 -0
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +78 -0
- package/dist/cjs/components/PluginSpecEditor.js +43 -0
- package/dist/cjs/components/PluginSpecEditor.test.js +70 -0
- package/dist/cjs/components/TimeSeriesQueryEditor.js +42 -0
- package/dist/cjs/components/index.js +35 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/model/calculations.js +77 -0
- package/dist/cjs/model/datasource.js +16 -0
- package/dist/cjs/model/index.js +35 -0
- package/dist/cjs/model/panels.js +16 -0
- package/dist/cjs/model/plugin-base.js +22 -0
- package/dist/cjs/model/plugin-loading.js +38 -0
- package/dist/cjs/model/plugins.js +16 -0
- package/dist/cjs/model/time-series-queries.js +16 -0
- package/dist/cjs/model/variables.js +16 -0
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +118 -0
- package/dist/cjs/runtime/TimeRangeProvider/index.js +29 -0
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +161 -0
- package/dist/cjs/runtime/datasources.js +44 -0
- package/dist/cjs/runtime/index.js +32 -0
- package/dist/cjs/runtime/plugin-registry.js +75 -0
- package/dist/cjs/runtime/template-variables.js +57 -0
- package/dist/cjs/runtime/time-series-queries.js +140 -0
- package/dist/cjs/test/index.js +28 -0
- package/dist/cjs/test/render.js +52 -0
- package/dist/cjs/test/setup-tests.js +20 -0
- package/dist/cjs/test/test-plugins/bert/index.js +77 -0
- package/dist/cjs/test/test-plugins/ernie/index.js +58 -0
- package/dist/cjs/test/test-plugins/index.js +77 -0
- package/dist/cjs/test-utils/index.js +28 -0
- package/dist/cjs/test-utils/mock-plugin-registry.js +68 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts +8 -0
- package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.js +46 -0
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +2 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +1 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.js +58 -0
- package/dist/components/CalculationSelector/CalculationSelector.test.js.map +1 -0
- package/dist/components/CalculationSelector/index.d.ts +2 -0
- package/dist/components/CalculationSelector/index.d.ts.map +1 -0
- package/dist/components/CalculationSelector/index.js +15 -0
- package/dist/components/CalculationSelector/index.js.map +1 -0
- package/dist/components/DatasourceSelect.d.ts +16 -0
- package/dist/components/DatasourceSelect.d.ts.map +1 -0
- package/dist/components/DatasourceSelect.js +73 -0
- package/dist/components/DatasourceSelect.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +34 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +96 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +2 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +160 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +1 -0
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/TabPanel.js +31 -0
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabs/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabs/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabs/index.js +15 -0
- package/dist/components/OptionsEditorTabs/index.js.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.d.ts +12 -0
- package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.js +68 -0
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.test.d.ts +2 -0
- package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +1 -0
- package/dist/components/PluginEditor/PluginEditor.test.js +143 -0
- package/dist/components/PluginEditor/PluginEditor.test.js.map +1 -0
- package/dist/components/PluginEditor/index.d.ts +3 -0
- package/dist/components/PluginEditor/index.d.ts.map +1 -0
- package/dist/components/PluginEditor/index.js +16 -0
- package/dist/components/PluginEditor/index.js.map +1 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts +30 -0
- package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -0
- package/dist/components/PluginEditor/plugin-editor-api.js +100 -0
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -0
- package/dist/components/PluginKindSelect.d.ts +12 -0
- package/dist/components/PluginKindSelect.d.ts.map +1 -0
- package/dist/components/PluginKindSelect.js +38 -0
- package/dist/components/PluginKindSelect.js.map +1 -0
- package/dist/components/PluginKindSelect.test.d.ts +2 -0
- package/dist/components/PluginKindSelect.test.d.ts.map +1 -0
- package/dist/components/PluginKindSelect.test.js +79 -0
- package/dist/components/PluginKindSelect.test.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.d.ts +13 -0
- package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.js +82 -0
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +2 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +1 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.js +137 -0
- package/dist/components/PluginRegistry/PluginRegistry.test.js.map +1 -0
- package/dist/components/PluginRegistry/index.d.ts +2 -0
- package/dist/components/PluginRegistry/index.d.ts.map +1 -0
- package/dist/components/PluginRegistry/index.js +15 -0
- package/dist/components/PluginRegistry/index.js.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts +14 -0
- package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -0
- package/dist/components/PluginRegistry/plugin-indexes.js +70 -0
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -0
- package/dist/components/PluginSpecEditor.d.ts +9 -0
- package/dist/components/PluginSpecEditor.d.ts.map +1 -0
- package/dist/components/PluginSpecEditor.js +37 -0
- package/dist/components/PluginSpecEditor.js.map +1 -0
- package/dist/components/PluginSpecEditor.test.d.ts +2 -0
- package/dist/components/PluginSpecEditor.test.d.ts.map +1 -0
- package/dist/components/PluginSpecEditor.test.js +63 -0
- package/dist/components/PluginSpecEditor.test.js.map +1 -0
- package/dist/components/TimeSeriesQueryEditor.d.ts +14 -0
- package/dist/components/TimeSeriesQueryEditor.d.ts.map +1 -0
- package/dist/components/TimeSeriesQueryEditor.js +38 -0
- package/dist/components/TimeSeriesQueryEditor.js.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +22 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/model/calculations.d.ts +21 -0
- package/dist/model/calculations.d.ts.map +1 -0
- package/dist/model/calculations.js +64 -0
- package/dist/model/calculations.js.map +1 -0
- package/dist/model/datasource.d.ts +12 -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 +9 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +22 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/panels.d.ts +20 -0
- package/dist/model/panels.d.ts.map +1 -0
- package/dist/model/panels.js +15 -0
- package/dist/model/panels.js.map +1 -0
- package/dist/model/plugin-base.d.ts +22 -0
- package/dist/model/plugin-base.d.ts.map +1 -0
- package/dist/model/plugin-base.js +15 -0
- package/dist/model/plugin-base.js.map +1 -0
- package/dist/model/plugin-loading.d.ts +22 -0
- package/dist/model/plugin-loading.d.ts.map +1 -0
- package/dist/model/plugin-loading.js +35 -0
- package/dist/model/plugin-loading.js.map +1 -0
- package/dist/model/plugins.d.ts +54 -0
- package/dist/model/plugins.d.ts.map +1 -0
- package/dist/model/plugins.js +15 -0
- package/dist/model/plugins.js.map +1 -0
- package/dist/model/time-series-queries.d.ts +42 -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 +35 -0
- package/dist/model/variables.d.ts.map +1 -0
- package/dist/model/variables.js +15 -0
- package/dist/model/variables.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +25 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +69 -0
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts +3 -0
- package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/index.js +16 -0
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts +25 -0
- package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -0
- package/dist/runtime/TimeRangeProvider/query-params.js +153 -0
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -0
- package/dist/runtime/datasources.d.ts +25 -0
- package/dist/runtime/datasources.d.ts.map +1 -0
- package/dist/runtime/datasources.js +34 -0
- package/dist/runtime/datasources.js.map +1 -0
- package/dist/runtime/index.d.ts +6 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +19 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/plugin-registry.d.ts +32 -0
- package/dist/runtime/plugin-registry.d.ts.map +1 -0
- package/dist/runtime/plugin-registry.js +69 -0
- package/dist/runtime/plugin-registry.js.map +1 -0
- package/dist/runtime/template-variables.d.ts +17 -0
- package/dist/runtime/template-variables.d.ts.map +1 -0
- package/dist/runtime/template-variables.js +44 -0
- package/dist/runtime/template-variables.js.map +1 -0
- package/dist/runtime/time-series-queries.d.ts +13 -0
- package/dist/runtime/time-series-queries.d.ts.map +1 -0
- package/dist/runtime/time-series-queries.js +132 -0
- package/dist/runtime/time-series-queries.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +13 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +49 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +18 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/test/test-plugins/bert/index.d.ts +8 -0
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -0
- package/dist/test/test-plugins/bert/index.js +66 -0
- package/dist/test/test-plugins/bert/index.js.map +1 -0
- package/dist/test/test-plugins/ernie/index.d.ts +5 -0
- package/dist/test/test-plugins/ernie/index.d.ts.map +1 -0
- package/dist/test/test-plugins/ernie/index.js +53 -0
- package/dist/test/test-plugins/ernie/index.js.map +1 -0
- package/dist/test/test-plugins/index.d.ts +6 -0
- package/dist/test/test-plugins/index.d.ts.map +1 -0
- package/dist/test/test-plugins/index.js +29 -0
- package/dist/test/test-plugins/index.js.map +1 -0
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +15 -0
- package/dist/test-utils/index.js.map +1 -0
- package/dist/test-utils/mock-plugin-registry.d.ts +20 -0
- package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -0
- package/dist/test-utils/mock-plugin-registry.js +62 -0
- package/dist/test-utils/mock-plugin-registry.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
PluginRegistryContext: ()=>PluginRegistryContext,
|
|
25
|
+
usePluginRegistry: ()=>usePluginRegistry,
|
|
26
|
+
usePlugin: ()=>usePlugin,
|
|
27
|
+
usePlugins: ()=>usePlugins,
|
|
28
|
+
useListPluginMetadata: ()=>useListPluginMetadata
|
|
29
|
+
});
|
|
30
|
+
const _react = require("react");
|
|
31
|
+
const _reactQuery = require("@tanstack/react-query");
|
|
32
|
+
const PluginRegistryContext = (0, _react.createContext)(undefined);
|
|
33
|
+
function usePluginRegistry() {
|
|
34
|
+
const ctx = (0, _react.useContext)(PluginRegistryContext);
|
|
35
|
+
if (ctx === undefined) {
|
|
36
|
+
throw new Error('PluginRegistryContext not found. Did you forget a provider?');
|
|
37
|
+
}
|
|
38
|
+
return ctx;
|
|
39
|
+
}
|
|
40
|
+
function usePlugin(pluginType, kind, options) {
|
|
41
|
+
var ref;
|
|
42
|
+
// We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically
|
|
43
|
+
options = {
|
|
44
|
+
...options,
|
|
45
|
+
enabled: ((ref = options === null || options === void 0 ? void 0 : options.enabled) !== null && ref !== void 0 ? ref : true) && kind !== ''
|
|
46
|
+
};
|
|
47
|
+
const { getPlugin } = usePluginRegistry();
|
|
48
|
+
return (0, _reactQuery.useQuery)([
|
|
49
|
+
'getPlugin',
|
|
50
|
+
pluginType,
|
|
51
|
+
kind
|
|
52
|
+
], ()=>getPlugin(pluginType, kind), options);
|
|
53
|
+
}
|
|
54
|
+
function usePlugins(pluginType, plugins) {
|
|
55
|
+
const { getPlugin } = usePluginRegistry();
|
|
56
|
+
return (0, _reactQuery.useQueries)({
|
|
57
|
+
queries: plugins.map((p)=>{
|
|
58
|
+
return {
|
|
59
|
+
queryKey: [
|
|
60
|
+
'getPlugin',
|
|
61
|
+
pluginType,
|
|
62
|
+
p.kind
|
|
63
|
+
],
|
|
64
|
+
queryFn: ()=>getPlugin(pluginType, p.kind)
|
|
65
|
+
};
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function useListPluginMetadata(pluginType, options) {
|
|
70
|
+
const { listPluginMetadata } = usePluginRegistry();
|
|
71
|
+
return (0, _reactQuery.useQuery)([
|
|
72
|
+
'listPluginMetadata',
|
|
73
|
+
pluginType
|
|
74
|
+
], ()=>listPluginMetadata(pluginType), options);
|
|
75
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
DEFAULT_ALL_VALUE: ()=>DEFAULT_ALL_VALUE,
|
|
25
|
+
TemplateVariableContext: ()=>TemplateVariableContext,
|
|
26
|
+
useTemplateVariableValues: ()=>useTemplateVariableValues
|
|
27
|
+
});
|
|
28
|
+
const _react = require("react");
|
|
29
|
+
const DEFAULT_ALL_VALUE = '$__all';
|
|
30
|
+
const TemplateVariableContext = (0, _react.createContext)(undefined);
|
|
31
|
+
function useTemplateVariableContext() {
|
|
32
|
+
const ctx = (0, _react.useContext)(TemplateVariableContext);
|
|
33
|
+
if (ctx === undefined) {
|
|
34
|
+
throw new Error('No TemplateVariableContext found. Did you forget a Provider?');
|
|
35
|
+
}
|
|
36
|
+
return ctx;
|
|
37
|
+
}
|
|
38
|
+
function useTemplateVariableValues(names) {
|
|
39
|
+
const { state } = useTemplateVariableContext();
|
|
40
|
+
const values = (0, _react.useMemo)(()=>{
|
|
41
|
+
const values = {};
|
|
42
|
+
names === null || names === void 0 ? void 0 : names.forEach((name)=>{
|
|
43
|
+
const s = state[name];
|
|
44
|
+
if (s) {
|
|
45
|
+
values[name] = s;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return values;
|
|
49
|
+
}, [
|
|
50
|
+
state,
|
|
51
|
+
names
|
|
52
|
+
]);
|
|
53
|
+
if (names === undefined) {
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
return values;
|
|
57
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
useTimeSeriesQuery: ()=>useTimeSeriesQuery,
|
|
25
|
+
useTimeSeriesQueries: ()=>useTimeSeriesQueries
|
|
26
|
+
});
|
|
27
|
+
const _reactQuery = require("@tanstack/react-query");
|
|
28
|
+
const _templateVariables = require("./template-variables");
|
|
29
|
+
const _timeRangeProvider = require("./TimeRangeProvider");
|
|
30
|
+
const _datasources = require("./datasources");
|
|
31
|
+
const _pluginRegistry = require("./plugin-registry");
|
|
32
|
+
/**
|
|
33
|
+
* Returns a serialized string of the current state of variable values.
|
|
34
|
+
*/ function getVariableValuesKey(v) {
|
|
35
|
+
return Object.values(v).map((v)=>JSON.stringify(v.value)).join(',');
|
|
36
|
+
}
|
|
37
|
+
function filterVariableStateMap(v, names) {
|
|
38
|
+
if (!names) {
|
|
39
|
+
return v;
|
|
40
|
+
}
|
|
41
|
+
return Object.fromEntries(Object.entries(v).filter(([name])=>names.includes(name)));
|
|
42
|
+
}
|
|
43
|
+
function getQueryOptions({ plugin , definition , context }) {
|
|
44
|
+
const { timeRange , datasourceStore , suggestedStepMs , variableState , refreshKey } = context;
|
|
45
|
+
const dependencies = (plugin === null || plugin === void 0 ? void 0 : plugin.dependsOn) ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};
|
|
46
|
+
const variableDependencies = dependencies === null || dependencies === void 0 ? void 0 : dependencies.variables;
|
|
47
|
+
// Determine queryKey
|
|
48
|
+
const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);
|
|
49
|
+
const variablesValueKey = getVariableValuesKey(filteredVariabledState);
|
|
50
|
+
const queryKey = [
|
|
51
|
+
definition,
|
|
52
|
+
timeRange,
|
|
53
|
+
datasourceStore,
|
|
54
|
+
suggestedStepMs,
|
|
55
|
+
variablesValueKey,
|
|
56
|
+
refreshKey
|
|
57
|
+
];
|
|
58
|
+
// Determine queryEnabled
|
|
59
|
+
let waitToLoad = false;
|
|
60
|
+
if (variableDependencies) {
|
|
61
|
+
waitToLoad = variableDependencies.some((v)=>{
|
|
62
|
+
var ref;
|
|
63
|
+
return (ref = variableState[v]) === null || ref === void 0 ? void 0 : ref.loading;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const queryEnabled = plugin !== undefined && !waitToLoad;
|
|
67
|
+
return {
|
|
68
|
+
queryKey,
|
|
69
|
+
queryEnabled
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const useTimeSeriesQuery = (definition, options)=>{
|
|
73
|
+
const { data: plugin } = (0, _pluginRegistry.usePlugin)('TimeSeriesQuery', definition.spec.plugin.kind);
|
|
74
|
+
const context = useTimeSeriesQueryContext();
|
|
75
|
+
const { queryEnabled , queryKey } = getQueryOptions({
|
|
76
|
+
plugin,
|
|
77
|
+
definition,
|
|
78
|
+
context
|
|
79
|
+
});
|
|
80
|
+
return (0, _reactQuery.useQuery)({
|
|
81
|
+
enabled: queryEnabled,
|
|
82
|
+
queryKey: queryKey,
|
|
83
|
+
queryFn: ()=>{
|
|
84
|
+
// The 'enabled' option should prevent this from happening, but make TypeScript happy by checking
|
|
85
|
+
if (plugin === undefined) {
|
|
86
|
+
throw new Error('Expected plugin to be loaded');
|
|
87
|
+
}
|
|
88
|
+
// Keep options out of query key so we don't re-run queries because suggested step changes
|
|
89
|
+
const ctx = {
|
|
90
|
+
...context,
|
|
91
|
+
suggestedStepMs: options === null || options === void 0 ? void 0 : options.suggestedStepMs
|
|
92
|
+
};
|
|
93
|
+
return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
function useTimeSeriesQueries(definitions, options) {
|
|
98
|
+
const { getPlugin } = (0, _pluginRegistry.usePluginRegistry)();
|
|
99
|
+
const context = useTimeSeriesQueryContext();
|
|
100
|
+
const pluginLoaderResponse = (0, _pluginRegistry.usePlugins)('TimeSeriesQuery', definitions.map((d)=>({
|
|
101
|
+
kind: d.spec.plugin.kind
|
|
102
|
+
})));
|
|
103
|
+
return (0, _reactQuery.useQueries)({
|
|
104
|
+
queries: definitions.map((definition, idx)=>{
|
|
105
|
+
var ref;
|
|
106
|
+
const plugin = (ref = pluginLoaderResponse[idx]) === null || ref === void 0 ? void 0 : ref.data;
|
|
107
|
+
const { queryEnabled , queryKey } = getQueryOptions({
|
|
108
|
+
plugin,
|
|
109
|
+
definition,
|
|
110
|
+
context
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
enabled: queryEnabled,
|
|
114
|
+
queryKey: queryKey,
|
|
115
|
+
queryFn: async ()=>{
|
|
116
|
+
// Keep options out of query key so we don't re-run queries because suggested step changes
|
|
117
|
+
const ctx = {
|
|
118
|
+
...context,
|
|
119
|
+
suggestedStepMs: options === null || options === void 0 ? void 0 : options.suggestedStepMs
|
|
120
|
+
};
|
|
121
|
+
const plugin = await getPlugin('TimeSeriesQuery', definition.spec.plugin.kind);
|
|
122
|
+
const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx);
|
|
123
|
+
return data;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function useTimeSeriesQueryContext() {
|
|
130
|
+
// Build the context object from data available at runtime
|
|
131
|
+
const { absoluteTimeRange , refreshKey } = (0, _timeRangeProvider.useTimeRange)();
|
|
132
|
+
const variableState = (0, _templateVariables.useTemplateVariableValues)();
|
|
133
|
+
const datasourceStore = (0, _datasources.useDatasourceStore)();
|
|
134
|
+
return {
|
|
135
|
+
timeRange: absoluteTimeRange,
|
|
136
|
+
variableState,
|
|
137
|
+
datasourceStore,
|
|
138
|
+
refreshKey
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_exportStar(require("./render"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "renderWithContext", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>renderWithContext
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _react = require("@testing-library/react");
|
|
23
|
+
const _reactQuery = require("@tanstack/react-query");
|
|
24
|
+
const _pluginRegistry = require("../components/PluginRegistry");
|
|
25
|
+
const _testPlugins = require("./test-plugins");
|
|
26
|
+
const testLogger = {
|
|
27
|
+
log: console.log,
|
|
28
|
+
warn: console.warn,
|
|
29
|
+
error: ()=>{
|
|
30
|
+
// Don't log network errors in tests to the console
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function renderWithContext(ui, renderOptions, contextOptions) {
|
|
34
|
+
// Create a new QueryClient for each test to avoid caching issues
|
|
35
|
+
const queryClient = new _reactQuery.QueryClient({
|
|
36
|
+
defaultOptions: {
|
|
37
|
+
queries: {
|
|
38
|
+
refetchOnWindowFocus: false,
|
|
39
|
+
retry: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
logger: testLogger
|
|
43
|
+
});
|
|
44
|
+
return (0, _react.render)(/*#__PURE__*/ (0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
|
|
45
|
+
client: queryClient,
|
|
46
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_pluginRegistry.PluginRegistry, {
|
|
47
|
+
pluginLoader: _testPlugins.testPluginLoader,
|
|
48
|
+
defaultPluginKinds: contextOptions === null || contextOptions === void 0 ? void 0 : contextOptions.defaultPluginKinds,
|
|
49
|
+
children: ui
|
|
50
|
+
})
|
|
51
|
+
}), renderOptions);
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
// Add testing library assertions
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
19
|
+
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
20
|
+
jest.mock('echarts/core');
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
BertPanel1: ()=>BertPanel1,
|
|
25
|
+
BertPanel2: ()=>BertPanel2
|
|
26
|
+
});
|
|
27
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const BertPanel1 = {
|
|
29
|
+
PanelComponent: ()=>null,
|
|
30
|
+
OptionsEditorComponent: function BertPanel1Editor({ value , onChange }) {
|
|
31
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
|
|
34
|
+
htmlFor: "editor-input",
|
|
35
|
+
children: "BertPanel1 editor"
|
|
36
|
+
}),
|
|
37
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
|
|
38
|
+
type: "text",
|
|
39
|
+
id: "editor-input",
|
|
40
|
+
value: value.option1,
|
|
41
|
+
onChange: (e)=>onChange({
|
|
42
|
+
...value,
|
|
43
|
+
option1: e.target.value
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
createInitialOptions: ()=>({
|
|
50
|
+
option1: ''
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
const BertPanel2 = {
|
|
54
|
+
PanelComponent: ()=>null,
|
|
55
|
+
OptionsEditorComponent: function BertPanel2Editor({ value , onChange }) {
|
|
56
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
|
|
59
|
+
htmlFor: "editor-input",
|
|
60
|
+
children: "BertPanel2 editor"
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
|
|
63
|
+
type: "text",
|
|
64
|
+
id: "editor-input",
|
|
65
|
+
value: value.option2,
|
|
66
|
+
onChange: (e)=>onChange({
|
|
67
|
+
...value,
|
|
68
|
+
option2: e.target.value
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
createInitialOptions: ()=>({
|
|
75
|
+
option2: ''
|
|
76
|
+
})
|
|
77
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "ErnieVariable", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>ErnieVariable
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const data = [
|
|
23
|
+
{
|
|
24
|
+
label: 'Grover',
|
|
25
|
+
value: 'Grover'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
label: 'Snuffleupagus',
|
|
29
|
+
value: 'Snuffleupagus'
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const ErnieVariable = {
|
|
33
|
+
getVariableOptions: async ()=>({
|
|
34
|
+
data
|
|
35
|
+
}),
|
|
36
|
+
OptionsEditorComponent: function ErnieVariableEditor({ value , onChange }) {
|
|
37
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
|
|
40
|
+
htmlFor: "editor-input",
|
|
41
|
+
children: "ErnieVariable editor"
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
|
|
44
|
+
type: "text",
|
|
45
|
+
id: "editor-input",
|
|
46
|
+
value: value.variableOption,
|
|
47
|
+
onChange: (e)=>onChange({
|
|
48
|
+
...value,
|
|
49
|
+
variableOption: e.target.value
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
createInitialOptions: ()=>({
|
|
56
|
+
variableOption: ''
|
|
57
|
+
})
|
|
58
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "testPluginLoader", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>testPluginLoader
|
|
20
|
+
});
|
|
21
|
+
const _model = require("../../model");
|
|
22
|
+
const _pluginJson = /*#__PURE__*/ _interopRequireDefault(require("./bert/plugin.json"));
|
|
23
|
+
const _pluginJson1 = /*#__PURE__*/ _interopRequireDefault(require("./ernie/plugin.json"));
|
|
24
|
+
function _interopRequireDefault(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
30
|
+
if (typeof WeakMap !== "function") return null;
|
|
31
|
+
var cacheBabelInterop = new WeakMap();
|
|
32
|
+
var cacheNodeInterop = new WeakMap();
|
|
33
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
34
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
35
|
+
})(nodeInterop);
|
|
36
|
+
}
|
|
37
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
38
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
42
|
+
return {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
47
|
+
if (cache && cache.has(obj)) {
|
|
48
|
+
return cache.get(obj);
|
|
49
|
+
}
|
|
50
|
+
var newObj = {};
|
|
51
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for(var key in obj){
|
|
53
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
55
|
+
if (desc && (desc.get || desc.set)) {
|
|
56
|
+
Object.defineProperty(newObj, key, desc);
|
|
57
|
+
} else {
|
|
58
|
+
newObj[key] = obj[key];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
newObj.default = obj;
|
|
63
|
+
if (cache) {
|
|
64
|
+
cache.set(obj, newObj);
|
|
65
|
+
}
|
|
66
|
+
return newObj;
|
|
67
|
+
}
|
|
68
|
+
const testPluginLoader = (0, _model.dynamicImportPluginLoader)([
|
|
69
|
+
{
|
|
70
|
+
resource: _pluginJson.default,
|
|
71
|
+
importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./bert")))
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
resource: _pluginJson1.default,
|
|
75
|
+
importPlugin: ()=>Promise.resolve().then(()=>/*#__PURE__*/ _interopRequireWildcard(require("./ernie")))
|
|
76
|
+
}
|
|
77
|
+
]);
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_exportStar(require("./mock-plugin-registry"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|