@perses-dev/clickhouse-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 (306) hide show
  1. package/README.md +41 -0
  2. package/__mf/css/async/1580.6b2b0c71.css +1 -0
  3. package/__mf/css/async/2341.6b2b0c71.css +1 -0
  4. package/__mf/css/async/6759.6b2b0c71.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/ClickHouse.99e35ca2.js +5 -0
  18. package/__mf/js/async/1580.5bd6ed40.js +2 -0
  19. package/__mf/js/async/1580.5bd6ed40.js.LICENSE.txt +9 -0
  20. package/__mf/js/async/1964.dccce52b.js +2 -0
  21. package/__mf/js/async/1964.dccce52b.js.LICENSE.txt +9 -0
  22. package/__mf/js/async/2114.27f707a0.js +1 -0
  23. package/__mf/js/async/2292.248bd1ea.js +2 -0
  24. package/__mf/js/async/2292.248bd1ea.js.LICENSE.txt +24 -0
  25. package/__mf/js/async/2417.1f135170.js +2 -0
  26. package/__mf/js/async/2417.1f135170.js.LICENSE.txt +9 -0
  27. package/__mf/js/async/2448.e42be954.js +10 -0
  28. package/__mf/js/async/2448.e42be954.js.LICENSE.txt +17 -0
  29. package/__mf/js/async/2651.3bdd6b21.js +1 -0
  30. package/__mf/js/async/3224.5735a223.js +1 -0
  31. package/__mf/js/async/3431.54fb88df.js +1 -0
  32. package/__mf/js/async/3632.f88c5ced.js +101 -0
  33. package/__mf/js/async/3863.70d46fa8.js +2 -0
  34. package/__mf/js/async/3863.70d46fa8.js.LICENSE.txt +9 -0
  35. package/__mf/js/async/3960.e0eb27f3.js +2 -0
  36. package/__mf/js/async/3960.e0eb27f3.js.LICENSE.txt +8 -0
  37. package/__mf/js/async/3980.2a6bea70.js +2 -0
  38. package/__mf/js/async/3980.2a6bea70.js.LICENSE.txt +9 -0
  39. package/__mf/js/async/4075.598f1ee5.js +1 -0
  40. package/__mf/js/async/4168.af4fa8b3.js +2 -0
  41. package/__mf/js/async/4238.8c8282dc.js +1 -0
  42. package/__mf/js/async/4269.a389e8c6.js +2 -0
  43. package/__mf/js/async/4269.a389e8c6.js.LICENSE.txt +9 -0
  44. package/__mf/js/async/4368.8468ec0a.js +2 -0
  45. package/__mf/js/async/4368.8468ec0a.js.LICENSE.txt +15 -0
  46. package/__mf/js/async/4421.de18bb66.js +1 -0
  47. package/__mf/js/async/5035.8a983cd3.js +73 -0
  48. package/__mf/js/async/5035.8a983cd3.js.LICENSE.txt +19 -0
  49. package/__mf/js/async/5214.d1943ccc.js +1 -0
  50. package/__mf/js/async/5409.c4876520.js +1 -0
  51. package/__mf/js/async/56.9997e6f8.js +1 -0
  52. package/__mf/js/async/5713.92805154.js +1 -0
  53. package/__mf/js/async/5981.f3abf3c8.js +2 -0
  54. package/__mf/js/async/5981.f3abf3c8.js.LICENSE.txt +8 -0
  55. package/__mf/js/async/6292.4311054b.js +1 -0
  56. package/__mf/js/async/6333.dfeaf029.js +2 -0
  57. package/__mf/js/async/6333.dfeaf029.js.LICENSE.txt +9 -0
  58. package/__mf/js/async/6377.6c8c4e15.js +2 -0
  59. package/__mf/js/async/6377.6c8c4e15.js.LICENSE.txt +32 -0
  60. package/__mf/js/async/6411.3873365b.js +1 -0
  61. package/__mf/js/async/6467.f4e5b898.js +1 -0
  62. package/__mf/js/async/6569.f8ee50db.js +1 -0
  63. package/__mf/js/async/6714.e4b5281a.js +2 -0
  64. package/__mf/js/async/6714.e4b5281a.js.LICENSE.txt +21 -0
  65. package/__mf/js/async/6770.e50c0d08.js +1 -0
  66. package/__mf/js/async/694.c93f9cdf.js +1 -0
  67. package/__mf/js/async/7376.c01a7f82.js +1 -0
  68. package/__mf/js/async/738.0cdf47b4.js +1 -0
  69. package/__mf/js/async/7740.b3df297f.js +1 -0
  70. package/__mf/js/async/8216.44c6334e.js +1 -0
  71. package/__mf/js/async/8465.f4c53fef.js +7 -0
  72. package/__mf/js/async/8465.f4c53fef.js.LICENSE.txt +21 -0
  73. package/__mf/js/async/8488.16a69ea5.js +1 -0
  74. package/__mf/js/async/8709.6d909ac5.js +2 -0
  75. package/__mf/js/async/8709.6d909ac5.js.LICENSE.txt +9 -0
  76. package/__mf/js/async/9173.90ba4f20.js +2 -0
  77. package/__mf/js/async/9173.90ba4f20.js.LICENSE.txt +19 -0
  78. package/__mf/js/async/9654.ab803765.js +37 -0
  79. package/__mf/js/async/__federation_expose_ClickHouseDatasource.1ef730b1.js +2 -0
  80. package/__mf/js/async/__federation_expose_ClickHouseDatasource.1ef730b1.js.LICENSE.txt +9 -0
  81. package/__mf/js/async/__federation_expose_ClickHouseLogQuery.3f312752.js +19 -0
  82. package/__mf/js/async/__federation_expose_ClickHouseTimeSeriesQuery.a3f88e6b.js +19 -0
  83. package/__mf/js/async/__federation_expose_Logs.88d56eeb.js +2 -0
  84. package/__mf/js/async/__federation_expose_Logs.88d56eeb.js.LICENSE.txt +9 -0
  85. package/__mf/js/main.b7c9a660.js +5 -0
  86. package/lib/bootstrap.d.ts +2 -0
  87. package/lib/bootstrap.d.ts.map +1 -0
  88. package/lib/bootstrap.js +19 -0
  89. package/lib/bootstrap.js.map +1 -0
  90. package/lib/cjs/bootstrap.js +26 -0
  91. package/lib/cjs/components/ClickQLEditor.js +72 -0
  92. package/lib/cjs/components/constants.js +41 -0
  93. package/lib/cjs/components/index.js +30 -0
  94. package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasource.js +49 -0
  95. package/lib/cjs/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +51 -0
  96. package/lib/cjs/datasources/click-house-datasource/click-house-datasource-types.js +16 -0
  97. package/lib/cjs/datasources/click-house-datasource/index.js +32 -0
  98. package/lib/cjs/datasources/index.js +30 -0
  99. package/lib/cjs/env.d.js +14 -0
  100. package/lib/cjs/getPluginModule.js +39 -0
  101. package/lib/cjs/index-federation.js +55 -0
  102. package/lib/cjs/index.js +39 -0
  103. package/lib/cjs/model/click-house-client.js +66 -0
  104. package/lib/cjs/model/click-house-data-types.js +16 -0
  105. package/lib/cjs/panels/index.js +30 -0
  106. package/lib/cjs/panels/logs/Logs.js +37 -0
  107. package/lib/cjs/panels/logs/LogsComponent.js +47 -0
  108. package/lib/cjs/panels/logs/LogsSettingsEditor.js +57 -0
  109. package/lib/cjs/panels/logs/components/EmptyLogsState.js +49 -0
  110. package/lib/cjs/panels/logs/components/LogRow/LogDetailsTable.js +71 -0
  111. package/lib/cjs/panels/logs/components/LogRow/LogRow.js +163 -0
  112. package/lib/cjs/panels/logs/components/LogRow/LogTimestamp.js +45 -0
  113. package/lib/cjs/panels/logs/components/LogRow/LogsStyles.js +77 -0
  114. package/lib/cjs/panels/logs/components/LogRow/index.js +37 -0
  115. package/lib/cjs/panels/logs/components/LogsList.js +44 -0
  116. package/lib/cjs/panels/logs/components/VirtualizedLogsList.js +60 -0
  117. package/lib/cjs/panels/logs/components/hooks/useExpandedRows.js +45 -0
  118. package/lib/cjs/panels/logs/index.js +33 -0
  119. package/lib/cjs/panels/logs/logs-types.js +16 -0
  120. package/lib/cjs/queries/click-house-log-query/ClickHouseLogQuery.js +43 -0
  121. package/lib/cjs/queries/click-house-log-query/ClickHouseLogQueryEditor.js +113 -0
  122. package/lib/cjs/queries/click-house-log-query/click-house-log-query-types.js +16 -0
  123. package/lib/cjs/queries/click-house-log-query/get-click-house-log-data.js +89 -0
  124. package/lib/cjs/queries/click-house-log-query/index.js +33 -0
  125. package/lib/cjs/queries/click-house-log-query/log-query-plugin-interface.js +4 -0
  126. package/lib/cjs/queries/click-house-time-series-query/ClickHouseQuery.js +43 -0
  127. package/lib/cjs/queries/click-house-time-series-query/ClickHouseQueryEditor.js +113 -0
  128. package/lib/cjs/queries/click-house-time-series-query/click-house-query-types.js +16 -0
  129. package/lib/cjs/queries/click-house-time-series-query/get-click-house-data.js +69 -0
  130. package/lib/cjs/queries/click-house-time-series-query/index.js +33 -0
  131. package/lib/cjs/queries/constants.js +34 -0
  132. package/lib/cjs/queries/index.js +31 -0
  133. package/lib/cjs/setup-tests.js +19 -0
  134. package/lib/components/ClickQLEditor.d.ts +5 -0
  135. package/lib/components/ClickQLEditor.d.ts.map +1 -0
  136. package/lib/components/ClickQLEditor.js +59 -0
  137. package/lib/components/ClickQLEditor.js.map +1 -0
  138. package/lib/components/constants.d.ts +2 -0
  139. package/lib/components/constants.d.ts.map +1 -0
  140. package/lib/components/constants.js +33 -0
  141. package/lib/components/constants.js.map +1 -0
  142. package/lib/components/index.d.ts +2 -0
  143. package/lib/components/index.d.ts.map +1 -0
  144. package/lib/components/index.js +15 -0
  145. package/lib/components/index.js.map +1 -0
  146. package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts +4 -0
  147. package/lib/datasources/click-house-datasource/ClickHouseDatasource.d.ts.map +1 -0
  148. package/lib/datasources/click-house-datasource/ClickHouseDatasource.js +41 -0
  149. package/lib/datasources/click-house-datasource/ClickHouseDatasource.js.map +1 -0
  150. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts +9 -0
  151. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.d.ts.map +1 -0
  152. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js +43 -0
  153. package/lib/datasources/click-house-datasource/ClickHouseDatasourceEditor.js.map +1 -0
  154. package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts +26 -0
  155. package/lib/datasources/click-house-datasource/click-house-datasource-types.d.ts.map +1 -0
  156. package/lib/datasources/click-house-datasource/click-house-datasource-types.js +15 -0
  157. package/lib/datasources/click-house-datasource/click-house-datasource-types.js.map +1 -0
  158. package/lib/datasources/click-house-datasource/index.d.ts +4 -0
  159. package/lib/datasources/click-house-datasource/index.d.ts.map +1 -0
  160. package/lib/datasources/click-house-datasource/index.js +17 -0
  161. package/lib/datasources/click-house-datasource/index.js.map +1 -0
  162. package/lib/datasources/index.d.ts +2 -0
  163. package/lib/datasources/index.d.ts.map +1 -0
  164. package/lib/datasources/index.js +15 -0
  165. package/lib/datasources/index.js.map +1 -0
  166. package/lib/env.d.js +15 -0
  167. package/lib/env.d.js.map +1 -0
  168. package/lib/getPluginModule.d.ts +6 -0
  169. package/lib/getPluginModule.d.ts.map +1 -0
  170. package/lib/getPluginModule.js +28 -0
  171. package/lib/getPluginModule.js.map +1 -0
  172. package/lib/index-federation.d.ts +1 -0
  173. package/lib/index-federation.d.ts.map +1 -0
  174. package/lib/index-federation.js +15 -0
  175. package/lib/index-federation.js.map +1 -0
  176. package/lib/index.d.ts +5 -0
  177. package/lib/index.d.ts.map +1 -0
  178. package/lib/index.js +18 -0
  179. package/lib/index.js.map +1 -0
  180. package/lib/model/click-house-client.d.ts +22 -0
  181. package/lib/model/click-house-client.d.ts.map +1 -0
  182. package/lib/model/click-house-client.js +58 -0
  183. package/lib/model/click-house-client.js.map +1 -0
  184. package/lib/model/click-house-data-types.d.ts +22 -0
  185. package/lib/model/click-house-data-types.d.ts.map +1 -0
  186. package/lib/model/click-house-data-types.js +15 -0
  187. package/lib/model/click-house-data-types.js.map +1 -0
  188. package/lib/panels/index.d.ts +2 -0
  189. package/lib/panels/index.d.ts.map +1 -0
  190. package/lib/panels/index.js +15 -0
  191. package/lib/panels/index.js.map +1 -0
  192. package/lib/panels/logs/Logs.d.ts +4 -0
  193. package/lib/panels/logs/Logs.d.ts.map +1 -0
  194. package/lib/panels/logs/Logs.js +29 -0
  195. package/lib/panels/logs/Logs.js.map +1 -0
  196. package/lib/panels/logs/LogsComponent.d.ts +4 -0
  197. package/lib/panels/logs/LogsComponent.d.ts.map +1 -0
  198. package/lib/panels/logs/LogsComponent.js +34 -0
  199. package/lib/panels/logs/LogsComponent.js.map +1 -0
  200. package/lib/panels/logs/LogsSettingsEditor.d.ts +7 -0
  201. package/lib/panels/logs/LogsSettingsEditor.d.ts.map +1 -0
  202. package/lib/panels/logs/LogsSettingsEditor.js +49 -0
  203. package/lib/panels/logs/LogsSettingsEditor.js.map +1 -0
  204. package/lib/panels/logs/components/EmptyLogsState.d.ts +7 -0
  205. package/lib/panels/logs/components/EmptyLogsState.d.ts.map +1 -0
  206. package/lib/panels/logs/components/EmptyLogsState.js +36 -0
  207. package/lib/panels/logs/components/EmptyLogsState.js.map +1 -0
  208. package/lib/panels/logs/components/LogRow/LogDetailsTable.d.ts +8 -0
  209. package/lib/panels/logs/components/LogRow/LogDetailsTable.d.ts.map +1 -0
  210. package/lib/panels/logs/components/LogRow/LogDetailsTable.js +58 -0
  211. package/lib/panels/logs/components/LogRow/LogDetailsTable.js.map +1 -0
  212. package/lib/panels/logs/components/LogRow/LogRow.d.ts +14 -0
  213. package/lib/panels/logs/components/LogRow/LogRow.d.ts.map +1 -0
  214. package/lib/panels/logs/components/LogRow/LogRow.js +109 -0
  215. package/lib/panels/logs/components/LogRow/LogRow.js.map +1 -0
  216. package/lib/panels/logs/components/LogRow/LogTimestamp.d.ts +7 -0
  217. package/lib/panels/logs/components/LogRow/LogTimestamp.d.ts.map +1 -0
  218. package/lib/panels/logs/components/LogRow/LogTimestamp.js +32 -0
  219. package/lib/panels/logs/components/LogRow/LogTimestamp.js.map +1 -0
  220. package/lib/panels/logs/components/LogRow/LogsStyles.d.ts +22 -0
  221. package/lib/panels/logs/components/LogRow/LogsStyles.d.ts.map +1 -0
  222. package/lib/panels/logs/components/LogRow/LogsStyles.js +55 -0
  223. package/lib/panels/logs/components/LogRow/LogsStyles.js.map +1 -0
  224. package/lib/panels/logs/components/LogRow/index.d.ts +3 -0
  225. package/lib/panels/logs/components/LogRow/index.d.ts.map +1 -0
  226. package/lib/panels/logs/components/LogRow/index.js +16 -0
  227. package/lib/panels/logs/components/LogRow/index.js.map +1 -0
  228. package/lib/panels/logs/components/LogsList.d.ts +8 -0
  229. package/lib/panels/logs/components/LogsList.d.ts.map +1 -0
  230. package/lib/panels/logs/components/LogsList.js +31 -0
  231. package/lib/panels/logs/components/LogsList.js.map +1 -0
  232. package/lib/panels/logs/components/VirtualizedLogsList.d.ts +10 -0
  233. package/lib/panels/logs/components/VirtualizedLogsList.d.ts.map +1 -0
  234. package/lib/panels/logs/components/VirtualizedLogsList.js +47 -0
  235. package/lib/panels/logs/components/VirtualizedLogsList.js.map +1 -0
  236. package/lib/panels/logs/components/hooks/useExpandedRows.d.ts +6 -0
  237. package/lib/panels/logs/components/hooks/useExpandedRows.d.ts.map +1 -0
  238. package/lib/panels/logs/components/hooks/useExpandedRows.js +37 -0
  239. package/lib/panels/logs/components/hooks/useExpandedRows.js.map +1 -0
  240. package/lib/panels/logs/index.d.ts +5 -0
  241. package/lib/panels/logs/index.d.ts.map +1 -0
  242. package/lib/panels/logs/index.js +18 -0
  243. package/lib/panels/logs/index.js.map +1 -0
  244. package/lib/panels/logs/logs-types.d.ts +16 -0
  245. package/lib/panels/logs/logs-types.d.ts.map +1 -0
  246. package/lib/panels/logs/logs-types.js +15 -0
  247. package/lib/panels/logs/logs-types.js.map +1 -0
  248. package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts +4 -0
  249. package/lib/queries/click-house-log-query/ClickHouseLogQuery.d.ts.map +1 -0
  250. package/lib/queries/click-house-log-query/ClickHouseLogQuery.js +35 -0
  251. package/lib/queries/click-house-log-query/ClickHouseLogQuery.js.map +1 -0
  252. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts +7 -0
  253. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.d.ts.map +1 -0
  254. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js +105 -0
  255. package/lib/queries/click-house-log-query/ClickHouseLogQueryEditor.js.map +1 -0
  256. package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts +6 -0
  257. package/lib/queries/click-house-log-query/click-house-log-query-types.d.ts.map +1 -0
  258. package/lib/queries/click-house-log-query/click-house-log-query-types.js +15 -0
  259. package/lib/queries/click-house-log-query/click-house-log-query-types.js.map +1 -0
  260. package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts +4 -0
  261. package/lib/queries/click-house-log-query/get-click-house-log-data.d.ts.map +1 -0
  262. package/lib/queries/click-house-log-query/get-click-house-log-data.js +81 -0
  263. package/lib/queries/click-house-log-query/get-click-house-log-data.js.map +1 -0
  264. package/lib/queries/click-house-log-query/index.d.ts +5 -0
  265. package/lib/queries/click-house-log-query/index.d.ts.map +1 -0
  266. package/lib/queries/click-house-log-query/index.js +18 -0
  267. package/lib/queries/click-house-log-query/index.js.map +1 -0
  268. package/lib/queries/click-house-log-query/log-query-plugin-interface.d.ts +25 -0
  269. package/lib/queries/click-house-log-query/log-query-plugin-interface.d.ts.map +1 -0
  270. package/lib/queries/click-house-log-query/log-query-plugin-interface.js +3 -0
  271. package/lib/queries/click-house-log-query/log-query-plugin-interface.js.map +1 -0
  272. package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts +4 -0
  273. package/lib/queries/click-house-time-series-query/ClickHouseQuery.d.ts.map +1 -0
  274. package/lib/queries/click-house-time-series-query/ClickHouseQuery.js +35 -0
  275. package/lib/queries/click-house-time-series-query/ClickHouseQuery.js.map +1 -0
  276. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts +7 -0
  277. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.d.ts.map +1 -0
  278. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js +105 -0
  279. package/lib/queries/click-house-time-series-query/ClickHouseQueryEditor.js.map +1 -0
  280. package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts +11 -0
  281. package/lib/queries/click-house-time-series-query/click-house-query-types.d.ts.map +1 -0
  282. package/lib/queries/click-house-time-series-query/click-house-query-types.js +16 -0
  283. package/lib/queries/click-house-time-series-query/click-house-query-types.js.map +1 -0
  284. package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts +4 -0
  285. package/lib/queries/click-house-time-series-query/get-click-house-data.d.ts.map +1 -0
  286. package/lib/queries/click-house-time-series-query/get-click-house-data.js +61 -0
  287. package/lib/queries/click-house-time-series-query/get-click-house-data.js.map +1 -0
  288. package/lib/queries/click-house-time-series-query/index.d.ts +5 -0
  289. package/lib/queries/click-house-time-series-query/index.d.ts.map +1 -0
  290. package/lib/queries/click-house-time-series-query/index.js +18 -0
  291. package/lib/queries/click-house-time-series-query/index.js.map +1 -0
  292. package/lib/queries/constants.d.ts +5 -0
  293. package/lib/queries/constants.d.ts.map +1 -0
  294. package/lib/queries/constants.js +18 -0
  295. package/lib/queries/constants.js.map +1 -0
  296. package/lib/queries/index.d.ts +3 -0
  297. package/lib/queries/index.d.ts.map +1 -0
  298. package/lib/queries/index.js +16 -0
  299. package/lib/queries/index.js.map +1 -0
  300. package/lib/setup-tests.d.ts +2 -0
  301. package/lib/setup-tests.d.ts.map +1 -0
  302. package/lib/setup-tests.js +17 -0
  303. package/lib/setup-tests.js.map +1 -0
  304. package/mf-manifest.json +505 -0
  305. package/mf-stats.json +561 -0
  306. package/package.json +85 -0
