@perses-dev/plugin-system 0.54.0-beta.0 → 0.54.0-beta.10

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 (290) hide show
  1. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +283 -0
  2. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +197 -0
  3. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +30 -0
  4. package/dist/cjs/components/Annotations/constants.js +23 -0
  5. package/dist/cjs/components/Annotations/index.js +31 -0
  6. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +3 -3
  7. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
  8. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +4 -5
  9. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +97 -12
  10. package/dist/cjs/components/MultiQueryEditor/index.js +1 -0
  11. package/dist/cjs/{utils/action.js → components/MultiQueryEditor/utils.js} +8 -15
  12. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +3 -6
  13. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +11 -15
  14. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +92 -0
  15. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +16 -13
  16. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
  17. package/dist/cjs/components/Variables/variable-model.js +115 -29
  18. package/dist/cjs/components/index.js +1 -0
  19. package/dist/cjs/context/ValidationProvider.js +10 -4
  20. package/dist/cjs/model/alerts-queries.js +16 -0
  21. package/dist/cjs/model/annotations.js +16 -0
  22. package/dist/cjs/model/calculations.js +178 -0
  23. package/dist/cjs/model/index.js +4 -0
  24. package/dist/cjs/model/legend.js +6 -5
  25. package/dist/cjs/model/log-volume-utils.js +10 -10
  26. package/dist/cjs/model/plugin-loading.js +24 -8
  27. package/dist/cjs/model/plugins.js +10 -0
  28. package/dist/cjs/model/silences-queries.js +16 -0
  29. package/dist/cjs/model/time-series-queries.js +10 -0
  30. package/dist/cjs/remote/PluginRuntime.js +46 -10
  31. package/dist/cjs/remote/remotePluginLoader.js +28 -5
  32. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +33 -24
  33. package/dist/cjs/runtime/DataQueriesProvider/model.js +3 -93
  34. package/dist/cjs/runtime/UsageMetricsProvider.js +2 -2
  35. package/dist/cjs/runtime/alerts-queries.js +101 -0
  36. package/dist/cjs/runtime/annotations.js +148 -0
  37. package/dist/cjs/runtime/index.js +3 -1
  38. package/dist/cjs/runtime/item-actions.js +3 -3
  39. package/dist/cjs/runtime/log-queries.js +4 -1
  40. package/dist/cjs/runtime/plugin-registry.js +12 -3
  41. package/dist/cjs/runtime/profile-queries.js +4 -1
  42. package/dist/cjs/runtime/silences-queries.js +101 -0
  43. package/dist/cjs/runtime/time-series-queries.js +4 -1
  44. package/dist/cjs/runtime/trace-queries.js +4 -1
  45. package/dist/cjs/test/mock-data.js +51 -0
  46. package/dist/cjs/test/test-plugins/bert/index.js +9 -12
  47. package/dist/cjs/test/test-plugins/ernie/index.js +9 -12
  48. package/dist/cjs/test/test-plugins/index.js +2 -2
  49. package/dist/cjs/test/utils.js +2 -2
  50. package/dist/cjs/test-utils/mock-plugin-registry.js +8 -2
  51. package/dist/cjs/utils/index.js +0 -1
  52. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +16 -0
  53. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -0
  54. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +270 -0
  55. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -0
  56. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +8 -0
  57. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -0
  58. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +184 -0
  59. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -0
  60. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts +2 -0
  61. package/dist/components/Annotations/AnnotationEditorForm/index.d.ts.map +1 -0
  62. package/dist/{runtime/QueryCountProvider.js → components/Annotations/AnnotationEditorForm/index.js} +2 -13
  63. package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -0
  64. package/dist/components/Annotations/constants.d.ts +2 -0
  65. package/dist/components/Annotations/constants.d.ts.map +1 -0
  66. package/dist/components/Annotations/constants.js +15 -0
  67. package/dist/components/Annotations/constants.js.map +1 -0
  68. package/dist/components/Annotations/index.d.ts +3 -0
  69. package/dist/components/Annotations/index.d.ts.map +1 -0
  70. package/dist/components/Annotations/index.js +16 -0
  71. package/dist/components/Annotations/index.js.map +1 -0
  72. package/dist/components/CalculationSelector/CalculationSelector.d.ts +1 -1
  73. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  74. package/dist/components/CalculationSelector/CalculationSelector.js +2 -2
  75. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  76. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +1 -1
  77. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  78. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +2 -3
  79. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  80. package/dist/components/DatasourceSelect/DatasourceSelect.js +2 -2
  81. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  82. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +1 -1
  83. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  84. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +2 -2
  85. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  86. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +1 -1
  87. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  88. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  89. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +2 -3
  90. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  91. package/dist/components/MetricLabelInput/MetricLabelInput.js +1 -1
  92. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  93. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +1 -1
  94. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
  95. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  96. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  97. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +100 -15
  98. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  99. package/dist/components/MultiQueryEditor/index.d.ts +1 -0
  100. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -1
  101. package/dist/components/MultiQueryEditor/index.js +1 -0
  102. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  103. package/dist/components/MultiQueryEditor/utils.d.ts +8 -0
  104. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -0
  105. package/dist/{utils/action.js → components/MultiQueryEditor/utils.js} +8 -12
  106. package/dist/components/MultiQueryEditor/utils.js.map +1 -0
  107. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +1 -1
  108. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  109. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  110. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  111. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +1 -1
  112. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  113. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  114. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +5 -8
  115. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  116. package/dist/components/PluginEditor/PluginEditor.js +1 -1
  117. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  118. package/dist/components/PluginKindSelect/PluginKindSelect.js +1 -1
  119. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  120. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  121. package/dist/components/PluginRegistry/PluginRegistry.js +12 -16
  122. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  123. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +12 -0
  124. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -0
  125. package/dist/components/PluginRegistry/getPluginSearchHelper.js +88 -0
  126. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -0
  127. package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -6
  128. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  129. package/dist/components/PluginRegistry/plugin-indexes.js +15 -13
  130. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  131. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  132. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +1 -1
  133. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  134. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +1 -1
  135. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  136. package/dist/components/TimeRangeControls/TimeRangeControls.js +1 -1
  137. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  138. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +1 -1
  139. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  140. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +2 -3
  141. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  142. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +1 -1
  143. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  144. package/dist/components/Variables/variable-model.d.ts +9 -1
  145. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  146. package/dist/components/Variables/variable-model.js +117 -31
  147. package/dist/components/Variables/variable-model.js.map +1 -1
  148. package/dist/components/index.d.ts +1 -0
  149. package/dist/components/index.d.ts.map +1 -1
  150. package/dist/components/index.js +1 -0
  151. package/dist/components/index.js.map +1 -1
  152. package/dist/context/ValidationProvider.d.ts +4 -2
  153. package/dist/context/ValidationProvider.d.ts.map +1 -1
  154. package/dist/context/ValidationProvider.js +10 -4
  155. package/dist/context/ValidationProvider.js.map +1 -1
  156. package/dist/model/alerts-queries.d.ts +33 -0
  157. package/dist/model/alerts-queries.d.ts.map +1 -0
  158. package/dist/model/alerts-queries.js +15 -0
  159. package/dist/model/alerts-queries.js.map +1 -0
  160. package/dist/model/annotations.d.ts +28 -0
  161. package/dist/model/annotations.d.ts.map +1 -0
  162. package/dist/model/annotations.js +17 -0
  163. package/dist/model/annotations.js.map +1 -0
  164. package/dist/model/calculations.d.ts +45 -0
  165. package/dist/model/calculations.d.ts.map +1 -0
  166. package/dist/model/calculations.js +165 -0
  167. package/dist/model/calculations.js.map +1 -0
  168. package/dist/model/index.d.ts +4 -0
  169. package/dist/model/index.d.ts.map +1 -1
  170. package/dist/model/index.js +4 -0
  171. package/dist/model/index.js.map +1 -1
  172. package/dist/model/legend.d.ts +3 -2
  173. package/dist/model/legend.d.ts.map +1 -1
  174. package/dist/model/legend.js +2 -1
  175. package/dist/model/legend.js.map +1 -1
  176. package/dist/model/log-queries.d.ts +2 -1
  177. package/dist/model/log-queries.d.ts.map +1 -1
  178. package/dist/model/log-queries.js.map +1 -1
  179. package/dist/model/plugin-loading.d.ts.map +1 -1
  180. package/dist/model/plugin-loading.js +24 -8
  181. package/dist/model/plugin-loading.js.map +1 -1
  182. package/dist/model/plugins.d.ts +23 -0
  183. package/dist/model/plugins.d.ts.map +1 -1
  184. package/dist/model/plugins.js +4 -1
  185. package/dist/model/plugins.js.map +1 -1
  186. package/dist/model/silences-queries.d.ts +33 -0
  187. package/dist/model/silences-queries.d.ts.map +1 -0
  188. package/dist/model/silences-queries.js +15 -0
  189. package/dist/model/silences-queries.js.map +1 -0
  190. package/dist/model/time-series-queries.d.ts +11 -1
  191. package/dist/model/time-series-queries.d.ts.map +1 -1
  192. package/dist/model/time-series-queries.js +4 -1
  193. package/dist/model/time-series-queries.js.map +1 -1
  194. package/dist/model/trace-queries.d.ts +2 -3
  195. package/dist/model/trace-queries.d.ts.map +1 -1
  196. package/dist/model/trace-queries.js.map +1 -1
  197. package/dist/remote/PersesPlugin.types.d.ts +2 -0
  198. package/dist/remote/PersesPlugin.types.d.ts.map +1 -1
  199. package/dist/remote/PersesPlugin.types.js.map +1 -1
  200. package/dist/remote/PluginLoaderComponent.js +1 -1
  201. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  202. package/dist/remote/PluginRuntime.d.ts +7 -1
  203. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  204. package/dist/remote/PluginRuntime.js +46 -10
  205. package/dist/remote/PluginRuntime.js.map +1 -1
  206. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  207. package/dist/remote/remotePluginLoader.js +28 -5
  208. package/dist/remote/remotePluginLoader.js.map +1 -1
  209. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  210. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +35 -26
  211. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  212. package/dist/runtime/DataQueriesProvider/model.d.ts +4 -4
  213. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  214. package/dist/runtime/DataQueriesProvider/model.js +0 -82
  215. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  216. package/dist/runtime/RouterProvider.js +1 -1
  217. package/dist/runtime/RouterProvider.js.map +1 -1
  218. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
  219. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  220. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +1 -1
  221. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  222. package/dist/runtime/UsageMetricsProvider.js +2 -2
  223. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  224. package/dist/runtime/alerts-queries.d.ts +11 -0
  225. package/dist/runtime/alerts-queries.d.ts.map +1 -0
  226. package/dist/runtime/alerts-queries.js +89 -0
  227. package/dist/runtime/alerts-queries.js.map +1 -0
  228. package/dist/runtime/annotations.d.ts +6 -0
  229. package/dist/runtime/annotations.d.ts.map +1 -0
  230. package/dist/runtime/annotations.js +129 -0
  231. package/dist/runtime/annotations.js.map +1 -0
  232. package/dist/runtime/datasources.d.ts +6 -0
  233. package/dist/runtime/datasources.d.ts.map +1 -1
  234. package/dist/runtime/datasources.js.map +1 -1
  235. package/dist/runtime/index.d.ts +3 -1
  236. package/dist/runtime/index.d.ts.map +1 -1
  237. package/dist/runtime/index.js +3 -1
  238. package/dist/runtime/index.js.map +1 -1
  239. package/dist/runtime/item-actions.js +1 -1
  240. package/dist/runtime/item-actions.js.map +1 -1
  241. package/dist/runtime/log-queries.js +4 -1
  242. package/dist/runtime/log-queries.js.map +1 -1
  243. package/dist/runtime/plugin-registry.d.ts +2 -2
  244. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  245. package/dist/runtime/plugin-registry.js +12 -3
  246. package/dist/runtime/plugin-registry.js.map +1 -1
  247. package/dist/runtime/profile-queries.js +4 -1
  248. package/dist/runtime/profile-queries.js.map +1 -1
  249. package/dist/runtime/silences-queries.d.ts +11 -0
  250. package/dist/runtime/silences-queries.d.ts.map +1 -0
  251. package/dist/runtime/silences-queries.js +89 -0
  252. package/dist/runtime/silences-queries.js.map +1 -0
  253. package/dist/runtime/time-series-queries.js +4 -1
  254. package/dist/runtime/time-series-queries.js.map +1 -1
  255. package/dist/runtime/trace-queries.js +4 -1
  256. package/dist/runtime/trace-queries.js.map +1 -1
  257. package/dist/test/mock-data.d.ts +3 -1
  258. package/dist/test/mock-data.d.ts.map +1 -1
  259. package/dist/test/mock-data.js +45 -0
  260. package/dist/test/mock-data.js.map +1 -1
  261. package/dist/test/render.js +1 -1
  262. package/dist/test/render.js.map +1 -1
  263. package/dist/test/test-plugins/bert/index.d.ts +12 -6
  264. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  265. package/dist/test/test-plugins/bert/index.js +6 -2
  266. package/dist/test/test-plugins/bert/index.js.map +1 -1
  267. package/dist/test/test-plugins/ernie/index.d.ts +8 -6
  268. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  269. package/dist/test/test-plugins/ernie/index.js +6 -2
  270. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  271. package/dist/test/test-plugins/index.js +2 -2
  272. package/dist/test/test-plugins/index.js.map +1 -1
  273. package/dist/test/utils.d.ts.map +1 -1
  274. package/dist/test/utils.js +2 -2
  275. package/dist/test/utils.js.map +1 -1
  276. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  277. package/dist/test-utils/mock-plugin-registry.js +8 -2
  278. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  279. package/dist/utils/index.d.ts +0 -1
  280. package/dist/utils/index.d.ts.map +1 -1
  281. package/dist/utils/index.js +0 -1
  282. package/dist/utils/index.js.map +1 -1
  283. package/package.json +7 -6
  284. package/dist/cjs/runtime/QueryCountProvider.js +0 -83
  285. package/dist/runtime/QueryCountProvider.d.ts +0 -9
  286. package/dist/runtime/QueryCountProvider.d.ts.map +0 -1
  287. package/dist/runtime/QueryCountProvider.js.map +0 -1
  288. package/dist/utils/action.d.ts +0 -4
  289. package/dist/utils/action.d.ts.map +0 -1
  290. package/dist/utils/action.js.map +0 -1
