@perses-dev/plugin-system 0.55.0-beta.1 → 0.55.0-beta.11

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 (577) 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/HTTPHeaderPolicyEditor.d.ts +10 -0
  40. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.d.ts.map +1 -0
  41. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js +99 -0
  42. package/dist/components/HTTPSettingsEditor/HTTPHeaderPolicyEditor.js.map +1 -0
  43. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts +4 -2
  44. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
  45. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +91 -41
  46. package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
  47. package/dist/components/HTTPSettingsEditor/index.js +1 -1
  48. package/dist/components/HTTPSettingsEditor/index.js.map +1 -1
  49. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts +1 -1
  50. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.d.ts.map +1 -1
  51. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +28 -28
  52. package/dist/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js.map +1 -1
  53. package/dist/components/ItemSelectionActionsOptionsEditor/index.js +1 -1
  54. package/dist/components/ItemSelectionActionsOptionsEditor/index.js.map +1 -1
  55. package/dist/components/LayoutEditor/LayoutEditor.d.ts +16 -0
  56. package/dist/components/LayoutEditor/LayoutEditor.d.ts.map +1 -0
  57. package/dist/components/LayoutEditor/LayoutEditor.js +115 -0
  58. package/dist/components/LayoutEditor/LayoutEditor.js.map +1 -0
  59. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts +7 -0
  60. package/dist/components/LayoutEditor/RepeatLayoutPreview.d.ts.map +1 -0
  61. package/dist/components/LayoutEditor/RepeatLayoutPreview.js +92 -0
  62. package/dist/components/LayoutEditor/RepeatLayoutPreview.js.map +1 -0
  63. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts +18 -0
  64. package/dist/components/LayoutEditor/RepeatVariableEditor.d.ts.map +1 -0
  65. package/dist/components/LayoutEditor/RepeatVariableEditor.js +168 -0
  66. package/dist/components/LayoutEditor/RepeatVariableEditor.js.map +1 -0
  67. package/dist/components/LayoutEditor/index.d.ts +4 -0
  68. package/dist/components/LayoutEditor/index.d.ts.map +1 -0
  69. package/dist/{cjs/model/explore.js → components/LayoutEditor/index.js} +5 -4
  70. package/dist/components/LayoutEditor/index.js.map +1 -0
  71. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -2
  72. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
  73. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +5 -5
  74. package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
  75. package/dist/components/LegendOptionsEditor/index.js +1 -1
  76. package/dist/components/LegendOptionsEditor/index.js.map +1 -1
  77. package/dist/components/LinksEditor/LinksEditor.d.ts +3 -3
  78. package/dist/components/LinksEditor/LinksEditor.d.ts.map +1 -1
  79. package/dist/components/LinksEditor/LinksEditor.js +6 -6
  80. package/dist/components/LinksEditor/LinksEditor.js.map +1 -1
  81. package/dist/components/LinksEditor/index.js +1 -1
  82. package/dist/components/LinksEditor/index.js.map +1 -1
  83. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts +1 -1
  84. package/dist/components/MetricLabelInput/MetricLabelInput.d.ts.map +1 -1
  85. package/dist/components/MetricLabelInput/MetricLabelInput.js +2 -2
  86. package/dist/components/MetricLabelInput/MetricLabelInput.js.map +1 -1
  87. package/dist/components/MetricLabelInput/index.js +1 -1
  88. package/dist/components/MetricLabelInput/index.js.map +1 -1
  89. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts +3 -4
  90. package/dist/components/MultiQueryEditor/MultiQueryEditor.d.ts.map +1 -1
  91. package/dist/components/MultiQueryEditor/MultiQueryEditor.js +27 -9
  92. package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
  93. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts +3 -4
  94. package/dist/components/MultiQueryEditor/QueryEditorContainer.d.ts.map +1 -1
  95. package/dist/components/MultiQueryEditor/QueryEditorContainer.js +14 -14
  96. package/dist/components/MultiQueryEditor/QueryEditorContainer.js.map +1 -1
  97. package/dist/components/MultiQueryEditor/index.js +2 -2
  98. package/dist/components/MultiQueryEditor/index.js.map +1 -1
  99. package/dist/components/MultiQueryEditor/utils.d.ts +1 -1
  100. package/dist/components/MultiQueryEditor/utils.d.ts.map +1 -1
  101. package/dist/components/MultiQueryEditor/utils.js.map +1 -1
  102. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +1 -1
  103. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -1
  104. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +4 -4
  105. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -1
  106. package/dist/components/OptionsEditorRadios/index.js +1 -1
  107. package/dist/components/OptionsEditorRadios/index.js.map +1 -1
  108. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +1 -1
  109. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -1
  110. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +1 -1
  111. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -1
  112. package/dist/components/OptionsEditorTabPanel/index.js +1 -1
  113. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -1
  114. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +1 -1
  115. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
  116. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +4 -4
  117. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  118. package/dist/components/OptionsEditorTabs/index.js +1 -1
  119. package/dist/components/OptionsEditorTabs/index.js.map +1 -1
  120. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts +2 -2
  121. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.d.ts.map +1 -1
  122. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js +9 -9
  123. package/dist/components/PanelSpecEditor/PanelAnnotationsEditor.js.map +1 -1
  124. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts +8 -5
  125. package/dist/components/PanelSpecEditor/PanelSpecEditor.d.ts.map +1 -1
  126. package/dist/components/PanelSpecEditor/PanelSpecEditor.js +27 -12
  127. package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
  128. package/dist/components/PanelSpecEditor/index.js +1 -1
  129. package/dist/components/PanelSpecEditor/index.js.map +1 -1
  130. package/dist/components/PluginEditor/PluginEditor.d.ts +2 -2
  131. package/dist/components/PluginEditor/PluginEditor.d.ts.map +1 -1
  132. package/dist/components/PluginEditor/PluginEditor.js +10 -9
  133. package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
  134. package/dist/components/PluginEditor/index.js +2 -2
  135. package/dist/components/PluginEditor/index.js.map +1 -1
  136. package/dist/components/PluginEditor/plugin-editor-api.d.ts +10 -3
  137. package/dist/components/PluginEditor/plugin-editor-api.d.ts.map +1 -1
  138. package/dist/components/PluginEditor/plugin-editor-api.js +10 -5
  139. package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
  140. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts +17 -4
  141. package/dist/components/PluginKindSelect/PluginKindSelect.d.ts.map +1 -1
  142. package/dist/components/PluginKindSelect/PluginKindSelect.js +191 -27
  143. package/dist/components/PluginKindSelect/PluginKindSelect.js.map +1 -1
  144. package/dist/components/PluginKindSelect/index.js +1 -1
  145. package/dist/components/PluginKindSelect/index.js.map +1 -1
  146. package/dist/components/PluginRegistry/PluginRegistry.d.ts +2 -2
  147. package/dist/components/PluginRegistry/PluginRegistry.d.ts.map +1 -1
  148. package/dist/components/PluginRegistry/PluginRegistry.js +71 -8
  149. package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
  150. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts +2 -2
  151. package/dist/components/PluginRegistry/getPluginSearchHelper.d.ts.map +1 -1
  152. package/dist/components/PluginRegistry/getPluginSearchHelper.js +2 -2
  153. package/dist/components/PluginRegistry/getPluginSearchHelper.js.map +1 -1
  154. package/dist/components/PluginRegistry/index.js +1 -1
  155. package/dist/components/PluginRegistry/index.js.map +1 -1
  156. package/dist/components/PluginRegistry/plugin-indexes.d.ts +3 -1
  157. package/dist/components/PluginRegistry/plugin-indexes.d.ts.map +1 -1
  158. package/dist/components/PluginRegistry/plugin-indexes.js +9 -4
  159. package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
  160. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts +10 -0
  161. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.d.ts.map +1 -0
  162. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js +62 -0
  163. package/dist/components/PluginSpecEditor/DatasourceSpecEditor.js.map +1 -0
  164. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts +5 -4
  165. package/dist/components/PluginSpecEditor/PluginSpecEditor.d.ts.map +1 -1
  166. package/dist/components/PluginSpecEditor/PluginSpecEditor.js +24 -6
  167. package/dist/components/PluginSpecEditor/PluginSpecEditor.js.map +1 -1
  168. package/dist/components/PluginSpecEditor/index.js +1 -1
  169. package/dist/components/PluginSpecEditor/index.js.map +1 -1
  170. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts +1 -1
  171. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.d.ts.map +1 -1
  172. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js +3 -3
  173. package/dist/components/SelectionOptionsEditor/SelectionOptionsEditor.js.map +1 -1
  174. package/dist/components/SelectionOptionsEditor/index.js +1 -1
  175. package/dist/components/SelectionOptionsEditor/index.js.map +1 -1
  176. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts +4 -4
  177. package/dist/components/TimeRangeControls/TimeRangeControls.d.ts.map +1 -1
  178. package/dist/components/TimeRangeControls/TimeRangeControls.js +18 -55
  179. package/dist/components/TimeRangeControls/TimeRangeControls.js.map +1 -1
  180. package/dist/components/TimeRangeControls/index.js +1 -1
  181. package/dist/components/TimeRangeControls/index.js.map +1 -1
  182. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts +3 -3
  183. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.d.ts.map +1 -1
  184. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js +11 -11
  185. package/dist/components/Variables/VariableEditorForm/VariableEditorForm.js.map +1 -1
  186. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts +2 -2
  187. package/dist/components/Variables/VariableEditorForm/VariablePreview.d.ts.map +1 -1
  188. package/dist/components/Variables/VariableEditorForm/VariablePreview.js +8 -7
  189. package/dist/components/Variables/VariableEditorForm/VariablePreview.js.map +1 -1
  190. package/dist/components/Variables/VariableEditorForm/index.js +3 -3
  191. package/dist/components/Variables/VariableEditorForm/index.js.map +1 -1
  192. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts +2 -2
  193. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.d.ts.map +1 -1
  194. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js +6 -6
  195. package/dist/components/Variables/VariableEditorForm/variable-editor-form-model.js.map +1 -1
  196. package/dist/components/Variables/index.js +2 -2
  197. package/dist/components/Variables/index.js.map +1 -1
  198. package/dist/components/Variables/variable-model.d.ts +8 -8
  199. package/dist/components/Variables/variable-model.d.ts.map +1 -1
  200. package/dist/components/Variables/variable-model.js +10 -5
  201. package/dist/components/Variables/variable-model.js.map +1 -1
  202. package/dist/components/index.d.ts +2 -0
  203. package/dist/components/index.d.ts.map +1 -1
  204. package/dist/components/index.js +21 -19
  205. package/dist/components/index.js.map +1 -1
  206. package/dist/constants/index.d.ts +1 -0
  207. package/dist/constants/index.d.ts.map +1 -1
  208. package/dist/constants/index.js +2 -1
  209. package/dist/constants/index.js.map +1 -1
  210. package/dist/constants/repeat.d.ts +3 -0
  211. package/dist/constants/repeat.d.ts.map +1 -0
  212. package/dist/{cjs/model/datasource.js → constants/repeat.js} +4 -4
  213. package/dist/constants/repeat.js.map +1 -0
  214. package/dist/constants/user-interface-text.d.ts.map +1 -1
  215. package/dist/context/ValidationProvider.d.ts +9 -9
  216. package/dist/context/ValidationProvider.d.ts.map +1 -1
  217. package/dist/context/ValidationProvider.js +6 -6
  218. package/dist/context/ValidationProvider.js.map +1 -1
  219. package/dist/context/index.js +1 -1
  220. package/dist/context/index.js.map +1 -1
  221. package/dist/index.js +9 -9
  222. package/dist/index.js.map +1 -1
  223. package/dist/model/alerts-queries.d.ts +4 -4
  224. package/dist/model/alerts-queries.d.ts.map +1 -1
  225. package/dist/model/alerts-queries.js.map +1 -1
  226. package/dist/model/annotations.d.ts +3 -3
  227. package/dist/model/annotations.d.ts.map +1 -1
  228. package/dist/model/annotations.js.map +1 -1
  229. package/dist/model/calculations.d.ts +1 -1
  230. package/dist/model/calculations.d.ts.map +1 -1
  231. package/dist/model/calculations.js.map +1 -1
  232. package/dist/model/datasource.d.ts +10 -3
  233. package/dist/model/datasource.d.ts.map +1 -1
  234. package/dist/model/datasource.js +1 -1
  235. package/dist/model/datasource.js.map +1 -1
  236. package/dist/model/explore.d.ts +2 -3
  237. package/dist/model/explore.d.ts.map +1 -1
  238. package/dist/model/explore.js.map +1 -1
  239. package/dist/model/index.d.ts +1 -0
  240. package/dist/model/index.d.ts.map +1 -1
  241. package/dist/model/index.js +17 -16
  242. package/dist/model/index.js.map +1 -1
  243. package/dist/model/json-queries.d.ts +29 -0
  244. package/dist/model/json-queries.d.ts.map +1 -0
  245. package/dist/{cjs/model/annotations.js → model/json-queries.js} +5 -4
  246. package/dist/model/json-queries.js.map +1 -0
  247. package/dist/model/legend.d.ts +3 -3
  248. package/dist/model/legend.d.ts.map +1 -1
  249. package/dist/model/legend.js +2 -2
  250. package/dist/model/legend.js.map +1 -1
  251. package/dist/model/log-queries.d.ts +3 -3
  252. package/dist/model/log-queries.d.ts.map +1 -1
  253. package/dist/model/log-queries.js.map +1 -1
  254. package/dist/model/panels.d.ts +13 -4
  255. package/dist/model/panels.d.ts.map +1 -1
  256. package/dist/model/panels.js.map +1 -1
  257. package/dist/model/plugin-base.d.ts +3 -3
  258. package/dist/model/plugin-base.d.ts.map +1 -1
  259. package/dist/model/plugin-base.js.map +1 -1
  260. package/dist/model/plugin-loading.d.ts +1 -1
  261. package/dist/model/plugin-loading.d.ts.map +1 -1
  262. package/dist/model/plugin-loading.js +1 -1
  263. package/dist/model/plugin-loading.js.map +1 -1
  264. package/dist/model/plugins.d.ts +26 -13
  265. package/dist/model/plugins.d.ts.map +1 -1
  266. package/dist/model/plugins.js.map +1 -1
  267. package/dist/model/profile-queries.d.ts +4 -4
  268. package/dist/model/profile-queries.d.ts.map +1 -1
  269. package/dist/model/profile-queries.js.map +1 -1
  270. package/dist/model/silences-queries.d.ts +4 -4
  271. package/dist/model/silences-queries.d.ts.map +1 -1
  272. package/dist/model/silences-queries.js.map +1 -1
  273. package/dist/model/time-series-queries.d.ts +4 -4
  274. package/dist/model/time-series-queries.d.ts.map +1 -1
  275. package/dist/model/time-series-queries.js.map +1 -1
  276. package/dist/model/trace-queries.d.ts +4 -4
  277. package/dist/model/trace-queries.d.ts.map +1 -1
  278. package/dist/model/trace-queries.js.map +1 -1
  279. package/dist/model/variables.d.ts +7 -3
  280. package/dist/model/variables.d.ts.map +1 -1
  281. package/dist/model/variables.js +1 -3
  282. package/dist/model/variables.js.map +1 -1
  283. package/dist/remote/PluginLoaderComponent.d.ts +1 -2
  284. package/dist/remote/PluginLoaderComponent.d.ts.map +1 -1
  285. package/dist/remote/PluginLoaderComponent.js +2 -2
  286. package/dist/remote/PluginLoaderComponent.js.map +1 -1
  287. package/dist/remote/PluginRuntime.d.ts +11 -2
  288. package/dist/remote/PluginRuntime.d.ts.map +1 -1
  289. package/dist/remote/PluginRuntime.js +84 -79
  290. package/dist/remote/PluginRuntime.js.map +1 -1
  291. package/dist/remote/index.d.ts +1 -0
  292. package/dist/remote/index.d.ts.map +1 -1
  293. package/dist/remote/index.js +3 -2
  294. package/dist/remote/index.js.map +1 -1
  295. package/dist/remote/remotePluginLoader.d.ts +2 -2
  296. package/dist/remote/remotePluginLoader.d.ts.map +1 -1
  297. package/dist/remote/remotePluginLoader.js +3 -3
  298. package/dist/remote/remotePluginLoader.js.map +1 -1
  299. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +3 -3
  300. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
  301. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +20 -12
  302. package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
  303. package/dist/runtime/DataQueriesProvider/index.js +2 -2
  304. package/dist/runtime/DataQueriesProvider/index.js.map +1 -1
  305. package/dist/runtime/DataQueriesProvider/model.d.ts +3 -3
  306. package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
  307. package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
  308. package/dist/runtime/RouterProvider.d.ts +2 -1
  309. package/dist/runtime/RouterProvider.d.ts.map +1 -1
  310. package/dist/runtime/RouterProvider.js +3 -3
  311. package/dist/runtime/RouterProvider.js.map +1 -1
  312. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts +3 -2
  313. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.d.ts.map +1 -1
  314. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +22 -8
  315. package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
  316. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts +3 -2
  317. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.d.ts.map +1 -1
  318. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js +5 -5
  319. package/dist/runtime/TimeRangeProvider/TimeRangeProviders.js.map +1 -1
  320. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts +13 -2
  321. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.d.ts.map +1 -1
  322. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +65 -4
  323. package/dist/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js.map +1 -1
  324. package/dist/runtime/TimeRangeProvider/index.js +4 -4
  325. package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
  326. package/dist/runtime/TimeRangeProvider/query-params.d.ts +3 -3
  327. package/dist/runtime/TimeRangeProvider/query-params.d.ts.map +1 -1
  328. package/dist/runtime/TimeRangeProvider/query-params.js +4 -4
  329. package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
  330. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts +1 -1
  331. package/dist/runtime/TimeRangeProvider/refresh-interval.d.ts.map +1 -1
  332. package/dist/runtime/TimeRangeProvider/refresh-interval.js +2 -2
  333. package/dist/runtime/TimeRangeProvider/refresh-interval.js.map +1 -1
  334. package/dist/runtime/UsageMetricsProvider.d.ts +3 -3
  335. package/dist/runtime/UsageMetricsProvider.d.ts.map +1 -1
  336. package/dist/runtime/UsageMetricsProvider.js +3 -3
  337. package/dist/runtime/UsageMetricsProvider.js.map +1 -1
  338. package/dist/runtime/alerts-queries.d.ts +2 -2
  339. package/dist/runtime/alerts-queries.d.ts.map +1 -1
  340. package/dist/runtime/alerts-queries.js +11 -7
  341. package/dist/runtime/alerts-queries.js.map +1 -1
  342. package/dist/runtime/annotations.d.ts +2 -2
  343. package/dist/runtime/annotations.d.ts.map +1 -1
  344. package/dist/runtime/annotations.js +16 -9
  345. package/dist/runtime/annotations.js.map +1 -1
  346. package/dist/runtime/builtin-variables.d.ts +2 -3
  347. package/dist/runtime/builtin-variables.d.ts.map +1 -1
  348. package/dist/runtime/builtin-variables.js +1 -1
  349. package/dist/runtime/builtin-variables.js.map +1 -1
  350. package/dist/runtime/datasources.d.ts +2 -3
  351. package/dist/runtime/datasources.d.ts.map +1 -1
  352. package/dist/runtime/datasources.js +2 -2
  353. package/dist/runtime/datasources.js.map +1 -1
  354. package/dist/runtime/index.d.ts +1 -0
  355. package/dist/runtime/index.d.ts.map +1 -1
  356. package/dist/runtime/index.js +16 -15
  357. package/dist/runtime/index.js.map +1 -1
  358. package/dist/runtime/item-actions.d.ts +3 -3
  359. package/dist/runtime/item-actions.d.ts.map +1 -1
  360. package/dist/runtime/item-actions.js +2 -2
  361. package/dist/runtime/item-actions.js.map +1 -1
  362. package/dist/runtime/json-queries.d.ts +11 -0
  363. package/dist/runtime/json-queries.d.ts.map +1 -0
  364. package/dist/runtime/json-queries.js +58 -0
  365. package/dist/runtime/json-queries.js.map +1 -0
  366. package/dist/runtime/log-queries.d.ts +3 -3
  367. package/dist/runtime/log-queries.d.ts.map +1 -1
  368. package/dist/runtime/log-queries.js +8 -6
  369. package/dist/runtime/log-queries.js.map +1 -1
  370. package/dist/runtime/plugin-registry.d.ts +24 -11
  371. package/dist/runtime/plugin-registry.d.ts.map +1 -1
  372. package/dist/runtime/plugin-registry.js +54 -18
  373. package/dist/runtime/plugin-registry.js.map +1 -1
  374. package/dist/runtime/profile-queries.d.ts +2 -2
  375. package/dist/runtime/profile-queries.d.ts.map +1 -1
  376. package/dist/runtime/profile-queries.js +7 -5
  377. package/dist/runtime/profile-queries.js.map +1 -1
  378. package/dist/runtime/silences-queries.d.ts +2 -2
  379. package/dist/runtime/silences-queries.d.ts.map +1 -1
  380. package/dist/runtime/silences-queries.js +11 -7
  381. package/dist/runtime/silences-queries.js.map +1 -1
  382. package/dist/runtime/time-series-queries.d.ts +3 -3
  383. package/dist/runtime/time-series-queries.d.ts.map +1 -1
  384. package/dist/runtime/time-series-queries.js +16 -9
  385. package/dist/runtime/time-series-queries.js.map +1 -1
  386. package/dist/runtime/trace-queries.d.ts +2 -2
  387. package/dist/runtime/trace-queries.d.ts.map +1 -1
  388. package/dist/runtime/trace-queries.js +12 -8
  389. package/dist/runtime/trace-queries.js.map +1 -1
  390. package/dist/runtime/utils.d.ts +1 -1
  391. package/dist/runtime/utils.d.ts.map +1 -1
  392. package/dist/runtime/utils.js.map +1 -1
  393. package/dist/runtime/variables.d.ts +7 -2
  394. package/dist/runtime/variables.d.ts.map +1 -1
  395. package/dist/runtime/variables.js +20 -4
  396. package/dist/runtime/variables.js.map +1 -1
  397. package/dist/schema/index.js +1 -1
  398. package/dist/schema/index.js.map +1 -1
  399. package/dist/schema/panel.d.ts +4 -4
  400. package/dist/schema/panel.d.ts.map +1 -1
  401. package/dist/schema/panel.js +18 -4
  402. package/dist/schema/panel.js.map +1 -1
  403. package/dist/test/index.js +2 -2
  404. package/dist/test/index.js.map +1 -1
  405. package/dist/test/mock-data.d.ts +14 -13
  406. package/dist/test/mock-data.d.ts.map +1 -1
  407. package/dist/test/mock-data.js +6 -0
  408. package/dist/test/mock-data.js.map +1 -1
  409. package/dist/test/render-hook.d.ts +2 -2
  410. package/dist/test/render-hook.d.ts.map +1 -1
  411. package/dist/test/render-hook.js +2 -2
  412. package/dist/test/render-hook.js.map +1 -1
  413. package/dist/test/render.d.ts +3 -3
  414. package/dist/test/render.d.ts.map +1 -1
  415. package/dist/test/render.js +3 -3
  416. package/dist/test/render.js.map +1 -1
  417. package/dist/test/setup-tests.d.ts +1 -1
  418. package/dist/test/setup-tests.d.ts.map +1 -1
  419. package/dist/test/setup-tests.js +3 -2
  420. package/dist/test/setup-tests.js.map +1 -1
  421. package/dist/test/test-plugins/bert/index.d.ts +3 -3
  422. package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
  423. package/dist/test/test-plugins/bert/index.js.map +1 -1
  424. package/dist/test/test-plugins/ernie/index.d.ts +7 -1
  425. package/dist/test/test-plugins/ernie/index.d.ts.map +1 -1
  426. package/dist/test/test-plugins/ernie/index.js +58 -1
  427. package/dist/test/test-plugins/ernie/index.js.map +1 -1
  428. package/dist/test/test-plugins/index.d.ts +1 -1
  429. package/dist/test/test-plugins/index.d.ts.map +1 -1
  430. package/dist/test/test-plugins/index.js +5 -5
  431. package/dist/test/test-plugins/index.js.map +1 -1
  432. package/dist/test/utils.d.ts +2 -2
  433. package/dist/test/utils.d.ts.map +1 -1
  434. package/dist/test/utils.js +5 -5
  435. package/dist/test/utils.js.map +1 -1
  436. package/dist/test-utils/index.js +1 -1
  437. package/dist/test-utils/index.js.map +1 -1
  438. package/dist/test-utils/mock-plugin-registry.d.ts +2 -2
  439. package/dist/test-utils/mock-plugin-registry.d.ts.map +1 -1
  440. package/dist/test-utils/mock-plugin-registry.js +1 -1
  441. package/dist/test-utils/mock-plugin-registry.js.map +1 -1
  442. package/dist/utils/csv-export.d.ts.map +1 -1
  443. package/dist/utils/csv-export.js +2 -2
  444. package/dist/utils/csv-export.js.map +1 -1
  445. package/dist/utils/event.js +1 -1
  446. package/dist/utils/index.d.ts +1 -0
  447. package/dist/utils/index.d.ts.map +1 -1
  448. package/dist/utils/index.js +4 -3
  449. package/dist/utils/index.js.map +1 -1
  450. package/dist/utils/plugin-versions.d.ts +18 -0
  451. package/dist/utils/plugin-versions.d.ts.map +1 -0
  452. package/dist/utils/plugin-versions.js +52 -0
  453. package/dist/utils/plugin-versions.js.map +1 -0
  454. package/dist/utils/variables.js +1 -1
  455. package/package.json +18 -17
  456. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationEditorForm.js +0 -283
  457. package/dist/cjs/components/Annotations/AnnotationEditorForm/AnnotationPreview.js +0 -197
  458. package/dist/cjs/components/Annotations/AnnotationEditorForm/index.js +0 -30
  459. package/dist/cjs/components/Annotations/constants.js +0 -23
  460. package/dist/cjs/components/Annotations/index.js +0 -31
  461. package/dist/cjs/components/CalculationSelector/CalculationSelector.js +0 -49
  462. package/dist/cjs/components/CalculationSelector/index.js +0 -30
  463. package/dist/cjs/components/DatasourceEditorForm/DatasourceEditorForm.js +0 -270
  464. package/dist/cjs/components/DatasourceEditorForm/index.js +0 -30
  465. package/dist/cjs/components/DatasourceSelect/DatasourceSelect.js +0 -266
  466. package/dist/cjs/components/DatasourceSelect/index.js +0 -30
  467. package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +0 -568
  468. package/dist/cjs/components/HTTPSettingsEditor/index.js +0 -30
  469. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/ItemSelectionActionsOptionsEditor.js +0 -1175
  470. package/dist/cjs/components/ItemSelectionActionsOptionsEditor/index.js +0 -30
  471. package/dist/cjs/components/LegendOptionsEditor/LegendOptionsEditor.js +0 -211
  472. package/dist/cjs/components/LegendOptionsEditor/index.js +0 -30
  473. package/dist/cjs/components/LinksEditor/LinksEditor.js +0 -162
  474. package/dist/cjs/components/LinksEditor/index.js +0 -30
  475. package/dist/cjs/components/MetricLabelInput/MetricLabelInput.js +0 -41
  476. package/dist/cjs/components/MetricLabelInput/index.js +0 -30
  477. package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +0 -159
  478. package/dist/cjs/components/MultiQueryEditor/QueryEditorContainer.js +0 -250
  479. package/dist/cjs/components/MultiQueryEditor/index.js +0 -31
  480. package/dist/cjs/components/MultiQueryEditor/utils.js +0 -36
  481. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +0 -69
  482. package/dist/cjs/components/OptionsEditorRadios/index.js +0 -30
  483. package/dist/cjs/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js +0 -39
  484. package/dist/cjs/components/OptionsEditorTabPanel/index.js +0 -30
  485. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +0 -61
  486. package/dist/cjs/components/OptionsEditorTabs/index.js +0 -30
  487. package/dist/cjs/components/PanelSpecEditor/PanelAnnotationsEditor.js +0 -246
  488. package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +0 -132
  489. package/dist/cjs/components/PanelSpecEditor/index.js +0 -30
  490. package/dist/cjs/components/PluginEditor/PluginEditor.js +0 -98
  491. package/dist/cjs/components/PluginEditor/index.js +0 -31
  492. package/dist/cjs/components/PluginEditor/plugin-editor-api.js +0 -136
  493. package/dist/cjs/components/PluginKindSelect/PluginKindSelect.js +0 -109
  494. package/dist/cjs/components/PluginKindSelect/index.js +0 -30
  495. package/dist/cjs/components/PluginRegistry/PluginRegistry.js +0 -86
  496. package/dist/cjs/components/PluginRegistry/getPluginSearchHelper.js +0 -92
  497. package/dist/cjs/components/PluginRegistry/index.js +0 -30
  498. package/dist/cjs/components/PluginRegistry/plugin-indexes.js +0 -88
  499. package/dist/cjs/components/PluginSpecEditor/PluginSpecEditor.js +0 -55
  500. package/dist/cjs/components/PluginSpecEditor/index.js +0 -30
  501. package/dist/cjs/components/SelectionOptionsEditor/SelectionOptionsEditor.js +0 -43
  502. package/dist/cjs/components/SelectionOptionsEditor/index.js +0 -30
  503. package/dist/cjs/components/TimeRangeControls/TimeRangeControls.js +0 -236
  504. package/dist/cjs/components/TimeRangeControls/index.js +0 -30
  505. package/dist/cjs/components/Variables/VariableEditorForm/VariableEditorForm.js +0 -613
  506. package/dist/cjs/components/Variables/VariableEditorForm/VariablePreview.js +0 -193
  507. package/dist/cjs/components/Variables/VariableEditorForm/index.js +0 -32
  508. package/dist/cjs/components/Variables/VariableEditorForm/variable-editor-form-model.js +0 -143
  509. package/dist/cjs/components/Variables/index.js +0 -31
  510. package/dist/cjs/components/Variables/variable-model.js +0 -211
  511. package/dist/cjs/components/index.js +0 -48
  512. package/dist/cjs/constants/index.js +0 -30
  513. package/dist/cjs/constants/user-interface-text.js +0 -32
  514. package/dist/cjs/context/ValidationProvider.js +0 -77
  515. package/dist/cjs/context/index.js +0 -30
  516. package/dist/cjs/index.js +0 -38
  517. package/dist/cjs/model/calculations.js +0 -178
  518. package/dist/cjs/model/index.js +0 -45
  519. package/dist/cjs/model/legend.js +0 -111
  520. package/dist/cjs/model/log-queries.js +0 -16
  521. package/dist/cjs/model/log-volume-utils.js +0 -124
  522. package/dist/cjs/model/panels.js +0 -16
  523. package/dist/cjs/model/plugin-base.js +0 -16
  524. package/dist/cjs/model/plugin-loading.js +0 -56
  525. package/dist/cjs/model/plugins.js +0 -26
  526. package/dist/cjs/model/profile-queries.js +0 -16
  527. package/dist/cjs/model/silences-queries.js +0 -16
  528. package/dist/cjs/model/time-series-queries.js +0 -26
  529. package/dist/cjs/model/trace-queries.js +0 -16
  530. package/dist/cjs/model/variables.js +0 -16
  531. package/dist/cjs/remote/PersesPlugin.types.js +0 -16
  532. package/dist/cjs/remote/PluginLoaderComponent.js +0 -87
  533. package/dist/cjs/remote/PluginRuntime.js +0 -331
  534. package/dist/cjs/remote/index.js +0 -31
  535. package/dist/cjs/remote/remotePluginLoader.js +0 -101
  536. package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +0 -154
  537. package/dist/cjs/runtime/DataQueriesProvider/index.js +0 -31
  538. package/dist/cjs/runtime/DataQueriesProvider/model.js +0 -34
  539. package/dist/cjs/runtime/RouterProvider.js +0 -114
  540. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +0 -201
  541. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProviders.js +0 -66
  542. package/dist/cjs/runtime/TimeRangeProvider/TimeRangeSettingsProvider.js +0 -113
  543. package/dist/cjs/runtime/TimeRangeProvider/index.js +0 -33
  544. package/dist/cjs/runtime/TimeRangeProvider/query-params.js +0 -250
  545. package/dist/cjs/runtime/TimeRangeProvider/refresh-interval.js +0 -30
  546. package/dist/cjs/runtime/UsageMetricsProvider.js +0 -102
  547. package/dist/cjs/runtime/alerts-queries.js +0 -101
  548. package/dist/cjs/runtime/annotations.js +0 -148
  549. package/dist/cjs/runtime/builtin-variables.js +0 -81
  550. package/dist/cjs/runtime/datasources.js +0 -80
  551. package/dist/cjs/runtime/index.js +0 -44
  552. package/dist/cjs/runtime/item-actions.js +0 -302
  553. package/dist/cjs/runtime/log-queries.js +0 -76
  554. package/dist/cjs/runtime/plugin-registry.js +0 -135
  555. package/dist/cjs/runtime/profile-queries.js +0 -73
  556. package/dist/cjs/runtime/silences-queries.js +0 -101
  557. package/dist/cjs/runtime/time-series-queries.js +0 -165
  558. package/dist/cjs/runtime/trace-queries.js +0 -106
  559. package/dist/cjs/runtime/utils.js +0 -39
  560. package/dist/cjs/runtime/variables.js +0 -160
  561. package/dist/cjs/schema/index.js +0 -30
  562. package/dist/cjs/schema/panel.js +0 -42
  563. package/dist/cjs/test/index.js +0 -31
  564. package/dist/cjs/test/mock-data.js +0 -357
  565. package/dist/cjs/test/render-hook.js +0 -31
  566. package/dist/cjs/test/render.js +0 -31
  567. package/dist/cjs/test/setup-tests.js +0 -20
  568. package/dist/cjs/test/test-plugins/bert/index.js +0 -99
  569. package/dist/cjs/test/test-plugins/ernie/index.js +0 -92
  570. package/dist/cjs/test/test-plugins/index.js +0 -81
  571. package/dist/cjs/test/utils.js +0 -58
  572. package/dist/cjs/test-utils/index.js +0 -30
  573. package/dist/cjs/test-utils/mock-plugin-registry.js +0 -81
  574. package/dist/cjs/utils/csv-export.js +0 -248
  575. package/dist/cjs/utils/event.js +0 -30
  576. package/dist/cjs/utils/index.js +0 -32
  577. package/dist/cjs/utils/variables.js +0 -44
