@perses-dev/greptimedb-plugin 0.1.0 → 0.2.0-beta.2

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 (230) hide show
  1. package/__mf/js/{GreptimeDB.d666b53a.js → GreptimeDB.f1e3a072.js} +4 -4
  2. package/__mf/js/async/121.caec175a.js +2 -0
  3. package/__mf/js/async/181.d4d87a1f.js +2 -0
  4. package/__mf/js/async/186.c1dea752.js +102 -0
  5. package/__mf/js/async/192.b9279059.js +1 -0
  6. package/__mf/js/async/2.dbc0a9c4.js +1 -0
  7. package/__mf/js/async/235.7a774edc.js +1 -0
  8. package/__mf/js/async/274.d5a294d9.js +2 -0
  9. package/__mf/js/async/356.21b667a3.js +1 -0
  10. package/__mf/js/async/392.201e515e.js +2 -0
  11. package/__mf/js/async/43.ebbb8652.js +2 -0
  12. package/__mf/js/async/440.f6c55d74.js +2 -0
  13. package/__mf/js/async/45.04388bc3.js +1 -0
  14. package/__mf/js/async/470.f896cf06.js +2 -0
  15. package/__mf/js/async/496.91780bef.js +1 -0
  16. package/__mf/js/async/529.6c76a9cd.js +43 -0
  17. package/__mf/js/async/{1589.a4d4fad9.js.LICENSE.txt → 529.6c76a9cd.js.LICENSE.txt} +41 -1
  18. package/__mf/js/async/562.15460f81.js +2 -0
  19. package/__mf/js/async/587.445bbdb5.js +1 -0
  20. package/__mf/js/async/588.2c301420.js +1 -0
  21. package/__mf/js/async/616.ef1089bf.js +1 -0
  22. package/__mf/js/async/628.6ea4a812.js +3 -0
  23. package/__mf/js/async/71.9f52cdd7.js +1 -0
  24. package/__mf/js/async/77.51ac6fa8.js +1 -0
  25. package/__mf/js/async/862.d29af04f.js +2 -0
  26. package/__mf/js/async/873.d5028ea7.js +1 -0
  27. package/__mf/js/async/941.6221d54d.js +2 -0
  28. package/__mf/js/async/944.89173f4a.js +10 -0
  29. package/__mf/js/async/968.6f0ebddf.js +1 -0
  30. package/__mf/js/async/978.4589faec.js +1 -0
  31. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.ec9b176f.js +2 -0
  32. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.96bef921.js +21 -0
  33. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.f4171877.js +21 -0
  34. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.e0ffd686.js +21 -0
  35. package/__mf/js/{main.7dfdd439.js → main.993845fa.js} +3 -3
  36. package/lib/bootstrap.js +2 -2
  37. package/lib/components/GreptimeDBQLEditor.d.ts +2 -2
  38. package/lib/components/GreptimeDBQLEditor.d.ts.map +1 -1
  39. package/lib/components/GreptimeDBQLEditor.js +3 -3
  40. package/lib/components/GreptimeDBQLEditor.js.map +1 -1
  41. package/lib/components/index.js +2 -2
  42. package/lib/components/index.js.map +1 -1
  43. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts +2 -2
  44. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.d.ts.map +1 -1
  45. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js +4 -4
  46. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasource.js.map +1 -1
  47. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts +2 -2
  48. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.d.ts.map +1 -1
  49. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +1 -1
  50. package/lib/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js.map +1 -1
  51. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts +4 -4
  52. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.d.ts.map +1 -1
  53. package/lib/datasources/greptimedb-datasource/greptimedb-datasource-types.js.map +1 -1
  54. package/lib/datasources/greptimedb-datasource/index.js +3 -3
  55. package/lib/datasources/greptimedb-datasource/index.js.map +1 -1
  56. package/lib/datasources/index.js +1 -1
  57. package/lib/datasources/index.js.map +1 -1
  58. package/lib/getPluginModule.d.ts +1 -1
  59. package/lib/getPluginModule.d.ts.map +1 -1
  60. package/lib/getPluginModule.js +3 -1
  61. package/lib/getPluginModule.js.map +1 -1
  62. package/lib/index-federation.js +1 -1
  63. package/lib/index.js +3 -3
  64. package/lib/index.js.map +1 -1
  65. package/lib/model/greptimedb-client.d.ts +3 -3
  66. package/lib/model/greptimedb-client.d.ts.map +1 -1
  67. package/lib/model/greptimedb-client.js +4 -2
  68. package/lib/model/greptimedb-client.js.map +1 -1
  69. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts +2 -2
  70. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.d.ts.map +1 -1
  71. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js +4 -6
  72. package/lib/queries/greptimedb-log-query/GreptimeDBLogQuery.js.map +1 -1
  73. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts +3 -3
  74. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.d.ts.map +1 -1
  75. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +8 -8
  76. package/lib/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js.map +1 -1
  77. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts +2 -2
  78. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.d.ts.map +1 -1
  79. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js +2 -2
  80. package/lib/queries/greptimedb-log-query/get-greptimedb-log-data.js.map +1 -1
  81. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts +1 -1
  82. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.d.ts.map +1 -1
  83. package/lib/queries/greptimedb-log-query/greptimedb-log-query-types.js.map +1 -1
  84. package/lib/queries/greptimedb-log-query/index.js +4 -4
  85. package/lib/queries/greptimedb-log-query/index.js.map +1 -1
  86. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts +2 -2
  87. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.d.ts.map +1 -1
  88. package/lib/queries/greptimedb-log-query/log-query-plugin-interface.js.map +1 -1
  89. package/lib/queries/greptimedb-query-data-model.d.ts +3 -3
  90. package/lib/queries/greptimedb-query-data-model.d.ts.map +1 -1
  91. package/lib/queries/greptimedb-query-data-model.js +4 -4
  92. package/lib/queries/greptimedb-query-data-model.js.map +1 -1
  93. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts +2 -2
  94. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.d.ts.map +1 -1
  95. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js +4 -6
  96. package/lib/queries/greptimedb-time-series-query/GreptimeDBQuery.js.map +1 -1
  97. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts +3 -3
  98. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.d.ts.map +1 -1
  99. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +8 -8
  100. package/lib/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js.map +1 -1
  101. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts +2 -2
  102. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.d.ts.map +1 -1
  103. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js +3 -5
  104. package/lib/queries/greptimedb-time-series-query/get-greptimedb-data.js.map +1 -1
  105. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts +1 -1
  106. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.d.ts.map +1 -1
  107. package/lib/queries/greptimedb-time-series-query/greptimedb-query-types.js.map +1 -1
  108. package/lib/queries/greptimedb-time-series-query/index.js +4 -4
  109. package/lib/queries/greptimedb-time-series-query/index.js.map +1 -1
  110. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts +2 -2
  111. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.d.ts.map +1 -1
  112. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +3 -3
  113. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js.map +1 -1
  114. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts +3 -3
  115. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.d.ts.map +1 -1
  116. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +7 -7
  117. package/lib/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js.map +1 -1
  118. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts +2 -2
  119. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.d.ts.map +1 -1
  120. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +6 -6
  121. package/lib/queries/greptimedb-trace-query/get-greptimedb-trace-data.js.map +1 -1
  122. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts +1 -1
  123. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.d.ts.map +1 -1
  124. package/lib/queries/greptimedb-trace-query/greptimedb-trace-query-types.js.map +1 -1
  125. package/lib/queries/greptimedb-trace-query/index.js +4 -4
  126. package/lib/queries/greptimedb-trace-query/index.js.map +1 -1
  127. package/lib/queries/index.js +3 -3
  128. package/lib/queries/index.js.map +1 -1
  129. package/lib/queries/query-editor-model.js +2 -2
  130. package/lib/queries/query-editor-model.js.map +1 -1
  131. package/lib/setup-tests.d.ts +1 -1
  132. package/lib/setup-tests.d.ts.map +1 -1
  133. package/lib/setup-tests.js +2 -2
  134. package/lib/setup-tests.js.map +1 -1
  135. package/mf-manifest.json +68 -100
  136. package/mf-stats.json +68 -104
  137. package/package.json +20 -12
  138. package/__mf/js/async/1589.a4d4fad9.js +0 -2
  139. package/__mf/js/async/1616.d071703e.js +0 -1
  140. package/__mf/js/async/2043.e37a8242.js +0 -2
  141. package/__mf/js/async/2386.84002e8c.js +0 -2
  142. package/__mf/js/async/3181.9e8e9ef5.js +0 -2
  143. package/__mf/js/async/392.614cab68.js +0 -2
  144. package/__mf/js/async/3944.f35af5a7.js +0 -10
  145. package/__mf/js/async/3981.66746f5c.js +0 -3
  146. package/__mf/js/async/4121.f8820bd7.js +0 -2
  147. package/__mf/js/async/4233.a3ff3ed2.js +0 -7
  148. package/__mf/js/async/4233.a3ff3ed2.js.LICENSE.txt +0 -39
  149. package/__mf/js/async/4475.52c68e1f.js +0 -101
  150. package/__mf/js/async/5002.ff5efed5.js +0 -1
  151. package/__mf/js/async/5071.72c3afda.js +0 -1
  152. package/__mf/js/async/5440.f8cb71c0.js +0 -2
  153. package/__mf/js/async/5481.0c2e941f.js +0 -2
  154. package/__mf/js/async/5562.fc9fccc9.js +0 -2
  155. package/__mf/js/async/5587.82a12128.js +0 -1
  156. package/__mf/js/async/6045.2b2dd0f6.js +0 -1
  157. package/__mf/js/async/6274.b682460a.js +0 -2
  158. package/__mf/js/async/629.e085c447.js +0 -1
  159. package/__mf/js/async/7177.746de250.js +0 -1
  160. package/__mf/js/async/7192.8effb0f3.js +0 -1
  161. package/__mf/js/async/7968.d3024d8d.js +0 -1
  162. package/__mf/js/async/7978.f72fcb59.js +0 -1
  163. package/__mf/js/async/7984.802dfa3c.js +0 -22
  164. package/__mf/js/async/7984.802dfa3c.js.LICENSE.txt +0 -19
  165. package/__mf/js/async/8356.42f66891.js +0 -1
  166. package/__mf/js/async/8470.8d2d3f35.js +0 -2
  167. package/__mf/js/async/873.9041549c.js +0 -1
  168. package/__mf/js/async/9235.8d75321e.js +0 -1
  169. package/__mf/js/async/941.6703c1a7.js +0 -2
  170. package/__mf/js/async/9558.97ad4633.js +0 -1
  171. package/__mf/js/async/9588.925f1ab4.js +0 -1
  172. package/__mf/js/async/9877.a7b7fb44.js +0 -38
  173. package/__mf/js/async/__federation_expose_GreptimeDBDatasource.7d12e7b8.js +0 -2
  174. package/__mf/js/async/__federation_expose_GreptimeDBLogQuery.f7fa9b26.js +0 -21
  175. package/__mf/js/async/__federation_expose_GreptimeDBTimeSeriesQuery.867c743e.js +0 -21
  176. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.a1f7328d.js +0 -21
  177. package/__mf/js/async/__federation_expose_GreptimeDBTraceQuery.a1f7328d.js.LICENSE.txt +0 -9
  178. package/lib/cjs/bootstrap.js +0 -26
  179. package/lib/cjs/components/GreptimeDBQLEditor.js +0 -72
  180. package/lib/cjs/components/constants.js +0 -42
  181. package/lib/cjs/components/index.js +0 -31
  182. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasource.js +0 -53
  183. package/lib/cjs/datasources/greptimedb-datasource/GreptimeDBDatasourceEditor.js +0 -51
  184. package/lib/cjs/datasources/greptimedb-datasource/greptimedb-datasource-types.js +0 -16
  185. package/lib/cjs/datasources/greptimedb-datasource/index.js +0 -32
  186. package/lib/cjs/datasources/index.js +0 -30
  187. package/lib/cjs/env.d.js +0 -14
  188. package/lib/cjs/getPluginModule.js +0 -39
  189. package/lib/cjs/index-federation.js +0 -55
  190. package/lib/cjs/index.js +0 -38
  191. package/lib/cjs/model/greptimedb-client.js +0 -76
  192. package/lib/cjs/model/greptimedb-data-types.js +0 -16
  193. package/lib/cjs/queries/constants.js +0 -34
  194. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQuery.js +0 -43
  195. package/lib/cjs/queries/greptimedb-log-query/GreptimeDBLogQueryEditor.js +0 -108
  196. package/lib/cjs/queries/greptimedb-log-query/get-greptimedb-log-data.js +0 -103
  197. package/lib/cjs/queries/greptimedb-log-query/greptimedb-log-query-types.js +0 -16
  198. package/lib/cjs/queries/greptimedb-log-query/index.js +0 -33
  199. package/lib/cjs/queries/greptimedb-log-query/log-query-plugin-interface.js +0 -16
  200. package/lib/cjs/queries/greptimedb-query-data-model.js +0 -152
  201. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQuery.js +0 -43
  202. package/lib/cjs/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.js +0 -107
  203. package/lib/cjs/queries/greptimedb-time-series-query/get-greptimedb-data.js +0 -184
  204. package/lib/cjs/queries/greptimedb-time-series-query/greptimedb-query-types.js +0 -16
  205. package/lib/cjs/queries/greptimedb-time-series-query/index.js +0 -33
  206. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQuery.js +0 -40
  207. package/lib/cjs/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.js +0 -79
  208. package/lib/cjs/queries/greptimedb-trace-query/get-greptimedb-trace-data.js +0 -518
  209. package/lib/cjs/queries/greptimedb-trace-query/greptimedb-trace-query-types.js +0 -16
  210. package/lib/cjs/queries/greptimedb-trace-query/index.js +0 -33
  211. package/lib/cjs/queries/greptimedb-trace-query/trace-query-sql.js +0 -25
  212. package/lib/cjs/queries/index.js +0 -32
  213. package/lib/cjs/queries/query-editor-model.js +0 -47
  214. package/lib/cjs/setup-tests.js +0 -19
  215. /package/__mf/css/async/{4233.85c2cbf6.css → 529.85c2cbf6.css} +0 -0
  216. /package/__mf/js/async/{4121.f8820bd7.js.LICENSE.txt → 121.caec175a.js.LICENSE.txt} +0 -0
  217. /package/__mf/js/async/{2386.84002e8c.js.LICENSE.txt → 181.d4d87a1f.js.LICENSE.txt} +0 -0
  218. /package/__mf/js/async/{6274.b682460a.js.LICENSE.txt → 274.d5a294d9.js.LICENSE.txt} +0 -0
  219. /package/__mf/js/async/{392.614cab68.js.LICENSE.txt → 392.201e515e.js.LICENSE.txt} +0 -0
  220. /package/__mf/js/async/{2043.e37a8242.js.LICENSE.txt → 43.ebbb8652.js.LICENSE.txt} +0 -0
  221. /package/__mf/js/async/{5440.f8cb71c0.js.LICENSE.txt → 440.f6c55d74.js.LICENSE.txt} +0 -0
  222. /package/__mf/js/async/{8470.8d2d3f35.js.LICENSE.txt → 470.f896cf06.js.LICENSE.txt} +0 -0
  223. /package/__mf/js/async/{3181.9e8e9ef5.js.LICENSE.txt → 562.15460f81.js.LICENSE.txt} +0 -0
  224. /package/__mf/js/async/{5481.0c2e941f.js.LICENSE.txt → 862.d29af04f.js.LICENSE.txt} +0 -0
  225. /package/__mf/js/async/{5562.fc9fccc9.js.LICENSE.txt → 941.6221d54d.js.LICENSE.txt} +0 -0
  226. /package/__mf/js/async/{3944.f35af5a7.js.LICENSE.txt → 944.89173f4a.js.LICENSE.txt} +0 -0
  227. /package/__mf/js/async/{941.6703c1a7.js.LICENSE.txt → __federation_expose_GreptimeDBDatasource.ec9b176f.js.LICENSE.txt} +0 -0
  228. /package/__mf/js/async/{__federation_expose_GreptimeDBDatasource.7d12e7b8.js.LICENSE.txt → __federation_expose_GreptimeDBLogQuery.96bef921.js.LICENSE.txt} +0 -0
  229. /package/__mf/js/async/{__federation_expose_GreptimeDBLogQuery.f7fa9b26.js.LICENSE.txt → __federation_expose_GreptimeDBTimeSeriesQuery.f4171877.js.LICENSE.txt} +0 -0
  230. /package/__mf/js/async/{__federation_expose_GreptimeDBTimeSeriesQuery.867c743e.js.LICENSE.txt → __federation_expose_GreptimeDBTraceQuery.e0ffd686.js.LICENSE.txt} +0 -0