@@ -0,0 +1,15 @@
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
+ export { };
14
+
15
+ //# sourceMappingURL=click-house-log-query-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/click-house-log-query-types.ts"],"sourcesContent":["// Copyright 2025 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 { DatasourceSelector } from '@perses-dev/core';\n\nexport interface ClickHouseLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
@@ -0,0 +1,4 @@
1
+ import { ClickHouseLogQuerySpec } from './click-house-log-query-types';
2
+ import { LogQueryPlugin } from './log-query-plugin-interface';
3
+ export declare const getClickHouseLogData: LogQueryPlugin<ClickHouseLogQuerySpec>['getLogData'];
4
+ //# sourceMappingURL=get-click-house-log-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-click-house-log-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAoD9D,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,YAAY,CA6BrF,CAAC"}
@@ -0,0 +1,81 @@
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
+ import { replaceVariables } from '@perses-dev/plugin-system';
14
+ import { DEFAULT_DATASOURCE } from '../constants';
15
+ function flattenObject(obj, parentKey = '', result = {}) {
16
+ for (const [key, value] of Object.entries(obj)){
17
+ const newKey = parentKey ? `${parentKey}.${key}` : key;
18
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
19
+ flattenObject(value, newKey, result);
20
+ } else {
21
+ result[newKey] = value;
22
+ }
23
+ }
24
+ return result;
25
+ }
26
+ function convertStreamsToLogs(streams) {
27
+ const entries = streams.map((entry)=>{
28
+ const flattened = flattenObject(entry);
29
+ if (!flattened.Timestamp && flattened.log_time) {
30
+ flattened.Timestamp = flattened.log_time;
31
+ }
32
+ const sortedEntry = {};
33
+ Object.keys(flattened).sort((a, b)=>a.localeCompare(b)).forEach((key)=>{
34
+ sortedEntry[key] = flattened[key];
35
+ });
36
+ const line = Object.entries(sortedEntry).filter(([key])=>key !== 'Timestamp').map(([key, value])=>`<${key}> ${value === '' || value === null || value === undefined ? '--' : value}`).join(' ');
37
+ return {
38
+ timestamp: sortedEntry?.Timestamp,
39
+ labels: sortedEntry,
40
+ line
41
+ };
42
+ });
43
+ return {
44
+ entries,
45
+ totalCount: entries.length
46
+ };
47
+ }
48
+ export const getClickHouseLogData = async (spec, context)=>{
49
+ if (spec.query === undefined || spec.query === null || spec.query === '') {
50
+ return {
51
+ logs: {
52
+ entries: [],
53
+ totalCount: 0
54
+ },
55
+ timeRange: {
56
+ start: context.timeRange.start,
57
+ end: context.timeRange.end
58
+ }
59
+ };
60
+ }
61
+ const query = replaceVariables(spec.query, context.variableState);
62
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_DATASOURCE);
63
+ const { start, end } = context.timeRange;
64
+ const response = await client.query({
65
+ start: start.getTime().toString(),
66
+ end: end.getTime().toString(),
67
+ query
68
+ });
69
+ return {
70
+ timeRange: {
71
+ start,
72
+ end
73
+ },
74
+ logs: convertStreamsToLogs(response.data),
75
+ metadata: {
76
+ executedQueryString: query
77
+ }
78
+ };
79
+ };
80
+
81
+ //# sourceMappingURL=get-click-house-log-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/get-click-house-log-data.ts"],"sourcesContent":["// Copyright 2025 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 { replaceVariables } from '@perses-dev/plugin-system';\nimport { LogEntry, LogsData } from '../../model/click-house-data-types';\nimport { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\nimport { ClickHouseLogQuerySpec } from './click-house-log-query-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nfunction flattenObject(\n obj: Record<string, any>,\n parentKey = '',\n result: Record<string, any> = {}\n): Record<string, any> {\n for (const [key, value] of Object.entries(obj)) {\n const newKey = parentKey ? `${parentKey}.${key}` : key;\n if (value && typeof value === 'object' && !Array.isArray(value)) {\n flattenObject(value, newKey, result);\n } else {\n result[newKey] = value;\n }\n }\n\n return result;\n}\n\nfunction convertStreamsToLogs(streams: LogEntry[]): LogsData {\n const entries: LogEntry[] = streams.map((entry) => {\n const flattened = flattenObject(entry);\n\n if (!flattened.Timestamp && flattened.log_time) {\n flattened.Timestamp = flattened.log_time;\n }\n\n const sortedEntry: Record<string, any> = {};\n Object.keys(flattened)\n .sort((a, b) => a.localeCompare(b))\n .forEach((key) => {\n sortedEntry[key] = flattened[key];\n });\n\n const line = Object.entries(sortedEntry)\n .filter(([key]) => key !== 'Timestamp')\n .map(([key, value]) => `<${key}> ${value === '' || value === null || value === undefined ? '--' : value}`)\n .join(' ');\n\n return {\n timestamp: sortedEntry?.Timestamp,\n labels: sortedEntry,\n line,\n } as LogEntry;\n });\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getClickHouseLogData: LogQueryPlugin<ClickHouseLogQuerySpec>['getLogData'] = async (spec, context) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n\n const client = (await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as ClickHouseClient;\n\n const { start, end } = context.timeRange;\n\n const response: ClickHouseQueryResponse = await client.query({\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n query,\n });\n\n return {\n timeRange: { start, end },\n logs: convertStreamsToLogs(response.data),\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","flattenObject","obj","parentKey","result","key","value","Object","entries","newKey","Array","isArray","convertStreamsToLogs","streams","map","entry","flattened","Timestamp","log_time","sortedEntry","keys","sort","a","b","localeCompare","forEach","line","filter","undefined","join","timestamp","labels","totalCount","length","getClickHouseLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","data","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,gBAAgB,QAAQ,4BAA4B;AAI7D,SAASC,kBAAkB,QAAQ,eAAe;AAGlD,SAASC,cACPC,GAAwB,EACxBC,YAAY,EAAE,EACdC,SAA8B,CAAC,CAAC;IAEhC,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACN,KAAM;QAC9C,MAAMO,SAASN,YAAY,GAAGA,UAAU,CAAC,EAAEE,KAAK,GAAGA;QACnD,IAAIC,SAAS,OAAOA,UAAU,YAAY,CAACI,MAAMC,OAAO,CAACL,QAAQ;YAC/DL,cAAcK,OAAOG,QAAQL;QAC/B,OAAO;YACLA,MAAM,CAACK,OAAO,GAAGH;QACnB;IACF;IAEA,OAAOF;AACT;AAEA,SAASQ,qBAAqBC,OAAmB;IAC/C,MAAML,UAAsBK,QAAQC,GAAG,CAAC,CAACC;QACvC,MAAMC,YAAYf,cAAcc;QAEhC,IAAI,CAACC,UAAUC,SAAS,IAAID,UAAUE,QAAQ,EAAE;YAC9CF,UAAUC,SAAS,GAAGD,UAAUE,QAAQ;QAC1C;QAEA,MAAMC,cAAmC,CAAC;QAC1CZ,OAAOa,IAAI,CAACJ,WACTK,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEE,aAAa,CAACD,IAC/BE,OAAO,CAAC,CAACpB;YACRc,WAAW,CAACd,IAAI,GAAGW,SAAS,CAACX,IAAI;QACnC;QAEF,MAAMqB,OAAOnB,OAAOC,OAAO,CAACW,aACzBQ,MAAM,CAAC,CAAC,CAACtB,IAAI,GAAKA,QAAQ,aAC1BS,GAAG,CAAC,CAAC,CAACT,KAAKC,MAAM,GAAK,CAAC,CAAC,EAAED,IAAI,EAAE,EAAEC,UAAU,MAAMA,UAAU,QAAQA,UAAUsB,YAAY,OAAOtB,OAAO,EACxGuB,IAAI,CAAC;QAER,OAAO;YACLC,WAAWX,aAAaF;YACxBc,QAAQZ;YACRO;QACF;IACF;IAEA,OAAO;QACLlB;QACAwB,YAAYxB,QAAQyB,MAAM;IAC5B;AACF;AAEA,OAAO,MAAMC,uBAA6E,OAAOC,MAAMC;IACrG,IAAID,KAAKE,KAAK,KAAKT,aAAaO,KAAKE,KAAK,KAAK,QAAQF,KAAKE,KAAK,KAAK,IAAI;QACxE,OAAO;YACLC,MAAM;gBAAE9B,SAAS,EAAE;gBAAEwB,YAAY;YAAE;YACnCO,WAAW;gBAAEC,OAAOJ,QAAQG,SAAS,CAACC,KAAK;gBAAEC,KAAKL,QAAQG,SAAS,CAACE,GAAG;YAAC;QAC1E;IACF;IAEA,MAAMJ,QAAQtC,iBAAiBoC,KAAKE,KAAK,EAAED,QAAQM,aAAa;IAEhE,MAAMC,SAAU,MAAMP,QAAQQ,eAAe,CAACC,mBAAmB,CAC/DV,KAAKW,UAAU,IAAI9C;IAGrB,MAAM,EAAEwC,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IAExC,MAAMQ,WAAoC,MAAMJ,OAAON,KAAK,CAAC;QAC3DG,OAAOA,MAAMQ,OAAO,GAAGC,QAAQ;QAC/BR,KAAKA,IAAIO,OAAO,GAAGC,QAAQ;QAC3BZ;IACF;IAEA,OAAO;QACLE,WAAW;YAAEC;YAAOC;QAAI;QACxBH,MAAM1B,qBAAqBmC,SAASG,IAAI;QACxCC,UAAU;YACRC,qBAAqBf;QACvB;IACF;AACF,EAAE"}
@@ -0,0 +1,5 @@
1
+ export * from './ClickHouseLogQuery';
2
+ export * from './ClickHouseLogQueryEditor';
3
+ export * from './get-click-house-log-data';
4
+ export * from './click-house-log-query-types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,18 @@
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
+ export * from './ClickHouseLogQuery';
14
+ export * from './ClickHouseLogQueryEditor';
15
+ export * from './get-click-house-log-data';
16
+ export * from './click-house-log-query-types';
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/index.ts"],"sourcesContent":["// Copyright 2025 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 './ClickHouseLogQuery';\nexport * from './ClickHouseLogQueryEditor';\nexport * from './get-click-house-log-data';\nexport * from './click-house-log-query-types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,6BAA6B;AAC3C,cAAc,6BAA6B;AAC3C,cAAc,gCAAgC"}
@@ -0,0 +1,25 @@
1
+ import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';
2
+ import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
3
+ import { LogsData } from '../../model/click-house-data-types';
4
+ export interface LogQueryResult {
5
+ logs: LogsData;
6
+ timeRange: AbsoluteTimeRange;
7
+ metadata?: {
8
+ executedQueryString: string;
9
+ };
10
+ }
11
+ export interface ClickHouseQueryContext {
12
+ timeRange: AbsoluteTimeRange;
13
+ variableState: VariableStateMap;
14
+ datasourceStore: DatasourceStore;
15
+ refreshKey: string;
16
+ }
17
+ type LogQueryPluginDependencies = {
18
+ variables?: string[];
19
+ };
20
+ export interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
21
+ getLogData: (spec: Spec, ctx: ClickHouseQueryContext) => Promise<LogQueryResult>;
22
+ dependsOn?: (spec: Spec, ctx: ClickHouseQueryContext) => LogQueryPluginDependencies;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=log-query-plugin-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACjF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,sBAAsB,KAAK,0BAA0B,CAAC;CACrF"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=log-query-plugin-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-log-query/log-query-plugin-interface.ts"],"sourcesContent":["import { AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\nimport { LogsData } from '../../model/click-house-data-types';\n\nexport interface LogQueryResult {\n logs: LogsData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface ClickHouseQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n refreshKey: string;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: ClickHouseQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: ClickHouseQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAuBA,WAGC"}
@@ -0,0 +1,4 @@
1
+ import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
3
+ export declare const ClickHouseTimeSeriesQuery: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>;
4
+ //# sourceMappingURL=ClickHouseQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClickHouseQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAkB,MAAM,2BAA2B,CAAC;AAGlF,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE1E,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAW1F,CAAC"}
@@ -0,0 +1,35 @@
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
+ import { parseVariables } from '@perses-dev/plugin-system';
14
+ import { getTimeSeriesData } from './get-click-house-data';
15
+ import { ClickHouseTimeSeriesQueryEditor } from './ClickHouseQueryEditor';
16
+ export const ClickHouseTimeSeriesQuery = {
17
+ getTimeSeriesData,
18
+ OptionsEditorComponent: ClickHouseTimeSeriesQueryEditor,
19
+ createInitialOptions: ()=>({
20
+ query: ''
21
+ }),
22
+ dependsOn: (spec)=>{
23
+ const queryVariables = parseVariables(spec.query);
24
+ const allVariables = [
25
+ ...new Set([
26
+ ...queryVariables
27
+ ])
28
+ ];
29
+ return {
30
+ variables: allVariables
31
+ };
32
+ }
33
+ };
34
+
35
+ //# sourceMappingURL=ClickHouseQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQuery.tsx"],"sourcesContent":["// Copyright 2025 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 { TimeSeriesQueryPlugin, parseVariables } from '@perses-dev/plugin-system';\nimport { getTimeSeriesData } from './get-click-house-data';\nimport { ClickHouseTimeSeriesQueryEditor } from './ClickHouseQueryEditor';\nimport { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';\n\nexport const ClickHouseTimeSeriesQuery: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n OptionsEditorComponent: ClickHouseTimeSeriesQueryEditor,\n createInitialOptions: () => ({ query: '' }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n const allVariables = [...new Set([...queryVariables])];\n return {\n variables: allVariables,\n };\n },\n};\n"],"names":["parseVariables","getTimeSeriesData","ClickHouseTimeSeriesQueryEditor","ClickHouseTimeSeriesQuery","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","allVariables","Set","variables"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAgCA,cAAc,QAAQ,4BAA4B;AAClF,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,+BAA+B,QAAQ,0BAA0B;AAG1E,OAAO,MAAMC,4BAAkF;IAC7FF;IACAG,wBAAwBF;IACxBG,sBAAsB,IAAO,CAAA;YAAEC,OAAO;QAAG,CAAA;IACzCC,WAAW,CAACC;QACV,MAAMC,iBAAiBT,eAAeQ,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAI;mBAAIF;aAAe;SAAE;QACtD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
@@ -0,0 +1,7 @@
1
+ import { OptionsEditorProps } from '@perses-dev/plugin-system';
2
+ import { ReactElement } from 'react';
3
+ import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
4
+ type ClickHouseTimeSeriesQueryEditorProps = OptionsEditorProps<ClickHouseTimeSeriesQuerySpec>;
5
+ export declare function ClickHouseTimeSeriesQueryEditor(props: ClickHouseTimeSeriesQueryEditorProps): ReactElement;
6
+ export {};
7
+ //# sourceMappingURL=ClickHouseQueryEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClickHouseQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAoC,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAM1E,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CAsEzG"}
@@ -0,0 +1,105 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';
15
+ import { useCallback, useEffect, useState } from 'react';
16
+ import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
17
+ import { ClickQLEditor } from '../../components';
18
+ import { Stack } from '@mui/material';
19
+ import { queryExample } from '../../components/constants';
20
+ export function ClickHouseTimeSeriesQueryEditor(props) {
21
+ const { onChange, value } = props;
22
+ const { datasource } = value;
23
+ const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;
24
+ const [localQuery, setLocalQuery] = useState(value.query || '');
25
+ const handleDatasourceChange = (newDatasourceSelection)=>{
26
+ if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {
27
+ onChange({
28
+ ...value,
29
+ datasource: newDatasourceSelection
30
+ });
31
+ return;
32
+ }
33
+ throw new Error('Got unexpected non ClickHouse datasource selection');
34
+ };
35
+ const handleQueryChange = useCallback((newQuery)=>{
36
+ setLocalQuery(newQuery);
37
+ }, []);
38
+ const handleQueryExecute = useCallback((query)=>{
39
+ onChange({
40
+ ...value,
41
+ query
42
+ });
43
+ }, [
44
+ onChange,
45
+ value
46
+ ]);
47
+ useEffect(()=>{
48
+ setLocalQuery(value.query || '');
49
+ }, [
50
+ value.query
51
+ ]);
52
+ const examplesStyle = {
53
+ fontSize: '11px',
54
+ color: '#777',
55
+ backgroundColor: '#f5f5f5',
56
+ padding: '8px',
57
+ borderRadius: '4px',
58
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
59
+ whiteSpace: 'pre-wrap',
60
+ lineHeight: '1.3'
61
+ };
62
+ return /*#__PURE__*/ _jsxs(Stack, {
63
+ spacing: 1.5,
64
+ children: [
65
+ /*#__PURE__*/ _jsx(DatasourceSelect, {
66
+ datasourcePluginKind: DATASOURCE_KIND,
67
+ value: selectedDatasource,
68
+ onChange: handleDatasourceChange,
69
+ label: "ClickHouse Datasource",
70
+ notched: true
71
+ }),
72
+ /*#__PURE__*/ _jsx(ClickQLEditor, {
73
+ value: localQuery,
74
+ onChange: handleQueryChange,
75
+ onBlur: ()=>handleQueryExecute(localQuery),
76
+ onKeyDown: (event)=>{
77
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
78
+ event.preventDefault();
79
+ handleQueryExecute(localQuery);
80
+ }
81
+ },
82
+ placeholder: "Enter ClickHouse SQL query"
83
+ }),
84
+ /*#__PURE__*/ _jsxs("details", {
85
+ children: [
86
+ /*#__PURE__*/ _jsx("summary", {
87
+ style: {
88
+ cursor: 'pointer',
89
+ fontSize: '12px',
90
+ color: '#666',
91
+ marginBottom: '8px'
92
+ },
93
+ children: "Query Examples"
94
+ }),
95
+ /*#__PURE__*/ _jsx("div", {
96
+ style: examplesStyle,
97
+ children: queryExample
98
+ })
99
+ ]
100
+ })
101
+ ]
102
+ });
103
+ }
104
+
105
+ //# sourceMappingURL=ClickHouseQueryEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/ClickHouseQueryEditor.tsx"],"sourcesContent":["// Copyright 2025 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 DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback, useEffect, useState } from 'react';\nimport { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { ClickQLEditor } from '../../components';\nimport { Stack } from '@mui/material';\nimport { queryExample } from '../../components/constants';\n\ntype ClickHouseTimeSeriesQueryEditorProps = OptionsEditorProps<ClickHouseTimeSeriesQuerySpec>;\n\nexport function ClickHouseTimeSeriesQueryEditor(props: ClickHouseTimeSeriesQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const [localQuery, setLocalQuery] = useState(value.query || '');\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange({ ...value, datasource: newDatasourceSelection });\n return;\n }\n throw new Error('Got unexpected non ClickHouse datasource selection');\n };\n\n const handleQueryChange = useCallback((newQuery: string) => {\n setLocalQuery(newQuery);\n }, []);\n\n const handleQueryExecute = useCallback(\n (query: string) => {\n onChange({ ...value, query });\n },\n [onChange, value]\n );\n\n useEffect(() => {\n setLocalQuery(value.query || '');\n }, [value.query]);\n\n const examplesStyle: React.CSSProperties = {\n fontSize: '11px',\n color: '#777',\n backgroundColor: '#f5f5f5',\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap',\n lineHeight: '1.3',\n };\n\n return (\n <Stack spacing={1.5}>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"ClickHouse Datasource\"\n notched\n />\n <ClickQLEditor\n value={localQuery}\n onChange={handleQueryChange}\n onBlur={() => handleQueryExecute(localQuery)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(localQuery);\n }\n }}\n placeholder=\"Enter ClickHouse SQL query\"\n />\n\n <details>\n <summary style={{ cursor: 'pointer', fontSize: '12px', color: '#666', marginBottom: '8px' }}>\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","useEffect","useState","DATASOURCE_KIND","DEFAULT_DATASOURCE","ClickQLEditor","Stack","queryExample","ClickHouseTimeSeriesQueryEditor","props","onChange","value","datasource","selectedDatasource","localQuery","setLocalQuery","query","handleDatasourceChange","newDatasourceSelection","kind","Error","handleQueryChange","newQuery","handleQueryExecute","examplesStyle","fontSize","color","backgroundColor","padding","borderRadius","fontFamily","whiteSpace","lineHeight","spacing","datasourcePluginKind","label","notched","onBlur","onKeyDown","event","key","ctrlKey","metaKey","preventDefault","placeholder","details","summary","style","cursor","marginBottom","div"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,QAEf,4BAA4B;AACnC,SAAuBC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAEvE,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,KAAK,QAAQ,gBAAgB;AACtC,SAASC,YAAY,QAAQ,6BAA6B;AAI1D,OAAO,SAASC,gCAAgCC,KAA2C;IACzF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IACvB,MAAME,qBAAqBD,cAAcR;IACzC,MAAM,CAACU,YAAYC,cAAc,GAAGb,SAASS,MAAMK,KAAK,IAAI;IAE5D,MAAMC,yBAA4D,CAACC;QACjE,IAAI,CAACnB,qBAAqBmB,2BAA2BA,uBAAuBC,IAAI,KAAKhB,iBAAiB;YACpGO,SAAS;gBAAE,GAAGC,KAAK;gBAAEC,YAAYM;YAAuB;YACxD;QACF;QACA,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAMC,oBAAoBrB,YAAY,CAACsB;QACrCP,cAAcO;IAChB,GAAG,EAAE;IAEL,MAAMC,qBAAqBvB,YACzB,CAACgB;QACCN,SAAS;YAAE,GAAGC,KAAK;YAAEK;QAAM;IAC7B,GACA;QAACN;QAAUC;KAAM;IAGnBV,UAAU;QACRc,cAAcJ,MAAMK,KAAK,IAAI;IAC/B,GAAG;QAACL,MAAMK,KAAK;KAAC;IAEhB,MAAMQ,gBAAqC;QACzCC,UAAU;QACVC,OAAO;QACPC,iBAAiB;QACjBC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,YAAY;QACZC,YAAY;IACd;IAEA,qBACE,MAAC1B;QAAM2B,SAAS;;0BACd,KAACnC;gBACCoC,sBAAsB/B;gBACtBQ,OAAOE;gBACPH,UAAUO;gBACVkB,OAAM;gBACNC,OAAO;;0BAET,KAAC/B;gBACCM,OAAOG;gBACPJ,UAAUW;gBACVgB,QAAQ,IAAMd,mBAAmBT;gBACjCwB,WAAW,CAACC;oBACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;wBAC7DH,MAAMI,cAAc;wBACpBpB,mBAAmBT;oBACrB;gBACF;gBACA8B,aAAY;;0BAGd,MAACC;;kCACC,KAACC;wBAAQC,OAAO;4BAAEC,QAAQ;4BAAWvB,UAAU;4BAAQC,OAAO;4BAAQuB,cAAc;wBAAM;kCAAG;;kCAG7F,KAACC;wBAAIH,OAAOvB;kCAAgBjB;;;;;;AAIpC"}
@@ -0,0 +1,11 @@
1
+ import { DatasourceSelector } from '@perses-dev/core';
2
+ export interface ClickHouseTimeSeriesQuerySpec {
3
+ query: string;
4
+ datasource?: DatasourceSelector;
5
+ }
6
+ export type DatasourceQueryResponse = {
7
+ status: string;
8
+ data: any;
9
+ warnings?: string[];
10
+ };
11
+ //# sourceMappingURL=click-house-query-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click-house-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAGD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC"}
@@ -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
+ // TODO: import this type from your datasource or an existing datasource plugin
14
+ export { };
15
+
16
+ //# sourceMappingURL=click-house-query-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/click-house-query-types.ts"],"sourcesContent":["// Copyright 2025 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 { DatasourceSelector } from '@perses-dev/core';\n\nexport interface ClickHouseTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n\n// TODO: import this type from your datasource or an existing datasource plugin\nexport type DatasourceQueryResponse = {\n status: string;\n data: any;\n warnings?: string[];\n};\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AASjC,+EAA+E;AAC/E,WAIE"}
@@ -0,0 +1,4 @@
1
+ import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import { ClickHouseTimeSeriesQuerySpec } from './click-house-query-types';
3
+ export declare const getTimeSeriesData: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>['getTimeSeriesData'];
4
+ //# sourceMappingURL=get-click-house-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-click-house-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAA2B,MAAM,2BAA2B,CAAC;AAwBnG,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC,mBAAmB,CA8BvG,CAAC"}
@@ -0,0 +1,61 @@
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
+ import { replaceVariables } from '@perses-dev/plugin-system';
14
+ import { DEFAULT_DATASOURCE } from '../constants';
15
+ function buildTimeSeries(response) {
16
+ if (!response || !response.data || response.data.length === 0) {
17
+ return [];
18
+ }
19
+ const values = response.data.map((row)=>{
20
+ const timestamp = new Date(row.time).getTime();
21
+ const value = Number(row.log_count);
22
+ return [
23
+ timestamp,
24
+ value
25
+ ];
26
+ });
27
+ return [
28
+ {
29
+ name: 'log_count',
30
+ values
31
+ }
32
+ ];
33
+ }
34
+ export const getTimeSeriesData = async (spec, context)=>{
35
+ if (spec.query === undefined || spec.query === null || spec.query === '') {
36
+ return {
37
+ series: []
38
+ };
39
+ }
40
+ const query = replaceVariables(spec.query, context.variableState);
41
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_DATASOURCE);
42
+ const { start, end } = context.timeRange;
43
+ const response = await client.query({
44
+ start: start.getTime().toString(),
45
+ end: end.getTime().toString(),
46
+ query
47
+ });
48
+ return {
49
+ series: buildTimeSeries(response),
50
+ timeRange: {
51
+ start,
52
+ end
53
+ },
54
+ stepMs: 30 * 1000,
55
+ metadata: {
56
+ executedQueryString: query
57
+ }
58
+ };
59
+ };
60
+
61
+ //# sourceMappingURL=get-click-house-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/get-click-house-data.ts"],"sourcesContent":["// Copyright 2025 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 { TimeSeries } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { ClickHouseTimeSeriesQuerySpec, DatasourceQueryResponse } from './click-house-query-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { TimeSeriesEntry } from '../../model/click-house-data-types';\nimport { ClickHouseClient, ClickHouseQueryResponse } from '../../model/click-house-client';\n\nfunction buildTimeSeries(response?: DatasourceQueryResponse): TimeSeries[] {\n if (!response || !response.data || response.data.length === 0) {\n return [];\n }\n\n const values: Array<[number, number]> = response.data.map((row: TimeSeriesEntry) => {\n const timestamp = new Date(row.time).getTime();\n const value = Number(row.log_count);\n return [timestamp, value];\n });\n\n return [\n {\n name: 'log_count',\n values,\n },\n ];\n}\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<ClickHouseTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n if (spec.query === undefined || spec.query === null || spec.query === '') {\n return { series: [] };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n\n const client = (await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as ClickHouseClient;\n\n const { start, end } = context.timeRange;\n\n const response: ClickHouseQueryResponse = await client.query({\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n query,\n });\n\n return {\n series: buildTimeSeries(response),\n timeRange: { start, end },\n stepMs: 30 * 1000,\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","buildTimeSeries","response","data","length","values","map","row","timestamp","Date","time","getTime","value","Number","log_count","name","getTimeSeriesData","spec","context","query","undefined","series","variableState","client","datasourceStore","getDatasourceClient","datasource","start","end","timeRange","toString","stepMs","metadata","executedQueryString"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAAgCA,gBAAgB,QAAQ,4BAA4B;AAEpF,SAASC,kBAAkB,QAAQ,eAAe;AAIlD,SAASC,gBAAgBC,QAAkC;IACzD,IAAI,CAACA,YAAY,CAACA,SAASC,IAAI,IAAID,SAASC,IAAI,CAACC,MAAM,KAAK,GAAG;QAC7D,OAAO,EAAE;IACX;IAEA,MAAMC,SAAkCH,SAASC,IAAI,CAACG,GAAG,CAAC,CAACC;QACzD,MAAMC,YAAY,IAAIC,KAAKF,IAAIG,IAAI,EAAEC,OAAO;QAC5C,MAAMC,QAAQC,OAAON,IAAIO,SAAS;QAClC,OAAO;YAACN;YAAWI;SAAM;IAC3B;IAEA,OAAO;QACL;YACEG,MAAM;YACNV;QACF;KACD;AACH;AAEA,OAAO,MAAMW,oBAA+F,OAC1GC,MACAC;IAEA,IAAID,KAAKE,KAAK,KAAKC,aAAaH,KAAKE,KAAK,KAAK,QAAQF,KAAKE,KAAK,KAAK,IAAI;QACxE,OAAO;YAAEE,QAAQ,EAAE;QAAC;IACtB;IAEA,MAAMF,QAAQpB,iBAAiBkB,KAAKE,KAAK,EAAED,QAAQI,aAAa;IAEhE,MAAMC,SAAU,MAAML,QAAQM,eAAe,CAACC,mBAAmB,CAC/DR,KAAKS,UAAU,IAAI1B;IAGrB,MAAM,EAAE2B,KAAK,EAAEC,GAAG,EAAE,GAAGV,QAAQW,SAAS;IAExC,MAAM3B,WAAoC,MAAMqB,OAAOJ,KAAK,CAAC;QAC3DQ,OAAOA,MAAMhB,OAAO,GAAGmB,QAAQ;QAC/BF,KAAKA,IAAIjB,OAAO,GAAGmB,QAAQ;QAC3BX;IACF;IAEA,OAAO;QACLE,QAAQpB,gBAAgBC;QACxB2B,WAAW;YAAEF;YAAOC;QAAI;QACxBG,QAAQ,KAAK;QACbC,UAAU;YACRC,qBAAqBd;QACvB;IACF;AACF,EAAE"}
@@ -0,0 +1,5 @@
1
+ export * from './get-click-house-data';
2
+ export * from './ClickHouseQuery';
3
+ export * from './ClickHouseQueryEditor';
4
+ export * from './click-house-query-types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/click-house-time-series-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,18 @@
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
+ export * from './get-click-house-data';
14
+ export * from './ClickHouseQuery';
15
+ export * from './ClickHouseQueryEditor';
16
+ export * from './click-house-query-types';
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/click-house-time-series-query/index.ts"],"sourcesContent":["// Copyright 2025 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 './get-click-house-data';\nexport * from './ClickHouseQuery';\nexport * from './ClickHouseQueryEditor';\nexport * from './click-house-query-types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,yBAAyB;AACvC,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,4BAA4B"}
@@ -0,0 +1,5 @@
1
+ export declare const DATASOURCE_KIND = "ClickHouseDatasource";
2
+ export declare const DEFAULT_DATASOURCE: {
3
+ kind: string;
4
+ };
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/queries/constants.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,yBAAyB,CAAC;AACtD,eAAO,MAAM,kBAAkB;;CAA4B,CAAC"}
@@ -0,0 +1,18 @@
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
+ export const DATASOURCE_KIND = 'ClickHouseDatasource';
14
+ export const DEFAULT_DATASOURCE = {
15
+ kind: DATASOURCE_KIND
16
+ };
17
+
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/queries/constants.ts"],"sourcesContent":["// Copyright 2025 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 const DATASOURCE_KIND = 'ClickHouseDatasource';\nexport const DEFAULT_DATASOURCE = { kind: DATASOURCE_KIND };\n"],"names":["DATASOURCE_KIND","DEFAULT_DATASOURCE","kind"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,kBAAkB,uBAAuB;AACtD,OAAO,MAAMC,qBAAqB;IAAEC,MAAMF;AAAgB,EAAE"}
@@ -0,0 +1,3 @@
1
+ export * from './click-house-time-series-query';
2
+ export * from './click-house-log-query';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/queries/index.ts"],"names":[],"mappings":"AAaA,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC"}
@@ -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
+ export * from './click-house-time-series-query';
14
+ export * from './click-house-log-query';
15
+
16
+ //# sourceMappingURL=index.js.map