@perses-dev/plugin-system 0.54.0-beta.1 → 0.54.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -15
  2. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +92 -0
  3. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +16 -13
  4. package/dist/cjs/components/Variables/variable-model.js +115 -29
  5. package/dist/cjs/context/ValidationProvider.js +3 -3
  6. package/dist/cjs/model/alerts-queries.js +16 -0
  7. package/dist/cjs/model/index.js +2 -0
  8. package/dist/cjs/model/log-volume-utils.js +10 -10
  9. package/dist/cjs/model/plugin-loading.js +24 -8
  10. package/dist/cjs/model/plugins.js +10 -0
  11. package/dist/cjs/model/silences-queries.js +16 -0
  12. package/dist/cjs/remote/PluginRuntime.js +38 -9
  13. package/dist/cjs/remote/remotePluginLoader.js +28 -5
  14. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +18 -2
  15. package/dist/cjs/runtime/DataQueriesProvider/model.js +30 -4
  16. package/dist/cjs/runtime/UsageMetricsProvider.js +2 -2
  17. package/dist/cjs/runtime/alerts-queries.js +101 -0
  18. package/dist/cjs/runtime/index.js +2 -0
  19. package/dist/cjs/runtime/item-actions.js +3 -3
  20. package/dist/cjs/runtime/log-queries.js +4 -1
  21. package/dist/cjs/runtime/plugin-registry.js +12 -3
  22. package/dist/cjs/runtime/profile-queries.js +4 -1
  23. package/dist/cjs/runtime/silences-queries.js +101 -0
  24. package/dist/cjs/runtime/time-series-queries.js +4 -1
  25. package/dist/cjs/runtime/trace-queries.js +4 -1
  26. package/dist/cjs/test/mock-data.js +51 -0
  27. package/dist/cjs/test/test-plugins/bert/index.js +9 -12
  28. package/dist/cjs/test/test-plugins/ernie/index.js +9 -12
  29. package/dist/cjs/test/test-plugins/index.js +2 -2
  30. package/dist/cjs/test-utils/mock-plugin-registry.js +8 -2
  31. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  32. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  33. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -1
  34. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  35. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +1 -1
  36. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  37. package/dist/components/DatasourceSelect/DatasourceSelect.js +2 -2
  38. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  39. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
  40. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  41. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +1 -1
  42. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  43. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1 -1
  44. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  45. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +1 -1
  46. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  47. package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
  48. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  49. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  50. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  51. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +1 -1
  52. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  53. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
  54. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  55. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  56. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  57. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
  58. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  59. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +1 -1
  60. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  61. package/dist/components/PluginEditor/PluginEditor.js +1 -1
  62. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  63. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  64. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  65. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  66. package/dist/components/PluginRegistry/PluginRegistry.js +12 -16
  67. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  68. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +12 -0
  69. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -0
  70. package/dist/components/PluginRegistry/getPluginSearchHelper.js +88 -0
  71. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -0
  72. package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -6
  73. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  74. package/dist/components/PluginRegistry/plugin-indexes.js +15 -13
  75. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  76. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  77. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  78. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  79. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +1 -1
  80. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  81. package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -1
  82. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  83. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +1 -1
  84. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  85. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
  86. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  87. package/dist/components/Variables/variable-model.d.ts +9 -1
  88. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  89. package/dist/components/Variables/variable-model.js +117 -31
  90. package/dist/components/Variables/variable-model.js.map +1 -1
  91. package/dist/context/ValidationProvider.d.ts +1 -1
  92. package/dist/context/ValidationProvider.d.ts.map +1 -1
  93. package/dist/context/ValidationProvider.js +2 -2
  94. package/dist/context/ValidationProvider.js.map +1 -1
  95. package/dist/model/alerts-queries.d.ts +33 -0
  96. package/dist/model/alerts-queries.d.ts.map +1 -0
  97. package/dist/model/alerts-queries.js +15 -0
  98. package/dist/model/alerts-queries.js.map +1 -0
  99. package/dist/model/datasource.d.ts +1 -8
  100. package/dist/model/datasource.d.ts.map +1 -1
  101. package/dist/model/datasource.js +1 -1
  102. package/dist/model/datasource.js.map +1 -1
  103. package/dist/model/index.d.ts +2 -0
  104. package/dist/model/index.d.ts.map +1 -1
  105. package/dist/model/index.js +2 -0
  106. package/dist/model/index.js.map +1 -1
  107. package/dist/model/plugin-loading.d.ts.map +1 -1
  108. package/dist/model/plugin-loading.js +24 -8
  109. package/dist/model/plugin-loading.js.map +1 -1
  110. package/dist/model/plugins.d.ts +21 -0
  111. package/dist/model/plugins.d.ts.map +1 -1
  112. package/dist/model/plugins.js +4 -1
  113. package/dist/model/plugins.js.map +1 -1
  114. package/dist/model/silences-queries.d.ts +33 -0
  115. package/dist/model/silences-queries.d.ts.map +1 -0
  116. package/dist/model/silences-queries.js +15 -0
  117. package/dist/model/silences-queries.js.map +1 -0
  118. package/dist/remote/PersesPlugin.types.d.ts +2 -0
  119. package/dist/remote/PersesPlugin.types.d.ts.map +1 -1
  120. package/dist/remote/PersesPlugin.types.js.map +1 -1
  121. package/dist/remote/PluginLoaderComponent.js +1 -1
  122. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  123. package/dist/remote/PluginRuntime.d.ts +7 -1
  124. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  125. package/dist/remote/PluginRuntime.js +38 -9
  126. package/dist/remote/PluginRuntime.js.map +1 -1
  127. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  128. package/dist/remote/remotePluginLoader.js +28 -5
  129. package/dist/remote/remotePluginLoader.js.map +1 -1
  130. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  131. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +19 -3
  132. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  133. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  134. package/dist/runtime/DataQueriesProvider/model.js +30 -4
  135. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  136. package/dist/runtime/QueryCountProvider.js +1 -1
  137. package/dist/runtime/QueryCountProvider.js.map +1 -1
  138. package/dist/runtime/RouterProvider.js +1 -1
  139. package/dist/runtime/RouterProvider.js.map +1 -1
  140. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  141. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  142. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
  143. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  144. package/dist/runtime/UsageMetricsProvider.js +2 -2
  145. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  146. package/dist/runtime/alerts-queries.d.ts +11 -0
  147. package/dist/runtime/alerts-queries.d.ts.map +1 -0
  148. package/dist/runtime/alerts-queries.js +89 -0
  149. package/dist/runtime/alerts-queries.js.map +1 -0
  150. package/dist/runtime/index.d.ts +2 -0
  151. package/dist/runtime/index.d.ts.map +1 -1
  152. package/dist/runtime/index.js +2 -0
  153. package/dist/runtime/index.js.map +1 -1
  154. package/dist/runtime/item-actions.js +1 -1
  155. package/dist/runtime/item-actions.js.map +1 -1
  156. package/dist/runtime/log-queries.js +4 -1
  157. package/dist/runtime/log-queries.js.map +1 -1
  158. package/dist/runtime/plugin-registry.d.ts +2 -1
  159. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  160. package/dist/runtime/plugin-registry.js +12 -3
  161. package/dist/runtime/plugin-registry.js.map +1 -1
  162. package/dist/runtime/profile-queries.js +4 -1
  163. package/dist/runtime/profile-queries.js.map +1 -1
  164. package/dist/runtime/silences-queries.d.ts +11 -0
  165. package/dist/runtime/silences-queries.d.ts.map +1 -0
  166. package/dist/runtime/silences-queries.js +89 -0
  167. package/dist/runtime/silences-queries.js.map +1 -0
  168. package/dist/runtime/time-series-queries.js +4 -1
  169. package/dist/runtime/time-series-queries.js.map +1 -1
  170. package/dist/runtime/trace-queries.js +4 -1
  171. package/dist/runtime/trace-queries.js.map +1 -1
  172. package/dist/test/mock-data.d.ts +3 -1
  173. package/dist/test/mock-data.d.ts.map +1 -1
  174. package/dist/test/mock-data.js +45 -0
  175. package/dist/test/mock-data.js.map +1 -1
  176. package/dist/test/render.js +1 -1
  177. package/dist/test/render.js.map +1 -1
  178. package/dist/test/test-plugins/bert/index.d.ts +12 -6
  179. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  180. package/dist/test/test-plugins/bert/index.js +6 -2
  181. package/dist/test/test-plugins/bert/index.js.map +1 -1
  182. package/dist/test/test-plugins/ernie/index.d.ts +8 -6
  183. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  184. package/dist/test/test-plugins/ernie/index.js +6 -2
  185. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  186. package/dist/test/test-plugins/index.js +2 -2
  187. package/dist/test/test-plugins/index.js.map +1 -1
  188. package/dist/test/utils.js +1 -1
  189. package/dist/test/utils.js.map +1 -1
  190. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  191. package/dist/test-utils/mock-plugin-registry.js +8 -2
  192. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  193. package/package.json +6 -5
