@perses-dev/plugin-system 0.0.0-snapshot-scatter-chart-embed-8efdfab → 0.0.0-snapshot-explorer-plugin-c4a7621

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 (431) hide show
  1. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
  2. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +83 -163
  3. package/dist/cjs/components/DatasourceSelect.js +12 -15
  4. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +528 -0
  5. package/dist/cjs/components/{TimeSeriesQueryEditor → HTTPSettingsEditor}/index.js +2 -2
  6. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +8 -7
  7. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +41 -0
  8. package/dist/cjs/{validation/resource.js → components/MetricLabelInput/index.js} +15 -9
  9. package/dist/cjs/components/{TraceQueryEditor/TraceQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +39 -40
  10. package/dist/cjs/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +23 -11
  11. package/dist/cjs/components/MultiQueryEditor/index.js +30 -0
  12. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
  13. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  14. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  15. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +54 -62
  16. package/dist/cjs/components/PluginEditor/PluginEditor.js +16 -13
  17. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +44 -33
  18. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +55 -7
  19. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +9 -10
  20. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +20 -17
  21. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  22. package/dist/cjs/components/ProjectSelect.js +7 -7
  23. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +131 -0
  24. package/dist/cjs/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
  25. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +394 -439
  26. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +17 -15
  27. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
  28. package/dist/cjs/components/Variables/variable-model.js +35 -37
  29. package/dist/cjs/components/index.js +4 -1
  30. package/dist/cjs/constants/user-interface-text.js +4 -1
  31. package/dist/cjs/context/ProjectStoreProvider.js +12 -9
  32. package/dist/cjs/context/ValidationProvider.js +69 -0
  33. package/dist/cjs/context/index.js +1 -0
  34. package/dist/cjs/index.js +1 -1
  35. package/dist/{components/TimeSeriesQueryEditor/index.js → cjs/model/explore.js} +4 -3
  36. package/dist/cjs/model/legend.js +5 -5
  37. package/dist/cjs/remote/PersesPlugin.types.js +16 -0
  38. package/dist/cjs/remote/PluginLoaderComponent.js +75 -0
  39. package/dist/cjs/remote/PluginRuntime.js +267 -0
  40. package/dist/cjs/{validation → remote}/index.js +2 -4
  41. package/dist/cjs/remote/remotePluginLoader.js +61 -0
  42. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +23 -14
  43. package/dist/cjs/runtime/DataQueriesProvider/model.js +10 -9
  44. package/dist/cjs/runtime/QueryCountProvider.js +83 -0
  45. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +37 -13
  46. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
  47. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +100 -0
  48. package/dist/cjs/runtime/TimeRangeProvider/index.js +2 -1
  49. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +20 -23
  50. package/dist/cjs/runtime/UsageMetricsProvider.js +99 -0
  51. package/dist/cjs/runtime/builtin-variables.js +7 -7
  52. package/dist/cjs/runtime/datasources.js +30 -21
  53. package/dist/cjs/runtime/index.js +4 -2
  54. package/dist/cjs/runtime/plugin-registry.js +48 -36
  55. package/dist/cjs/runtime/time-series-queries.js +35 -40
  56. package/dist/cjs/runtime/trace-queries.js +9 -6
  57. package/dist/cjs/runtime/{template-variables.js → variables.js} +38 -48
  58. package/dist/cjs/stories/shared-utils/decorators/WithDataQueries.js +1 -1
  59. package/dist/cjs/stories/shared-utils/decorators/WithPluginRegistry.js +1 -65
  60. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
  61. package/dist/cjs/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
  62. package/dist/cjs/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +9 -9
  63. package/dist/cjs/stories/shared-utils/decorators/WithTimeRange.js +1 -1
  64. package/dist/cjs/stories/shared-utils/decorators/index.js +2 -2
  65. package/dist/cjs/test/mock-data.js +25 -4
  66. package/dist/cjs/test/render.js +2 -11
  67. package/dist/cjs/test/test-plugins/bert/index.js +21 -20
  68. package/dist/cjs/test/test-plugins/ernie/index.js +2 -2
  69. package/dist/cjs/test/test-plugins/index.js +3 -1
  70. package/dist/cjs/test-utils/mock-plugin-registry.js +13 -13
  71. package/dist/cjs/utils/action.js +3 -3
  72. package/dist/cjs/utils/variables.js +24 -24
  73. package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -2
  74. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  75. package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
  76. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  77. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +7 -7
  78. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  79. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +86 -166
  80. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  81. package/dist/components/DatasourceSelect.d.ts +4 -4
  82. package/dist/components/DatasourceSelect.d.ts.map +1 -1
  83. package/dist/components/DatasourceSelect.js +9 -12
  84. package/dist/components/DatasourceSelect.js.map +1 -1
  85. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +11 -0
  86. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -0
  87. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +474 -0
  88. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -0
  89. package/dist/components/HTTPSettingsEditor/index.d.ts +2 -0
  90. package/dist/components/HTTPSettingsEditor/index.d.ts.map +1 -0
  91. package/dist/components/HTTPSettingsEditor/index.js +15 -0
  92. package/dist/components/HTTPSettingsEditor/index.js.map +1 -0
  93. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +3 -2
  94. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  95. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +10 -9
  96. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  97. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +7 -0
  98. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -0
  99. package/dist/components/MetricLabelInput/MetricLabelInput.js +33 -0
  100. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -0
  101. package/dist/components/MetricLabelInput/index.d.ts +2 -0
  102. package/dist/components/MetricLabelInput/index.d.ts.map +1 -0
  103. package/dist/components/MetricLabelInput/index.js +15 -0
  104. package/dist/components/MetricLabelInput/index.js.map +1 -0
  105. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +17 -0
  106. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -0
  107. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryEditor.js → MultiQueryEditor/MultiQueryEditor.js} +42 -39
  108. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -0
  109. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +29 -0
  110. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -0
  111. package/dist/components/{TimeSeriesQueryEditor/TimeSeriesQueryInput.js → MultiQueryEditor/QueryEditorContainer.js} +33 -10
  112. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -0
  113. package/dist/components/MultiQueryEditor/index.d.ts +2 -0
  114. package/dist/components/MultiQueryEditor/index.d.ts.map +1 -0
  115. package/dist/components/MultiQueryEditor/index.js +15 -0
  116. package/dist/components/{TraceQueryEditor → MultiQueryEditor}/index.js.map +1 -1
  117. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +4 -4
  118. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  119. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +3 -3
  120. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  121. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +2 -2
  122. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  123. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  124. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  125. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +5 -5
  126. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  127. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +3 -3
  128. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  129. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +5 -3
  130. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  131. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +56 -64
  132. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  133. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
  134. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  135. package/dist/components/PluginEditor/PluginEditor.js +16 -13
  136. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  137. package/dist/components/PluginEditor/plugin-editor-api.d.ts +16 -10
  138. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  139. package/dist/components/PluginEditor/plugin-editor-api.js +44 -33
  140. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  141. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +11 -5
  142. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  143. package/dist/components/PluginKindSelect/PluginKindSelect.js +61 -10
  144. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  145. package/dist/components/PluginRegistry/PluginRegistry.d.ts +4 -4
  146. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  147. package/dist/components/PluginRegistry/PluginRegistry.js +9 -10
  148. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  149. package/dist/components/PluginRegistry/plugin-indexes.d.ts +4 -4
  150. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  151. package/dist/components/PluginRegistry/plugin-indexes.js +17 -14
  152. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  153. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -5
  154. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  155. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +3 -3
  156. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  157. package/dist/components/ProjectSelect.d.ts +3 -3
  158. package/dist/components/ProjectSelect.d.ts.map +1 -1
  159. package/dist/components/ProjectSelect.js +7 -7
  160. package/dist/components/ProjectSelect.js.map +1 -1
  161. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +14 -0
  162. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -0
  163. package/dist/components/TimeRangeControls/TimeRangeControls.js +110 -0
  164. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -0
  165. package/dist/components/TimeRangeControls/index.d.ts +2 -0
  166. package/dist/components/TimeRangeControls/index.d.ts.map +1 -0
  167. package/dist/components/{TraceQueryEditor → TimeRangeControls}/index.js +1 -1
  168. package/dist/components/TimeRangeControls/index.js.map +1 -0
  169. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +4 -3
  170. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  171. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +395 -442
  172. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  173. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +3 -3
  174. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  175. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +11 -11
  176. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  177. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +3 -3
  178. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  179. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +7 -12
  180. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  181. package/dist/components/Variables/variable-model.d.ts +2 -1
  182. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  183. package/dist/components/Variables/variable-model.js +29 -31
  184. package/dist/components/Variables/variable-model.js.map +1 -1
  185. package/dist/components/index.d.ts +4 -1
  186. package/dist/components/index.d.ts.map +1 -1
  187. package/dist/components/index.js +4 -1
  188. package/dist/components/index.js.map +1 -1
  189. package/dist/constants/user-interface-text.d.ts +2 -0
  190. package/dist/constants/user-interface-text.d.ts.map +1 -1
  191. package/dist/constants/user-interface-text.js +4 -1
  192. package/dist/constants/user-interface-text.js.map +1 -1
  193. package/dist/context/ProjectStoreProvider.d.ts +4 -4
  194. package/dist/context/ProjectStoreProvider.d.ts.map +1 -1
  195. package/dist/context/ProjectStoreProvider.js +9 -6
  196. package/dist/context/ProjectStoreProvider.js.map +1 -1
  197. package/dist/context/ValidationProvider.d.ts +19 -0
  198. package/dist/context/ValidationProvider.d.ts.map +1 -0
  199. package/dist/context/ValidationProvider.js +52 -0
  200. package/dist/context/ValidationProvider.js.map +1 -0
  201. package/dist/context/index.d.ts +1 -0
  202. package/dist/context/index.d.ts.map +1 -1
  203. package/dist/context/index.js +1 -0
  204. package/dist/context/index.js.map +1 -1
  205. package/dist/context/query-params.d.ts.map +1 -1
  206. package/dist/context/query-params.js.map +1 -1
  207. package/dist/index.d.ts +1 -1
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +1 -1
  210. package/dist/index.js.map +1 -1
  211. package/dist/model/datasource.js +3 -1
  212. package/dist/model/datasource.js.map +1 -1
  213. package/dist/model/explore.d.ts +13 -0
  214. package/dist/model/explore.d.ts.map +1 -0
  215. package/dist/{validation/resource.js → model/explore.js} +4 -3
  216. package/dist/model/explore.js.map +1 -0
  217. package/dist/model/legend.d.ts +2 -2
  218. package/dist/model/legend.d.ts.map +1 -1
  219. package/dist/model/legend.js.map +1 -1
  220. package/dist/model/panels.d.ts +17 -5
  221. package/dist/model/panels.d.ts.map +1 -1
  222. package/dist/model/panels.js.map +1 -1
  223. package/dist/model/plugin-base.d.ts +0 -1
  224. package/dist/model/plugin-base.d.ts.map +1 -1
  225. package/dist/model/plugin-base.js.map +1 -1
  226. package/dist/model/plugin-loading.js.map +1 -1
  227. package/dist/model/plugins.d.ts +35 -21
  228. package/dist/model/plugins.d.ts.map +1 -1
  229. package/dist/model/plugins.js.map +1 -1
  230. package/dist/model/time-series-queries.d.ts +4 -3
  231. package/dist/model/time-series-queries.d.ts.map +1 -1
  232. package/dist/model/time-series-queries.js.map +1 -1
  233. package/dist/model/trace-queries.d.ts +1 -1
  234. package/dist/model/trace-queries.d.ts.map +1 -1
  235. package/dist/model/trace-queries.js.map +1 -1
  236. package/dist/model/variables.d.ts +2 -2
  237. package/dist/model/variables.d.ts.map +1 -1
  238. package/dist/model/variables.js +3 -1
  239. package/dist/model/variables.js.map +1 -1
  240. package/dist/remote/PersesPlugin.types.d.ts +7 -0
  241. package/dist/remote/PersesPlugin.types.d.ts.map +1 -0
  242. package/dist/remote/PersesPlugin.types.js +15 -0
  243. package/dist/remote/PersesPlugin.types.js.map +1 -0
  244. package/dist/remote/PluginLoaderComponent.d.ts +10 -0
  245. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -0
  246. package/dist/remote/PluginLoaderComponent.js +67 -0
  247. package/dist/remote/PluginLoaderComponent.js.map +1 -0
  248. package/dist/remote/PluginRuntime.d.ts +11 -0
  249. package/dist/remote/PluginRuntime.d.ts.map +1 -0
  250. package/dist/remote/PluginRuntime.js +202 -0
  251. package/dist/remote/PluginRuntime.js.map +1 -0
  252. package/dist/remote/index.d.ts +3 -0
  253. package/dist/remote/index.d.ts.map +1 -0
  254. package/dist/{validation → remote}/index.js +2 -4
  255. package/dist/remote/index.js.map +1 -0
  256. package/dist/remote/remotePluginLoader.d.ts +3 -0
  257. package/dist/remote/remotePluginLoader.d.ts.map +1 -0
  258. package/dist/remote/remotePluginLoader.js +53 -0
  259. package/dist/remote/remotePluginLoader.js.map +1 -0
  260. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +2 -2
  261. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  262. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +19 -10
  263. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  264. package/dist/runtime/DataQueriesProvider/model.d.ts +6 -7
  265. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  266. package/dist/runtime/DataQueriesProvider/model.js +10 -9
  267. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  268. package/dist/runtime/QueryCountProvider.d.ts +9 -0
  269. package/dist/runtime/QueryCountProvider.d.ts.map +1 -0
  270. package/dist/{validation/datasource.js → runtime/QueryCountProvider.js} +14 -10
  271. package/dist/runtime/QueryCountProvider.js.map +1 -0
  272. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +6 -2
  273. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  274. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +30 -9
  275. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  276. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts +2 -2
  277. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.d.ts.map +1 -1
  278. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js +3 -3
  279. package/dist/runtime/TimeRangeProvider/TimeRangeProviderWithQueryParams.js.map +1 -1
  280. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +32 -0
  281. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -0
  282. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +82 -0
  283. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -0
  284. package/dist/runtime/TimeRangeProvider/index.d.ts +1 -0
  285. package/dist/runtime/TimeRangeProvider/index.d.ts.map +1 -1
  286. package/dist/runtime/TimeRangeProvider/index.js +2 -1
  287. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  288. package/dist/runtime/TimeRangeProvider/query-params.d.ts +1 -1
  289. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  290. package/dist/runtime/TimeRangeProvider/query-params.js +8 -11
  291. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  292. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  293. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  294. package/dist/runtime/UsageMetricsProvider.d.ts +25 -0
  295. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -0
  296. package/dist/runtime/UsageMetricsProvider.js +77 -0
  297. package/dist/runtime/UsageMetricsProvider.js.map +1 -0
  298. package/dist/runtime/builtin-variables.d.ts +2 -2
  299. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  300. package/dist/runtime/builtin-variables.js +4 -4
  301. package/dist/runtime/builtin-variables.js.map +1 -1
  302. package/dist/runtime/datasources.d.ts +5 -4
  303. package/dist/runtime/datasources.d.ts.map +1 -1
  304. package/dist/runtime/datasources.js +24 -15
  305. package/dist/runtime/datasources.js.map +1 -1
  306. package/dist/runtime/index.d.ts +3 -1
  307. package/dist/runtime/index.d.ts.map +1 -1
  308. package/dist/runtime/index.js +4 -2
  309. package/dist/runtime/index.js.map +1 -1
  310. package/dist/runtime/plugin-registry.d.ts +11 -11
  311. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  312. package/dist/runtime/plugin-registry.js +40 -28
  313. package/dist/runtime/plugin-registry.js.map +1 -1
  314. package/dist/runtime/time-series-queries.d.ts +5 -4
  315. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  316. package/dist/runtime/time-series-queries.js +28 -33
  317. package/dist/runtime/time-series-queries.js.map +1 -1
  318. package/dist/runtime/trace-queries.d.ts +5 -4
  319. package/dist/runtime/trace-queries.d.ts.map +1 -1
  320. package/dist/runtime/trace-queries.js +10 -7
  321. package/dist/runtime/trace-queries.js.map +1 -1
  322. package/dist/runtime/{template-variables.d.ts → variables.d.ts} +7 -7
  323. package/dist/runtime/variables.d.ts.map +1 -0
  324. package/dist/runtime/{template-variables.js → variables.js} +35 -44
  325. package/dist/runtime/variables.js.map +1 -0
  326. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts +3 -3
  327. package/dist/stories/shared-utils/decorators/WithDataQueries.d.ts.map +1 -1
  328. package/dist/stories/shared-utils/decorators/WithDataQueries.js +1 -1
  329. package/dist/stories/shared-utils/decorators/WithDataQueries.js.map +1 -1
  330. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts +2 -2
  331. package/dist/stories/shared-utils/decorators/WithPluginRegistry.d.ts.map +1 -1
  332. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js +2 -22
  333. package/dist/stories/shared-utils/decorators/WithPluginRegistry.js.map +1 -1
  334. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts +3 -3
  335. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.d.ts.map +1 -1
  336. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js +1 -1
  337. package/dist/stories/shared-utils/decorators/WithPluginSystemBuiltinVariables.js.map +1 -1
  338. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts +3 -3
  339. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.d.ts.map +1 -1
  340. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js +5 -5
  341. package/dist/stories/shared-utils/decorators/WithPluginSystemDatasourceStore.js.map +1 -1
  342. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts +13 -0
  343. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.d.ts.map +1 -0
  344. package/dist/stories/shared-utils/decorators/{WithPluginSystemTemplateVariables.js → WithPluginSystemVariables.js} +10 -10
  345. package/dist/stories/shared-utils/decorators/WithPluginSystemVariables.js.map +1 -0
  346. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts +3 -3
  347. package/dist/stories/shared-utils/decorators/WithTimeRange.d.ts.map +1 -1
  348. package/dist/stories/shared-utils/decorators/WithTimeRange.js +1 -1
  349. package/dist/stories/shared-utils/decorators/WithTimeRange.js.map +1 -1
  350. package/dist/stories/shared-utils/decorators/index.d.ts +1 -1
  351. package/dist/stories/shared-utils/decorators/index.d.ts.map +1 -1
  352. package/dist/stories/shared-utils/decorators/index.js +2 -2
  353. package/dist/stories/shared-utils/decorators/index.js.map +1 -1
  354. package/dist/test/mock-data.d.ts.map +1 -1
  355. package/dist/test/mock-data.js +25 -4
  356. package/dist/test/mock-data.js.map +1 -1
  357. package/dist/test/render.d.ts +4 -4
  358. package/dist/test/render.d.ts.map +1 -1
  359. package/dist/test/render.js +2 -11
  360. package/dist/test/render.js.map +1 -1
  361. package/dist/test/setup-tests.js.map +1 -1
  362. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  363. package/dist/test/test-plugins/bert/index.js +21 -20
  364. package/dist/test/test-plugins/bert/index.js.map +1 -1
  365. package/dist/test/test-plugins/ernie/index.js +2 -2
  366. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  367. package/dist/test-utils/mock-plugin-registry.d.ts +6 -4
  368. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  369. package/dist/test-utils/mock-plugin-registry.js +10 -10
  370. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  371. package/dist/utils/variables.d.ts +4 -4
  372. package/dist/utils/variables.d.ts.map +1 -1
  373. package/dist/utils/variables.js +19 -19
  374. package/dist/utils/variables.js.map +1 -1
  375. package/package.json +7 -6
  376. package/dist/cjs/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js +0 -146
  377. package/dist/cjs/components/TraceQueryEditor/TraceQueryInput.js +0 -96
  378. package/dist/cjs/validation/datasource.js +0 -30
  379. package/dist/cjs/validation/role.js +0 -85
  380. package/dist/cjs/validation/rolebinding.js +0 -55
  381. package/dist/cjs/validation/secret.js +0 -176
  382. package/dist/cjs/validation/variable.js +0 -48
  383. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts +0 -8
  384. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.d.ts.map +0 -1
  385. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryEditor.js.map +0 -1
  386. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts +0 -13
  387. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.d.ts.map +0 -1
  388. package/dist/components/TimeSeriesQueryEditor/TimeSeriesQueryInput.js.map +0 -1
  389. package/dist/components/TimeSeriesQueryEditor/index.d.ts +0 -2
  390. package/dist/components/TimeSeriesQueryEditor/index.d.ts.map +0 -1
  391. package/dist/components/TimeSeriesQueryEditor/index.js.map +0 -1
  392. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts +0 -9
  393. package/dist/components/TraceQueryEditor/TraceQueryEditor.d.ts.map +0 -1
  394. package/dist/components/TraceQueryEditor/TraceQueryEditor.js +0 -130
  395. package/dist/components/TraceQueryEditor/TraceQueryEditor.js.map +0 -1
  396. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts +0 -13
  397. package/dist/components/TraceQueryEditor/TraceQueryInput.d.ts.map +0 -1
  398. package/dist/components/TraceQueryEditor/TraceQueryInput.js +0 -83
  399. package/dist/components/TraceQueryEditor/TraceQueryInput.js.map +0 -1
  400. package/dist/components/TraceQueryEditor/index.d.ts +0 -2
  401. package/dist/components/TraceQueryEditor/index.d.ts.map +0 -1
  402. package/dist/runtime/template-variables.d.ts.map +0 -1
  403. package/dist/runtime/template-variables.js.map +0 -1
  404. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts +0 -13
  405. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.d.ts.map +0 -1
  406. package/dist/stories/shared-utils/decorators/WithPluginSystemTemplateVariables.js.map +0 -1
  407. package/dist/validation/datasource.d.ts +0 -19
  408. package/dist/validation/datasource.d.ts.map +0 -1
  409. package/dist/validation/datasource.js.map +0 -1
  410. package/dist/validation/index.d.ts +0 -5
  411. package/dist/validation/index.d.ts.map +0 -1
  412. package/dist/validation/index.js.map +0 -1
  413. package/dist/validation/resource.d.ts +0 -3
  414. package/dist/validation/resource.d.ts.map +0 -1
  415. package/dist/validation/resource.js.map +0 -1
  416. package/dist/validation/role.d.ts +0 -228
  417. package/dist/validation/role.d.ts.map +0 -1
  418. package/dist/validation/role.js +0 -66
  419. package/dist/validation/role.js.map +0 -1
  420. package/dist/validation/rolebinding.d.ts +0 -137
  421. package/dist/validation/rolebinding.d.ts.map +0 -1
  422. package/dist/validation/rolebinding.js +0 -47
  423. package/dist/validation/rolebinding.js.map +0 -1
  424. package/dist/validation/secret.d.ts +0 -964
  425. package/dist/validation/secret.d.ts.map +0 -1
  426. package/dist/validation/secret.js +0 -157
  427. package/dist/validation/secret.js.map +0 -1
  428. package/dist/validation/variable.d.ts +0 -96
  429. package/dist/validation/variable.d.ts.map +0 -1
  430. package/dist/validation/variable.js +0 -40
  431. package/dist/validation/variable.js.map +0 -1