@@ -1 +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,c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,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"}
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 type { LogData, LogEntry } from '@perses-dev/spec';\n\nimport type { GreptimeDBClient, GreptimeDBQueryResponse } from '../../model/greptimedb-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport type { GreptimeDBRecords } from '../greptimedb-query-data-model';\nimport {\n findTimeColumnIndex,\n normalizeRecords,\n replaceQueryVariables,\n toTimestampMs,\n} from '../greptimedb-query-data-model';\nimport type { GreptimeDBLogQuerySpec } from './greptimedb-log-query-types';\nimport type { 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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B;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"}
@@ -1,4 +1,4 @@
1
- import { DatasourceSelector } from '@perses-dev/spec';
1
+ import type { DatasourceSelector } from '@perses-dev/spec';
2
2
  export interface GreptimeDBLogQuerySpec {
3
3
  query: string;
4
4
  datasource?: DatasourceSelector;
@@ -1 +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"}
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,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC"}
@@ -1 +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"}
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 type { 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"}
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './GreptimeDBLogQuery';
14
- export * from './GreptimeDBLogQueryEditor';
15
- export * from './get-greptimedb-log-data';
16
- export * from './greptimedb-log-query-types';
13
+ export * from "./GreptimeDBLogQuery.js";
14
+ export * from "./GreptimeDBLogQueryEditor.js";
15
+ export * from "./get-greptimedb-log-data.js";
16
+ export * from "./greptimedb-log-query-types.js";
17
17
 
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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,0BAAuB;AACrC,cAAc,gCAA6B;AAC3C,cAAc,+BAA4B;AAC1C,cAAc,kCAA+B"}
@@ -1,5 +1,5 @@
1
- import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
- import { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';
1
+ import type { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import type { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';
3
3
  export interface LogQueryResult {
4
4
  logs: LogData;
5
5
  timeRange: AbsoluteTimeRange;
@@ -1 +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"}
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,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhF,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"}
@@ -1 +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"}
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 type { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\nimport type { 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"}
@@ -1,6 +1,6 @@
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';
1
+ import type { VariableStateMap } from '@perses-dev/plugin-system';
2
+ import type { AbsoluteTimeRange } from '@perses-dev/spec';
3
+ import type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData } from '../model/greptimedb-data-types';
4
4
  export type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData };
5
5
  /**
6
6
  * Supplement a variableState map with Perses builtin time-range variables
@@ -1 +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"}
1
+ {"version":3,"file":"greptimedb-query-data-model.d.ts","sourceRoot":"","sources":["../../../src/queries/greptimedb-query-data-model.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExH,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"}
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { replaceVariables } from '@perses-dev/plugin-system';
13
+ import { replaceVariables } from "@perses-dev/plugin-system";
14
14
  /**
15
15
  * Supplement a variableState map with Perses builtin time-range variables
16
16
  * (__from, __to, __range, __range_s, __range_ms).
@@ -124,13 +124,13 @@ export function findTimeColumnIndex(columnSchemas) {
124
124
  timeIndex = columnSchemas.findIndex((col)=>col.name === selectedColumn.name);
125
125
  }
126
126
  if (timeIndex === -1) {
127
- const fallbackColumns = [
127
+ const fallbackColumns = new Set([
128
128
  'greptime_timestamp',
129
129
  'timestamp',
130
130
  'ts',
131
131
  'time'
132
- ];
133
- timeIndex = columnSchemas.findIndex((col)=>fallbackColumns.includes(col.name.toLowerCase()));
132
+ ]);
133
+ timeIndex = columnSchemas.findIndex((col)=>fallbackColumns.has(col.name.toLowerCase()));
134
134
  }
135
135
  return timeIndex;
136
136
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/queries/greptimedb-query-data-model.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 { replaceVariables, VariableStateMap } from '@perses-dev/plugin-system';\nimport { AbsoluteTimeRange } from '@perses-dev/spec';\nimport { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData } from '../model/greptimedb-data-types';\n\nexport type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData };\n\n/**\n * Supplement a variableState map with Perses builtin time-range variables\n * (__from, __to, __range, __range_s, __range_ms).\n *\n * Background: the LogQuery runtime passes context.variableState via\n * useVariableValues() which does NOT include builtin variables, unlike\n * TimeSeriesQuery which uses useAllVariableValues(). This helper bridges\n * that gap so both query types can rely on replaceVariables() uniformly.\n */\nexport function replaceQueryVariables(\n query: string,\n variableState: VariableStateMap,\n timeRange: AbsoluteTimeRange\n): string {\n const { start, end } = timeRange;\n const rangeMs = end.valueOf() - start.valueOf();\n const builtinState: VariableStateMap = {\n __from: { value: start.valueOf().toString(), loading: false },\n __to: { value: end.valueOf().toString(), loading: false },\n __range_ms: { value: rangeMs.toString(), loading: false },\n __range_s: { value: Math.floor(rangeMs / 1000).toString(), loading: false },\n __range: { value: formatDuration(rangeMs), loading: false },\n };\n // User-defined variables take precedence over builtins (matching framework behaviour).\n return replaceVariables(query, { ...builtinState, ...variableState });\n}\n\n/** Format a millisecond duration as a human-readable Prometheus-style string, e.g. \"1h5m30s\". */\nfunction formatDuration(ms: number): string {\n const totalSeconds = Math.floor(ms / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n let result = '';\n if (hours > 0) result += `${hours}h`;\n if (minutes > 0) result += `${minutes}m`;\n if (seconds > 0 || result === '') result += `${seconds}s`;\n return result;\n}\n\nfunction normalizeTimestampType(dataType: string | undefined): string | null {\n if (!dataType) {\n return null;\n }\n return dataType.toLowerCase();\n}\n\nexport function toTimestampMs(value: unknown, dataType: string | undefined): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n const normalizedType = normalizeTimestampType(dataType);\n\n if (typeof value === 'number') {\n if (normalizedType) {\n if (normalizedType.includes('nanosecond')) {\n return Math.floor(value / 1_000_000);\n }\n if (normalizedType.includes('microsecond')) {\n return Math.floor(value / 1_000);\n }\n if (normalizedType.includes('millisecond')) {\n return value;\n }\n if (normalizedType.includes('second')) {\n return value * 1000;\n }\n }\n if (value > 1_000_000_000_000_000) {\n return Math.floor(value / 1_000_000);\n }\n if (value > 1_000_000_000_000) {\n return value;\n }\n if (value > 1_000_000_000) {\n return value * 1000;\n }\n return value;\n }\n\n if (typeof value === 'string') {\n const asNumber = Number(value);\n if (!Number.isNaN(asNumber)) {\n return toTimestampMs(asNumber, dataType);\n }\n }\n\n const asDate = new Date(value as string);\n const ts = asDate.getTime();\n return Number.isNaN(ts) ? null : ts;\n}\n\nexport function normalizeRecords(payload: GreptimeDBResponseData): GreptimeDBRecords | undefined {\n if (!payload || typeof payload !== 'object') return undefined;\n\n return payload.output?.[0]?.records;\n}\n\nexport function findTimeColumnIndex(columnSchemas: GreptimeDBColumnSchema[]): number {\n let timeIndex = -1;\n const timestampColumns = columnSchemas.filter((col) => {\n const normalizedType = normalizeTimestampType(col.data_type);\n return normalizedType !== null && normalizedType.startsWith('timestamp');\n });\n if (timestampColumns.length > 0) {\n const semanticTimestamp = timestampColumns.find((col) => col.semantic_type?.toLowerCase() === 'timestamp');\n const selectedColumn = semanticTimestamp ?? timestampColumns[0]!;\n timeIndex = columnSchemas.findIndex((col) => col.name === selectedColumn.name);\n }\n\n if (timeIndex === -1) {\n const fallbackColumns = ['greptime_timestamp', 'timestamp', 'ts', 'time'];\n timeIndex = columnSchemas.findIndex((col) => fallbackColumns.includes(col.name.toLowerCase()));\n }\n\n return timeIndex;\n}\n"],"names":["replaceVariables","replaceQueryVariables","query","variableState","timeRange","start","end","rangeMs","valueOf","builtinState","__from","value","toString","loading","__to","__range_ms","__range_s","Math","floor","__range","formatDuration","ms","totalSeconds","hours","minutes","seconds","result","normalizeTimestampType","dataType","toLowerCase","toTimestampMs","undefined","normalizedType","includes","asNumber","Number","isNaN","asDate","Date","ts","getTime","normalizeRecords","payload","output","records","findTimeColumnIndex","columnSchemas","timeIndex","timestampColumns","filter","col","data_type","startsWith","length","semanticTimestamp","find","semantic_type","selectedColumn","findIndex","name","fallbackColumns"],"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,gBAAgB,QAA0B,4BAA4B;AAM/E;;;;;;;;CAQC,GACD,OAAO,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AAOnB,mBAAmB,QAAQA,eAAeoB,UAAU,CAAC;IAC9D;IACA,IAAIJ,iBAAiBK,MAAM,GAAG,GAAG;QAC/B,MAAMC,oBAAoBN,iBAAiBO,IAAI,CAAC,CAACL,MAAQA,IAAIM,aAAa,EAAE3B,kBAAkB;QAC9F,MAAM4B,iBAAiBH,qBAAqBN,gBAAgB,CAAC,EAAE;QAC/DD,YAAYD,cAAcY,SAAS,CAAC,CAACR,MAAQA,IAAIS,IAAI,KAAKF,eAAeE,IAAI;IAC/E;IAEA,IAAIZ,cAAc,CAAC,GAAG;QACpB,MAAMa,kBAAkB;YAAC;YAAsB;YAAa;YAAM;SAAO;QACzEb,YAAYD,cAAcY,SAAS,CAAC,CAACR,MAAQU,gBAAgB3B,QAAQ,CAACiB,IAAIS,IAAI,CAAC9B,WAAW;IAC5F;IAEA,OAAOkB;AACT"}
1
+ {"version":3,"sources":["../../../src/queries/greptimedb-query-data-model.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { VariableStateMap } from '@perses-dev/plugin-system';\nimport { replaceVariables } from '@perses-dev/plugin-system';\nimport type { AbsoluteTimeRange } from '@perses-dev/spec';\n\nimport type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData } from '../model/greptimedb-data-types';\n\nexport type { GreptimeDBColumnSchema, GreptimeDBRecords, GreptimeDBResponseData };\n\n/**\n * Supplement a variableState map with Perses builtin time-range variables\n * (__from, __to, __range, __range_s, __range_ms).\n *\n * Background: the LogQuery runtime passes context.variableState via\n * useVariableValues() which does NOT include builtin variables, unlike\n * TimeSeriesQuery which uses useAllVariableValues(). This helper bridges\n * that gap so both query types can rely on replaceVariables() uniformly.\n */\nexport function replaceQueryVariables(\n query: string,\n variableState: VariableStateMap,\n timeRange: AbsoluteTimeRange,\n): string {\n const { start, end } = timeRange;\n const rangeMs = end.valueOf() - start.valueOf();\n const builtinState: VariableStateMap = {\n __from: { value: start.valueOf().toString(), loading: false },\n __to: { value: end.valueOf().toString(), loading: false },\n __range_ms: { value: rangeMs.toString(), loading: false },\n __range_s: { value: Math.floor(rangeMs / 1000).toString(), loading: false },\n __range: { value: formatDuration(rangeMs), loading: false },\n };\n // User-defined variables take precedence over builtins (matching framework behaviour).\n return replaceVariables(query, { ...builtinState, ...variableState });\n}\n\n/** Format a millisecond duration as a human-readable Prometheus-style string, e.g. \"1h5m30s\". */\nfunction formatDuration(ms: number): string {\n const totalSeconds = Math.floor(ms / 1000);\n const hours = Math.floor(totalSeconds / 3600);\n const minutes = Math.floor((totalSeconds % 3600) / 60);\n const seconds = totalSeconds % 60;\n let result = '';\n if (hours > 0) result += `${hours}h`;\n if (minutes > 0) result += `${minutes}m`;\n if (seconds > 0 || result === '') result += `${seconds}s`;\n return result;\n}\n\nfunction normalizeTimestampType(dataType: string | undefined): string | null {\n if (!dataType) {\n return null;\n }\n return dataType.toLowerCase();\n}\n\nexport function toTimestampMs(value: unknown, dataType: string | undefined): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n\n const normalizedType = normalizeTimestampType(dataType);\n\n if (typeof value === 'number') {\n if (normalizedType) {\n if (normalizedType.includes('nanosecond')) {\n return Math.floor(value / 1_000_000);\n }\n if (normalizedType.includes('microsecond')) {\n return Math.floor(value / 1_000);\n }\n if (normalizedType.includes('millisecond')) {\n return value;\n }\n if (normalizedType.includes('second')) {\n return value * 1000;\n }\n }\n if (value > 1_000_000_000_000_000) {\n return Math.floor(value / 1_000_000);\n }\n if (value > 1_000_000_000_000) {\n return value;\n }\n if (value > 1_000_000_000) {\n return value * 1000;\n }\n return value;\n }\n\n if (typeof value === 'string') {\n const asNumber = Number(value);\n if (!Number.isNaN(asNumber)) {\n return toTimestampMs(asNumber, dataType);\n }\n }\n\n const asDate = new Date(value as string);\n const ts = asDate.getTime();\n return Number.isNaN(ts) ? null : ts;\n}\n\nexport function normalizeRecords(payload: GreptimeDBResponseData): GreptimeDBRecords | undefined {\n if (!payload || typeof payload !== 'object') return undefined;\n\n return payload.output?.[0]?.records;\n}\n\nexport function findTimeColumnIndex(columnSchemas: GreptimeDBColumnSchema[]): number {\n let timeIndex = -1;\n const timestampColumns = columnSchemas.filter((col) => {\n const normalizedType = normalizeTimestampType(col.data_type);\n return normalizedType !== null && normalizedType.startsWith('timestamp');\n });\n if (timestampColumns.length > 0) {\n const semanticTimestamp = timestampColumns.find((col) => col.semantic_type?.toLowerCase() === 'timestamp');\n const selectedColumn = semanticTimestamp ?? timestampColumns[0]!;\n timeIndex = columnSchemas.findIndex((col) => col.name === selectedColumn.name);\n }\n\n if (timeIndex === -1) {\n const fallbackColumns = new Set(['greptime_timestamp', 'timestamp', 'ts', 'time']);\n timeIndex = columnSchemas.findIndex((col) => fallbackColumns.has(col.name.toLowerCase()));\n }\n\n return timeIndex;\n}\n"],"names":["replaceVariables","replaceQueryVariables","query","variableState","timeRange","start","end","rangeMs","valueOf","builtinState","__from","value","toString","loading","__to","__range_ms","__range_s","Math","floor","__range","formatDuration","ms","totalSeconds","hours","minutes","seconds","result","normalizeTimestampType","dataType","toLowerCase","toTimestampMs","undefined","normalizedType","includes","asNumber","Number","isNaN","asDate","Date","ts","getTime","normalizeRecords","payload","output","records","findTimeColumnIndex","columnSchemas","timeIndex","timestampColumns","filter","col","data_type","startsWith","length","semanticTimestamp","find","semantic_type","selectedColumn","findIndex","name","fallbackColumns","Set","has"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AA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AMC,mBAAmBF,cAAcG,MAAM,CAAC,CAACC;QAC7C,MAAMlB,iBAAiBL,uBAAuBuB,IAAIC,SAAS;QAC3D,OAAOnB,mBAAmB,QAAQA,eAAeoB,UAAU,CAAC;IAC9D;IACA,IAAIJ,iBAAiBK,MAAM,GAAG,GAAG;QAC/B,MAAMC,oBAAoBN,iBAAiBO,IAAI,CAAC,CAACL,MAAQA,IAAIM,aAAa,EAAE3B,kBAAkB;QAC9F,MAAM4B,iBAAiBH,qBAAqBN,gBAAgB,CAAC,EAAE;QAC/DD,YAAYD,cAAcY,SAAS,CAAC,CAACR,MAAQA,IAAIS,IAAI,KAAKF,eAAeE,IAAI;IAC/E;IAEA,IAAIZ,cAAc,CAAC,GAAG;QACpB,MAAMa,kBAAkB,IAAIC,IAAI;YAAC;YAAsB;YAAa;YAAM;SAAO;QACjFd,YAAYD,cAAcY,SAAS,CAAC,CAACR,MAAQU,gBAAgBE,GAAG,CAACZ,IAAIS,IAAI,CAAC9B,WAAW;IACvF;IAEA,OAAOkB;AACT"}
@@ -1,4 +1,4 @@
1
- import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
- import { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
1
+ import type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
3
3
  export declare const GreptimeDBTimeSeriesQuery: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec>;
4
4
  //# sourceMappingURL=GreptimeDBQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GreptimeDBQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAkB,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAIzE,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAa1F,CAAC"}
1
+ {"version":3,"file":"GreptimeDBQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAIvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAG9E,eAAO,MAAM,yBAAyB,EAAE,qBAAqB,CAAC,6BAA6B,CAa1F,CAAC"}
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { parseVariables } from '@perses-dev/plugin-system';
14
- import { getTimeSeriesData } from './get-greptimedb-data';
15
- import { GreptimeDBTimeSeriesQueryEditor } from './GreptimeDBQueryEditor';
13
+ import { parseVariables } from "@perses-dev/plugin-system";
14
+ import { getTimeSeriesData } from "./get-greptimedb-data.js";
15
+ import { GreptimeDBTimeSeriesQueryEditor } from "./GreptimeDBQueryEditor.js";
16
16
  export const GreptimeDBTimeSeriesQuery = {
17
17
  getTimeSeriesData,
18
18
  OptionsEditorComponent: GreptimeDBTimeSeriesQueryEditor,
@@ -22,9 +22,7 @@ export const GreptimeDBTimeSeriesQuery = {
22
22
  dependsOn: (spec)=>{
23
23
  const queryVariables = parseVariables(spec.query);
24
24
  const allVariables = [
25
- ...new Set([
26
- ...queryVariables
27
- ])
25
+ ...new Set(queryVariables)
28
26
  ];
29
27
  return {
30
28
  variables: allVariables
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQuery.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, TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\nimport { getTimeSeriesData } from './get-greptimedb-data';\nimport { GreptimeDBTimeSeriesQueryEditor } from './GreptimeDBQueryEditor';\n\nexport const GreptimeDBTimeSeriesQuery: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n OptionsEditorComponent: GreptimeDBTimeSeriesQueryEditor,\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","getTimeSeriesData","GreptimeDBTimeSeriesQueryEditor","GreptimeDBTimeSeriesQuery","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,QAA+B,4BAA4B;AAElF,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,+BAA+B,QAAQ,0BAA0B;AAE1E,OAAO,MAAMC,4BAAkF;IAC7FF;IACAG,wBAAwBF;IACxBG,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;QACT,CAAA;IACAC,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"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQuery.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 type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\nimport { parseVariables } from '@perses-dev/plugin-system';\n\nimport { getTimeSeriesData } from './get-greptimedb-data';\nimport type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\nimport { GreptimeDBTimeSeriesQueryEditor } from './GreptimeDBQueryEditor';\n\nexport const GreptimeDBTimeSeriesQuery: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec> = {\n getTimeSeriesData,\n OptionsEditorComponent: GreptimeDBTimeSeriesQueryEditor,\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","getTimeSeriesData","GreptimeDBTimeSeriesQueryEditor","GreptimeDBTimeSeriesQuery","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;AAGjC,SAASA,cAAc,QAAQ,4BAA4B;AAE3D,SAASC,iBAAiB,QAAQ,2BAAwB;AAE1D,SAASC,+BAA+B,QAAQ,6BAA0B;AAE1E,OAAO,MAAMC,4BAAkF;IAC7FF;IACAG,wBAAwBF;IACxBG,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;QACT,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,iBAAiBT,eAAeQ,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAIF;SAAgB;QACjD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
@@ -1,6 +1,6 @@
1
- import { OptionsEditorProps } from '@perses-dev/plugin-system';
2
- import { ReactElement } from 'react';
3
- import { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
1
+ import type { OptionsEditorProps } from '@perses-dev/plugin-system';
2
+ import type { ReactElement } from 'react';
3
+ import type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
4
4
  type GreptimeDBTimeSeriesQueryEditorProps = OptionsEditorProps<GreptimeDBTimeSeriesQuerySpec>;
5
5
  export declare function GreptimeDBTimeSeriesQueryEditor(props: GreptimeDBTimeSeriesQueryEditorProps): ReactElement;
6
6
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"GreptimeDBQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAOlD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CAiFzG"}
1
+ {"version":3,"file":"GreptimeDBQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAO1C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAE9E,KAAK,oCAAoC,GAAG,kBAAkB,CAAC,6BAA6B,CAAC,CAAC;AAE9F,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,oCAAoC,GAAG,YAAY,CAiFzG"}
@@ -11,14 +11,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
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 } 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';
14
+ import { Stack } from "@mui/material";
15
+ import { DatasourceSelect, isVariableDatasource } from "@perses-dev/plugin-system";
16
+ import { produce } from "immer";
17
+ import { useCallback } from "react";
18
+ import { GreptimeDBQLEditor } from "../../components/index.js";
19
+ import { queryExample } from "../../components/constants.js";
20
+ import { DATASOURCE_KIND, DEFAULT_DATASOURCE } from "../constants.js";
21
+ import { useQueryState } from "../query-editor-model.js";
22
22
  export function GreptimeDBTimeSeriesQueryEditor(props) {
23
23
  const { onChange, value } = props;
24
24
  const { datasource } = value;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.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 } 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 { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\n\ntype GreptimeDBTimeSeriesQueryEditorProps = OptionsEditorProps<GreptimeDBTimeSeriesQuerySpec>;\n\nexport function GreptimeDBTimeSeriesQueryEditor(props: GreptimeDBTimeSeriesQueryEditorProps): ReactElement {\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: '#777',\n backgroundColor: '#f5f5f5',\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: '#666',\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","DATASOURCE_KIND","DEFAULT_DATASOURCE","GreptimeDBQLEditor","queryExample","useQueryState","GreptimeDBTimeSeriesQueryEditor","props","onChange","value","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","queryValue","handleGreptimeDBQueryChange","e","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,+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,QAAQ,gBAAgB;AACtC,SAASC,e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B;gBACF;gBACAgC,aAAY;;0BAEd,MAACC;;kCACC,KAACC;wBACCC,OAAO;4BACLC,QAAQ;4BACRvB,UAAU;4BACVC,OAAO;4BACPuB,cAAc;wBAChB;kCACD;;kCAGD,KAACC;wBAAIH,OAAOvB;kCAAgBpB;;;;;;AAIpC"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/GreptimeDBQueryEditor.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 { Stack } from '@mui/material';\nimport type { DatasourceSelectProps, OptionsEditorProps } from '@perses-dev/plugin-system';\nimport { DatasourceSelect, isVariableDatasource } from '@perses-dev/plugin-system';\nimport { produce } from 'immer';\nimport type { ReactElement } from 'react';\nimport { useCallback } from 'react';\n\nimport { GreptimeDBQLEditor } from '../../components';\nimport { queryExample } from '../../components/constants';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\n\ntype GreptimeDBTimeSeriesQueryEditorProps = OptionsEditorProps<GreptimeDBTimeSeriesQuerySpec>;\n\nexport function GreptimeDBTimeSeriesQueryEditor(props: GreptimeDBTimeSeriesQueryEditorProps): ReactElement {\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: '#777',\n backgroundColor: '#f5f5f5',\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: '#666',\n marginBottom: '8px',\n }}\n >\n Query Examples\n </summary>\n <div style={examplesStyle}>{queryExample}</div>\n </details>\n </Stack>\n );\n}\n"],"names":["Stack","DatasourceSelect","isVariableDatasource","produce","useCallback","GreptimeDBQLEditor","queryExample","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","GreptimeDBTimeSeriesQueryEditor","props","onChange","value","datasource","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","queryValue","handleGreptimeDBQueryChange","e","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,+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,KAAK,QAAQ,gBAAgB;AAEtC,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,4BAA4B;AACnF,SAASC,OAAO,QAAQ,QAAQ;AAEhC,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,kBAAkB,QAAQ,4BAAmB;AACtD,SAASC,YAAY,QAAQ,gCAA6B;AAC1D,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,kBAAe;AACnE,SAASC,aAAa,QAAQ,2BAAwB;AAKtD,OAAO,SAASC,gCAAgCC,KAA2C;IACzF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAE,GAAGD;IAEvB,MAAME,qBAAqBD,cAAcN;IACzC,MAAM,EAAEQ,KAAK,EAAEC,iBAAiB,EAAEC,eAAe,EAAE,GAAGT,cAAcE;IAEpE,MAAMQ,yBAA4D,CAACC;QACjE,IAAI,CAAClB,qBAAqBkB,2BAA2BA,uBAAuBC,IAAI,KAAKd,iBAAiB;YACpGK,SACET,QAAQU,OAAO,CAACS;gBACdA,MAAMR,UAAU,GAAGM;YACrB;YAEF;QACF;QACA,MAAM,IAAIG,MAAM;IAClB;IAEA,MAAMC,qBAAqB,CAACC;QAC1Bb,SACET,QAAQU,OAAO,CAACS;YACdA,MAAMN,KAAK,GAAGS;QAChB;IAEJ;IAEA,MAAMC,8BAA8BtB,YAClC,CAACuB;QACCV,kBAAkBU;IACpB,GACA;QAACV;KAAkB;IAGrB,MAAMW,gBAAgB;QACpBC,UAAU;QACVC,OAAO;QACPC,iBAAiB;QACjBC,SAAS;QACTC,cAAc;QACdC,YAAY;QACZC,YAAY;QACZC,YAAY;IACd;IAEA,qBACE,MAACpC;QAAMqC,SAAS;;0BACd,KAACpC;gBACCqC,sBAAsB/B;gBACtBM,OAAOE;gBACPH,UAAUO;gBACVoB,OAAM;gBACNC,OAAO;;0BAET,KAACnC;gBACCQ,OAAOG;gBACPJ,UAAUc;gBACVe,QAAQvB;gBACRwB,WAAW,CAACC;oBACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;wBAC7DH,MAAMI,cAAc;wBACpBvB,mBAAmBR;oBACrB;gBACF;gBACAgC,aAAY;;0BAEd,MAACC;;kCACC,KAACC;wBACCC,OAAO;4BACLC,QAAQ;4BACRvB,UAAU;4BACVC,OAAO;4BACPuB,cAAc;wBAChB;kCACD;;kCAGD,KAACC;wBAAIH,OAAOvB;kCAAgBtB;;;;;;AAIpC"}
@@ -1,4 +1,4 @@
1
- import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
- import { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
1
+ import type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';
3
3
  export declare const getTimeSeriesData: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec>['getTimeSeriesData'];
4
4
  //# sourceMappingURL=get-greptimedb-data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-greptimedb-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/get-greptimedb-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAUlE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AA+IzE,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC,mBAAmB,CA+CvG,CAAC"}
1
+ {"version":3,"file":"get-greptimedb-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/get-greptimedb-data.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAWvE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AA+I9E,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC,mBAAmB,CA+CvG,CAAC"}
@@ -10,8 +10,8 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { DEFAULT_DATASOURCE } from '../constants';
14
- import { findTimeColumnIndex, normalizeRecords, replaceQueryVariables, toTimestampMs } from '../greptimedb-query-data-model';
13
+ import { DEFAULT_DATASOURCE } from "../constants.js";
14
+ import { findTimeColumnIndex, normalizeRecords, replaceQueryVariables, toTimestampMs } from "../greptimedb-query-data-model.js";
15
15
  function isLikelyNumericType(dataType) {
16
16
  if (!dataType) return false;
17
17
  const t = dataType.toLowerCase();
@@ -121,9 +121,7 @@ function buildTimeSeries(records, fallbackTimestampMs) {
121
121
  function inferStepMsFromSeries(series, fallbackStepMs) {
122
122
  let minDeltaMs = Number.POSITIVE_INFINITY;
123
123
  for (const s of series){
124
- const sortedTimestamps = [
125
- ...s.values.map(([ts])=>ts)
126
- ].sort((a, b)=>a - b);
124
+ const sortedTimestamps = s.values.map(([ts])=>ts).toSorted((a, b)=>a - b);
127
125
  for(let i = 1; i < sortedTimestamps.length; i++){
128
126
  const delta = sortedTimestamps[i] - sortedTimestamps[i - 1];
129
127
  if (delta > 0 && delta < minDeltaMs) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/get-greptimedb-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 { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\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 { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\n\nfunction isLikelyNumericType(dataType: string | undefined): boolean {\n if (!dataType) return false;\n const t = dataType.toLowerCase();\n return (\n t.includes('int') || t.includes('float') || t.includes('double') || t.includes('decimal') || t.includes('number')\n );\n}\n\nfunction buildSeriesName(valueColumnName: string, labels: Record<string, string>): string {\n const entries = Object.entries(labels);\n if (entries.length === 0) {\n return valueColumnName;\n }\n\n return entries.map(([k, v]) => `${k}=${v}`).join(',');\n}\n\nfunction buildTimeSeries(\n records: GreptimeDBRecords | undefined,\n fallbackTimestampMs: number\n): Array<{ name: string; labels: Record<string, string>; values: Array<[number, number]> }> {\n const columnSchemas = records?.schema?.column_schemas ?? [];\n const rows = records?.rows ?? [];\n\n if (!columnSchemas.length || !rows.length) {\n return [];\n }\n\n const timeIndex = findTimeColumnIndex(columnSchemas);\n\n if (timeIndex === -1) {\n // Stat-style queries (e.g. `select count(*)`) may return a single numeric column with no timestamp.\n // In this case, emit a synthetic single-point series to keep numeric panels working.\n const scalarValueIndex = columnSchemas.findIndex((c) => isLikelyNumericType(c.data_type));\n if (scalarValueIndex === -1) {\n return [];\n }\n\n const scalarColumnName = columnSchemas[scalarValueIndex]?.name ?? 'value';\n const scalarValues: Array<[number, number]> = [];\n\n rows.forEach((row, rowIndex) => {\n const raw = row?.[scalarValueIndex];\n const value = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(value)) {\n return;\n }\n // Spread multiple rows by 1ms so ordering is stable.\n scalarValues.push([fallbackTimestampMs + rowIndex, value]);\n });\n\n if (scalarValues.length === 0) {\n return [];\n }\n\n return [\n {\n name: scalarColumnName,\n labels: {},\n values: scalarValues,\n },\n ];\n }\n\n // Choose a \"value\" column. Prefer greptime conventions, then fall back to the first numeric column.\n let valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && c.name.toLowerCase() === 'greptime_value');\n if (valueIndex === -1) {\n valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && c.name.toLowerCase() === 'value');\n }\n if (valueIndex === -1) {\n valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && isLikelyNumericType(c.data_type));\n }\n if (valueIndex === -1) {\n // Last resort: treat the first non-time column as value.\n valueIndex = columnSchemas.findIndex((_, idx) => idx !== timeIndex);\n }\n\n const valueColumnName = columnSchemas[valueIndex]?.name ?? 'value';\n\n // Chart-safe default: group rows into standard timeseries (multiple points per series).\n const seriesMap = new Map<\n string,\n { name: string; labels: Record<string, string>; values: Array<[number, number]> }\n >();\n\n for (const row of rows) {\n const tsMs = toTimestampMs(row?.[timeIndex], columnSchemas[timeIndex]?.data_type);\n if (tsMs === null) {\n continue;\n }\n\n const raw = row?.[valueIndex];\n const value = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(value)) {\n continue;\n }\n\n const labels: Record<string, string> = {};\n columnSchemas.forEach((col, idx) => {\n if (idx === timeIndex || idx === valueIndex) return;\n const v = row?.[idx];\n labels[col.name] = v === null || v === undefined ? '' : String(v);\n });\n\n // Stable series key by label set.\n const labelsKey = columnSchemas\n .filter((_, idx) => idx !== timeIndex && idx !== valueIndex)\n .map((c) => `${c.name}=${labels[c.name] ?? ''}`)\n .join('|');\n const key = `${valueColumnName}|${labelsKey}`;\n\n const existing = seriesMap.get(key);\n if (existing) {\n existing.values.push([tsMs, value]);\n } else {\n seriesMap.set(key, { name: buildSeriesName(valueColumnName, labels), labels, values: [[tsMs, value]] });\n }\n }\n\n return Array.from(seriesMap.values()).filter((s) => s.values.length > 0);\n}\n\nfunction inferStepMsFromSeries(\n series: Array<{ name: string; labels: Record<string, string>; values: Array<[number, number]> }>,\n fallbackStepMs: number\n): number {\n let minDeltaMs = Number.POSITIVE_INFINITY;\n\n for (const s of series) {\n const sortedTimestamps = [...s.values.map(([ts]) => ts)].sort((a, b) => a - b);\n for (let i = 1; i < sortedTimestamps.length; i++) {\n const delta = sortedTimestamps[i]! - sortedTimestamps[i - 1]!;\n if (delta > 0 && delta < minDeltaMs) {\n minDeltaMs = delta;\n }\n }\n }\n\n return Number.isFinite(minDeltaMs) ? minDeltaMs : fallbackStepMs;\n}\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n if (!spec.query) {\n return {\n series: [],\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 const tableColumns = records?.schema?.column_schemas ?? [];\n const tableRows = records?.rows ?? [];\n\n const series = buildTimeSeries(records, end.getTime());\n const stepMs = inferStepMsFromSeries(series, context.suggestedStepMs || 30 * 1000);\n\n return {\n series,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n records,\n table: {\n columns: tableColumns,\n rows: tableRows,\n },\n },\n };\n};\n"],"names":["DEFAULT_DATASOURCE","findTimeColumnIndex","normalizeRecords","replaceQueryVariables","toTimestampMs","isLikelyNumericType","dataType","t","toLowerCase","includes","buildSeriesName","valueColumnName","labels","entries","Object","length","map","k","v","join","buildTimeSeries","records","fallbackTimestampMs","columnSchemas","schema","column_schemas","rows","timeIndex","scalarValueIndex","findIndex","c","data_type","scalarColumnName","name","scalarValues","forEach","row","rowIndex","raw","value","Number","isFinite","push","values","valueIndex","idx","_","seriesMap","Map","tsMs","col","undefined","String","labelsKey","filter","key","existing","get","set","Array","from","s","inferStepMsFromSeries","series","fallbackStepMs","minDeltaMs","POSITIVE_INFINITY","sortedTimestamps","ts","sort","a","b","i","delta","getTimeSeriesData","spec","context","query","start","end","timeRange","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","status","Error","error","data","tableColumns","tableRows","stepMs","suggestedStepMs","metadata","executedQueryString","table","columns"],"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;AAGxC,SAASC,oBAAoBC,QAA4B;IACvD,IAAI,CAACA,UAAU,OAAO;IACtB,MAAMC,IAAID,SAASE,WAAW;IAC9B,OACED,EAAEE,QAAQ,CAAC,UAAUF,EAAEE,QAAQ,CAAC,YAAYF,EAAEE,QAAQ,CAAC,aAAaF,EAAEE,QAAQ,CAAC,cAAcF,EAAEE,QAAQ,CAAC;AAE5G;AAEA,SAASC,gBAAgBC,eAAuB,EAAEC,MAA8B;IAC9E,MAAMC,UAAUC,OAAOD,OAAO,CAACD;IAC/B,IAAIC,QAAQE,MAAM,KAAK,GAAG;QACxB,OAAO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AAsBwE,KAAKE,KAAK,EAAED,QAAQK,aAAa,EAAEL,QAAQI,SAAS;IAExF,MAAME,SAAU,MAAMN,QAAQO,eAAe,CAACC,mBAAmB,CAC/DT,KAAKU,UAAU,IAAIrF;IAGrB,MAAMsF,WAAoC,MAAMJ,OAAOL,KAAK,CAAC;QAC3DC,OAAOA,MAAMS,OAAO,GAAGC,QAAQ;QAC/BT,KAAKA,IAAIQ,OAAO,GAAGC,QAAQ;QAC3BX;IACF;IAEA,IAAIS,SAASG,MAAM,KAAK,SAAS;QAC/B,MAAM,IAAIC,MAAMJ,SAASK,KAAK,IAAI;IACpC;IAEA,MAAMtE,UAAUnB,iBAAiBoF,SAASM,IAAI;IAC9C,MAAMC,eAAexE,SAASG,QAAQC,kBAAkB,EAAE;IAC1D,MAAMqE,YAAYzE,SAASK,QAAQ,EAAE;IAErC,MAAMqC,SAAS3C,gBAAgBC,SAAS0D,IAAIQ,OAAO;IACnD,MAAMQ,SAASjC,sBAAsBC,QAAQa,QAAQoB,eAAe,IAAI,KAAK;IAE7E,OAAO;QACLjC;QACAiB,WAAW;YAAEF;YAAOC;QAAI;QACxBgB;QACAE,UAAU;YACRC,qBAAqBrB;YACrBxD;YACA8E,OAAO;gBACLC,SAASP;gBACTnE,MAAMoE;YACR;QACF;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/get-greptimedb-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 type { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';\n\nimport type { GreptimeDBClient, GreptimeDBQueryResponse } from '../../model/greptimedb-client';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport type { GreptimeDBRecords } from '../greptimedb-query-data-model';\nimport {\n findTimeColumnIndex,\n normalizeRecords,\n replaceQueryVariables,\n toTimestampMs,\n} from '../greptimedb-query-data-model';\nimport type { GreptimeDBTimeSeriesQuerySpec } from './greptimedb-query-types';\n\nfunction isLikelyNumericType(dataType: string | undefined): boolean {\n if (!dataType) return false;\n const t = dataType.toLowerCase();\n return (\n t.includes('int') || t.includes('float') || t.includes('double') || t.includes('decimal') || t.includes('number')\n );\n}\n\nfunction buildSeriesName(valueColumnName: string, labels: Record<string, string>): string {\n const entries = Object.entries(labels);\n if (entries.length === 0) {\n return valueColumnName;\n }\n\n return entries.map(([k, v]) => `${k}=${v}`).join(',');\n}\n\nfunction buildTimeSeries(\n records: GreptimeDBRecords | undefined,\n fallbackTimestampMs: number,\n): Array<{ name: string; labels: Record<string, string>; values: Array<[number, number]> }> {\n const columnSchemas = records?.schema?.column_schemas ?? [];\n const rows = records?.rows ?? [];\n\n if (!columnSchemas.length || !rows.length) {\n return [];\n }\n\n const timeIndex = findTimeColumnIndex(columnSchemas);\n\n if (timeIndex === -1) {\n // Stat-style queries (e.g. `select count(*)`) may return a single numeric column with no timestamp.\n // In this case, emit a synthetic single-point series to keep numeric panels working.\n const scalarValueIndex = columnSchemas.findIndex((c) => isLikelyNumericType(c.data_type));\n if (scalarValueIndex === -1) {\n return [];\n }\n\n const scalarColumnName = columnSchemas[scalarValueIndex]?.name ?? 'value';\n const scalarValues: Array<[number, number]> = [];\n\n rows.forEach((row, rowIndex) => {\n const raw = row?.[scalarValueIndex];\n const value = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(value)) {\n return;\n }\n // Spread multiple rows by 1ms so ordering is stable.\n scalarValues.push([fallbackTimestampMs + rowIndex, value]);\n });\n\n if (scalarValues.length === 0) {\n return [];\n }\n\n return [\n {\n name: scalarColumnName,\n labels: {},\n values: scalarValues,\n },\n ];\n }\n\n // Choose a \"value\" column. Prefer greptime conventions, then fall back to the first numeric column.\n let valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && c.name.toLowerCase() === 'greptime_value');\n if (valueIndex === -1) {\n valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && c.name.toLowerCase() === 'value');\n }\n if (valueIndex === -1) {\n valueIndex = columnSchemas.findIndex((c, idx) => idx !== timeIndex && isLikelyNumericType(c.data_type));\n }\n if (valueIndex === -1) {\n // Last resort: treat the first non-time column as value.\n valueIndex = columnSchemas.findIndex((_, idx) => idx !== timeIndex);\n }\n\n const valueColumnName = columnSchemas[valueIndex]?.name ?? 'value';\n\n // Chart-safe default: group rows into standard timeseries (multiple points per series).\n const seriesMap = new Map<\n string,\n { name: string; labels: Record<string, string>; values: Array<[number, number]> }\n >();\n\n for (const row of rows) {\n const tsMs = toTimestampMs(row?.[timeIndex], columnSchemas[timeIndex]?.data_type);\n if (tsMs === null) {\n continue;\n }\n\n const raw = row?.[valueIndex];\n const value = typeof raw === 'number' ? raw : Number(raw);\n if (!Number.isFinite(value)) {\n continue;\n }\n\n const labels: Record<string, string> = {};\n columnSchemas.forEach((col, idx) => {\n if (idx === timeIndex || idx === valueIndex) return;\n const v = row?.[idx];\n labels[col.name] = v === null || v === undefined ? '' : String(v);\n });\n\n // Stable series key by label set.\n const labelsKey = columnSchemas\n .filter((_, idx) => idx !== timeIndex && idx !== valueIndex)\n .map((c) => `${c.name}=${labels[c.name] ?? ''}`)\n .join('|');\n const key = `${valueColumnName}|${labelsKey}`;\n\n const existing = seriesMap.get(key);\n if (existing) {\n existing.values.push([tsMs, value]);\n } else {\n seriesMap.set(key, { name: buildSeriesName(valueColumnName, labels), labels, values: [[tsMs, value]] });\n }\n }\n\n return Array.from(seriesMap.values()).filter((s) => s.values.length > 0);\n}\n\nfunction inferStepMsFromSeries(\n series: Array<{ name: string; labels: Record<string, string>; values: Array<[number, number]> }>,\n fallbackStepMs: number,\n): number {\n let minDeltaMs = Number.POSITIVE_INFINITY;\n\n for (const s of series) {\n const sortedTimestamps = s.values.map(([ts]) => ts).toSorted((a, b) => a - b);\n for (let i = 1; i < sortedTimestamps.length; i++) {\n const delta = sortedTimestamps[i]! - sortedTimestamps[i - 1]!;\n if (delta > 0 && delta < minDeltaMs) {\n minDeltaMs = delta;\n }\n }\n }\n\n return Number.isFinite(minDeltaMs) ? minDeltaMs : fallbackStepMs;\n}\n\nexport const getTimeSeriesData: TimeSeriesQueryPlugin<GreptimeDBTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context,\n) => {\n if (!spec.query) {\n return {\n series: [],\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 const tableColumns = records?.schema?.column_schemas ?? [];\n const tableRows = records?.rows ?? [];\n\n const series = buildTimeSeries(records, end.getTime());\n const stepMs = inferStepMsFromSeries(series, context.suggestedStepMs || 30 * 1000);\n\n return {\n series,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n records,\n table: {\n columns: tableColumns,\n rows: tableRows,\n },\n },\n };\n};\n"],"names":["DEFAULT_DATASOURCE","findTimeColumnIndex","normalizeRecords","replaceQueryVariables","toTimestampMs","isLikelyNumericType","dataType","t","toLowerCase","includes","buildSeriesName","valueColumnName","labels","entries","Object","length","map","k","v","join","buildTimeSeries","records","fallbackTimestampMs","columnSchemas","schema","column_schemas","rows","timeIndex","scalarValueIndex","findIndex","c","data_type","scalarColumnName","name","scalarValues","forEach","row","rowIndex","raw","value","Number","isFinite","push","values","valueIndex","idx","_","seriesMap","Map","tsMs","col","undefined","String","labelsKey","filter","key","existing","get","set","Array","from","s","inferStepMsFromSeries","series","fallbackStepMs","minDeltaMs","POSITIVE_INFINITY","sortedTimestamps","ts","toSorted","a","b","i","delta","getTimeSeriesData","spec","context","query","start","end","timeRange","variableState","client","datasourceStore","getDatasourceClient","datasource","response","getTime","toString","status","Error","error","data","tableColumns","tableRows","stepMs","suggestedStepMs","metadata","executedQueryString","table","columns"],"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;AAKjC,SAASA,kBAAkB,QAAQ,kBAAe;AAElD,SACEC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,aAAa,QACR,oCAAiC;AAGxC,SAASC,oBAAoBC,QAA4B;IACvD,IAAI,CAACA,UAAU,OAAO;IACtB,MAAMC,IAAID,SAASE,WAAW;IAC9B,OACED,EAAEE,QAAQ,CAAC,UAAUF,EAAEE,QAAQ,CAAC,YAAYF,EAAEE,QAAQ,CAAC,aAAaF,EAAEE,QAAQ,CAAC,cAAcF,EAAEE,QAAQ,CAAC;AAE5G;AAEA,SAASC,gBAAgBC,eAAuB,EAAEC,MAA8B;IAC9E,MAAMC,UAAUC,OAAOD,OAAO,CAACD;IAC/B,IAAIC,QAAQE,MAAM,KAAK,GAAG;QACxB,OAAOJ;IACT;IAEA,OAAOE,QAAQG,GAAG,CAAC,CAAC,CAACC,GAAGC,EAAE,GAAK,GAAGD,EAAE,CAAC,EAAEC,GAAG,EAAEC,IAAI,CAAC;AACnD;AAEA,SAASC,gBACPC,OAAsC,EACtCC,mBAA2B;IAE3B,MAAMC,gBAAgBF,SAASG,QAAQC,kBAAkB,EAAE;IAC3D,MAAMC,OAAOL,SAASK,QAAQ,EAAE;IAEhC,IAAI,CAACH,cAAcR,MAAM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IS,SAASG,MAAM,KAAK,SAAS;QAC/B,MAAM,IAAIC,MAAMJ,SAASK,KAAK,IAAI;IACpC;IAEA,MAAMtE,UAAUnB,iBAAiBoF,SAASM,IAAI;IAC9C,MAAMC,eAAexE,SAASG,QAAQC,kBAAkB,EAAE;IAC1D,MAAMqE,YAAYzE,SAASK,QAAQ,EAAE;IAErC,MAAMqC,SAAS3C,gBAAgBC,SAAS0D,IAAIQ,OAAO;IACnD,MAAMQ,SAASjC,sBAAsBC,QAAQa,QAAQoB,eAAe,IAAI,KAAK;IAE7E,OAAO;QACLjC;QACAiB,WAAW;YAAEF;YAAOC;QAAI;QACxBgB;QACAE,UAAU;YACRC,qBAAqBrB;YACrBxD;YACA8E,OAAO;gBACLC,SAASP;gBACTnE,MAAMoE;YACR;QACF;IACF;AACF,EAAE"}
@@ -1,4 +1,4 @@
1
- import { DatasourceSelector } from '@perses-dev/spec';
1
+ import type { DatasourceSelector } from '@perses-dev/spec';
2
2
  export interface GreptimeDBTimeSeriesQuerySpec {
3
3
  query: string;
4
4
  datasource?: DatasourceSelector;
@@ -1 +1 @@
1
- {"version":3,"file":"greptimedb-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/greptimedb-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;IAEhC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"greptimedb-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-time-series-query/greptimedb-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAEhC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/greptimedb-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 GreptimeDBTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n // Legacy field kept for dashboard compatibility. Not used by query execution.\n timeColumn?: string;\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,WAKC"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-query/greptimedb-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 type { DatasourceSelector } from '@perses-dev/spec';\n\nexport interface GreptimeDBTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n // Legacy field kept for dashboard compatibility. Not used by query execution.\n timeColumn?: string;\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,WAKC"}
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './get-greptimedb-data';
14
- export * from './GreptimeDBQuery';
15
- export * from './GreptimeDBQueryEditor';
16
- export * from './greptimedb-query-types';
13
+ export * from "./get-greptimedb-data.js";
14
+ export * from "./GreptimeDBQuery.js";
15
+ export * from "./GreptimeDBQueryEditor.js";
16
+ export * from "./greptimedb-query-types.js";
17
17
 
18
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-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 './get-greptimedb-data';\nexport * from './GreptimeDBQuery';\nexport * from './GreptimeDBQueryEditor';\nexport * from './greptimedb-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,wBAAwB;AACtC,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,2BAA2B"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-time-series-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 './get-greptimedb-data';\nexport * from './GreptimeDBQuery';\nexport * from './GreptimeDBQueryEditor';\nexport * from './greptimedb-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,2BAAwB;AACtC,cAAc,uBAAoB;AAClC,cAAc,6BAA0B;AACxC,cAAc,8BAA2B"}
@@ -1,4 +1,4 @@
1
- import { TraceQueryPlugin } from '@perses-dev/plugin-system';
2
- import { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';
1
+ import type { TraceQueryPlugin } from '@perses-dev/plugin-system';
2
+ import type { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';
3
3
  export declare const GreptimeDBTraceQuery: TraceQueryPlugin<GreptimeDBTraceQuerySpec>;
4
4
  //# sourceMappingURL=GreptimeDBTraceQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GreptimeDBTraceQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,wBAAwB,CAY3E,CAAC"}
1
+ {"version":3,"file":"GreptimeDBTraceQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIlE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG/E,eAAO,MAAM,oBAAoB,EAAE,gBAAgB,CAAC,wBAAwB,CAY3E,CAAC"}
@@ -10,9 +10,9 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import { parseVariables } from '@perses-dev/plugin-system';
14
- import { getGreptimeDBTraceData } from './get-greptimedb-trace-data';
15
- import { GreptimeDBTraceQueryEditor } from './GreptimeDBTraceQueryEditor';
13
+ import { parseVariables } from "@perses-dev/plugin-system";
14
+ import { getGreptimeDBTraceData } from "./get-greptimedb-trace-data.js";
15
+ import { GreptimeDBTraceQueryEditor } from "./GreptimeDBTraceQueryEditor.js";
16
16
  export const GreptimeDBTraceQuery = {
17
17
  getTraceData: getGreptimeDBTraceData,
18
18
  OptionsEditorComponent: GreptimeDBTraceQueryEditor,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQuery.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, TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';\nimport { getGreptimeDBTraceData } from './get-greptimedb-trace-data';\nimport { GreptimeDBTraceQueryEditor } from './GreptimeDBTraceQueryEditor';\n\nexport const GreptimeDBTraceQuery: TraceQueryPlugin<GreptimeDBTraceQuerySpec> = {\n getTraceData: getGreptimeDBTraceData,\n OptionsEditorComponent: GreptimeDBTraceQueryEditor,\n createInitialOptions: () => ({\n query: '',\n }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n return {\n variables: [...new Set(queryVariables)],\n };\n },\n};\n"],"names":["parseVariables","getGreptimeDBTraceData","GreptimeDBTraceQueryEditor","GreptimeDBTraceQuery","getTraceData","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","variables","Set"],"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,QAA0B,4BAA4B;AAE7E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,0BAA0B,QAAQ,+BAA+B;AAE1E,OAAO,MAAMC,uBAAmE;IAC9EC,cAAcH;IACdI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;QACT,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,KAAKF,KAAK;QAChD,OAAO;YACLI,WAAW;mBAAI,IAAIC,IAAIF;aAAgB;QACzC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQuery.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 type { TraceQueryPlugin } from '@perses-dev/plugin-system';\nimport { parseVariables } from '@perses-dev/plugin-system';\n\nimport { getGreptimeDBTraceData } from './get-greptimedb-trace-data';\nimport type { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';\nimport { GreptimeDBTraceQueryEditor } from './GreptimeDBTraceQueryEditor';\n\nexport const GreptimeDBTraceQuery: TraceQueryPlugin<GreptimeDBTraceQuerySpec> = {\n getTraceData: getGreptimeDBTraceData,\n OptionsEditorComponent: GreptimeDBTraceQueryEditor,\n createInitialOptions: () => ({\n query: '',\n }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n return {\n variables: [...new Set(queryVariables)],\n };\n },\n};\n"],"names":["parseVariables","getGreptimeDBTraceData","GreptimeDBTraceQueryEditor","GreptimeDBTraceQuery","getTraceData","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","variables","Set"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,cAAc,QAAQ,4BAA4B;AAE3D,SAASC,sBAAsB,QAAQ,iCAA8B;AAErE,SAASC,0BAA0B,QAAQ,kCAA+B;AAE1E,OAAO,MAAMC,uBAAmE;IAC9EC,cAAcH;IACdI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAC3BC,OAAO;QACT,CAAA;IACAC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,KAAKF,KAAK;QAChD,OAAO;YACLI,WAAW;mBAAI,IAAIC,IAAIF;aAAgB;QACzC;IACF;AACF,EAAE"}
@@ -1,6 +1,6 @@
1
- import { OptionsEditorProps } from '@perses-dev/plugin-system';
2
- import { ReactElement } from 'react';
3
- import { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';
1
+ import type { OptionsEditorProps } from '@perses-dev/plugin-system';
2
+ import type { ReactElement } from 'react';
3
+ import type { GreptimeDBTraceQuerySpec } from './greptimedb-trace-query-types';
4
4
  type GreptimeDBTraceQueryEditorProps = OptionsEditorProps<GreptimeDBTraceQuerySpec>;
5
5
  export declare function GreptimeDBTraceQueryEditor(props: GreptimeDBTraceQueryEditorProps): ReactElement;
6
6
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"GreptimeDBTraceQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.tsx"],"names":[],"mappings":"AAeA,OAAO,EAIL,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAe,MAAM,OAAO,CAAC;AAIlD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,KAAK,+BAA+B,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;AAEpF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,YAAY,CAwD/F"}
1
+ {"version":3,"file":"GreptimeDBTraceQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/greptimedb-trace-query/GreptimeDBTraceQueryEditor.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAyB,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE/E,KAAK,+BAA+B,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;AAEpF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,+BAA+B,GAAG,YAAY,CAwD/F"}