@perses-dev/victorialogs-plugin 0.1.0

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 (294) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/1580.d3010b86.css +1 -0
  4. package/__mf/css/async/2341.d3010b86.css +1 -0
  5. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  6. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  7. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  8. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  9. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  10. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  11. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  12. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  13. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  17. package/__mf/js/VictoriaLogs.9a08c902.js +5 -0
  18. package/__mf/js/async/158.c35084cf.js +10 -0
  19. package/__mf/js/async/158.c35084cf.js.LICENSE.txt +17 -0
  20. package/__mf/js/async/1580.ace454a9.js +2 -0
  21. package/__mf/js/async/1580.ace454a9.js.LICENSE.txt +9 -0
  22. package/__mf/js/async/1964.6d84f735.js +2 -0
  23. package/__mf/js/async/1964.6d84f735.js.LICENSE.txt +9 -0
  24. package/__mf/js/async/2178.d1785908.js +2 -0
  25. package/__mf/js/async/2178.d1785908.js.LICENSE.txt +15 -0
  26. package/__mf/js/async/2292.0696771a.js +2 -0
  27. package/__mf/js/async/2292.0696771a.js.LICENSE.txt +24 -0
  28. package/__mf/js/async/2472.3c37aa71.js +22 -0
  29. package/__mf/js/async/2472.3c37aa71.js.LICENSE.txt +19 -0
  30. package/__mf/js/async/2558.beff8442.js +101 -0
  31. package/__mf/js/async/2708.c79893a7.js +1 -0
  32. package/__mf/js/async/3224.858fb6d6.js +1 -0
  33. package/__mf/js/async/3431.358ac817.js +1 -0
  34. package/__mf/js/async/3863.66f8659b.js +2 -0
  35. package/__mf/js/async/3863.66f8659b.js.LICENSE.txt +9 -0
  36. package/__mf/js/async/3960.bbacac1d.js +2 -0
  37. package/__mf/js/async/3960.bbacac1d.js.LICENSE.txt +8 -0
  38. package/__mf/js/async/3980.03396afa.js +2 -0
  39. package/__mf/js/async/3980.03396afa.js.LICENSE.txt +9 -0
  40. package/__mf/js/async/4075.8aae8af4.js +1 -0
  41. package/__mf/js/async/4238.cd5e3d1f.js +1 -0
  42. package/__mf/js/async/4269.f9191848.js +2 -0
  43. package/__mf/js/async/4269.f9191848.js.LICENSE.txt +9 -0
  44. package/__mf/js/async/4310.b6c0f250.js +7 -0
  45. package/__mf/js/async/4310.b6c0f250.js.LICENSE.txt +21 -0
  46. package/__mf/js/async/4421.c442f6d9.js +1 -0
  47. package/__mf/js/async/5214.bcb7530e.js +1 -0
  48. package/__mf/js/async/5348.aa77f629.js +2 -0
  49. package/__mf/js/async/5348.aa77f629.js.LICENSE.txt +9 -0
  50. package/__mf/js/async/5388.92f525c5.js +1 -0
  51. package/__mf/js/async/5409.5d25f1db.js +1 -0
  52. package/__mf/js/async/5628.f229b9f6.js +1 -0
  53. package/__mf/js/async/5682.a317ee96.js +1 -0
  54. package/__mf/js/async/5790.f7a41a40.js +1 -0
  55. package/__mf/js/async/5981.e54ec80b.js +2 -0
  56. package/__mf/js/async/5981.e54ec80b.js.LICENSE.txt +8 -0
  57. package/__mf/js/async/6134.6f58094d.js +38 -0
  58. package/__mf/js/async/6292.fda8a9af.js +1 -0
  59. package/__mf/js/async/6333.031c68b4.js +2 -0
  60. package/__mf/js/async/6333.031c68b4.js.LICENSE.txt +9 -0
  61. package/__mf/js/async/6374.e9650306.js +1 -0
  62. package/__mf/js/async/6377.e48abaa5.js +2 -0
  63. package/__mf/js/async/6377.e48abaa5.js.LICENSE.txt +32 -0
  64. package/__mf/js/async/6620.4f2fc96e.js +2 -0
  65. package/__mf/js/async/6620.4f2fc96e.js.LICENSE.txt +21 -0
  66. package/__mf/js/async/6770.5c90a318.js +1 -0
  67. package/__mf/js/async/694.663f3faf.js +1 -0
  68. package/__mf/js/async/7376.91743064.js +1 -0
  69. package/__mf/js/async/738.b4e8c361.js +1 -0
  70. package/__mf/js/async/7740.82b38509.js +1 -0
  71. package/__mf/js/async/8216.3417496f.js +1 -0
  72. package/__mf/js/async/8488.9eb8e6dc.js +1 -0
  73. package/__mf/js/async/8537.a7ed2e24.js +1 -0
  74. package/__mf/js/async/8727.e54ca5fd.js +1 -0
  75. package/__mf/js/async/8930.fa15926d.js +1 -0
  76. package/__mf/js/async/9173.d784dd69.js +2 -0
  77. package/__mf/js/async/9173.d784dd69.js.LICENSE.txt +19 -0
  78. package/__mf/js/async/9563.b88ff7ff.js +2 -0
  79. package/__mf/js/async/9563.b88ff7ff.js.LICENSE.txt +9 -0
  80. package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.807e09ec.js +2 -0
  81. package/__mf/js/async/__federation_expose_VictoriaLogsDatasource.807e09ec.js.LICENSE.txt +9 -0
  82. package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.94ae15a7.js +2 -0
  83. package/__mf/js/async/__federation_expose_VictoriaLogsFieldNamesVariable.94ae15a7.js.LICENSE.txt +9 -0
  84. package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.eabc284b.js +2 -0
  85. package/__mf/js/async/__federation_expose_VictoriaLogsFieldValuesVariable.eabc284b.js.LICENSE.txt +9 -0
  86. package/__mf/js/async/__federation_expose_VictoriaLogsLogQuery.8122cbeb.js +1 -0
  87. package/__mf/js/async/__federation_expose_VictoriaLogsTimeSeriesQuery.56dd4cab.js +1 -0
  88. package/__mf/js/main.9f62e593.js +5 -0
  89. package/lib/bootstrap.d.ts +2 -0
  90. package/lib/bootstrap.d.ts.map +1 -0
  91. package/lib/bootstrap.js +7 -0
  92. package/lib/bootstrap.js.map +1 -0
  93. package/lib/cjs/bootstrap.js +14 -0
  94. package/lib/cjs/components/index.js +23 -0
  95. package/lib/cjs/components/logsql-editor.js +110 -0
  96. package/lib/cjs/components/logsql-extension.js +55 -0
  97. package/lib/cjs/components/logsql-highlight.js +40 -0
  98. package/lib/cjs/datasources/index.js +30 -0
  99. package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +61 -0
  100. package/lib/cjs/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +95 -0
  101. package/lib/cjs/datasources/victorialogs-datasource/index.js +32 -0
  102. package/lib/cjs/datasources/victorialogs-datasource/types.js +16 -0
  103. package/lib/cjs/env.d.js +2 -0
  104. package/lib/cjs/getPluginModule.js +27 -0
  105. package/lib/cjs/index-federation.js +43 -0
  106. package/lib/cjs/index.js +27 -0
  107. package/lib/cjs/model/client.js +156 -0
  108. package/lib/cjs/model/index.js +32 -0
  109. package/lib/cjs/model/selectors.js +47 -0
  110. package/lib/cjs/model/types.js +16 -0
  111. package/lib/cjs/queries/constants.js +22 -0
  112. package/lib/cjs/queries/index.js +31 -0
  113. package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +31 -0
  114. package/lib/cjs/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +118 -0
  115. package/lib/cjs/queries/victorialogs-log-query/index.js +21 -0
  116. package/lib/cjs/queries/victorialogs-log-query/interface.js +4 -0
  117. package/lib/cjs/queries/victorialogs-log-query/query.js +61 -0
  118. package/lib/cjs/queries/victorialogs-log-query/types.js +4 -0
  119. package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +43 -0
  120. package/lib/cjs/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +116 -0
  121. package/lib/cjs/queries/victorialogs-time-series-query/index.js +33 -0
  122. package/lib/cjs/queries/victorialogs-time-series-query/query.js +122 -0
  123. package/lib/cjs/queries/victorialogs-time-series-query/types.js +16 -0
  124. package/lib/cjs/setup-tests.js +7 -0
  125. package/lib/cjs/variables/index.js +31 -0
  126. package/lib/cjs/variables/types.js +4 -0
  127. package/lib/cjs/variables/utils.js +85 -0
  128. package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +45 -0
  129. package/lib/cjs/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +89 -0
  130. package/lib/cjs/variables/victorialogs-field-names/index.js +30 -0
  131. package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +49 -0
  132. package/lib/cjs/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +130 -0
  133. package/lib/cjs/variables/victorialogs-field-values/index.js +30 -0
  134. package/lib/components/index.d.ts +3 -0
  135. package/lib/components/index.d.ts.map +1 -0
  136. package/lib/components/index.js +15 -0
  137. package/lib/components/index.js.map +1 -0
  138. package/lib/components/logsql-editor.d.ts +5 -0
  139. package/lib/components/logsql-editor.d.ts.map +1 -0
  140. package/lib/components/logsql-editor.js +61 -0
  141. package/lib/components/logsql-editor.js.map +1 -0
  142. package/lib/components/logsql-extension.d.ts +4 -0
  143. package/lib/components/logsql-extension.d.ts.map +1 -0
  144. package/lib/components/logsql-extension.js +47 -0
  145. package/lib/components/logsql-extension.js.map +1 -0
  146. package/lib/components/logsql-highlight.d.ts +2 -0
  147. package/lib/components/logsql-highlight.d.ts.map +1 -0
  148. package/lib/components/logsql-highlight.js +32 -0
  149. package/lib/components/logsql-highlight.js.map +1 -0
  150. package/lib/datasources/index.d.ts +2 -0
  151. package/lib/datasources/index.d.ts.map +1 -0
  152. package/lib/datasources/index.js +15 -0
  153. package/lib/datasources/index.js.map +1 -0
  154. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts +5 -0
  155. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.d.ts.map +1 -0
  156. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js +53 -0
  157. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasource.js.map +1 -0
  158. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts +9 -0
  159. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.d.ts.map +1 -0
  160. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js +87 -0
  161. package/lib/datasources/victorialogs-datasource/VictoriaLogsDatasourceEditor.js.map +1 -0
  162. package/lib/datasources/victorialogs-datasource/index.d.ts +4 -0
  163. package/lib/datasources/victorialogs-datasource/index.d.ts.map +1 -0
  164. package/lib/datasources/victorialogs-datasource/index.js +17 -0
  165. package/lib/datasources/victorialogs-datasource/index.js.map +1 -0
  166. package/lib/datasources/victorialogs-datasource/types.d.ts +6 -0
  167. package/lib/datasources/victorialogs-datasource/types.d.ts.map +1 -0
  168. package/lib/datasources/victorialogs-datasource/types.js +15 -0
  169. package/lib/datasources/victorialogs-datasource/types.js.map +1 -0
  170. package/lib/env.d.js +3 -0
  171. package/lib/env.d.js.map +1 -0
  172. package/lib/getPluginModule.d.ts +6 -0
  173. package/lib/getPluginModule.d.ts.map +1 -0
  174. package/lib/getPluginModule.js +16 -0
  175. package/lib/getPluginModule.js.map +1 -0
  176. package/lib/index-federation.d.ts +1 -0
  177. package/lib/index-federation.d.ts.map +1 -0
  178. package/lib/index-federation.js +3 -0
  179. package/lib/index-federation.js.map +1 -0
  180. package/lib/index.d.ts +5 -0
  181. package/lib/index.d.ts.map +1 -0
  182. package/lib/index.js +6 -0
  183. package/lib/index.js.map +1 -0
  184. package/lib/model/client.d.ts +39 -0
  185. package/lib/model/client.d.ts.map +1 -0
  186. package/lib/model/client.js +134 -0
  187. package/lib/model/client.js.map +1 -0
  188. package/lib/model/index.d.ts +4 -0
  189. package/lib/model/index.d.ts.map +1 -0
  190. package/lib/model/index.js +17 -0
  191. package/lib/model/index.js.map +1 -0
  192. package/lib/model/selectors.d.ts +10 -0
  193. package/lib/model/selectors.d.ts.map +1 -0
  194. package/lib/model/selectors.js +25 -0
  195. package/lib/model/selectors.js.map +1 -0
  196. package/lib/model/types.d.ts +44 -0
  197. package/lib/model/types.d.ts.map +1 -0
  198. package/lib/model/types.js +15 -0
  199. package/lib/model/types.js.map +1 -0
  200. package/lib/queries/constants.d.ts +5 -0
  201. package/lib/queries/constants.d.ts.map +1 -0
  202. package/lib/queries/constants.js +6 -0
  203. package/lib/queries/constants.js.map +1 -0
  204. package/lib/queries/index.d.ts +3 -0
  205. package/lib/queries/index.d.ts.map +1 -0
  206. package/lib/queries/index.js +16 -0
  207. package/lib/queries/index.js.map +1 -0
  208. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts +4 -0
  209. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.d.ts.map +1 -0
  210. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js +23 -0
  211. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQuery.js.map +1 -0
  212. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts +7 -0
  213. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.d.ts.map +1 -0
  214. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js +110 -0
  215. package/lib/queries/victorialogs-log-query/VictoriaLogsLogQueryEditor.js.map +1 -0
  216. package/lib/queries/victorialogs-log-query/index.d.ts +5 -0
  217. package/lib/queries/victorialogs-log-query/index.d.ts.map +1 -0
  218. package/lib/queries/victorialogs-log-query/index.js +6 -0
  219. package/lib/queries/victorialogs-log-query/index.js.map +1 -0
  220. package/lib/queries/victorialogs-log-query/interface.d.ts +24 -0
  221. package/lib/queries/victorialogs-log-query/interface.d.ts.map +1 -0
  222. package/lib/queries/victorialogs-log-query/interface.js +3 -0
  223. package/lib/queries/victorialogs-log-query/interface.js.map +1 -0
  224. package/lib/queries/victorialogs-log-query/query.d.ts +4 -0
  225. package/lib/queries/victorialogs-log-query/query.d.ts.map +1 -0
  226. package/lib/queries/victorialogs-log-query/query.js +53 -0
  227. package/lib/queries/victorialogs-log-query/query.js.map +1 -0
  228. package/lib/queries/victorialogs-log-query/types.d.ts +6 -0
  229. package/lib/queries/victorialogs-log-query/types.d.ts.map +1 -0
  230. package/lib/queries/victorialogs-log-query/types.js +3 -0
  231. package/lib/queries/victorialogs-log-query/types.js.map +1 -0
  232. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts +4 -0
  233. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.d.ts.map +1 -0
  234. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js +35 -0
  235. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQuery.js.map +1 -0
  236. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts +7 -0
  237. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.d.ts.map +1 -0
  238. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js +108 -0
  239. package/lib/queries/victorialogs-time-series-query/VictoriaLogsTimeSeriesQueryEditor.js.map +1 -0
  240. package/lib/queries/victorialogs-time-series-query/index.d.ts +5 -0
  241. package/lib/queries/victorialogs-time-series-query/index.d.ts.map +1 -0
  242. package/lib/queries/victorialogs-time-series-query/index.js +18 -0
  243. package/lib/queries/victorialogs-time-series-query/index.js.map +1 -0
  244. package/lib/queries/victorialogs-time-series-query/query.d.ts +12 -0
  245. package/lib/queries/victorialogs-time-series-query/query.d.ts.map +1 -0
  246. package/lib/queries/victorialogs-time-series-query/query.js +114 -0
  247. package/lib/queries/victorialogs-time-series-query/query.js.map +1 -0
  248. package/lib/queries/victorialogs-time-series-query/types.d.ts +7 -0
  249. package/lib/queries/victorialogs-time-series-query/types.d.ts.map +1 -0
  250. package/lib/queries/victorialogs-time-series-query/types.js +15 -0
  251. package/lib/queries/victorialogs-time-series-query/types.js.map +1 -0
  252. package/lib/setup-tests.d.ts +2 -0
  253. package/lib/setup-tests.d.ts.map +1 -0
  254. package/lib/setup-tests.js +5 -0
  255. package/lib/setup-tests.js.map +1 -0
  256. package/lib/variables/index.d.ts +3 -0
  257. package/lib/variables/index.d.ts.map +1 -0
  258. package/lib/variables/index.js +16 -0
  259. package/lib/variables/index.js.map +1 -0
  260. package/lib/variables/types.d.ts +13 -0
  261. package/lib/variables/types.d.ts.map +1 -0
  262. package/lib/variables/types.js +3 -0
  263. package/lib/variables/types.js.map +1 -0
  264. package/lib/variables/utils.d.ts +12 -0
  265. package/lib/variables/utils.d.ts.map +1 -0
  266. package/lib/variables/utils.js +63 -0
  267. package/lib/variables/utils.js.map +1 -0
  268. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts +4 -0
  269. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.d.ts.map +1 -0
  270. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js +37 -0
  271. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariable.js.map +1 -0
  272. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts +5 -0
  273. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.d.ts.map +1 -0
  274. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js +81 -0
  275. package/lib/variables/victorialogs-field-names/VictoriaLogsFieldNamesVariableEditor.js.map +1 -0
  276. package/lib/variables/victorialogs-field-names/index.d.ts +2 -0
  277. package/lib/variables/victorialogs-field-names/index.d.ts.map +1 -0
  278. package/lib/variables/victorialogs-field-names/index.js +15 -0
  279. package/lib/variables/victorialogs-field-names/index.js.map +1 -0
  280. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts +4 -0
  281. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.d.ts.map +1 -0
  282. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js +41 -0
  283. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariable.js.map +1 -0
  284. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts +5 -0
  285. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.d.ts.map +1 -0
  286. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js +122 -0
  287. package/lib/variables/victorialogs-field-values/VictoriaLogsFieldValuesVariableEditor.js.map +1 -0
  288. package/lib/variables/victorialogs-field-values/index.d.ts +2 -0
  289. package/lib/variables/victorialogs-field-values/index.d.ts.map +1 -0
  290. package/lib/variables/victorialogs-field-values/index.js +15 -0
  291. package/lib/variables/victorialogs-field-values/index.js.map +1 -0
  292. package/mf-manifest.json +556 -0
  293. package/mf-stats.json +614 -0
  294. package/package.json +97 -0
