@perses-dev/splunk-plugin 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +60 -0
  3. package/__mf/css/async/7.85c2cbf6.css +1 -0
  4. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  5. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  6. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  8. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  10. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  11. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  12. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  13. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  14. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  17. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  18. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  26. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  27. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  28. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  29. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  30. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  31. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  32. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  33. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  34. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  35. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  36. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  37. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  38. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  39. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  40. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  42. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  43. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  44. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  45. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  47. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  49. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  50. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  51. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  52. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  53. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  54. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  55. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  56. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  57. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  58. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  59. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  60. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  61. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  62. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  63. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  64. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  66. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  67. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  68. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  69. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  70. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  71. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  72. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  73. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  74. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  75. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  77. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  79. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  80. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  82. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  83. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  84. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  85. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  86. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  87. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  88. package/__mf/js/Splunk.d622dd09.js +7 -0
  89. package/__mf/js/async/121.444e1abe.js +2 -0
  90. package/__mf/js/async/121.444e1abe.js.LICENSE.txt +9 -0
  91. package/__mf/js/async/177.cfdf2ea5.js +1 -0
  92. package/__mf/js/async/181.fee3676d.js +2 -0
  93. package/__mf/js/async/181.fee3676d.js.LICENSE.txt +9 -0
  94. package/__mf/js/async/278.171d6548.js +24 -0
  95. package/__mf/js/async/278.171d6548.js.LICENSE.txt +44 -0
  96. package/__mf/js/async/386.9514a8a7.js +2 -0
  97. package/__mf/js/async/386.9514a8a7.js.LICENSE.txt +9 -0
  98. package/__mf/js/async/413.0cd939f5.js +1 -0
  99. package/__mf/js/async/470.3f481d24.js +2 -0
  100. package/__mf/js/async/470.3f481d24.js.LICENSE.txt +19 -0
  101. package/__mf/js/async/667.bb282078.js +1 -0
  102. package/__mf/js/async/7.ed3f1592.js +7 -0
  103. package/__mf/js/async/7.ed3f1592.js.LICENSE.txt +64 -0
  104. package/__mf/js/async/732.69245394.js +139 -0
  105. package/__mf/js/async/732.69245394.js.LICENSE.txt +46 -0
  106. package/__mf/js/async/941.8fe72889.js +2 -0
  107. package/__mf/js/async/941.8fe72889.js.LICENSE.txt +9 -0
  108. package/__mf/js/async/963.f1d8b579.js +1 -0
  109. package/__mf/js/async/982.8a88a864.js +10 -0
  110. package/__mf/js/async/982.8a88a864.js.LICENSE.txt +26 -0
  111. package/__mf/js/async/__federation_expose_SplunkDatasource.f30e66ce.js +2 -0
  112. package/__mf/js/async/__federation_expose_SplunkDatasource.f30e66ce.js.LICENSE.txt +9 -0
  113. package/__mf/js/async/__federation_expose_SplunkLogQuery.df0414d6.js +2 -0
  114. package/__mf/js/async/__federation_expose_SplunkLogQuery.df0414d6.js.LICENSE.txt +9 -0
  115. package/__mf/js/async/__federation_expose_SplunkTimeSeriesQuery.fa50234a.js +2 -0
  116. package/__mf/js/async/__federation_expose_SplunkTimeSeriesQuery.fa50234a.js.LICENSE.txt +9 -0
  117. package/__mf/js/async/lib-router.1acd2c34.js +2 -0
  118. package/__mf/js/async/lib-router.1acd2c34.js.LICENSE.txt +32 -0
  119. package/__mf/js/main.39e2a771.js +7 -0
  120. package/lib/bootstrap.d.ts +2 -0
  121. package/lib/bootstrap.d.ts.map +1 -0
  122. package/lib/bootstrap.js +20 -0
  123. package/lib/bootstrap.js.map +1 -0
  124. package/lib/cjs/bootstrap.js +27 -0
  125. package/lib/cjs/datasources/index.js +30 -0
  126. package/lib/cjs/datasources/splunk-datasource/SplunkDatasource.js +69 -0
  127. package/lib/cjs/datasources/splunk-datasource/SplunkDatasourceEditor.js +71 -0
  128. package/lib/cjs/datasources/splunk-datasource/index.js +32 -0
  129. package/lib/cjs/datasources/splunk-datasource/splunk-datasource-types.js +16 -0
  130. package/lib/cjs/env.d.js +14 -0
  131. package/lib/cjs/getPluginModule.js +39 -0
  132. package/lib/cjs/index-federation.js +55 -0
  133. package/lib/cjs/index.js +39 -0
  134. package/lib/cjs/model/index.js +31 -0
  135. package/lib/cjs/model/splunk-client-types.js +16 -0
  136. package/lib/cjs/model/splunk-client.js +151 -0
  137. package/lib/cjs/queries/constants.js +25 -0
  138. package/lib/cjs/queries/index.js +31 -0
  139. package/lib/cjs/queries/splunk-log-query/SplunkLogQuery.js +43 -0
  140. package/lib/cjs/queries/splunk-log-query/SplunkLogQueryEditor.js +95 -0
  141. package/lib/cjs/queries/splunk-log-query/get-splunk-log-data.js +127 -0
  142. package/lib/cjs/queries/splunk-log-query/index.js +33 -0
  143. package/lib/cjs/queries/splunk-log-query/log-query-plugin-interface.js +16 -0
  144. package/lib/cjs/queries/splunk-log-query/splunk-log-query-types.js +16 -0
  145. package/lib/cjs/queries/splunk-time-series-query/SplunkTimeSeriesQuery.js +43 -0
  146. package/lib/cjs/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.js +95 -0
  147. package/lib/cjs/queries/splunk-time-series-query/get-splunk-time-series-data.js +106 -0
  148. package/lib/cjs/queries/splunk-time-series-query/index.js +33 -0
  149. package/lib/cjs/queries/splunk-time-series-query/splunk-time-series-query-types.js +16 -0
  150. package/lib/cjs/setup-tests.js +19 -0
  151. package/lib/datasources/index.d.ts +2 -0
  152. package/lib/datasources/index.d.ts.map +1 -0
  153. package/lib/datasources/index.js +15 -0
  154. package/lib/datasources/index.js.map +1 -0
  155. package/lib/datasources/splunk-datasource/SplunkDatasource.d.ts +5 -0
  156. package/lib/datasources/splunk-datasource/SplunkDatasource.d.ts.map +1 -0
  157. package/lib/datasources/splunk-datasource/SplunkDatasource.js +61 -0
  158. package/lib/datasources/splunk-datasource/SplunkDatasource.js.map +1 -0
  159. package/lib/datasources/splunk-datasource/SplunkDatasource.test.d.ts +2 -0
  160. package/lib/datasources/splunk-datasource/SplunkDatasource.test.d.ts.map +1 -0
  161. package/lib/datasources/splunk-datasource/SplunkDatasourceEditor.d.ts +9 -0
  162. package/lib/datasources/splunk-datasource/SplunkDatasourceEditor.d.ts.map +1 -0
  163. package/lib/datasources/splunk-datasource/SplunkDatasourceEditor.js +63 -0
  164. package/lib/datasources/splunk-datasource/SplunkDatasourceEditor.js.map +1 -0
  165. package/lib/datasources/splunk-datasource/index.d.ts +4 -0
  166. package/lib/datasources/splunk-datasource/index.d.ts.map +1 -0
  167. package/lib/datasources/splunk-datasource/index.js +17 -0
  168. package/lib/datasources/splunk-datasource/index.js.map +1 -0
  169. package/lib/datasources/splunk-datasource/splunk-datasource-types.d.ts +6 -0
  170. package/lib/datasources/splunk-datasource/splunk-datasource-types.d.ts.map +1 -0
  171. package/lib/datasources/splunk-datasource/splunk-datasource-types.js +15 -0
  172. package/lib/datasources/splunk-datasource/splunk-datasource-types.js.map +1 -0
  173. package/lib/env.d.js +15 -0
  174. package/lib/env.d.js.map +1 -0
  175. package/lib/getPluginModule.d.ts +6 -0
  176. package/lib/getPluginModule.d.ts.map +1 -0
  177. package/lib/getPluginModule.js +28 -0
  178. package/lib/getPluginModule.js.map +1 -0
  179. package/lib/index-federation.d.ts +1 -0
  180. package/lib/index-federation.d.ts.map +1 -0
  181. package/lib/index-federation.js +15 -0
  182. package/lib/index-federation.js.map +1 -0
  183. package/lib/index.d.ts +5 -0
  184. package/lib/index.d.ts.map +1 -0
  185. package/lib/index.js +18 -0
  186. package/lib/index.js.map +1 -0
  187. package/lib/model/index.d.ts +3 -0
  188. package/lib/model/index.d.ts.map +1 -0
  189. package/lib/model/index.js +16 -0
  190. package/lib/model/index.js.map +1 -0
  191. package/lib/model/splunk-client-types.d.ts +50 -0
  192. package/lib/model/splunk-client-types.d.ts.map +1 -0
  193. package/lib/model/splunk-client-types.js +15 -0
  194. package/lib/model/splunk-client-types.js.map +1 -0
  195. package/lib/model/splunk-client.d.ts +40 -0
  196. package/lib/model/splunk-client.d.ts.map +1 -0
  197. package/lib/model/splunk-client.js +126 -0
  198. package/lib/model/splunk-client.js.map +1 -0
  199. package/lib/queries/constants.d.ts +4 -0
  200. package/lib/queries/constants.d.ts.map +1 -0
  201. package/lib/queries/constants.js +17 -0
  202. package/lib/queries/constants.js.map +1 -0
  203. package/lib/queries/index.d.ts +3 -0
  204. package/lib/queries/index.d.ts.map +1 -0
  205. package/lib/queries/index.js +16 -0
  206. package/lib/queries/index.js.map +1 -0
  207. package/lib/queries/splunk-log-query/SplunkLogQuery.d.ts +4 -0
  208. package/lib/queries/splunk-log-query/SplunkLogQuery.d.ts.map +1 -0
  209. package/lib/queries/splunk-log-query/SplunkLogQuery.js +35 -0
  210. package/lib/queries/splunk-log-query/SplunkLogQuery.js.map +1 -0
  211. package/lib/queries/splunk-log-query/SplunkLogQuery.test.d.ts +2 -0
  212. package/lib/queries/splunk-log-query/SplunkLogQuery.test.d.ts.map +1 -0
  213. package/lib/queries/splunk-log-query/SplunkLogQueryEditor.d.ts +7 -0
  214. package/lib/queries/splunk-log-query/SplunkLogQueryEditor.d.ts.map +1 -0
  215. package/lib/queries/splunk-log-query/SplunkLogQueryEditor.js +87 -0
  216. package/lib/queries/splunk-log-query/SplunkLogQueryEditor.js.map +1 -0
  217. package/lib/queries/splunk-log-query/get-splunk-log-data.d.ts +4 -0
  218. package/lib/queries/splunk-log-query/get-splunk-log-data.d.ts.map +1 -0
  219. package/lib/queries/splunk-log-query/get-splunk-log-data.js +119 -0
  220. package/lib/queries/splunk-log-query/get-splunk-log-data.js.map +1 -0
  221. package/lib/queries/splunk-log-query/index.d.ts +5 -0
  222. package/lib/queries/splunk-log-query/index.d.ts.map +1 -0
  223. package/lib/queries/splunk-log-query/index.js +18 -0
  224. package/lib/queries/splunk-log-query/index.js.map +1 -0
  225. package/lib/queries/splunk-log-query/log-query-plugin-interface.d.ts +23 -0
  226. package/lib/queries/splunk-log-query/log-query-plugin-interface.d.ts.map +1 -0
  227. package/lib/queries/splunk-log-query/log-query-plugin-interface.js +15 -0
  228. package/lib/queries/splunk-log-query/log-query-plugin-interface.js.map +1 -0
  229. package/lib/queries/splunk-log-query/splunk-log-query-types.d.ts +11 -0
  230. package/lib/queries/splunk-log-query/splunk-log-query-types.d.ts.map +1 -0
  231. package/lib/queries/splunk-log-query/splunk-log-query-types.js +15 -0
  232. package/lib/queries/splunk-log-query/splunk-log-query-types.js.map +1 -0
  233. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.d.ts +4 -0
  234. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.d.ts.map +1 -0
  235. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.js +35 -0
  236. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.js.map +1 -0
  237. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.test.d.ts +2 -0
  238. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQuery.test.d.ts.map +1 -0
  239. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.d.ts +7 -0
  240. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.d.ts.map +1 -0
  241. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.js +87 -0
  242. package/lib/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.js.map +1 -0
  243. package/lib/queries/splunk-time-series-query/get-splunk-time-series-data.d.ts +4 -0
  244. package/lib/queries/splunk-time-series-query/get-splunk-time-series-data.d.ts.map +1 -0
  245. package/lib/queries/splunk-time-series-query/get-splunk-time-series-data.js +98 -0
  246. package/lib/queries/splunk-time-series-query/get-splunk-time-series-data.js.map +1 -0
  247. package/lib/queries/splunk-time-series-query/index.d.ts +5 -0
  248. package/lib/queries/splunk-time-series-query/index.d.ts.map +1 -0
  249. package/lib/queries/splunk-time-series-query/index.js +18 -0
  250. package/lib/queries/splunk-time-series-query/index.js.map +1 -0
  251. package/lib/queries/splunk-time-series-query/splunk-time-series-query-types.d.ts +10 -0
  252. package/lib/queries/splunk-time-series-query/splunk-time-series-query-types.d.ts.map +1 -0
  253. package/lib/queries/splunk-time-series-query/splunk-time-series-query-types.js +15 -0
  254. package/lib/queries/splunk-time-series-query/splunk-time-series-query-types.js.map +1 -0
  255. package/lib/setup-tests.d.ts +2 -0
  256. package/lib/setup-tests.d.ts.map +1 -0
  257. package/lib/setup-tests.js +17 -0
  258. package/lib/setup-tests.js.map +1 -0
  259. package/mf-manifest.json +198 -0
  260. package/mf-stats.json +220 -0
  261. package/package.json +74 -0
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
15
+ import { Box, InputLabel, Stack, TextField } from '@mui/material';
16
+ import { produce } from 'immer';
17
+ const DATASOURCE_KIND = 'SplunkDatasource';
18
+ const DEFAULT_DATASOURCE = {
19
+ kind: DATASOURCE_KIND
20
+ };
21
+ export function SplunkLogQueryEditor(props) {
22
+ const { onChange, value } = props;
23
+ const { datasource, query } = value;
24
+ const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;
25
+ const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, DATASOURCE_KIND);
26
+ const handleDatasourceChange = (newDatasourceSelection)=>{
27
+ if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {
28
+ onChange(produce(value, (draft)=>{
29
+ draft.datasource = newDatasourceSelection;
30
+ }));
31
+ return;
32
+ }
33
+ throw new Error('Got unexpected non SplunkQuery datasource selection');
34
+ };
35
+ const handleQueryChange = (newQuery)=>{
36
+ onChange(produce(value, (draft)=>{
37
+ draft.query = newQuery;
38
+ }));
39
+ };
40
+ return /*#__PURE__*/ _jsxs(Stack, {
41
+ spacing: 1.5,
42
+ paddingBottom: 1,
43
+ children: [
44
+ /*#__PURE__*/ _jsxs(Box, {
45
+ children: [
46
+ /*#__PURE__*/ _jsx(InputLabel, {
47
+ sx: {
48
+ display: 'block',
49
+ marginBottom: '4px',
50
+ fontWeight: 500
51
+ },
52
+ children: "Datasource"
53
+ }),
54
+ /*#__PURE__*/ _jsx(DatasourceSelect, {
55
+ datasourcePluginKind: DATASOURCE_KIND,
56
+ value: selectedDatasource,
57
+ onChange: handleDatasourceChange,
58
+ label: "Splunk Datasource",
59
+ notched: true
60
+ })
61
+ ]
62
+ }),
63
+ /*#__PURE__*/ _jsxs(Box, {
64
+ children: [
65
+ /*#__PURE__*/ _jsx(InputLabel, {
66
+ sx: {
67
+ display: 'block',
68
+ marginBottom: '4px',
69
+ fontWeight: 500
70
+ },
71
+ children: "SPL Query"
72
+ }),
73
+ /*#__PURE__*/ _jsx(TextField, {
74
+ fullWidth: true,
75
+ multiline: true,
76
+ rows: 4,
77
+ value: query,
78
+ onChange: (e)=>handleQueryChange(e.target.value),
79
+ placeholder: "search index=main error"
80
+ })
81
+ ]
82
+ })
83
+ ]
84
+ });
85
+ }
86
+
87
+ //# sourceMappingURL=SplunkLogQueryEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-log-query/SplunkLogQueryEditor.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 useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { Box, InputLabel, Stack, TextField } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { produce } from 'immer';\nimport { SplunkLogQuerySpec } from './splunk-log-query-types';\n\nconst DATASOURCE_KIND = 'SplunkDatasource';\nconst DEFAULT_DATASOURCE = { kind: DATASOURCE_KIND };\n\ntype SplunkLogQueryEditorProps = OptionsEditorProps<SplunkLogQuerySpec>;\n\nexport function SplunkLogQueryEditor(props: SplunkLogQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource, query } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, DATASOURCE_KIND);\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\n throw new Error('Got unexpected non SplunkQuery datasource selection');\n };\n\n const handleQueryChange = (newQuery: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = newQuery;\n })\n );\n };\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <Box>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Splunk Datasource\"\n notched\n />\n </Box>\n\n <Box>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n SPL Query\n </InputLabel>\n <TextField\n fullWidth\n multiline\n rows={4}\n value={query}\n onChange={(e) => handleQueryChange(e.target.value)}\n placeholder=\"search index=main error\"\n />\n </Box>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","Box","InputLabel","Stack","TextField","produce","DATASOURCE_KIND","DEFAULT_DATASOURCE","kind","SplunkLogQueryEditor","props","onChange","value","datasource","query","datasourceSelectValue","selectedDatasource","handleDatasourceChange","newDatasourceSelection","draft","Error","handleQueryChange","newQuery","spacing","paddingBottom","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","fullWidth","multiline","rows","e","target","placeholder"],"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,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAElE,SAASC,OAAO,QAAQ,QAAQ;AAGhC,MAAMC,kBAAkB;AACxB,MAAMC,qBAAqB;IAAEC,MAAMF;AAAgB;AAInD,OAAO,SAASG,qBAAqBC,KAAgC;IACnE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAEC,KAAK,EAAE,GAAGF;IAC9B,MAAMG,wBAAwBF,cAAcN;IAC5C,MAAMS,qBAAqBhB,mCAAmCe,uBAAuBT;IAErF,MAAMW,yBAA4D,CAACC;QACjE,IAAI,CAACnB,qBAAqBmB,2BAA2BA,uBAAuBV,IAAI,KAAKF,iBAAiB;YACpGK,SACEN,QAAQO,OAAO,CAACO;gBACdA,MAAMN,UAAU,GAAGK;YACrB;YAEF;QACF;QAEA,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAMC,oBAAoB,CAACC;QACzBX,SACEN,QAAQO,OAAO,CAACO;YACdA,MAAML,KAAK,GAAGQ;QAChB;IAEJ;IAEA,qBACE,MAACnB;QAAMoB,SAAS;QAAKC,eAAe;;0BAClC,MAACvB;;kCACC,KAACC;wBACCuB,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC9B;wBACC+B,sBAAsBvB;wBACtBM,OAAOI;wBACPL,UAAUM;wBACVa,OAAM;wBACNC,OAAO;;;;0BAIX,MAAC9B;;kCACC,KAACC;wBACCuB,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACxB;wBACC4B,SAAS;wBACTC,SAAS;wBACTC,MAAM;wBACNtB,OAAOE;wBACPH,UAAU,CAACwB,IAAMd,kBAAkBc,EAAEC,MAAM,CAACxB,KAAK;wBACjDyB,aAAY;;;;;;AAKtB"}
@@ -0,0 +1,4 @@
1
+ import { SplunkLogQuerySpec } from './splunk-log-query-types';
2
+ import { LogQueryPlugin } from './log-query-plugin-interface';
3
+ export declare const getSplunkLogData: LogQueryPlugin<SplunkLogQuerySpec>['getLogData'];
4
+ //# sourceMappingURL=get-splunk-log-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-splunk-log-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-log-query/get-splunk-log-data.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAmB,MAAM,8BAA8B,CAAC;AAyB/E,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC,YAAY,CAqG7E,CAAC"}
@@ -0,0 +1,119 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { replaceVariables } from '@perses-dev/plugin-system';
14
+ import { DEFAULT_DATASOURCE } from '../constants';
15
+ function convertResultsToLogs(results) {
16
+ const resultsArray = Array.isArray(results) ? results : [
17
+ results
18
+ ];
19
+ const entries = resultsArray.map((result)=>({
20
+ timestamp: new Date(result._time).getTime() / 1000,
21
+ line: result._raw || JSON.stringify(result),
22
+ // Convert all other response properties to labels, excluding '_time' and '_raw' as they are used in panel row display
23
+ labels: Object.fromEntries(Object.entries(result).filter(([key])=>key !== '_time' && key !== '_raw'))
24
+ }));
25
+ return {
26
+ entries,
27
+ totalCount: entries.length
28
+ };
29
+ }
30
+ export const getSplunkLogData = async (spec, context)=>{
31
+ if (!spec.query) {
32
+ return {
33
+ logs: {
34
+ entries: [],
35
+ totalCount: 0
36
+ },
37
+ timeRange: {
38
+ start: context.timeRange.start,
39
+ end: context.timeRange.end
40
+ }
41
+ };
42
+ }
43
+ const query = replaceVariables(spec.query, context.variableState);
44
+ const client = await context.datasourceStore.getDatasourceClient(spec.datasource ?? DEFAULT_DATASOURCE);
45
+ const datasourceSpec = await context.datasourceStore.getDatasource(spec.datasource ?? DEFAULT_DATASOURCE);
46
+ const allowedEndpoints = datasourceSpec.plugin.spec?.proxy?.spec?.allowedEndpoints || [];
47
+ const hasExportEndpoint = allowedEndpoints.some((ep)=>ep.endpointPattern?.includes('/export'));
48
+ //TODO - Ideally this Indexes endpoint to be pushed inside the explorer view.
49
+ const hasIndexesEndpoint = allowedEndpoints.some((ep)=>ep.endpointPattern?.includes('/indexes'));
50
+ const { start, end } = context.timeRange;
51
+ const earliest_time = Math.floor(start.getTime() / 1000).toString();
52
+ const latest_time = Math.floor(end.getTime() / 1000).toString();
53
+ let eventsResponse;
54
+ if (hasExportEndpoint || datasourceSpec.plugin.spec.directUrl) {
55
+ eventsResponse = await client.exportSearch({
56
+ search: query,
57
+ earliest_time: spec.earliest || earliest_time,
58
+ latest_time: spec.latest || latest_time
59
+ });
60
+ } else if (hasIndexesEndpoint || datasourceSpec.plugin.spec.directUrl) {
61
+ //TODO - Ideally this Indexes endpoint to be pushed inside the explorer view.
62
+ const indexesResponse = await client.getIndexes();
63
+ const entries = indexesResponse?.entry ? indexesResponse.entry.map((index)=>({
64
+ // Use current time as timestamp since index response does not include a timestamp.
65
+ timestamp: new Date().getTime() / 1000,
66
+ line: index.name,
67
+ // Convert all other index response properties to labels, excluding 'name' as it is used in panel row display
68
+ labels: Object.fromEntries(Object.entries(index).filter(([key])=>key !== 'name').map(([key, value])=>[
69
+ key,
70
+ typeof value === 'object' ? JSON.stringify(value) : String(value)
71
+ ]))
72
+ })) : [];
73
+ return {
74
+ logs: {
75
+ entries,
76
+ totalCount: entries.length
77
+ },
78
+ timeRange: {
79
+ start,
80
+ end
81
+ },
82
+ metadata: {
83
+ executedQueryString: query
84
+ }
85
+ };
86
+ } else {
87
+ const jobResponse = await client.createJob({
88
+ search: query,
89
+ earliest_time: spec.earliest || earliest_time,
90
+ latest_time: spec.latest || latest_time
91
+ });
92
+ const jobId = jobResponse.sid;
93
+ let jobStatus;
94
+ do {
95
+ await new Promise((resolve)=>setTimeout(resolve, 500));
96
+ jobStatus = await client.getJobStatus(jobId);
97
+ if (!jobStatus || !jobStatus.entry?.[0]?.content) {
98
+ console.warn('Failed to get job status or job status response is malformed', {
99
+ jobStatus
100
+ });
101
+ break;
102
+ }
103
+ }while (!jobStatus.entry?.[0]?.content?.isDone)
104
+ eventsResponse = await client.getJobResults(jobId);
105
+ }
106
+ const logs = convertResultsToLogs(eventsResponse.results);
107
+ return {
108
+ logs,
109
+ timeRange: {
110
+ start,
111
+ end
112
+ },
113
+ metadata: {
114
+ executedQueryString: query
115
+ }
116
+ };
117
+ };
118
+
119
+ //# sourceMappingURL=get-splunk-log-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-log-query/get-splunk-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 { replaceVariables } from '@perses-dev/plugin-system';\nimport { HTTPAllowedEndpoint, LogData, LogEntry } from '@perses-dev/spec';\nimport { SplunkClient } from '../../model/splunk-client';\nimport { SplunkDatasourceSpec } from '../../datasources/splunk-datasource/splunk-datasource-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport {\n SplunkIndexResponse,\n SplunkJobCreateResponse,\n SplunkJobStatusResponse,\n SplunkResultsResponse,\n} from '../../model/splunk-client-types';\nimport { SplunkLogQuerySpec } from './splunk-log-query-types';\nimport { LogQueryPlugin, LogQueryContext } from './log-query-plugin-interface';\n\nfunction convertResultsToLogs(\n results:\n | Array<{ _time: string; _raw: string; [key: string]: string | number }>\n | { _time: string; _raw: string; [key: string]: string | number }\n): LogData {\n const resultsArray = Array.isArray(results) ? results : [results];\n\n const entries: LogEntry[] = resultsArray.map((result) => ({\n timestamp: new Date(result._time).getTime() / 1000,\n line: result._raw || JSON.stringify(result),\n // Convert all other response properties to labels, excluding '_time' and '_raw' as they are used in panel row display\n labels: Object.fromEntries(Object.entries(result).filter(([key]) => key !== '_time' && key !== '_raw')) as Record<\n string,\n string\n >,\n }));\n\n return {\n entries,\n totalCount: entries.length,\n };\n}\n\nexport const getSplunkLogData: LogQueryPlugin<SplunkLogQuerySpec>['getLogData'] = async (\n spec: SplunkLogQuerySpec,\n context: LogQueryContext\n) => {\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 query = replaceVariables(spec.query, context.variableState);\n const client: SplunkClient = await context.datasourceStore.getDatasourceClient<SplunkClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n );\n\n const datasourceSpec = await context.datasourceStore.getDatasource(spec.datasource ?? DEFAULT_DATASOURCE);\n const allowedEndpoints: HTTPAllowedEndpoint[] =\n (datasourceSpec.plugin.spec as SplunkDatasourceSpec)?.proxy?.spec?.allowedEndpoints || [];\n\n const hasExportEndpoint: boolean = allowedEndpoints.some((ep: HTTPAllowedEndpoint) =>\n ep.endpointPattern?.includes('/export')\n );\n //TODO - Ideally this Indexes endpoint to be pushed inside the explorer view.\n const hasIndexesEndpoint: boolean = allowedEndpoints.some((ep: HTTPAllowedEndpoint) =>\n ep.endpointPattern?.includes('/indexes')\n );\n\n const { start, end } = context.timeRange;\n\n const earliest_time: string = Math.floor(start.getTime() / 1000).toString();\n const latest_time: string = Math.floor(end.getTime() / 1000).toString();\n\n let eventsResponse: SplunkResultsResponse;\n\n if (hasExportEndpoint || datasourceSpec.plugin.spec.directUrl) {\n eventsResponse = await client.exportSearch({\n search: query,\n earliest_time: spec.earliest || earliest_time,\n latest_time: spec.latest || latest_time,\n });\n } else if (hasIndexesEndpoint || datasourceSpec.plugin.spec.directUrl) {\n //TODO - Ideally this Indexes endpoint to be pushed inside the explorer view.\n const indexesResponse: SplunkIndexResponse = await client.getIndexes();\n const entries = indexesResponse?.entry\n ? indexesResponse.entry.map((index) => ({\n // Use current time as timestamp since index response does not include a timestamp.\n timestamp: new Date().getTime() / 1000,\n line: index.name,\n // Convert all other index response properties to labels, excluding 'name' as it is used in panel row display\n labels: Object.fromEntries(\n Object.entries(index)\n .filter(([key]) => key !== 'name')\n .map(([key, value]) => [key, typeof value === 'object' ? JSON.stringify(value) : String(value)])\n ) as Record<string, string>,\n }))\n : [];\n\n return {\n logs: {\n entries,\n totalCount: entries.length,\n },\n timeRange: { start, end },\n metadata: {\n executedQueryString: query,\n },\n };\n } else {\n const jobResponse: SplunkJobCreateResponse = await client.createJob({\n search: query,\n earliest_time: spec.earliest || earliest_time,\n latest_time: spec.latest || latest_time,\n });\n\n const jobId: string = jobResponse.sid;\n\n let jobStatus: SplunkJobStatusResponse;\n do {\n await new Promise((resolve) => setTimeout(resolve, 500));\n jobStatus = await client.getJobStatus(jobId);\n if (!jobStatus || !jobStatus.entry?.[0]?.content) {\n console.warn('Failed to get job status or job status response is malformed', { jobStatus });\n break;\n }\n } while (!jobStatus.entry?.[0]?.content?.isDone);\n\n eventsResponse = await client.getJobResults(jobId);\n }\n\n const logs: LogData = convertResultsToLogs(\n eventsResponse.results as Array<{ _time: string; _raw: string; [key: string]: string | number }>\n );\n\n return {\n logs,\n timeRange: { start, end },\n metadata: {\n executedQueryString: query,\n },\n };\n};\n"],"names":["replaceVariables","DEFAULT_DATASOURCE","convertResultsToLogs","results","resultsArray","Array","isArray","entries","map","result","timestamp","Date","_time","getTime","line","_raw","JSON","stringify","labels","Object","fromEntries","filter","key","totalCount","length","getSplunkLogData","spec","context","query","logs","timeRange","start","end","variableState","client","datasourceStore","getDatasourceClient","datasource","datasourceSpec","getDatasource","allowedEndpoints","plugin","proxy","hasExportEndpoint","some","ep","endpointPattern","includes","hasIndexesEndpoint","earliest_time","Math","floor","toString","latest_time","eventsResponse","directUrl","exportSearch","search","earliest","latest","indexesResponse","getIndexes","entry","index","name","value","String","metadata","executedQueryString","jobResponse","createJob","jobId","sid","jobStatus","Promise","resolve","setTimeout","getJobStatus","content","console","warn","isDone","getJobResults"],"mappings":"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"}
@@ -0,0 +1,5 @@
1
+ export * from './get-splunk-log-data';
2
+ export * from './SplunkLogQuery';
3
+ export * from './SplunkLogQueryEditor';
4
+ export * from './splunk-log-query-types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-log-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,18 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './get-splunk-log-data';
14
+ export * from './SplunkLogQuery';
15
+ export * from './SplunkLogQueryEditor';
16
+ export * from './splunk-log-query-types';
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-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 './get-splunk-log-data';\nexport * from './SplunkLogQuery';\nexport * from './SplunkLogQueryEditor';\nexport * from './splunk-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,wBAAwB;AACtC,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,2BAA2B"}
@@ -0,0 +1,23 @@
1
+ import { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';
2
+ import { AbsoluteTimeRange, LogData, UnknownSpec } from '@perses-dev/spec';
3
+ export interface LogQueryResult {
4
+ logs: LogData;
5
+ timeRange: AbsoluteTimeRange;
6
+ metadata?: {
7
+ executedQueryString: string;
8
+ };
9
+ }
10
+ export interface LogQueryContext {
11
+ timeRange: AbsoluteTimeRange;
12
+ variableState: VariableStateMap;
13
+ datasourceStore: DatasourceStore;
14
+ }
15
+ type LogQueryPluginDependencies = {
16
+ variables?: string[];
17
+ };
18
+ export interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {
19
+ getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;
20
+ dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=log-query-plugin-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-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,eAAe;IAC9B,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,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;CAC9E"}
@@ -0,0 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=log-query-plugin-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-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 LogQueryContext {\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: LogQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,WAGC"}
@@ -0,0 +1,11 @@
1
+ import { DatasourceSelector } from '@perses-dev/spec';
2
+ import { SplunkLogResults } from '../../model/splunk-client-types';
3
+ export interface SplunkLogQuerySpec {
4
+ query: string;
5
+ datasource?: DatasourceSelector;
6
+ earliest?: string;
7
+ latest?: string;
8
+ maxResults?: number;
9
+ }
10
+ export type SplunkLogQueryResponse = SplunkLogResults;
11
+ //# sourceMappingURL=splunk-log-query-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splunk-log-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-log-query/splunk-log-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { };
14
+
15
+ //# sourceMappingURL=splunk-log-query-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-log-query/splunk-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';\nimport { SplunkLogResults } from '../../model/splunk-client-types';\n\nexport interface SplunkLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n earliest?: string;\n latest?: string;\n maxResults?: number;\n}\n\nexport type SplunkLogQueryResponse = SplunkLogResults;\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;AAajC,WAAsD"}
@@ -0,0 +1,4 @@
1
+ import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import { SplunkTimeSeriesQuerySpec } from './splunk-time-series-query-types';
3
+ export declare const SplunkTimeSeriesQuery: TimeSeriesQueryPlugin<SplunkTimeSeriesQuerySpec>;
4
+ //# sourceMappingURL=SplunkTimeSeriesQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplunkTimeSeriesQuery.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-time-series-query/SplunkTimeSeriesQuery.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAkB,MAAM,2BAA2B,CAAC;AAGlF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,eAAO,MAAM,qBAAqB,EAAE,qBAAqB,CAAC,yBAAyB,CAWlF,CAAC"}
@@ -0,0 +1,35 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { parseVariables } from '@perses-dev/plugin-system';
14
+ import { getSplunkTimeSeriesData } from './get-splunk-time-series-data';
15
+ import { SplunkTimeSeriesQueryEditor } from './SplunkTimeSeriesQueryEditor';
16
+ export const SplunkTimeSeriesQuery = {
17
+ getTimeSeriesData: getSplunkTimeSeriesData,
18
+ OptionsEditorComponent: SplunkTimeSeriesQueryEditor,
19
+ createInitialOptions: ()=>({
20
+ query: ''
21
+ }),
22
+ dependsOn: (spec)=>{
23
+ const queryVariables = parseVariables(spec.query);
24
+ const allVariables = [
25
+ ...new Set([
26
+ ...queryVariables
27
+ ])
28
+ ];
29
+ return {
30
+ variables: allVariables
31
+ };
32
+ }
33
+ };
34
+
35
+ //# sourceMappingURL=SplunkTimeSeriesQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-time-series-query/SplunkTimeSeriesQuery.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 { TimeSeriesQueryPlugin, parseVariables } from '@perses-dev/plugin-system';\nimport { getSplunkTimeSeriesData } from './get-splunk-time-series-data';\nimport { SplunkTimeSeriesQueryEditor } from './SplunkTimeSeriesQueryEditor';\nimport { SplunkTimeSeriesQuerySpec } from './splunk-time-series-query-types';\n\nexport const SplunkTimeSeriesQuery: TimeSeriesQueryPlugin<SplunkTimeSeriesQuerySpec> = {\n getTimeSeriesData: getSplunkTimeSeriesData,\n OptionsEditorComponent: SplunkTimeSeriesQueryEditor,\n createInitialOptions: () => ({ query: '' }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n const allVariables = [...new Set([...queryVariables])];\n return {\n variables: allVariables,\n };\n },\n};\n"],"names":["parseVariables","getSplunkTimeSeriesData","SplunkTimeSeriesQueryEditor","SplunkTimeSeriesQuery","getTimeSeriesData","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,SAAgCA,cAAc,QAAQ,4BAA4B;AAClF,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,2BAA2B,QAAQ,gCAAgC;AAG5E,OAAO,MAAMC,wBAA0E;IACrFC,mBAAmBH;IACnBI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAAEC,OAAO;QAAG,CAAA;IACzCC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAI;mBAAIF;aAAe;SAAE;QACtD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SplunkTimeSeriesQuery.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplunkTimeSeriesQuery.test.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-time-series-query/SplunkTimeSeriesQuery.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { OptionsEditorProps } from '@perses-dev/plugin-system';
2
+ import { ReactElement } from 'react';
3
+ import { SplunkTimeSeriesQuerySpec } from './splunk-time-series-query-types';
4
+ type SplunkQueryEditorProps = OptionsEditorProps<SplunkTimeSeriesQuerySpec>;
5
+ export declare function SplunkTimeSeriesQueryEditor(props: SplunkQueryEditorProps): ReactElement;
6
+ export {};
7
+ //# sourceMappingURL=SplunkTimeSeriesQueryEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SplunkTimeSeriesQueryEditor.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAIL,kBAAkB,EAEnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAK7E,KAAK,sBAAsB,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,CAAC;AAE5E,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAqEvF"}
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Copyright The Perses Authors
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { DatasourceSelect, isVariableDatasource, useDatasourceSelectValueToSelector } from '@perses-dev/plugin-system';
15
+ import { Box, InputLabel, Stack, TextField } from '@mui/material';
16
+ import { produce } from 'immer';
17
+ const DATASOURCE_KIND = 'SplunkDatasource';
18
+ const DEFAULT_DATASOURCE = {
19
+ kind: DATASOURCE_KIND
20
+ };
21
+ export function SplunkTimeSeriesQueryEditor(props) {
22
+ const { onChange, value } = props;
23
+ const { datasource, query } = value;
24
+ const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;
25
+ const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, DATASOURCE_KIND);
26
+ const handleDatasourceChange = (newDatasourceSelection)=>{
27
+ if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {
28
+ onChange(produce(value, (draft)=>{
29
+ draft.datasource = newDatasourceSelection;
30
+ }));
31
+ return;
32
+ }
33
+ throw new Error('Got unexpected non SplunkQuery datasource selection');
34
+ };
35
+ const handleQueryChange = (newQuery)=>{
36
+ onChange(produce(value, (draft)=>{
37
+ draft.query = newQuery;
38
+ }));
39
+ };
40
+ return /*#__PURE__*/ _jsxs(Stack, {
41
+ spacing: 1.5,
42
+ paddingBottom: 1,
43
+ children: [
44
+ /*#__PURE__*/ _jsxs(Box, {
45
+ children: [
46
+ /*#__PURE__*/ _jsx(InputLabel, {
47
+ sx: {
48
+ display: 'block',
49
+ marginBottom: '4px',
50
+ fontWeight: 500
51
+ },
52
+ children: "Datasource"
53
+ }),
54
+ /*#__PURE__*/ _jsx(DatasourceSelect, {
55
+ datasourcePluginKind: DATASOURCE_KIND,
56
+ value: selectedDatasource,
57
+ onChange: handleDatasourceChange,
58
+ label: "Splunk Datasource",
59
+ notched: true
60
+ })
61
+ ]
62
+ }),
63
+ /*#__PURE__*/ _jsxs(Box, {
64
+ children: [
65
+ /*#__PURE__*/ _jsx(InputLabel, {
66
+ sx: {
67
+ display: 'block',
68
+ marginBottom: '4px',
69
+ fontWeight: 500
70
+ },
71
+ children: "SPL Query"
72
+ }),
73
+ /*#__PURE__*/ _jsx(TextField, {
74
+ fullWidth: true,
75
+ multiline: true,
76
+ rows: 4,
77
+ value: query,
78
+ onChange: (e)=>handleQueryChange(e.target.value),
79
+ placeholder: "search index=main | timechart count"
80
+ })
81
+ ]
82
+ })
83
+ ]
84
+ });
85
+ }
86
+
87
+ //# sourceMappingURL=SplunkTimeSeriesQueryEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/queries/splunk-time-series-query/SplunkTimeSeriesQueryEditor.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 useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { Box, InputLabel, Stack, TextField } from '@mui/material';\nimport { ReactElement } from 'react';\nimport { produce } from 'immer';\nimport { SplunkTimeSeriesQuerySpec } from './splunk-time-series-query-types';\n\nconst DATASOURCE_KIND = 'SplunkDatasource';\nconst DEFAULT_DATASOURCE = { kind: DATASOURCE_KIND };\n\ntype SplunkQueryEditorProps = OptionsEditorProps<SplunkTimeSeriesQuerySpec>;\n\nexport function SplunkTimeSeriesQueryEditor(props: SplunkQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource, query } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(datasourceSelectValue, DATASOURCE_KIND);\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\n throw new Error('Got unexpected non SplunkQuery datasource selection');\n };\n\n const handleQueryChange = (newQuery: string): void => {\n onChange(\n produce(value, (draft) => {\n draft.query = newQuery;\n })\n );\n };\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <Box>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Splunk Datasource\"\n notched\n />\n </Box>\n\n <Box>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n SPL Query\n </InputLabel>\n <TextField\n fullWidth\n multiline\n rows={4}\n value={query}\n onChange={(e) => handleQueryChange(e.target.value)}\n placeholder=\"search index=main | timechart count\"\n />\n </Box>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","Box","InputLabel","Stack","TextField","produce","DATASOURCE_KIND","DEFAULT_DATASOURCE","kind","SplunkTimeSeriesQueryEditor","props","onChange","value","datasource","query","datasourceSelectValue","selectedDatasource","handleDatasourceChange","newDatasourceSelection","draft","Error","handleQueryChange","newQuery","spacing","paddingBottom","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","fullWidth","multiline","rows","e","target","placeholder"],"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,EAEpBC,kCAAkC,QAC7B,4BAA4B;AACnC,SAASC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,QAAQ,gBAAgB;AAElE,SAASC,OAAO,QAAQ,QAAQ;AAGhC,MAAMC,kBAAkB;AACxB,MAAMC,qBAAqB;IAAEC,MAAMF;AAAgB;AAInD,OAAO,SAASG,4BAA4BC,KAA6B;IACvE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAC5B,MAAM,EAAEG,UAAU,EAAEC,KAAK,EAAE,GAAGF;IAC9B,MAAMG,wBAAwBF,cAAcN;IAC5C,MAAMS,qBAAqBhB,mCAAmCe,uBAAuBT;IAErF,MAAMW,yBAA4D,CAACC;QACjE,IAAI,CAACnB,qBAAqBmB,2BAA2BA,uBAAuBV,IAAI,KAAKF,iBAAiB;YACpGK,SACEN,QAAQO,OAAO,CAACO;gBACdA,MAAMN,UAAU,GAAGK;YACrB;YAEF;QACF;QAEA,MAAM,IAAIE,MAAM;IAClB;IAEA,MAAMC,oBAAoB,CAACC;QACzBX,SACEN,QAAQO,OAAO,CAACO;YACdA,MAAML,KAAK,GAAGQ;QAChB;IAEJ;IAEA,qBACE,MAACnB;QAAMoB,SAAS;QAAKC,eAAe;;0BAClC,MAACvB;;kCACC,KAACC;wBACCuB,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC9B;wBACC+B,sBAAsBvB;wBACtBM,OAAOI;wBACPL,UAAUM;wBACVa,OAAM;wBACNC,OAAO;;;;0BAIX,MAAC9B;;kCACC,KAACC;wBACCuB,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACxB;wBACC4B,SAAS;wBACTC,SAAS;wBACTC,MAAM;wBACNtB,OAAOE;wBACPH,UAAU,CAACwB,IAAMd,kBAAkBc,EAAEC,MAAM,CAACxB,KAAK;wBACjDyB,aAAY;;;;;;AAKtB"}
@@ -0,0 +1,4 @@
1
+ import { TimeSeriesQueryPlugin } from '@perses-dev/plugin-system';
2
+ import { SplunkTimeSeriesQuerySpec } from './splunk-time-series-query-types';
3
+ export declare const getSplunkTimeSeriesData: TimeSeriesQueryPlugin<SplunkTimeSeriesQuerySpec>['getTimeSeriesData'];
4
+ //# sourceMappingURL=get-splunk-time-series-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-splunk-time-series-data.d.ts","sourceRoot":"","sources":["../../../../src/queries/splunk-time-series-query/get-splunk-time-series-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,qBAAqB,EAAoB,MAAM,2BAA2B,CAAC;AAMpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAyB7E,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,CAAC,yBAAyB,CAAC,CAAC,mBAAmB,CAsEzG,CAAC"}