@perses-dev/plugin-system 0.55.0-beta.2 → 0.55.0-beta.6

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 (563) hide show
  1. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts +3 -3
  2. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.d.ts.map +1 -1
  3. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +11 -11
  4. package/dist/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js.map +1 -1
  5. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts +3 -3
  6. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.d.ts.map +1 -1
  7. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +6 -6
  8. package/dist/components/Annotations/AnnotationEditorForm/AnnotationPreview.js.map +1 -1
  9. package/dist/components/Annotations/AnnotationEditorForm/index.js +1 -1
  10. package/dist/components/Annotations/AnnotationEditorForm/index.js.map +1 -1
  11. package/dist/components/Annotations/index.js +2 -2
  12. package/dist/components/Annotations/index.js.map +1 -1
  13. package/dist/components/CalculationSelector/CalculationSelector.d.ts +2 -2
  14. package/dist/components/CalculationSelector/CalculationSelector.d.ts.map +1 -1
  15. package/dist/components/CalculationSelector/CalculationSelector.js +2 -2
  16. package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
  17. package/dist/components/CalculationSelector/index.js +1 -1
  18. package/dist/components/CalculationSelector/index.js.map +1 -1
  19. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts +3 -2
  20. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.d.ts.map +1 -1
  21. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js +10 -9
  22. package/dist/components/DatasourceEditorForm/DatasourceEditorForm.js.map +1 -1
  23. package/dist/components/DatasourceEditorForm/index.js +1 -1
  24. package/dist/components/DatasourceEditorForm/index.js.map +1 -1
  25. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts +4 -4
  26. package/dist/components/DatasourceSelect/DatasourceSelect.d.ts.map +1 -1
  27. package/dist/components/DatasourceSelect/DatasourceSelect.js +7 -7
  28. package/dist/components/DatasourceSelect/DatasourceSelect.js.map +1 -1
  29. package/dist/components/DatasourceSelect/index.js +1 -1
  30. package/dist/components/DatasourceSelect/index.js.map +1 -1
  31. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts +8 -0
  32. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.d.ts.map +1 -0
  33. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js +45 -0
  34. package/dist/components/DatasourceTestConnectionButton/DatasourceTestConnectionButton.js.map +1 -0
  35. package/dist/components/DatasourceTestConnectionButton/index.d.ts +2 -0
  36. package/dist/components/DatasourceTestConnectionButton/index.d.ts.map +1 -0
  37. package/dist/{cjs/model/alerts-queries.js → components/DatasourceTestConnectionButton/index.js} +3 -4
  38. package/dist/components/DatasourceTestConnectionButton/index.js.map +1 -0
  39. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +3 -2
  40. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  41. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +54 -29
  42. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  43. package/dist/components/HTTPSettingsEditor/index.js +1 -1
  44. package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
  45. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +1 -1
  46. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
  47. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +24 -24
  48. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  49. package/dist/components/ItemSelectionActionsOptionsEditor/index.js +1 -1
  50. package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -1
  51. package/dist/components/LayoutEditor/LayoutEditor.d.ts +16 -0
  52. package/dist/components/LayoutEditor/LayoutEditor.d.ts.map +1 -0
  53. package/dist/components/LayoutEditor/LayoutEditor.js +115 -0
  54. package/dist/components/LayoutEditor/LayoutEditor.js.map +1 -0
  55. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts +7 -0
  56. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts.map +1 -0
  57. package/dist/components/LayoutEditor/RepeatLayoutPreview.js +92 -0
  58. package/dist/components/LayoutEditor/RepeatLayoutPreview.js.map +1 -0
  59. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts +18 -0
  60. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts.map +1 -0
  61. package/dist/components/LayoutEditor/RepeatVariableEditor.js +168 -0
  62. package/dist/components/LayoutEditor/RepeatVariableEditor.js.map +1 -0
  63. package/dist/components/LayoutEditor/index.d.ts +4 -0
  64. package/dist/components/LayoutEditor/index.d.ts.map +1 -0
  65. package/dist/{cjs/model/explore.js → components/LayoutEditor/index.js} +5 -4
  66. package/dist/components/LayoutEditor/index.js.map +1 -0
  67. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -2
  68. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  69. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +5 -5
  70. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  71. package/dist/components/LegendOptionsEditor/index.js +1 -1
  72. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  73. package/dist/components/LinksEditor/LinksEditor.d.ts +3 -3
  74. package/dist/components/LinksEditor/LinksEditor.d.ts.map +1 -1
  75. package/dist/components/LinksEditor/LinksEditor.js +6 -6
  76. package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
  77. package/dist/components/LinksEditor/index.js +1 -1
  78. package/dist/components/LinksEditor/index.js.map +1 -1
  79. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +1 -1
  80. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -1
  81. package/dist/components/MetricLabelInput/MetricLabelInput.js +2 -2
  82. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  83. package/dist/components/MetricLabelInput/index.js +1 -1
  84. package/dist/components/MetricLabelInput/index.js.map +1 -1
  85. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -4
  86. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  87. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +12 -9
  88. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  89. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -4
  90. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  91. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -14
  92. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  93. package/dist/components/MultiQueryEditor/index.js +2 -2
  94. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  95. package/dist/components/MultiQueryEditor/utils.d.ts +1 -1
  96. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -1
  97. package/dist/components/MultiQueryEditor/utils.js.map +1 -1
  98. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +1 -1
  99. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  100. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +4 -4
  101. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  102. package/dist/components/OptionsEditorRadios/index.js +1 -1
  103. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  104. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  105. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  106. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  107. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  108. package/dist/components/OptionsEditorTabPanel/index.js +1 -1
  109. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  110. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +1 -1
  111. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  112. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +4 -4
  113. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  114. package/dist/components/OptionsEditorTabs/index.js +1 -1
  115. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  116. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts +2 -2
  117. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts.map +1 -1
  118. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js +9 -9
  119. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js.map +1 -1
  120. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +7 -5
  121. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  122. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +19 -10
  123. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  124. package/dist/components/PanelSpecEditor/index.js +1 -1
  125. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  126. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
  127. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  128. package/dist/components/PluginEditor/PluginEditor.js +10 -9
  129. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  130. package/dist/components/PluginEditor/index.js +2 -2
  131. package/dist/components/PluginEditor/index.js.map +1 -1
  132. package/dist/components/PluginEditor/plugin-editor-api.d.ts +4 -3
  133. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  134. package/dist/components/PluginEditor/plugin-editor-api.js +4 -4
  135. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  136. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +3 -4
  137. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  138. package/dist/components/PluginKindSelect/PluginKindSelect.js +4 -4
  139. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  140. package/dist/components/PluginKindSelect/index.js +1 -1
  141. package/dist/components/PluginKindSelect/index.js.map +1 -1
  142. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  143. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  144. package/dist/components/PluginRegistry/PluginRegistry.js +5 -5
  145. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  146. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +2 -2
  147. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
  148. package/dist/components/PluginRegistry/getPluginSearchHelper.js +2 -2
  149. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -1
  150. package/dist/components/PluginRegistry/index.js +1 -1
  151. package/dist/components/PluginRegistry/index.js.map +1 -1
  152. package/dist/components/PluginRegistry/plugin-indexes.d.ts +2 -1
  153. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  154. package/dist/components/PluginRegistry/plugin-indexes.js +3 -3
  155. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  156. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts +10 -0
  157. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts.map +1 -0
  158. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js +62 -0
  159. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js.map +1 -0
  160. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
  161. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  162. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +19 -5
  163. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  164. package/dist/components/PluginSpecEditor/index.js +1 -1
  165. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  166. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +1 -1
  167. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -1
  168. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +3 -3
  169. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  170. package/dist/components/SelectionOptionsEditor/index.js +1 -1
  171. package/dist/components/SelectionOptionsEditor/index.js.map +1 -1
  172. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +2 -2
  173. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  174. package/dist/components/TimeRangeControls/TimeRangeControls.js +13 -14
  175. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  176. package/dist/components/TimeRangeControls/index.js +1 -1
  177. package/dist/components/TimeRangeControls/index.js.map +1 -1
  178. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +3 -3
  179. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  180. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -11
  181. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  182. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
  183. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +7 -7
  185. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  186. package/dist/components/Variables/VariableEditorForm/index.js +3 -3
  187. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  188. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  189. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  190. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  191. package/dist/components/Variables/index.js +2 -2
  192. package/dist/components/Variables/index.js.map +1 -1
  193. package/dist/components/Variables/variable-model.d.ts +4 -4
  194. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  195. package/dist/components/Variables/variable-model.js +3 -3
  196. package/dist/components/Variables/variable-model.js.map +1 -1
  197. package/dist/components/index.d.ts +2 -0
  198. package/dist/components/index.d.ts.map +1 -1
  199. package/dist/components/index.js +21 -19
  200. package/dist/components/index.js.map +1 -1
  201. package/dist/constants/index.d.ts +1 -0
  202. package/dist/constants/index.d.ts.map +1 -1
  203. package/dist/constants/index.js +2 -1
  204. package/dist/constants/index.js.map +1 -1
  205. package/dist/constants/repeat.d.ts +3 -0
  206. package/dist/constants/repeat.d.ts.map +1 -0
  207. package/dist/{cjs/model/datasource.js → constants/repeat.js} +4 -4
  208. package/dist/constants/repeat.js.map +1 -0
  209. package/dist/context/ValidationProvider.d.ts +5 -5
  210. package/dist/context/ValidationProvider.d.ts.map +1 -1
  211. package/dist/context/ValidationProvider.js +5 -5
  212. package/dist/context/ValidationProvider.js.map +1 -1
  213. package/dist/context/index.js +1 -1
  214. package/dist/context/index.js.map +1 -1
  215. package/dist/index.js +9 -9
  216. package/dist/index.js.map +1 -1
  217. package/dist/model/alerts-queries.d.ts +4 -4
  218. package/dist/model/alerts-queries.d.ts.map +1 -1
  219. package/dist/model/alerts-queries.js.map +1 -1
  220. package/dist/model/annotations.d.ts +3 -3
  221. package/dist/model/annotations.d.ts.map +1 -1
  222. package/dist/model/annotations.js.map +1 -1
  223. package/dist/model/calculations.d.ts +1 -1
  224. package/dist/model/calculations.d.ts.map +1 -1
  225. package/dist/model/calculations.js.map +1 -1
  226. package/dist/model/datasource.d.ts +10 -3
  227. package/dist/model/datasource.d.ts.map +1 -1
  228. package/dist/model/datasource.js +1 -1
  229. package/dist/model/datasource.js.map +1 -1
  230. package/dist/model/explore.d.ts +2 -3
  231. package/dist/model/explore.d.ts.map +1 -1
  232. package/dist/model/explore.js.map +1 -1
  233. package/dist/model/index.d.ts +1 -0
  234. package/dist/model/index.d.ts.map +1 -1
  235. package/dist/model/index.js +17 -16
  236. package/dist/model/index.js.map +1 -1
  237. package/dist/model/json-queries.d.ts +29 -0
  238. package/dist/model/json-queries.d.ts.map +1 -0
  239. package/dist/{cjs/model/annotations.js → model/json-queries.js} +5 -4
  240. package/dist/model/json-queries.js.map +1 -0
  241. package/dist/model/legend.d.ts +2 -2
  242. package/dist/model/legend.d.ts.map +1 -1
  243. package/dist/model/legend.js +2 -2
  244. package/dist/model/legend.js.map +1 -1
  245. package/dist/model/log-queries.d.ts +3 -3
  246. package/dist/model/log-queries.d.ts.map +1 -1
  247. package/dist/model/log-queries.js.map +1 -1
  248. package/dist/model/panels.d.ts +13 -4
  249. package/dist/model/panels.d.ts.map +1 -1
  250. package/dist/model/panels.js.map +1 -1
  251. package/dist/model/plugin-base.d.ts +3 -3
  252. package/dist/model/plugin-base.d.ts.map +1 -1
  253. package/dist/model/plugin-base.js.map +1 -1
  254. package/dist/model/plugin-loading.d.ts +1 -1
  255. package/dist/model/plugin-loading.d.ts.map +1 -1
  256. package/dist/model/plugin-loading.js +1 -1
  257. package/dist/model/plugin-loading.js.map +1 -1
  258. package/dist/model/plugins.d.ts +15 -13
  259. package/dist/model/plugins.d.ts.map +1 -1
  260. package/dist/model/plugins.js.map +1 -1
  261. package/dist/model/profile-queries.d.ts +4 -4
  262. package/dist/model/profile-queries.d.ts.map +1 -1
  263. package/dist/model/profile-queries.js.map +1 -1
  264. package/dist/model/silences-queries.d.ts +4 -4
  265. package/dist/model/silences-queries.d.ts.map +1 -1
  266. package/dist/model/silences-queries.js.map +1 -1
  267. package/dist/model/time-series-queries.d.ts +4 -4
  268. package/dist/model/time-series-queries.d.ts.map +1 -1
  269. package/dist/model/time-series-queries.js.map +1 -1
  270. package/dist/model/trace-queries.d.ts +4 -4
  271. package/dist/model/trace-queries.d.ts.map +1 -1
  272. package/dist/model/trace-queries.js.map +1 -1
  273. package/dist/model/variables.d.ts +7 -3
  274. package/dist/model/variables.d.ts.map +1 -1
  275. package/dist/model/variables.js +1 -3
  276. package/dist/model/variables.js.map +1 -1
  277. package/dist/remote/PluginLoaderComponent.d.ts +1 -2
  278. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
  279. package/dist/remote/PluginLoaderComponent.js +2 -2
  280. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  281. package/dist/remote/PluginRuntime.d.ts +2 -2
  282. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  283. package/dist/remote/PluginRuntime.js +18 -26
  284. package/dist/remote/PluginRuntime.js.map +1 -1
  285. package/dist/remote/index.js +2 -2
  286. package/dist/remote/index.js.map +1 -1
  287. package/dist/remote/remotePluginLoader.d.ts +2 -2
  288. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  289. package/dist/remote/remotePluginLoader.js +3 -3
  290. package/dist/remote/remotePluginLoader.js.map +1 -1
  291. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +3 -3
  292. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  293. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +20 -12
  294. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  295. package/dist/runtime/DataQueriesProvider/index.js +2 -2
  296. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  297. package/dist/runtime/DataQueriesProvider/model.d.ts +3 -3
  298. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  299. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  300. package/dist/runtime/RouterProvider.d.ts +2 -1
  301. package/dist/runtime/RouterProvider.d.ts.map +1 -1
  302. package/dist/runtime/RouterProvider.js +3 -3
  303. package/dist/runtime/RouterProvider.js.map +1 -1
  304. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +3 -2
  305. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  306. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +22 -8
  307. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  308. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -2
  309. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
  310. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +5 -5
  311. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  312. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +9 -2
  313. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  314. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +16 -3
  315. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  316. package/dist/runtime/TimeRangeProvider/index.js +4 -4
  317. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  318. package/dist/runtime/TimeRangeProvider/query-params.d.ts +3 -3
  319. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  320. package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
  321. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  322. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
  323. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  324. package/dist/runtime/TimeRangeProvider/refresh-interval.js +2 -2
  325. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  326. package/dist/runtime/UsageMetricsProvider.d.ts +3 -3
  327. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  328. package/dist/runtime/UsageMetricsProvider.js +3 -3
  329. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  330. package/dist/runtime/alerts-queries.d.ts +2 -2
  331. package/dist/runtime/alerts-queries.d.ts.map +1 -1
  332. package/dist/runtime/alerts-queries.js +5 -5
  333. package/dist/runtime/alerts-queries.js.map +1 -1
  334. package/dist/runtime/annotations.d.ts +2 -2
  335. package/dist/runtime/annotations.d.ts.map +1 -1
  336. package/dist/runtime/annotations.js +6 -6
  337. package/dist/runtime/annotations.js.map +1 -1
  338. package/dist/runtime/builtin-variables.d.ts +2 -3
  339. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  340. package/dist/runtime/builtin-variables.js +1 -1
  341. package/dist/runtime/builtin-variables.js.map +1 -1
  342. package/dist/runtime/datasources.d.ts +2 -3
  343. package/dist/runtime/datasources.d.ts.map +1 -1
  344. package/dist/runtime/datasources.js +2 -2
  345. package/dist/runtime/datasources.js.map +1 -1
  346. package/dist/runtime/index.d.ts +1 -0
  347. package/dist/runtime/index.d.ts.map +1 -1
  348. package/dist/runtime/index.js +16 -15
  349. package/dist/runtime/index.js.map +1 -1
  350. package/dist/runtime/item-actions.d.ts +3 -3
  351. package/dist/runtime/item-actions.d.ts.map +1 -1
  352. package/dist/runtime/item-actions.js +2 -2
  353. package/dist/runtime/item-actions.js.map +1 -1
  354. package/dist/runtime/json-queries.d.ts +11 -0
  355. package/dist/runtime/json-queries.d.ts.map +1 -0
  356. package/dist/runtime/json-queries.js +58 -0
  357. package/dist/runtime/json-queries.js.map +1 -0
  358. package/dist/runtime/log-queries.d.ts +3 -3
  359. package/dist/runtime/log-queries.d.ts.map +1 -1
  360. package/dist/runtime/log-queries.js +5 -5
  361. package/dist/runtime/log-queries.js.map +1 -1
  362. package/dist/runtime/plugin-registry.d.ts +3 -4
  363. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  364. package/dist/runtime/plugin-registry.js +2 -2
  365. package/dist/runtime/plugin-registry.js.map +1 -1
  366. package/dist/runtime/profile-queries.d.ts +2 -2
  367. package/dist/runtime/profile-queries.d.ts.map +1 -1
  368. package/dist/runtime/profile-queries.js +4 -4
  369. package/dist/runtime/profile-queries.js.map +1 -1
  370. package/dist/runtime/silences-queries.d.ts +2 -2
  371. package/dist/runtime/silences-queries.d.ts.map +1 -1
  372. package/dist/runtime/silences-queries.js +5 -5
  373. package/dist/runtime/silences-queries.js.map +1 -1
  374. package/dist/runtime/time-series-queries.d.ts +3 -3
  375. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  376. package/dist/runtime/time-series-queries.js +6 -6
  377. package/dist/runtime/time-series-queries.js.map +1 -1
  378. package/dist/runtime/trace-queries.d.ts +2 -2
  379. package/dist/runtime/trace-queries.d.ts.map +1 -1
  380. package/dist/runtime/trace-queries.js +6 -6
  381. package/dist/runtime/trace-queries.js.map +1 -1
  382. package/dist/runtime/utils.d.ts +1 -1
  383. package/dist/runtime/utils.d.ts.map +1 -1
  384. package/dist/runtime/utils.js.map +1 -1
  385. package/dist/runtime/variables.d.ts +1 -2
  386. package/dist/runtime/variables.d.ts.map +1 -1
  387. package/dist/runtime/variables.js +4 -4
  388. package/dist/runtime/variables.js.map +1 -1
  389. package/dist/schema/index.js +1 -1
  390. package/dist/schema/index.js.map +1 -1
  391. package/dist/schema/panel.d.ts +2 -2
  392. package/dist/schema/panel.d.ts.map +1 -1
  393. package/dist/schema/panel.js +18 -4
  394. package/dist/schema/panel.js.map +1 -1
  395. package/dist/test/index.js +2 -2
  396. package/dist/test/index.js.map +1 -1
  397. package/dist/test/mock-data.d.ts +2 -1
  398. package/dist/test/mock-data.d.ts.map +1 -1
  399. package/dist/test/mock-data.js +6 -0
  400. package/dist/test/mock-data.js.map +1 -1
  401. package/dist/test/render-hook.d.ts +2 -2
  402. package/dist/test/render-hook.d.ts.map +1 -1
  403. package/dist/test/render-hook.js +2 -2
  404. package/dist/test/render-hook.js.map +1 -1
  405. package/dist/test/render.d.ts +3 -3
  406. package/dist/test/render.d.ts.map +1 -1
  407. package/dist/test/render.js +3 -3
  408. package/dist/test/render.js.map +1 -1
  409. package/dist/test/setup-tests.d.ts +1 -1
  410. package/dist/test/setup-tests.d.ts.map +1 -1
  411. package/dist/test/setup-tests.js +3 -2
  412. package/dist/test/setup-tests.js.map +1 -1
  413. package/dist/test/test-plugins/bert/index.d.ts +3 -3
  414. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  415. package/dist/test/test-plugins/bert/index.js.map +1 -1
  416. package/dist/test/test-plugins/ernie/index.d.ts +7 -1
  417. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  418. package/dist/test/test-plugins/ernie/index.js +58 -1
  419. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  420. package/dist/test/test-plugins/index.d.ts +1 -1
  421. package/dist/test/test-plugins/index.d.ts.map +1 -1
  422. package/dist/test/test-plugins/index.js +5 -5
  423. package/dist/test/test-plugins/index.js.map +1 -1
  424. package/dist/test/utils.d.ts +2 -2
  425. package/dist/test/utils.d.ts.map +1 -1
  426. package/dist/test/utils.js +5 -5
  427. package/dist/test/utils.js.map +1 -1
  428. package/dist/test-utils/index.js +1 -1
  429. package/dist/test-utils/index.js.map +1 -1
  430. package/dist/test-utils/mock-plugin-registry.d.ts +2 -2
  431. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  432. package/dist/test-utils/mock-plugin-registry.js +1 -1
  433. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  434. package/dist/utils/csv-export.d.ts.map +1 -1
  435. package/dist/utils/csv-export.js +1 -1
  436. package/dist/utils/csv-export.js.map +1 -1
  437. package/dist/utils/event.js +1 -1
  438. package/dist/utils/index.js +3 -3
  439. package/dist/utils/index.js.map +1 -1
  440. package/dist/utils/variables.js +1 -1
  441. package/package.json +11 -11
  442. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +0 -283
  443. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +0 -197
  444. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +0 -30
  445. package/dist/cjs/components/Annotations/constants.js +0 -23
  446. package/dist/cjs/components/Annotations/index.js +0 -31
  447. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +0 -49
  448. package/dist/cjs/components/CalculationSelector/index.js +0 -30
  449. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +0 -270
  450. package/dist/cjs/components/DatasourceEditorForm/index.js +0 -30
  451. package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +0 -266
  452. package/dist/cjs/components/DatasourceSelect/index.js +0 -30
  453. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -568
  454. package/dist/cjs/components/HTTPSettingsEditor/index.js +0 -30
  455. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +0 -1175
  456. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +0 -30
  457. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +0 -211
  458. package/dist/cjs/components/LegendOptionsEditor/index.js +0 -30
  459. package/dist/cjs/components/LinksEditor/LinksEditor.js +0 -162
  460. package/dist/cjs/components/LinksEditor/index.js +0 -30
  461. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +0 -41
  462. package/dist/cjs/components/MetricLabelInput/index.js +0 -30
  463. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +0 -159
  464. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +0 -250
  465. package/dist/cjs/components/MultiQueryEditor/index.js +0 -31
  466. package/dist/cjs/components/MultiQueryEditor/utils.js +0 -36
  467. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +0 -69
  468. package/dist/cjs/components/OptionsEditorRadios/index.js +0 -30
  469. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -39
  470. package/dist/cjs/components/OptionsEditorTabPanel/index.js +0 -30
  471. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +0 -61
  472. package/dist/cjs/components/OptionsEditorTabs/index.js +0 -30
  473. package/dist/cjs/components/PanelSpecEditor/PanelAnnotationsEditor.js +0 -246
  474. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +0 -135
  475. package/dist/cjs/components/PanelSpecEditor/index.js +0 -30
  476. package/dist/cjs/components/PluginEditor/PluginEditor.js +0 -98
  477. package/dist/cjs/components/PluginEditor/index.js +0 -31
  478. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +0 -136
  479. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +0 -109
  480. package/dist/cjs/components/PluginKindSelect/index.js +0 -30
  481. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +0 -86
  482. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +0 -92
  483. package/dist/cjs/components/PluginRegistry/index.js +0 -30
  484. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +0 -88
  485. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +0 -55
  486. package/dist/cjs/components/PluginSpecEditor/index.js +0 -30
  487. package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +0 -43
  488. package/dist/cjs/components/SelectionOptionsEditor/index.js +0 -30
  489. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -236
  490. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  491. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -613
  492. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -193
  493. package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -32
  494. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -143
  495. package/dist/cjs/components/Variables/index.js +0 -31
  496. package/dist/cjs/components/Variables/variable-model.js +0 -211
  497. package/dist/cjs/components/index.js +0 -48
  498. package/dist/cjs/constants/index.js +0 -30
  499. package/dist/cjs/constants/user-interface-text.js +0 -32
  500. package/dist/cjs/context/ValidationProvider.js +0 -77
  501. package/dist/cjs/context/index.js +0 -30
  502. package/dist/cjs/index.js +0 -38
  503. package/dist/cjs/model/calculations.js +0 -178
  504. package/dist/cjs/model/index.js +0 -45
  505. package/dist/cjs/model/legend.js +0 -111
  506. package/dist/cjs/model/log-queries.js +0 -16
  507. package/dist/cjs/model/log-volume-utils.js +0 -124
  508. package/dist/cjs/model/panels.js +0 -16
  509. package/dist/cjs/model/plugin-base.js +0 -16
  510. package/dist/cjs/model/plugin-loading.js +0 -56
  511. package/dist/cjs/model/plugins.js +0 -26
  512. package/dist/cjs/model/profile-queries.js +0 -16
  513. package/dist/cjs/model/silences-queries.js +0 -16
  514. package/dist/cjs/model/time-series-queries.js +0 -26
  515. package/dist/cjs/model/trace-queries.js +0 -16
  516. package/dist/cjs/model/variables.js +0 -16
  517. package/dist/cjs/remote/PersesPlugin.types.js +0 -16
  518. package/dist/cjs/remote/PluginLoaderComponent.js +0 -87
  519. package/dist/cjs/remote/PluginRuntime.js +0 -331
  520. package/dist/cjs/remote/index.js +0 -31
  521. package/dist/cjs/remote/remotePluginLoader.js +0 -101
  522. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +0 -154
  523. package/dist/cjs/runtime/DataQueriesProvider/index.js +0 -31
  524. package/dist/cjs/runtime/DataQueriesProvider/model.js +0 -34
  525. package/dist/cjs/runtime/RouterProvider.js +0 -114
  526. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +0 -201
  527. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +0 -66
  528. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -113
  529. package/dist/cjs/runtime/TimeRangeProvider/index.js +0 -33
  530. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -250
  531. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +0 -30
  532. package/dist/cjs/runtime/UsageMetricsProvider.js +0 -102
  533. package/dist/cjs/runtime/alerts-queries.js +0 -101
  534. package/dist/cjs/runtime/annotations.js +0 -148
  535. package/dist/cjs/runtime/builtin-variables.js +0 -81
  536. package/dist/cjs/runtime/datasources.js +0 -80
  537. package/dist/cjs/runtime/index.js +0 -44
  538. package/dist/cjs/runtime/item-actions.js +0 -302
  539. package/dist/cjs/runtime/log-queries.js +0 -76
  540. package/dist/cjs/runtime/plugin-registry.js +0 -135
  541. package/dist/cjs/runtime/profile-queries.js +0 -73
  542. package/dist/cjs/runtime/silences-queries.js +0 -101
  543. package/dist/cjs/runtime/time-series-queries.js +0 -165
  544. package/dist/cjs/runtime/trace-queries.js +0 -106
  545. package/dist/cjs/runtime/utils.js +0 -39
  546. package/dist/cjs/runtime/variables.js +0 -160
  547. package/dist/cjs/schema/index.js +0 -30
  548. package/dist/cjs/schema/panel.js +0 -42
  549. package/dist/cjs/test/index.js +0 -31
  550. package/dist/cjs/test/mock-data.js +0 -357
  551. package/dist/cjs/test/render-hook.js +0 -31
  552. package/dist/cjs/test/render.js +0 -31
  553. package/dist/cjs/test/setup-tests.js +0 -20
  554. package/dist/cjs/test/test-plugins/bert/index.js +0 -99
  555. package/dist/cjs/test/test-plugins/ernie/index.js +0 -92
  556. package/dist/cjs/test/test-plugins/index.js +0 -81
  557. package/dist/cjs/test/utils.js +0 -58
  558. package/dist/cjs/test-utils/index.js +0 -30
  559. package/dist/cjs/test-utils/mock-plugin-registry.js +0 -81
  560. package/dist/cjs/utils/csv-export.js +0 -248
  561. package/dist/cjs/utils/event.js +0 -30
  562. package/dist/cjs/utils/index.js +0 -32
  563. package/dist/cjs/utils/variables.js +0 -44