@@ -0,0 +1,11 @@
1
+ import { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ export type SilencesQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'SilencesQuery', PluginSpec>;
4
+ export declare const SILENCES_QUERY_KEY = "SilencesQuery";
5
+ /**
6
+ * Run a silences query using a SilencesQuery plugin and return the results.
7
+ * Silences represent current state and are NOT time-range dependent.
8
+ * @param definitions: dashboard definition for a silences query
9
+ */
10
+ export declare function useSilencesQueries(definitions: SilencesQueryDefinition[]): Array<UseQueryResult<SilencesData>>;
11
+ //# sourceMappingURL=silences-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"silences-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/silences-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO7E,MAAM,MAAM,uBAAuB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAC7G,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CA6B9G"}
@@ -0,0 +1,89 @@
1
+ // Copyright 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 { useQueries } from '@tanstack/react-query';
14
+ import { useDatasourceStore } from './datasources';
15
+ import { usePluginRegistry, usePlugins } from './plugin-registry';
16
+ import { useAllVariableValues } from './variables';
17
+ import { filterVariableStateMap, getVariableValuesKey } from './utils';
18
+ export const SILENCES_QUERY_KEY = 'SilencesQuery';
19
+ /**
20
+ * Run a silences query using a SilencesQuery plugin and return the results.
21
+ * Silences represent current state and are NOT time-range dependent.
22
+ * @param definitions: dashboard definition for a silences query
23
+ */ export function useSilencesQueries(definitions) {
24
+ const { getPlugin } = usePluginRegistry();
25
+ const context = useSilencesQueryContext();
26
+ const pluginLoaderResponse = usePlugins('SilencesQuery', definitions.map((d)=>({
27
+ kind: d.spec.plugin.kind
28
+ })));
29
+ return useQueries({
30
+ queries: definitions.map((definition, idx)=>{
31
+ const plugin = pluginLoaderResponse[idx]?.data;
32
+ const { queryEnabled, queryKey } = getQueryOptions({
33
+ context,
34
+ definition,
35
+ plugin
36
+ });
37
+ const silencesQueryKind = definition?.spec?.plugin?.kind;
38
+ return {
39
+ enabled: queryEnabled,
40
+ queryKey: queryKey,
41
+ refetchOnMount: false,
42
+ refetchOnWindowFocus: false,
43
+ refetchOnReconnect: false,
44
+ staleTime: 60_000,
45
+ queryFn: async ({ signal })=>{
46
+ const plugin = await getPlugin({
47
+ kind: SILENCES_QUERY_KEY,
48
+ name: silencesQueryKind
49
+ });
50
+ const data = await plugin.getSilencesData(definition.spec.plugin.spec, context, signal);
51
+ return data;
52
+ }
53
+ };
54
+ })
55
+ });
56
+ }
57
+ function getQueryOptions({ plugin, definition, context }) {
58
+ const { variableState } = context;
59
+ const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};
60
+ const variableDependencies = dependencies?.variables;
61
+ const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);
62
+ const variablesValueKey = getVariableValuesKey(filteredVariabledState);
63
+ // Note: no absoluteTimeRange in query key since silences are current state
64
+ const queryKey = [
65
+ 'query',
66
+ SILENCES_QUERY_KEY,
67
+ definition,
68
+ variablesValueKey
69
+ ];
70
+ let waitToLoad = false;
71
+ if (variableDependencies) {
72
+ waitToLoad = variableDependencies.some((v)=>variableState[v]?.loading);
73
+ }
74
+ const queryEnabled = plugin !== undefined && !waitToLoad;
75
+ return {
76
+ queryKey,
77
+ queryEnabled
78
+ };
79
+ }
80
+ function useSilencesQueryContext() {
81
+ const variableState = useAllVariableValues();
82
+ const datasourceStore = useDatasourceStore();
83
+ return {
84
+ variableState,
85
+ datasourceStore
86
+ };
87
+ }
88
+
89
+ //# sourceMappingURL=silences-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/silences-queries.ts"],"sourcesContent":["// Copyright 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 { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { SilencesQueryContext, SilencesQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\n\nexport type SilencesQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'SilencesQuery', PluginSpec>;\nexport const SILENCES_QUERY_KEY = 'SilencesQuery';\n\n/**\n * Run a silences query using a SilencesQuery plugin and return the results.\n * Silences represent current state and are NOT time-range dependent.\n * @param definitions: dashboard definition for a silences query\n */\nexport function useSilencesQueries(definitions: SilencesQueryDefinition[]): Array<UseQueryResult<SilencesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useSilencesQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'SilencesQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const silencesQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: 60_000,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<SilencesData> => {\n const plugin = await getPlugin({ kind: SILENCES_QUERY_KEY, name: silencesQueryKind });\n const data = await plugin.getSilencesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: SilencesQueryPlugin;\n definition: SilencesQueryDefinition;\n context: SilencesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n // Note: no absoluteTimeRange in query key since silences are current state\n const queryKey = ['query', SILENCES_QUERY_KEY, definition, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useSilencesQueryContext(): SilencesQueryContext {\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","SILENCES_QUERY_KEY","useSilencesQueries","definitions","getPlugin","context","useSilencesQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","silencesQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","queryFn","signal","name","getSilencesData","variableState","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAmBA,UAAU,QAAwB,wBAAwB;AAE7E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAClE,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AAGvE,OAAO,MAAMC,qBAAqB,gBAAgB;AAElD;;;;CAIC,GACD,OAAO,SAASC,mBAAmBC,WAAsC;IACvE,MAAM,EAAEC,SAAS,EAAE,GAAGR;IACtB,MAAMS,UAAUC;IAEhB,MAAMC,uBAAuBV,WAC3B,iBACAM,YAAYK,GAAG,CAAC,CAACC,IAAO,CAAA;YAAEC,MAAMD,EAAEE,IAAI,CAACC,MAAM,CAACF,IAAI;QAAC,CAAA;IAGrD,OAAOhB,WAAW;QAChBmB,SAASV,YAAYK,GAAG,CAAC,CAACM,YAAYC;YACpC,MAAMH,SAASL,oBAAoB,CAACQ,IAAI,EAAEC;YAC1C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGC,gBAAgB;gBAAEd;gBAASS;gBAAYF;YAAO;YACjF,MAAMQ,oBAAoBN,YAAYH,MAAMC,QAAQF;YACpD,OAAO;gBACLW,SAASJ;gBACTC,UAAUA;gBACVI,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAW;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMf,SAAS,MAAMR,UAAU;wBAAEM,MAAMT;wBAAoB2B,MAAMR;oBAAkB;oBACnF,MAAMJ,OAAO,MAAMJ,OAAOiB,eAAe,CAACf,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,SAASsB;oBAChF,OAAOX;gBACT;YACF;QACF;IACF;AACF;AAEA,SAASG,gBAAgB,EACvBP,MAAM,EACNE,UAAU,EACVT,OAAO,EAKR;IAIC,MAAM,EAAEyB,aAAa,EAAE,GAAGzB;IAE1B,MAAM0B,eAAenB,QAAQoB,YAAYpB,OAAOoB,SAAS,CAAClB,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,WAAW,CAAC;IACnG,MAAM4B,uBAAuBF,cAAcG;IAE3C,MAAMC,yBAAyBpC,uBAAuB+B,eAAeG;IACrE,MAAMG,oBAAoBpC,qBAAqBmC;IAC/C,2EAA2E;IAC3E,MAAMjB,WAAW;QAAC;QAASjB;QAAoBa;QAAYsB;KAAkB;IAE7E,IAAIC,aAAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMT,aAAa,CAACS,EAAE,EAAEC;IAClE;IAEA,MAAMvB,eAAeL,WAAW6B,aAAa,CAACJ;IAC9C,OAAO;QACLnB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAMwB,gBAAgBhC;IACtB,MAAM4C,kBAAkB/C;IAExB,OAAO;QACLmC;QACAY;IACF;AACF"}
@@ -100,7 +100,10 @@ function getQueryOptions({ plugin, definition, context }) {
100
100
  staleTime: Infinity,
101
101
  queryKey: queryKey,
102
102
  queryFn: async ({ signal })=>{
103
- const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);
103
+ const plugin = await getPlugin({
104
+ kind: TIME_SERIES_QUERY_KEY,
105
+ name: definition.spec.plugin.kind
106
+ });
104
107
  const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, context, signal);