@@ -0,0 +1,267 @@
1
+ /* eslint-disable @typescript-eslint/no-require-imports */ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ loadPlugin: function() {
25
+ return loadPlugin;
26
+ },
27
+ pluginRuntime: function() {
28
+ return pluginRuntime;
29
+ },
30
+ usePluginRuntime: function() {
31
+ return usePluginRuntime;
32
+ }
33
+ });
34
+ const _runtime = require("@module-federation/enhanced/runtime");
35
+ const _reactquery = /*#__PURE__*/ _interop_require_wildcard(require("@tanstack/react-query"));
36
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
37
+ const _reactdom = /*#__PURE__*/ _interop_require_default(require("react-dom"));
38
+ const _reactrouterdom = /*#__PURE__*/ _interop_require_wildcard(require("react-router-dom"));
39
+ const _reacthookform = /*#__PURE__*/ _interop_require_wildcard(require("react-hook-form"));
40
+ function _interop_require_default(obj) {
41
+ return obj && obj.__esModule ? obj : {
42
+ default: obj
43
+ };
44
+ }
45
+ function _getRequireWildcardCache(nodeInterop) {
46
+ if (typeof WeakMap !== "function") return null;
47
+ var cacheBabelInterop = new WeakMap();
48
+ var cacheNodeInterop = new WeakMap();
49
+ return (_getRequireWildcardCache = function(nodeInterop) {
50
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
51
+ })(nodeInterop);
52
+ }
53
+ function _interop_require_wildcard(obj, nodeInterop) {
54
+ if (!nodeInterop && obj && obj.__esModule) {
55
+ return obj;
56
+ }
57
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
58
+ return {
59
+ default: obj
60
+ };
61
+ }
62
+ var cache = _getRequireWildcardCache(nodeInterop);
63
+ if (cache && cache.has(obj)) {
64
+ return cache.get(obj);
65
+ }
66
+ var newObj = {
67
+ __proto__: null
68
+ };
69
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
70
+ for(var key in obj){
71
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
72
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
73
+ if (desc && (desc.get || desc.set)) {
74
+ Object.defineProperty(newObj, key, desc);
75
+ } else {
76
+ newObj[key] = obj[key];
77
+ }
78
+ }
79
+ }
80
+ newObj.default = obj;
81
+ if (cache) {
82
+ cache.set(obj, newObj);
83
+ }
84
+ return newObj;
85
+ }
86
+ const pluginRuntime = (0, _runtime.init)({
87
+ name: '@perses/perses-ui-host',
88
+ remotes: [],
89
+ shared: {
90
+ react: {
91
+ version: _react.default.version,
92
+ lib: ()=>_react.default,
93
+ shareConfig: {
94
+ singleton: true,
95
+ requiredVersion: `^${_react.default.version}`
96
+ }
97
+ },
98
+ 'react-dom': {
99
+ version: '18.3.1',
100
+ lib: ()=>_reactdom.default,
101
+ shareConfig: {
102
+ singleton: true,
103
+ requiredVersion: `^18.3.1`
104
+ }
105
+ },
106
+ 'react-router-dom': {
107
+ version: '6.26.0',
108
+ lib: ()=>_reactrouterdom,
109
+ shareConfig: {
110
+ singleton: true,
111
+ requiredVersion: '^6.26.0'
112
+ }
113
+ },
114
+ '@tanstack/react-query': {
115
+ version: '4.36.1',
116
+ lib: ()=>_reactquery,
117
+ shareConfig: {
118
+ singleton: true,
119
+ requiredVersion: '^4.36.1'
120
+ }
121
+ },
122
+ 'react-hook-form': {
123
+ version: '7.52.2',
124
+ lib: ()=>_reacthookform,
125
+ shareConfig: {
126
+ singleton: true,
127
+ requiredVersion: '^7.52.2'
128
+ }
129
+ },
130
+ echarts: {
131
+ version: '5.5.0',
132
+ lib: ()=>require('echarts'),
133
+ shareConfig: {
134
+ singleton: true,
135
+ requiredVersion: '^5.5.0'
136
+ }
137
+ },
138
+ '@perses-dev/components': {
139
+ version: '0.50.0',
140
+ lib: ()=>require('@perses-dev/components'),
141
+ shareConfig: {
142
+ singleton: true,
143
+ requiredVersion: '^0.50.0'
144
+ }
145
+ },
146
+ '@perses-dev/plugin-system': {
147
+ version: '0.50.0',
148
+ lib: ()=>require('@perses-dev/plugin-system'),
149
+ shareConfig: {
150
+ singleton: true,
151
+ requiredVersion: '^0.50.0'
152
+ }
153
+ },
154
+ '@perses-dev/explore': {
155
+ version: '0.50.0',
156
+ lib: ()=>require('@perses-dev/explore'),
157
+ shareConfig: {
158
+ singleton: true,
159
+ requiredVersion: '^0.50.0'
160
+ }
161
+ },
162
+ '@perses-dev/dashboards': {
163
+ version: '0.50.0',
164
+ lib: ()=>require('@perses-dev/dashboards'),
165
+ shareConfig: {
166
+ singleton: true,
167
+ requiredVersion: '^0.50.0'
168
+ }
169
+ },
170
+ // Below are the shared modules that are used by the plugins, this can be part of the SDK
171
+ 'date-fns': {
172
+ version: '2.29.3',
173
+ lib: ()=>require('date-fns'),
174
+ shareConfig: {
175
+ singleton: true,
176
+ requiredVersion: '^2.29.3'
177
+ }
178
+ },
179
+ 'date-fns-tz': {
180
+ version: '1.3.8',
181
+ lib: ()=>require('date-fns-tz'),
182
+ shareConfig: {
183
+ singleton: true,
184
+ requiredVersion: '^1.3.8'
185
+ }
186
+ },
187
+ lodash: {
188
+ version: '4.17.21',
189
+ lib: ()=>require('lodash'),
190
+ shareConfig: {
191
+ singleton: true,
192
+ requiredVersion: '^4.17.21'
193
+ }
194
+ },
195
+ '@emotion/react': {
196
+ version: '11.11.3',
197
+ lib: ()=>require('@emotion/react'),
198
+ shareConfig: {
199
+ singleton: true,
200
+ requiredVersion: '^11.11.3'
201
+ }
202
+ },
203
+ '@emotion/styled': {
204
+ version: '11.11.0',
205
+ lib: ()=>require('@emotion/styled'),
206
+ shareConfig: {
207
+ singleton: true,
208
+ requiredVersion: '^11.11.0'
209
+ }
210
+ },
211
+ '@hookform/resolvers/zod': {
212
+ version: '3.3.4',
213
+ lib: ()=>require('@hookform/resolvers/zod'),
214
+ shareConfig: {
215
+ singleton: true,
216
+ requiredVersion: '^3.3.4'
217
+ }
218
+ },
219
+ 'use-resize-observer': {
220
+ version: '9.1.0',
221
+ lib: ()=>require('use-resize-observer'),
222
+ shareConfig: {
223
+ singleton: true,
224
+ requiredVersion: '^9.1.0'
225
+ }
226
+ },
227
+ 'mdi-material-ui': {
228
+ version: '7.4.0',
229
+ lib: ()=>require('mdi-material-ui'),
230
+ shareConfig: {
231
+ singleton: true,
232
+ requiredVersion: '^7.4.0'
233
+ }
234
+ },
235
+ immer: {
236
+ version: '9.0.15',
237
+ lib: ()=>require('immer'),
238
+ shareConfig: {
239
+ singleton: true,
240
+ requiredVersion: '^9.0.15'
241
+ }
242
+ }
243
+ }
244
+ });
245
+ const registerRemote = (name, baseURL)=>{
246
+ const existingRemote = pluginRuntime.options.remotes.find((remote)=>remote.name === name);
247
+ if (!existingRemote) {
248
+ const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;
249
+ pluginRuntime.registerRemotes([
250
+ {
251
+ name,
252
+ entry: remoteEntryURL,
253
+ alias: name
254
+ }
255
+ ]);
256
+ }
257
+ };
258
+ const loadPlugin = async (moduleName, pluginName, baseURL)=>{
259
+ registerRemote(moduleName, baseURL);
260
+ return (0, _runtime.loadRemote)(`${moduleName}/${pluginName}`);
261
+ };
262
+ function usePluginRuntime({ plugin }) {
263
+ return {
264
+ pluginRuntime,
265
+ loadPlugin: ()=>loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL)
266
+ };
267
+ }
@@ -14,10 +14,8 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- _export_star(require("./datasource"), exports);
18
- _export_star(require("./resource"), exports);
19
- _export_star(require("./secret"), exports);
20
- _export_star(require("./variable"), exports);
17
+ _export_star(require("./PluginLoaderComponent"), exports);
18
+ _export_star(require("./remotePluginLoader"), exports);
21
19
  function _export_star(from, to) {
22
20
  Object.keys(from).forEach(function(k) {
23
21
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,61 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "remotePluginLoader", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return remotePluginLoader;
21
+ }
22
+ });
23
+ const _PluginRuntime = require("./PluginRuntime");
24
+ const isPluginMetadata = (plugin)=>{
25
+ return typeof plugin === 'object' && plugin !== null && 'kind' in plugin && 'spec' in plugin && typeof plugin.spec === 'object' && plugin.spec !== null && 'name' in plugin.spec;
26
+ };
27
+ const isPluginModuleResource = (pluginModule)=>{
28
+ return typeof pluginModule === 'object' && pluginModule !== null && 'metadata' in pluginModule && 'spec' in pluginModule && typeof pluginModule.spec === 'object' && pluginModule.spec !== null && 'plugins' in pluginModule.spec && Array.isArray(pluginModule.spec.plugins) && pluginModule.spec.plugins.every(isPluginMetadata);
29
+ };
30
+ const remotePluginLoader = (baseURL)=>{
31
+ return {
32
+ getInstalledPlugins: async ()=>{
33
+ const pluginsResponse = await fetch(`${baseURL ? baseURL : ''}/api/v1/plugins`);
34
+ const plugins = await pluginsResponse.json();
35
+ let pluginModules = [];
36
+ if (Array.isArray(plugins)) {
37
+ pluginModules = plugins.filter(isPluginModuleResource);
38
+ } else {
39
+ console.error('RemotePluginLoader: Error loading plugins, response is not an array');
40
+ }
41
+ if (!pluginModules.length) {
42
+ console.error('RemotePluginLoader: No valid plugins found');
43
+ }
44
+ return pluginModules;
45
+ },
46
+ importPluginModule: async (resource)=>{
47
+ const pluginModuleName = resource.metadata.name;
48
+ const pluginModule = {};
49
+ for (const plugin of resource.spec.plugins){
50
+ const remotePluginModule = await (0, _PluginRuntime.loadPlugin)(pluginModuleName, plugin.spec.name);
51
+ const remotePlugin = remotePluginModule?.[plugin.spec.name];
52
+ if (remotePlugin) {
53
+ pluginModule[plugin.spec.name] = remotePlugin;
54
+ } else {
55
+ console.error(`RemotePluginLoader: Error loading plugin ${plugin.spec.name}`);
56
+ }
57
+ }
58
+ return pluginModule;
59
+ }
60
+ };
61
+ };
@@ -24,20 +24,21 @@ _export(exports, {
24
24
  DataQueriesContext: function() {
25
25
  return DataQueriesContext;
26
26
  },
27
- useDataQueriesContext: function() {
28
- return useDataQueriesContext;
27
+ DataQueriesProvider: function() {
28
+ return DataQueriesProvider;
29
29
  },
30
30
  useDataQueries: function() {
31
31
  return useDataQueries;
32
32
  },
33
- DataQueriesProvider: function() {
34
- return DataQueriesProvider;
33
+ useDataQueriesContext: function() {
34
+ return useDataQueriesContext;
35
35
  }
36
36
  });
37
37
  const _jsxruntime = require("react/jsx-runtime");
38
38
  const _react = require("react");
39
39
  const _timeseriesqueries = require("../time-series-queries");
40
40
  const _tracequeries = require("../trace-queries");
41
+ const _UsageMetricsProvider = require("../UsageMetricsProvider");
41
42
  const _model = require("./model");
42
43
  const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
43
44
  function useDataQueriesContext() {
@@ -50,15 +51,9 @@ function useDataQueriesContext() {
50
51
  function useDataQueries(queryType) {
51
52
  const ctx = useDataQueriesContext();
52
53
  // Filter the query results based on the specified query type
53
- const filteredQueryResults = ctx.queryResults.filter((queryResult)=>{
54
- var _queryResult_definition;
55
- return (queryResult === null || queryResult === void 0 ? void 0 : (_queryResult_definition = queryResult.definition) === null || _queryResult_definition === void 0 ? void 0 : _queryResult_definition.kind) === queryType;
56
- });
54
+ const filteredQueryResults = ctx.queryResults.filter((queryResult)=>queryResult?.definition?.kind === queryType);
57
55
  // Filter the errors based on the specified query type
58
- const filteredErrors = ctx.errors.filter((errors, index)=>{
59
- var _ctx_queryResults_index, _ctx_queryResults_index_definition;
60
- return ((_ctx_queryResults_index = ctx.queryResults[index]) === null || _ctx_queryResults_index === void 0 ? void 0 : (_ctx_queryResults_index_definition = _ctx_queryResults_index.definition) === null || _ctx_queryResults_index_definition === void 0 ? void 0 : _ctx_queryResults_index_definition.kind) === queryType;
61
- });
56
+ const filteredErrors = ctx.errors.filter((errors, index)=>ctx.queryResults[index]?.definition?.kind === queryType);
62
57
  // Create a new context object with the filtered results and errors
63
58
  const filteredCtx = {
64
59
  queryResults: filteredQueryResults,
@@ -70,7 +65,7 @@ function useDataQueries(queryType) {
70
65
  return filteredCtx;
71
66
  }
72
67
  function DataQueriesProvider(props) {
73
- const { definitions , options , children , queryOptions } = props;
68
+ const { definitions, options, children, queryOptions } = props;
74
69
  // Returns a query kind, for example "TimeSeriesQuery" = getQueryType("PrometheusTimeSeriesQuery")
75
70
  const getQueryType = (0, _model.useQueryType)();
76
71
  const queryDefinitions = definitions.map((definition)=>{
@@ -82,6 +77,7 @@ function DataQueriesProvider(props) {
82
77
  }
83
78
  };
84
79
  });
80
+ const usageMetrics = (0, _UsageMetricsProvider.useUsageMetrics)();
85
81
  // Filter definitions for time series query and other future query plugins
86
82
  const timeSeriesQueries = queryDefinitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
87
83
  const timeSeriesResults = (0, _timeseriesqueries.useTimeSeriesQueries)(timeSeriesQueries, options, queryOptions);
@@ -99,6 +95,17 @@ function DataQueriesProvider(props) {
99
95
  ...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries),
100
96
  ...(0, _model.transformQueryResults)(traceResults, traceQueries)
101
97
  ];
98
+ if (queryOptions?.enabled) {
99
+ for (const result of mergedQueryResults){
100
+ if (!result.isLoading && !result.isFetching && !result.error) {
101
+ usageMetrics.markQuery(result.definition, 'success');
102
+ } else if (result.error) {
103
+ usageMetrics.markQuery(result.definition, 'error');
104
+ } else {
105
+ usageMetrics.markQuery(result.definition, 'pending');
106
+ }
107
+ }
108
+ }
102
109
  return {
103
110
  queryResults: mergedQueryResults,
104
111
  isFetching: mergedQueryResults.some((result)=>result.isFetching),
@@ -111,7 +118,9 @@ function DataQueriesProvider(props) {
111
118
  timeSeriesResults,
112
119
  traceQueries,
113
120
  traceResults,
114
- refetchAll
121
+ refetchAll,
122
+ queryOptions?.enabled,
123
+ usageMetrics
115
124
  ]);
116
125
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(DataQueriesContext.Provider, {
117
126
  value: ctx,
@@ -31,7 +31,7 @@ _export(exports, {
31
31
  const _react = require("react");
32
32
  const _pluginregistry = require("../plugin-registry");
33
33
  function transformQueryResults(results, definitions) {
34
- return results.map(({ data , isFetching , isLoading , refetch , error }, i)=>{
34
+ return results.map(({ data, isFetching, isLoading, refetch, error }, i)=>{
35
35
  return {
36
36
  definition: definitions[i],
37
37
  data,
@@ -43,8 +43,12 @@ function transformQueryResults(results, definitions) {
43
43
  });
44
44
  }
45
45
  function useQueryType() {
46
- const { data: timeSeriesQueryPlugins , isLoading: isTimeSeriesQueryLoading } = (0, _pluginregistry.useListPluginMetadata)('TimeSeriesQuery');
47
- const { data: traceQueryPlugins , isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)('TraceQuery');
46
+ const { data: timeSeriesQueryPlugins, isLoading: isTimeSeriesQueryLoading } = (0, _pluginregistry.useListPluginMetadata)([
47
+ 'TimeSeriesQuery'
48
+ ]);
49
+ const { data: traceQueryPlugins, isLoading: isTraceQueryPluginLoading } = (0, _pluginregistry.useListPluginMetadata)([
50
+ 'TraceQuery'
51
+ ]);
48
52
  // For example, `map: {"TimeSeriesQuery":["PrometheusTimeSeriesQuery"],"TraceQuery":["TempoTraceQuery"]}`
49
53
  const queryTypeMap = (0, _react.useMemo)(()=>{
50
54
  const map = {
@@ -53,14 +57,12 @@ function useQueryType() {
53
57
  };
54
58
  if (timeSeriesQueryPlugins) {
55
59
  timeSeriesQueryPlugins.forEach((plugin)=>{
56
- var _map_plugin_pluginType;
57
- (_map_plugin_pluginType = map[plugin.pluginType]) === null || _map_plugin_pluginType === void 0 ? void 0 : _map_plugin_pluginType.push(plugin.kind);
60
+ map[plugin.kind]?.push(plugin.spec.name);
58
61
  });
59
62
  }
60
63
  if (traceQueryPlugins) {
61
64
  traceQueryPlugins.forEach((plugin)=>{
62
- var _map_plugin_pluginType;
63
- (_map_plugin_pluginType = map[plugin.pluginType]) === null || _map_plugin_pluginType === void 0 ? void 0 : _map_plugin_pluginType.push(plugin.kind);
65
+ map[plugin.kind]?.push(plugin.spec.name);
64
66
  });
65
67
  }
66
68
  return map;
@@ -82,8 +84,7 @@ function useQueryType() {
82
84
  return undefined;
83
85
  }
84
86
  for(const queryType in queryTypeMap){
85
- var _queryTypeMap_queryType;
86
- if ((_queryTypeMap_queryType = queryTypeMap[queryType]) === null || _queryTypeMap_queryType === void 0 ? void 0 : _queryTypeMap_queryType.includes(pluginKind)) {
87
+ if (queryTypeMap[queryType]?.includes(pluginKind)) {
87
88
  return queryType;
88
89
  }
89
90
  }
@@ -0,0 +1,83 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ QueryCountProvider: function() {
25
+ return QueryCountProvider;
26
+ },
27
+ useQueryCountContext: function() {
28
+ return useQueryCountContext;
29
+ }
30
+ });
31
+ const _jsxruntime = require("react/jsx-runtime");
32
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
33
+ function _getRequireWildcardCache(nodeInterop) {
34
+ if (typeof WeakMap !== "function") return null;
35
+ var cacheBabelInterop = new WeakMap();
36
+ var cacheNodeInterop = new WeakMap();
37
+ return (_getRequireWildcardCache = function(nodeInterop) {
38
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
39
+ })(nodeInterop);
40
+ }
41
+ function _interop_require_wildcard(obj, nodeInterop) {
42
+ if (!nodeInterop && obj && obj.__esModule) {
43
+ return obj;
44
+ }
45
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
46
+ return {
47
+ default: obj
48
+ };
49
+ }
50
+ var cache = _getRequireWildcardCache(nodeInterop);
51
+ if (cache && cache.has(obj)) {
52
+ return cache.get(obj);
53
+ }
54
+ var newObj = {
55
+ __proto__: null
56
+ };
57
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
58
+ for(var key in obj){
59
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
60
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
61
+ if (desc && (desc.get || desc.set)) {
62
+ Object.defineProperty(newObj, key, desc);
63
+ } else {
64
+ newObj[key] = obj[key];
65
+ }
66
+ }
67
+ }
68
+ newObj.default = obj;
69
+ if (cache) {
70
+ cache.set(obj, newObj);
71
+ }
72
+ return newObj;
73
+ }
74
+ const QueryCountContext = /*#__PURE__*/ (0, _react.createContext)(0);
75
+ const QueryCountProvider = ({ queryCount, children })=>{
76
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(QueryCountContext.Provider, {
77
+ value: queryCount,
78
+ children: children
79
+ });
80
+ };
81
+ const useQueryCountContext = ()=>{
82
+ return (0, _react.useContext)(QueryCountContext);
83
+ };
@@ -24,14 +24,17 @@ _export(exports, {
24
24
  TimeRangeContext: function() {
25
25
  return TimeRangeContext;
26
26
  },
27
- useTimeRangeContext: function() {
28
- return useTimeRangeContext;
27
+ TimeRangeProvider: function() {
28
+ return TimeRangeProvider;
29
+ },
30
+ useSuggestedStepMs: function() {
31
+ return useSuggestedStepMs;
29
32
  },
30
33
  useTimeRange: function() {
31
34
  return useTimeRange;
32
35
  },
33
- TimeRangeProvider: function() {
34
- return TimeRangeProvider;
36
+ useTimeRangeContext: function() {
37
+ return useTimeRangeContext;
35
38
  }
36
39
  });
37
40
  const _jsxruntime = require("react/jsx-runtime");
@@ -59,7 +62,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
59
62
  if (cache && cache.has(obj)) {
60
63
  return cache.get(obj);
61
64
  }
62
- var newObj = {};
65
+ var newObj = {
66
+ __proto__: null
67
+ };
63
68
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
64
69
  for(var key in obj){
65
70
  if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
@@ -88,18 +93,24 @@ function useTimeRangeContext() {
88
93
  function useTimeRange() {
89
94
  return useTimeRangeContext();
90
95
  }
96
+ function useSuggestedStepMs(width) {
97
+ const { absoluteTimeRange } = useTimeRange();
98
+ if (width === undefined) return 0;
99
+ return (0, _core.getSuggestedStepMs)(absoluteTimeRange, width);
100
+ }
91
101
  function TimeRangeProvider(props) {
92
- const { timeRange , refreshInterval , children , setTimeRange , setRefreshInterval } = props;
102
+ const { timeRange, refreshInterval, children, setTimeRange, setRefreshInterval } = props;
93
103
  const [localTimeRange, setLocalTimeRange] = (0, _react.useState)(timeRange);
94
- const [localRefreshInterval, setLocalefreshInterval] = (0, _react.useState)(refreshInterval);
104
+ const [localRefreshInterval, setLocalRefreshInterval] = (0, _react.useState)(refreshInterval);
95
105
  const [refreshCounter, setRefreshCounter] = (0, _react.useState)(0);
96
106
  (0, _react.useEffect)(()=>{
97
107
  setLocalTimeRange(timeRange);
98
108
  }, [
99
- timeRange
109
+ timeRange,
110
+ refreshCounter
100
111
  ]);
101
112
  (0, _react.useEffect)(()=>{
102
- setLocalefreshInterval(refreshInterval);
113
+ setLocalRefreshInterval(refreshInterval);
103
114
  }, [
104
115
  refreshInterval
105
116
  ]);
@@ -108,24 +119,37 @@ function TimeRangeProvider(props) {
108
119
  }, [
109
120
  setRefreshCounter
110
121
  ]);
122
+ const refreshIntervalInMs = (0, _refreshinterval.getRefreshIntervalInMs)(localRefreshInterval);
123
+ (0, _react.useEffect)(()=>{
124
+ if (refreshIntervalInMs > 0) {
125
+ const interval = setInterval(()=>{
126
+ refresh();
127
+ }, refreshIntervalInMs);
128
+ return ()=>clearInterval(interval);
129
+ }
130
+ }, [
131
+ refresh,
132
+ refreshIntervalInMs
133
+ ]);
111
134
  const ctx = (0, _react.useMemo)(()=>{
112
135
  const absoluteTimeRange = (0, _core.isRelativeTimeRange)(localTimeRange) ? (0, _core.toAbsoluteTimeRange)(localTimeRange) : localTimeRange;
113
136
  return {
114
137
  timeRange: localTimeRange,
115
- setTimeRange: setTimeRange !== null && setTimeRange !== void 0 ? setTimeRange : setLocalTimeRange,
138
+ setTimeRange: setTimeRange ?? setLocalTimeRange,
116
139
  absoluteTimeRange,
117
140
  refresh,
118
141
  refreshKey: `${absoluteTimeRange.start}:${absoluteTimeRange.end}:${localRefreshInterval}:${refreshCounter}`,
119
142
  refreshInterval: localRefreshInterval,
120
- refreshIntervalInMs: (0, _refreshinterval.getRefreshIntervalInMs)(localRefreshInterval),
121
- setRefreshInterval: setRefreshInterval !== null && setRefreshInterval !== void 0 ? setRefreshInterval : setLocalefreshInterval
143
+ refreshIntervalInMs: refreshIntervalInMs,
144
+ setRefreshInterval: setRefreshInterval ?? setLocalRefreshInterval
122
145
  };
123
146
  }, [
124
147
  localTimeRange,
125
148
  setTimeRange,
126
149
  refresh,
127
- refreshCounter,
128
150
  localRefreshInterval,
151
+ refreshCounter,
152
+ refreshIntervalInMs,
129
153
  setRefreshInterval
130
154
  ]);
131
155
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(TimeRangeContext.Provider, {
@@ -30,9 +30,9 @@ function _interop_require_default(obj) {
30
30
  };
31
31
  }
32
32
  function TimeRangeProviderWithQueryParams(props) {
33
- const { initialTimeRange , initialRefreshInterval , children } = props;
34
- const { timeRange , setTimeRange } = (0, _queryparams.useTimeRangeParams)(initialTimeRange);
35
- const { refreshInterval , setRefreshInterval } = (0, _queryparams.useSetRefreshIntervalParams)(initialRefreshInterval);
33
+ const { initialTimeRange, initialRefreshInterval, children } = props;
34
+ const { timeRange, setTimeRange } = (0, _queryparams.useTimeRangeParams)(initialTimeRange);
35
+ const { refreshInterval, setRefreshInterval } = (0, _queryparams.useSetRefreshIntervalParams)(initialRefreshInterval);
36
36
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_TimeRangeProvider.TimeRangeProvider, {
37
37
  timeRange: timeRange,
38
38
  refreshInterval: refreshInterval,