@@ -0,0 +1,118 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "VictoriaLogsLogQueryEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return VictoriaLogsLogQueryEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _pluginsystem = require("@perses-dev/plugin-system");
25
+ const _material = require("@mui/material");
26
+ const _react = require("react");
27
+ const _logsqleditor = require("../../components/logsql-editor");
28
+ const _model = require("../../model");
29
+ const _constants = require("../constants");
30
+ function VictoriaLogsLogQueryEditor(props) {
31
+ const { onChange, value } = props;
32
+ const { datasource } = value;
33
+ const datasourceSelectValue = datasource ?? _constants.DEFAULT_DATASOURCE;
34
+ const selectedDatasource = (0, _pluginsystem.useDatasourceSelectValueToSelector)(datasourceSelectValue, _model.VICTORIALOGS_DATASOURCE_KIND);
35
+ // const { data: client } = useDatasourceClient<VictoriaLogsClient>(selectedDatasource);
36
+ // const victorialogsURL = client?.options.datasourceUrl;
37
+ // Local state for editor value to prevent query_range calls on every keystroke
38
+ const [localQuery, setLocalQuery] = (0, _react.useState)(value.query);
39
+ // Update local state when prop changes
40
+ (0, _react.useEffect)(()=>{
41
+ setLocalQuery(value.query);
42
+ }, [
43
+ value.query
44
+ ]);
45
+ const handleDatasourceChange = (newDatasourceSelection)=>{
46
+ if (!(0, _pluginsystem.isVariableDatasource)(newDatasourceSelection) && newDatasourceSelection.kind === _constants.DATASOURCE_KIND) {
47
+ onChange({
48
+ ...value,
49
+ datasource: newDatasourceSelection
50
+ });
51
+ return;
52
+ }
53
+ throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');
54
+ };
55
+ // Debounced query change handler to prevent excessive query_range calls
56
+ const handleQueryChange = (0, _react.useCallback)((newQuery)=>{
57
+ setLocalQuery(newQuery);
58
+ }, []);
59
+ // Immediate query execution on Enter or blur
60
+ const handleQueryExecute = (0, _react.useCallback)((query)=>{
61
+ onChange({
62
+ ...value,
63
+ query
64
+ });
65
+ }, [
66
+ onChange,
67
+ value
68
+ ]);
69
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
70
+ spacing: 1.5,
71
+ paddingBottom: 1,
72
+ children: [
73
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
74
+ children: [
75
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
76
+ sx: {
77
+ display: 'block',
78
+ marginBottom: '4px',
79
+ fontWeight: 500
80
+ },
81
+ children: "Datasource"
82
+ }),
83
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
84
+ datasourcePluginKind: _constants.DATASOURCE_KIND,
85
+ value: selectedDatasource,
86
+ onChange: handleDatasourceChange,
87
+ label: "VictoriaLogs Datasource",
88
+ notched: true
89
+ })
90
+ ]
91
+ }),
92
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
93
+ children: [
94
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
95
+ sx: {
96
+ display: 'block',
97
+ marginBottom: '4px',
98
+ fontWeight: 500
99
+ },
100
+ children: "LogsQL Query"
101
+ }),
102
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_logsqleditor.LogsQLEditor, {
103
+ value: localQuery,
104
+ onChange: handleQueryChange,
105
+ onBlur: ()=>handleQueryExecute(localQuery),
106
+ onKeyDown: (event)=>{
107
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
108
+ event.preventDefault();
109
+ handleQueryExecute(localQuery);
110
+ }
111
+ },
112
+ placeholder: 'Enter LogsQL query (e.g. {job="mysql"} |= "error")'
113
+ })
114
+ ]
115
+ })
116
+ ]
117
+ });
118
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./query"), exports);
6
+ _export_star(require("./VictoriaLogsLogQuery"), exports);
7
+ _export_star(require("./VictoriaLogsLogQueryEditor"), exports);
8
+ _export_star(require("./types"), exports);
9
+ function _export_star(from, to) {
10
+ Object.keys(from).forEach(function(k) {
11
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
12
+ Object.defineProperty(to, k, {
13
+ enumerable: true,
14
+ get: function() {
15
+ return from[k];
16
+ }
17
+ });
18
+ }
19
+ });
20
+ return from;
21
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getVictoriaLogsLogData", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getVictoriaLogsLogData;
9
+ }
10
+ });
11
+ const _pluginsystem = require("@perses-dev/plugin-system");
12
+ const _constants = require("../constants");
13
+ function convertStreamToLogs(data, defaultTime) {
14
+ const entries = [];
15
+ data.forEach((entry)=>{
16
+ const { _msg, _time, ...labels } = entry;
17
+ const time = !_time && !_msg ? defaultTime : Date.parse(_time);
18
+ entries.push({
19
+ timestamp: Number(time) / 1000,
20
+ line: _msg || "",
21
+ labels: labels
22
+ });
23
+ });
24
+ return {
25
+ entries,
26
+ totalCount: entries.length
27
+ };
28
+ }
29
+ const getVictoriaLogsLogData = async (spec, context)=>{
30
+ if (!spec.query) {
31
+ return {
32
+ logs: {
33
+ entries: [],
34
+ totalCount: 0
35
+ },
36
+ timeRange: {
37
+ start: context.timeRange.start,
38
+ end: context.timeRange.end
39
+ }
40
+ };
41
+ }
42
+ const query = (0, _pluginsystem.replaceVariables)(spec.query, context.variableState);
43
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? _constants.DEFAULT_DATASOURCE);
44
+ const { start, end } = context.timeRange;
45
+ const response = await client.streamQueryRange({
46
+ query,
47
+ start: start.toISOString(),
48
+ end: end.toISOString()
49
+ });
50
+ const logs = convertStreamToLogs(response, end.getTime().toString());
51
+ return {
52
+ logs,
53
+ timeRange: {
54
+ start,
55
+ end
56
+ },
57
+ metadata: {
58
+ executedQueryString: query
59
+ }
60
+ };
61
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,43 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "VictoriaLogsTimeSeriesQuery", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return VictoriaLogsTimeSeriesQuery;
21
+ }
22
+ });
23
+ const _pluginsystem = require("@perses-dev/plugin-system");
24
+ const _query = require("./query");
25
+ const _VictoriaLogsTimeSeriesQueryEditor = require("./VictoriaLogsTimeSeriesQueryEditor");
26
+ const VictoriaLogsTimeSeriesQuery = {
27
+ getTimeSeriesData: _query.getVictoriaLogsTimeSeriesData,
28
+ OptionsEditorComponent: _VictoriaLogsTimeSeriesQueryEditor.VictoriaLogsQueryEditor,
29
+ createInitialOptions: ()=>({
30
+ query: ''
31
+ }),
32
+ dependsOn: (spec)=>{
33
+ const queryVariables = (0, _pluginsystem.parseVariables)(spec.query);
34
+ const allVariables = [
35
+ ...new Set([
36
+ ...queryVariables
37
+ ])
38
+ ];
39
+ return {
40
+ variables: allVariables
41
+ };
42
+ }
43
+ };
@@ -0,0 +1,116 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "VictoriaLogsQueryEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return VictoriaLogsQueryEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _pluginsystem = require("@perses-dev/plugin-system");
25
+ const _material = require("@mui/material");
26
+ const _react = require("react");
27
+ const _logsqleditor = require("../../components/logsql-editor");
28
+ const _model = require("../../model");
29
+ const _constants = require("../constants");
30
+ function VictoriaLogsQueryEditor(props) {
31
+ const { onChange, value } = props;
32
+ const { datasource } = value;
33
+ const datasourceSelectValue = datasource ?? _constants.DEFAULT_DATASOURCE;
34
+ const selectedDatasource = (0, _pluginsystem.useDatasourceSelectValueToSelector)(datasourceSelectValue, _model.VICTORIALOGS_DATASOURCE_KIND);
35
+ // Local state for editor value to prevent query_range calls on every keystroke
36
+ const [localQuery, setLocalQuery] = (0, _react.useState)(value.query);
37
+ // Update local state when prop changes
38
+ (0, _react.useEffect)(()=>{
39
+ setLocalQuery(value.query);
40
+ }, [
41
+ value.query
42
+ ]);
43
+ const handleDatasourceChange = (newDatasourceSelection)=>{
44
+ if (!(0, _pluginsystem.isVariableDatasource)(newDatasourceSelection) && newDatasourceSelection.kind === _constants.DATASOURCE_KIND) {
45
+ onChange({
46
+ ...value,
47
+ datasource: newDatasourceSelection
48
+ });
49
+ return;
50
+ }
51
+ throw new Error('Got unexpected non VictoriaLogsQuery datasource selection');
52
+ };
53
+ // Debounced query change handler to prevent excessive query_range calls
54
+ const handleQueryChange = (0, _react.useCallback)((newQuery)=>{
55
+ setLocalQuery(newQuery);
56
+ }, []);
57
+ // Immediate query execution on Enter or blur
58
+ const handleQueryExecute = (0, _react.useCallback)((query)=>{
59
+ onChange({
60
+ ...value,
61
+ query
62
+ });
63
+ }, [
64
+ onChange,
65
+ value
66
+ ]);
67
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
68
+ spacing: 1.5,
69
+ paddingBottom: 1,
70
+ children: [
71
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
72
+ children: [
73
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
74
+ sx: {
75
+ display: 'block',
76
+ marginBottom: '4px',
77
+ fontWeight: 500
78
+ },
79
+ children: "Datasource"
80
+ }),
81
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.DatasourceSelect, {
82
+ datasourcePluginKind: _constants.DATASOURCE_KIND,
83
+ value: selectedDatasource,
84
+ onChange: handleDatasourceChange,
85
+ label: "VictoriaLogs Datasource",
86
+ notched: true
87
+ })
88
+ ]
89
+ }),
90
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
91
+ children: [
92
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.InputLabel, {
93
+ sx: {
94
+ display: 'block',
95
+ marginBottom: '4px',
96
+ fontWeight: 500
97
+ },
98
+ children: "LogsQL Query"
99
+ }),
100
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_logsqleditor.LogsQLEditor, {
101
+ value: localQuery,
102
+ onChange: handleQueryChange,
103
+ onBlur: ()=>handleQueryExecute(localQuery),
104
+ onKeyDown: (event)=>{
105
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
106
+ event.preventDefault();
107
+ handleQueryExecute(localQuery);
108
+ }
109
+ },
110
+ placeholder: 'Enter LogsQL query (e.g. {job="mysql"} |= "error")'
111
+ })
112
+ ]
113
+ })
114
+ ]
115
+ });
116
+ }
@@ -0,0 +1,33 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./query"), exports);
18
+ _export_star(require("./VictoriaLogsTimeSeriesQuery"), exports);
19
+ _export_star(require("./VictoriaLogsTimeSeriesQueryEditor"), exports);
20
+ _export_star(require("./types"), exports);
21
+ function _export_star(from, to) {
22
+ Object.keys(from).forEach(function(k) {
23
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
24
+ Object.defineProperty(to, k, {
25
+ enumerable: true,
26
+ get: function() {
27
+ return from[k];
28
+ }
29
+ });
30
+ }
31
+ });
32
+ return from;
33
+ }
@@ -0,0 +1,122 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "getVictoriaLogsTimeSeriesData", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return getVictoriaLogsTimeSeriesData;
21
+ }
22
+ });
23
+ const _core = require("@perses-dev/core");
24
+ const _pluginsystem = require("@perses-dev/plugin-system");
25
+ const _datefns = require("date-fns");
26
+ const _constants = require("../constants");
27
+ // Constants for VictoriaLogs step calculation
28
+ const MAX_VICTORIALOGS_DATA_POINTS = 10000; // Similar to Prometheus
29
+ const DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum
30
+ /**
31
+ * Converts a duration string (like "15s", "1m") to seconds
32
+ */ function getDurationStringSeconds(durationString) {
33
+ if (!durationString) return undefined;
34
+ const duration = (0, _core.parseDurationString)(durationString);
35
+ const ms = (0, _datefns.milliseconds)(duration);
36
+ return Math.floor(ms / 1000);
37
+ }
38
+ /**
39
+ * Calculates appropriate step for VictoriaLogs range queries
40
+ */ function getVictoriaLogsRangeStep(startMs, endMs, minStepSeconds = DEFAULT_MIN_STEP_SECONDS, suggestedStepMs = 0) {
41
+ const suggestedStepSeconds = suggestedStepMs / 1000;
42
+ const querySeconds = (endMs - startMs) / 1000;
43
+ let safeStep = querySeconds / MAX_VICTORIALOGS_DATA_POINTS;
44
+ if (safeStep > 1) {
45
+ safeStep = Math.ceil(safeStep);
46
+ }
47
+ return Math.max(suggestedStepSeconds, minStepSeconds, safeStep);
48
+ }
49
+ /**
50
+ * Formats step in seconds as a duration string for VictoriaLogs API
51
+ */ function formatStepForVictoriaLogs(stepSeconds) {
52
+ if (stepSeconds < 60) {
53
+ return `${Math.round(stepSeconds)}s`;
54
+ } else if (stepSeconds < 3600) {
55
+ return `${Math.round(stepSeconds / 60)}m`;
56
+ } else {
57
+ return `${Math.round(stepSeconds / 3600)}h`;
58
+ }
59
+ }
60
+ function convertMatrixToTimeSeries(matrix) {
61
+ return matrix.map((series)=>{
62
+ const { _stream, ...labels } = series.metric;
63
+ if (_stream) {
64
+ const match = _stream.match(/{([^}]+)}/);
65
+ if (match && match[1]) {
66
+ const labelsStr = match[1].split(',').forEach((labelPair)=>{
67
+ const [key, val] = labelPair.split('=').map((s)=>s.trim().replace(/^"|"$/g, ''));
68
+ if (key && val) labels[key] = val;
69
+ });
70
+ }
71
+ }
72
+ const name = Object.entries(labels).map(([k, v])=>`${k}=${v}`).join(', ');
73
+ return {
74
+ name: name,
75
+ values: series.values.map(([timestamp, value])=>[
76
+ Number(timestamp) * 1000,
77
+ Number(value)
78
+ ]),
79
+ labels
80
+ };
81
+ });
82
+ }
83
+ const getVictoriaLogsTimeSeriesData = async (spec, context)=>{
84
+ if (!spec.query) {
85
+ return {
86
+ series: [],
87
+ timeRange: {
88
+ start: context.timeRange.start,
89
+ end: context.timeRange.end
90
+ },
91
+ stepMs: DEFAULT_MIN_STEP_SECONDS * 1000
92
+ };
93
+ }
94
+ const query = (0, _pluginsystem.replaceVariables)(spec.query, context.variableState);
95
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? _constants.DEFAULT_DATASOURCE);
96
+ const { start, end } = context.timeRange;
97
+ const minStepSeconds = spec.step ? getDurationStringSeconds(spec.step) ?? DEFAULT_MIN_STEP_SECONDS : DEFAULT_MIN_STEP_SECONDS;
98
+ const stepSeconds = getVictoriaLogsRangeStep(start.getTime(), end.getTime(), minStepSeconds, context.suggestedStepMs);
99
+ const stepString = formatStepForVictoriaLogs(stepSeconds);
100
+ const stepMs = stepSeconds * 1000;
101
+ const response = await client.statsQueryRange({
102
+ query,
103
+ step: stepString,
104
+ start: start.toISOString(),
105
+ end: end.toISOString()
106
+ });
107
+ if (response.status === 'error') {
108
+ throw new Error(response.error);
109
+ }
110
+ const series = convertMatrixToTimeSeries(response.data.result);
111
+ return {
112
+ series: series,
113
+ timeRange: {
114
+ start,
115
+ end
116
+ },
117
+ stepMs,
118
+ metadata: {
119
+ executedQueryString: query
120
+ }
121
+ };
122
+ };
@@ -0,0 +1,16 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ require("@testing-library/jest-dom");
6
+ // Always mock e-charts during tests since we don't have a proper canvas in jsdom
7
+ jest.mock('echarts/core');
@@ -0,0 +1,31 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ _export_star(require("./victorialogs-field-names"), exports);
18
+ _export_star(require("./victorialogs-field-values"), exports);
19
+ function _export_star(from, to) {
20
+ Object.keys(from).forEach(function(k) {
21
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
22
+ Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ }
29
+ });
30
+ return from;
31
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ fieldItemsToVariableOptions: function() {
13
+ return fieldItemsToVariableOptions;
14
+ },
15
+ getVictoriaLogsTimeRange: function() {
16
+ return getVictoriaLogsTimeRange;
17
+ },
18
+ useFieldNames: function() {
19
+ return useFieldNames;
20
+ },
21
+ useFieldValues: function() {
22
+ return useFieldValues;
23
+ }
24
+ });
25
+ const _pluginsystem = require("@perses-dev/plugin-system");
26
+ const _reactquery = require("@tanstack/react-query");
27
+ const fieldItemsToVariableOptions = (values)=>{
28
+ if (!values) return [];
29
+ return values.map((value)=>({
30
+ value: value.value,
31
+ label: value.value
32
+ }));
33
+ };
34
+ function getVictoriaLogsTimeRange(timeRange) {
35
+ const { start, end } = timeRange;
36
+ return {
37
+ start: start.toISOString(),
38
+ end: end.toISOString()
39
+ };
40
+ }
41
+ function useFieldNames(query, datasource) {
42
+ const { absoluteTimeRange: { start, end } } = (0, _pluginsystem.useTimeRange)();
43
+ const { data: client } = (0, _pluginsystem.useDatasourceClient)(datasource);
44
+ const enabled = !!client && !!query;
45
+ return (0, _reactquery.useQuery)({
46
+ enabled: enabled,
47
+ queryKey: [
48
+ 'datasource',
49
+ datasource.name,
50
+ 'query',
51
+ query
52
+ ],
53
+ queryFn: async ()=>{
54
+ return await client.fieldNames({
55
+ start: start.toISOString(),
56
+ end: end.toISOString(),
57
+ query: query
58
+ });
59
+ }
60
+ });
61
+ }
62
+ function useFieldValues(field, query, datasource) {
63
+ const { absoluteTimeRange: { start, end } } = (0, _pluginsystem.useTimeRange)();
64
+ const { data: client } = (0, _pluginsystem.useDatasourceClient)(datasource);
65
+ const enabled = !!client && !!query;
66
+ return (0, _reactquery.useQuery)({
67
+ enabled: enabled,
68
+ queryKey: [
69
+ 'field',
70
+ field,
71
+ 'datasource',
72
+ datasource.name,
73
+ 'query',
74
+ query
75
+ ],
76
+ queryFn: async ()=>{
77
+ return await client.fieldValues({
78
+ query: query,
79
+ field: field,
80
+ start: start.toISOString(),
81
+ end: end.toISOString()
82
+ });
83
+ }
84
+ });
85
+ }