105
108
  return data;
106
109
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"sourcesContent":["// Copyright 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 { TimeSeriesData, TimeSeriesQueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport {\n Query,\n QueryCache,\n QueryKey,\n QueryObserverOptions,\n useQueries,\n useQuery,\n useQueryClient,\n UseQueryResult,\n} from '@tanstack/react-query';\nimport { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryMode, TimeSeriesQueryPlugin } from '../model';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { timeRange, suggestedStepMs, mode, variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n\n const queryKey = [\n 'query',\n TIME_SERIES_QUERY_KEY,\n definition,\n timeRange,\n variablesValueKey,\n suggestedStepMs,\n mode,\n ] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions<TimeSeriesData>\n): UseQueryResult<TimeSeriesData> => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n queryFn: ({ signal }) => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>\n): Array<UseQueryResult<TimeSeriesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = {\n ...useTimeSeriesQueryContext(),\n mode: options?.mode,\n suggestedStepMs: options?.suggestedStepMs,\n };\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n ...queryOptions,\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryKey: queryKey,\n queryFn: async ({ signal }: { signal: AbortSignal }): Promise<TimeSeriesData> => {\n const plugin = await getPlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n } as QueryObserverOptions;\n }),\n }) as Array<UseQueryResult<TimeSeriesData>>;\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries(): TimeSeriesDataQuery[] {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache): TimeSeriesDataQuery[] {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQueries","useQuery","useQueryClient","useTimeRange","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","TIME_SERIES_QUERY_KEY","getQueryOptions","plugin","definition","context","timeRange","suggestedStepMs","mode","variableState","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","v","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","queryFn","signal","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","map","d","queries","idx","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","absoluteTimeRange","datasourceStore","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAKEA,UAAU,EACVC,QAAQ,EACRC,cAAc,QAET,wBAAwB;AAE/B,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAC7E,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AACvE,SAASC,oBAAoB,QAAQ,cAAc;AAOnD,OAAO,MAAMC,wBAAwB,kBAAkB;AAEvD,SAASC,gBAAgB,EACvBC,MAAM,EACNC,UAAU,EACVC,OAAO,EAKR;IAIC,MAAM,EAAEC,SAAS,EAAEC,eAAe,EAAEC,IAAI,EAAEC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MAAM6D,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMd,UAAiC,EAAE;IAEzC,KAAK,MAAMe,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;QACrD,MAAMC,YAAYH,MAAMxC,QAAQ,EAAE,CAAC,EAAE;QACrC,IAAI2C,WAAWhC,QAAQ,AAACgC,UAAUhC,IAAI,CAAYiC,UAAU,CAAC5D,wBAAwB;YACnFyC,QAAQoB,IAAI,CAACL;QACf;IACF;IAEA,OAAOf;AACT"}
1
+ {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"sourcesContent":["// Copyright 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 { TimeSeriesData, TimeSeriesQueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport {\n Query,\n QueryCache,\n QueryKey,\n QueryObserverOptions,\n useQueries,\n useQuery,\n useQueryClient,\n UseQueryResult,\n} from '@tanstack/react-query';\nimport { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryMode, TimeSeriesQueryPlugin } from '../model';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { timeRange, suggestedStepMs, mode, variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n\n const queryKey = [\n 'query',\n TIME_SERIES_QUERY_KEY,\n definition,\n timeRange,\n variablesValueKey,\n suggestedStepMs,\n mode,\n ] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions<TimeSeriesData>\n): UseQueryResult<TimeSeriesData> => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n queryFn: ({ signal }) => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>\n): Array<UseQueryResult<TimeSeriesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = {\n ...useTimeSeriesQueryContext(),\n mode: options?.mode,\n suggestedStepMs: options?.suggestedStepMs,\n };\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n ...queryOptions,\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryKey: queryKey,\n queryFn: async ({ signal }: { signal: AbortSignal }): Promise<TimeSeriesData> => {\n const plugin = await getPlugin({ kind: TIME_SERIES_QUERY_KEY, name: definition.spec.plugin.kind });\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n } as QueryObserverOptions;\n }),\n }) as Array<UseQueryResult<TimeSeriesData>>;\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries(): TimeSeriesDataQuery[] {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache): TimeSeriesDataQuery[] {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQueries","useQuery","useQueryClient","useTimeRange","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","TIME_SERIES_QUERY_KEY","getQueryOptions","plugin","definition","context","timeRange","suggestedStepMs","mode","variableState","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","v","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","queryFn","signal","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","map","d","queries","idx","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","name","absoluteTimeRange","datasourceStore","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAKEA,UAAU,EACVC,QAAQ,EACRC,cAAc,QAET,wBAAwB;AAE/B,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAC7E,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AACvE,SAASC,oBAAoB,QAAQ,cAAc;AA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EAAEqB,iBAAiB,EAAE,GAAGzD;IAC9B,MAAMgB,gBAAgBT;IACtB,MAAMmD,kBAAkBzD;IAExB,OAAO;QACLY,WAAW4C;QACXzC;QACA0C;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC;IACd,MAAMC,cAAc7D;IACpB,MAAM8D,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMf,UAAiC,EAAE;IAEzC,KAAK,MAAMgB,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;QACrD,MAAMC,YAAYH,MAAMzC,QAAQ,EAAE,CAAC,EAAE;QACrC,IAAI4C,WAAWjC,QAAQ,AAACiC,UAAUjC,IAAI,CAAYkC,UAAU,CAAC7D,wBAAwB;YACnFyC,QAAQqB,IAAI,CAACL;QACf;IACF;IAEA,OAAOhB;AACT"}
@@ -46,7 +46,10 @@ export const TRACE_QUERY_KEY = 'TraceQuery';
46
46
  refetchOnReconnect: false,
47
47
  staleTime: Infinity,
48
48
  queryFn: async ({ signal })=>{
49
- const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);
49
+ const plugin = await getPlugin({
50
+ kind: TRACE_QUERY_KEY,
51
+ name: traceQueryKind
52
+ });
50
53
  const data = await plugin.getTraceData(definition.spec.plugin.spec, context, signal);
51
54
  return data;
52
55
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/trace-queries.ts"],"sourcesContent":["// Copyright 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 { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { TraceQueryContext, TraceQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useTraceQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'TraceQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<TraceData> => {\n const plugin = await getPlugin(TRACE_QUERY_KEY, traceQueryKind);\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TraceQueryPlugin;\n definition: TraceQueryDefinition;\n context: TraceQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = ['query', TRACE_QUERY_KEY, definition, absoluteTimeRange, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useTraceQueryContext(): TraceQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useTimeRange","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","TRACE_QUERY_KEY","useTraceQueries","definitions","getPlugin","context","useTraceQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","traceQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","getTraceData","variableState","absoluteTimeRange","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAmBA,UAAU,QAAwB,wBAAwB;AAE7E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAAS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AAS,CAACnB,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,WAAW,CAAC;IACnG,MAAM6B,uBAAuBF,cAAcG;IAE3C,MAAMC,yBAAyBrC,uBAAuB+B,eAAeI;IACrE,MAAMG,oBAAoBrC,qBAAqBoC;IAC/C,MAAMlB,WAAW;QAAC;QAASjB;QAAiBa;QAAYiB;QAAmBM;KAAkB;IAE7F,IAAIC,aAAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMV,aAAa,CAACU,EAAE,EAAEC;IAClE;IAEA,MAAMxB,eAAeL,WAAW8B,aAAa,CAACJ;IAC9C,OAAO;QACLpB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAM,EAAEyB,iBAAiB,EAAE,GAAGlC;IAC9B,MAAMiC,gBAAgBhC;IACtB,MAAM6C,kBAAkBjD;IAExB,OAAO;QACLoC;QACAa;QACAZ;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/trace-queries.ts"],"sourcesContent":["// Copyright 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 { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { TraceQueryContext, TraceQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useTraceQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'TraceQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<TraceData> => {\n const plugin = await getPlugin({ kind: TRACE_QUERY_KEY, name: traceQueryKind });\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TraceQueryPlugin;\n definition: TraceQueryDefinition;\n context: TraceQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = ['query', TRACE_QUERY_KEY, definition, absoluteTimeRange, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useTraceQueryContext(): TraceQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useTimeRange","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","TRACE_QUERY_KEY","useTraceQueries","definitions","getPlugin","context","useTraceQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","traceQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","getTraceData","variableState","absoluteTimeRange","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAmBA,UAAU,QAAwB,wBAAwB;AAE7E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAClE,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AAEvE,OAAO,MAAMC,kBAAkB,aAAa;AAE5C;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,SAAS,EAAE,GAAGT;IACtB,MAAMU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AAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMV,aAAa,CAACU,EAAE,EAAEC;IAClE;IAEA,MAAMzB,eAAeL,WAAW+B,aAAa,CAACJ;IAC9C,OAAO;QACLrB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAM,EAAE0B,iBAAiB,EAAE,GAAGnC;IAC9B,MAAMkC,gBAAgBjC;IACtB,MAAM8C,kBAAkBlD;IAExB,OAAO;QACLqC;QACAa;QACAZ;IACF;AACF"}
@@ -1,8 +1,10 @@
1
- import { LogData, ProfileData, TimeSeriesData, TraceData } from '@perses-dev/spec';
1
+ import { AlertsData, LogData, ProfileData, SilencesData, TimeSeriesData, TraceData } from '@perses-dev/spec';
2
2
  export declare const MOCK_TIME_SERIES_DATA: TimeSeriesData;
3
3
  export declare const MOCK_TRACE_DATA: TraceData;
4
4
  export declare const MOCK_LOG_DATA: LogData;
5
5
  export declare const MOCK_PROFILE_DATA: ProfileData;
6
+ export declare const MOCK_ALERTS_DATA: AlertsData;
7
+ export declare const MOCK_SILENCES_DATA: SilencesData;
6
8
  export declare const MOCK_VALID_PLUGIN_METADATA: {
7
9
  kind: "Panel";
8
10
  spec: {
@@ -1 +1 @@
1
- {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../src/test/mock-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEnF,eAAO,MAAM,qBAAqB,EAAE,cAsBnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAmC7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAoB3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAmB/B,CAAC;AAGF,eAAO,MAAM,0BAA0B;;;;;;;;;CAStC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;CAS7C,CAAC;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;;;;;;;;CAwBpC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;CAwBvC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;CASpC,CAAC"}
@@ -122,6 +122,51 @@ export const MOCK_PROFILE_DATA = {
122
122
  name: 'cpu'
123
123
  }
124
124
  };
125
+ export const MOCK_ALERTS_DATA = {
126
+ alerts: [
127
+ {
128
+ id: 'abc123',
129
+ name: 'HighErrorRate',
130
+ state: 'firing',
131
+ labels: {
132
+ alertname: 'HighErrorRate',
133
+ severity: 'critical',
134
+ service: 'backend'
135
+ },
136
+ annotations: {
137
+ summary: 'High error rate detected'
138
+ },
139
+ severity: 'critical',
140
+ startsAt: '2024-01-01T00:00:00Z',
141
+ endsAt: '2024-01-02T00:00:00Z',
142
+ updatedAt: '2024-01-01T12:00:00Z',
143
+ receivers: [
144
+ 'cluster-01'
145
+ ]
146
+ }
147
+ ]
148
+ };
149
+ export const MOCK_SILENCES_DATA = {
150
+ silences: [
151
+ {
152
+ id: 'silence-1',
153
+ state: 'active',
154
+ matchers: [
155
+ {
156
+ name: 'alertname',
157
+ value: 'HighErrorRate',
158
+ isRegex: false,
159
+ isEqual: true
160
+ }
161
+ ],
162
+ startsAt: '2024-01-01T00:00:00Z',
163
+ endsAt: '2024-01-02T00:00:00Z',
164
+ createdBy: 'admin',
165
+ comment: 'Maintenance window',
166
+ updatedAt: '2024-01-01T00:00:00Z'
167
+ }
168
+ ]
169
+ };
125
170
  // Remote Plugin Loader Test Fixtures
126
171
  export const MOCK_VALID_PLUGIN_METADATA = {
127
172
  kind: 'Panel',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 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 { LogData, ProfileData, TimeSeriesData, TraceData } from '@perses-dev/spec';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n\nexport const MOCK_LOG_DATA: LogData = {\n totalCount: 2,\n entries: [\n {\n timestamp: 1666479357903,\n line: 'Error: Something went wrong',\n labels: {\n level: 'error',\n service: 'backend',\n },\n },\n {\n timestamp: 1666479382282,\n line: 'Info: Request processed successfully',\n labels: {\n level: 'info',\n service: 'frontend',\n },\n },\n ],\n};\n\nexport const MOCK_PROFILE_DATA: ProfileData = {\n profile: {\n stackTrace: {\n id: 0,\n name: 'root',\n level: 0,\n start: 1699916103945861,\n end: 1699916105065861,\n total: 1000,\n self: 500,\n children: [],\n },\n },\n metadata: {\n spyName: '',\n sampleRate: 1000000000,\n units: 'samples',\n name: 'cpu',\n },\n};\n\n// Remote Plugin Loader Test Fixtures\nexport const MOCK_VALID_PLUGIN_METADATA = {\n kind: 'Panel' as const,\n spec: {\n name: 'testPlugin',\n display: {\n name: 'Test Plugin',\n description: 'A test plugin for unit testing',\n },\n },\n};\n\nexport const MOCK_VALID_PLUGIN_MODULE_RESOURCE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'test-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [MOCK_VALID_PLUGIN_METADATA],\n },\n};\n\nexport const MOCK_INVALID_PLUGIN_MODULE = {\n // Missing required fields\n metadata: {\n name: 'invalid-module',\n },\n spec: {\n plugins: [\n {\n // Missing required fields\n kind: 'Panel',\n },\n ],\n },\n};\n\nexport const MOCK_MIXED_VALIDITY_PLUGIN_MODULES = [\n MOCK_VALID_PLUGIN_MODULE_RESOURCE,\n MOCK_INVALID_PLUGIN_MODULE,\n {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'another-valid-module',\n version: '2.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Variable' as const,\n spec: {\n name: 'anotherPlugin',\n display: {\n name: 'Another Plugin',\n },\n },\n },\n ],\n },\n },\n];\n\nexport const MOCK_REMOTE_PLUGIN_MODULE = {\n testPlugin: {\n component: (): null => null,\n createDefaultOptions: (): Record<string, unknown> => ({}),\n },\n};\n\nexport const MOCK_MULTI_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'multi-plugin-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'plugin1',\n display: { name: 'Plugin 1' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'plugin2',\n display: { name: 'Plugin 2' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_PARTIAL_FAILURE_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'partial-failure-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'workingPlugin',\n display: { name: 'Working Plugin' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'failingPlugin',\n display: { name: 'Failing Plugin' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_EMPTY_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'empty-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [],\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString","MOCK_LOG_DATA","totalCount","entries","timestamp","line","labels","level","service","MOCK_PROFILE_DATA","profile","stackTrace","id","total","self","children","spyName","sampleRate","units","MOCK_VALID_PLUGIN_METADATA","kind","spec","display","description","MOCK_VALID_PLUGIN_MODULE_RESOURCE","version","plugins","MOCK_INVALID_PLUGIN_MODULE","MOCK_MIXED_VALIDITY_PLUGIN_MODULES","MOCK_REMOTE_PLUGIN_MODULE","testPlugin","component","createDefaultOptions","MOCK_MULTI_PLUGIN_MODULE","MOCK_PARTIAL_FAILURE_MODULE","MOCK_EMPTY_PLUGIN_MODULE"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IAC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B;gBACpC;YACF;YACA;gBACEkC,MAAM;gBACNC,MAAM;oBACJnC,MAAM;oBACNoC,SAAS;wBAAEpC,MAAM;oBAAiB;gBACpC;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMiD,2BAA2B;IACtCf,MAAM;IACNrB,UAAU;QACRb,MAAM;QACNuC,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS,EAAE;IACb;AACF,EAAE"}
1
+ {"version":3,"sources":["../../src/test/mock-data.ts"],"sourcesContent":["// Copyright 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 { AlertsData, LogData, ProfileData, SilencesData, TimeSeriesData, TraceData } from '@perses-dev/spec';\n\nexport const MOCK_TIME_SERIES_DATA: TimeSeriesData = {\n timeRange: {\n start: new Date(1666625490000),\n end: new Date(1666625535000),\n },\n stepMs: 24379,\n series: [\n {\n name: 'device=\"/dev/vda1\", env=\"demo\", fstype=\"ext4\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/\"',\n values: [\n [1666479357903, 0.27700745551584494],\n [1666479382282, 0.27701284657366565],\n ],\n },\n {\n name: 'device=\"/dev/vda15\", env=\"demo\", fstype=\"vfat\", instance=\"demo.do.prometheus.io:9100\", job=\"node\", mountpoint=\"/boot/efi\"',\n values: [\n [1666479357903, 0.08486496097624885],\n [1666479382282, 0.08486496097624885],\n ],\n },\n ],\n};\n\nexport const MOCK_TRACE_DATA: TraceData = {\n searchResult: [\n {\n durationMs: 1120,\n serviceStats: {\n 'shop-backend': {\n spanCount: 4,\n errorCount: 0,\n },\n 'cart-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'article-service': {\n spanCount: 2,\n errorCount: 0,\n },\n 'auth-service': {\n spanCount: 1,\n errorCount: 0,\n },\n postgres: {\n spanCount: 1,\n errorCount: 0,\n },\n },\n startTimeUnixMs: 1699916103945861,\n traceId: '95ba9202315c29c801b5aa41452aa775',\n rootServiceName: 'shop-backend',\n rootTraceName: 'article-to-cart',\n },\n ],\n metadata: {\n executedQueryString: '{ duration > 1000ms }',\n },\n};\n\nexport const MOCK_LOG_DATA: LogData = {\n totalCount: 2,\n entries: [\n {\n timestamp: 1666479357903,\n line: 'Error: Something went wrong',\n labels: {\n level: 'error',\n service: 'backend',\n },\n },\n {\n timestamp: 1666479382282,\n line: 'Info: Request processed successfully',\n labels: {\n level: 'info',\n service: 'frontend',\n },\n },\n ],\n};\n\nexport const MOCK_PROFILE_DATA: ProfileData = {\n profile: {\n stackTrace: {\n id: 0,\n name: 'root',\n level: 0,\n start: 1699916103945861,\n end: 1699916105065861,\n total: 1000,\n self: 500,\n children: [],\n },\n },\n metadata: {\n spyName: '',\n sampleRate: 1000000000,\n units: 'samples',\n name: 'cpu',\n },\n};\n\nexport const MOCK_ALERTS_DATA: AlertsData = {\n alerts: [\n {\n id: 'abc123',\n name: 'HighErrorRate',\n state: 'firing',\n labels: {\n alertname: 'HighErrorRate',\n severity: 'critical',\n service: 'backend',\n },\n annotations: {\n summary: 'High error rate detected',\n },\n severity: 'critical',\n startsAt: '2024-01-01T00:00:00Z',\n endsAt: '2024-01-02T00:00:00Z',\n updatedAt: '2024-01-01T12:00:00Z',\n receivers: ['cluster-01'],\n },\n ],\n};\n\nexport const MOCK_SILENCES_DATA: SilencesData = {\n silences: [\n {\n id: 'silence-1',\n state: 'active',\n matchers: [\n {\n name: 'alertname',\n value: 'HighErrorRate',\n isRegex: false,\n isEqual: true,\n },\n ],\n startsAt: '2024-01-01T00:00:00Z',\n endsAt: '2024-01-02T00:00:00Z',\n createdBy: 'admin',\n comment: 'Maintenance window',\n updatedAt: '2024-01-01T00:00:00Z',\n },\n ],\n};\n\n// Remote Plugin Loader Test Fixtures\nexport const MOCK_VALID_PLUGIN_METADATA = {\n kind: 'Panel' as const,\n spec: {\n name: 'testPlugin',\n display: {\n name: 'Test Plugin',\n description: 'A test plugin for unit testing',\n },\n },\n};\n\nexport const MOCK_VALID_PLUGIN_MODULE_RESOURCE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'test-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [MOCK_VALID_PLUGIN_METADATA],\n },\n};\n\nexport const MOCK_INVALID_PLUGIN_MODULE = {\n // Missing required fields\n metadata: {\n name: 'invalid-module',\n },\n spec: {\n plugins: [\n {\n // Missing required fields\n kind: 'Panel',\n },\n ],\n },\n};\n\nexport const MOCK_MIXED_VALIDITY_PLUGIN_MODULES = [\n MOCK_VALID_PLUGIN_MODULE_RESOURCE,\n MOCK_INVALID_PLUGIN_MODULE,\n {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'another-valid-module',\n version: '2.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Variable' as const,\n spec: {\n name: 'anotherPlugin',\n display: {\n name: 'Another Plugin',\n },\n },\n },\n ],\n },\n },\n];\n\nexport const MOCK_REMOTE_PLUGIN_MODULE = {\n testPlugin: {\n component: (): null => null,\n createDefaultOptions: (): Record<string, unknown> => ({}),\n },\n};\n\nexport const MOCK_MULTI_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'multi-plugin-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'plugin1',\n display: { name: 'Plugin 1' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'plugin2',\n display: { name: 'Plugin 2' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_PARTIAL_FAILURE_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'partial-failure-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [\n {\n kind: 'Panel' as const,\n spec: {\n name: 'workingPlugin',\n display: { name: 'Working Plugin' },\n },\n },\n {\n kind: 'Variable' as const,\n spec: {\n name: 'failingPlugin',\n display: { name: 'Failing Plugin' },\n },\n },\n ],\n },\n};\n\nexport const MOCK_EMPTY_PLUGIN_MODULE = {\n kind: 'PluginModule' as const,\n metadata: {\n name: 'empty-module',\n version: '1.0.0',\n },\n spec: {\n plugins: [],\n },\n};\n"],"names":["MOCK_TIME_SERIES_DATA","timeRange","start","Date","end","stepMs","series","name","values","MOCK_TRACE_DATA","searchResult","durationMs","serviceStats","spanCount","errorCount","postgres","startTimeUnixMs","traceId","rootServiceName","rootTraceName","metadata","executedQueryString","MOCK_LOG_DATA","totalCount","entries","timestamp","line","labels","level","service","MOCK_PROFILE_DATA","profile","stackTrace","id","total","self","children","spyName","sampleRate","units","MOCK_ALERTS_DATA","alerts","state","alertname","severity","annotations","summary","startsAt","endsAt","updatedAt","receivers","MOCK_SILENCES_DATA","silences","matchers","value","isRegex","isEqual","createdBy","comment","MOCK_VALID_PLUGIN_METADATA","kind","spec","display","description","MOCK_VALID_PLUGIN_MODULE_RESOURCE","version","plugins","MOCK_INVALID_PLUGIN_MODULE","MOCK_MIXED_VALIDITY_PLUGIN_MODULES","MOCK_REMOTE_PLUGIN_MODULE","testPlugin","component","createDefaultOptions","MOCK_MULTI_PLUGIN_MODULE","MOCK_PARTIAL_FAILURE_MODULE","MOCK_EMPTY_PLUGIN_MODULE"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,wBAAwC;IACnDC,WAAW;QACTC,OAAO,IAAIC,KAAK;QAChBC,KAAK,IAAID,KAAK;IAChB;IACAE,QAAQ;IACRC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;gBACN;oBAA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N0D,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS;YACP;gBACEN,MAAM;gBACNC,MAAM;oBACJtD,MAAM;oBACNuD,SAAS;wBAAEvD,MAAM;oBAAW;gBAC9B;YACF;YACA;gBACEqD,MAAM;gBACNC,MAAM;oBACJtD,MAAM;oBACNuD,SAAS;wBAAEvD,MAAM;oBAAW;gBAC9B;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMmE,8BAA8B;IACzCd,MAAM;IACNxC,UAAU;QACRb,MAAM;QACN0D,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS;YACP;gBACEN,MAAM;gBACNC,MAAM;oBACJtD,MAAM;oBACNuD,SAAS;wBAAEvD,MAAM;oBAAiB;gBACpC;YACF;YACA;gBACEqD,MAAM;gBACNC,MAAM;oBACJtD,MAAM;oBACNuD,SAAS;wBAAEvD,MAAM;oBAAiB;gBACpC;YACF;SACD;IACH;AACF,EAAE;AAEF,OAAO,MAAMoE,2BAA2B;IACtCf,MAAM;IACNxC,UAAU;QACRb,MAAM;QACN0D,SAAS;IACX;IACAJ,MAAM;QACJK,SAAS,EAAE;IACb;AACF,EAAE"}
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  // Copyright The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,7 +11,6 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { render } from '@testing-library/react';
15
15
  import { getTestContextWrapper } from './utils';
16
16
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 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 { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { ReactNode } from 'react';\nimport { ContextOptions, getTestContextWrapper } from './utils';\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n): RenderResult {\n const Wrapper = getTestContextWrapper(contextOptions);\n return render(<Wrapper>{ui}</Wrapper>, renderOptions);\n}\n"],"names":["render","getTestContextWrapper","renderWithContext","ui","renderOptions","contextOptions","Wrapper"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqC,yBAAyB;AAE7E,SAAyBC,qBAAqB,QAAQ,UAAU;AAEhE;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAa,EACbC,aAA8C,EAC9CC,cAA+B;IAE/B,MAAMC,UAAUL,sBAAsBI;IACtC,OAAOL,qBAAO,KAACM;kBAASH;QAAeC;AACzC"}
1
+ {"version":3,"sources":["../../src/test/render.tsx"],"sourcesContent":["// Copyright 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 { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { ReactNode } from 'react';\nimport { ContextOptions, getTestContextWrapper } from './utils';\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n): RenderResult {\n const Wrapper = getTestContextWrapper(contextOptions);\n return render(<Wrapper>{ui}</Wrapper>, renderOptions);\n}\n"],"names":["render","getTestContextWrapper","renderWithContext","ui","renderOptions","contextOptions","Wrapper"],"mappings":";AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,MAAM,QAAqC,yBAAyB;AAE7E,SAAyBC,qBAAqB,QAAQ,UAAU;AAEhE;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAa,EACbC,aAA8C,EAC9CC,cAA+B;IAE/B,MAAMC,UAAUL,sBAAsBI;IACtC,OAAOL,qBAAO,KAACM;kBAASH;QAAeC;AACzC"}
@@ -1,8 +1,14 @@
1
1
  import { PanelPlugin } from '../../../model';
2
- export declare const BertPanel1: PanelPlugin<{
3
- option1: string;
4
- }>;
5
- export declare const BertPanel2: PanelPlugin<{
6
- option2: string;
7
- }>;
2
+ export declare const plugins: {
3
+ 'Panel:BertPanel1::1.0.0': PanelPlugin<{
4
+ option1: string;
5
+ }, import("../../../model").PanelProps<{
6
+ option1: string;
7
+ }, import("@perses-dev/spec").QueryDataType>>;
8
+ 'Panel:BertPanel2::1.0.0': PanelPlugin<{
9
+ option2: string;
10
+ }, import("../../../model").PanelProps<{
11
+ option2: string;
12
+ }, import("@perses-dev/spec").QueryDataType>>;
13
+ };
8
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/bert/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAsB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiBjE,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CASvD,CAAC;AAgBF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAgBvD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/bert/index.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAsB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA4DjE,eAAO,MAAM,OAAO;;iBA3CqB,MAAM;;iBAAN,MAAM;;;iBAyBN,MAAM;;iBAAN,MAAM;;CAqB9C,CAAC"}
@@ -31,7 +31,7 @@ function BertPanel1Editor({ value, onChange }) {
31
31
  });
32
32
  }
33
33
  // Dummy plugins to test loading
34
- export const BertPanel1 = {
34
+ const BertPanel1 = {
35
35
  PanelComponent: ()=>null,
36
36
  panelOptionsEditorComponents: [
37
37
  {
@@ -62,7 +62,7 @@ function BertPanel2Editor({ value, onChange }) {
62
62
  ]
63
63
  });
64
64
  }
65
- export const BertPanel2 = {
65
+ const BertPanel2 = {
66
66
  PanelComponent: ()=>null,
67
67
  panelOptionsEditorComponents: [
68
68
  {
@@ -83,5 +83,9 @@ export const BertPanel2 = {
83
83
  }),
84
84
  hideQueryEditor: true
85
85
  };
86
+ export const plugins = {
87
+ 'Panel:BertPanel1::1.0.0': BertPanel1,
88
+ 'Panel:BertPanel2::1.0.0': BertPanel2
89
+ };
86
90
 
87
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/test/test-plugins/bert/index.tsx"],"sourcesContent":["// Copyright 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 { ReactElement } from 'react';\nimport { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nexport const BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nfunction BertPanel2Editor({ value, onChange }: OptionsEditorProps<{ option2: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n}\n\nexport const BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: BertPanel2Editor,\n },\n {\n label: 'Custom Tab',\n content: function Editor(): ReactElement {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2Editor","option2","BertPanel2","Editor","hideQueryEditor"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;A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sourcesContent":["// Copyright 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 { ReactElement } from 'react';\nimport { OptionsEditorProps, PanelPlugin } from '../../../model';\n\nfunction BertPanel1Editor({ value, onChange }: OptionsEditorProps<{ option1: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel1 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option1}\n onChange={(e) => onChange({ ...value, option1: e.target.value })}\n />\n </div>\n );\n}\n\n// Dummy plugins to test loading\nconst BertPanel1: PanelPlugin<{ option1: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Editor',\n content: BertPanel1Editor,\n },\n ],\n createInitialOptions: () => ({ option1: '' }),\n};\n\nfunction BertPanel2Editor({ value, onChange }: OptionsEditorProps<{ option2: string }>): ReactElement {\n return (\n <div>\n <label htmlFor=\"editor-input\">BertPanel2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.option2}\n onChange={(e) => onChange({ ...value, option2: e.target.value })}\n />\n </div>\n );\n}\n\nconst BertPanel2: PanelPlugin<{ option2: string }> = {\n PanelComponent: () => null,\n panelOptionsEditorComponents: [\n {\n label: 'Settings',\n content: BertPanel2Editor,\n },\n {\n label: 'Custom Tab',\n content: function Editor(): ReactElement {\n return <div>custom content</div>;\n },\n },\n ],\n createInitialOptions: () => ({ option2: '' }),\n hideQueryEditor: true,\n};\n\nexport const plugins = {\n 'Panel:BertPanel1::1.0.0': BertPanel1,\n 'Panel:BertPanel2::1.0.0': BertPanel2,\n};\n"],"names":["BertPanel1Editor","value","onChange","div","label","htmlFor","input","type","id","option1","e","target","BertPanel1","PanelComponent","panelOptionsEditorComponents","content","createInitialOptions","BertPanel2Editor","option2","BertPanel2","Editor","hideQueryEditor","plugins"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAKjC,SAASA,iBAAiB,EAAEC,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMQ,OAAO;gBACpBP,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEQ,SAASC,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,gCAAgC;AAChC,MAAMW,aAA+C;IACnDC,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASf;QACX;KACD;IACDgB,sBAAsB,IAAO,CAAA;YAAEP,SAAS;QAAG,CAAA;AAC7C;AAEA,SAASQ,iBAAiB,EAAEhB,KAAK,EAAEC,QAAQ,EAA2C;IACpF,qBACE,MAACC;;0BACC,KAACC;gBAAMC,SAAQ;0BAAe;;0BAC9B,KAACC;gBACCC,MAAK;gBACLC,IAAG;gBACHP,OAAOA,MAAMiB,OAAO;gBACpBhB,UAAU,CAACQ,IAAMR,SAAS;wBAAE,GAAGD,KAAK;wBAAEiB,SAASR,EAAEC,MAAM,CAACV,KAAK;oBAAC;;;;AAItE;AAEA,MAAMkB,aAA+C;IACnDN,gBAAgB,IAAM;IACtBC,8BAA8B;QAC5B;YACEV,OAAO;YACPW,SAASE;QACX;QACA;YACEb,OAAO;YACPW,SAAS,SAASK;gBAChB,qBAAO,KAACjB;8BAAI;;YACd;QACF;KACD;IACDa,sBAAsB,IAAO,CAAA;YAAEE,SAAS;QAAG,CAAA;IAC3CG,iBAAiB;AACnB;AAEA,OAAO,MAAMC,UAAU;IACrB,2BAA2BV;IAC3B,2BAA2BO;AAC7B,EAAE"}
@@ -1,8 +1,10 @@
1
1
  import { VariablePlugin } from '../../../model';
2
- export declare const ErnieVariable1: VariablePlugin<{
3
- variableOption: string;
4
- }>;
5
- export declare const ErnieVariable2: VariablePlugin<{
6
- variableOption2: string;
7
- }>;
2
+ export declare const plugins: {
3
+ 'Variable:ErnieVariable1::1.0.0': VariablePlugin<{
4
+ variableOption: string;
5
+ }>;
6
+ 'Variable:ErnieVariable2::1.0.0': VariablePlugin<{
7
+ variableOption2: string;
8
+ }>;
9
+ };
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/ernie/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAQhE,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAgBrE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,CAgBtE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/test/test-plugins/ernie/index.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AA4ChE,eAAO,MAAM,OAAO;;wBApCmC,MAAM;;;yBAkBL,MAAM;;CAqB7D,CAAC"}
@@ -22,7 +22,7 @@ const data = [
22
22
  }
23
23
  ];
24
24
  // Dummy plugin to test loading
25
- export const ErnieVariable1 = {
25
+ const ErnieVariable1 = {
26
26
  getVariableOptions: async ()=>({
27
27
  data
28
28
  }),
@@ -49,7 +49,7 @@ export const ErnieVariable1 = {
49
49
  variableOption: ''
50
50
  })
51
51
  };
52
- export const ErnieVariable2 = {
52
+ const ErnieVariable2 = {
53
53
  getVariableOptions: async ()=>({
54
54
  data
55
55
  }),
@@ -76,5 +76,9 @@ export const ErnieVariable2 = {
76
76
  variableOption2: ''
77
77
  })
78
78
  };
79
+ export const plugins = {
80
+ 'Variable:ErnieVariable1::1.0.0': ErnieVariable1,
81
+ 'Variable:ErnieVariable2::1.0.0': ErnieVariable2
82
+ };
79
83
 
80
84
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/test/test-plugins/ernie/index.tsx"],"sourcesContent":["// Copyright 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 ErnieVariable1: VariablePlugin<{ variableOption: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption}\n onChange={(e) => onChange({ ...value, variableOption: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption: '' }),\n};\n\nexport const ErnieVariable2: VariablePlugin<{ variableOption2: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption2}\n onChange={(e) => onChange({ ...value, variableOption2: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption2: '' }),\n};\n"],"names":["data","label","value","ErnieVariable1","getVariableOptions","OptionsEditorComponent","ErnieVariableEditor","onChange","div","htmlFor","input","type","id","variableOption","e","target","createInitialOptions","ErnieVariable2","variableOption2"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,MAAMA,OAAyB;IAC7B;QAAEC,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAiBC,OAAO;IAAgB;CAClD;AAED,+BAA+B;AAC/B,OAAO,MAAMC,iBAA6D;IACxEC,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,KAAK,EAAEK,QAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMW,cAAc;oBAC3BN,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEW,gBAAgBC,EAAEC,MAAM,CAACb,KAAK;wBAAC;;;;IAI7E;IACAc,sBAAsB,IAAO,CAAA;YAAEH,gBAAgB;QAAG,CAAA;AACpD,EAAE;AAEF,OAAO,MAAMI,iBAA8D;IACzEb,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,KAAK,EAAEK,QAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMgB,eAAe;oBAC5BX,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEgB,iBAAiBJ,EAAEC,MAAM,CAACb,KAAK;wBAAC;;;;IAI9E;IACAc,sBAAsB,IAAO,CAAA;YAAEE,iBAAiB;QAAG,CAAA;AACrD,EAAE"}
1
+ {"version":3,"sources":["../../../../src/test/test-plugins/ernie/index.tsx"],"sourcesContent":["// Copyright 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\nconst ErnieVariable1: VariablePlugin<{ variableOption: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption}\n onChange={(e) => onChange({ ...value, variableOption: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption: '' }),\n};\n\nconst ErnieVariable2: VariablePlugin<{ variableOption2: string }> = {\n getVariableOptions: async () => ({ data }),\n OptionsEditorComponent: function ErnieVariableEditor({ value, onChange }) {\n return (\n <div>\n <label htmlFor=\"editor-input\">ErnieVariable2 editor</label>\n <input\n type=\"text\"\n id=\"editor-input\"\n value={value.variableOption2}\n onChange={(e) => onChange({ ...value, variableOption2: e.target.value })}\n />\n </div>\n );\n },\n createInitialOptions: () => ({ variableOption2: '' }),\n};\n\nexport const plugins = {\n 'Variable:ErnieVariable1::1.0.0': ErnieVariable1,\n 'Variable:ErnieVariable2::1.0.0': ErnieVariable2,\n};\n"],"names":["data","label","value","ErnieVariable1","getVariableOptions","OptionsEditorComponent","ErnieVariableEditor","onChange","div","htmlFor","input","type","id","variableOption","e","target","createInitialOptions","ErnieVariable2","variableOption2","plugins"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,MAAMA,OAAyB;IAC7B;QAAEC,OAAO;QAAUC,OAAO;IAAS;IACnC;QAAED,OAAO;QAAiBC,OAAO;IAAgB;CAClD;AAED,+BAA+B;AAC/B,MAAMC,iBAA6D;IACjEC,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,KAAK,EAAEK,QAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMW,cAAc;oBAC3BN,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEW,gBAAgBC,EAAEC,MAAM,CAACb,KAAK;wBAAC;;;;IAI7E;IACAc,sBAAsB,IAAO,CAAA;YAAEH,gBAAgB;QAAG,CAAA;AACpD;AAEA,MAAMI,iBAA8D;IAClEb,oBAAoB,UAAa,CAAA;YAAEJ;QAAK,CAAA;IACxCK,wBAAwB,SAASC,oBAAoB,EAAEJ,KAAK,EAAEK,QAAQ,EAAE;QACtE,qBACE,MAACC;;8BACC,KAACP;oBAAMQ,SAAQ;8BAAe;;8BAC9B,KAACC;oBACCC,MAAK;oBACLC,IAAG;oBACHV,OAAOA,MAAMgB,eAAe;oBAC5BX,UAAU,CAACO,IAAMP,SAAS;4BAAE,GAAGL,KAAK;4BAAEgB,iBAAiBJ,EAAEC,MAAM,CAACb,KAAK;wBAAC;;;;IAI9E;IACAc,sBAAsB,IAAO,CAAA;YAAEE,iBAAiB;QAAG,CAAA;AACrD;AAEA,OAAO,MAAMC,UAAU;IACrB,kCAAkChB;IAClC,kCAAkCc;AACpC,EAAE"}
@@ -18,11 +18,11 @@ import ernieResource from './ernie/plugin.json';
18
18
  */ export const testPluginLoader = dynamicImportPluginLoader([
19
19
  {
20
20
  resource: bertResource,
21
- importPlugin: ()=>import('./bert')
21
+ importPlugin: ()=>import('./bert').then((m)=>m.plugins)
22
22
  },
23
23
  {
24
24
  resource: ernieResource,
25
- importPlugin: ()=>import('./ernie')
25
+ importPlugin: ()=>import('./ernie').then((m)=>m.plugins)
26
26
  }
27
27
  ]);
28
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/test/test-plugins/index.ts"],"sourcesContent":["// Copyright 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 { dynamicImportPluginLoader, PluginLoader, PluginModuleResource } from '../../model';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n/**\n * A PluginLoader for tests that will dynamically load the plugins in this folder.\n */\nexport const testPluginLoader: PluginLoader = dynamicImportPluginLoader([\n { resource: bertResource as PluginModuleResource, importPlugin: () => import('./bert') },\n { resource: ernieResource as PluginModuleResource, importPlugin: () => import('./ernie') },\n]);\n"],"names":["dynamicImportPluginLoader","bertResource","ernieResource","testPluginLoader","resource","importPlugin"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,yBAAyB,QAA4C,cAAc;AAC5F,OAAOC,kBAAkB,qBAAqB;AAC9C,OAAOC,mBAAmB,sBAAsB;AAEhD;;CAEC,GACD,OAAO,MAAMC,mBAAiCH,0BAA0B;IACtE;QAAEI,UAAUH;QAAsCI,cAAc,IAAM,MAAM,CAAC;IAAU;IACvF;QAAED,UAAUF;QAAuCG,cAAc,IAAM,MAAM,CAAC;IAAW;CAC1F,EAAE"}
1
+ {"version":3,"sources":["../../../src/test/test-plugins/index.ts"],"sourcesContent":["// Copyright 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 { dynamicImportPluginLoader, PluginLoader, PluginModuleResource } from '../../model';\nimport bertResource from './bert/plugin.json';\nimport ernieResource from './ernie/plugin.json';\n\n/**\n * A PluginLoader for tests that will dynamically load the plugins in this folder.\n */\nexport const testPluginLoader: PluginLoader = dynamicImportPluginLoader([\n { resource: bertResource as PluginModuleResource, importPlugin: () => import('./bert').then((m) => m.plugins) },\n { resource: ernieResource as PluginModuleResource, importPlugin: () => import('./ernie').then((m) => m.plugins) },\n]);\n"],"names":["dynamicImportPluginLoader","bertResource","ernieResource","testPluginLoader","resource","importPlugin","then","m","plugins"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,yBAAyB,QAA4C,cAAc;AAC5F,OAAOC,kBAAkB,qBAAqB;AAC9C,OAAOC,mBAAmB,sBAAsB;AAEhD;;CAEC,GACD,OAAO,MAAMC,mBAAiCH,0BAA0B;IACtE;QAAEI,UAAUH;QAAsCI,cAAc,IAAM,MAAM,CAAC,UAAUC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO;IAAE;IAC9G;QAAEJ,UAAUF;QAAuCG,cAAc,IAAM,MAAM,CAAC,WAAWC,IAAI,CAAC,CAACC,IAAMA,EAAEC,OAAO;IAAE;CACjH,EAAE"}
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  // Copyright The Perses Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,7 +11,6 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
15
15
  import { PluginRegistry } from '../components';
16
16
  import { TimeRangeProviderBasic } from '../runtime';