@@ -10,11 +10,11 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries } from '@tanstack/react-query';
14
- import { useDatasourceStore } from './datasources';
15
- import { usePluginRegistry } from './plugin-registry';
16
- import { useTimeRange } from './TimeRangeProvider';
17
- import { useVariableValues } from './variables';
13
+ import { useQueries } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePluginRegistry } from "./plugin-registry.js";
16
+ import { useTimeRange } from "./TimeRangeProvider/index.js";
17
+ import { useVariableValues } from "./variables.js";
18
18
  export const LOG_QUERY_KEY = 'LogQuery';
19
19
  export function useLogQueries(definitions) {
20
20
  const { getPlugin } = usePluginRegistry();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/log-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { LogQueryResult } from '../model/log-queries';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useVariableValues } from './variables';\n\nexport type LogQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'LogQuery', PluginSpec>;\nexport const LOG_QUERY_KEY = 'LogQuery';\n\nexport function useLogQueries(definitions: LogQueryDefinition[]): Array<UseQueryResult<LogQueryResult>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n const variableValues = useVariableValues();\n\n const context = {\n timeRange: absoluteTimeRange,\n variableState: variableValues,\n datasourceStore,\n refreshKey: '',\n };\n\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = ['query', LOG_QUERY_KEY, definition, absoluteTimeRange, variableValues] as const;\n const logQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<LogQueryResult> => {\n const plugin = await getPlugin({ kind: LOG_QUERY_KEY, name: logQueryKind });\n const data = await plugin.getLogData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","useVariableValues","LOG_QUERY_KEY","useLogQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","variableValues","context","timeRange","variableState","refreshKey","queries","map","definition","queryKey","logQueryKind","spec","plugin","kind","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","data","getLogData","structuralSharing"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,QAAwB,wBAAwB;AAEnE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,iBAAiB,QAAQ,cAAc;AAGhD,OAAO,MAAMC,gBAAgB,WAAW;AAExC,OAAO,SAASC,cAAcC,WAAiC;IAC7D,MAAM,EAAEC,SAAS,EAAE,GAAGN;IACtB,MAAMO,kBAAkBR;IACxB,MAAM,EAAES,iBAAiB,EAAE,GAAGP;IAC9B,MAAMQ,iBAAiBP;IAEvB,MAAMQ,UAAU;QACdC,WAAWH;QACXI,eAAeH;QACfF;QACAM,YAAY;IACd;IAEA,OAAOf,WAAW;QAChBgB,SAAST,YAAYU,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAAC;gBAASd;gBAAea;gBAAYR;gBAAmBC;aAAe;YACxF,MAAMS,eAAeF,YAAYG,MAAMC,QAAQC;YAC/C,OAAO;gBACLJ,UAAUA;gBACVK,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMR,SAAS,MAAMd,UAAU;wBAAEe,MAAMlB;wBAAe0B,MAAMX;oBAAa;oBACzE,MAAMY,OAAO,MAAMV,OAAOW,UAAU,CAACf,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAET,SAASkB;oBAC3E,OAAOE;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/log-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport type { LogQueryResult } from '../model/log-queries';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useVariableValues } from './variables';\n\nexport type LogQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'LogQuery', PluginSpec>;\nexport const LOG_QUERY_KEY = 'LogQuery';\n\nexport function useLogQueries(definitions: LogQueryDefinition[]): Array<UseQueryResult<LogQueryResult>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n const variableValues = useVariableValues();\n\n const context = {\n timeRange: absoluteTimeRange,\n variableState: variableValues,\n datasourceStore,\n refreshKey: '',\n };\n\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = ['query', LOG_QUERY_KEY, definition, absoluteTimeRange, variableValues] as const;\n const logQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<LogQueryResult> => {\n const plugin = await getPlugin({ kind: LOG_QUERY_KEY, name: logQueryKind });\n const data = await plugin.getLogData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","useVariableValues","LOG_QUERY_KEY","useLogQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","variableValues","context","timeRange","variableState","refreshKey","queries","map","definition","queryKey","logQueryKind","spec","plugin","kind","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","data","getLogData","structuralSharing"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,UAAU,QAAQ,wBAAwB;AAGnD,SAASC,kBAAkB,QAAQ,mBAAgB;AACnD,SAASC,iBAAiB,QAAQ,uBAAoB;AACtD,SAASC,YAAY,QAAQ,+BAAsB;AACnD,SAASC,iBAAiB,QAAQ,iBAAc;AAGhD,OAAO,MAAMC,gBAAgB,WAAW;AAExC,OAAO,SAASC,cAAcC,WAAiC;IAC7D,MAAM,EAAEC,SAAS,EAAE,GAAGN;IACtB,MAAMO,kBAAkBR;IACxB,MAAM,EAAES,iBAAiB,EAAE,GAAGP;IAC9B,MAAMQ,iBAAiBP;IAEvB,MAAMQ,UAAU;QACdC,WAAWH;QACXI,eAAeH;QACfF;QACAM,YAAY;IACd;IAEA,OAAOf,WAAW;QAChBgB,SAAST,YAAYU,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAAC;gBAASd;gBAAea;gBAAYR;gBAAmBC;aAAe;YACxF,MAAMS,eAAeF,YAAYG,MAAMC,QAAQC;YAC/C,OAAO;gBACLJ,UAAUA;gBACVK,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMR,SAAS,MAAMd,UAAU;wBAAEe,MAAMlB;wBAAe0B,MAAMX;oBAAa;oBACzE,MAAMY,OAAO,MAAMV,OAAOW,UAAU,CAACf,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAET,SAASkB;oBAC3E,OAAOE;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
- import { BuiltinVariableDefinition } from '@perses-dev/spec';
3
- import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
4
- import { DefaultPluginKinds, PluginImplementation, PluginMetadataWithModule, PluginType, PluginCompoundKey } from '../model';
1
+ import type { BuiltinVariableDefinition } from '@perses-dev/spec';
2
+ import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
3
+ import type { DefaultPluginKinds, PluginImplementation, PluginMetadataWithModule, PluginType, PluginCompoundKey } from '../model';
5
4
  export interface PluginRegistryContextType {
6
5
  getPlugin<T extends PluginType>(compoundKey: PluginCompoundKey<T>): Promise<PluginImplementation<T>>;
7
6
  listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadataWithModule[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/runtime/plugin-registry.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAwB,eAAe,EAAE,cAAc,EAAE,MAAM,uBAA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AAoB,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,EAAE,MAAM,CAAC,CAAC,EAClH,UAAU,GAAG,SAAS,CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,UAAU,EAC5C,UAAU,EAAE,CAAC,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC5B,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAYhD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAC7C,UAAU,EAAE,CAAC,EACb,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/B,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAoBhD;AAGD,KAAK,4BAA4B,GAAG,IAAI,CACtC,eAAe,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,wBAAwB,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,EAClG,UAAU,GAAG,SAAS,CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,CAAC,EAAE,4BAA4B,GACrC,cAAc,CAAC,wBAAwB,EAAE,CAAC,CAO5C;AAED,wBAAgB,mCAAmC,IAAI,cAAc,CAAC,yBAAyB,EAAE,CAAC,CAkBjG"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries, useQuery } from '@tanstack/react-query';
14
- import { createContext, useContext } from 'react';
13
+ import { useQueries, useQuery } from "@tanstack/react-query";
14
+ import { createContext, useContext } from "react";
15
15
  export const PluginRegistryContext = createContext(undefined);
16
16
  /**
17
17
  * Use the PluginRegistry context directly. This is meant as an escape hatch for custom async flows. You should probably
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/plugin-registry.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { BuiltinVariableDefinition } from '@perses-dev/spec';\nimport { useQueries, useQuery, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\nimport {\n DefaultPluginKinds,\n PluginImplementation,\n PluginMetadataWithModule,\n PluginType,\n PluginCompoundKey,\n} from '../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(compoundKey: PluginCompoundKey<T>): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadataWithModule[]>;\n defaultPluginKinds?: DefaultPluginKinds;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\n/**\n * Use the PluginRegistry context directly. This is meant as an escape hatch for custom async flows. You should probably\n * be using `usePlugin` or `useListPluginMetadata` instead.\n */\nexport function usePluginRegistry(): PluginRegistryContextType {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n\n// Allows consumers to pass useQuery options from react-query when loading a plugin\ntype UsePluginOptions<T extends PluginType> = Omit<\n UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType | undefined, string]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Loads a plugin and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugin<T extends PluginType>(\n pluginType: T | undefined,\n kind: string,\n options?: UsePluginOptions<T>\n): UseQueryResult<PluginImplementation<T>, Error> {\n // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically\n options = {\n ...options,\n enabled: (options?.enabled ?? true) && pluginType !== undefined && kind !== '',\n };\n const { getPlugin } = usePluginRegistry();\n return useQuery({\n queryKey: ['getPlugin', pluginType, kind],\n queryFn: () => getPlugin({ kind: pluginType!, name: kind }),\n ...options,\n });\n}\n\n/**\n * Loads a list of plugins and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugins<T extends PluginType>(\n pluginType: T,\n plugins: Array<{ kind: string }>\n): Array<UseQueryResult<PluginImplementation<T>>> {\n const { getPlugin } = usePluginRegistry();\n\n // useQueries() does not support queries with duplicate keys, therefore we de-duplicate the plugin kinds before running useQueries()\n // This resolves the following warning in the JS console: \"[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.\"\n // https://github.com/TanStack/query/issues/8224#issuecomment-2523554831\n // https://github.com/TanStack/query/issues/4187#issuecomment-1256336901\n const kinds = [...new Set(plugins.map((p) => p.kind))];\n\n const result: Array<UseQueryResult<PluginImplementation<T>>> = useQueries({\n queries: kinds.map((kind) => {\n return {\n queryKey: ['getPlugin', pluginType, kind],\n queryFn: () => getPlugin({ kind: pluginType, name: kind }),\n };\n }),\n });\n\n // Re-assemble array in original order\n return plugins.map((p) => result[kinds.indexOf(p.kind)]!);\n}\n\n// Allow consumers to pass useQuery options from react-query when listing metadata\ntype UseListPluginMetadataOptions = Omit<\n UseQueryOptions<PluginMetadataWithModule[], Error, PluginMetadataWithModule[], [string, string[]]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.\n */\nexport function useListPluginMetadata(\n pluginTypes: PluginType[],\n options?: UseListPluginMetadataOptions\n): UseQueryResult<PluginMetadataWithModule[]> {\n const { listPluginMetadata } = usePluginRegistry();\n return useQuery({\n queryKey: ['listPluginMetadata', pluginTypes],\n queryFn: () => listPluginMetadata(pluginTypes),\n ...options,\n });\n}\n\nexport function usePluginBuiltinVariableDefinitions(): UseQueryResult<BuiltinVariableDefinition[]> {\n const { getPlugin, listPluginMetadata } = usePluginRegistry();\n\n return useQuery({\n queryKey: ['usePluginBuiltinVariableDefinitions'],\n queryFn: async () => {\n const datasources = await listPluginMetadata(['Datasource']);\n const datasourceNames = new Set(datasources.map((datasource) => datasource.spec.name));\n const result: BuiltinVariableDefinition[] = [];\n for (const name of datasourceNames) {\n const plugin = await getPlugin({ kind: 'Datasource', name });\n if (plugin.getBuiltinVariableDefinitions) {\n plugin.getBuiltinVariableDefinitions().forEach((definition) => result.push(definition));\n }\n }\n return result;\n },\n });\n}\n"],"names":["useQueries","useQuery","createContext","useContext","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error","usePlugin","pluginType","kind","options","enabled","getPlugin","queryKey","queryFn","name","usePlugins","plugins","kinds","Set","map","p","result","queries","indexOf","useListPluginMetadata","pluginTypes","listPluginMetadata","usePluginBuiltinVariableDefinitions","datasources","datasourceNames","datasource","spec","plugin","getBuiltinVariableDefinitions","forEach","definition","push"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,EAAEC,QAAQ,QAAyC,wBAAwB;AAC9F,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAelD,OAAO,MAAMC,wBAAwBF,cAAqDG,WAAW;AAErG;;;CAGC,GACD,OAAO,SAASC;IACd,MAAMC,MAAMJ,WAAWC;IACvB,IAAIG,QAAQF,WAAW;QACrB,MAAM,IAAIG,MAAM;IAClB;IACA,OAAOD;AACT;AAQA;;CAEC,GACD,OAAO,SAASE,UACdC,UAA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L,SAAS;QACdc,UAAU;YAAC;SAAsC;QACjDC,SAAS;YACP,MAAMe,cAAc,MAAMF,mBAAmB;gBAAC;aAAa;YAC3D,MAAMG,kBAAkB,IAAIX,IAAIU,YAAYT,GAAG,CAAC,CAACW,aAAeA,WAAWC,IAAI,CAACjB,IAAI;YACpF,MAAMO,SAAsC,EAAE;YAC9C,KAAK,MAAMP,QAAQe,gBAAiB;gBAClC,MAAMG,SAAS,MAAMrB,UAAU;oBAAEH,MAAM;oBAAcM;gBAAK;gBAC1D,IAAIkB,OAAOC,6BAA6B,EAAE;oBACxCD,OAAOC,6BAA6B,GAAGC,OAAO,CAAC,CAACC,aAAed,OAAOe,IAAI,CAACD;gBAC7E;YACF;YACA,OAAOd;QACT;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/plugin-registry.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { BuiltinVariableDefinition } from '@perses-dev/spec';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useQueries, useQuery } from '@tanstack/react-query';\nimport { createContext, useContext } from 'react';\n\nimport type {\n DefaultPluginKinds,\n PluginImplementation,\n PluginMetadataWithModule,\n PluginType,\n PluginCompoundKey,\n} from '../model';\n\nexport interface PluginRegistryContextType {\n getPlugin<T extends PluginType>(compoundKey: PluginCompoundKey<T>): Promise<PluginImplementation<T>>;\n listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadataWithModule[]>;\n defaultPluginKinds?: DefaultPluginKinds;\n}\n\nexport const PluginRegistryContext = createContext<PluginRegistryContextType | undefined>(undefined);\n\n/**\n * Use the PluginRegistry context directly. This is meant as an escape hatch for custom async flows. You should probably\n * be using `usePlugin` or `useListPluginMetadata` instead.\n */\nexport function usePluginRegistry(): PluginRegistryContextType {\n const ctx = useContext(PluginRegistryContext);\n if (ctx === undefined) {\n throw new Error('PluginRegistryContext not found. Did you forget a provider?');\n }\n return ctx;\n}\n\n// Allows consumers to pass useQuery options from react-query when loading a plugin\ntype UsePluginOptions<T extends PluginType> = Omit<\n UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType | undefined, string]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Loads a plugin and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugin<T extends PluginType>(\n pluginType: T | undefined,\n kind: string,\n options?: UsePluginOptions<T>,\n): UseQueryResult<PluginImplementation<T>, Error> {\n // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically\n options = {\n ...options,\n enabled: (options?.enabled ?? true) && pluginType !== undefined && kind !== '',\n };\n const { getPlugin } = usePluginRegistry();\n return useQuery({\n queryKey: ['getPlugin', pluginType, kind],\n queryFn: () => getPlugin({ kind: pluginType!, name: kind }),\n ...options,\n });\n}\n\n/**\n * Loads a list of plugins and returns the plugin implementation, along with loading/error state.\n */\nexport function usePlugins<T extends PluginType>(\n pluginType: T,\n plugins: Array<{ kind: string }>,\n): Array<UseQueryResult<PluginImplementation<T>>> {\n const { getPlugin } = usePluginRegistry();\n\n // useQueries() does not support queries with duplicate keys, therefore we de-duplicate the plugin kinds before running useQueries()\n // This resolves the following warning in the JS console: \"[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.\"\n // https://github.com/TanStack/query/issues/8224#issuecomment-2523554831\n // https://github.com/TanStack/query/issues/4187#issuecomment-1256336901\n const kinds = [...new Set(plugins.map((p) => p.kind))];\n\n const result: Array<UseQueryResult<PluginImplementation<T>>> = useQueries({\n queries: kinds.map((kind) => {\n return {\n queryKey: ['getPlugin', pluginType, kind],\n queryFn: () => getPlugin({ kind: pluginType, name: kind }),\n };\n }),\n });\n\n // Re-assemble array in original order\n return plugins.map((p) => result[kinds.indexOf(p.kind)]!);\n}\n\n// Allow consumers to pass useQuery options from react-query when listing metadata\ntype UseListPluginMetadataOptions = Omit<\n UseQueryOptions<PluginMetadataWithModule[], Error, PluginMetadataWithModule[], [string, string[]]>,\n 'queryKey' | 'queryFn'\n>;\n\n/**\n * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.\n */\nexport function useListPluginMetadata(\n pluginTypes: PluginType[],\n options?: UseListPluginMetadataOptions,\n): UseQueryResult<PluginMetadataWithModule[]> {\n const { listPluginMetadata } = usePluginRegistry();\n return useQuery({\n queryKey: ['listPluginMetadata', pluginTypes],\n queryFn: () => listPluginMetadata(pluginTypes),\n ...options,\n });\n}\n\nexport function usePluginBuiltinVariableDefinitions(): UseQueryResult<BuiltinVariableDefinition[]> {\n const { getPlugin, listPluginMetadata } = usePluginRegistry();\n\n return useQuery({\n queryKey: ['usePluginBuiltinVariableDefinitions'],\n queryFn: async () => {\n const datasources = await listPluginMetadata(['Datasource']);\n const datasourceNames = new Set(datasources.map((datasource) => datasource.spec.name));\n const result: BuiltinVariableDefinition[] = [];\n for (const name of datasourceNames) {\n const plugin = await getPlugin({ kind: 'Datasource', name });\n if (plugin.getBuiltinVariableDefinitions) {\n plugin.getBuiltinVariableDefinitions().forEach((definition) => result.push(definition));\n }\n }\n return result;\n },\n });\n}\n"],"names":["useQueries","useQuery","createContext","useContext","PluginRegistryContext","undefined","usePluginRegistry","ctx","Error","usePlugin","pluginType","kind","options","enabled","getPlugin","queryKey","queryFn","name","usePlugins","plugins","kinds","Set","map","p","result","queries","indexOf","useListPluginMetadata","pluginTypes","listPluginMetadata","usePluginBuiltinVariableDefinitions","datasources","datasourceNames","datasource","spec","plugin","getBuiltinVariableDefinitions","forEach","definition","push"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AAC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C,OAAOQ,QAAQG,GAAG,CAAC,CAACC,IAAMC,MAAM,CAACJ,MAAMM,OAAO,CAACH,EAAEZ,IAAI,EAAE;AACzD;AAQA;;CAEC,GACD,OAAO,SAASgB,sBACdC,WAAyB,EACzBhB,OAAsC;IAEtC,MAAM,EAAEiB,kBAAkB,EAAE,GAAGvB;IAC/B,OAAOL,SAAS;QACdc,UAAU;YAAC;YAAsBa;SAAY;QAC7CZ,SAAS,IAAMa,mBAAmBD;QAClC,GAAGhB,OAAO;IACZ;AACF;AAEA,OAAO,SAASkB;IACd,MAAM,EAAEhB,SAAS,EAAEe,kBAAkB,EAAE,GAAGvB;IAE1C,OAAOL,SAAS;QACdc,UAAU;YAAC;SAAsC;QACjDC,SAAS;YACP,MAAMe,cAAc,MAAMF,mBAAmB;gBAAC;aAAa;YAC3D,MAAMG,kBAAkB,IAAIX,IAAIU,YAAYT,GAAG,CAAC,CAACW,aAAeA,WAAWC,IAAI,CAACjB,IAAI;YACpF,MAAMO,SAAsC,EAAE;YAC9C,KAAK,MAAMP,QAAQe,gBAAiB;gBAClC,MAAMG,SAAS,MAAMrB,UAAU;oBAAEH,MAAM;oBAAcM;gBAAK;gBAC1D,IAAIkB,OAAOC,6BAA6B,EAAE;oBACxCD,OAAOC,6BAA6B,GAAGC,OAAO,CAAC,CAACC,aAAed,OAAOe,IAAI,CAACD;gBAC7E;YACF;YACA,OAAOd;QACT;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/spec';
2
- import { UseQueryResult } from '@tanstack/react-query';
1
+ import type { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
3
  export type ProfileQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'ProfileQuery', PluginSpec>;
4
4
  export declare const PROFILE_QUERY_KEY = "ProfileQuery";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"profile-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/profile-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAInE,MAAM,MAAM,sBAAsB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAC3G,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,sBAAsB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAgC3G"}
1
+ {"version":3,"file":"profile-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/profile-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAM5D,MAAM,MAAM,sBAAsB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAC3G,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,sBAAsB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,CAgC3G"}
@@ -10,10 +10,10 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries } from '@tanstack/react-query';
14
- import { useDatasourceStore } from './datasources';
15
- import { usePluginRegistry } from './plugin-registry';
16
- import { useTimeRange } from './TimeRangeProvider';
13
+ import { useQueries } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePluginRegistry } from "./plugin-registry.js";
16
+ import { useTimeRange } from "./TimeRangeProvider/index.js";
17
17
  export const PROFILE_QUERY_KEY = 'ProfileQuery';
18
18
  /**
19
19
  * Run a profile query using a ProfileQuery plugin and return the results
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/profile-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/spec';\nimport { useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nexport type ProfileQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'ProfileQuery', PluginSpec>;\nexport const PROFILE_QUERY_KEY = 'ProfileQuery';\n\n/**\n * Run a profile query using a ProfileQuery plugin and return the results\n * @param definitions: dashboard defintion for a profile query\n */\nexport function useProfileQueries(definitions: ProfileQueryDefinition[]): Array<UseQueryResult<ProfileData>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n\n const context = {\n datasourceStore,\n absoluteTimeRange,\n };\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = ['query', PROFILE_QUERY_KEY, definition, absoluteTimeRange] as const; // `queryKey` watches and reruns `queryFn` if keys in the array change\n const profileQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<ProfileData> => {\n const plugin = await getPlugin({ kind: PROFILE_QUERY_KEY, name: profileQueryKind });\n const data = await plugin.getProfileData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","PROFILE_QUERY_KEY","useProfileQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","context","queries","map","definition","queryKey","profileQueryKind","spec","plugin","kind","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","data","getProfileData","structuralSharing"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,UAAU,QAAwB,wBAAwB;AACnE,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,YAAY,QAAQ,sBAAsB;AAEnD,OAAO,MAAMC,oBAAoB,eAAe;AAEhD;;;CAGC,GACD,OAAO,SAASC,kBAAkBC,WAAqC;IACrE,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,kBAAkBP;IACxB,MAAM,EAAEQ,iBAAiB,EAAE,GAAGN;IAE9B,MAAMO,UAAU;QACdF;QACAC;IACF;IAEA,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOT,WAAW;QAChBW,SAASL,YAAYM,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAAC;gBAASV;gBAAmBS;gBAAYJ;aAAkB,EAAW,sEAAsE;YAC7J,MAAMM,mBAAmBF,YAAYG,MAAMC,QAAQC;YACnD,OAAO;gBACLJ,UAAUA;gBACVK,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMR,SAAS,MAAMV,UAAU;wBAAEW,MAAMd;wBAAmBsB,MAAMX;oBAAiB;oBACjF,MAAMY,OAAO,MAAMV,OAAOW,cAAc,CAACf,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,SAASe;oBAC/E,OAAOE;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/profile-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { QueryDefinition, UnknownSpec, ProfileData } from '@perses-dev/spec';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nexport type ProfileQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'ProfileQuery', PluginSpec>;\nexport const PROFILE_QUERY_KEY = 'ProfileQuery';\n\n/**\n * Run a profile query using a ProfileQuery plugin and return the results\n * @param definitions: dashboard defintion for a profile query\n */\nexport function useProfileQueries(definitions: ProfileQueryDefinition[]): Array<UseQueryResult<ProfileData>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const { absoluteTimeRange } = useTimeRange();\n\n const context = {\n datasourceStore,\n absoluteTimeRange,\n };\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = ['query', PROFILE_QUERY_KEY, definition, absoluteTimeRange] as const; // `queryKey` watches and reruns `queryFn` if keys in the array change\n const profileQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<ProfileData> => {\n const plugin = await getPlugin({ kind: PROFILE_QUERY_KEY, name: profileQueryKind });\n const data = await plugin.getProfileData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useTimeRange","PROFILE_QUERY_KEY","useProfileQueries","definitions","getPlugin","datasourceStore","absoluteTimeRange","context","queries","map","definition","queryKey","profileQueryKind","spec","plugin","kind","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","data","getProfileData","structuralSharing"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,kBAAkB,QAAQ,mBAAgB;AACnD,SAASC,iBAAiB,QAAQ,uBAAoB;AACtD,SAASC,YAAY,QAAQ,+BAAsB;AAEnD,OAAO,MAAMC,oBAAoB,eAAe;AAEhD;;;CAGC,GACD,OAAO,SAASC,kBAAkBC,WAAqC;IACrE,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,kBAAkBP;IACxB,MAAM,EAAEQ,iBAAiB,EAAE,GAAGN;IAE9B,MAAMO,UAAU;QACdF;QACAC;IACF;IAEA,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOT,WAAW;QAChBW,SAASL,YAAYM,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAAC;gBAASV;gBAAmBS;gBAAYJ;aAAkB,EAAW,sEAAsE;YAC7J,MAAMM,mBAAmBF,YAAYG,MAAMC,QAAQC;YACnD,OAAO;gBACLJ,UAAUA;gBACVK,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMR,SAAS,MAAMV,UAAU;wBAAEW,MAAMd;wBAAmBsB,MAAMX;oBAAiB;oBACjF,MAAMY,OAAO,MAAMV,OAAOW,cAAc,CAACf,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,SAASe;oBAC/E,OAAOE;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
- import { UseQueryResult } from '@tanstack/react-query';
1
+ import type { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
3
  export type SilencesQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'SilencesQuery', PluginSpec>;
4
4
  export declare const SILENCES_QUERY_KEY = "SilencesQuery";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"silences-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/silences-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO7E,MAAM,MAAM,uBAAuB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAC7G,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CA6B9G"}
1
+ {"version":3,"file":"silences-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/silences-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAStE,MAAM,MAAM,uBAAuB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAC7G,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CA6B9G"}
@@ -10,11 +10,11 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries } from '@tanstack/react-query';
14
- import { useDatasourceStore } from './datasources';
15
- import { usePluginRegistry, usePlugins } from './plugin-registry';
16
- import { useAllVariableValues } from './variables';
17
- import { filterVariableStateMap, getVariableValuesKey } from './utils';
13
+ import { useQueries } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePluginRegistry, usePlugins } from "./plugin-registry.js";
16
+ import { filterVariableStateMap, getVariableValuesKey } from "./utils.js";
17
+ import { useAllVariableValues } from "./variables.js";
18
18
  export const SILENCES_QUERY_KEY = 'SilencesQuery';
