plugin-elastic-report 0.0.0-stage → 0.7.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 (272) hide show
  1. package/ai/skills/elastic-report/SKILLS.md +34 -0
  2. package/client-v2.d.ts +2 -0
  3. package/client-v2.js +1 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/357.0dd385384cab5dbf.js +10 -0
  7. package/dist/client/index.js +10 -0
  8. package/dist/client-v2/851.142c93fc6d666b28.js +10 -0
  9. package/dist/client-v2/857.a5bf9637d5fd4ef5.js +10 -0
  10. package/dist/client-v2/877.f4095a3dbcadf98f.js +10 -0
  11. package/dist/client-v2/index.js +10 -0
  12. package/dist/externalVersion.js +21 -0
  13. package/dist/index.js +48 -0
  14. package/dist/locale/en-US.json +198 -0
  15. package/dist/locale/vi-VN.json +198 -0
  16. package/dist/locale/zh-CN.json +198 -0
  17. package/dist/node_modules/@elastic/elasticsearch/.dockerignore +11 -0
  18. package/dist/node_modules/@elastic/elasticsearch/LICENSE +202 -0
  19. package/dist/node_modules/@elastic/elasticsearch/NOTICE.txt +2 -0
  20. package/dist/node_modules/@elastic/elasticsearch/catalog-info.yaml +50 -0
  21. package/dist/node_modules/@elastic/elasticsearch/codecov.yml +14 -0
  22. package/dist/node_modules/@elastic/elasticsearch/index.d.ts +28 -0
  23. package/dist/node_modules/@elastic/elasticsearch/index.js +85525 -0
  24. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.d.ts +39 -0
  25. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.js +155 -0
  26. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.d.ts +39 -0
  27. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.js +130 -0
  28. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.d.ts +14 -0
  29. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js +60 -0
  30. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.d.ts +14 -0
  31. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.js +43 -0
  32. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.d.ts +193 -0
  33. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.js +766 -0
  34. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.d.ts +102 -0
  35. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.js +395 -0
  36. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.d.ts +14 -0
  37. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.js +60 -0
  38. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.d.ts +14 -0
  39. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.js +56 -0
  40. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.d.ts +123 -0
  41. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.js +482 -0
  42. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.d.ts +245 -0
  43. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.js +1121 -0
  44. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.d.ts +14 -0
  45. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.js +68 -0
  46. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.d.ts +14 -0
  47. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.js +53 -0
  48. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.d.ts +32 -0
  49. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.js +100 -0
  50. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.d.ts +14 -0
  51. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.js +46 -0
  52. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.d.ts +14 -0
  53. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.js +59 -0
  54. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.d.ts +14 -0
  55. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.js +45 -0
  56. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.d.ts +14 -0
  57. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.js +45 -0
  58. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.d.ts +46 -0
  59. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.js +169 -0
  60. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.d.ts +39 -0
  61. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.js +139 -0
  62. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.d.ts +46 -0
  63. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.js +170 -0
  64. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.d.ts +14 -0
  65. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.js +46 -0
  66. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.d.ts +14 -0
  67. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.js +46 -0
  68. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.d.ts +14 -0
  69. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.js +60 -0
  70. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.d.ts +25 -0
  71. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.js +75 -0
  72. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.d.ts +14 -0
  73. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.js +68 -0
  74. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.d.ts +50 -0
  75. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.js +211 -0
  76. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.d.ts +14 -0
  77. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.js +46 -0
  78. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.d.ts +14 -0
  79. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.js +45 -0
  80. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.d.ts +14 -0
  81. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.js +43 -0
  82. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.d.ts +14 -0
  83. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.js +43 -0
  84. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.d.ts +14 -0
  85. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.js +46 -0
  86. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.d.ts +18 -0
  87. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.js +70 -0
  88. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.d.ts +14 -0
  89. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.js +54 -0
  90. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.d.ts +88 -0
  91. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.js +329 -0
  92. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.d.ts +14 -0
  93. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.js +61 -0
  94. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.d.ts +494 -0
  95. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.js +2133 -0
  96. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.d.ts +221 -0
  97. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.js +1167 -0
  98. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.d.ts +14 -0
  99. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.js +43 -0
  100. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.d.ts +95 -0
  101. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.js +389 -0
  102. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.d.ts +14 -0
  103. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.js +59 -0
  104. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.d.ts +60 -0
  105. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.js +194 -0
  106. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.d.ts +32 -0
  107. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.js +118 -0
  108. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.d.ts +14 -0
  109. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.js +68 -0
  110. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.d.ts +32 -0
  111. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.js +107 -0
  112. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.d.ts +522 -0
  113. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.js +2468 -0
  114. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.d.ts +18 -0
  115. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.js +60 -0
  116. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.d.ts +14 -0
  117. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js +60 -0
  118. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.d.ts +14 -0
  119. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.js +60 -0
  120. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.d.ts +14 -0
  121. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.js +68 -0
  122. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.d.ts +60 -0
  123. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.js +290 -0
  124. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.d.ts +14 -0
  125. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.js +59 -0
  126. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.d.ts +14 -0
  127. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.js +43 -0
  128. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.d.ts +39 -0
  129. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.js +135 -0
  130. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.d.ts +14 -0
  131. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.js +68 -0
  132. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.d.ts +67 -0
  133. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.js +260 -0
  134. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.d.ts +14 -0
  135. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.js +67 -0
  136. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.d.ts +14 -0
  137. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.js +56 -0
  138. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.d.ts +14 -0
  139. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.js +45 -0
  140. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.d.ts +14 -0
  141. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.js +68 -0
  142. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.d.ts +67 -0
  143. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.js +263 -0
  144. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.d.ts +14 -0
  145. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.js +57 -0
  146. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.d.ts +14 -0
  147. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.js +59 -0
  148. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.d.ts +14 -0
  149. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.js +75 -0
  150. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.d.ts +81 -0
  151. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.js +313 -0
  152. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.d.ts +14 -0
  153. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.js +63 -0
  154. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.d.ts +14 -0
  155. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.js +54 -0
  156. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.d.ts +14 -0
  157. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.js +68 -0
  158. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.d.ts +39 -0
  159. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.js +167 -0
  160. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.d.ts +459 -0
  161. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.js +1982 -0
  162. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.d.ts +32 -0
  163. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.js +125 -0
  164. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.d.ts +18 -0
  165. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.js +78 -0
  166. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.d.ts +74 -0
  167. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.js +253 -0
  168. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.d.ts +102 -0
  169. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.js +410 -0
  170. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.d.ts +53 -0
  171. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.js +205 -0
  172. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.d.ts +18 -0
  173. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.js +54 -0
  174. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.d.ts +32 -0
  175. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.js +96 -0
  176. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.d.ts +60 -0
  177. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.js +223 -0
  178. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.d.ts +32 -0
  179. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.js +109 -0
  180. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.d.ts +14 -0
  181. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.js +59 -0
  182. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.d.ts +14 -0
  183. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.js +68 -0
  184. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.d.ts +39 -0
  185. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.js +148 -0
  186. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.d.ts +101 -0
  187. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.js +386 -0
  188. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.d.ts +14 -0
  189. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.js +60 -0
  190. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.d.ts +14 -0
  191. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.js +59 -0
  192. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.d.ts +14 -0
  193. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.js +45 -0
  194. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.d.ts +102 -0
  195. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.js +405 -0
  196. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.d.ts +25 -0
  197. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.js +75 -0
  198. package/dist/node_modules/@elastic/elasticsearch/lib/api/index.d.ts +265 -0
  199. package/dist/node_modules/@elastic/elasticsearch/lib/api/index.js +632 -0
  200. package/dist/node_modules/@elastic/elasticsearch/lib/api/types.d.ts +19933 -0
  201. package/dist/node_modules/@elastic/elasticsearch/lib/api/types.js +21 -0
  202. package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.d.ts +20606 -0
  203. package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.js +21 -0
  204. package/dist/node_modules/@elastic/elasticsearch/lib/client.d.ts +152 -0
  205. package/dist/node_modules/@elastic/elasticsearch/lib/client.js +369 -0
  206. package/dist/node_modules/@elastic/elasticsearch/lib/helpers.d.ts +184 -0
  207. package/dist/node_modules/@elastic/elasticsearch/lib/helpers.js +889 -0
  208. package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.d.ts +4 -0
  209. package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.js +56 -0
  210. package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +15 -0
  211. package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +7 -0
  212. package/dist/node_modules/@elastic/elasticsearch/package.json +1 -0
  213. package/dist/node_modules/@elastic/elasticsearch/tsconfig.json +38 -0
  214. package/dist/server/acl-guard.js +179 -0
  215. package/dist/server/collections/es-report-data-views.js +85 -0
  216. package/dist/server/collections/es-reports.js +101 -0
  217. package/dist/server/index.js +58 -0
  218. package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
  219. package/dist/server/mcp/ElasticReportToolCatalog.js +639 -0
  220. package/dist/server/plugin.js +529 -0
  221. package/dist/server/services/ElasticReportService.js +377 -0
  222. package/dist/server/services/ElasticsearchConnectionService.js +572 -0
  223. package/dist/server/services/ReportExportService.js +243 -0
  224. package/dist/server/services/ReportQueryCompiler.js +1299 -0
  225. package/dist/server/workflow/ElasticReportQueryInstruction.js +123 -0
  226. package/dist/shared/constants.js +96 -0
  227. package/dist/shared/types.js +24 -0
  228. package/package.json +62 -4
  229. package/server.d.ts +2 -0
  230. package/server.js +1 -0
  231. package/src/client/index.tsx +34 -0
  232. package/src/client/workflow-instructions.tsx +44 -0
  233. package/src/client-v2/__tests__/elastic-report.test.tsx +791 -0
  234. package/src/client-v2/__tests__/kql-autocomplete.test.ts +178 -0
  235. package/src/client-v2/api.ts +320 -0
  236. package/src/client-v2/bus/DashboardFilterBus.ts +212 -0
  237. package/src/client-v2/components/ElasticBasicCharts.tsx +652 -0
  238. package/src/client-v2/components/ElasticFilterBar.tsx +372 -0
  239. package/src/client-v2/components/ElasticKqlInput.tsx +421 -0
  240. package/src/client-v2/components/ElasticReportBlock.tsx +306 -0
  241. package/src/client-v2/components/ElasticReportRenderer.tsx +1257 -0
  242. package/src/client-v2/components/HighlightText.tsx +50 -0
  243. package/src/client-v2/components/ReportSelect.tsx +85 -0
  244. package/src/client-v2/index.tsx +14 -0
  245. package/src/client-v2/locale.ts +23 -0
  246. package/src/client-v2/models/ElasticFilterBarBlockModel.tsx +115 -0
  247. package/src/client-v2/models/ElasticReportBlockModel.tsx +118 -0
  248. package/src/client-v2/pages/ElasticReportManager.tsx +1453 -0
  249. package/src/client-v2/plugin.tsx +72 -0
  250. package/src/client-v2/utils/kqlAutocomplete.ts +861 -0
  251. package/src/client-v2/workflow/instructions.tsx +149 -0
  252. package/src/index.ts +11 -0
  253. package/src/locale/en-US.json +198 -0
  254. package/src/locale/vi-VN.json +198 -0
  255. package/src/locale/zh-CN.json +198 -0
  256. package/src/server/__tests__/query-compiler.test.ts +620 -0
  257. package/src/server/__tests__/report-mcp-acl.integration.test.ts +645 -0
  258. package/src/server/acl-guard.ts +194 -0
  259. package/src/server/collections/es-report-data-views.ts +64 -0
  260. package/src/server/collections/es-reports.ts +80 -0
  261. package/src/server/index.ts +15 -0
  262. package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
  263. package/src/server/mcp/ElasticReportToolCatalog.ts +663 -0
  264. package/src/server/plugin.ts +599 -0
  265. package/src/server/services/ElasticReportService.ts +486 -0
  266. package/src/server/services/ElasticsearchConnectionService.ts +728 -0
  267. package/src/server/services/ReportExportService.ts +282 -0
  268. package/src/server/services/ReportQueryCompiler.ts +1552 -0
  269. package/src/server/workflow/ElasticReportQueryInstruction.ts +124 -0
  270. package/src/shared/constants.ts +36 -0
  271. package/src/shared/types.ts +272 -0
  272. package/README.md +0 -3