@@ -10,20 +10,21 @@
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 './annotations';
14
- export * from './builtin-variables';
15
- export * from './datasources';
16
- export * from './plugin-registry';
17
- export * from './variables';
18
- export * from './TimeRangeProvider';
19
- export * from './time-series-queries';
20
- export * from './trace-queries';
21
- export * from './profile-queries';
22
- export * from './alerts-queries';
23
- export * from './silences-queries';
24
- export * from './item-actions';
25
- export * from './DataQueriesProvider';
26
- export * from './RouterProvider';
27
- export * from './UsageMetricsProvider';
13
+ export * from "./annotations.js";
14
+ export * from "./builtin-variables.js";
15
+ export * from "./datasources.js";
16
+ export * from "./plugin-registry.js";
17
+ export * from "./variables.js";
18
+ export * from "./TimeRangeProvider/index.js";
19
+ export * from "./time-series-queries.js";
20
+ export * from "./trace-queries.js";
21
+ export * from "./profile-queries.js";
22
+ export * from "./alerts-queries.js";
23
+ export * from "./json-queries.js";
24
+ export * from "./silences-queries.js";
25
+ export * from "./item-actions.js";
26
+ export * from "./DataQueriesProvider/index.js";
27
+ export * from "./RouterProvider.js";
28
+ export * from "./UsageMetricsProvider.js";
28
29
 