@@ -34,7 +34,7 @@ _export(exports, {
34
34
  const _jsxruntime = require("react/jsx-runtime");
35
35
  const _react = require("react");
36
36
  const _spec = require("@perses-dev/spec");
37
- const _core = require("@perses-dev/core");
37
+ const _client = require("@perses-dev/client");
38
38
  const ValidationSchemasContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
39
39
  function useValidationSchemas() {
40
40
  const ctx = (0, _react.useContext)(ValidationSchemasContext);
@@ -44,11 +44,12 @@ function useValidationSchemas() {
44
44
  return ctx;
45
45
  }
46
46
  function ValidationProvider({ children }) {
47
- const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_core.datasourceDefinitionSchema);
47
+ const [datasourceEditorSchema, setDatasourceEditorSchema] = (0, _react.useState)(_client.datasourceDefinitionSchema);
48
48
  const [panelEditorSchema, setPanelEditorSchema] = (0, _react.useState)(_spec.panelEditorSchema); // TODO I don't get why this does not compile
49
49
  const [variableEditorSchema, setVariableEditorSchema] = (0, _react.useState)(_spec.variableDefinitionSchema);
50
+ const [annotationEditorSchema, setAnnotationEditorSchema] = (0, _react.useState)(_spec.annotationSpecSchema);
50
51
  function setDatasourceEditorSchemaPlugin(pluginSchema) {
51
- setDatasourceEditorSchema((0, _core.buildDatasourceDefinitionSchema)(pluginSchema));
52
+ setDatasourceEditorSchema((0, _client.buildDatasourceDefinitionSchema)(pluginSchema));
52
53
  }
53
54
  function setPanelEditorSchemaPlugin(pluginSchema) {
54
55
  setPanelEditorSchema((0, _spec.buildPanelEditorSchema)(pluginSchema));
@@ -56,14 +57,19 @@ function ValidationProvider({ children }) {
56
57
  function setVariableEditorSchemaPlugin(pluginSchema) {
57
58
  setVariableEditorSchema((0, _spec.buildVariableDefinitionSchema)(pluginSchema));
58
59
  }
60
+ function setAnnotationEditorSchemaPlugin(pluginSchema) {
61
+ setAnnotationEditorSchema((0, _spec.buildAnnotationSpecSchema)(pluginSchema));
62
+ }
59
63
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(ValidationSchemasContext.Provider, {
60
64
  value: {
61
65
  datasourceEditorSchema,
62
66
  panelEditorSchema,
63
67
  variableEditorSchema,
68
+ annotationEditorSchema,
64
69
  setDatasourceEditorSchemaPlugin,
65
70
  setPanelEditorSchemaPlugin,
66
- setVariableEditorSchemaPlugin
71
+ setVariableEditorSchemaPlugin,
72
+ setAnnotationEditorSchemaPlugin
67
73
  },
68
74
  children: children
69
75
  });
@@ -0,0 +1,16 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -0,0 +1,16 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -0,0 +1,178 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: Object.getOwnPropertyDescriptor(all, name).get
21
+ });
22
+ }
23
+ _export(exports, {
24
+ get CALCULATIONS_CONFIG () {
25
+ return CALCULATIONS_CONFIG;
26
+ },
27
+ get CalculationsMap () {
28
+ return CalculationsMap;
29
+ },
30
+ get DEFAULT_CALCULATION () {
31
+ return DEFAULT_CALCULATION;
32
+ },
33
+ get getCalculation () {
34
+ return getCalculation;
35
+ },
36
+ get getCalculations () {
37
+ return getCalculations;
38
+ }
39
+ });
40
+ const DEFAULT_CALCULATION = 'last'; // aligned with cue
41
+ const CalculationsMap = {
42
+ first: first,
43
+ last: last,
44
+ 'first-number': firstNumber,
45
+ 'last-number': lastNumber,
46
+ mean: mean,
47
+ sum: sum,
48
+ min: min,
49
+ max: max
50
+ };
51
+ const CALCULATIONS_CONFIG = {
52
+ first: {
53
+ label: 'First',
54
+ description: 'First value'
55
+ },
56
+ last: {
57
+ label: 'Last',
58
+ description: 'Last value'
59
+ },
60
+ 'first-number': {
61
+ label: 'First *',
62
+ description: 'First numeric value'
63
+ },
64
+ 'last-number': {
65
+ label: 'Last *',
66
+ description: 'Last numeric value'
67
+ },
68
+ mean: {
69
+ label: 'Avg',
70
+ description: 'Average value excluding nulls'
71
+ },
72
+ sum: {
73
+ label: 'Sum',
74
+ description: 'The sum of all values'
75
+ },
76
+ min: {
77
+ label: 'Min',
78
+ description: 'Minimum value'
79
+ },
80
+ max: {
81
+ label: 'Max',
82
+ description: 'Maximum value'
83
+ }
84
+ };
85
+ function getCalculations(values, includeCalculations) {
86
+ const calculations = includeCalculations.reduce((initResult, calculation)=>{
87
+ initResult[calculation] = undefined;
88
+ return initResult;
89
+ }, {});
90
+ // We save these values as separate values instead of directly setting them
91
+ // in the calculations because they are needed by multiple calculations.
92
+ let nonNullCount = 0;
93
+ let sum = 0;
94
+ // We use this large function capable of performing one or more calculations
95
+ // in a single iteration of the data to minimize the performance impact of
96
+ // generating multiple calculations for large timeseries values. This is
97
+ // less optimized for certain single calculations when done in isolation (e.g.
98
+ // `last`), but will be more performant in the more expensive cases where
99
+ // multiple values are being used (e.g. table legend).
100
+ values.forEach((tuple, i)=>{
101
+ const value = tuple[1];
102
+ if (i === 0 && 'first' in calculations) {
103
+ calculations.first = value;
104
+ }
105
+ if (i === values.length - 1 && 'last' in calculations) {
106
+ calculations.last = value;
107
+ }
108
+ // Handling specific to non-null values.
109
+ if (typeof value === 'number') {
110
+ nonNullCount += 1;
111
+ sum += value;
112
+ if ('first-number' in calculations && calculations['first-number'] === undefined) {
113
+ // Save the first number we see.
114
+ calculations['first-number'] = value;
115
+ }
116
+ if ('last-number' in calculations) {
117
+ // Keep setting the numbers we see, which will eventually be set to the
118
+ // last number when finished iterating.
119
+ calculations['last-number'] = value;
120
+ }
121
+ if ('min' in calculations) {
122
+ if (typeof calculations.min !== 'number') {
123
+ // Init the first time we see a number
124
+ calculations.min = value;
125
+ } else {
126
+ // Use lowest value once initialized
127
+ calculations.min = Math.min(calculations.min, value);
128
+ }
129
+ }
130
+ if ('max' in calculations) {
131
+ if (typeof calculations.max !== 'number') {
132
+ // Init the first time we see a number
133
+ calculations.max = value;
134
+ } else {
135
+ // Use highest value once initialized
136
+ calculations.max = Math.max(calculations.max, value);
137
+ }
138
+ }
139
+ }
140
+ });
141
+ // Set calculations that require iterating over all values.
142
+ if (nonNullCount > 0 && 'sum' in calculations) {
143
+ calculations.sum = sum;
144
+ }
145
+ if (nonNullCount > 0 && 'mean' in calculations) {
146
+ calculations.mean = sum / nonNullCount;
147
+ }
148
+ return calculations;
149
+ }
150
+ function getCalculation(values, calculation) {
151
+ return getCalculations(values, [
152
+ calculation
153
+ ])[calculation];
154
+ }
155
+ function first(values) {
156
+ return getCalculation(values, 'first');
157
+ }
158
+ function last(values) {
159
+ return getCalculation(values, 'last');
160
+ }
161
+ function firstNumber(values) {
162
+ return getCalculation(values, 'first-number');
163
+ }
164
+ function lastNumber(values) {
165
+ return getCalculation(values, 'last-number');
166
+ }
167
+ function mean(values) {
168
+ return getCalculation(values, 'mean');
169
+ }
170
+ function sum(values) {
171
+ return getCalculation(values, 'sum');
172
+ }
173
+ function min(values) {
174
+ return getCalculation(values, 'min');
175
+ }
176
+ function max(values) {
177
+ return getCalculation(values, 'max');
178
+ }
@@ -14,6 +14,7 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ _export_star(require("./annotations"), exports);
17
18
  _export_star(require("./datasource"), exports);
18
19
  _export_star(require("./legend"), exports);
19
20
  _export_star(require("./log-queries"), exports);
@@ -26,6 +27,9 @@ _export_star(require("./time-series-queries"), exports);
26
27
  _export_star(require("./trace-queries"), exports);
27
28
  _export_star(require("./profile-queries"), exports);
28
29
  _export_star(require("./variables"), exports);
30
+ _export_star(require("./calculations"), exports);
31
+ _export_star(require("./alerts-queries"), exports);
32
+ _export_star(require("./silences-queries"), exports);
29
33
  function _export_star(from, to) {
30
34
  Object.keys(from).forEach(function(k) {
31
35
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -43,7 +43,8 @@ _export(exports, {
43
43
  return validateLegendSpec;
44
44
  }
45
45
  });
46
- const _core = require("@perses-dev/core");
46
+ const _components = require("@perses-dev/components");
47
+ const _calculations = require("./calculations");
47
48
  const legendValues = [
48
49
  'mean',
49
50
  'first',
@@ -89,7 +90,7 @@ const LEGEND_SIZE_CONFIG = {
89
90
  }
90
91
  };
91
92
  const LEGEND_VALUE_CONFIG = legendValues.reduce((config, value)=>{
92
- config[value] = _core.CALCULATIONS_CONFIG[value];
93
+ config[value] = _calculations.CALCULATIONS_CONFIG[value];
93
94
  return config;
94
95
  }, {});
95
96
  function validateLegendSpec(legend) {
@@ -97,13 +98,13 @@ function validateLegendSpec(legend) {
97
98
  // undefined is valid since this is how legend is hidden by default
98
99
  return true;
99
100
  }
100
- if (!(0, _core.isValidLegendPosition)(legend.position)) {
101
+ if (!(0, _components.isValidLegendPosition)(legend.position)) {
101
102
  return false;
102
103
  }
103
- if (legend.mode && !(0, _core.isValidLegendMode)(legend.mode)) {
104
+ if (legend.mode && !(0, _components.isValidLegendMode)(legend.mode)) {
104
105
  return false;
105
106
  }
106
- if (legend.size && !(0, _core.isValidLegendSize)(legend.size)) {
107
+ if (legend.size && !(0, _components.isValidLegendSize)(legend.size)) {
107
108
  return false;
108
109
  }
109
110
  return true;
@@ -1,3 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "calculateVolumeInterval", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return calculateVolumeInterval;
9
+ }
10
+ });
1
11
  // Copyright The Perses Authors
2
12
  // Licensed under the Apache License, Version 2.0 (the "License");
3
13
  // you may not use this file except in compliance with the License.
@@ -11,16 +21,6 @@
11
21
  // See the License for the specific language governing permissions and
12
22
  // limitations under the License.
13
23
  // Target number of bars for log volume histogram
14
- "use strict";
15
- Object.defineProperty(exports, "__esModule", {
16
- value: true
17
- });
18
- Object.defineProperty(exports, "calculateVolumeInterval", {
19
- enumerable: true,
20
- get: function() {
21
- return calculateVolumeInterval;
22
- }
23
- });
24
24
  const TARGET_HISTOGRAM_BARS = 40;
25
25
  // Standard intervals for histogram calculations (in milliseconds)
26
26
  const STANDARD_INTERVALS = [
@@ -20,21 +20,37 @@ Object.defineProperty(exports, "dynamicImportPluginLoader", {
20
20
  return dynamicImportPluginLoader;
21
21
  }
22
22
  });
23
+ const _plugins = require("./plugins");
23
24
  function dynamicImportPluginLoader(plugins) {
24
- const importMap = new Map(plugins.map((plugin)=>[
25
- plugin.resource,
26
- plugin.importPlugin
27
- ]));
25
+ const importMap = new Map();
26
+ for (const p of plugins){
27
+ const { resource, resource: { kind, metadata: { name, registry, version } }, importPlugin } = p;
28
+ importMap.set((0, _plugins.getPluginModuleCompoundKey)({
29
+ kind,
30
+ name,
31
+ registry,
32
+ version
33
+ }), {
34
+ resource,
35
+ importPlugin
36
+ });
37
+ }
28
38
  return {
29
39
  async getInstalledPlugins () {
30
- return Promise.resolve(Array.from(importMap.keys()));
40
+ return Promise.resolve(Array.from(importMap.values()).map((v)=>v.resource));
31
41
  },
32
42
  importPluginModule (resource) {
33
- const importFn = importMap.get(resource);
34
- if (importFn === undefined) {
43
+ const { kind, metadata: { name, version, registry } } = resource;
44
+ const { importPlugin } = importMap.get((0, _plugins.getPluginModuleCompoundKey)({
45
+ kind,
46
+ name,
47
+ registry,
48
+ version
49
+ })) || {};
50
+ if (importPlugin === undefined) {
35
51
  throw new Error('Plugin not found');
36
52
  }
37
- return importFn();
53
+ return importPlugin();
38
54
  }
39
55
  };
40
56
  }
@@ -14,3 +14,13 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ Object.defineProperty(exports, "getPluginModuleCompoundKey", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return getPluginModuleCompoundKey;
21
+ }
22
+ });
23
+ function getPluginModuleCompoundKey(compoundKey) {
24
+ const { kind, name, registry, version } = compoundKey;
25
+ return `${kind}:${name}:${registry ?? ''}:${version ?? ''}`;
26
+ }
@@ -0,0 +1,16 @@
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
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -14,3 +14,13 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
+ Object.defineProperty(exports, "isTimeSeriesValueTuple", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return isTimeSeriesValueTuple;
21
+ }
22
+ });
23
+ function isTimeSeriesValueTuple(data) {
24
+ if (data.length !== 2) return false;
25
+ return true;
26
+ }
@@ -147,7 +147,14 @@ const getPluginRuntime = ()=>{
147
147
  requiredVersion: '^5.5.0'
148
148
  }
149
149
  },
150
- // TODO should we add @perses-dev/spec here ?
150
+ '@perses-dev/spec': {
151
+ version: '0.2.0-beta.2',
152
+ lib: ()=>require('@perses-dev/spec'),
153
+ shareConfig: {
154
+ singleton: true,
155
+ requiredVersion: '^0.2.0-beta.2'
156
+ }
157
+ },
151
158
  '@perses-dev/core': {
152
159
  version: '0.53.1',
153
160
  lib: ()=>require('@perses-dev/core'),
@@ -156,6 +163,14 @@ const getPluginRuntime = ()=>{
156
163
  requiredVersion: '^0.53.1'
157
164
  }
158
165
  },
166
+ '@perses-dev/client': {
167
+ version: '0.54.0-beta.1',
168
+ lib: ()=>require('@perses-dev/client'),
169
+ shareConfig: {
170
+ singleton: true,
171
+ requiredVersion: '^0.54.0-beta.1'
172
+ }
173
+ },
159
174
  '@perses-dev/components': {
160
175
  version: '0.53.1',
161
176
  lib: ()=>require('@perses-dev/components'),
@@ -268,28 +283,49 @@ const getPluginRuntime = ()=>{
268
283
  }
269
284
  return instance;
270
285
  };
271
- const registerRemote = (name, baseURL)=>{
286
+ function getModuleFederationRemoteName(name, registry, version) {
287
+ return `${name}:${registry ?? ''}:${version ?? ''}`;
288
+ }
289
+ const registerRemote = (name, registry, version, baseURL)=>{
272
290
  const pluginRuntime = getPluginRuntime();
273
- const existingRemote = pluginRuntime.options.remotes.find((remote)=>remote.name === name);
291
+ const registryName = getModuleFederationRemoteName(name, registry, version);
292
+ const existingRemote = pluginRuntime.options.remotes.find((remote)=>remote.name === registryName);
274
293
  if (!existingRemote) {
275
- const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;
294
+ const nameVersionRegistry = [
295
+ name,
296
+ version,
297
+ registry
298
+ ].filter(Boolean).join('~');
299
+ const prefix = baseURL || '/plugins';
300
+ const remoteEntryURL = `${prefix}/${nameVersionRegistry}/mf-manifest.json`;
276
301
  pluginRuntime.registerRemotes([
277
302
  {
278
- name,
303
+ name: registryName,
279
304
  entry: remoteEntryURL,
280
- alias: name
305
+ alias: registryName
281
306
  }
282
307
  ]);
283
308
  }
284
309
  };
285
- const loadPlugin = async (moduleName, pluginName, baseURL)=>{
286
- registerRemote(moduleName, baseURL);
310
+ const loadPlugin = async (target)=>{
311
+ const { moduleName, pluginName, registry, version, baseURL } = target;
312
+ registerRemote(moduleName, registry, version, baseURL);
287
313
  const pluginRuntime = getPluginRuntime();
288
- return pluginRuntime.loadRemote(`${moduleName}/${pluginName}`);
314
+ const registryName = getModuleFederationRemoteName(moduleName, registry, version);
315
+ return pluginRuntime.loadRemote(`${registryName}/${pluginName}`);
289
316
  };
290
317
  function usePluginRuntime({ plugin }) {
291
318
  return {
292
319
  pluginRuntime: getPluginRuntime(),
293
- loadPlugin: ()=>loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL)
320
+ loadPlugin: ()=>{
321
+ const { moduleName, name: pluginName, registry, version, baseURL } = plugin;
322
+ return loadPlugin({
323
+ moduleName,
324
+ pluginName,
325
+ registry,
326
+ version,
327
+ baseURL
328
+ });
329
+ }
294
330
  };
295
331
  }
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "remotePluginLoader", {
20
20
  return remotePluginLoader;
21
21
  }
22
22
  });
