@perses-dev/greptimedb-plugin 0.1.0-beta.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 (331) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/8077.85c2cbf6.css +1 -0
  4. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  5. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  6. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  8. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  10. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  11. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  12. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  13. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  14. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  17. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  18. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  26. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  27. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  28. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  29. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  30. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  31. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  32. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  33. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  34. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  35. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  36. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  37. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  38. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  39. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  40. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  42. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  43. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  44. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  45. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  47. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  49. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  50. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  51. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  52. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  53. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  54. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  55. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  56. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  57. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  58. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  59. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  60. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  61. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  62. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  63. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  64. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  66. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  67. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  68. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  69. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  70. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  71. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  72. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  73. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  74. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  75. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  77. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  79. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  80. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  82. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  83. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  84. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  85. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  86. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  87. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  88. package/__mf/js/GreptimeDB.7a063e9e.js +7 -0
  89. package/__mf/js/async/1616.20d43f7e.js +1 -0
  90. package/__mf/js/async/2043.97b1f27f.js +2 -0
  91. package/__mf/js/async/2043.97b1f27f.js.LICENSE.txt +24 -0
  92. package/__mf/js/async/2269.f1322789.js +3 -0
  93. package/__mf/js/async/2386.b7243314.js +2 -0
  94. package/__mf/js/async/2386.b7243314.js.LICENSE.txt +9 -0
  95. package/__mf/js/async/3181.7ac30201.js +2 -0
  96. package/__mf/js/async/3181.7ac30201.js.LICENSE.txt +9 -0
  97. package/__mf/js/async/3247.65183b95.js +2 -0
  98. package/__mf/js/async/3247.65183b95.js.LICENSE.txt +37 -0
  99. package/__mf/js/async/392.91ae0e19.js +2 -0
  100. package/__mf/js/async/392.91ae0e19.js.LICENSE.txt +8 -0
  101. package/__mf/js/async/3944.12d0f358.js +10 -0
  102. package/__mf/js/async/3944.12d0f358.js.LICENSE.txt +17 -0
  103. package/__mf/js/async/4121.06b9cab6.js +2 -0
  104. package/__mf/js/async/4121.06b9cab6.js.LICENSE.txt +9 -0
  105. package/__mf/js/async/5002.0a422150.js +1 -0
  106. package/__mf/js/async/5071.e5cc2bd7.js +1 -0
  107. package/__mf/js/async/5402.eda0fb07.js +101 -0
  108. package/__mf/js/async/5440.7abefadb.js +2 -0
  109. package/__mf/js/async/5440.7abefadb.js.LICENSE.txt +32 -0
  110. package/__mf/js/async/5562.a39a5d1e.js +2 -0
  111. package/__mf/js/async/5562.a39a5d1e.js.LICENSE.txt +9 -0
  112. package/__mf/js/async/5587.a3fb718a.js +1 -0
  113. package/__mf/js/async/6045.10e9fa5a.js +1 -0
  114. package/__mf/js/async/6274.6f0093e7.js +2 -0
  115. package/__mf/js/async/6274.6f0093e7.js.LICENSE.txt +8 -0
  116. package/__mf/js/async/6753.1e42e819.js +1 -0
  117. package/__mf/js/async/7177.78bced1c.js +1 -0
  118. package/__mf/js/async/7192.e0362dae.js +1 -0
  119. package/__mf/js/async/7862.8048abcc.js +2 -0
  120. package/__mf/js/async/7862.8048abcc.js.LICENSE.txt +9 -0
  121. package/__mf/js/async/7968.7b2e2836.js +1 -0
  122. package/__mf/js/async/7978.8cd67008.js +1 -0
  123. package/__mf/js/async/8077.fe9828a3.js +7 -0
  124. package/__mf/js/async/8077.fe9828a3.js.LICENSE.txt +39 -0
  125. package/__mf/js/async/8356.ac21fc24.js +1 -0
  126. package/__mf/js/async/8470.a2e67e3a.js +2 -0
  127. package/__mf/js/async/8470.a2e67e3a.js.LICENSE.txt +19 -0
  128. package/__mf/js/async/873.863f53e4.js +1 -0
  129. package/__mf/js/async/9235.7651eaca.js +1 -0
  130. package/__mf/js/async/941.4155d3cc.js +2 -0
  131. package/__mf/js/async/941.4155d3cc.js.LICENSE.txt +9 -0
  132. package/__mf/js/async/9558.215ad80c.js +1 -0
  133. package/__mf/js/async/9588.2f544a41.js +1 -0
  134. package/__mf/js/async/9877.8766524e.js +38 -0
  135. package/__mf/js/async/9916.2a1eb7a0.js +22 -0
  136. package/__mf/js/async/9916.2a1eb7a0.js.LICENSE.txt +19 -0
  137. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.bf1dec3c.js +2 -0
  138. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.bf1dec3c.js.LICENSE.txt +9 -0
  139. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.d80b2965.js +21 -0
  140. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.d80b2965.js.LICENSE.txt +9 -0
  141. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.59cda507.js +21 -0
  142. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.59cda507.js.LICENSE.txt +9 -0
  143. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.00464f43.js +21 -0
  144. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.00464f43.js.LICENSE.txt +9 -0
  145. package/__mf/js/main.a4e4afce.js +7 -0
  146. package/lib/bootstrap.d.ts +2 -0
  147. package/lib/bootstrap.d.ts.map +1 -0
  148. package/lib/bootstrap.js +19 -0
  149. package/lib/bootstrap.js.map +1 -0
  150. package/lib/cjs/bootstrap.js +26 -0
  151. package/lib/cjs/components/GreptimeDBQLEditor.js +72 -0
  152. package/lib/cjs/components/constants.js +42 -0
  153. package/lib/cjs/components/index.js +31 -0
  154. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasource.js +53 -0
  155. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +51 -0
  156. package/lib/cjs/datasources/greptimedb-datasource/greptimedb-datasource-types.js +16 -0
  157. package/lib/cjs/datasources/greptimedb-datasource/index.js +32 -0
  158. package/lib/cjs/datasources/index.js +30 -0
  159. package/lib/cjs/env.d.js +14 -0
  160. package/lib/cjs/getPluginModule.js +39 -0
  161. package/lib/cjs/index-federation.js +55 -0
  162. package/lib/cjs/index.js +38 -0
  163. package/lib/cjs/model/greptimedb-client.js +76 -0
  164. package/lib/cjs/model/greptimedb-data-types.js +16 -0
  165. package/lib/cjs/queries/constants.js +34 -0
  166. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQuery.js +43 -0
  167. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +108 -0
  168. package/lib/cjs/queries/greptimedb-log-query/get-greptimedb-log-data.js +103 -0
  169. package/lib/cjs/queries/greptimedb-log-query/greptimedb-log-query-types.js +16 -0
  170. package/lib/cjs/queries/greptimedb-log-query/index.js +33 -0
  171. package/lib/cjs/queries/greptimedb-log-query/log-query-plugin-interface.js +16 -0
  172. package/lib/cjs/queries/greptimedb-query-data-model.js +152 -0
  173. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQuery.js +43 -0
  174. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +107 -0
  175. package/lib/cjs/queries/greptimedb-time-series-query/get-greptimedb-data.js +184 -0
  176. package/lib/cjs/queries/greptimedb-time-series-query/greptimedb-query-types.js +16 -0
  177. package/lib/cjs/queries/greptimedb-time-series-query/index.js +33 -0
  178. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +40 -0
  179. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +79 -0
  180. package/lib/cjs/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +518 -0
  181. package/lib/cjs/queries/greptimedb-trace-query/greptimedb-trace-query-types.js +16 -0
  182. package/lib/cjs/queries/greptimedb-trace-query/index.js +33 -0
  183. package/lib/cjs/queries/greptimedb-trace-query/trace-query-sql.js +25 -0
  184. package/lib/cjs/queries/index.js +32 -0
  185. package/lib/cjs/queries/query-editor-model.js +47 -0
  186. package/lib/cjs/setup-tests.js +19 -0
  187. package/lib/components/GreptimeDBQLEditor.d.ts +4 -0
  188. package/lib/components/GreptimeDBQLEditor.d.ts.map +1 -0
  189. package/lib/components/GreptimeDBQLEditor.js +59 -0
  190. package/lib/components/GreptimeDBQLEditor.js.map +1 -0
  191. package/lib/components/constants.d.ts +2 -0
  192. package/lib/components/constants.d.ts.map +1 -0
  193. package/lib/components/constants.js +34 -0
  194. package/lib/components/constants.js.map +1 -0
  195. package/lib/components/index.d.ts +3 -0
  196. package/lib/components/index.d.ts.map +1 -0
  197. package/lib/components/index.js +16 -0
  198. package/lib/components/index.js.map +1 -0
  199. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts +4 -0
  200. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts.map +1 -0
  201. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js +45 -0
  202. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js.map +1 -0
  203. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts +9 -0
  204. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts.map +1 -0
  205. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +43 -0
  206. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js.map +1 -0
  207. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts +29 -0
  208. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts.map +1 -0
  209. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.js +15 -0
  210. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.js.map +1 -0
  211. package/lib/datasources/greptimedb-datasource/index.d.ts +4 -0
  212. package/lib/datasources/greptimedb-datasource/index.d.ts.map +1 -0
  213. package/lib/datasources/greptimedb-datasource/index.js +17 -0
  214. package/lib/datasources/greptimedb-datasource/index.js.map +1 -0
  215. package/lib/datasources/index.d.ts +2 -0
  216. package/lib/datasources/index.d.ts.map +1 -0
  217. package/lib/datasources/index.js +15 -0
  218. package/lib/datasources/index.js.map +1 -0
  219. package/lib/env.d.js +15 -0
  220. package/lib/env.d.js.map +1 -0
  221. package/lib/getPluginModule.d.ts +6 -0
  222. package/lib/getPluginModule.d.ts.map +1 -0
  223. package/lib/getPluginModule.js +28 -0
  224. package/lib/getPluginModule.js.map +1 -0
  225. package/lib/index-federation.d.ts +1 -0
  226. package/lib/index-federation.d.ts.map +1 -0
  227. package/lib/index-federation.js +15 -0
  228. package/lib/index-federation.js.map +1 -0
  229. package/lib/index.d.ts +4 -0
  230. package/lib/index.d.ts.map +1 -0
  231. package/lib/index.js +17 -0
  232. package/lib/index.js.map +1 -0
  233. package/lib/model/greptimedb-client.d.ts +17 -0
  234. package/lib/model/greptimedb-client.d.ts.map +1 -0
  235. package/lib/model/greptimedb-client.js +68 -0
  236. package/lib/model/greptimedb-client.js.map +1 -0
  237. package/lib/model/greptimedb-data-types.d.ts +21 -0
  238. package/lib/model/greptimedb-data-types.d.ts.map +1 -0
  239. package/lib/model/greptimedb-data-types.js +15 -0
  240. package/lib/model/greptimedb-data-types.js.map +1 -0
  241. package/lib/queries/constants.d.ts +5 -0
  242. package/lib/queries/constants.d.ts.map +1 -0
  243. package/lib/queries/constants.js +18 -0
  244. package/lib/queries/constants.js.map +1 -0
  245. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts +4 -0
  246. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts.map +1 -0
  247. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js +35 -0
  248. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js.map +1 -0
  249. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts +7 -0
  250. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts.map +1 -0
  251. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +100 -0
  252. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js.map +1 -0
  253. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts +4 -0
  254. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts.map +1 -0
  255. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js +95 -0
  256. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js.map +1 -0
  257. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts +6 -0
  258. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts.map +1 -0
  259. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.js +15 -0
  260. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.js.map +1 -0
  261. package/lib/queries/greptimedb-log-query/index.d.ts +5 -0
  262. package/lib/queries/greptimedb-log-query/index.d.ts.map +1 -0
  263. package/lib/queries/greptimedb-log-query/index.js +18 -0
  264. package/lib/queries/greptimedb-log-query/index.js.map +1 -0
  265. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts +23 -0
  266. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts.map +1 -0
  267. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.js +15 -0
  268. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.js.map +1 -0
  269. package/lib/queries/greptimedb-query-data-model.d.ts +18 -0
  270. package/lib/queries/greptimedb-query-data-model.d.ts.map +1 -0
  271. package/lib/queries/greptimedb-query-data-model.js +138 -0
  272. package/lib/queries/greptimedb-query-data-model.js.map +1 -0
  273. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts +4 -0
  274. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts.map +1 -0
  275. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js +35 -0
  276. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js.map +1 -0
  277. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts +7 -0
  278. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts.map +1 -0
  279. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +99 -0
  280. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js.map +1 -0
  281. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts +4 -0
  282. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts.map +1 -0
  283. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js +176 -0
  284. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js.map +1 -0
  285. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts +7 -0
  286. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts.map +1 -0
  287. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.js +15 -0
  288. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.js.map +1 -0
  289. package/lib/queries/greptimedb-time-series-query/index.d.ts +5 -0
  290. package/lib/queries/greptimedb-time-series-query/index.d.ts.map +1 -0
  291. package/lib/queries/greptimedb-time-series-query/index.js +18 -0
  292. package/lib/queries/greptimedb-time-series-query/index.js.map +1 -0
  293. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts +4 -0
  294. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts.map +1 -0
  295. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +32 -0
  296. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js.map +1 -0
  297. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts +7 -0
  298. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts.map +1 -0
  299. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +71 -0
  300. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js.map +1 -0
  301. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts +11 -0
  302. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts.map +1 -0
  303. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +466 -0
  304. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js.map +1 -0
  305. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts +6 -0
  306. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts.map +1 -0
  307. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.js +15 -0
  308. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.js.map +1 -0
  309. package/lib/queries/greptimedb-trace-query/index.d.ts +5 -0
  310. package/lib/queries/greptimedb-trace-query/index.d.ts.map +1 -0
  311. package/lib/queries/greptimedb-trace-query/index.js +18 -0
  312. package/lib/queries/greptimedb-trace-query/index.js.map +1 -0
  313. package/lib/queries/greptimedb-trace-query/trace-query-sql.d.ts +2 -0
  314. package/lib/queries/greptimedb-trace-query/trace-query-sql.d.ts.map +1 -0
  315. package/lib/queries/greptimedb-trace-query/trace-query-sql.js +17 -0
  316. package/lib/queries/greptimedb-trace-query/trace-query-sql.js.map +1 -0
  317. package/lib/queries/index.d.ts +4 -0
  318. package/lib/queries/index.d.ts.map +1 -0
  319. package/lib/queries/index.js +17 -0
  320. package/lib/queries/index.js.map +1 -0
  321. package/lib/queries/query-editor-model.d.ts +19 -0
  322. package/lib/queries/query-editor-model.d.ts.map +1 -0
  323. package/lib/queries/query-editor-model.js +44 -0
  324. package/lib/queries/query-editor-model.js.map +1 -0
  325. package/lib/setup-tests.d.ts +2 -0
  326. package/lib/setup-tests.d.ts.map +1 -0
  327. package/lib/setup-tests.js +17 -0
  328. package/lib/setup-tests.js.map +1 -0
  329. package/mf-manifest.json +462 -0
  330. package/mf-stats.json +530 -0
  331. package/package.json +86 -0