@@ -0,0 +1,1167 @@
1
+ "use strict";
2
+ /*
3
+ * Licensed to Elasticsearch B.V. under one or more contributor
4
+ * license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright
6
+ * ownership. Elasticsearch B.V. licenses this file to you under
7
+ * the Apache License, Version 2.0 (the "License"); you may
8
+ * not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ class Inference {
22
+ constructor(transport) {
23
+ Object.defineProperty(this, "transport", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ this.transport = transport;
30
+ }
31
+ async chatCompletionUnified(params, options) {
32
+ var _a;
33
+ const acceptedPath = ['inference_id'];
34
+ const acceptedBody = ['chat_completion_request'];
35
+ const querystring = {};
36
+ // @ts-expect-error
37
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
38
+ for (const key in params) {
39
+ if (acceptedBody.includes(key)) {
40
+ // @ts-expect-error
41
+ body = params[key];
42
+ }
43
+ else if (acceptedPath.includes(key)) {
44
+ continue;
45
+ }
46
+ else if (key !== 'body') {
47
+ // @ts-expect-error
48
+ querystring[key] = params[key];
49
+ }
50
+ }
51
+ const method = 'POST';
52
+ const path = `/_inference/chat_completion/${encodeURIComponent(params.inference_id.toString())}/_stream`;
53
+ const meta = {
54
+ name: 'inference.chat_completion_unified',
55
+ pathParts: {
56
+ inference_id: params.inference_id
57
+ }
58
+ };
59
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
60
+ }
61
+ async completion(params, options) {
62
+ const acceptedPath = ['inference_id'];
63
+ const acceptedBody = ['input', 'task_settings'];
64
+ const querystring = {};
65
+ // @ts-expect-error
66
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
67
+ let body;
68
+ if (typeof userBody === 'string') {
69
+ body = userBody;
70
+ }
71
+ else {
72
+ body = userBody != null ? { ...userBody } : undefined;
73
+ }
74
+ for (const key in params) {
75
+ if (acceptedBody.includes(key)) {
76
+ body = body !== null && body !== void 0 ? body : {};
77
+ // @ts-expect-error
78
+ body[key] = params[key];
79
+ }
80
+ else if (acceptedPath.includes(key)) {
81
+ continue;
82
+ }
83
+ else if (key !== 'body') {
84
+ // @ts-expect-error
85
+ querystring[key] = params[key];
86
+ }
87
+ }
88
+ const method = 'POST';
89
+ const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}`;
90
+ const meta = {
91
+ name: 'inference.completion',
92
+ pathParts: {
93
+ inference_id: params.inference_id
94
+ }
95
+ };
96
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
97
+ }
98
+ async delete(params, options) {
99
+ const acceptedPath = ['task_type', 'inference_id'];
100
+ const querystring = {};
101
+ const body = undefined;
102
+ for (const key in params) {
103
+ if (acceptedPath.includes(key)) {
104
+ continue;
105
+ }
106
+ else if (key !== 'body') {
107
+ // @ts-expect-error
108
+ querystring[key] = params[key];
109
+ }
110
+ }
111
+ let method = '';
112
+ let path = '';
113
+ if (params.task_type != null && params.inference_id != null) {
114
+ method = 'DELETE';
115
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
116
+ }
117
+ else {
118
+ method = 'DELETE';
119
+ path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
120
+ }
121
+ const meta = {
122
+ name: 'inference.delete',
123
+ pathParts: {
124
+ task_type: params.task_type,
125
+ inference_id: params.inference_id
126
+ }
127
+ };
128
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
129
+ }
130
+ async get(params, options) {
131
+ const acceptedPath = ['task_type', 'inference_id'];
132
+ const querystring = {};
133
+ const body = undefined;
134
+ params = params !== null && params !== void 0 ? params : {};
135
+ for (const key in params) {
136
+ if (acceptedPath.includes(key)) {
137
+ continue;
138
+ }
139
+ else if (key !== 'body') {
140
+ // @ts-expect-error
141
+ querystring[key] = params[key];
142
+ }
143
+ }
144
+ let method = '';
145
+ let path = '';
146
+ if (params.task_type != null && params.inference_id != null) {
147
+ method = 'GET';
148
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
149
+ }
150
+ else if (params.inference_id != null) {
151
+ method = 'GET';
152
+ path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
153
+ }
154
+ else if (params.task_type != null) {
155
+ method = 'GET';
156
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/_all`;
157
+ }
158
+ else {
159
+ method = 'GET';
160
+ path = '/_inference';
161
+ }
162
+ const meta = {
163
+ name: 'inference.get',
164
+ pathParts: {
165
+ task_type: params.task_type,
166
+ inference_id: params.inference_id
167
+ }
168
+ };
169
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
170
+ }
171
+ async inference(params, options) {
172
+ const acceptedPath = ['task_type', 'inference_id'];
173
+ const acceptedBody = ['query', 'input', 'input_type', 'task_settings'];
174
+ const querystring = {};
175
+ // @ts-expect-error
176
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
177
+ let body;
178
+ if (typeof userBody === 'string') {
179
+ body = userBody;
180
+ }
181
+ else {
182
+ body = userBody != null ? { ...userBody } : undefined;
183
+ }
184
+ for (const key in params) {
185
+ if (acceptedBody.includes(key)) {
186
+ body = body !== null && body !== void 0 ? body : {};
187
+ // @ts-expect-error
188
+ body[key] = params[key];
189
+ }
190
+ else if (acceptedPath.includes(key)) {
191
+ continue;
192
+ }
193
+ else if (key !== 'body') {
194
+ // @ts-expect-error
195
+ querystring[key] = params[key];
196
+ }
197
+ }
198
+ let method = '';
199
+ let path = '';
200
+ if (params.task_type != null && params.inference_id != null) {
201
+ method = 'POST';
202
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
203
+ }
204
+ else {
205
+ method = 'POST';
206
+ path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
207
+ }
208
+ const meta = {
209
+ name: 'inference.inference',
210
+ pathParts: {
211
+ task_type: params.task_type,
212
+ inference_id: params.inference_id
213
+ }
214
+ };
215
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
216
+ }
217
+ async put(params, options) {
218
+ var _a;
219
+ const acceptedPath = ['task_type', 'inference_id'];
220
+ const acceptedBody = ['inference_config'];
221
+ const querystring = {};
222
+ // @ts-expect-error
223
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
224
+ for (const key in params) {
225
+ if (acceptedBody.includes(key)) {
226
+ // @ts-expect-error
227
+ body = params[key];
228
+ }
229
+ else if (acceptedPath.includes(key)) {
230
+ continue;
231
+ }
232
+ else if (key !== 'body') {
233
+ // @ts-expect-error
234
+ querystring[key] = params[key];
235
+ }
236
+ }
237
+ let method = '';
238
+ let path = '';
239
+ if (params.task_type != null && params.inference_id != null) {
240
+ method = 'PUT';
241
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}`;
242
+ }
243
+ else {
244
+ method = 'PUT';
245
+ path = `/_inference/${encodeURIComponent(params.inference_id.toString())}`;
246
+ }
247
+ const meta = {
248
+ name: 'inference.put',
249
+ pathParts: {
250
+ task_type: params.task_type,
251
+ inference_id: params.inference_id
252
+ }
253
+ };
254
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
255
+ }
256
+ async putAlibabacloud(params, options) {
257
+ const acceptedPath = ['task_type', 'alibabacloud_inference_id'];
258
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
259
+ const querystring = {};
260
+ // @ts-expect-error
261
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
262
+ let body;
263
+ if (typeof userBody === 'string') {
264
+ body = userBody;
265
+ }
266
+ else {
267
+ body = userBody != null ? { ...userBody } : undefined;
268
+ }
269
+ for (const key in params) {
270
+ if (acceptedBody.includes(key)) {
271
+ body = body !== null && body !== void 0 ? body : {};
272
+ // @ts-expect-error
273
+ body[key] = params[key];
274
+ }
275
+ else if (acceptedPath.includes(key)) {
276
+ continue;
277
+ }
278
+ else if (key !== 'body') {
279
+ // @ts-expect-error
280
+ querystring[key] = params[key];
281
+ }
282
+ }
283
+ const method = 'PUT';
284
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.alibabacloud_inference_id.toString())}`;
285
+ const meta = {
286
+ name: 'inference.put_alibabacloud',
287
+ pathParts: {
288
+ task_type: params.task_type,
289
+ alibabacloud_inference_id: params.alibabacloud_inference_id
290
+ }
291
+ };
292
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
293
+ }
294
+ async putAmazonbedrock(params, options) {
295
+ const acceptedPath = ['task_type', 'amazonbedrock_inference_id'];
296
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
297
+ const querystring = {};
298
+ // @ts-expect-error
299
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
300
+ let body;
301
+ if (typeof userBody === 'string') {
302
+ body = userBody;
303
+ }
304
+ else {
305
+ body = userBody != null ? { ...userBody } : undefined;
306
+ }
307
+ for (const key in params) {
308
+ if (acceptedBody.includes(key)) {
309
+ body = body !== null && body !== void 0 ? body : {};
310
+ // @ts-expect-error
311
+ body[key] = params[key];
312
+ }
313
+ else if (acceptedPath.includes(key)) {
314
+ continue;
315
+ }
316
+ else if (key !== 'body') {
317
+ // @ts-expect-error
318
+ querystring[key] = params[key];
319
+ }
320
+ }
321
+ const method = 'PUT';
322
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonbedrock_inference_id.toString())}`;
323
+ const meta = {
324
+ name: 'inference.put_amazonbedrock',
325
+ pathParts: {
326
+ task_type: params.task_type,
327
+ amazonbedrock_inference_id: params.amazonbedrock_inference_id
328
+ }
329
+ };
330
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
331
+ }
332
+ async putAmazonsagemaker(params, options) {
333
+ const acceptedPath = ['task_type', 'amazonsagemaker_inference_id'];
334
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
335
+ const querystring = {};
336
+ // @ts-expect-error
337
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
338
+ let body;
339
+ if (typeof userBody === 'string') {
340
+ body = userBody;
341
+ }
342
+ else {
343
+ body = userBody != null ? { ...userBody } : undefined;
344
+ }
345
+ for (const key in params) {
346
+ if (acceptedBody.includes(key)) {
347
+ body = body !== null && body !== void 0 ? body : {};
348
+ // @ts-expect-error
349
+ body[key] = params[key];
350
+ }
351
+ else if (acceptedPath.includes(key)) {
352
+ continue;
353
+ }
354
+ else if (key !== 'body') {
355
+ // @ts-expect-error
356
+ querystring[key] = params[key];
357
+ }
358
+ }
359
+ const method = 'PUT';
360
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.amazonsagemaker_inference_id.toString())}`;
361
+ const meta = {
362
+ name: 'inference.put_amazonsagemaker',
363
+ pathParts: {
364
+ task_type: params.task_type,
365
+ amazonsagemaker_inference_id: params.amazonsagemaker_inference_id
366
+ }
367
+ };
368
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
369
+ }
370
+ async putAnthropic(params, options) {
371
+ const acceptedPath = ['task_type', 'anthropic_inference_id'];
372
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
373
+ const querystring = {};
374
+ // @ts-expect-error
375
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
376
+ let body;
377
+ if (typeof userBody === 'string') {
378
+ body = userBody;
379
+ }
380
+ else {
381
+ body = userBody != null ? { ...userBody } : undefined;
382
+ }
383
+ for (const key in params) {
384
+ if (acceptedBody.includes(key)) {
385
+ body = body !== null && body !== void 0 ? body : {};
386
+ // @ts-expect-error
387
+ body[key] = params[key];
388
+ }
389
+ else if (acceptedPath.includes(key)) {
390
+ continue;
391
+ }
392
+ else if (key !== 'body') {
393
+ // @ts-expect-error
394
+ querystring[key] = params[key];
395
+ }
396
+ }
397
+ const method = 'PUT';
398
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.anthropic_inference_id.toString())}`;
399
+ const meta = {
400
+ name: 'inference.put_anthropic',
401
+ pathParts: {
402
+ task_type: params.task_type,
403
+ anthropic_inference_id: params.anthropic_inference_id
404
+ }
405
+ };
406
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
407
+ }
408
+ async putAzureaistudio(params, options) {
409
+ const acceptedPath = ['task_type', 'azureaistudio_inference_id'];
410
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
411
+ const querystring = {};
412
+ // @ts-expect-error
413
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
414
+ let body;
415
+ if (typeof userBody === 'string') {
416
+ body = userBody;
417
+ }
418
+ else {
419
+ body = userBody != null ? { ...userBody } : undefined;
420
+ }
421
+ for (const key in params) {
422
+ if (acceptedBody.includes(key)) {
423
+ body = body !== null && body !== void 0 ? body : {};
424
+ // @ts-expect-error
425
+ body[key] = params[key];
426
+ }
427
+ else if (acceptedPath.includes(key)) {
428
+ continue;
429
+ }
430
+ else if (key !== 'body') {
431
+ // @ts-expect-error
432
+ querystring[key] = params[key];
433
+ }
434
+ }
435
+ const method = 'PUT';
436
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureaistudio_inference_id.toString())}`;
437
+ const meta = {
438
+ name: 'inference.put_azureaistudio',
439
+ pathParts: {
440
+ task_type: params.task_type,
441
+ azureaistudio_inference_id: params.azureaistudio_inference_id
442
+ }
443
+ };
444
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
445
+ }
446
+ async putAzureopenai(params, options) {
447
+ const acceptedPath = ['task_type', 'azureopenai_inference_id'];
448
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
449
+ const querystring = {};
450
+ // @ts-expect-error
451
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
452
+ let body;
453
+ if (typeof userBody === 'string') {
454
+ body = userBody;
455
+ }
456
+ else {
457
+ body = userBody != null ? { ...userBody } : undefined;
458
+ }
459
+ for (const key in params) {
460
+ if (acceptedBody.includes(key)) {
461
+ body = body !== null && body !== void 0 ? body : {};
462
+ // @ts-expect-error
463
+ body[key] = params[key];
464
+ }
465
+ else if (acceptedPath.includes(key)) {
466
+ continue;
467
+ }
468
+ else if (key !== 'body') {
469
+ // @ts-expect-error
470
+ querystring[key] = params[key];
471
+ }
472
+ }
473
+ const method = 'PUT';
474
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.azureopenai_inference_id.toString())}`;
475
+ const meta = {
476
+ name: 'inference.put_azureopenai',
477
+ pathParts: {
478
+ task_type: params.task_type,
479
+ azureopenai_inference_id: params.azureopenai_inference_id
480
+ }
481
+ };
482
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
483
+ }
484
+ async putCohere(params, options) {
485
+ const acceptedPath = ['task_type', 'cohere_inference_id'];
486
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
487
+ const querystring = {};
488
+ // @ts-expect-error
489
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
490
+ let body;
491
+ if (typeof userBody === 'string') {
492
+ body = userBody;
493
+ }
494
+ else {
495
+ body = userBody != null ? { ...userBody } : undefined;
496
+ }
497
+ for (const key in params) {
498
+ if (acceptedBody.includes(key)) {
499
+ body = body !== null && body !== void 0 ? body : {};
500
+ // @ts-expect-error
501
+ body[key] = params[key];
502
+ }
503
+ else if (acceptedPath.includes(key)) {
504
+ continue;
505
+ }
506
+ else if (key !== 'body') {
507
+ // @ts-expect-error
508
+ querystring[key] = params[key];
509
+ }
510
+ }
511
+ const method = 'PUT';
512
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.cohere_inference_id.toString())}`;
513
+ const meta = {
514
+ name: 'inference.put_cohere',
515
+ pathParts: {
516
+ task_type: params.task_type,
517
+ cohere_inference_id: params.cohere_inference_id
518
+ }
519
+ };
520
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
521
+ }
522
+ async putCustom(params, options) {
523
+ const acceptedPath = ['task_type', 'custom_inference_id'];
524
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
525
+ const querystring = {};
526
+ // @ts-expect-error
527
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
528
+ let body;
529
+ if (typeof userBody === 'string') {
530
+ body = userBody;
531
+ }
532
+ else {
533
+ body = userBody != null ? { ...userBody } : undefined;
534
+ }
535
+ for (const key in params) {
536
+ if (acceptedBody.includes(key)) {
537
+ body = body !== null && body !== void 0 ? body : {};
538
+ // @ts-expect-error
539
+ body[key] = params[key];
540
+ }
541
+ else if (acceptedPath.includes(key)) {
542
+ continue;
543
+ }
544
+ else if (key !== 'body') {
545
+ // @ts-expect-error
546
+ querystring[key] = params[key];
547
+ }
548
+ }
549
+ const method = 'PUT';
550
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.custom_inference_id.toString())}`;
551
+ const meta = {
552
+ name: 'inference.put_custom',
553
+ pathParts: {
554
+ task_type: params.task_type,
555
+ custom_inference_id: params.custom_inference_id
556
+ }
557
+ };
558
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
559
+ }
560
+ async putDeepseek(params, options) {
561
+ const acceptedPath = ['task_type', 'deepseek_inference_id'];
562
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
563
+ const querystring = {};
564
+ // @ts-expect-error
565
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
566
+ let body;
567
+ if (typeof userBody === 'string') {
568
+ body = userBody;
569
+ }
570
+ else {
571
+ body = userBody != null ? { ...userBody } : undefined;
572
+ }
573
+ for (const key in params) {
574
+ if (acceptedBody.includes(key)) {
575
+ body = body !== null && body !== void 0 ? body : {};
576
+ // @ts-expect-error
577
+ body[key] = params[key];
578
+ }
579
+ else if (acceptedPath.includes(key)) {
580
+ continue;
581
+ }
582
+ else if (key !== 'body') {
583
+ // @ts-expect-error
584
+ querystring[key] = params[key];
585
+ }
586
+ }
587
+ const method = 'PUT';
588
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.deepseek_inference_id.toString())}`;
589
+ const meta = {
590
+ name: 'inference.put_deepseek',
591
+ pathParts: {
592
+ task_type: params.task_type,
593
+ deepseek_inference_id: params.deepseek_inference_id
594
+ }
595
+ };
596
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
597
+ }
598
+ async putElasticsearch(params, options) {
599
+ const acceptedPath = ['task_type', 'elasticsearch_inference_id'];
600
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
601
+ const querystring = {};
602
+ // @ts-expect-error
603
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
604
+ let body;
605
+ if (typeof userBody === 'string') {
606
+ body = userBody;
607
+ }
608
+ else {
609
+ body = userBody != null ? { ...userBody } : undefined;
610
+ }
611
+ for (const key in params) {
612
+ if (acceptedBody.includes(key)) {
613
+ body = body !== null && body !== void 0 ? body : {};
614
+ // @ts-expect-error
615
+ body[key] = params[key];
616
+ }
617
+ else if (acceptedPath.includes(key)) {
618
+ continue;
619
+ }
620
+ else if (key !== 'body') {
621
+ // @ts-expect-error
622
+ querystring[key] = params[key];
623
+ }
624
+ }
625
+ const method = 'PUT';
626
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elasticsearch_inference_id.toString())}`;
627
+ const meta = {
628
+ name: 'inference.put_elasticsearch',
629
+ pathParts: {
630
+ task_type: params.task_type,
631
+ elasticsearch_inference_id: params.elasticsearch_inference_id
632
+ }
633
+ };
634
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
635
+ }
636
+ async putElser(params, options) {
637
+ const acceptedPath = ['task_type', 'elser_inference_id'];
638
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
639
+ const querystring = {};
640
+ // @ts-expect-error
641
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
642
+ let body;
643
+ if (typeof userBody === 'string') {
644
+ body = userBody;
645
+ }
646
+ else {
647
+ body = userBody != null ? { ...userBody } : undefined;
648
+ }
649
+ for (const key in params) {
650
+ if (acceptedBody.includes(key)) {
651
+ body = body !== null && body !== void 0 ? body : {};
652
+ // @ts-expect-error
653
+ body[key] = params[key];
654
+ }
655
+ else if (acceptedPath.includes(key)) {
656
+ continue;
657
+ }
658
+ else if (key !== 'body') {
659
+ // @ts-expect-error
660
+ querystring[key] = params[key];
661
+ }
662
+ }
663
+ const method = 'PUT';
664
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.elser_inference_id.toString())}`;
665
+ const meta = {
666
+ name: 'inference.put_elser',
667
+ pathParts: {
668
+ task_type: params.task_type,
669
+ elser_inference_id: params.elser_inference_id
670
+ }
671
+ };
672
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
673
+ }
674
+ async putGoogleaistudio(params, options) {
675
+ const acceptedPath = ['task_type', 'googleaistudio_inference_id'];
676
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
677
+ const querystring = {};
678
+ // @ts-expect-error
679
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
680
+ let body;
681
+ if (typeof userBody === 'string') {
682
+ body = userBody;
683
+ }
684
+ else {
685
+ body = userBody != null ? { ...userBody } : undefined;
686
+ }
687
+ for (const key in params) {
688
+ if (acceptedBody.includes(key)) {
689
+ body = body !== null && body !== void 0 ? body : {};
690
+ // @ts-expect-error
691
+ body[key] = params[key];
692
+ }
693
+ else if (acceptedPath.includes(key)) {
694
+ continue;
695
+ }
696
+ else if (key !== 'body') {
697
+ // @ts-expect-error
698
+ querystring[key] = params[key];
699
+ }
700
+ }
701
+ const method = 'PUT';
702
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googleaistudio_inference_id.toString())}`;
703
+ const meta = {
704
+ name: 'inference.put_googleaistudio',
705
+ pathParts: {
706
+ task_type: params.task_type,
707
+ googleaistudio_inference_id: params.googleaistudio_inference_id
708
+ }
709
+ };
710
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
711
+ }
712
+ async putGooglevertexai(params, options) {
713
+ const acceptedPath = ['task_type', 'googlevertexai_inference_id'];
714
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
715
+ const querystring = {};
716
+ // @ts-expect-error
717
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
718
+ let body;
719
+ if (typeof userBody === 'string') {
720
+ body = userBody;
721
+ }
722
+ else {
723
+ body = userBody != null ? { ...userBody } : undefined;
724
+ }
725
+ for (const key in params) {
726
+ if (acceptedBody.includes(key)) {
727
+ body = body !== null && body !== void 0 ? body : {};
728
+ // @ts-expect-error
729
+ body[key] = params[key];
730
+ }
731
+ else if (acceptedPath.includes(key)) {
732
+ continue;
733
+ }
734
+ else if (key !== 'body') {
735
+ // @ts-expect-error
736
+ querystring[key] = params[key];
737
+ }
738
+ }
739
+ const method = 'PUT';
740
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.googlevertexai_inference_id.toString())}`;
741
+ const meta = {
742
+ name: 'inference.put_googlevertexai',
743
+ pathParts: {
744
+ task_type: params.task_type,
745
+ googlevertexai_inference_id: params.googlevertexai_inference_id
746
+ }
747
+ };
748
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
749
+ }
750
+ async putHuggingFace(params, options) {
751
+ const acceptedPath = ['task_type', 'huggingface_inference_id'];
752
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
753
+ const querystring = {};
754
+ // @ts-expect-error
755
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
756
+ let body;
757
+ if (typeof userBody === 'string') {
758
+ body = userBody;
759
+ }
760
+ else {
761
+ body = userBody != null ? { ...userBody } : undefined;
762
+ }
763
+ for (const key in params) {
764
+ if (acceptedBody.includes(key)) {
765
+ body = body !== null && body !== void 0 ? body : {};
766
+ // @ts-expect-error
767
+ body[key] = params[key];
768
+ }
769
+ else if (acceptedPath.includes(key)) {
770
+ continue;
771
+ }
772
+ else if (key !== 'body') {
773
+ // @ts-expect-error
774
+ querystring[key] = params[key];
775
+ }
776
+ }
777
+ const method = 'PUT';
778
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.huggingface_inference_id.toString())}`;
779
+ const meta = {
780
+ name: 'inference.put_hugging_face',
781
+ pathParts: {
782
+ task_type: params.task_type,
783
+ huggingface_inference_id: params.huggingface_inference_id
784
+ }
785
+ };
786
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
787
+ }
788
+ async putJinaai(params, options) {
789
+ const acceptedPath = ['task_type', 'jinaai_inference_id'];
790
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
791
+ const querystring = {};
792
+ // @ts-expect-error
793
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
794
+ let body;
795
+ if (typeof userBody === 'string') {
796
+ body = userBody;
797
+ }
798
+ else {
799
+ body = userBody != null ? { ...userBody } : undefined;
800
+ }
801
+ for (const key in params) {
802
+ if (acceptedBody.includes(key)) {
803
+ body = body !== null && body !== void 0 ? body : {};
804
+ // @ts-expect-error
805
+ body[key] = params[key];
806
+ }
807
+ else if (acceptedPath.includes(key)) {
808
+ continue;
809
+ }
810
+ else if (key !== 'body') {
811
+ // @ts-expect-error
812
+ querystring[key] = params[key];
813
+ }
814
+ }
815
+ const method = 'PUT';
816
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.jinaai_inference_id.toString())}`;
817
+ const meta = {
818
+ name: 'inference.put_jinaai',
819
+ pathParts: {
820
+ task_type: params.task_type,
821
+ jinaai_inference_id: params.jinaai_inference_id
822
+ }
823
+ };
824
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
825
+ }
826
+ async putMistral(params, options) {
827
+ const acceptedPath = ['task_type', 'mistral_inference_id'];
828
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings'];
829
+ const querystring = {};
830
+ // @ts-expect-error
831
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
832
+ let body;
833
+ if (typeof userBody === 'string') {
834
+ body = userBody;
835
+ }
836
+ else {
837
+ body = userBody != null ? { ...userBody } : undefined;
838
+ }
839
+ for (const key in params) {
840
+ if (acceptedBody.includes(key)) {
841
+ body = body !== null && body !== void 0 ? body : {};
842
+ // @ts-expect-error
843
+ body[key] = params[key];
844
+ }
845
+ else if (acceptedPath.includes(key)) {
846
+ continue;
847
+ }
848
+ else if (key !== 'body') {
849
+ // @ts-expect-error
850
+ querystring[key] = params[key];
851
+ }
852
+ }
853
+ const method = 'PUT';
854
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.mistral_inference_id.toString())}`;
855
+ const meta = {
856
+ name: 'inference.put_mistral',
857
+ pathParts: {
858
+ task_type: params.task_type,
859
+ mistral_inference_id: params.mistral_inference_id
860
+ }
861
+ };
862
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
863
+ }
864
+ async putOpenai(params, options) {
865
+ const acceptedPath = ['task_type', 'openai_inference_id'];
866
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
867
+ const querystring = {};
868
+ // @ts-expect-error
869
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
870
+ let body;
871
+ if (typeof userBody === 'string') {
872
+ body = userBody;
873
+ }
874
+ else {
875
+ body = userBody != null ? { ...userBody } : undefined;
876
+ }
877
+ for (const key in params) {
878
+ if (acceptedBody.includes(key)) {
879
+ body = body !== null && body !== void 0 ? body : {};
880
+ // @ts-expect-error
881
+ body[key] = params[key];
882
+ }
883
+ else if (acceptedPath.includes(key)) {
884
+ continue;
885
+ }
886
+ else if (key !== 'body') {
887
+ // @ts-expect-error
888
+ querystring[key] = params[key];
889
+ }
890
+ }
891
+ const method = 'PUT';
892
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.openai_inference_id.toString())}`;
893
+ const meta = {
894
+ name: 'inference.put_openai',
895
+ pathParts: {
896
+ task_type: params.task_type,
897
+ openai_inference_id: params.openai_inference_id
898
+ }
899
+ };
900
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
901
+ }
902
+ async putVoyageai(params, options) {
903
+ const acceptedPath = ['task_type', 'voyageai_inference_id'];
904
+ const acceptedBody = ['chunking_settings', 'service', 'service_settings', 'task_settings'];
905
+ const querystring = {};
906
+ // @ts-expect-error
907
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
908
+ let body;
909
+ if (typeof userBody === 'string') {
910
+ body = userBody;
911
+ }
912
+ else {
913
+ body = userBody != null ? { ...userBody } : undefined;
914
+ }
915
+ for (const key in params) {
916
+ if (acceptedBody.includes(key)) {
917
+ body = body !== null && body !== void 0 ? body : {};
918
+ // @ts-expect-error
919
+ body[key] = params[key];
920
+ }
921
+ else if (acceptedPath.includes(key)) {
922
+ continue;
923
+ }
924
+ else if (key !== 'body') {
925
+ // @ts-expect-error
926
+ querystring[key] = params[key];
927
+ }
928
+ }
929
+ const method = 'PUT';
930
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.voyageai_inference_id.toString())}`;
931
+ const meta = {
932
+ name: 'inference.put_voyageai',
933
+ pathParts: {
934
+ task_type: params.task_type,
935
+ voyageai_inference_id: params.voyageai_inference_id
936
+ }
937
+ };
938
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
939
+ }
940
+ async putWatsonx(params, options) {
941
+ const acceptedPath = ['task_type', 'watsonx_inference_id'];
942
+ const acceptedBody = ['service', 'service_settings'];
943
+ const querystring = {};
944
+ // @ts-expect-error
945
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
946
+ let body;
947
+ if (typeof userBody === 'string') {
948
+ body = userBody;
949
+ }
950
+ else {
951
+ body = userBody != null ? { ...userBody } : undefined;
952
+ }
953
+ for (const key in params) {
954
+ if (acceptedBody.includes(key)) {
955
+ body = body !== null && body !== void 0 ? body : {};
956
+ // @ts-expect-error
957
+ body[key] = params[key];
958
+ }
959
+ else if (acceptedPath.includes(key)) {
960
+ continue;
961
+ }
962
+ else if (key !== 'body') {
963
+ // @ts-expect-error
964
+ querystring[key] = params[key];
965
+ }
966
+ }
967
+ const method = 'PUT';
968
+ const path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.watsonx_inference_id.toString())}`;
969
+ const meta = {
970
+ name: 'inference.put_watsonx',
971
+ pathParts: {
972
+ task_type: params.task_type,
973
+ watsonx_inference_id: params.watsonx_inference_id
974
+ }
975
+ };
976
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
977
+ }
978
+ async rerank(params, options) {
979
+ const acceptedPath = ['inference_id'];
980
+ const acceptedBody = ['query', 'input', 'task_settings'];
981
+ const querystring = {};
982
+ // @ts-expect-error
983
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
984
+ let body;
985
+ if (typeof userBody === 'string') {
986
+ body = userBody;
987
+ }
988
+ else {
989
+ body = userBody != null ? { ...userBody } : undefined;
990
+ }
991
+ for (const key in params) {
992
+ if (acceptedBody.includes(key)) {
993
+ body = body !== null && body !== void 0 ? body : {};
994
+ // @ts-expect-error
995
+ body[key] = params[key];
996
+ }
997
+ else if (acceptedPath.includes(key)) {
998
+ continue;
999
+ }
1000
+ else if (key !== 'body') {
1001
+ // @ts-expect-error
1002
+ querystring[key] = params[key];
1003
+ }
1004
+ }
1005
+ const method = 'POST';
1006
+ const path = `/_inference/rerank/${encodeURIComponent(params.inference_id.toString())}`;
1007
+ const meta = {
1008
+ name: 'inference.rerank',
1009
+ pathParts: {
1010
+ inference_id: params.inference_id
1011
+ }
1012
+ };
1013
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1014
+ }
1015
+ async sparseEmbedding(params, options) {
1016
+ const acceptedPath = ['inference_id'];
1017
+ const acceptedBody = ['input', 'task_settings'];
1018
+ const querystring = {};
1019
+ // @ts-expect-error
1020
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1021
+ let body;
1022
+ if (typeof userBody === 'string') {
1023
+ body = userBody;
1024
+ }
1025
+ else {
1026
+ body = userBody != null ? { ...userBody } : undefined;
1027
+ }
1028
+ for (const key in params) {
1029
+ if (acceptedBody.includes(key)) {
1030
+ body = body !== null && body !== void 0 ? body : {};
1031
+ // @ts-expect-error
1032
+ body[key] = params[key];
1033
+ }
1034
+ else if (acceptedPath.includes(key)) {
1035
+ continue;
1036
+ }
1037
+ else if (key !== 'body') {
1038
+ // @ts-expect-error
1039
+ querystring[key] = params[key];
1040
+ }
1041
+ }
1042
+ const method = 'POST';
1043
+ const path = `/_inference/sparse_embedding/${encodeURIComponent(params.inference_id.toString())}`;
1044
+ const meta = {
1045
+ name: 'inference.sparse_embedding',
1046
+ pathParts: {
1047
+ inference_id: params.inference_id
1048
+ }
1049
+ };
1050
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1051
+ }
1052
+ async streamCompletion(params, options) {
1053
+ const acceptedPath = ['inference_id'];
1054
+ const acceptedBody = ['input', 'task_settings'];
1055
+ const querystring = {};
1056
+ // @ts-expect-error
1057
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1058
+ let body;
1059
+ if (typeof userBody === 'string') {
1060
+ body = userBody;
1061
+ }
1062
+ else {
1063
+ body = userBody != null ? { ...userBody } : undefined;
1064
+ }
1065
+ for (const key in params) {
1066
+ if (acceptedBody.includes(key)) {
1067
+ body = body !== null && body !== void 0 ? body : {};
1068
+ // @ts-expect-error
1069
+ body[key] = params[key];
1070
+ }
1071
+ else if (acceptedPath.includes(key)) {
1072
+ continue;
1073
+ }
1074
+ else if (key !== 'body') {
1075
+ // @ts-expect-error
1076
+ querystring[key] = params[key];
1077
+ }
1078
+ }
1079
+ const method = 'POST';
1080
+ const path = `/_inference/completion/${encodeURIComponent(params.inference_id.toString())}/_stream`;
1081
+ const meta = {
1082
+ name: 'inference.stream_completion',
1083
+ pathParts: {
1084
+ inference_id: params.inference_id
1085
+ }
1086
+ };
1087
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1088
+ }
1089
+ async textEmbedding(params, options) {
1090
+ const acceptedPath = ['inference_id'];
1091
+ const acceptedBody = ['input', 'input_type', 'task_settings'];
1092
+ const querystring = {};
1093
+ // @ts-expect-error
1094
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1095
+ let body;
1096
+ if (typeof userBody === 'string') {
1097
+ body = userBody;
1098
+ }
1099
+ else {
1100
+ body = userBody != null ? { ...userBody } : undefined;
1101
+ }
1102
+ for (const key in params) {
1103
+ if (acceptedBody.includes(key)) {
1104
+ body = body !== null && body !== void 0 ? body : {};
1105
+ // @ts-expect-error
1106
+ body[key] = params[key];
1107
+ }
1108
+ else if (acceptedPath.includes(key)) {
1109
+ continue;
1110
+ }
1111
+ else if (key !== 'body') {
1112
+ // @ts-expect-error
1113
+ querystring[key] = params[key];
1114
+ }
1115
+ }
1116
+ const method = 'POST';
1117
+ const path = `/_inference/text_embedding/${encodeURIComponent(params.inference_id.toString())}`;
1118
+ const meta = {
1119
+ name: 'inference.text_embedding',
1120
+ pathParts: {
1121
+ inference_id: params.inference_id
1122
+ }
1123
+ };
1124
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1125
+ }
1126
+ async update(params, options) {
1127
+ var _a;
1128
+ const acceptedPath = ['inference_id', 'task_type'];
1129
+ const acceptedBody = ['inference_config'];
1130
+ const querystring = {};
1131
+ // @ts-expect-error
1132
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1133
+ for (const key in params) {
1134
+ if (acceptedBody.includes(key)) {
1135
+ // @ts-expect-error
1136
+ body = params[key];
1137
+ }
1138
+ else if (acceptedPath.includes(key)) {
1139
+ continue;
1140
+ }
1141
+ else if (key !== 'body') {
1142
+ // @ts-expect-error
1143
+ querystring[key] = params[key];
1144
+ }
1145
+ }
1146
+ let method = '';
1147
+ let path = '';
1148
+ if (params.task_type != null && params.inference_id != null) {
1149
+ method = 'PUT';
1150
+ path = `/_inference/${encodeURIComponent(params.task_type.toString())}/${encodeURIComponent(params.inference_id.toString())}/_update`;
1151
+ }
1152
+ else {
1153
+ method = 'PUT';
1154
+ path = `/_inference/${encodeURIComponent(params.inference_id.toString())}/_update`;
1155
+ }
1156
+ const meta = {
1157
+ name: 'inference.update',
1158
+ pathParts: {
1159
+ inference_id: params.inference_id,
1160
+ task_type: params.task_type
1161
+ }
1162
+ };
1163
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1164
+ }
1165
+ }
1166
+ exports.default = Inference;
1167
+ //# sourceMappingURL=inference.js.map