29
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/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 './annotations';\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './alerts-queries';\nexport * from './silences-queries';\nexport * from './item-actions';\nexport * from './DataQueriesProvider';\nexport * from './RouterProvider';\nexport * from './UsageMetricsProvider';\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,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,oBAAoB;AAClC,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB;AACtC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB"}
1
+ {"version":3,"sources":["../../src/runtime/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 './annotations';\nexport * from './builtin-variables';\nexport * from './datasources';\nexport * from './plugin-registry';\nexport * from './variables';\nexport * from './TimeRangeProvider';\nexport * from './time-series-queries';\nexport * from './trace-queries';\nexport * from './profile-queries';\nexport * from './alerts-queries';\nexport * from './json-queries';\nexport * from './silences-queries';\nexport * from './item-actions';\nexport * from './DataQueriesProvider';\nexport * from './RouterProvider';\nexport * from './UsageMetricsProvider';\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,mBAAgB;AAC9B,cAAc,yBAAsB;AACpC,cAAc,mBAAgB;AAC9B,cAAc,uBAAoB;AAClC,cAAc,iBAAc;AAC5B,cAAc,+BAAsB;AACpC,cAAc,2BAAwB;AACtC,cAAc,qBAAkB;AAChC,cAAc,uBAAoB;AAClC,cAAc,sBAAmB;AACjC,cAAc,oBAAiB;AAC/B,cAAc,wBAAqB;AACnC,cAAc,oBAAiB;AAC/B,cAAc,iCAAwB;AACtC,cAAc,sBAAmB;AACjC,cAAc,4BAAyB"}
@@ -1,6 +1,6 @@
1
- import { ActionStatus, SelectionItem, VariableStateMap } from '@perses-dev/components';
2
- import { type FetchFn } from '@perses-dev/client';
3
- import { ItemAction } from '../components/ItemSelectionActionsOptionsEditor';
1
+ import type { FetchFn } from '@perses-dev/client';
2
+ import type { ActionStatus, SelectionItem, VariableStateMap } from '@perses-dev/components';
3
+ import type { ItemAction } from '../components/ItemSelectionActionsOptionsEditor';
4
4
  /**
5
5
  * Parameters for executing a selection action
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"item-actions.d.ts","sourceRoot":"","sources":["../../src/runtime/item-actions.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,YAAY,EAGZ,aAAa,EACb,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM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,EAAE,GAAG,OAAO;IAC/C,4BAA4B;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,yCAAyC;IACzC,YAAY,EAAE,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IACrC,0DAA0D;IAC1D,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,uCAAuC;IACvC,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC;IAC1F,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACjE;AA4PD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAcjH"}
@@ -10,7 +10,7 @@
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 { interpolateSelectionBatch, interpolateSelectionIndividual } from '@perses-dev/components';
13
+ import { interpolateSelectionBatch, interpolateSelectionIndividual } from "@perses-dev/components";
14
14
  const BODY_METHODS = new Set([
15
15
  'POST',
16
16
  'PUT',
@@ -18,7 +18,7 @@ const BODY_METHODS = new Set([
18
18
  ]);
19
19
  function buildWebhookHeaders(action) {
20
20
  const headers = {
21
- ...action.headers ?? {}
21
+ ...action.headers
22
22
  };
23
23
  const contentType = action.contentType ?? 'none';
24
24
  const supportsBody = BODY_METHODS.has(action.method);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/item-actions.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 ActionStatus,\n interpolateSelectionBatch,\n interpolateSelectionIndividual,\n SelectionItem,\n VariableStateMap,\n} from '@perses-dev/components';\nimport { type FetchFn } from '@perses-dev/client';\nimport { ItemAction, EventAction, WebhookAction } from '../components/ItemSelectionActionsOptionsEditor';\n\nconst BODY_METHODS = new Set(['POST', 'PUT', 'PATCH']);\n\nfunction buildWebhookHeaders(action: WebhookAction): Record<string, string> {\n const headers: Record<string, string> = { ...(action.headers ?? {}) };\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method);\n\n if (supportsBody && contentType === 'json') {\n headers['Content-Type'] = 'application/json';\n } else if (supportsBody && contentType === 'text') {\n headers['Content-Type'] = 'text/plain; charset=utf-8';\n }\n\n return headers;\n}\n\n/**\n * Parameters for executing a selection action\n */\nexport interface ExecuteActionParams<Id = unknown> {\n /** The action to execute */\n action: ItemAction;\n /** Map of selection IDs to their data */\n selectionMap: Map<Id, SelectionItem>;\n /** Optional dashboard variable state for interpolation */\n variableState?: VariableStateMap;\n /** Callback to update action status */\n setActionStatus: (actionName: string, status: Partial<ActionStatus>, itemId?: Id) => void;\n /** Fetch function from FetchProvider context */\n fetchFn: FetchFn;\n}\n\n/**\n * Result of action execution\n */\nexport interface ActionExecutionResult {\n success: boolean;\n error?: Error;\n /** For individual batch mode, results per item */\n itemResults?: Map<unknown, { success: boolean; error?: Error }>;\n}\n\n/**\n * Execute an event action by dispatching a single CustomEvent with batch data\n */\nfunction executeEventBatch<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus']\n): ActionExecutionResult {\n try {\n setActionStatus(action.name, { loading: true });\n\n const items = Array.from(selectionMap.values());\n\n // Interpolate body template if provided\n let body: string | undefined;\n if (action.bodyTemplate) {\n const bodyResult = interpolateSelectionBatch(action.bodyTemplate, items, variableState);\n body = bodyResult.text;\n } else {\n body = JSON.stringify({ items });\n }\n\n const event = new CustomEvent(action.eventName, {\n detail: body,\n bubbles: true,\n cancelable: true,\n });\n\n window.dispatchEvent(event);\n\n setActionStatus(action.name, { loading: false, success: true });\n return { success: true };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err });\n return { success: false, error: err };\n }\n}\n\n/**\n * Execute events actions by dispatching one CustomEvent per selection\n */\nfunction executeEventIndividual<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus']\n): ActionExecutionResult {\n const entries = Array.from(selectionMap.entries());\n const count = entries.length;\n const itemResults = new Map<Id, { success: boolean; error?: Error }>();\n\n // Initialize all items as loading\n setActionStatus(action.name, { loading: true, itemStatuses: new Map() });\n\n for (let index = 0; index < entries.length; index++) {\n const [id, item] = entries[index]!;\n\n setActionStatus(action.name, { loading: true }, id);\n\n try {\n // Interpolate body template if provided\n let body: string | undefined;\n if (action.bodyTemplate) {\n const bodyResult = interpolateSelectionIndividual(action.bodyTemplate, item, index, count, variableState);\n body = bodyResult.text;\n } else {\n body = JSON.stringify({ id, data: item });\n }\n\n const event = new CustomEvent(action.eventName, {\n detail: body,\n bubbles: true,\n cancelable: true,\n });\n\n window.dispatchEvent(event);\n itemResults.set(id, { success: true });\n setActionStatus(action.name, { loading: false, success: true }, id);\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err }, id);\n itemResults.set(id, { success: false, error: err });\n }\n }\n\n setActionStatus(action.name, { loading: false, success: true });\n\n return {\n success: true,\n itemResults,\n };\n}\n\n/**\n * Execute a webhook action in individual mode (one request per selection)\n */\nasync function executeWebhookIndividual<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn\n): Promise<ActionExecutionResult> {\n const entries = Array.from(selectionMap.entries());\n const count = entries.length;\n const itemResults = new Map<Id, { success: boolean; error?: Error }>();\n\n // Initialize all items as loading\n setActionStatus(action.name, { loading: true, itemStatuses: new Map() });\n\n // Execute requests sequentially to avoid overwhelming the server\n for (let index = 0; index < entries.length; index++) {\n const [id, item] = entries[index]!;\n\n setActionStatus(action.name, { loading: true }, id);\n\n try {\n // Interpolate URL\n const urlResult = interpolateSelectionIndividual(action.url, item, index, count, variableState);\n\n // Interpolate body template if provided\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method) && contentType !== 'none';\n let body: string | undefined;\n if (supportsBody && action.bodyTemplate) {\n const bodyResult = interpolateSelectionIndividual(action.bodyTemplate, item, index, count, variableState);\n body = bodyResult.text;\n }\n\n // Make the request\n const response = await fetchFn(urlResult.text, {\n method: action.method,\n headers: buildWebhookHeaders(action),\n body: body,\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n setActionStatus(action.name, { loading: false, success: true }, id);\n itemResults.set(id, { success: true });\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err }, id);\n itemResults.set(id, { success: false, error: err });\n }\n }\n\n // Update overall action status\n const allSucceeded = Array.from(itemResults.values()).every((r) => r.success);\n const anyFailed = Array.from(itemResults.values()).some((r) => !r.success);\n\n if (allSucceeded) {\n setActionStatus(action.name, { loading: false, success: true });\n } else if (anyFailed) {\n setActionStatus(action.name, {\n loading: false,\n error: new Error('Some requests failed'),\n });\n }\n\n return {\n success: allSucceeded,\n itemResults,\n };\n}\n\n/**\n * Execute a webhook action in batch mode (single request with all selections)\n */\nasync function executeWebhookBatch<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn\n): Promise<ActionExecutionResult> {\n const items = Array.from(selectionMap.values());\n\n setActionStatus(action.name, { loading: true });\n\n try {\n // Interpolate URL\n const urlResult = interpolateSelectionBatch(action.url, items, variableState);\n\n // Interpolate body template if provided\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method) && contentType !== 'none';\n let body: string | undefined;\n if (supportsBody && action.bodyTemplate) {\n const bodyResult = interpolateSelectionBatch(action.bodyTemplate, items, variableState);\n body = bodyResult.text;\n }\n\n // Make the request\n const response = await fetchFn(urlResult.text, {\n method: action.method,\n headers: buildWebhookHeaders(action),\n body: body,\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n setActionStatus(action.name, { loading: false, success: true });\n return { success: true };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err });\n return { success: false, error: err };\n }\n}\n\n/**\n * Execute a webhook action\n */\nasync function executeWebhookAction<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn\n): Promise<ActionExecutionResult> {\n if (action.batchMode === 'batch') {\n return executeWebhookBatch(action, selectionMap, variableState, setActionStatus, fetchFn);\n } else {\n return executeWebhookIndividual(action, selectionMap, variableState, setActionStatus, fetchFn);\n }\n}\n\n/**\n * Execute an event action\n */\nasync function executeEventAction<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus']\n): Promise<ActionExecutionResult> {\n if (action.batchMode === 'batch') {\n return executeEventBatch(action, selectionMap, variableState, setActionStatus);\n } else {\n return executeEventIndividual(action, selectionMap, variableState, setActionStatus);\n }\n}\n\n/**\n * Execute a selection action (event or webhook)\n *\n * @param params - Execution parameters including action, selections, and callbacks\n * @returns Promise resolving to the execution result\n */\nexport async function executeAction<Id = unknown>(params: ExecuteActionParams<Id>): Promise<ActionExecutionResult> {\n const { action, selectionMap, variableState, setActionStatus, fetchFn } = params;\n\n if (selectionMap.size === 0) {\n return { success: true };\n }\n\n if (action.type === 'event') {\n return executeEventAction(action, selectionMap, variableState, setActionStatus);\n } else if (action.type === 'webhook') {\n return executeWebhookAction(action, selectionMap, variableState, setActionStatus, fetchFn);\n }\n\n return { success: false, error: new Error(`Unknown action type`) };\n}\n"],"names":["interpolateSelectionBatch","interpolateSelectionIndividual","BODY_METHODS","Set","buildWebhookHeaders","action","headers","contentType","supportsBody","has","method","executeEventBatch","selectionMap","variableState","setActionStatus","name","loading","items","Array","from","values","body","bodyTemplate","bodyResult","text","JSON","stringify","event","CustomEvent","eventName","detail","bubbles","cancelable","window","dispatchEvent","success","error","err","Error","String","executeEventIndividual","entries","count","length","itemResults","Map","itemStatuses","index","id","item","data","set","executeWebhookIndividual","fetchFn","urlResult","url","response","ok","status","statusText","allSucceeded","every","r","anyFailed","some","executeWebhookBatch","executeWebhookAction","batchMode","executeEventAction","executeAction","params","size","type"],"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,SAEEA,yBAAyB,EACzBC,8BAA8B,QAGzB,yBAAyB;AAIhC,MAAMC,eAAe,IAAIC,IAAI;IAAC;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yB/C,QAAQO,cAAcC,eAAeC,iBAAiBuC;IACxF;AACF;AAEA;;CAEC,GACD,eAAee,mBACb/D,MAAmB,EACnBO,YAAoC,EACpCC,aAA2C,EAC3CC,eAA2D;IAE3D,IAAIT,OAAO8D,SAAS,KAAK,SAAS;QAChC,OAAOxD,kBAAkBN,QAAQO,cAAcC,eAAeC;IAChE,OAAO;QACL,OAAO0B,uBAAuBnC,QAAQO,cAAcC,eAAeC;IACrE;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeuD,cAA4BC,MAA+B;IAC/E,MAAM,EAAEjE,MAAM,EAAEO,YAAY,EAAEC,aAAa,EAAEC,eAAe,EAAEuC,OAAO,EAAE,GAAGiB;IAE1E,IAAI1D,aAAa2D,IAAI,KAAK,GAAG;QAC3B,OAAO;YAAEpC,SAAS;QAAK;IACzB;IAEA,IAAI9B,OAAOmE,IAAI,KAAK,SAAS;QAC3B,OAAOJ,mBAAmB/D,QAAQO,cAAcC,eAAeC;IACjE,OAAO,IAAIT,OAAOmE,IAAI,KAAK,WAAW;QACpC,OAAON,qBAAqB7D,QAAQO,cAAcC,eAAeC,iBAAiBuC;IACpF;IAEA,OAAO;QAAElB,SAAS;QAAOC,OAAO,IAAIE,MAAM,CAAC,mBAAmB,CAAC;IAAE;AACnE"}
1
+ {"version":3,"sources":["../../src/runtime/item-actions.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 { FetchFn } from '@perses-dev/client';\nimport type { ActionStatus, SelectionItem, VariableStateMap } from '@perses-dev/components';\nimport { interpolateSelectionBatch, interpolateSelectionIndividual } from '@perses-dev/components';\n\nimport type { ItemAction, EventAction, WebhookAction } from '../components/ItemSelectionActionsOptionsEditor';\n\nconst BODY_METHODS = new Set(['POST', 'PUT', 'PATCH']);\n\nfunction buildWebhookHeaders(action: WebhookAction): Record<string, string> {\n const headers: Record<string, string> = { ...action.headers };\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method);\n\n if (supportsBody && contentType === 'json') {\n headers['Content-Type'] = 'application/json';\n } else if (supportsBody && contentType === 'text') {\n headers['Content-Type'] = 'text/plain; charset=utf-8';\n }\n\n return headers;\n}\n\n/**\n * Parameters for executing a selection action\n */\nexport interface ExecuteActionParams<Id = unknown> {\n /** The action to execute */\n action: ItemAction;\n /** Map of selection IDs to their data */\n selectionMap: Map<Id, SelectionItem>;\n /** Optional dashboard variable state for interpolation */\n variableState?: VariableStateMap;\n /** Callback to update action status */\n setActionStatus: (actionName: string, status: Partial<ActionStatus>, itemId?: Id) => void;\n /** Fetch function from FetchProvider context */\n fetchFn: FetchFn;\n}\n\n/**\n * Result of action execution\n */\nexport interface ActionExecutionResult {\n success: boolean;\n error?: Error;\n /** For individual batch mode, results per item */\n itemResults?: Map<unknown, { success: boolean; error?: Error }>;\n}\n\n/**\n * Execute an event action by dispatching a single CustomEvent with batch data\n */\nfunction executeEventBatch<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n): ActionExecutionResult {\n try {\n setActionStatus(action.name, { loading: true });\n\n const items = Array.from(selectionMap.values());\n\n // Interpolate body template if provided\n let body: string | undefined;\n if (action.bodyTemplate) {\n const bodyResult = interpolateSelectionBatch(action.bodyTemplate, items, variableState);\n body = bodyResult.text;\n } else {\n body = JSON.stringify({ items });\n }\n\n const event = new CustomEvent(action.eventName, {\n detail: body,\n bubbles: true,\n cancelable: true,\n });\n\n window.dispatchEvent(event);\n\n setActionStatus(action.name, { loading: false, success: true });\n return { success: true };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err });\n return { success: false, error: err };\n }\n}\n\n/**\n * Execute events actions by dispatching one CustomEvent per selection\n */\nfunction executeEventIndividual<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n): ActionExecutionResult {\n const entries = Array.from(selectionMap.entries());\n const count = entries.length;\n const itemResults = new Map<Id, { success: boolean; error?: Error }>();\n\n // Initialize all items as loading\n setActionStatus(action.name, { loading: true, itemStatuses: new Map() });\n\n for (let index = 0; index < entries.length; index++) {\n const [id, item] = entries[index]!;\n\n setActionStatus(action.name, { loading: true }, id);\n\n try {\n // Interpolate body template if provided\n let body: string | undefined;\n if (action.bodyTemplate) {\n const bodyResult = interpolateSelectionIndividual(action.bodyTemplate, item, index, count, variableState);\n body = bodyResult.text;\n } else {\n body = JSON.stringify({ id, data: item });\n }\n\n const event = new CustomEvent(action.eventName, {\n detail: body,\n bubbles: true,\n cancelable: true,\n });\n\n window.dispatchEvent(event);\n itemResults.set(id, { success: true });\n setActionStatus(action.name, { loading: false, success: true }, id);\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err }, id);\n itemResults.set(id, { success: false, error: err });\n }\n }\n\n setActionStatus(action.name, { loading: false, success: true });\n\n return {\n success: true,\n itemResults,\n };\n}\n\n/**\n * Execute a webhook action in individual mode (one request per selection)\n */\nasync function executeWebhookIndividual<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn,\n): Promise<ActionExecutionResult> {\n const entries = Array.from(selectionMap.entries());\n const count = entries.length;\n const itemResults = new Map<Id, { success: boolean; error?: Error }>();\n\n // Initialize all items as loading\n setActionStatus(action.name, { loading: true, itemStatuses: new Map() });\n\n // Execute requests sequentially to avoid overwhelming the server\n for (let index = 0; index < entries.length; index++) {\n const [id, item] = entries[index]!;\n\n setActionStatus(action.name, { loading: true }, id);\n\n try {\n // Interpolate URL\n const urlResult = interpolateSelectionIndividual(action.url, item, index, count, variableState);\n\n // Interpolate body template if provided\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method) && contentType !== 'none';\n let body: string | undefined;\n if (supportsBody && action.bodyTemplate) {\n const bodyResult = interpolateSelectionIndividual(action.bodyTemplate, item, index, count, variableState);\n body = bodyResult.text;\n }\n\n // Make the request\n const response = await fetchFn(urlResult.text, {\n method: action.method,\n headers: buildWebhookHeaders(action),\n body: body,\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n setActionStatus(action.name, { loading: false, success: true }, id);\n itemResults.set(id, { success: true });\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err }, id);\n itemResults.set(id, { success: false, error: err });\n }\n }\n\n // Update overall action status\n const allSucceeded = Array.from(itemResults.values()).every((r) => r.success);\n const anyFailed = Array.from(itemResults.values()).some((r) => !r.success);\n\n if (allSucceeded) {\n setActionStatus(action.name, { loading: false, success: true });\n } else if (anyFailed) {\n setActionStatus(action.name, {\n loading: false,\n error: new Error('Some requests failed'),\n });\n }\n\n return {\n success: allSucceeded,\n itemResults,\n };\n}\n\n/**\n * Execute a webhook action in batch mode (single request with all selections)\n */\nasync function executeWebhookBatch<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn,\n): Promise<ActionExecutionResult> {\n const items = Array.from(selectionMap.values());\n\n setActionStatus(action.name, { loading: true });\n\n try {\n // Interpolate URL\n const urlResult = interpolateSelectionBatch(action.url, items, variableState);\n\n // Interpolate body template if provided\n const contentType = action.contentType ?? 'none';\n const supportsBody = BODY_METHODS.has(action.method) && contentType !== 'none';\n let body: string | undefined;\n if (supportsBody && action.bodyTemplate) {\n const bodyResult = interpolateSelectionBatch(action.bodyTemplate, items, variableState);\n body = bodyResult.text;\n }\n\n // Make the request\n const response = await fetchFn(urlResult.text, {\n method: action.method,\n headers: buildWebhookHeaders(action),\n body: body,\n });\n\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n setActionStatus(action.name, { loading: false, success: true });\n return { success: true };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n setActionStatus(action.name, { loading: false, error: err });\n return { success: false, error: err };\n }\n}\n\n/**\n * Execute a webhook action\n */\nasync function executeWebhookAction<Id>(\n action: WebhookAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n fetchFn: FetchFn,\n): Promise<ActionExecutionResult> {\n if (action.batchMode === 'batch') {\n return executeWebhookBatch(action, selectionMap, variableState, setActionStatus, fetchFn);\n } else {\n return executeWebhookIndividual(action, selectionMap, variableState, setActionStatus, fetchFn);\n }\n}\n\n/**\n * Execute an event action\n */\nasync function executeEventAction<Id>(\n action: EventAction,\n selectionMap: Map<Id, SelectionItem>,\n variableState: VariableStateMap | undefined,\n setActionStatus: ExecuteActionParams<Id>['setActionStatus'],\n): Promise<ActionExecutionResult> {\n if (action.batchMode === 'batch') {\n return executeEventBatch(action, selectionMap, variableState, setActionStatus);\n } else {\n return executeEventIndividual(action, selectionMap, variableState, setActionStatus);\n }\n}\n\n/**\n * Execute a selection action (event or webhook)\n *\n * @param params - Execution parameters including action, selections, and callbacks\n * @returns Promise resolving to the execution result\n */\nexport async function executeAction<Id = unknown>(params: ExecuteActionParams<Id>): Promise<ActionExecutionResult> {\n const { action, selectionMap, variableState, setActionStatus, fetchFn } = params;\n\n if (selectionMap.size === 0) {\n return { success: true };\n }\n\n if (action.type === 'event') {\n return executeEventAction(action, selectionMap, variableState, setActionStatus);\n } else if (action.type === 'webhook') {\n return executeWebhookAction(action, selectionMap, variableState, setActionStatus, fetchFn);\n }\n\n return { success: false, error: new Error(`Unknown action type`) };\n}\n"],"names":["interpolateSelectionBatch","interpolateSelectionIndividual","BODY_METHODS","Set","buildWebhookHeaders","action","headers","contentType","supportsBody","has","method","executeEventBatch","selectionMap","variableState","setActionStatus","name","loading","items","Array","from","values","body","bodyTemplate","bodyResult","text","JSON","stringify","event","CustomEvent","eventName","detail","bubbles","cancelable","window","dispatchEvent","success","error","err","Error","String","executeEventIndividual","entries","count","length","itemResults","Map","itemStatuses","index","id","item","data","set","executeWebhookIndividual","fetchFn","urlResult","url","response","ok","status","statusText","allSucceeded","every","r","anyFailed","some","executeWebhookBatch","executeWebhookAction","batchMode","executeEventAction","executeAction","params","size","type"],"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,yBAAyB,EAAEC,8BAA8B,QAAQ,yBAAyB;AAInG,MAAMC,eAAe,IAAIC,IAAI;IAAC;IAAQ;IAAO;CAAQ;AAErD,SAASC,oBAAoBC,MAAqB;IAChD,MAAMC,UAAkC;QAAE,GAAGD,OAAOC,OAAO;IAAC;IAC5D,MAAMC,cAAcF,OAAOE,WAAW,IAAI;IAC1C,MAAMC,eAAeN,aAAaO,GAAG,CAACJ,OAAOK,MAAM;IAEnD,IAAIF,gBAAgBD,gBAAgB,QAAQ;QAC1CD,OAAO,CAAC,eAAe,GAAG;IAC5B,OAAO,IAAIE,gBAAgBD,gBAAgB,QAAQ;QACjDD,OAAO,CAAC,eAAe,GAAG;IAC5B;IAEA,OAAOA;AACT;AA4BA;;CAEC,GACD,SAASK,kBACPN,MAAmB,EACnBO,YAAoC,EACpCC,aAA2C,EAC3CC,eAA2D;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GAAG;QAC3B,OAAO;YAAEpC,SAAS;QAAK;IACzB;IAEA,IAAI9B,OAAOmE,IAAI,KAAK,SAAS;QAC3B,OAAOJ,mBAAmB/D,QAAQO,cAAcC,eAAeC;IACjE,OAAO,IAAIT,OAAOmE,IAAI,KAAK,WAAW;QACpC,OAAON,qBAAqB7D,QAAQO,cAAcC,eAAeC,iBAAiBuC;IACpF;IAEA,OAAO;QAAElB,SAAS;QAAOC,OAAO,IAAIE,MAAM,CAAC,mBAAmB,CAAC;IAAE;AACnE"}
@@ -0,0 +1,11 @@
1
+ import type { JsonData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
+ export type JsonQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'JsonQuery', PluginSpec>;
4
+ export declare const JSON_QUERY_KEY = "JsonQuery";
5
+ /**
6
+ * Run a json query using a JsonQuery plugin and return the results.
7
+ * A json query returns an arbitrary JSON payload and is NOT time-range dependent.
8
+ * @param definitions: dashboard definitions for the json queries to run
9
+ */
10
+ export declare function useJsonQueries(definitions: JsonQueryDefinition[]): Array<UseQueryResult<JsonData>>;
11
+ //# sourceMappingURL=json-queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/json-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQ5D,MAAM,MAAM,mBAAmB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AACrG,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CA4BlG"}
@@ -0,0 +1,58 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useQueries } from "@tanstack/react-query";
14
+ import { useDatasourceStore } from "./datasources.js";
15
+ import { usePluginRegistry } from "./plugin-registry.js";
16
+ import { useVariableValues } from "./variables.js";
17
+ export const JSON_QUERY_KEY = 'JsonQuery';
18
+ /**
19
+ * Run a json query using a JsonQuery plugin and return the results.
20
+ * A json query returns an arbitrary JSON payload and is NOT time-range dependent.
21
+ * @param definitions: dashboard definitions for the json queries to run
22
+ */ export function useJsonQueries(definitions) {
23
+ const { getPlugin } = usePluginRegistry();
24
+ const datasourceStore = useDatasourceStore();
25
+ const variableValues = useVariableValues();
26
+ const context = {
27
+ variableState: variableValues,
28
+ datasourceStore
29
+ };
30
+ return useQueries({
31
+ queries: definitions.map((definition)=>{
32
+ const queryKey = [
33
+ 'query',
34
+ JSON_QUERY_KEY,
35
+ definition,
36
+ variableValues
37
+ ];
38
+ const jsonQueryKind = definition?.spec?.plugin?.kind;
39
+ return {
40
+ queryKey,
41
+ refetchOnMount: false,
42
+ refetchOnWindowFocus: false,
43
+ refetchOnReconnect: false,
44
+ staleTime: Infinity,
45
+ queryFn: async ({ signal })=>{
46
+ const plugin = await getPlugin({
47
+ kind: JSON_QUERY_KEY,
48
+ name: jsonQueryKind
49
+ });
50
+ return plugin.getJsonData(definition.spec.plugin.spec, context, signal);
51
+ },
52
+ structuralSharing: false
53
+ };
54
+ })
55
+ });
56
+ }
57
+
58
+ //# sourceMappingURL=json-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/runtime/json-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 { JsonData, QueryDefinition, UnknownSpec } from '@perses-dev/spec';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport type { JsonQueryContext } from '../model/json-queries';\nimport { useDatasourceStore } from './datasources';\nimport { usePluginRegistry } from './plugin-registry';\nimport { useVariableValues } from './variables';\n\nexport type JsonQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'JsonQuery', PluginSpec>;\nexport const JSON_QUERY_KEY = 'JsonQuery';\n\n/**\n * Run a json query using a JsonQuery plugin and return the results.\n * A json query returns an arbitrary JSON payload and is NOT time-range dependent.\n * @param definitions: dashboard definitions for the json queries to run\n */\nexport function useJsonQueries(definitions: JsonQueryDefinition[]): Array<UseQueryResult<JsonData>> {\n const { getPlugin } = usePluginRegistry();\n const datasourceStore = useDatasourceStore();\n const variableValues = useVariableValues();\n\n const context: JsonQueryContext = {\n variableState: variableValues,\n datasourceStore,\n };\n\n return useQueries({\n queries: definitions.map((definition) => {\n const queryKey = ['query', JSON_QUERY_KEY, definition, variableValues] as const;\n const jsonQueryKind = definition?.spec?.plugin?.kind;\n return {\n queryKey,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n staleTime: Infinity,\n queryFn: async ({ signal }: { signal?: AbortSignal }): Promise<JsonData> => {\n const plugin = await getPlugin({ kind: JSON_QUERY_KEY, name: jsonQueryKind });\n return plugin.getJsonData(definition.spec.plugin.spec, context, signal);\n },\n structuralSharing: false,\n };\n }),\n });\n}\n"],"names":["useQueries","useDatasourceStore","usePluginRegistry","useVariableValues","JSON_QUERY_KEY","useJsonQueries","definitions","getPlugin","datasourceStore","variableValues","context","variableState","queries","map","definition","queryKey","jsonQueryKind","spec","plugin","kind","refetchOnMount","refetchOnWindowFocus","refetchOnReconnect","staleTime","Infinity","queryFn","signal","name","getJsonData","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,iBAAiB,QAAQ,iBAAc;AAGhD,OAAO,MAAMC,iBAAiB,YAAY;AAE1C;;;;CAIC,GACD,OAAO,SAASC,eAAeC,WAAkC;IAC/D,MAAM,EAAEC,SAAS,EAAE,GAAGL;IACtB,MAAMM,kBAAkBP;IACxB,MAAMQ,iBAAiBN;IAEvB,MAAMO,UAA4B;QAChCC,eAAeF;QACfD;IACF;IAEA,OAAOR,WAAW;QAChBY,SAASN,YAAYO,GAAG,CAAC,CAACC;YACxB,MAAMC,WAAW;gBAAC;gBAASX;gBAAgBU;gBAAYL;aAAe;YACtE,MAAMO,gBAAgBF,YAAYG,MAAMC,QAAQC;YAChD,OAAO;gBACLJ;gBACAK,gBAAgB;gBAChBC,sBAAsB;gBACtBC,oBAAoB;gBACpBC,WAAWC;gBACXC,SAAS,OAAO,EAAEC,MAAM,EAA4B;oBAClD,MAAMR,SAAS,MAAMX,UAAU;wBAAEY,MAAMf;wBAAgBuB,MAAMX;oBAAc;oBAC3E,OAAOE,OAAOU,WAAW,CAACd,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAEP,SAASgB;gBAClE;gBACAG,mBAAmB;YACrB;QACF;IACF;AACF"}
@@ -1,6 +1,6 @@
1
- import { QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
- import { UseQueryResult } from '@tanstack/react-query';
3
- import { LogQueryResult } from '../model/log-queries';
1
+ import type { QueryDefinition, UnknownSpec } from '@perses-dev/spec';
2
+ import type { UseQueryResult } from '@tanstack/react-query';
3
+ import type { LogQueryResult } from '../model/log-queries';
4
4
  export type LogQueryDefinition<PluginSpec = UnknownSpec> = QueryDefinition<'LogQuery', PluginSpec>;
5
5
  export declare const LOG_QUERY_KEY = "LogQuery";
6
6
  export declare function useLogQueries(definitions: LogQueryDefinition[]): Array<UseQueryResult<LogQueryResult>>;
@@ -1 +1 @@
1
- {"version":3,"file":"log-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/log-queries.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAc,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAMtD,MAAM,MAAM,kBAAkB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AACnG,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC,wBAAgB,aAAa,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAiCtG"}
1
+ {"version":3,"file":"log-queries.d.ts","sourceRoot":"","sources":["../../src/runtime/log-queries.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAM3D,MAAM,MAAM,kBAAkB,CAAC,UAAU,GAAG,WAAW,IAAI,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AACnG,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC,wBAAgB,aAAa,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAsCtG"}
@@ -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();
@@ -46,7 +46,9 @@ export function useLogQueries(definitions) {
46
46
  queryFn: async ({ signal })=>{
47
47
  const plugin = await getPlugin({
48
48
  kind: LOG_QUERY_KEY,
49
- name: logQueryKind
49
+ name: logQueryKind,
50
+ version: definition.spec.plugin.metadata?.version,
51
+ registry: definition.spec.plugin.metadata?.registry
50
52
  });
51
53
  const data = await plugin.getLogData(definition.spec.plugin.spec, context, signal);
52
54
  return data;
@@ -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({\n kind: LOG_QUERY_KEY,\n name: logQueryKind,\n version: definition.spec.plugin.metadata?.version,\n registry: definition.spec.plugin.metadata?.registry,\n });\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","version","metadata","registry","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;wBAC7Be,MAAMlB;wBACN0B,MAAMX;wBACNY,SAASd,WAAWG,IAAI,CAACC,MAAM,CAACW,QAAQ,EAAED;wBAC1CE,UAAUhB,WAAWG,IAAI,CAACC,MAAM,CAACW,QAAQ,EAAEC;oBAC7C;oBACA,MAAMC,OAAO,MAAMb,OAAOc,UAAU,CAAClB,WAAWG,IAAI,CAACC,MAAM,CAACD,IAAI,EAAET,SAASkB;oBAC3E,OAAOK;gBACT;gBAEAE,mBAAmB;YACrB;QACF;IACF;AACF"}
@@ -1,10 +1,9 @@
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, PluginDefinitionMetadata } 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
- listPluginMetadata(pluginTypes: PluginType[]): Promise<PluginMetadataWithModule[]>;
6
+ listPluginMetadata(pluginTypes?: PluginType[]): Promise<PluginMetadataWithModule[]>;
8
7
  defaultPluginKinds?: DefaultPluginKinds;
9
8
  }
10
9
  export declare const PluginRegistryContext: import("react").Context<PluginRegistryContextType | undefined>;
@@ -13,22 +12,36 @@ export declare const PluginRegistryContext: import("react").Context<PluginRegist
13
12
  * be using `usePlugin` or `useListPluginMetadata` instead.
14
13
  */
15
14
  export declare function usePluginRegistry(): PluginRegistryContextType;
16
- type UsePluginOptions<T extends PluginType> = Omit<UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, [string, PluginType | undefined, string]>, 'queryKey' | 'queryFn'>;
15
+ type UsePluginQueryKey = [string, PluginType | undefined, string, string, string];
16
+ type UsePluginOptions<T extends PluginType> = Omit<UseQueryOptions<PluginImplementation<T>, Error, PluginImplementation<T>, UsePluginQueryKey>, 'queryKey' | 'queryFn'> & {
17
+ /** Pin resolution to a specific plugin version. When omitted, the latest available version is used. */
18
+ version?: string;
19
+ /** Pin resolution to a specific plugin registry. */
20
+ registry?: string;
21
+ };
17
22
  /**
18
23
  * Loads a plugin and returns the plugin implementation, along with loading/error state.
24
+ *
25
+ * When `options.version` is provided, the plugin is resolved with an exact version match: if that version is not
26
+ * installed, the query fails instead of silently falling back to the latest available version.
19
27
  */
20
28
  export declare function usePlugin<T extends PluginType>(pluginType: T | undefined, kind: string, options?: UsePluginOptions<T>): UseQueryResult<PluginImplementation<T>, Error>;
21
29
  /**
22
- * Loads a list of plugins and returns the plugin implementation, along with loading/error state.
30
+ * A plugin reference to load, optionally pinned to a specific version/registry.
23
31
  */
24
- export declare function usePlugins<T extends PluginType>(pluginType: T, plugins: Array<{
32
+ export interface UsePluginsItem extends PluginDefinitionMetadata {
25
33
  kind: string;
26
- }>): Array<UseQueryResult<PluginImplementation<T>>>;
34
+ }
35
+ /**
36
+ * Loads a list of plugins and returns the plugin implementation, along with loading/error state.
37
+ */
38
+ export declare function usePlugins<T extends PluginType>(pluginType: T, plugins: UsePluginsItem[]): Array<UseQueryResult<PluginImplementation<T>>>;
27
39
  type UseListPluginMetadataOptions = Omit<UseQueryOptions<PluginMetadataWithModule[], Error, PluginMetadataWithModule[], [string, string[]]>, 'queryKey' | 'queryFn'>;
28
40
  /**
29
- * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
41
+ * Gets a list of plugin metadata for the specified plugin types and returns it, along with loading/error state. When
42
+ * `pluginTypes` is omitted, the metadata of every installed plugin is returned, whatever its type.
30
43
  */
31
- export declare function useListPluginMetadata(pluginTypes: PluginType[], options?: UseListPluginMetadataOptions): UseQueryResult<PluginMetadataWithModule[]>;
44
+ export declare function useListPluginMetadata(pluginTypes?: PluginType[], options?: UseListPluginMetadataOptions): UseQueryResult<PluginMetadataWithModule[]>;
32
45
  export declare function usePluginBuiltinVariableDefinitions(): UseQueryResult<BuiltinVariableDefinition[]>;
33
46
  export {};
34
47
  //# sourceMappingURL=plugin-registry.d.ts.map
@@ -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,uBAAuB,CAAC;AAE9F,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,UAAU,EACV,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACnF,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,eAAO,MAAM,qBAAqB,gEAAkE,CAAC;AAErG;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,yBAAyB,CAM7D;AAGD,KAAK,gBAAgB,CAAC,CAAC,SAAS,UAAU,IAAI,IAAI,CAChD,eAAe,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,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,C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A6BhD;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;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,CAAC,EAAE,UAAU,EAAE,EAC1B,OAAO,CAAC,EAAE,4BAA4B,GACrC,cAAc,CAAC,wBAAwB,EAAE,CAAC,CAQ5C;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
@@ -25,63 +25,99 @@ export const PluginRegistryContext = createContext(undefined);
25
25
  }
26
26
  /**
27
27
  * Loads a plugin and returns the plugin implementation, along with loading/error state.
28
+ *
29
+ * When `options.version` is provided, the plugin is resolved with an exact version match: if that version is not
30
+ * installed, the query fails instead of silently falling back to the latest available version.
28
31
  */ export function usePlugin(pluginType, kind, options) {
32
+ const { version, registry, ...queryOptions } = options ?? {};
29
33
  // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically
30
- options = {
31
- ...options,
32
- enabled: (options?.enabled ?? true) && pluginType !== undefined && kind !== ''
34
+ const useQueryOptions = {
35
+ ...queryOptions,
36
+ enabled: (queryOptions.enabled ?? true) && pluginType !== undefined && kind !== ''
33
37
  };
34
38
  const { getPlugin } = usePluginRegistry();
35
39
  return useQuery({
36
40
  queryKey: [
37
41
  'getPlugin',
38
42
  pluginType,
39
- kind
43
+ kind,
44
+ version ?? '',
45
+ registry ?? ''
40
46
  ],
41
47
  queryFn: ()=>getPlugin({
42
48
  kind: pluginType,
43
- name: kind
49
+ name: kind,
50
+ version,
51
+ registry
44
52
  }),
45
- ...options
53
+ ...useQueryOptions
46
54
  });
47
55
  }
56
+ /**
57
+ * Full identity of a plugin to load. Two definitions pinned to different versions (or registries) of the same kind are
58
+ * distinct plugins and must be loaded independently.
59
+ */ function getUsePluginsItemIdentity(plugin) {
60
+ return `${plugin.kind}:${plugin.version ?? ''}:${plugin.registry ?? ''}`;
61
+ }
48
62
  /**
49
63
  * Loads a list of plugins and returns the plugin implementation, along with loading/error state.
50
64
  */ export function usePlugins(pluginType, plugins) {
51
65
  const { getPlugin } = usePluginRegistry();
52
- // useQueries() does not support queries with duplicate keys, therefore we de-duplicate the plugin kinds before running useQueries()
66
+ // useQueries() does not support queries with duplicate keys, therefore we de-duplicate the plugins before running useQueries()
53
67
  // This resolves the following warning in the JS console: "[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."
54
68
  // https://github.com/TanStack/query/issues/8224#issuecomment-2523554831
55
69
  // https://github.com/TanStack/query/issues/4187#issuecomment-1256336901
56
- const kinds = [
57
- ...new Set(plugins.map((p)=>p.kind))
70
+ const uniquePlugins = new Map();
71
+ for (const p of plugins){
72
+ const key = getUsePluginsItemIdentity(p);
73
+ if (!uniquePlugins.has(key)) {
74
+ uniquePlugins.set(key, p);
75
+ }
76
+ }
77
+ const uniqueKeys = [
78
+ ...uniquePlugins.keys()
79
+ ];
80
+ const uniqueValues = [
81
+ ...uniquePlugins.values()
58
82
  ];
59
83
  const result = useQueries({
60
- queries: kinds.map((kind)=>{
84
+ queries: uniqueValues.map((p)=>{
61
85
  return {
62
86
  queryKey: [
63
87
  'getPlugin',
64
88
  pluginType,
65
- kind
89
+ p.kind,
90
+ p.version ?? '',
91
+ p.registry ?? ''
66
92
  ],
67
93
  queryFn: ()=>getPlugin({
68
94
  kind: pluginType,
69
- name: kind
95
+ name: p.kind,
96
+ version: p.version,
97
+ registry: p.registry
70
98
  })
71
99
  };
72
100
  })
73
101
  });
74
- // Re-assemble array in original order
75
- return plugins.map((p)=>result[kinds.indexOf(p.kind)]);
102
+ // Re-assemble array in original order. Index lookups go through a Map so this stays linear on large panels.
103
+ const indexByIdentity = new Map(uniqueKeys.map((key, index)=>[
104
+ key,
105
+ index
106
+ ]));
107
+ return plugins.map((p)=>result[indexByIdentity.get(getUsePluginsItemIdentity(p))]);
76
108
  }
77
109
  /**
78
- * Gets a list of plugin metadata for the specified plugin type and returns it, along with loading/error state.
110
+ * Gets a list of plugin metadata for the specified plugin types and returns it, along with loading/error state. When
111
+ * `pluginTypes` is omitted, the metadata of every installed plugin is returned, whatever its type.
79
112
  */ export function useListPluginMetadata(pluginTypes, options) {
80
113
  const { listPluginMetadata } = usePluginRegistry();
81
114
  return useQuery({
115
+ // `['*']` marks the "every plugin type" query so it gets its own cache entry.
82
116
  queryKey: [
83
117
  'listPluginMetadata',
84
- pluginTypes
118
+ pluginTypes ?? [
119
+ '*'
120
+ ]
85
121
  ],
86
122
  queryFn: ()=>listPluginMetadata(pluginTypes),
87
123
  ...options
@@ -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,UAAyB,EACzBC,IAAY,EACZC,OAA6B;IAE7B,wGAAwG;IACxGA,UAAU;QACR,GAAGA,OAAO;QACVC,SAAS,AAACD,CAAAA,SAASC,WAAW,IAAG,KAAMH,eAAeL,aAAaM,SAAS;IAC9E;IACA,MAAM,EAAEG,SAAS,EAAE,GAAGR;IACtB,OAAOL,SAAS;QACdc,UAAU;YAAC;YAAaL;YAAYC;SAAK;QACzCK,SAAS,IAAMF,UAAU;gBAAEH,MAAMD;gBAAaO,MAAMN;YAAK;QACzD,GAAGC,OAAO;IACZ;AACF;AAEA;;CAEC,GACD,OAAO,SAASM,WACdR,UAAa,EACbS,OAAgC;IAEhC,MAAM,EAAEL,SAAS,EAAE,GAAGR;IAEtB,oIAAoI;IACpI,iJAAiJ;IACjJ,wEAAwE;IACxE,wEAAwE;IACxE,MAAMc,QAAQ;WAAI,IAAIC,IAAIF,QA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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, PluginDefinitionMetadata } 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\ntype UsePluginQueryKey = [string, PluginType | undefined, string, string, string];\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>, UsePluginQueryKey>,\n 'queryKey' | 'queryFn'\n> & {\n /** Pin resolution to a specific plugin version. When omitted, the latest available version is used. */\n version?: string;\n /** Pin resolution to a specific plugin registry. */\n registry?: string;\n};\n\n/**\n * Loads a plugin and returns the plugin implementation, along with loading/error state.\n *\n * When `options.version` is provided, the plugin is resolved with an exact version match: if that version is not\n * installed, the query fails instead of silently falling back to the latest available version.\n */\nexport function usePlugin<T extends PluginType>(\n pluginType: T | undefined,\n kind: string,\n options?: UsePluginOptions<T>,\n): UseQueryResult<PluginImplementation<T>, Error> {\n const { version, registry, ...queryOptions } = options ?? {};\n // We never want to ask for a plugin when the kind isn't set yet, so disable those queries automatically\n const useQueryOptions = {\n ...queryOptions,\n enabled: (queryOptions.enabled ?? true) && pluginType !== undefined && kind !== '',\n };\n const { getPlugin } = usePluginRegistry();\n return useQuery({\n queryKey: ['getPlugin', pluginType, kind, version ?? '', registry ?? ''],\n queryFn: () => getPlugin({ kind: pluginType!, name: kind, version, registry }),\n ...useQueryOptions,\n });\n}\n\n/**\n * A plugin reference to load, optionally pinned to a specific version/registry.\n */\nexport interface UsePluginsItem extends PluginDefinitionMetadata {\n kind: string;\n}\n\n/**\n * Full identity of a plugin to load. Two definitions pinned to different versions (or registries) of the same kind are\n * distinct plugins and must be loaded independently.\n */\nfunction getUsePluginsItemIdentity(plugin: UsePluginsItem): string {\n return `${plugin.kind}:${plugin.version ?? ''}:${plugin.registry ?? ''}`;\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: UsePluginsItem[],\n): Array<UseQueryResult<PluginImplementation<T>>> {\n const { getPlugin } = usePluginRegistry();\n\n // useQueries() does not support queries with duplicate keys, therefore we de-duplicate the plugins 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 uniquePlugins = new Map<string, UsePluginsItem>();\n for (const p of plugins) {\n const key = getUsePluginsItemIdentity(p);\n if (!uniquePlugins.has(key)) {\n uniquePlugins.set(key, p);\n }\n }\n const uniqueKeys = [...uniquePlugins.keys()];\n const uniqueValues = [...uniquePlugins.values()];\n\n const result: Array<UseQueryResult<PluginImplementation<T>>> = useQueries({\n queries: uniqueValues.map((p) => {\n return {\n queryKey: ['getPlugin', pluginType, p.kind, p.version ?? '', p.registry ?? ''],\n queryFn: () => getPlugin({ kind: pluginType, name: p.kind, version: p.version, registry: p.registry }),\n };\n }),\n });\n\n // Re-assemble array in original order. Index lookups go through a Map so this stays linear on large panels.\n const indexByIdentity = new Map(uniqueKeys.map((key, index) => [key, index]));\n return plugins.map((p) => result[indexByIdentity.get(getUsePluginsItemIdentity(p))!]!);\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 types and returns it, along with loading/error state. When\n * `pluginTypes` is omitted, the metadata of every installed plugin is returned, whatever its type.\n */\nexport function useListPluginMetadata(\n pluginTypes?: PluginType[],\n options?: UseListPluginMetadataOptions,\n): UseQueryResult<PluginMetadataWithModule[]> {\n const { listPluginMetadata } = usePluginRegistry();\n return useQuery({\n // `['*']` marks the \"every plugin type\" query so it gets its own cache entry.\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","version","registry","queryOptions","useQueryOptions","enabled","getPlugin","queryKey","queryFn","name","getUsePluginsItemIdentity","plugin","usePlugins","plugins","uniquePlugins","Map","p","key","has","set","uniqueKeys","keys","uniqueValues","values","result","queries","map","indexByIdentity","index","get","useListPluginMetadata","pluginTypes","listPluginMetadata","usePluginBuiltinVariableDefinitions","datasources","datasourceNames","Set","datasource","spec","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;AAIjC,SAASA,UAAU,EAAEC,QAAQ,QAAQ,wBAAwB;AAC7D,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAgBlD,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;AAeA;;;;;CAKC,GACD,OAAO,SAASE,UACdC,UAAyB,EACzBC,IAAY,EACZC,OAA6B;IAE7B,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGC,cAAc,GAAGH,WAAW,CAAC;IAC3D,wGAAwG;IACxG,MAAMI,kBAAkB;QACtB,GAAGD,YAAY;QACfE,SAAS,AAACF,CAAAA,aAAaE,OAAO,IAAI,IAAG,KAAMP,eAAeL,aAAaM,SAAS;IAClF;IACA,MAAM,EAAEO,SAAS,EAAE,GAAGZ;IACtB,OAAOL,SAAS;QACdkB,UAAU;YAAC;YAAaT;YAAYC;YAAME,WAAW;Y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,IAAMQ,MAAM,CAACG,gBAAgBE,GAAG,CAACnB,0BAA0BM,IAAK;AACtF;AAQA;;;CAGC,GACD,OAAO,SAASc,sBACdC,WAA0B,EAC1B/B,OAAsC;IAEtC,MAAM,EAAEgC,kBAAkB,EAAE,GAAGtC;IAC/B,OAAOL,SAAS;QACd,8EAA8E;QAC9EkB,UAAU;YAAC;YAAsBwB,eAAe;gBAAC;aAAI;SAAC;QACtDvB,SAAS,IAAMwB,mBAAmBD;QAClC,GAAG/B,OAAO;IACZ;AACF;AAEA,OAAO,SAASiC;IACd,MAAM,EAAE3B,SAAS,EAAE0B,kBAAkB,EAAE,GAAGtC;IAE1C,OAAOL,SAAS;QACdkB,UAAU;YAAC;SAAsC;QACjDC,SAAS;YACP,MAAM0B,cAAc,MAAMF,mBAAmB;gBAAC;aAAa;YAC3D,MAAMG,kBAAkB,IAAIC,IAAIF,YAAYR,GAAG,CAAC,CAACW,aAAeA,WAAWC,IAAI,CAAC7B,IAAI;YACpF,MAAMe,SAAsC,EAAE;YAC9C,KAAK,MAAMf,QAAQ0B,gBAAiB;gBAClC,MAAMxB,SAAS,MAAML,UAAU;oBAAEP,MAAM;oBAAcU;gBAAK;gBAC1D,IAAIE,OAAO4B,6BAA6B,EAAE;oBACxC5B,OAAO4B,6BAA6B,GAAGC,OAAO,CAAC,CAACC,aAAejB,OAAOkB,IAAI,CAACD;gBAC7E;YACF;YACA,OAAOjB;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
  /**