19
19
  /**
20
20
  * Run a silences query using a SilencesQuery plugin and return the results.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/silences-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { SilencesQueryContext, SilencesQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\n\nexport type SilencesQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'SilencesQuery', PluginSpec>;\nexport const SILENCES_QUERY_KEY = 'SilencesQuery';\n\n/**\n * Run a silences query using a SilencesQuery plugin and return the results.\n * Silences represent current state and are NOT time-range dependent.\n * @param definitions: dashboard definition for a silences query\n */\nexport function useSilencesQueries(definitions: SilencesQueryDefinition[]): Array<UseQueryResult<SilencesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useSilencesQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'SilencesQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const silencesQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: 60_000,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<SilencesData> => {\n const plugin = await getPlugin({ kind: SILENCES_QUERY_KEY, name: silencesQueryKind });\n const data = await plugin.getSilencesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: SilencesQueryPlugin;\n definition: SilencesQueryDefinition;\n context: SilencesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n // Note: no absoluteTimeRange in query key since silences are current state\n const queryKey = ['query', SILENCES_QUERY_KEY, definition, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useSilencesQueryContext(): SilencesQueryContext {\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","SILENCES_QUERY_KEY","useSilencesQueries","definitions","getPlugin","context","useSilencesQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","silencesQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","queryFn","signal","name","getSilencesData","variableState","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC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GAAGzB;IAE1B,MAAM0B,eAAenB,QAAQoB,YAAYpB,OAAOoB,SAAS,CAAClB,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,WAAW,CAAC;IACnG,MAAM4B,uBAAuBF,cAAcG;IAE3C,MAAMC,yBAAyBpC,uBAAuB+B,eAAeG;IACrE,MAAMG,oBAAoBpC,qBAAqBmC;IAC/C,2EAA2E;IAC3E,MAAMjB,WAAW;QAAC;QAASjB;QAAoBa;QAAYsB;KAAkB;IAE7E,IAAIC,aAAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMT,aAAa,CAACS,EAAE,EAAEC;IAClE;IAEA,MAAMvB,eAAeL,WAAW6B,aAAa,CAACJ;IAC9C,OAAO;QACLnB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAMwB,gBAAgBhC;IACtB,MAAM4C,kBAAkB/C;IAExB,OAAO;QACLmC;QACAY;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/silences-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { SilencesData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { QueryKey, UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport type { SilencesQueryContext, SilencesQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\n\nexport type SilencesQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'SilencesQuery', PluginSpec>;\nexport const SILENCES_QUERY_KEY = 'SilencesQuery';\n\n/**\n * Run a silences query using a SilencesQuery plugin and return the results.\n * Silences represent current state and are NOT time-range dependent.\n * @param definitions: dashboard definition for a silences query\n */\nexport function useSilencesQueries(definitions: SilencesQueryDefinition[]): Array<UseQueryResult<SilencesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useSilencesQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'SilencesQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind })),\n );\n\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const silencesQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: 60_000,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<SilencesData> => {\n const plugin = await getPlugin({ kind: SILENCES_QUERY_KEY, name: silencesQueryKind });\n const data = await plugin.getSilencesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: SilencesQueryPlugin;\n definition: SilencesQueryDefinition;\n context: SilencesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n // Note: no absoluteTimeRange in query key since silences are current state\n const queryKey = ['query', SILENCES_QUERY_KEY, definition, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useSilencesQueryContext(): SilencesQueryContext {\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","SILENCES_QUERY_KEY","useSilencesQueries","definitions","getPlugin","context","useSilencesQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","silencesQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","queryFn","signal","name","getSilencesData","variableState","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,UAAU,QAAQ,wBAAwB;AAGnD,SAASC,kBAAkB,QAAQ,mBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,uBAAoB;AAClE,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,aAAU;AACvE,SAASC,oBAAoB,QAAQ,iBAAc;AAGnD,OAAO,MAAMC,qBAAqB,gBAAgB;AAElD;;;;CAIC,GACD,OAAO,SAASC,mBAAmBC,WAAsC;IACvE,MAAM,EAAEC,SAAS,EAAE,GAAGR;IACtB,MAAMS,UAAUC;IAEhB,MAAMC,uBAAuBV,WAC3B,iBACAM,YAAYK,GAAG,CAAC,CAACC,IAAO,CAAA;YAAEC,MAAMD,EAAEE,IAAI,CAACC,MAAM,CAACF,IAAI;QAAC,CAAA;IAGrD,OAAOhB,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AMwB,gBAAgB9B;IACtB,MAAM0C,kBAAkB/C;IAExB,OAAO;QACLmC;QACAY;IACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { TimeSeriesData, TimeSeriesQueryDefinition } from '@perses-dev/spec';
2
- import { QueryCache, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';
3
- import { TimeSeriesDataQuery, TimeSeriesQueryMode } from '../model';
1
+ import type { TimeSeriesData, TimeSeriesQueryDefinition } from '@perses-dev/spec';
2
+ import type { QueryCache, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';
3
+ import type { TimeSeriesDataQuery, TimeSeriesQueryMode } from '../model';
4
4
  export interface UseTimeSeriesQueryOptions {
5
5
  suggestedStepMs?: number;
6
6
  mode?: TimeSeriesQueryMode;
@@ -1 +1 @@
1
- {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAe,MAAM,kBAAkB,CAAC;AAC1F,OAAO,EAEL,UAAU,EAEV,oBAAoB,EAIpB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAA0B,mBAAmB,EAAyB,MAAM,UAAU,CAAC;AAOnH,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AA+CvD;;GAEG;AACH,eAAO,MAAM,kBAAkB,eACjB,yBAAyB,YAC3B,yBAAyB,iBACpB,qBAAqB,cAAc,CAAC,KAClD,eAAe,cAAc,CAiB/B,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,yBAAyB,EAAE,EACxC,OAAO,CAAC,EAAE,yBAAyB,EACnC,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GACpD,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAgCvC;AAiBD;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,mBAAmB,EAAE,CAIlE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,EAAE,CAWnF"}
1
+ {"version":3,"file":"time-series-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/time-series-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAe,MAAM,kBAAkB,CAAC;AAC/F,OAAO,KAAK,EAAS,UAAU,EAAY,oBAAoB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG/G,OAAO,KAAK,EAAE,mBAAmB,EAA0B,mBAAmB,EAAyB,MAAM,UAAU,CAAC;AAOxH,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AA+CvD;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,yBAAyB,EACrC,UAAU,yBAAyB,EACnC,eAAe,oBAAoB,CAAC,cAAc,CAAC,KAClD,cAAc,CAAC,cAAc,CAiB/B,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,yBAAyB,EAAE,EACxC,OAAO,CAAC,EAAE,yBAAyB,EACnC,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GACpD,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAgCvC;AAiBD;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,mBAAmB,EAAE,CAIlE;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,EAAE,CAWnF"}
@@ -10,12 +10,12 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
14
- import { useTimeRange } from './TimeRangeProvider';
15
- import { useDatasourceStore } from './datasources';
16
- import { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';
17
- import { filterVariableStateMap, getVariableValuesKey } from './utils';
18
- import { useAllVariableValues } from './variables';
13
+ import { useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePlugin, usePluginRegistry, usePlugins } from "./plugin-registry.js";
16
+ import { useTimeRange } from "./TimeRangeProvider/index.js";
17
+ import { filterVariableStateMap, getVariableValuesKey } from "./utils.js";
18
+ import { useAllVariableValues } from "./variables.js";
19
19
  export const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';
20
20
  function getQueryOptions({ plugin, definition, context }) {
21
21
  const { timeRange, suggestedStepMs, mode, variableState } = context;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesData, TimeSeriesQueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport {\n Query,\n QueryCache,\n QueryKey,\n QueryObserverOptions,\n useQueries,\n useQuery,\n useQueryClient,\n UseQueryResult,\n} from '@tanstack/react-query';\nimport { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryMode, TimeSeriesQueryPlugin } from '../model';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { timeRange, suggestedStepMs, mode, variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n\n const queryKey = [\n 'query',\n TIME_SERIES_QUERY_KEY,\n definition,\n timeRange,\n variablesValueKey,\n suggestedStepMs,\n mode,\n ] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions<TimeSeriesData>\n): UseQueryResult<TimeSeriesData> => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n queryFn: ({ signal }) => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>\n): Array<UseQueryResult<TimeSeriesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = {\n ...useTimeSeriesQueryContext(),\n mode: options?.mode,\n suggestedStepMs: options?.suggestedStepMs,\n };\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n ...queryOptions,\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryKey: queryKey,\n queryFn: async ({ signal }: { signal: AbortSignal }): Promise<TimeSeriesData> => {\n const plugin = await getPlugin({ kind: TIME_SERIES_QUERY_KEY, name: definition.spec.plugin.kind });\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n } as QueryObserverOptions;\n }),\n }) as Array<UseQueryResult<TimeSeriesData>>;\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries(): TimeSeriesDataQuery[] {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache): TimeSeriesDataQuery[] {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQueries","useQuery","useQueryClient","useTimeRange","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","TIME_SERIES_QUERY_KEY","getQueryOptions","plugin","definition","context","timeRange","suggestedStepMs","mode","variableState","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","v","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","queryFn","signal","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","map","d","queries","idx","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","name","absoluteTimeRange","datasourceStore","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAKEA,UAAU,EACVC,QAAQ,EACR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gD,MAAM7C,WAAWQ,IAAI,CAACT,MAAM,CAACyB,IAAI;oBAAC;oBAChG,MAAMD,OAAO,MAAMxB,OAAOgC,iBAAiB,CAAC/B,WAAWQ,IAAI,CAACT,MAAM,CAACS,IAAI,EAAEP,SAAS2B;oBAClF,OAAOL;gBACT;YACF;QACF;IACF;AACF;AAEA;;CAEC,GACD,SAASE;IACP,MAAM,EAAEqB,iBAAiB,EAAE,GAAGzD;IAC9B,MAAMgB,gBAAgBT;IACtB,MAAMmD,kBAAkBzD;IAExB,OAAO;QACLY,WAAW4C;QACXzC;QACA0C;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC;IACd,MAAMC,cAAc7D;IACpB,MAAM8D,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMf,UAAiC,EAAE;IAEzC,KAAK,MAAMgB,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;QACrD,MAAMC,YAAYH,MAAMzC,QAAQ,EAAE,CAAC,EAAE;QACrC,IAAI4C,WAAWjC,QAAQ,AAACiC,UAAUjC,IAAI,CAAYkC,UAAU,CAAC7D,wBAAwB;YACnFyC,QAAQqB,IAAI,CAACL;QACf;IACF;IAEA,OAAOhB;AACT"}
1
+ {"version":3,"sources":["../../src/runtime/time-series-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { TimeSeriesData, TimeSeriesQueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { Query, QueryCache, QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useQueries, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport type { TimeSeriesDataQuery, TimeSeriesQueryContext, TimeSeriesQueryMode, TimeSeriesQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePlugin, usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\n\nexport interface UseTimeSeriesQueryOptions {\n suggestedStepMs?: number;\n mode?: TimeSeriesQueryMode;\n}\n\nexport const TIME_SERIES_QUERY_KEY = 'TimeSeriesQuery';\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TimeSeriesQueryPlugin;\n definition: TimeSeriesQueryDefinition;\n context: TimeSeriesQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { timeRange, suggestedStepMs, mode, variableState } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n // Determine queryKey\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n\n const queryKey = [\n 'query',\n TIME_SERIES_QUERY_KEY,\n definition,\n timeRange,\n variablesValueKey,\n suggestedStepMs,\n mode,\n ] as const;\n\n // Determine queryEnabled\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n\n return {\n queryKey,\n queryEnabled,\n };\n}\n\n/**\n * Runs a time series query using a plugin and returns the results.\n */\nexport const useTimeSeriesQuery = (\n definition: TimeSeriesQueryDefinition,\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: QueryObserverOptions<TimeSeriesData>,\n): UseQueryResult<TimeSeriesData> => {\n const { data: plugin } = usePlugin(TIME_SERIES_QUERY_KEY, definition.spec.plugin.kind);\n const context = useTimeSeriesQueryContext();\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return useQuery({\n enabled: (queryOptions?.enabled ?? true) || queryEnabled,\n queryKey: queryKey,\n queryFn: ({ signal }) => {\n // The 'enabled' option should prevent this from happening, but make TypeScript happy by checking\n if (plugin === undefined) {\n throw new Error('Expected plugin to be loaded');\n }\n // Keep options out of query key so we don't re-run queries because suggested step changes\n const ctx: TimeSeriesQueryContext = { ...context, suggestedStepMs: options?.suggestedStepMs };\n return plugin.getTimeSeriesData(definition.spec.plugin.spec, ctx, signal);\n },\n });\n};\n\n/**\n * Runs multiple time series queries using plugins and returns the results.\n */\nexport function useTimeSeriesQueries(\n definitions: TimeSeriesQueryDefinition[],\n options?: UseTimeSeriesQueryOptions,\n queryOptions?: Omit<QueryObserverOptions, 'queryKey'>,\n): Array<UseQueryResult<TimeSeriesData>> {\n const { getPlugin } = usePluginRegistry();\n const context = {\n ...useTimeSeriesQueryContext(),\n mode: options?.mode,\n suggestedStepMs: options?.suggestedStepMs,\n };\n\n const pluginLoaderResponse = usePlugins(\n TIME_SERIES_QUERY_KEY,\n definitions.map((d) => ({ kind: d.spec.plugin.kind })),\n );\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ plugin, definition, context });\n return {\n ...queryOptions,\n enabled: (queryOptions?.enabled ?? true) && queryEnabled,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryKey: queryKey,\n queryFn: async ({ signal }: { signal: AbortSignal }): Promise<TimeSeriesData> => {\n const plugin = await getPlugin({ kind: TIME_SERIES_QUERY_KEY, name: definition.spec.plugin.kind });\n const data = await plugin.getTimeSeriesData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n } as QueryObserverOptions;\n }),\n }) as Array<UseQueryResult<TimeSeriesData>>;\n}\n\n/**\n * Build the time series query context object from data available at runtime\n */\nfunction useTimeSeriesQueryContext(): TimeSeriesQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n timeRange: absoluteTimeRange,\n variableState,\n datasourceStore,\n };\n}\n\n/**\n * Get active time series queries for query results summary\n */\nexport function useActiveTimeSeriesQueries(): TimeSeriesDataQuery[] {\n const queryClient = useQueryClient();\n const queryCache = queryClient.getQueryCache();\n return getActiveTimeSeriesQueries(queryCache);\n}\n\n/**\n * Filter all cached queries down to only active time series queries\n */\nexport function getActiveTimeSeriesQueries(cache: QueryCache): TimeSeriesDataQuery[] {\n const queries: TimeSeriesDataQuery[] = [];\n\n for (const query of cache.findAll({ type: 'active' })) {\n const firstPart = query.queryKey?.[0] as UnknownSpec;\n if (firstPart?.kind && (firstPart.kind as string).startsWith(TIME_SERIES_QUERY_KEY)) {\n queries.push(query as Query<TimeSeriesData, unknown, TimeSeriesData, QueryKey>);\n }\n }\n\n return queries;\n}\n"],"names":["useQueries","useQuery","useQueryClient","useDatasourceStore","usePlugin","usePluginRegistry","usePlugins","useTimeRange","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","TIME_SERIES_QUERY_KEY","getQueryOptions","plugin","definition","context","timeRange","suggestedStepMs","mode","variableState","dependencies","dependsOn","spec","variableDependencies","variables","filteredVariabledState","variablesValueKey","queryKey","waitToLoad","some","v","loading","queryEnabled","undefined","useTimeSeriesQuery","options","queryOptions","data","kind","useTimeSeriesQueryContext","enabled","queryFn","signal","Error","ctx","getTimeSeriesData","useTimeSeriesQueries","definitions","getPlugin","pluginLoaderResponse","map","d","queries","idx","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","name","absoluteTimeRange","datasourceStore","useActiveTimeSeriesQueries","queryClient","queryCache","getQueryCache","getActiveTimeSeriesQueries","cache","query","findAll","type","firstPart","startsWith","push"],"mappings":"AAAA,+BAA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AAW,IAAG,KAAMR;gBAC5CsB,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACX/B,UAAUA;gBACVc,SAAS,OAAO,EAAEC,MAAM,EAA2B;oBACjD,MAAM7B,SAAS,MAAMmC,UAAU;wBAAEV,MAAM3B;wBAAuBgD,MAAM7C,WAAWQ,IAAI,CAACT,MAAM,CAACyB,IAAI;oBAAC;oBAChG,MAAMD,OAAO,MAAMxB,OAAOgC,iBAAiB,CAAC/B,WAAWQ,IAAI,CAACT,MAAM,CAACS,IAAI,EAAEP,SAAS2B;oBAClF,OAAOL;gBACT;YACF;QACF;IACF;AACF;AAEA;;CAEC,GACD,SAASE;IACP,MAAM,EAAEqB,iBAAiB,EAAE,GAAGrD;IAC9B,MAAMY,gBAAgBT;IACtB,MAAMmD,kBAAkB1D;IAExB,OAAO;QACLa,WAAW4C;QACXzC;QACA0C;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAASC;IACd,MAAMC,cAAc7D;IACpB,MAAM8D,aAAaD,YAAYE,aAAa;IAC5C,OAAOC,2BAA2BF;AACpC;AAEA;;CAEC,GACD,OAAO,SAASE,2BAA2BC,KAAiB;IAC1D,MAAMf,UAAiC,EAAE;IAEzC,KAAK,MAAMgB,SAASD,MAAME,OAAO,CAAC;QAAEC,MAAM;IAAS,GAAI;QACrD,MAAMC,YAAYH,MAAMzC,QAAQ,EAAE,CAAC,EAAE;QACrC,IAAI4C,WAAWjC,QAAQ,AAACiC,UAAUjC,IAAI,CAAYkC,UAAU,CAAC7D,wBAAwB;YACnFyC,QAAQqB,IAAI,CAACL;QACf;IACF;IAEA,OAAOhB;AACT"}
@@ -1,5 +1,5 @@
1
- import { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';
2
- import { UseQueryResult } from '@tanstack/react-query';
1
+ import type { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
3
  export type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;
4
4
  export declare const TRACE_QUERY_KEY = "TraceQuery";
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/trace-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAwB,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO7E,MAAM,MAAM,oBAAoB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACvG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA+BrG"}
1
+ {"version":3,"file":"trace-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/trace-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAStE,MAAM,MAAM,oBAAoB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACvG,eAAO,MAAM,eAAe,eAAe,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA+BrG"}
@@ -10,12 +10,12 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { useQueries } from '@tanstack/react-query';
14
- import { useDatasourceStore } from './datasources';
15
- import { usePluginRegistry, usePlugins } from './plugin-registry';
16
- import { useTimeRange } from './TimeRangeProvider';
17
- import { useAllVariableValues } from './variables';
18
- import { filterVariableStateMap, getVariableValuesKey } from './utils';
13
+ import { useQueries } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePluginRegistry, usePlugins } from "./plugin-registry.js";
16
+ import { useTimeRange } from "./TimeRangeProvider/index.js";
17
+ import { filterVariableStateMap, getVariableValuesKey } from "./utils.js";
18
+ import { useAllVariableValues } from "./variables.js";
19
19
  export const TRACE_QUERY_KEY = 'TraceQuery';
20
20
  /**
21
21
  * Run a trace query using a TraceQuery plugin and return the results
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';\nimport { QueryKey, useQueries, UseQueryResult } from '@tanstack/react-query';\nimport { TraceQueryContext, TraceQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { useAllVariableValues } from './variables';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useTraceQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'TraceQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind }))\n );\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<TraceData> => {\n const plugin = await getPlugin({ kind: TRACE_QUERY_KEY, name: traceQueryKind });\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TraceQueryPlugin;\n definition: TraceQueryDefinition;\n context: TraceQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = ['query', TRACE_QUERY_KEY, definition, absoluteTimeRange, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useTraceQueryContext(): TraceQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useTimeRange","useAllVariableValues","filterVariableStateMap","getVariableValuesKey","TRACE_QUERY_KEY","useTraceQueries","definitions","getPlugin","context","useTraceQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","traceQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","getTraceData","variableState","absoluteTimeRange","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAmBA,UAAU,QAAwB,wBAAwB;AAE7E,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,oBAAoB;AAClE,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,UAAU;AAEvE,OAAO,MAAMC,kBAAkB,aAAa;AAE5C;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,SAAS,EAAE,GAAGT;IACtB,MAAMU,UAAUC;IAEhB,MAAMC,uBAAuBX,WAC3B,cACAO,YAAYK,GAAG,CAAC,CAACC,IAAO,CAAA;YAAEC,MAAMD,EAAEE,IAAI,CAACC,MAAM,CAACF,IAAI;QAAC,CAAA;IAGrD,+FAA+F;IAC/F,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rB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAM,EAAE0B,iBAAiB,EAAE,GAAGnC;IAC9B,MAAMkC,gBAAgBjC;IACtB,MAAM8C,kBAAkBlD;IAExB,OAAO;QACLqC;QACAa;QACAZ;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/runtime/trace-queries.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { QueryDefinition, UnknownSpec, TraceData } from '@perses-dev/spec';\nimport type { QueryKey, UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport type { TraceQueryContext, TraceQueryPlugin } from '../model';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry, usePlugins } from './plugin-registry';\nimport { useTimeRange } from './TimeRangeProvider';\nimport { filterVariableStateMap, getVariableValuesKey } from './utils';\nimport { useAllVariableValues } from './variables';\nexport type TraceQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'TraceQuery', PluginSpec>;\nexport const TRACE_QUERY_KEY = 'TraceQuery';\n\n/**\n * Run a trace query using a TraceQuery plugin and return the results\n * @param definitions: dashboard defintion for a trace query, written in Trace Query Language (TraceQL)\n * Documentation for TraceQL: https://grafana.com/docs/tempo/latest/traceql/\n */\nexport function useTraceQueries(definitions: TraceQueryDefinition[]): Array<UseQueryResult<TraceData>> {\n const { getPlugin } = usePluginRegistry();\n const context = useTraceQueryContext();\n\n const pluginLoaderResponse = usePlugins(\n 'TraceQuery',\n definitions.map((d) => ({ kind: d.spec.plugin.kind })),\n );\n\n // useQueries() handles data fetching from query plugins (e.g. traceQL queries, promQL queries)\n // https://tanstack.com/query/v4/docs/react/reference/useQuery\n return useQueries({\n queries: definitions.map((definition, idx) => {\n const plugin = pluginLoaderResponse[idx]?.data;\n const { queryEnabled, queryKey } = getQueryOptions({ context, definition, plugin });\n const traceQueryKind = definition?.spec?.plugin?.kind;\n return {\n enabled: queryEnabled,\n queryKey: queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<TraceData> => {\n const plugin = await getPlugin({ kind: TRACE_QUERY_KEY, name: traceQueryKind });\n const data = await plugin.getTraceData(definition.spec.plugin.spec, context, signal);\n return data;\n },\n };\n }),\n });\n}\n\nfunction getQueryOptions({\n plugin,\n definition,\n context,\n}: {\n plugin?: TraceQueryPlugin;\n definition: TraceQueryDefinition;\n context: TraceQueryContext;\n}): {\n queryKey: QueryKey;\n queryEnabled: boolean;\n} {\n const { variableState, absoluteTimeRange } = context;\n\n const dependencies = plugin?.dependsOn ? plugin.dependsOn(definition.spec.plugin.spec, context) : {};\n const variableDependencies = dependencies?.variables;\n\n const filteredVariabledState = filterVariableStateMap(variableState, variableDependencies);\n const variablesValueKey = getVariableValuesKey(filteredVariabledState);\n const queryKey = ['query', TRACE_QUERY_KEY, definition, absoluteTimeRange, variablesValueKey] as const;\n\n let waitToLoad = false;\n if (variableDependencies) {\n waitToLoad = variableDependencies.some((v) => variableState[v]?.loading);\n }\n\n const queryEnabled = plugin !== undefined && !waitToLoad;\n return {\n queryKey,\n queryEnabled,\n };\n}\n\nfunction useTraceQueryContext(): TraceQueryContext {\n const { absoluteTimeRange } = useTimeRange();\n const variableState = useAllVariableValues();\n const datasourceStore = useDatasourceStore();\n\n return {\n variableState,\n datasourceStore,\n absoluteTimeRange,\n };\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","usePlugins","useTimeRange","filterVariableStateMap","getVariableValuesKey","useAllVariableValues","TRACE_QUERY_KEY","useTraceQueries","definitions","getPlugin","context","useTraceQueryContext","pluginLoaderResponse","map","d","kind","spec","plugin","queries","definition","idx","data","queryEnabled","queryKey","getQueryOptions","traceQueryKind","enabled","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","getTraceData","variableState","absoluteTimeRange","dependencies","dependsOn","variableDependencies","variables","filteredVariabledState","variablesValueKey","waitToLoad","some","v","loading","undefined","datasourceStore"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,UAAU,QAAQ,wBAAwB;AAGnD,SAASC,kBAAkB,QAAQ,mBAAgB;AACnD,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,uBAAoB;AAClE,SAASC,YAAY,QAAQ,+BAAsB;AACnD,SAASC,sBAAsB,EAAEC,oBAAoB,QAAQ,aAAU;AACvE,SAASC,oBAAoB,QAAQ,iBAAc;AAEnD,OAAO,MAAMC,kBAAkB,aAAa;AAE5C;;;;CAIC,GACD,OAAO,SAASC,gBAAgBC,WAAmC;IACjE,MAAM,EAAEC,SAAS,EAAE,GAAGT;IACtB,MAAMU,UAAUC;IAEhB,MAAMC,uBAAuBX,WAC3B,cACAO,YAAYK,GAAG,CAAC,CAACC,IAAO,CAAA;YAAEC,MAAMD,EAAEE,IAAI,CAACC,MAAM,CAACF,IAAI;QAAC,CAAA;IAGrD,+FAA+F;IAC/F,8DAA8D;IAC9D,OAAOjB,WAAW;QAChBoB,SAASV,YAAYK,GAAG,CAAC,CAACM,YAAYC;YACpC,MAAMH,SAASL,oBAAoB,CAACQ,IAAI,EAAEC;YAC1C,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE,GAAGC,gBAAgB;gBAAEd;gBAASS;gBAAYF;YAAO;YACjF,MAAMQ,iBAAiBN,YAAYH,MAAMC,QAAQF;YACjD,OAAO;gBACLW,SAASJ;gBACTC,UAAUA;gBACVI,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMhB,SAAS,MAAMR,UAAU;wBAAEM,MAAMT;wBAAiB4B,MAAMT;oBAAe;oBAC7E,MAAMJ,OAAO,MAAMJ,OAAOkB,YAAY,CAAChB,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,SAASuB;oBAC7E,OAAOZ;gBACT;YACF;QACF;IACF;AACF;AAEA,SAASG,gBAAgB,EACvBP,MAAM,EACNE,UAAU,EACVT,OAAO,EAKR;IAIC,MAAM,EAAE0B,aAAa,EAAEC,iBAAiB,EAAE,GAAG3B;IAE7C,MAAM4B,eAAerB,QAAQsB,YAAYtB,OAAOsB,SAAS,CAACpB,WAAWH,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEN,WAAW,CAAC;IACnG,MAAM8B,uBAAuBF,cAAcG;IAE3C,MAAMC,yBAAyBvC,uBAAuBiC,eAAeI;IACrE,MAAMG,oBAAoBvC,qBAAqBsC;IAC/C,MAAMnB,WAAW;QAAC;QAASjB;QAAiBa;QAAYkB;QAAmBM;KAAkB;IAE7F,IAAIC,aAAa;IACjB,IAAIJ,sBAAsB;QACxBI,aAAaJ,qBAAqBK,IAAI,CAAC,CAACC,IAAMV,aAAa,CAACU,EAAE,EAAEC;IAClE;IAEA,MAAMzB,eAAeL,WAAW+B,aAAa,CAACJ;IAC9C,OAAO;QACLrB;QACAD;IACF;AACF;AAEA,SAASX;IACP,MAAM,EAAE0B,iBAAiB,EAAE,GAAGnC;IAC9B,MAAMkC,gBAAgB/B;IACtB,MAAM4C,kBAAkBlD;IAExB,OAAO;QACLqC;QACAa;QACAZ;IACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { VariableStateMap } from './variables';
1
+ import type { VariableStateMap } from './variables';
2
2
  export declare function filterVariableStateMap(v: VariableStateMap, names?: string[]): VariableStateMap;
3
3
  /**
4
4
  * Returns a serialized string of the current state of variable values.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/runtime/utils.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAK9F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAIhE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/runtime/utils.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAK9F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAIhE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { VariableStateMap } from './variables';\n\nexport function filterVariableStateMap(v: VariableStateMap, names?: string[]): VariableStateMap {\n if (!names) {\n return v;\n }\n return Object.fromEntries(Object.entries(v).filter(([name]) => names.includes(name)));\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n"],"names":["filterVariableStateMap","v","names","Object","fromEntries","entries","filter","name","includes","getVariableValuesKey","values","map","JSON","stringify","value","join"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,SAASA,uBAAuBC,CAAmB,EAAEC,KAAgB;IAC1E,IAAI,CAACA,OAAO;QACV,OAAOD;IACT;IACA,OAAOE,OAAOC,WAAW,CAACD,OAAOE,OAAO,CAACJ,GAAGK,MAAM,CAAC,CAAC,CAACC,KAAK,GAAKL,MAAMM,QAAQ,CAACD;AAChF;AAEA;;CAEC,GACD,OAAO,SAASE,qBAAqBR,CAAmB;IACtD,OAAOE,OAAOO,MAAM,CAACT,GAClBU,GAAG,CAAC,CAACV,IAAMW,KAAKC,SAAS,CAACZ,EAAEa,KAAK,GACjCC,IAAI,CAAC;AACV"}
1
+ {"version":3,"sources":["../../src/runtime/utils.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { VariableStateMap } from './variables';\n\nexport function filterVariableStateMap(v: VariableStateMap, names?: string[]): VariableStateMap {\n if (!names) {\n return v;\n }\n return Object.fromEntries(Object.entries(v).filter(([name]) => names.includes(name)));\n}\n\n/**\n * Returns a serialized string of the current state of variable values.\n */\nexport function getVariableValuesKey(v: VariableStateMap): string {\n return Object.values(v)\n .map((v) => JSON.stringify(v.value))\n .join(',');\n}\n"],"names":["filterVariableStateMap","v","names","Object","fromEntries","entries","filter","name","includes","getVariableValuesKey","values","map","JSON","stringify","value","join"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,SAASA,uBAAuBC,CAAmB,EAAEC,KAAgB;IAC1E,IAAI,CAACA,OAAO;QACV,OAAOD;IACT;IACA,OAAOE,OAAOC,WAAW,CAACD,OAAOE,OAAO,CAACJ,GAAGK,MAAM,CAAC,CAAC,CAACC,KAAK,GAAKL,MAAMM,QAAQ,CAACD;AAChF;AAEA;;CAEC,GACD,OAAO,SAASE,qBAAqBR,CAAmB;IACtD,OAAOE,OAAOO,MAAM,CAACT,GAClBU,GAAG,CAAC,CAACV,IAAMW,KAAKC,SAAS,CAACZ,EAAEa,KAAK,GACjCC,IAAI,CAAC;AACV"}
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
- import { VariableOption, VariableState, VariableStateMap } from '@perses-dev/components';
1
+ import type { VariableOption, VariableState, VariableStateMap } from '@perses-dev/components';
3
2
  import { immerable } from 'immer';
4
3
  export type { VariableOption, VariableState, VariableStateMap };
5
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/runtime/variables.ts"],"names":[],"mappings":";AAaA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GA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AAgB,EAChC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,MAAM,CAMR;AAGD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKvF"}
@@ -10,10 +10,10 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { parseVariables, replaceVariables } from '@perses-dev/components';
14
- import { immerable } from 'immer';
15
- import { createContext, useContext, useMemo } from 'react';
16
- import { useBuiltinVariableValues } from './builtin-variables';
13
+ import { parseVariables, replaceVariables } from "@perses-dev/components";
14
+ import { immerable } from "immer";
15
+ import { createContext, useContext, useMemo } from "react";
16
+ import { useBuiltinVariableValues } from "./builtin-variables.js";
17
17
  /**
18
18
  * A state map with two entry keys, materialized by {@link VariableStateKey} structure.
19
19
  */ export class VariableStoreStateMap {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/variables.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n VariableOption,\n VariableState,\n VariableStateMap,\n parseVariables,\n replaceVariables,\n} from '@perses-dev/components';\nimport { immerable } from 'immer';\nimport { createContext, useContext, useMemo } from 'react';\nimport { useBuiltinVariableValues } from './builtin-variables';\n\n// Re-export types from @perses-dev/components for backwards compatibility\nexport type { VariableOption, VariableState, VariableStateMap };\n\n/**\n * Structure used as key in the {@link VariableStoreStateMap}.\n */\nexport type VariableStateKey = {\n /**\n * name of the variable we want to access in the state.\n */\n name: string;\n /**\n * source of the variable we want to access in the state.\n * Defined only for external variables.\n */\n source?: string;\n};\n\n/**\n * A state map with two entry keys, materialized by {@link VariableStateKey} structure.\n */\nexport class VariableStoreStateMap {\n /**\n * \"Immerable\" is mandatory to be able to use this class in an immer context.\n * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas\n */\n [immerable] = true;\n\n private readonly DEFAULT_LOCAL_SOURCE_NAME = '';\n private readonly _state: Record<string, Record<string, VariableState>> = {};\n\n /**\n * Get variable state by key.\n * @param key\n */\n get(key: VariableStateKey): VariableState | undefined {\n return this._sourceStatesOrEmpty(key.source)[key.name];\n }\n\n /**\n * Set variable state by key.\n * @param key\n * @param value\n */\n set(key: VariableStateKey, value: VariableState): VariableState | undefined {\n const sourceName = this._sourceName(key.source);\n if (!this._state[sourceName]) {\n this._state[sourceName] = {};\n }\n this._sourceStatesOrEmpty(key.source)[key.name] = value;\n return value;\n }\n\n /**\n * Check presence of variable state by key.\n * @param key\n */\n has(key: VariableStateKey): boolean {\n return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;\n }\n\n /**\n * Delete variable state by key.\n * @param key\n */\n delete(key: VariableStateKey): boolean {\n const result = this.has(key);\n const sourceName = this._sourceName(key.source);\n const sourceStates = this._state[sourceName];\n\n // Delete var from source state\n if (sourceStates) {\n delete sourceStates[key.name];\n }\n\n // Delete source state from state if empty\n if (Object.keys(sourceStates ?? {})?.length === 0) {\n delete this._state[sourceName];\n }\n return result;\n }\n\n private _sourceName(source: string | undefined): string {\n return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;\n }\n\n private _sourceStatesOrEmpty(source: string | undefined): Record<string, VariableState> {\n return this._state[this._sourceName(source)] ?? {};\n }\n}\n\nexport type VariableSrv = {\n state: VariableStateMap;\n};\n\nexport const VariableContext = createContext<VariableSrv | undefined>(undefined);\n\nfunction useVariableContext(): VariableSrv {\n const ctx = useContext(VariableContext);\n if (ctx === undefined) {\n throw new Error('No VariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useVariableValues(names?: string[]): VariableStateMap {\n const { state } = useVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\n// useAllVariableValues wraps user-defined variables with built-in variables\nexport function useAllVariableValues(names?: string[]): VariableStateMap {\n const variableValues = useVariableValues(names);\n const builtinVariableValues = useBuiltinVariableValues(names);\n\n return useMemo(() => {\n return { ...variableValues, ...builtinVariableValues } as VariableStateMap;\n }, [variableValues, builtinVariableValues]);\n}\n\n// Simple wrapper around replaceVariables() with support for extra string variables.\nexport function replaceVariablesInString(\n text: string,\n variableValues: VariableStateMap,\n extraVariables?: Record<string, string>\n): string {\n const vars = { ...variableValues }; // shallow clone to avoid modifying the original object\n for (const [key, value] of Object.entries(extraVariables ?? {})) {\n vars[key] = { value, loading: false };\n }\n return replaceVariables(text, vars);\n}\n\n// Convenience hook for replacing variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseVariables(str) : [];\n const variableValues = useAllVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceVariables(str, variableValues);\n}\n"],"names":["parseVariables","replaceVariables","immerable","createContext","useContext","useMemo","useBuiltinVariableValues","VariableStoreStateMap","DEFAULT_LOCAL_SOURCE_NAME","_state","get","key","_sourceStatesOrEmpty","source","name","set","value","sourceName","_sourceName","has","undefined","delete","result","sourceStates","Object","keys","length","VariableContext","useVariableContext","ctx","Error","useVariableValues","names","state","values","forEach","s","useAllVariableValues","variableValues","builtinVariableValues","replaceVariablesInString","text","extraVariables","vars","entries","loading","useReplaceVariablesInString","str","variablesInString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;A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AE,GAAGL,cAAc;IAAC,GAAG,uDAAuD;IAC3F,KAAK,MAAM,CAAC3B,KAAKK,MAAM,IAAIQ,OAAOoB,OAAO,CAACF,kBAAkB,CAAC,GAAI;QAC/DC,IAAI,CAAChC,IAAI,GAAG;YAAEK;YAAO6B,SAAS;QAAM;IACtC;IACA,OAAO5C,iBAAiBwC,MAAME;AAChC;AAEA,uDAAuD;AACvD,OAAO,SAASG,4BAA4BC,GAAuB;IACjE,MAAMC,oBAAoBD,MAAM/C,eAAe+C,OAAO,EAAE;IACxD,MAAMT,iBAAiBD,qBAAqBW;IAC5C,IAAI,CAACD,KAAK,OAAO3B;IACjB,OAAOnB,iBAAiB8C,KAAKT;AAC/B"}
1
+ {"version":3,"sources":["../../src/runtime/variables.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { VariableOption, VariableState, VariableStateMap } from '@perses-dev/components';\nimport { parseVariables, replaceVariables } from '@perses-dev/components';\nimport { immerable } from 'immer';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport { useBuiltinVariableValues } from './builtin-variables';\n\n// Re-export types from @perses-dev/components for backwards compatibility\nexport type { VariableOption, VariableState, VariableStateMap };\n\n/**\n * Structure used as key in the {@link VariableStoreStateMap}.\n */\nexport type VariableStateKey = {\n /**\n * name of the variable we want to access in the state.\n */\n name: string;\n /**\n * source of the variable we want to access in the state.\n * Defined only for external variables.\n */\n source?: string;\n};\n\n/**\n * A state map with two entry keys, materialized by {@link VariableStateKey} structure.\n */\nexport class VariableStoreStateMap {\n /**\n * \"Immerable\" is mandatory to be able to use this class in an immer context.\n * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas\n */\n [immerable] = true;\n\n private readonly DEFAULT_LOCAL_SOURCE_NAME = '';\n private readonly _state: Record<string, Record<string, VariableState>> = {};\n\n /**\n * Get variable state by key.\n * @param key\n */\n get(key: VariableStateKey): VariableState | undefined {\n return this._sourceStatesOrEmpty(key.source)[key.name];\n }\n\n /**\n * Set variable state by key.\n * @param key\n * @param value\n */\n set(key: VariableStateKey, value: VariableState): VariableState | undefined {\n const sourceName = this._sourceName(key.source);\n if (!this._state[sourceName]) {\n this._state[sourceName] = {};\n }\n this._sourceStatesOrEmpty(key.source)[key.name] = value;\n return value;\n }\n\n /**\n * Check presence of variable state by key.\n * @param key\n */\n has(key: VariableStateKey): boolean {\n return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;\n }\n\n /**\n * Delete variable state by key.\n * @param key\n */\n delete(key: VariableStateKey): boolean {\n const result = this.has(key);\n const sourceName = this._sourceName(key.source);\n const sourceStates = this._state[sourceName];\n\n // Delete var from source state\n if (sourceStates) {\n delete sourceStates[key.name];\n }\n\n // Delete source state from state if empty\n if (Object.keys(sourceStates ?? {})?.length === 0) {\n delete this._state[sourceName];\n }\n return result;\n }\n\n private _sourceName(source: string | undefined): string {\n return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;\n }\n\n private _sourceStatesOrEmpty(source: string | undefined): Record<string, VariableState> {\n return this._state[this._sourceName(source)] ?? {};\n }\n}\n\nexport type VariableSrv = {\n state: VariableStateMap;\n};\n\nexport const VariableContext = createContext<VariableSrv | undefined>(undefined);\n\nfunction useVariableContext(): VariableSrv {\n const ctx = useContext(VariableContext);\n if (ctx === undefined) {\n throw new Error('No VariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useVariableValues(names?: string[]): VariableStateMap {\n const { state } = useVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\n// useAllVariableValues wraps user-defined variables with built-in variables\nexport function useAllVariableValues(names?: string[]): VariableStateMap {\n const variableValues = useVariableValues(names);\n const builtinVariableValues = useBuiltinVariableValues(names);\n\n return useMemo(() => {\n return { ...variableValues, ...builtinVariableValues } as VariableStateMap;\n }, [variableValues, builtinVariableValues]);\n}\n\n// Simple wrapper around replaceVariables() with support for extra string variables.\nexport function replaceVariablesInString(\n text: string,\n variableValues: VariableStateMap,\n extraVariables?: Record<string, string>,\n): string {\n const vars = { ...variableValues }; // shallow clone to avoid modifying the original object\n for (const [key, value] of Object.entries(extraVariables ?? {})) {\n vars[key] = { value, loading: false };\n }\n return replaceVariables(text, vars);\n}\n\n// Convenience hook for replacing variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseVariables(str) : [];\n const variableValues = useAllVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceVariables(str, variableValues);\n}\n"],"names":["parseVariables","replaceVariables","immerable","createContext","useContext","useMemo","useBuiltinVariableValues","VariableStoreStateMap","DEFAULT_LOCAL_SOURCE_NAME","_state","get","key","_sourceStatesOrEmpty","source","name","set","value","sourceName","_sourceName","has","undefined","delete","result","sourceStates","Object","keys","length","VariableContext","useVariableContext","ctx","Error","useVariableValues","names","state","values","forEach","s","useAllVariableValues","variableValues","builtinVariableValues","replaceVariablesInString","text","extraVariables","vars","entries","loading","useReplaceVariablesInString","str","variablesInString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,yBAAyB;AAC1E,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,aAAa,EAAEC,UAAU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YAAO6B,SAAS;QAAM;IACtC;IACA,OAAO5C,iBAAiBwC,MAAME;AAChC;AAEA,uDAAuD;AACvD,OAAO,SAASG,4BAA4BC,GAAuB;IACjE,MAAMC,oBAAoBD,MAAM/C,eAAe+C,OAAO,EAAE;IACxD,MAAMT,iBAAiBD,qBAAqBW;IAC5C,IAAI,CAACD,KAAK,OAAO3B;IACjB,OAAOnB,iBAAiB8C,KAAKT;AAC/B"}
@@ -10,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './panel';
13
+ export * from "./panel.js";
14
14
 
15
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './panel';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../src/schema/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './panel';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,aAAU"}
@@ -1,6 +1,6 @@
1
+ import type { PluginSchema } from '@perses-dev/spec';
1
2
  import { z } from 'zod';
2
- import { PluginSchema } from '@perses-dev/spec';
3
- import { PanelEditorValues } from '../model';
3
+ import type { PanelEditorValues } from '../model';
4
4
  export declare const panelEditorSchema: z.ZodSchema<PanelEditorValues>;
5
5
  export declare function buildPanelEditorSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelEditorValues>;
6
6
  //# sourceMappingURL=panel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/schema/panel.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAqD,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAG3D,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAKjG"}
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/schema/panel.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgBlD,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAI3D,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAMjG"}