@@ -0,0 +1,68 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ async function readErrorResponse(response) {
14
+ const contentType = response.headers?.get('content-type');
15
+ if (contentType && contentType.includes('application/json')) {
16
+ const errorJson = await response.json();
17
+ return `GreptimeDB error: ${response.status} ${response.statusText} - ${JSON.stringify(errorJson)}`;
18
+ }
19
+ const errorText = await response.text();
20
+ return `GreptimeDB error: ${response.status} ${response.statusText} - ${errorText}`;
21
+ }
22
+ export async function greptimedbQuery(params, queryOptions) {
23
+ const { datasourceUrl, headers } = queryOptions;
24
+ const url = buildSqlUrl(datasourceUrl);
25
+ if (!params.query) {
26
+ throw new Error('No query provided in params');
27
+ }
28
+ const init = {
29
+ method: 'POST',
30
+ headers: {
31
+ 'Content-Type': 'application/x-www-form-urlencoded',
32
+ ...headers ?? {}
33
+ },
34
+ body: new URLSearchParams({
35
+ sql: params.query
36
+ }).toString()
37
+ };
38
+ try {
39
+ const response = await fetch(url.toString(), init);
40
+ if (!response.ok) {
41
+ const errorMessage = await readErrorResponse(response);
42
+ console.error('GreptimeDB error response:', errorMessage);
43
+ return {
44
+ status: 'error',
45
+ data: {
46
+ output: []
47
+ },
48
+ error: errorMessage
49
+ };
50
+ }
51
+ const body = await response.json();
52
+ return {
53
+ status: body?.status ?? 'success',
54
+ data: body
55
+ };
56
+ } catch (e) {
57
+ throw new Error(`GreptimeDB query failed: ${e}`);
58
+ }
59
+ }
60
+ function buildSqlUrl(datasourceUrl) {
61
+ const base = datasourceUrl.endsWith('/') ? `${datasourceUrl}v1/sql` : `${datasourceUrl}/v1/sql`;
62
+ if (base.startsWith('http://') || base.startsWith('https://')) {
63
+ return new URL(base);
64
+ }
65
+ return new URL(base, window.location.origin);
66
+ }
67
+
68
+ //# sourceMappingURL=greptimedb-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/model/greptimedb-client.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { RequestHeaders } from '@perses-dev/client';\nimport { GreptimeDBDatasourceResponse, GreptimeDBQueryRequestParameters } from '../datasources/greptimedb-datasource';\nimport { GreptimeDBResponseData } from './greptimedb-data-types';\n\nexport interface GreptimeDBQueryOptions {\n datasourceUrl: string;\n headers?: RequestHeaders;\n}\n\nexport interface GreptimeDBQueryResponse {\n status: 'success' | 'error';\n data: GreptimeDBResponseData;\n error?: string;\n}\n\nexport interface GreptimeDBClient {\n query: (params: GreptimeDBQueryRequestParameters) => Promise<GreptimeDBQueryResponse>;\n}\n\nasync function readErrorResponse(response: Response): Promise<string> {\n const contentType = response.headers?.get('content-type');\n if (contentType && contentType.includes('application/json')) {\n const errorJson = await response.json();\n return `GreptimeDB error: ${response.status} ${response.statusText} - ${JSON.stringify(errorJson)}`;\n }\n const errorText = await response.text();\n return `GreptimeDB error: ${response.status} ${response.statusText} - ${errorText}`;\n}\n\nexport async function greptimedbQuery(\n params: GreptimeDBQueryRequestParameters,\n queryOptions: GreptimeDBQueryOptions\n): Promise<GreptimeDBDatasourceResponse> {\n const { datasourceUrl, headers } = queryOptions;\n const url = buildSqlUrl(datasourceUrl);\n\n if (!params.query) {\n throw new Error('No query provided in params');\n }\n\n const init: RequestInit = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n ...(headers ?? {}),\n },\n body: new URLSearchParams({\n sql: params.query,\n }).toString(),\n };\n\n try {\n const response = await fetch(url.toString(), init);\n if (!response.ok) {\n const errorMessage = await readErrorResponse(response);\n console.error('GreptimeDB error response:', errorMessage);\n return {\n status: 'error',\n data: { output: [] },\n error: errorMessage,\n };\n }\n\n const body = await response.json();\n\n return {\n status: body?.status ?? 'success',\n data: body,\n };\n } catch (e) {\n throw new Error(`GreptimeDB query failed: ${e}`);\n }\n}\n\nfunction buildSqlUrl(datasourceUrl: string): URL {\n const base = datasourceUrl.endsWith('/') ? `${datasourceUrl}v1/sql` : `${datasourceUrl}/v1/sql`;\n\n if (base.startsWith('http://') || base.startsWith('https://')) {\n return new URL(base);\n }\n\n return new URL(base, window.location.origin);\n}\n"],"names":["readErrorResponse","response","contentType","headers","get","includes","errorJson","json","status","statusText","JSON","stringify","errorText","text","greptimedbQuery","params","queryOptions","datasourceUrl","url","buildSqlUrl","query","Error","init","method","body","URLSearchParams","sql","toString","fetch","ok","errorMessage","console","error","data","output","e","base","endsWith","startsWith","URL","window","location","origin"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqBjC,eAAeA,kBAAkBC,QAAkB;IACjD,MAAMC,cAAcD,SAASE,OAAO,EAAEC,IAAI;IAC1C,IAAIF,eAAeA,YAAYG,QAAQ,CAAC,qBAAqB;QAC3D,MAAMC,YAAY,MAAML,SAASM,IAAI;QACrC,OAAO,CAAC,kBAAkB,EAAEN,SAASO,MAAM,CAAC,CAAC,EAAEP,SAASQ,UAAU,CAAC,GAAG,EAAEC,KAAKC,SAAS,CAACL,YAAY;IACrG;IACA,MAAMM,YAAY,MAAMX,SAASY,IAAI;IACrC,OAAO,CAAC,kBAAkB,EAAEZ,SAASO,MAAM,CAAC,CAAC,EAAEP,SAASQ,UAAU,CAAC,GAAG,EAAEG,WAAW;AACrF;AAEA,OAAO,eAAeE,gBACpBC,MAAwC,EACxCC,YAAoC;IAEpC,MAAM,EAAEC,aAAa,EAAEd,OAAO,EAAE,GAAGa;IACnC,MAAME,MAAMC,YAAYF;IAExB,IAAI,CAACF,OAAOK,KAAK,EAAE;QACjB,MAAM,IAAIC,MAAM;IAClB;IAEA,MAAMC,OAAoB;QACxBC,QAAQ;QACRpB,SAAS;YACP,gBAAgB;YAChB,GAAIA,WAAW,CAAC,CAAC;QACnB;QACAqB,MAAM,IAAIC,gBAAgB;YACxBC,KAAKX,OAAOK,KAAK;QACnB,GAAGO,QAAQ;IACb;IAEA,IAAI;QACF,MAAM1B,WAAW,MAAM2B,MAAMV,IAAIS,QAAQ,IAAIL;QAC7C,IAAI,CAACrB,SAAS4B,EAAE,EAAE;YAChB,MAAMC,eAAe,MAAM9B,kBAAkBC;YAC7C8B,QAAQC,KAAK,CAAC,8BAA8BF;YAC5C,OAAO;gBACLtB,QAAQ;gBACRyB,MAAM;oBAAEC,QAAQ,EAAE;gBAAC;gBACnBF,OAAOF;YACT;QACF;QAEA,MAAMN,OAAO,MAAMvB,SAASM,IAAI;QAEhC,OAAO;YACLC,QAAQgB,MAAMhB,UAAU;YACxByB,MAAMT;QACR;IACF,EAAE,OAAOW,GAAG;QACV,MAAM,IAAId,MAAM,CAAC,yBAAyB,EAAEc,GAAG;IACjD;AACF;AAEA,SAAShB,YAAYF,aAAqB;IACxC,MAAMmB,OAAOnB,cAAcoB,QAAQ,CAAC,OAAO,GAAGpB,cAAc,MAAM,CAAC,GAAG,GAAGA,cAAc,OAAO,CAAC;IAE/F,IAAImB,KAAKE,UAAU,CAAC,cAAcF,KAAKE,UAAU,CAAC,aAAa;QAC7D,OAAO,IAAIC,IAAIH;IACjB;IAEA,OAAO,IAAIG,IAAIH,MAAMI,OAAOC,QAAQ,CAACC,MAAM;AAC7C"}
@@ -0,0 +1,21 @@
1
+ export interface GreptimeDBColumnSchema {
2
+ name: string;
3
+ data_type?: string;
4
+ semantic_type?: string;
5
+ }
6
+ export interface GreptimeDBRecords {
7
+ schema?: {
8
+ column_schemas?: GreptimeDBColumnSchema[];
9
+ };
10
+ rows?: unknown[][];
11
+ total_rows?: number;
12
+ }
13
+ export interface GreptimeDBOutputRecord {
14
+ records?: GreptimeDBRecords;
15
+ affectedrows?: number;
16
+ }
17
+ export interface GreptimeDBResponseData {
18
+ output?: GreptimeDBOutputRecord[];
19
+ execution_time_ms?: number;
20
+ }
21
+ //# sourceMappingURL=greptimedb-data-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greptimedb-data-types.d.ts","sourceRoot":"","sources":["../../../src/model/greptimedb-data-types.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE;QACP,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;KAC3C,CAAC;IACF,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=greptimedb-data-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/model/greptimedb-data-types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface GreptimeDBColumnSchema {\n name: string;\n data_type?: string;\n semantic_type?: string;\n}\n\nexport interface GreptimeDBRecords {\n schema?: {\n column_schemas?: GreptimeDBColumnSchema[];\n };\n rows?: unknown[][];\n total_rows?: number;\n}\n\nexport interface GreptimeDBOutputRecord {\n records?: GreptimeDBRecords;\n affectedrows?: number;\n}\n\nexport interface GreptimeDBResponseData {\n output?: GreptimeDBOutputRecord[];\n execution_time_ms?: number;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAqBjC,WAGC"}
@@ -0,0 +1,5 @@
1
+ export declare const DATASOURCE_KIND = "GreptimeDBDatasource";
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;;CAE9B,CAAC"}
@@ -0,0 +1,18 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export const DATASOURCE_KIND = 'GreptimeDBDatasource';
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 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 = 'GreptimeDBDatasource';\nexport const DEFAULT_DATASOURCE = {\n kind: DATASOURCE_KIND,\n};\n"],"names":["DATASOURCE_KIND","DEFAULT_DATASOURCE","kind"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,MAAMA,kBAAkB,uBAAuB;AACtD,OAAO,MAAMC,qBAAqB;IAChCC,MAAMF;AACR,EAAE"}
@@ -0,0 +1,4 @@
1
+ import { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';
2
+ import { LogQueryPlugin } from './log-query-plugin-interface';
3
+ export declare const GreptimeDBLogQuery: LogQueryPlugin<GreptimeDBLogQuerySpec>;
4
+ //# sourceMappingURL=GreptimeDBLogQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GreptimeDBLogQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-log-query/GreptimeDBLogQuery.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,sBAAsB,CAarE,CAAC"}
@@ -0,0 +1,35 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { parseVariables } from '@perses-dev/plugin-system';
14
+ import { getGreptimeDBLogData } from './get-greptimedb-log-data';
15
+ import { GreptimeDBLogQueryEditor } from './GreptimeDBLogQueryEditor';
16
+ export const GreptimeDBLogQuery = {
17
+ getLogData: getGreptimeDBLogData,
18
+ OptionsEditorComponent: GreptimeDBLogQueryEditor,
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=GreptimeDBLogQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/GreptimeDBLogQuery.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { parseVariables } from '@perses-dev/plugin-system';\nimport { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';\nimport { getGreptimeDBLogData } from './get-greptimedb-log-data';\nimport { GreptimeDBLogQueryEditor } from './GreptimeDBLogQueryEditor';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nexport const GreptimeDBLogQuery: LogQueryPlugin<GreptimeDBLogQuerySpec> = {\n getLogData: getGreptimeDBLogData,\n OptionsEditorComponent: GreptimeDBLogQueryEditor,\n createInitialOptions: () => ({\n query: '',\n }),\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","getGreptimeDBLogData","GreptimeDBLogQueryEditor","GreptimeDBLogQuery","getLogData","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","allVariables","Set","variables"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,cAAc,QAAQ,4BAA4B;AAE3D,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,wBAAwB,QAAQ,6BAA6B;AAGtE,OAAO,MAAMC,qBAA6D;IACxEC,YAAYH;IACZI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;QACT,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,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 { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';
4
+ type GreptimeDBLogQueryEditorProps = OptionsEditorProps<GreptimeDBLogQuerySpec>;
5
+ export declare function GreptimeDBLogQueryEditor(props: GreptimeDBLogQueryEditorProps): ReactElement;
6
+ export {};
7
+ //# sourceMappingURL=GreptimeDBLogQueryEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GreptimeDBLogQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,KAAK,6BAA6B,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;AAEhF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,GAAG,YAAY,CAkF3F"}
@@ -0,0 +1,100 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';
15
+ import { useCallback } from 'react';
16
+ import { produce } from 'immer';
17
+ import { Stack, useTheme } from '@mui/material';
18
+ import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';
19
+ import { GreptimeDBQLEditor } from '../../components';
20
+ import { queryExample } from '../../components/constants';
21
+ import { useQueryState } from '../query-editor-model';
22
+ export function GreptimeDBLogQueryEditor(props) {
23
+ const theme = useTheme();
24
+ const { onChange, value } = props;
25
+ const { datasource } = value;
26
+ const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;
27
+ const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);
28
+ const handleDatasourceChange = (newDatasourceSelection)=>{
29
+ if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {
30
+ onChange(produce(value, (draft)=>{
31
+ draft.datasource = newDatasourceSelection;
32
+ }));
33
+ return;
34
+ }
35
+ throw new Error('Got unexpected non GreptimeDB datasource selection');
36
+ };
37
+ const handleQueryExecute = (queryValue)=>{
38
+ onChange(produce(value, (draft)=>{
39
+ draft.query = queryValue;
40
+ }));
41
+ };
42
+ const handleGreptimeDBQueryChange = useCallback((e)=>{
43
+ handleQueryChange(e);
44
+ }, [
45
+ handleQueryChange
46
+ ]);
47
+ const examplesStyle = {
48
+ fontSize: '11px',
49
+ color: theme.palette.text.secondary,
50
+ backgroundColor: theme.palette.background.code,
51
+ padding: '8px',
52
+ borderRadius: '4px',
53
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
54
+ whiteSpace: 'pre-wrap',
55
+ lineHeight: '1.3'
56
+ };
57
+ return /*#__PURE__*/ _jsxs(Stack, {
58
+ spacing: 1.5,
59
+ children: [
60
+ /*#__PURE__*/ _jsx(DatasourceSelect, {
61
+ datasourcePluginKind: DATASOURCE_KIND,
62
+ value: selectedDatasource,
63
+ onChange: handleDatasourceChange,
64
+ label: "GreptimeDB Datasource",
65
+ notched: true
66
+ }),
67
+ /*#__PURE__*/ _jsx(GreptimeDBQLEditor, {
68
+ value: query,
69
+ onChange: handleGreptimeDBQueryChange,
70
+ onBlur: handleQueryBlur,
71
+ onKeyDown: (event)=>{
72
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
73
+ event.preventDefault();
74
+ handleQueryExecute(query);
75
+ }
76
+ },
77
+ placeholder: "Enter GreptimeDB SQL query"
78
+ }),
79
+ /*#__PURE__*/ _jsxs("details", {
80
+ children: [
81
+ /*#__PURE__*/ _jsx("summary", {
82
+ style: {
83
+ cursor: 'pointer',
84
+ fontSize: '12px',
85
+ color: theme.palette.text.secondary,
86
+ marginBottom: '8px'
87
+ },
88
+ children: "Query Examples"
89
+ }),
90
+ /*#__PURE__*/ _jsx("div", {
91
+ style: examplesStyle,
92
+ children: queryExample
93
+ })
94
+ ]
95
+ })
96
+ ]
97
+ });
98
+ }
99
+
100
+ //# sourceMappingURL=GreptimeDBLogQueryEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.tsx"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n} from '@perses-dev/plugin-system';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { Stack, useTheme } from '@mui/material';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { GreptimeDBQLEditor } from '../../components';\nimport { queryExample } from '../../components/constants';\nimport { useQueryState } from '../query-editor-model';\nimport { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';\n\ntype GreptimeDBLogQueryEditorProps = OptionsEditorProps<GreptimeDBLogQuerySpec>;\n\nexport function GreptimeDBLogQueryEditor(props: GreptimeDBLogQueryEditorProps): ReactElement {\n const theme = useTheme();\n const { onChange, value } = props;\n const { datasource } = value;\n\n const selectedDatasource = datasource ?? DEFAULT_DATASOURCE;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n throw new Error('Got unexpected non GreptimeDB datasource selection');\n };\n\n const handleQueryExecute = (queryValue: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = queryValue;\n })\n );\n };\n\n const handleGreptimeDBQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n const examplesStyle = {\n fontSize: '11px',\n color: theme.palette.text.secondary,\n backgroundColor: theme.palette.background.code,\n padding: '8px',\n borderRadius: '4px',\n fontFamily: 'Monaco, Menlo, \"Ubuntu Mono\", monospace',\n whiteSpace: 'pre-wrap' as const,\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=\"GreptimeDB Datasource\"\n notched\n />\n <GreptimeDBQLEditor\n value={query}\n onChange={handleGreptimeDBQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder=\"Enter GreptimeDB SQL query\"\n />\n <details>\n <summary\n style={{\n cursor: 'pointer',\n fontSize: '12px',\n color: theme.palette.text.secondary,\n marginBottom: '8px',\n }}\n >\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useCallback","produce","Stack","useTheme","DATASOURCE_KIND","DEFAULT_DATASOURCE","GreptimeDBQLEditor","queryExample","useQueryState","GreptimeDBLogQueryEditor","props","theme","onChange","value","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","queryValue","handleGreptimeDBQueryChange","e","examplesStyle","fontSize","color","palette","text","secondary","backgroundColor","background","code","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,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SACEA,gBAAgB,EAEhBC,oBAAoB,QAEf,4BAA4B;AACnC,SAAuBC,WAAW,QAAQ,QAAQ;AAClD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,KAAK,EAAEC,QAAQ,QAAQ,gBAAgB;AAChD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,eAAe;AACnE,SAASC,kBAAkB,QAAQ,mBAAmB;AACtD,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,aAAa,QAAQ,wBAAwB;AAKtD,OAAO,SAASC,yBAAyBC,KAAoC;IAC3E,MAAMC,QAAQR;IACd,MAAM,EAAES,QAAQ,EAAEC,KAAK,EAAE,GAAGH;IAC5B,MAAM,EAAEI,UAAU,EAAE,GAAGD;IAEvB,MAAME,qBAAqBD,cAAcT;IACzC,MAAM,EAAEW,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGV,cAAcE;IAEpE,MAAMS,yBAA4D,CAACC;QACjE,IAAI,CAACrB,qBAAqBqB,2BAA2BA,uBAAuBC,IAAI,KAAKjB,iBAAiB;YACpGQ,SACEX,QAAQY,OAAO,CAACS;gBACdA,MAAMR,UAAU,GAAGM;YACrB;YAEF;QACF;QACA,MAAM,IAAIG,MAAM;IAClB;IAEA,MAAMC,qBAAqB,CAACC;QAC1Bb,SACEX,QAAQY,OAAO,CAACS;YACdA,MAAMN,KAAK,GAAGS;QAChB;IAEJ;IAEA,MAAMC,8BAA8B1B,YAClC,CAAC2B;QACCV,kBAAkBU;IACpB,GACA;QAACV;KAAkB;IAGrB,MAAMW,gBAAgB;QACpBC,UAAU;QACVC,OAAOnB,MAAMoB,OAAO,CAACC,IAAI,CAACC,SAAS;QACnCC,iBAAiBvB,MAAMoB,OAAO,CAACI,UAAU,CAACC,IAAI;QAC9CC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,YAAY;QACZC,YAAY;IACd;IAEA,qBACE,MAACvC;QAAMwC,SAAS;;0BACd,KAAC5C;gBACC6C,sBAAsBvC;gBACtBS,OAAOE;gBACPH,UAAUO;gBACVyB,OAAM;gBACNC,OAAO;;0BAET,KAACvC;gBACCO,OAAOG;gBACPJ,UAAUc;gBACVoB,QAAQ5B;gBACR6B,WAAW,CAACC;oBACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;wBAC7DH,MAAMI,cAAc;wBACpB5B,mBAAmBR;oBACrB;gBACF;gBACAqC,aAAY;;0BAEd,MAACC;;kCACC,KAACC;wBACCC,OAAO;4BACLC,QAAQ;4BACR5B,UAAU;4BACVC,OAAOnB,MAAMoB,OAAO,CAACC,IAAI,CAACC,SAAS;4BACnCyB,cAAc;wBAChB;kCACD;;kCAGD,KAACC;wBAAIH,OAAO5B;kCAAgBrB;;;;;;AAIpC"}
@@ -0,0 +1,4 @@
1
+ import { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';
2
+ import { LogQueryPlugin } from './log-query-plugin-interface';
3
+ export declare const getGreptimeDBLogData: LogQueryPlugin<GreptimeDBLogQuerySpec>['getLogData'];
4
+ //# sourceMappingURL=get-greptimedb-log-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-greptimedb-log-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-log-query/get-greptimedb-log-data.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAwD9D,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC,YAAY,CAkCrF,CAAC"}
@@ -0,0 +1,95 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { DEFAULT_DATASOURCE } from '../constants';
14
+ import { findTimeColumnIndex, normalizeRecords, replaceQueryVariables, toTimestampMs } from '../greptimedb-query-data-model';
15
+ function buildLogs(records) {
16
+ const columnSchemas = records?.schema?.column_schemas ?? [];
17
+ const rows = records?.rows ?? [];
18
+ if (!columnSchemas.length || !rows.length) {
19
+ return {
20
+ entries: [],
21
+ totalCount: 0
22
+ };
23
+ }
24
+ const timeIndex = findTimeColumnIndex(columnSchemas);
25
+ if (timeIndex === -1) {
26
+ return {
27
+ entries: [],
28
+ totalCount: 0
29
+ };
30
+ }
31
+ const entries = rows.map((row)=>{
32
+ const tsMs = toTimestampMs(row?.[timeIndex], columnSchemas[timeIndex]?.data_type);
33
+ if (tsMs === null) {
34
+ return null;
35
+ }
36
+ const labels = {};
37
+ const lineParts = [];
38
+ columnSchemas.forEach((col, index)=>{
39
+ if (index === timeIndex) {
40
+ return;
41
+ }
42
+ const value = row?.[index];
43
+ const stringValue = value === null || value === undefined ? '' : String(value);
44
+ labels[col.name] = stringValue;
45
+ lineParts.push(`${col.name}=${stringValue === '' ? '--' : stringValue}`);
46
+ });
47
+ return {
48
+ timestamp: Math.floor(tsMs / 1000),
49
+ labels,
50
+ line: lineParts.join(' ')
51
+ };
52
+ }).filter((entry)=>entry !== null);
53
+ return {
54
+ entries,
55
+ totalCount: entries.length
56
+ };
57
+ }
58
+ export const getGreptimeDBLogData = async (spec, context)=>{
59
+ if (!spec.query) {
60
+ return {
61
+ logs: {
62
+ entries: [],
63
+ totalCount: 0
64
+ },
65
+ timeRange: {
66
+ start: context.timeRange.start,
67
+ end: context.timeRange.end
68
+ }
69
+ };
70
+ }
71
+ const { start, end } = context.timeRange;
72
+ const query = replaceQueryVariables(spec.query, context.variableState, context.timeRange);
73
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_DATASOURCE);
74
+ const response = await client.query({
75
+ start: start.getTime().toString(),
76
+ end: end.getTime().toString(),
77
+ query
78
+ });
79
+ if (response.status === 'error') {
80
+ throw new Error(response.error ?? 'GreptimeDB query failed');
81
+ }
82
+ const records = normalizeRecords(response.data);
83
+ return {
84
+ timeRange: {
85
+ start,
86
+ end
87
+ },
88
+ logs: buildLogs(records),
89
+ metadata: {
90
+ executedQueryString: query
91
+ }
92
+ };
93
+ };
94
+
95
+ //# sourceMappingURL=get-greptimedb-log-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/get-greptimedb-log-data.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { LogData, LogEntry } from '@perses-dev/spec';\nimport { GreptimeDBClient, GreptimeDBQueryResponse } from '../../model/greptimedb-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport {\n findTimeColumnIndex,\n GreptimeDBRecords,\n normalizeRecords,\n replaceQueryVariables,\n toTimestampMs,\n} from '../greptimedb-query-data-model';\nimport { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';\nimport { LogQueryPlugin } from './log-query-plugin-interface';\n\nfunction buildLogs(records: GreptimeDBRecords | undefined): LogData {\n const columnSchemas = records?.schema?.column_schemas ?? [];\n const rows = records?.rows ?? [];\n\n if (!columnSchemas.length || !rows.length) {\n return {\n entries: [],\n totalCount: 0,\n };\n }\n\n const timeIndex = findTimeColumnIndex(columnSchemas);\n\n if (timeIndex === -1) {\n return {\n entries: [],\n totalCount: 0,\n };\n }\n\n const entries = rows\n .map((row) => {\n const tsMs = toTimestampMs(row?.[timeIndex], columnSchemas[timeIndex]?.data_type);\n if (tsMs === null) {\n return null;\n }\n\n const labels: Record<string, string> = {};\n const lineParts: string[] = [];\n\n columnSchemas.forEach((col, index) => {\n if (index === timeIndex) {\n return;\n }\n const value = row?.[index];\n const stringValue = value === null || value === undefined ? '' : String(value);\n labels[col.name] = stringValue;\n lineParts.push(`${col.name}=${stringValue === '' ? '--' : stringValue}`);\n });\n\n return {\n timestamp: Math.floor(tsMs / 1000),\n labels,\n line: lineParts.join(' '),\n } as LogEntry;\n })\n .filter((entry): entry is LogEntry => entry !== null);\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getGreptimeDBLogData: LogQueryPlugin<GreptimeDBLogQuerySpec>['getLogData'] = async (spec, context) => {\n if (!spec.query) {\n return {\n logs: { entries: [], totalCount: 0 },\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n };\n }\n\n const { start, end } = context.timeRange;\n const query = replaceQueryVariables(spec.query, context.variableState, context.timeRange);\n\n const client = (await context.datasourceStore.getDatasourceClient(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as GreptimeDBClient;\n\n const response: GreptimeDBQueryResponse = await client.query({\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n query,\n });\n\n if (response.status === 'error') {\n throw new Error(response.error ?? 'GreptimeDB query failed');\n }\n\n const records = normalizeRecords(response.data);\n\n return {\n timeRange: { start, end },\n logs: buildLogs(records),\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["DEFAULT_DATASOURCE","findTimeColumnIndex","normalizeRecords","replaceQueryVariables","toTimestampMs","buildLogs","records","columnSchemas","schema","column_schemas","rows","length","entries","totalCount","timeIndex","map","row","tsMs","data_type","labels","lineParts","forEach","col","index","value","stringValue","undefined","String","name","push","timestamp","Math","floor","line","join","filter","entry","getGreptimeDBLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","status","Error","error","data","metadata","executedQueryString"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,SAASA,kBAAkB,QAAQ,eAAe;AAClD,SACEC,mBAAmB,EAEnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,aAAa,QACR,iCAAiC;AAIxC,SAASC,UAAUC,OAAsC;IACvD,MAAMC,gBAAgBD,SAASE,QAAQC,kBAAkB,EAAE;IAC3D,MAAMC,OAAOJ,SAASI,QAAQ,EAAE;IAEhC,IAAI,CAACH,cAAcI,MAAM,IAAI,CAACD,KAAKC,MAAM,EAAE;QACzC,OAAO;YACLC,SAAS,EAAE;YACXC,YAAY;QACd;IACF;IAEA,MAAMC,YAAYb,oBAAoBM;IAEtC,IAAIO,cAAc,CAAC,GAAG;QACpB,OAAO;YACLF,SAAS,EAAE;YACXC,YAAY;QACd;IACF;IAEA,MAAMD,UAAUF,KACbK,GAAG,CAAC,CAACC;QACJ,MAAMC,OAAOb,cAAcY,KAAK,CAACF,UAAU,EAAEP,aAAa,CAACO,UAAU,EAAEI;QACvE,IAAID,SAAS,MAAM;YACjB,OAAO;QACT;QAEA,MAAME,SAAiC,CAAC;QACxC,MAAMC,YAAsB,EAAE;QAE9Bb,cAAcc,OAAO,CAAC,CAACC,KAAKC;YAC1B,IAAIA,UAAUT,WAAW;gBACvB;YACF;YACA,MAAMU,QAAQR,KAAK,CAACO,MAAM;YAC1B,MAAME,cAAcD,UAAU,QAAQA,UAAUE,YAAY,KAAKC,OAAOH;YACxEL,MAAM,CAACG,IAAIM,IAAI,CAAC,GAAGH;YACnBL,UAAUS,IAAI,CAAC,GAAGP,IAAIM,IAAI,CAAC,CAAC,EAAEH,gBAAgB,KAAK,OAAOA,aAAa;QACzE;QAEA,OAAO;YACLK,WAAWC,KAAKC,KAAK,CAACf,OAAO;YAC7BE;YACAc,MAAMb,UAAUc,IAAI,CAAC;QACvB;IACF,GACCC,MAAM,CAAC,CAACC,QAA6BA,UAAU;IAElD,OAAO;QACLxB;QACAC,YAAYD,QAAQD,MAAM;IAC5B;AACF;AAEA,OAAO,MAAM0B,uBAA6E,OAAOC,MAAMC;IACrG,IAAI,CAACD,KAAKE,KAAK,EAAE;QACf,OAAO;YACLC,MAAM;gBAAE7B,SAAS,EAAE;gBAAEC,YAAY;YAAE;YACnC6B,WAAW;gBAAEC,OAAOJ,QAAQG,SAAS,CAACC,KAAK;gBAAEC,KAAKL,QAAQG,SAAS,CAACE,GAAG;YAAC;QAC1E;IACF;IAEA,MAAM,EAAED,KAAK,EAAEC,GAAG,EAAE,GAAGL,QAAQG,SAAS;IACxC,MAAMF,QAAQrC,sBAAsBmC,KAAKE,KAAK,EAAED,QAAQM,aAAa,EAAEN,QAAQG,SAAS;IAExF,MAAMI,SAAU,MAAMP,QAAQQ,eAAe,CAACC,mBAAmB,CAC/DV,KAAKW,UAAU,IAAIjD;IAGrB,MAAMkD,WAAoC,MAAMJ,OAAON,KAAK,CAAC;QAC3DG,OAAOA,MAAMQ,OAAO,GAAGC,QAAQ;QAC/BR,KAAKA,IAAIO,OAAO,GAAGC,QAAQ;QAC3BZ;IACF;IAEA,IAAIU,SAASG,MAAM,KAAK,SAAS;QAC/B,MAAM,IAAIC,MAAMJ,SAASK,KAAK,IAAI;IACpC;IAEA,MAAMjD,UAAUJ,iBAAiBgD,SAASM,IAAI;IAE9C,OAAO;QACLd,WAAW;YAAEC;YAAOC;QAAI;QACxBH,MAAMpC,UAAUC;QAChBmD,UAAU;YACRC,qBAAqBlB;QACvB;IACF;AACF,EAAE"}
@@ -0,0 +1,6 @@
1
+ import { DatasourceSelector } from '@perses-dev/spec';
2
+ export interface GreptimeDBLogQuerySpec {
3
+ query: string;
4
+ datasource?: DatasourceSelector;
5
+ }
6
+ //# sourceMappingURL=greptimedb-log-query-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greptimedb-log-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-log-query/greptimedb-log-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC"}
@@ -0,0 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=greptimedb-log-query-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/greptimedb-log-query-types.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface GreptimeDBLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,WAGC"}
@@ -0,0 +1,5 @@
1
+ export * from './GreptimeDBLogQuery';
2
+ export * from './GreptimeDBLogQueryEditor';
3
+ export * from './get-greptimedb-log-data';
4
+ export * from './greptimedb-log-query-types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-log-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,18 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './GreptimeDBLogQuery';
14
+ export * from './GreptimeDBLogQueryEditor';
15
+ export * from './get-greptimedb-log-data';
16
+ export * from './greptimedb-log-query-types';
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './GreptimeDBLogQuery';\nexport * from './GreptimeDBLogQueryEditor';\nexport * from './get-greptimedb-log-data';\nexport * from './greptimedb-log-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,uBAAuB;AACrC,cAAc,6BAA6B;AAC3C,cAAc,4BAA4B;AAC1C,cAAc,+BAA+B"}
@@ -0,0 +1,23 @@
1
+ import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';
3
+ export interface LogQueryResult {
4
+ logs: LogData;
5
+ timeRange: AbsoluteTimeRange;
6
+ metadata?: {
7
+ executedQueryString: string;
8
+ };
9
+ }
10
+ export interface GreptimeDBQueryContext {
11
+ timeRange: AbsoluteTimeRange;
12
+ variableState: VariableStateMap;
13
+ datasourceStore: DatasourceStore;
14
+ }
15
+ type LogQueryPluginDependencies = {
16
+ variables?: string[];
17
+ };
18
+ export interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
19
+ getLogData: (spec: Spec, ctx: GreptimeDBQueryContext) => Promise<LogQueryResult>;
20
+ dependsOn?: (spec: Spec, ctx: GreptimeDBQueryContext) => LogQueryPluginDependencies;
21
+ }
22
+ export {};
23
+ //# 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/greptimedb-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,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;CAClC;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,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=log-query-plugin-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-log-query/log-query-plugin-interface.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\nimport { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface GreptimeDBQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: GreptimeDBQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: GreptimeDBQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,WAGC"}
@@ -0,0 +1,18 @@
1
+ import { VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { AbsoluteTimeRange } from '@perses-dev/spec';
3
+ import { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData } from '../model/greptimedb-data-types';
4
+ export type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData };
5
+ /**
6
+ * Supplement a variableState map with Perses builtin time-range variables
7
+ * (__from, __to, __range, __range_s, __range_ms).
8
+ *
9
+ * Background: the LogQuery runtime passes context.variableState via
10
+ * useVariableValues() which does NOT include builtin variables, unlike
11
+ * TimeSeriesQuery which uses useAllVariableValues(). This helper bridges
12
+ * that gap so both query types can rely on replaceVariables() uniformly.
13
+ */
14
+ export declare function replaceQueryVariables(query: string, variableState: VariableStateMap, timeRange: AbsoluteTimeRange): string;
15
+ export declare function toTimestampMs(value: unknown, dataType: string | undefined): number | null;
16
+ export declare function normalizeRecords(payload: GreptimeDBResponseData): GreptimeDBRecords | undefined;
17
+ export declare function findTimeColumnIndex(columnSchemas: GreptimeDBColumnSchema[]): number;
18
+ //# sourceMappingURL=greptimedb-query-data-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"greptimedb-query-data-model.d.ts","sourceRoot":"","sources":["../../../src/queries/greptimedb-query-data-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAoB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEnH,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;AAElF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,gBAAgB,EAC/B,SAAS,EAAE,iBAAiB,GAC3B,MAAM,CAYR;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CA4CzF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iBAAiB,GAAG,SAAS,CAI/F;AAED,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG,MAAM,CAkBnF"}