23
+ const _pluginsystem = require("@perses-dev/plugin-system");
23
24
  const _PluginRuntime = require("./PluginRuntime");
24
25
  const isPluginMetadata = (plugin)=>{
25
26
  return typeof plugin === 'object' && plugin !== null && 'kind' in plugin && 'spec' in plugin && typeof plugin.spec === 'object' && plugin.spec !== null && 'name' in plugin.spec;
@@ -59,17 +60,39 @@ function remotePluginLoader(options) {
59
60
  return pluginModules;
60
61
  },
61
62
  importPluginModule: async (resource)=>{
62
- const pluginModuleName = resource.metadata.name;
63
+ const { name: pluginModuleName, version, registry } = resource.metadata;
63
64
  const pluginModule = {};
64
- for (const plugin of resource.spec.plugins){
65
- const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(pluginModuleName, plugin.spec.name, pluginsAssetsPath);
65
+ const loadPromises = resource.spec.plugins.map(async (plugin)=>{
66
+ const remotePluginModule = await (0, _PluginRuntime.loadPlugin)({
67
+ moduleName: pluginModuleName,
68
+ pluginName: plugin.spec.name,
69
+ registry,
70
+ version,
71
+ baseURL: pluginsAssetsPath
72
+ });
66
73
  const remotePlugin = remotePluginModule?.[plugin.spec.name];
67
74
  if (remotePlugin) {
68
- pluginModule[plugin.spec.name] = remotePlugin;
75
+ return {
76
+ kind: plugin.kind,
77
+ name: plugin.spec.name,
78
+ remotePlugin
79
+ };
69
80
  } else {
70
81
  console.error(`RemotePluginLoader: Error loading plugin ${plugin.spec.name}`);
82
+ return null;
71
83
  }
72
- }
84
+ });
85
+ const loadedPlugins = await Promise.all(loadPromises);
86
+ loadedPlugins.forEach((item)=>{
87
+ if (item?.remotePlugin) {
88
+ pluginModule[(0, _pluginsystem.getPluginModuleCompoundKey)({
89
+ kind: item.kind,
90
+ name: item.name,
91
+ registry,
92
+ version
93
+ })] = item.remotePlugin;
94
+ }
95
+ });
73
96
  return pluginModule;
74
97
  }
75
98
  };