plugin-elastic-report 0.0.0-stage → 0.1.1

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 (257) hide show
  1. package/ai/skills/elastic-report/SKILLS.md +32 -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/index.js +10 -0
  7. package/dist/client-v2/851.488fdbf5bc5b6a36.js +10 -0
  8. package/dist/client-v2/index.js +10 -0
  9. package/dist/externalVersion.js +20 -0
  10. package/dist/index.js +48 -0
  11. package/dist/locale/en-US.json +99 -0
  12. package/dist/locale/vi-VN.json +99 -0
  13. package/dist/locale/zh-CN.json +99 -0
  14. package/dist/node_modules/@elastic/elasticsearch/.dockerignore +11 -0
  15. package/dist/node_modules/@elastic/elasticsearch/LICENSE +202 -0
  16. package/dist/node_modules/@elastic/elasticsearch/NOTICE.txt +2 -0
  17. package/dist/node_modules/@elastic/elasticsearch/catalog-info.yaml +50 -0
  18. package/dist/node_modules/@elastic/elasticsearch/codecov.yml +14 -0
  19. package/dist/node_modules/@elastic/elasticsearch/index.d.ts +28 -0
  20. package/dist/node_modules/@elastic/elasticsearch/index.js +85525 -0
  21. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.d.ts +39 -0
  22. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/async_search.js +155 -0
  23. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.d.ts +39 -0
  24. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/autoscaling.js +130 -0
  25. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.d.ts +14 -0
  26. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/bulk.js +60 -0
  27. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.d.ts +14 -0
  28. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/capabilities.js +43 -0
  29. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.d.ts +193 -0
  30. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cat.js +766 -0
  31. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.d.ts +102 -0
  32. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ccr.js +395 -0
  33. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.d.ts +14 -0
  34. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/clear_scroll.js +60 -0
  35. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.d.ts +14 -0
  36. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/close_point_in_time.js +56 -0
  37. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.d.ts +123 -0
  38. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/cluster.js +482 -0
  39. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.d.ts +245 -0
  40. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/connector.js +1121 -0
  41. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.d.ts +14 -0
  42. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/count.js +68 -0
  43. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.d.ts +14 -0
  44. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/create.js +53 -0
  45. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.d.ts +32 -0
  46. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/dangling_indices.js +100 -0
  47. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.d.ts +14 -0
  48. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete.js +46 -0
  49. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.d.ts +14 -0
  50. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query.js +59 -0
  51. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.d.ts +14 -0
  52. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_by_query_rethrottle.js +45 -0
  53. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.d.ts +14 -0
  54. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/delete_script.js +45 -0
  55. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.d.ts +46 -0
  56. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/enrich.js +169 -0
  57. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.d.ts +39 -0
  58. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/eql.js +139 -0
  59. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.d.ts +46 -0
  60. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/esql.js +170 -0
  61. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.d.ts +14 -0
  62. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists.js +46 -0
  63. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.d.ts +14 -0
  64. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/exists_source.js +46 -0
  65. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.d.ts +14 -0
  66. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/explain.js +60 -0
  67. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.d.ts +25 -0
  68. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/features.js +75 -0
  69. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.d.ts +14 -0
  70. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/field_caps.js +68 -0
  71. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.d.ts +50 -0
  72. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/fleet.js +211 -0
  73. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.d.ts +14 -0
  74. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get.js +46 -0
  75. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.d.ts +14 -0
  76. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script.js +45 -0
  77. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.d.ts +14 -0
  78. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_context.js +43 -0
  79. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.d.ts +14 -0
  80. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_script_languages.js +43 -0
  81. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.d.ts +14 -0
  82. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/get_source.js +46 -0
  83. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.d.ts +18 -0
  84. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/graph.js +70 -0
  85. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.d.ts +14 -0
  86. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/health_report.js +54 -0
  87. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.d.ts +88 -0
  88. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ilm.js +329 -0
  89. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.d.ts +14 -0
  90. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/index.js +61 -0
  91. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.d.ts +494 -0
  92. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/indices.js +2133 -0
  93. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.d.ts +221 -0
  94. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/inference.js +1167 -0
  95. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.d.ts +14 -0
  96. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/info.js +43 -0
  97. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.d.ts +95 -0
  98. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ingest.js +389 -0
  99. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.d.ts +14 -0
  100. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/knn_search.js +59 -0
  101. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.d.ts +60 -0
  102. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/license.js +194 -0
  103. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.d.ts +32 -0
  104. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/logstash.js +118 -0
  105. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.d.ts +14 -0
  106. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mget.js +68 -0
  107. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.d.ts +32 -0
  108. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/migration.js +107 -0
  109. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.d.ts +522 -0
  110. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ml.js +2468 -0
  111. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.d.ts +18 -0
  112. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/monitoring.js +60 -0
  113. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.d.ts +14 -0
  114. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch.js +60 -0
  115. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.d.ts +14 -0
  116. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/msearch_template.js +60 -0
  117. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.d.ts +14 -0
  118. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/mtermvectors.js +68 -0
  119. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.d.ts +60 -0
  120. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/nodes.js +290 -0
  121. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.d.ts +14 -0
  122. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/open_point_in_time.js +59 -0
  123. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.d.ts +14 -0
  124. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ping.js +43 -0
  125. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.d.ts +39 -0
  126. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/profiling.js +135 -0
  127. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.d.ts +14 -0
  128. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/put_script.js +68 -0
  129. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.d.ts +67 -0
  130. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/query_rules.js +260 -0
  131. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.d.ts +14 -0
  132. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rank_eval.js +67 -0
  133. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.d.ts +14 -0
  134. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex.js +56 -0
  135. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.d.ts +14 -0
  136. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/reindex_rethrottle.js +45 -0
  137. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.d.ts +14 -0
  138. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/render_search_template.js +68 -0
  139. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.d.ts +67 -0
  140. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/rollup.js +263 -0
  141. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.d.ts +14 -0
  142. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scripts_painless_execute.js +57 -0
  143. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.d.ts +14 -0
  144. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/scroll.js +59 -0
  145. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.d.ts +14 -0
  146. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search.js +75 -0
  147. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.d.ts +81 -0
  148. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_application.js +313 -0
  149. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.d.ts +14 -0
  150. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_mvt.js +63 -0
  151. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.d.ts +14 -0
  152. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_shards.js +54 -0
  153. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.d.ts +14 -0
  154. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/search_template.js +68 -0
  155. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.d.ts +39 -0
  156. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/searchable_snapshots.js +167 -0
  157. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.d.ts +459 -0
  158. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/security.js +1982 -0
  159. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.d.ts +32 -0
  160. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/shutdown.js +125 -0
  161. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.d.ts +18 -0
  162. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/simulate.js +78 -0
  163. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.d.ts +74 -0
  164. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/slm.js +253 -0
  165. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.d.ts +102 -0
  166. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/snapshot.js +410 -0
  167. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.d.ts +53 -0
  168. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/sql.js +205 -0
  169. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.d.ts +18 -0
  170. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/ssl.js +54 -0
  171. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.d.ts +32 -0
  172. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/streams.js +96 -0
  173. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.d.ts +60 -0
  174. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/synonyms.js +223 -0
  175. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.d.ts +32 -0
  176. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/tasks.js +109 -0
  177. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.d.ts +14 -0
  178. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/terms_enum.js +59 -0
  179. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.d.ts +14 -0
  180. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/termvectors.js +68 -0
  181. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.d.ts +39 -0
  182. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/text_structure.js +148 -0
  183. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.d.ts +101 -0
  184. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/transform.js +386 -0
  185. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.d.ts +14 -0
  186. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update.js +60 -0
  187. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.d.ts +14 -0
  188. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query.js +59 -0
  189. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.d.ts +14 -0
  190. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/update_by_query_rethrottle.js +45 -0
  191. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.d.ts +102 -0
  192. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/watcher.js +405 -0
  193. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.d.ts +25 -0
  194. package/dist/node_modules/@elastic/elasticsearch/lib/api/api/xpack.js +75 -0
  195. package/dist/node_modules/@elastic/elasticsearch/lib/api/index.d.ts +265 -0
  196. package/dist/node_modules/@elastic/elasticsearch/lib/api/index.js +632 -0
  197. package/dist/node_modules/@elastic/elasticsearch/lib/api/types.d.ts +19933 -0
  198. package/dist/node_modules/@elastic/elasticsearch/lib/api/types.js +21 -0
  199. package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.d.ts +20606 -0
  200. package/dist/node_modules/@elastic/elasticsearch/lib/api/typesWithBodyKey.js +21 -0
  201. package/dist/node_modules/@elastic/elasticsearch/lib/client.d.ts +152 -0
  202. package/dist/node_modules/@elastic/elasticsearch/lib/client.js +369 -0
  203. package/dist/node_modules/@elastic/elasticsearch/lib/helpers.d.ts +184 -0
  204. package/dist/node_modules/@elastic/elasticsearch/lib/helpers.js +889 -0
  205. package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.d.ts +4 -0
  206. package/dist/node_modules/@elastic/elasticsearch/lib/sniffingTransport.js +56 -0
  207. package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv +15 -0
  208. package/dist/node_modules/@elastic/elasticsearch/node_modules/.bin/arrow2csv.cmd +7 -0
  209. package/dist/node_modules/@elastic/elasticsearch/package.json +1 -0
  210. package/dist/node_modules/@elastic/elasticsearch/tsconfig.json +38 -0
  211. package/dist/server/acl-guard.js +107 -0
  212. package/dist/server/collections/es-report-data-views.js +79 -0
  213. package/dist/server/collections/es-reports.js +95 -0
  214. package/dist/server/index.js +58 -0
  215. package/dist/server/mcp/ElasticReportMcpServer.js +344 -0
  216. package/dist/server/mcp/ElasticReportToolCatalog.js +417 -0
  217. package/dist/server/plugin.js +395 -0
  218. package/dist/server/services/ElasticReportService.js +263 -0
  219. package/dist/server/services/ElasticsearchConnectionService.js +332 -0
  220. package/dist/server/services/ReportQueryCompiler.js +858 -0
  221. package/dist/shared/constants.js +81 -0
  222. package/dist/shared/types.js +24 -0
  223. package/package.json +61 -4
  224. package/server.d.ts +2 -0
  225. package/server.js +1 -0
  226. package/src/client/index.tsx +19 -0
  227. package/src/client-v2/__tests__/elastic-report.test.tsx +311 -0
  228. package/src/client-v2/api.ts +224 -0
  229. package/src/client-v2/components/ElasticBasicCharts.tsx +399 -0
  230. package/src/client-v2/components/ElasticReportBlock.tsx +160 -0
  231. package/src/client-v2/components/ElasticReportRenderer.tsx +707 -0
  232. package/src/client-v2/components/HighlightText.tsx +50 -0
  233. package/src/client-v2/components/ReportSelect.tsx +72 -0
  234. package/src/client-v2/index.tsx +14 -0
  235. package/src/client-v2/locale.ts +23 -0
  236. package/src/client-v2/models/ElasticReportBlockModel.tsx +85 -0
  237. package/src/client-v2/pages/ElasticReportManager.tsx +1047 -0
  238. package/src/client-v2/plugin.tsx +52 -0
  239. package/src/index.ts +11 -0
  240. package/src/locale/en-US.json +99 -0
  241. package/src/locale/vi-VN.json +99 -0
  242. package/src/locale/zh-CN.json +99 -0
  243. package/src/server/__tests__/query-compiler.test.ts +231 -0
  244. package/src/server/__tests__/report-mcp-acl.integration.test.ts +377 -0
  245. package/src/server/acl-guard.ts +103 -0
  246. package/src/server/collections/es-report-data-views.ts +58 -0
  247. package/src/server/collections/es-reports.ts +74 -0
  248. package/src/server/index.ts +15 -0
  249. package/src/server/mcp/ElasticReportMcpServer.ts +391 -0
  250. package/src/server/mcp/ElasticReportToolCatalog.ts +417 -0
  251. package/src/server/plugin.ts +431 -0
  252. package/src/server/services/ElasticReportService.ts +326 -0
  253. package/src/server/services/ElasticsearchConnectionService.ts +401 -0
  254. package/src/server/services/ReportQueryCompiler.ts +1017 -0
  255. package/src/shared/constants.ts +29 -0
  256. package/src/shared/types.ts +175 -0
  257. package/README.md +0 -3
@@ -0,0 +1,2468 @@
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 Ml {
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 clearTrainedModelDeploymentCache(params, options) {
32
+ const acceptedPath = ['model_id'];
33
+ const querystring = {};
34
+ const body = undefined;
35
+ for (const key in params) {
36
+ if (acceptedPath.includes(key)) {
37
+ continue;
38
+ }
39
+ else if (key !== 'body') {
40
+ // @ts-expect-error
41
+ querystring[key] = params[key];
42
+ }
43
+ }
44
+ const method = 'POST';
45
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/cache/_clear`;
46
+ const meta = {
47
+ name: 'ml.clear_trained_model_deployment_cache',
48
+ pathParts: {
49
+ model_id: params.model_id
50
+ }
51
+ };
52
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
53
+ }
54
+ async closeJob(params, options) {
55
+ const acceptedPath = ['job_id'];
56
+ const acceptedBody = ['allow_no_match', 'force', 'timeout'];
57
+ const querystring = {};
58
+ // @ts-expect-error
59
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
60
+ let body;
61
+ if (typeof userBody === 'string') {
62
+ body = userBody;
63
+ }
64
+ else {
65
+ body = userBody != null ? { ...userBody } : undefined;
66
+ }
67
+ for (const key in params) {
68
+ if (acceptedBody.includes(key)) {
69
+ body = body !== null && body !== void 0 ? body : {};
70
+ // @ts-expect-error
71
+ body[key] = params[key];
72
+ }
73
+ else if (acceptedPath.includes(key)) {
74
+ continue;
75
+ }
76
+ else if (key !== 'body') {
77
+ // @ts-expect-error
78
+ querystring[key] = params[key];
79
+ }
80
+ }
81
+ const method = 'POST';
82
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_close`;
83
+ const meta = {
84
+ name: 'ml.close_job',
85
+ pathParts: {
86
+ job_id: params.job_id
87
+ }
88
+ };
89
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
90
+ }
91
+ async deleteCalendar(params, options) {
92
+ const acceptedPath = ['calendar_id'];
93
+ const querystring = {};
94
+ const body = undefined;
95
+ for (const key in params) {
96
+ if (acceptedPath.includes(key)) {
97
+ continue;
98
+ }
99
+ else if (key !== 'body') {
100
+ // @ts-expect-error
101
+ querystring[key] = params[key];
102
+ }
103
+ }
104
+ const method = 'DELETE';
105
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
106
+ const meta = {
107
+ name: 'ml.delete_calendar',
108
+ pathParts: {
109
+ calendar_id: params.calendar_id
110
+ }
111
+ };
112
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
113
+ }
114
+ async deleteCalendarEvent(params, options) {
115
+ const acceptedPath = ['calendar_id', 'event_id'];
116
+ const querystring = {};
117
+ const body = undefined;
118
+ for (const key in params) {
119
+ if (acceptedPath.includes(key)) {
120
+ continue;
121
+ }
122
+ else if (key !== 'body') {
123
+ // @ts-expect-error
124
+ querystring[key] = params[key];
125
+ }
126
+ }
127
+ const method = 'DELETE';
128
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events/${encodeURIComponent(params.event_id.toString())}`;
129
+ const meta = {
130
+ name: 'ml.delete_calendar_event',
131
+ pathParts: {
132
+ calendar_id: params.calendar_id,
133
+ event_id: params.event_id
134
+ }
135
+ };
136
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
137
+ }
138
+ async deleteCalendarJob(params, options) {
139
+ const acceptedPath = ['calendar_id', 'job_id'];
140
+ const querystring = {};
141
+ const body = undefined;
142
+ for (const key in params) {
143
+ if (acceptedPath.includes(key)) {
144
+ continue;
145
+ }
146
+ else if (key !== 'body') {
147
+ // @ts-expect-error
148
+ querystring[key] = params[key];
149
+ }
150
+ }
151
+ const method = 'DELETE';
152
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/jobs/${encodeURIComponent(params.job_id.toString())}`;
153
+ const meta = {
154
+ name: 'ml.delete_calendar_job',
155
+ pathParts: {
156
+ calendar_id: params.calendar_id,
157
+ job_id: params.job_id
158
+ }
159
+ };
160
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
161
+ }
162
+ async deleteDataFrameAnalytics(params, options) {
163
+ const acceptedPath = ['id'];
164
+ const querystring = {};
165
+ const body = undefined;
166
+ for (const key in params) {
167
+ if (acceptedPath.includes(key)) {
168
+ continue;
169
+ }
170
+ else if (key !== 'body') {
171
+ // @ts-expect-error
172
+ querystring[key] = params[key];
173
+ }
174
+ }
175
+ const method = 'DELETE';
176
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
177
+ const meta = {
178
+ name: 'ml.delete_data_frame_analytics',
179
+ pathParts: {
180
+ id: params.id
181
+ }
182
+ };
183
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
184
+ }
185
+ async deleteDatafeed(params, options) {
186
+ const acceptedPath = ['datafeed_id'];
187
+ const querystring = {};
188
+ const body = undefined;
189
+ for (const key in params) {
190
+ if (acceptedPath.includes(key)) {
191
+ continue;
192
+ }
193
+ else if (key !== 'body') {
194
+ // @ts-expect-error
195
+ querystring[key] = params[key];
196
+ }
197
+ }
198
+ const method = 'DELETE';
199
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
200
+ const meta = {
201
+ name: 'ml.delete_datafeed',
202
+ pathParts: {
203
+ datafeed_id: params.datafeed_id
204
+ }
205
+ };
206
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
207
+ }
208
+ async deleteExpiredData(params, options) {
209
+ const acceptedPath = ['job_id'];
210
+ const acceptedBody = ['requests_per_second', 'timeout'];
211
+ const querystring = {};
212
+ // @ts-expect-error
213
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
214
+ let body;
215
+ if (typeof userBody === 'string') {
216
+ body = userBody;
217
+ }
218
+ else {
219
+ body = userBody != null ? { ...userBody } : undefined;
220
+ }
221
+ params = params !== null && params !== void 0 ? params : {};
222
+ for (const key in params) {
223
+ if (acceptedBody.includes(key)) {
224
+ body = body !== null && body !== void 0 ? body : {};
225
+ // @ts-expect-error
226
+ body[key] = params[key];
227
+ }
228
+ else if (acceptedPath.includes(key)) {
229
+ continue;
230
+ }
231
+ else if (key !== 'body') {
232
+ // @ts-expect-error
233
+ querystring[key] = params[key];
234
+ }
235
+ }
236
+ let method = '';
237
+ let path = '';
238
+ if (params.job_id != null) {
239
+ method = 'DELETE';
240
+ path = `/_ml/_delete_expired_data/${encodeURIComponent(params.job_id.toString())}`;
241
+ }
242
+ else {
243
+ method = 'DELETE';
244
+ path = '/_ml/_delete_expired_data';
245
+ }
246
+ const meta = {
247
+ name: 'ml.delete_expired_data',
248
+ pathParts: {
249
+ job_id: params.job_id
250
+ }
251
+ };
252
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
253
+ }
254
+ async deleteFilter(params, options) {
255
+ const acceptedPath = ['filter_id'];
256
+ const querystring = {};
257
+ const body = undefined;
258
+ for (const key in params) {
259
+ if (acceptedPath.includes(key)) {
260
+ continue;
261
+ }
262
+ else if (key !== 'body') {
263
+ // @ts-expect-error
264
+ querystring[key] = params[key];
265
+ }
266
+ }
267
+ const method = 'DELETE';
268
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
269
+ const meta = {
270
+ name: 'ml.delete_filter',
271
+ pathParts: {
272
+ filter_id: params.filter_id
273
+ }
274
+ };
275
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
276
+ }
277
+ async deleteForecast(params, options) {
278
+ const acceptedPath = ['job_id', 'forecast_id'];
279
+ const querystring = {};
280
+ const body = undefined;
281
+ for (const key in params) {
282
+ if (acceptedPath.includes(key)) {
283
+ continue;
284
+ }
285
+ else if (key !== 'body') {
286
+ // @ts-expect-error
287
+ querystring[key] = params[key];
288
+ }
289
+ }
290
+ let method = '';
291
+ let path = '';
292
+ if (params.job_id != null && params.forecast_id != null) {
293
+ method = 'DELETE';
294
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast/${encodeURIComponent(params.forecast_id.toString())}`;
295
+ }
296
+ else {
297
+ method = 'DELETE';
298
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast`;
299
+ }
300
+ const meta = {
301
+ name: 'ml.delete_forecast',
302
+ pathParts: {
303
+ job_id: params.job_id,
304
+ forecast_id: params.forecast_id
305
+ }
306
+ };
307
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
308
+ }
309
+ async deleteJob(params, options) {
310
+ const acceptedPath = ['job_id'];
311
+ const querystring = {};
312
+ const body = undefined;
313
+ for (const key in params) {
314
+ if (acceptedPath.includes(key)) {
315
+ continue;
316
+ }
317
+ else if (key !== 'body') {
318
+ // @ts-expect-error
319
+ querystring[key] = params[key];
320
+ }
321
+ }
322
+ const method = 'DELETE';
323
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
324
+ const meta = {
325
+ name: 'ml.delete_job',
326
+ pathParts: {
327
+ job_id: params.job_id
328
+ }
329
+ };
330
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
331
+ }
332
+ async deleteModelSnapshot(params, options) {
333
+ const acceptedPath = ['job_id', 'snapshot_id'];
334
+ const querystring = {};
335
+ const body = undefined;
336
+ for (const key in params) {
337
+ if (acceptedPath.includes(key)) {
338
+ continue;
339
+ }
340
+ else if (key !== 'body') {
341
+ // @ts-expect-error
342
+ querystring[key] = params[key];
343
+ }
344
+ }
345
+ const method = 'DELETE';
346
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}`;
347
+ const meta = {
348
+ name: 'ml.delete_model_snapshot',
349
+ pathParts: {
350
+ job_id: params.job_id,
351
+ snapshot_id: params.snapshot_id
352
+ }
353
+ };
354
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
355
+ }
356
+ async deleteTrainedModel(params, options) {
357
+ const acceptedPath = ['model_id'];
358
+ const querystring = {};
359
+ const body = undefined;
360
+ for (const key in params) {
361
+ if (acceptedPath.includes(key)) {
362
+ continue;
363
+ }
364
+ else if (key !== 'body') {
365
+ // @ts-expect-error
366
+ querystring[key] = params[key];
367
+ }
368
+ }
369
+ const method = 'DELETE';
370
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
371
+ const meta = {
372
+ name: 'ml.delete_trained_model',
373
+ pathParts: {
374
+ model_id: params.model_id
375
+ }
376
+ };
377
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
378
+ }
379
+ async deleteTrainedModelAlias(params, options) {
380
+ const acceptedPath = ['model_alias', 'model_id'];
381
+ const querystring = {};
382
+ const body = undefined;
383
+ for (const key in params) {
384
+ if (acceptedPath.includes(key)) {
385
+ continue;
386
+ }
387
+ else if (key !== 'body') {
388
+ // @ts-expect-error
389
+ querystring[key] = params[key];
390
+ }
391
+ }
392
+ const method = 'DELETE';
393
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/model_aliases/${encodeURIComponent(params.model_alias.toString())}`;
394
+ const meta = {
395
+ name: 'ml.delete_trained_model_alias',
396
+ pathParts: {
397
+ model_alias: params.model_alias,
398
+ model_id: params.model_id
399
+ }
400
+ };
401
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
402
+ }
403
+ async estimateModelMemory(params, options) {
404
+ const acceptedPath = [];
405
+ const acceptedBody = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'];
406
+ const querystring = {};
407
+ // @ts-expect-error
408
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
409
+ let body;
410
+ if (typeof userBody === 'string') {
411
+ body = userBody;
412
+ }
413
+ else {
414
+ body = userBody != null ? { ...userBody } : undefined;
415
+ }
416
+ params = params !== null && params !== void 0 ? params : {};
417
+ for (const key in params) {
418
+ if (acceptedBody.includes(key)) {
419
+ body = body !== null && body !== void 0 ? body : {};
420
+ // @ts-expect-error
421
+ body[key] = params[key];
422
+ }
423
+ else if (acceptedPath.includes(key)) {
424
+ continue;
425
+ }
426
+ else if (key !== 'body') {
427
+ // @ts-expect-error
428
+ querystring[key] = params[key];
429
+ }
430
+ }
431
+ const method = 'POST';
432
+ const path = '/_ml/anomaly_detectors/_estimate_model_memory';
433
+ const meta = {
434
+ name: 'ml.estimate_model_memory'
435
+ };
436
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
437
+ }
438
+ async evaluateDataFrame(params, options) {
439
+ const acceptedPath = [];
440
+ const acceptedBody = ['evaluation', 'index', 'query'];
441
+ const querystring = {};
442
+ // @ts-expect-error
443
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
444
+ let body;
445
+ if (typeof userBody === 'string') {
446
+ body = userBody;
447
+ }
448
+ else {
449
+ body = userBody != null ? { ...userBody } : undefined;
450
+ }
451
+ for (const key in params) {
452
+ if (acceptedBody.includes(key)) {
453
+ body = body !== null && body !== void 0 ? body : {};
454
+ // @ts-expect-error
455
+ body[key] = params[key];
456
+ }
457
+ else if (acceptedPath.includes(key)) {
458
+ continue;
459
+ }
460
+ else if (key !== 'body') {
461
+ // @ts-expect-error
462
+ querystring[key] = params[key];
463
+ }
464
+ }
465
+ const method = 'POST';
466
+ const path = '/_ml/data_frame/_evaluate';
467
+ const meta = {
468
+ name: 'ml.evaluate_data_frame'
469
+ };
470
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
471
+ }
472
+ async explainDataFrameAnalytics(params, options) {
473
+ const acceptedPath = ['id'];
474
+ const acceptedBody = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'];
475
+ const querystring = {};
476
+ // @ts-expect-error
477
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
478
+ let body;
479
+ if (typeof userBody === 'string') {
480
+ body = userBody;
481
+ }
482
+ else {
483
+ body = userBody != null ? { ...userBody } : undefined;
484
+ }
485
+ params = params !== null && params !== void 0 ? params : {};
486
+ for (const key in params) {
487
+ if (acceptedBody.includes(key)) {
488
+ body = body !== null && body !== void 0 ? body : {};
489
+ // @ts-expect-error
490
+ body[key] = params[key];
491
+ }
492
+ else if (acceptedPath.includes(key)) {
493
+ continue;
494
+ }
495
+ else if (key !== 'body') {
496
+ // @ts-expect-error
497
+ querystring[key] = params[key];
498
+ }
499
+ }
500
+ let method = '';
501
+ let path = '';
502
+ if (params.id != null) {
503
+ method = body != null ? 'POST' : 'GET';
504
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_explain`;
505
+ }
506
+ else {
507
+ method = body != null ? 'POST' : 'GET';
508
+ path = '/_ml/data_frame/analytics/_explain';
509
+ }
510
+ const meta = {
511
+ name: 'ml.explain_data_frame_analytics',
512
+ pathParts: {
513
+ id: params.id
514
+ }
515
+ };
516
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
517
+ }
518
+ async flushJob(params, options) {
519
+ const acceptedPath = ['job_id'];
520
+ const acceptedBody = ['advance_time', 'calc_interim', 'end', 'skip_time', 'start'];
521
+ const querystring = {};
522
+ // @ts-expect-error
523
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
524
+ let body;
525
+ if (typeof userBody === 'string') {
526
+ body = userBody;
527
+ }
528
+ else {
529
+ body = userBody != null ? { ...userBody } : undefined;
530
+ }
531
+ for (const key in params) {
532
+ if (acceptedBody.includes(key)) {
533
+ body = body !== null && body !== void 0 ? body : {};
534
+ // @ts-expect-error
535
+ body[key] = params[key];
536
+ }
537
+ else if (acceptedPath.includes(key)) {
538
+ continue;
539
+ }
540
+ else if (key !== 'body') {
541
+ // @ts-expect-error
542
+ querystring[key] = params[key];
543
+ }
544
+ }
545
+ const method = 'POST';
546
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_flush`;
547
+ const meta = {
548
+ name: 'ml.flush_job',
549
+ pathParts: {
550
+ job_id: params.job_id
551
+ }
552
+ };
553
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
554
+ }
555
+ async forecast(params, options) {
556
+ const acceptedPath = ['job_id'];
557
+ const acceptedBody = ['duration', 'expires_in', 'max_model_memory'];
558
+ const querystring = {};
559
+ // @ts-expect-error
560
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
561
+ let body;
562
+ if (typeof userBody === 'string') {
563
+ body = userBody;
564
+ }
565
+ else {
566
+ body = userBody != null ? { ...userBody } : undefined;
567
+ }
568
+ for (const key in params) {
569
+ if (acceptedBody.includes(key)) {
570
+ body = body !== null && body !== void 0 ? body : {};
571
+ // @ts-expect-error
572
+ body[key] = params[key];
573
+ }
574
+ else if (acceptedPath.includes(key)) {
575
+ continue;
576
+ }
577
+ else if (key !== 'body') {
578
+ // @ts-expect-error
579
+ querystring[key] = params[key];
580
+ }
581
+ }
582
+ const method = 'POST';
583
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast`;
584
+ const meta = {
585
+ name: 'ml.forecast',
586
+ pathParts: {
587
+ job_id: params.job_id
588
+ }
589
+ };
590
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
591
+ }
592
+ async getBuckets(params, options) {
593
+ const acceptedPath = ['job_id', 'timestamp'];
594
+ const acceptedBody = ['anomaly_score', 'desc', 'end', 'exclude_interim', 'expand', 'page', 'sort', 'start'];
595
+ const querystring = {};
596
+ // @ts-expect-error
597
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
598
+ let body;
599
+ if (typeof userBody === 'string') {
600
+ body = userBody;
601
+ }
602
+ else {
603
+ body = userBody != null ? { ...userBody } : undefined;
604
+ }
605
+ for (const key in params) {
606
+ if (acceptedBody.includes(key)) {
607
+ body = body !== null && body !== void 0 ? body : {};
608
+ // @ts-expect-error
609
+ body[key] = params[key];
610
+ }
611
+ else if (acceptedPath.includes(key)) {
612
+ continue;
613
+ }
614
+ else if (key !== 'body') {
615
+ // @ts-expect-error
616
+ querystring[key] = params[key];
617
+ }
618
+ }
619
+ let method = '';
620
+ let path = '';
621
+ if (params.job_id != null && params.timestamp != null) {
622
+ method = body != null ? 'POST' : 'GET';
623
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/buckets/${encodeURIComponent(params.timestamp.toString())}`;
624
+ }
625
+ else {
626
+ method = body != null ? 'POST' : 'GET';
627
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/buckets`;
628
+ }
629
+ const meta = {
630
+ name: 'ml.get_buckets',
631
+ pathParts: {
632
+ job_id: params.job_id,
633
+ timestamp: params.timestamp
634
+ }
635
+ };
636
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
637
+ }
638
+ async getCalendarEvents(params, options) {
639
+ const acceptedPath = ['calendar_id'];
640
+ const querystring = {};
641
+ const body = undefined;
642
+ for (const key in params) {
643
+ if (acceptedPath.includes(key)) {
644
+ continue;
645
+ }
646
+ else if (key !== 'body') {
647
+ // @ts-expect-error
648
+ querystring[key] = params[key];
649
+ }
650
+ }
651
+ const method = 'GET';
652
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events`;
653
+ const meta = {
654
+ name: 'ml.get_calendar_events',
655
+ pathParts: {
656
+ calendar_id: params.calendar_id
657
+ }
658
+ };
659
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
660
+ }
661
+ async getCalendars(params, options) {
662
+ const acceptedPath = ['calendar_id'];
663
+ const acceptedBody = ['page'];
664
+ const querystring = {};
665
+ // @ts-expect-error
666
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
667
+ let body;
668
+ if (typeof userBody === 'string') {
669
+ body = userBody;
670
+ }
671
+ else {
672
+ body = userBody != null ? { ...userBody } : undefined;
673
+ }
674
+ params = params !== null && params !== void 0 ? params : {};
675
+ for (const key in params) {
676
+ if (acceptedBody.includes(key)) {
677
+ body = body !== null && body !== void 0 ? body : {};
678
+ // @ts-expect-error
679
+ body[key] = params[key];
680
+ }
681
+ else if (acceptedPath.includes(key)) {
682
+ continue;
683
+ }
684
+ else if (key !== 'body') {
685
+ // @ts-expect-error
686
+ querystring[key] = params[key];
687
+ }
688
+ }
689
+ let method = '';
690
+ let path = '';
691
+ if (params.calendar_id != null) {
692
+ method = body != null ? 'POST' : 'GET';
693
+ path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
694
+ }
695
+ else {
696
+ method = body != null ? 'POST' : 'GET';
697
+ path = '/_ml/calendars';
698
+ }
699
+ const meta = {
700
+ name: 'ml.get_calendars',
701
+ pathParts: {
702
+ calendar_id: params.calendar_id
703
+ }
704
+ };
705
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
706
+ }
707
+ async getCategories(params, options) {
708
+ const acceptedPath = ['job_id', 'category_id'];
709
+ const acceptedBody = ['page'];
710
+ const querystring = {};
711
+ // @ts-expect-error
712
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
713
+ let body;
714
+ if (typeof userBody === 'string') {
715
+ body = userBody;
716
+ }
717
+ else {
718
+ body = userBody != null ? { ...userBody } : undefined;
719
+ }
720
+ for (const key in params) {
721
+ if (acceptedBody.includes(key)) {
722
+ body = body !== null && body !== void 0 ? body : {};
723
+ // @ts-expect-error
724
+ body[key] = params[key];
725
+ }
726
+ else if (acceptedPath.includes(key)) {
727
+ continue;
728
+ }
729
+ else if (key !== 'body') {
730
+ // @ts-expect-error
731
+ querystring[key] = params[key];
732
+ }
733
+ }
734
+ let method = '';
735
+ let path = '';
736
+ if (params.job_id != null && params.category_id != null) {
737
+ method = body != null ? 'POST' : 'GET';
738
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories/${encodeURIComponent(params.category_id.toString())}`;
739
+ }
740
+ else {
741
+ method = body != null ? 'POST' : 'GET';
742
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories`;
743
+ }
744
+ const meta = {
745
+ name: 'ml.get_categories',
746
+ pathParts: {
747
+ job_id: params.job_id,
748
+ category_id: params.category_id
749
+ }
750
+ };
751
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
752
+ }
753
+ async getDataFrameAnalytics(params, options) {
754
+ const acceptedPath = ['id'];
755
+ const querystring = {};
756
+ const body = undefined;
757
+ params = params !== null && params !== void 0 ? params : {};
758
+ for (const key in params) {
759
+ if (acceptedPath.includes(key)) {
760
+ continue;
761
+ }
762
+ else if (key !== 'body') {
763
+ // @ts-expect-error
764
+ querystring[key] = params[key];
765
+ }
766
+ }
767
+ let method = '';
768
+ let path = '';
769
+ if (params.id != null) {
770
+ method = 'GET';
771
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
772
+ }
773
+ else {
774
+ method = 'GET';
775
+ path = '/_ml/data_frame/analytics';
776
+ }
777
+ const meta = {
778
+ name: 'ml.get_data_frame_analytics',
779
+ pathParts: {
780
+ id: params.id
781
+ }
782
+ };
783
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
784
+ }
785
+ async getDataFrameAnalyticsStats(params, options) {
786
+ const acceptedPath = ['id'];
787
+ const querystring = {};
788
+ const body = undefined;
789
+ params = params !== null && params !== void 0 ? params : {};
790
+ for (const key in params) {
791
+ if (acceptedPath.includes(key)) {
792
+ continue;
793
+ }
794
+ else if (key !== 'body') {
795
+ // @ts-expect-error
796
+ querystring[key] = params[key];
797
+ }
798
+ }
799
+ let method = '';
800
+ let path = '';
801
+ if (params.id != null) {
802
+ method = 'GET';
803
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_stats`;
804
+ }
805
+ else {
806
+ method = 'GET';
807
+ path = '/_ml/data_frame/analytics/_stats';
808
+ }
809
+ const meta = {
810
+ name: 'ml.get_data_frame_analytics_stats',
811
+ pathParts: {
812
+ id: params.id
813
+ }
814
+ };
815
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
816
+ }
817
+ async getDatafeedStats(params, options) {
818
+ const acceptedPath = ['datafeed_id'];
819
+ const querystring = {};
820
+ const body = undefined;
821
+ params = params !== null && params !== void 0 ? params : {};
822
+ for (const key in params) {
823
+ if (acceptedPath.includes(key)) {
824
+ continue;
825
+ }
826
+ else if (key !== 'body') {
827
+ // @ts-expect-error
828
+ querystring[key] = params[key];
829
+ }
830
+ }
831
+ let method = '';
832
+ let path = '';
833
+ if (params.datafeed_id != null) {
834
+ method = 'GET';
835
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_stats`;
836
+ }
837
+ else {
838
+ method = 'GET';
839
+ path = '/_ml/datafeeds/_stats';
840
+ }
841
+ const meta = {
842
+ name: 'ml.get_datafeed_stats',
843
+ pathParts: {
844
+ datafeed_id: params.datafeed_id
845
+ }
846
+ };
847
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
848
+ }
849
+ async getDatafeeds(params, options) {
850
+ const acceptedPath = ['datafeed_id'];
851
+ const querystring = {};
852
+ const body = undefined;
853
+ params = params !== null && params !== void 0 ? params : {};
854
+ for (const key in params) {
855
+ if (acceptedPath.includes(key)) {
856
+ continue;
857
+ }
858
+ else if (key !== 'body') {
859
+ // @ts-expect-error
860
+ querystring[key] = params[key];
861
+ }
862
+ }
863
+ let method = '';
864
+ let path = '';
865
+ if (params.datafeed_id != null) {
866
+ method = 'GET';
867
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
868
+ }
869
+ else {
870
+ method = 'GET';
871
+ path = '/_ml/datafeeds';
872
+ }
873
+ const meta = {
874
+ name: 'ml.get_datafeeds',
875
+ pathParts: {
876
+ datafeed_id: params.datafeed_id
877
+ }
878
+ };
879
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
880
+ }
881
+ async getFilters(params, options) {
882
+ const acceptedPath = ['filter_id'];
883
+ const querystring = {};
884
+ const body = undefined;
885
+ params = params !== null && params !== void 0 ? params : {};
886
+ for (const key in params) {
887
+ if (acceptedPath.includes(key)) {
888
+ continue;
889
+ }
890
+ else if (key !== 'body') {
891
+ // @ts-expect-error
892
+ querystring[key] = params[key];
893
+ }
894
+ }
895
+ let method = '';
896
+ let path = '';
897
+ if (params.filter_id != null) {
898
+ method = 'GET';
899
+ path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
900
+ }
901
+ else {
902
+ method = 'GET';
903
+ path = '/_ml/filters';
904
+ }
905
+ const meta = {
906
+ name: 'ml.get_filters',
907
+ pathParts: {
908
+ filter_id: params.filter_id
909
+ }
910
+ };
911
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
912
+ }
913
+ async getInfluencers(params, options) {
914
+ const acceptedPath = ['job_id'];
915
+ const acceptedBody = ['page'];
916
+ const querystring = {};
917
+ // @ts-expect-error
918
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
919
+ let body;
920
+ if (typeof userBody === 'string') {
921
+ body = userBody;
922
+ }
923
+ else {
924
+ body = userBody != null ? { ...userBody } : undefined;
925
+ }
926
+ for (const key in params) {
927
+ if (acceptedBody.includes(key)) {
928
+ body = body !== null && body !== void 0 ? body : {};
929
+ // @ts-expect-error
930
+ body[key] = params[key];
931
+ }
932
+ else if (acceptedPath.includes(key)) {
933
+ continue;
934
+ }
935
+ else if (key !== 'body') {
936
+ // @ts-expect-error
937
+ querystring[key] = params[key];
938
+ }
939
+ }
940
+ const method = body != null ? 'POST' : 'GET';
941
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/influencers`;
942
+ const meta = {
943
+ name: 'ml.get_influencers',
944
+ pathParts: {
945
+ job_id: params.job_id
946
+ }
947
+ };
948
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
949
+ }
950
+ async getJobStats(params, options) {
951
+ const acceptedPath = ['job_id'];
952
+ const querystring = {};
953
+ const body = undefined;
954
+ params = params !== null && params !== void 0 ? params : {};
955
+ for (const key in params) {
956
+ if (acceptedPath.includes(key)) {
957
+ continue;
958
+ }
959
+ else if (key !== 'body') {
960
+ // @ts-expect-error
961
+ querystring[key] = params[key];
962
+ }
963
+ }
964
+ let method = '';
965
+ let path = '';
966
+ if (params.job_id != null) {
967
+ method = 'GET';
968
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_stats`;
969
+ }
970
+ else {
971
+ method = 'GET';
972
+ path = '/_ml/anomaly_detectors/_stats';
973
+ }
974
+ const meta = {
975
+ name: 'ml.get_job_stats',
976
+ pathParts: {
977
+ job_id: params.job_id
978
+ }
979
+ };
980
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
981
+ }
982
+ async getJobs(params, options) {
983
+ const acceptedPath = ['job_id'];
984
+ const querystring = {};
985
+ const body = undefined;
986
+ params = params !== null && params !== void 0 ? params : {};
987
+ for (const key in params) {
988
+ if (acceptedPath.includes(key)) {
989
+ continue;
990
+ }
991
+ else if (key !== 'body') {
992
+ // @ts-expect-error
993
+ querystring[key] = params[key];
994
+ }
995
+ }
996
+ let method = '';
997
+ let path = '';
998
+ if (params.job_id != null) {
999
+ method = 'GET';
1000
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
1001
+ }
1002
+ else {
1003
+ method = 'GET';
1004
+ path = '/_ml/anomaly_detectors';
1005
+ }
1006
+ const meta = {
1007
+ name: 'ml.get_jobs',
1008
+ pathParts: {
1009
+ job_id: params.job_id
1010
+ }
1011
+ };
1012
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1013
+ }
1014
+ async getMemoryStats(params, options) {
1015
+ const acceptedPath = ['node_id'];
1016
+ const querystring = {};
1017
+ const body = undefined;
1018
+ params = params !== null && params !== void 0 ? params : {};
1019
+ for (const key in params) {
1020
+ if (acceptedPath.includes(key)) {
1021
+ continue;
1022
+ }
1023
+ else if (key !== 'body') {
1024
+ // @ts-expect-error
1025
+ querystring[key] = params[key];
1026
+ }
1027
+ }
1028
+ let method = '';
1029
+ let path = '';
1030
+ if (params.node_id != null) {
1031
+ method = 'GET';
1032
+ path = `/_ml/memory/${encodeURIComponent(params.node_id.toString())}/_stats`;
1033
+ }
1034
+ else {
1035
+ method = 'GET';
1036
+ path = '/_ml/memory/_stats';
1037
+ }
1038
+ const meta = {
1039
+ name: 'ml.get_memory_stats',
1040
+ pathParts: {
1041
+ node_id: params.node_id
1042
+ }
1043
+ };
1044
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1045
+ }
1046
+ async getModelSnapshotUpgradeStats(params, options) {
1047
+ const acceptedPath = ['job_id', 'snapshot_id'];
1048
+ const querystring = {};
1049
+ const body = undefined;
1050
+ for (const key in params) {
1051
+ if (acceptedPath.includes(key)) {
1052
+ continue;
1053
+ }
1054
+ else if (key !== 'body') {
1055
+ // @ts-expect-error
1056
+ querystring[key] = params[key];
1057
+ }
1058
+ }
1059
+ const method = 'GET';
1060
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_upgrade/_stats`;
1061
+ const meta = {
1062
+ name: 'ml.get_model_snapshot_upgrade_stats',
1063
+ pathParts: {
1064
+ job_id: params.job_id,
1065
+ snapshot_id: params.snapshot_id
1066
+ }
1067
+ };
1068
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1069
+ }
1070
+ async getModelSnapshots(params, options) {
1071
+ const acceptedPath = ['job_id', 'snapshot_id'];
1072
+ const acceptedBody = ['desc', 'end', 'page', 'sort', 'start'];
1073
+ const querystring = {};
1074
+ // @ts-expect-error
1075
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1076
+ let body;
1077
+ if (typeof userBody === 'string') {
1078
+ body = userBody;
1079
+ }
1080
+ else {
1081
+ body = userBody != null ? { ...userBody } : undefined;
1082
+ }
1083
+ for (const key in params) {
1084
+ if (acceptedBody.includes(key)) {
1085
+ body = body !== null && body !== void 0 ? body : {};
1086
+ // @ts-expect-error
1087
+ body[key] = params[key];
1088
+ }
1089
+ else if (acceptedPath.includes(key)) {
1090
+ continue;
1091
+ }
1092
+ else if (key !== 'body') {
1093
+ // @ts-expect-error
1094
+ querystring[key] = params[key];
1095
+ }
1096
+ }
1097
+ let method = '';
1098
+ let path = '';
1099
+ if (params.job_id != null && params.snapshot_id != null) {
1100
+ method = body != null ? 'POST' : 'GET';
1101
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}`;
1102
+ }
1103
+ else {
1104
+ method = body != null ? 'POST' : 'GET';
1105
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots`;
1106
+ }
1107
+ const meta = {
1108
+ name: 'ml.get_model_snapshots',
1109
+ pathParts: {
1110
+ job_id: params.job_id,
1111
+ snapshot_id: params.snapshot_id
1112
+ }
1113
+ };
1114
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1115
+ }
1116
+ async getOverallBuckets(params, options) {
1117
+ const acceptedPath = ['job_id'];
1118
+ const acceptedBody = ['allow_no_match', 'bucket_span', 'end', 'exclude_interim', 'overall_score', 'start', 'top_n'];
1119
+ const querystring = {};
1120
+ // @ts-expect-error
1121
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1122
+ let body;
1123
+ if (typeof userBody === 'string') {
1124
+ body = userBody;
1125
+ }
1126
+ else {
1127
+ body = userBody != null ? { ...userBody } : undefined;
1128
+ }
1129
+ for (const key in params) {
1130
+ if (acceptedBody.includes(key)) {
1131
+ body = body !== null && body !== void 0 ? body : {};
1132
+ // @ts-expect-error
1133
+ body[key] = params[key];
1134
+ }
1135
+ else if (acceptedPath.includes(key)) {
1136
+ continue;
1137
+ }
1138
+ else if (key !== 'body') {
1139
+ // @ts-expect-error
1140
+ querystring[key] = params[key];
1141
+ }
1142
+ }
1143
+ const method = body != null ? 'POST' : 'GET';
1144
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/overall_buckets`;
1145
+ const meta = {
1146
+ name: 'ml.get_overall_buckets',
1147
+ pathParts: {
1148
+ job_id: params.job_id
1149
+ }
1150
+ };
1151
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1152
+ }
1153
+ async getRecords(params, options) {
1154
+ const acceptedPath = ['job_id'];
1155
+ const acceptedBody = ['desc', 'end', 'exclude_interim', 'page', 'record_score', 'sort', 'start'];
1156
+ const querystring = {};
1157
+ // @ts-expect-error
1158
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1159
+ let body;
1160
+ if (typeof userBody === 'string') {
1161
+ body = userBody;
1162
+ }
1163
+ else {
1164
+ body = userBody != null ? { ...userBody } : undefined;
1165
+ }
1166
+ for (const key in params) {
1167
+ if (acceptedBody.includes(key)) {
1168
+ body = body !== null && body !== void 0 ? body : {};
1169
+ // @ts-expect-error
1170
+ body[key] = params[key];
1171
+ }
1172
+ else if (acceptedPath.includes(key)) {
1173
+ continue;
1174
+ }
1175
+ else if (key !== 'body') {
1176
+ // @ts-expect-error
1177
+ querystring[key] = params[key];
1178
+ }
1179
+ }
1180
+ const method = body != null ? 'POST' : 'GET';
1181
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/records`;
1182
+ const meta = {
1183
+ name: 'ml.get_records',
1184
+ pathParts: {
1185
+ job_id: params.job_id
1186
+ }
1187
+ };
1188
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1189
+ }
1190
+ async getTrainedModels(params, options) {
1191
+ const acceptedPath = ['model_id'];
1192
+ const querystring = {};
1193
+ const body = undefined;
1194
+ params = params !== null && params !== void 0 ? params : {};
1195
+ for (const key in params) {
1196
+ if (acceptedPath.includes(key)) {
1197
+ continue;
1198
+ }
1199
+ else if (key !== 'body') {
1200
+ // @ts-expect-error
1201
+ querystring[key] = params[key];
1202
+ }
1203
+ }
1204
+ let method = '';
1205
+ let path = '';
1206
+ if (params.model_id != null) {
1207
+ method = 'GET';
1208
+ path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
1209
+ }
1210
+ else {
1211
+ method = 'GET';
1212
+ path = '/_ml/trained_models';
1213
+ }
1214
+ const meta = {
1215
+ name: 'ml.get_trained_models',
1216
+ pathParts: {
1217
+ model_id: params.model_id
1218
+ }
1219
+ };
1220
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1221
+ }
1222
+ async getTrainedModelsStats(params, options) {
1223
+ const acceptedPath = ['model_id'];
1224
+ const querystring = {};
1225
+ const body = undefined;
1226
+ params = params !== null && params !== void 0 ? params : {};
1227
+ for (const key in params) {
1228
+ if (acceptedPath.includes(key)) {
1229
+ continue;
1230
+ }
1231
+ else if (key !== 'body') {
1232
+ // @ts-expect-error
1233
+ querystring[key] = params[key];
1234
+ }
1235
+ }
1236
+ let method = '';
1237
+ let path = '';
1238
+ if (params.model_id != null) {
1239
+ method = 'GET';
1240
+ path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/_stats`;
1241
+ }
1242
+ else {
1243
+ method = 'GET';
1244
+ path = '/_ml/trained_models/_stats';
1245
+ }
1246
+ const meta = {
1247
+ name: 'ml.get_trained_models_stats',
1248
+ pathParts: {
1249
+ model_id: params.model_id
1250
+ }
1251
+ };
1252
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1253
+ }
1254
+ async inferTrainedModel(params, options) {
1255
+ const acceptedPath = ['model_id'];
1256
+ const acceptedBody = ['docs', 'inference_config'];
1257
+ const querystring = {};
1258
+ // @ts-expect-error
1259
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1260
+ let body;
1261
+ if (typeof userBody === 'string') {
1262
+ body = userBody;
1263
+ }
1264
+ else {
1265
+ body = userBody != null ? { ...userBody } : undefined;
1266
+ }
1267
+ for (const key in params) {
1268
+ if (acceptedBody.includes(key)) {
1269
+ body = body !== null && body !== void 0 ? body : {};
1270
+ // @ts-expect-error
1271
+ body[key] = params[key];
1272
+ }
1273
+ else if (acceptedPath.includes(key)) {
1274
+ continue;
1275
+ }
1276
+ else if (key !== 'body') {
1277
+ // @ts-expect-error
1278
+ querystring[key] = params[key];
1279
+ }
1280
+ }
1281
+ const method = 'POST';
1282
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/_infer`;
1283
+ const meta = {
1284
+ name: 'ml.infer_trained_model',
1285
+ pathParts: {
1286
+ model_id: params.model_id
1287
+ }
1288
+ };
1289
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1290
+ }
1291
+ async info(params, options) {
1292
+ const acceptedPath = [];
1293
+ const querystring = {};
1294
+ const body = undefined;
1295
+ params = params !== null && params !== void 0 ? params : {};
1296
+ for (const key in params) {
1297
+ if (acceptedPath.includes(key)) {
1298
+ continue;
1299
+ }
1300
+ else if (key !== 'body') {
1301
+ // @ts-expect-error
1302
+ querystring[key] = params[key];
1303
+ }
1304
+ }
1305
+ const method = 'GET';
1306
+ const path = '/_ml/info';
1307
+ const meta = {
1308
+ name: 'ml.info'
1309
+ };
1310
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1311
+ }
1312
+ async openJob(params, options) {
1313
+ const acceptedPath = ['job_id'];
1314
+ const acceptedBody = ['timeout'];
1315
+ const querystring = {};
1316
+ // @ts-expect-error
1317
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1318
+ let body;
1319
+ if (typeof userBody === 'string') {
1320
+ body = userBody;
1321
+ }
1322
+ else {
1323
+ body = userBody != null ? { ...userBody } : undefined;
1324
+ }
1325
+ for (const key in params) {
1326
+ if (acceptedBody.includes(key)) {
1327
+ body = body !== null && body !== void 0 ? body : {};
1328
+ // @ts-expect-error
1329
+ body[key] = params[key];
1330
+ }
1331
+ else if (acceptedPath.includes(key)) {
1332
+ continue;
1333
+ }
1334
+ else if (key !== 'body') {
1335
+ // @ts-expect-error
1336
+ querystring[key] = params[key];
1337
+ }
1338
+ }
1339
+ const method = 'POST';
1340
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_open`;
1341
+ const meta = {
1342
+ name: 'ml.open_job',
1343
+ pathParts: {
1344
+ job_id: params.job_id
1345
+ }
1346
+ };
1347
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1348
+ }
1349
+ async postCalendarEvents(params, options) {
1350
+ const acceptedPath = ['calendar_id'];
1351
+ const acceptedBody = ['events'];
1352
+ const querystring = {};
1353
+ // @ts-expect-error
1354
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1355
+ let body;
1356
+ if (typeof userBody === 'string') {
1357
+ body = userBody;
1358
+ }
1359
+ else {
1360
+ body = userBody != null ? { ...userBody } : undefined;
1361
+ }
1362
+ for (const key in params) {
1363
+ if (acceptedBody.includes(key)) {
1364
+ body = body !== null && body !== void 0 ? body : {};
1365
+ // @ts-expect-error
1366
+ body[key] = params[key];
1367
+ }
1368
+ else if (acceptedPath.includes(key)) {
1369
+ continue;
1370
+ }
1371
+ else if (key !== 'body') {
1372
+ // @ts-expect-error
1373
+ querystring[key] = params[key];
1374
+ }
1375
+ }
1376
+ const method = 'POST';
1377
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events`;
1378
+ const meta = {
1379
+ name: 'ml.post_calendar_events',
1380
+ pathParts: {
1381
+ calendar_id: params.calendar_id
1382
+ }
1383
+ };
1384
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1385
+ }
1386
+ async postData(params, options) {
1387
+ var _a;
1388
+ const acceptedPath = ['job_id'];
1389
+ const acceptedBody = ['data'];
1390
+ const querystring = {};
1391
+ // @ts-expect-error
1392
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1393
+ for (const key in params) {
1394
+ if (acceptedBody.includes(key)) {
1395
+ // @ts-expect-error
1396
+ body = params[key];
1397
+ }
1398
+ else if (acceptedPath.includes(key)) {
1399
+ continue;
1400
+ }
1401
+ else if (key !== 'body') {
1402
+ // @ts-expect-error
1403
+ querystring[key] = params[key];
1404
+ }
1405
+ }
1406
+ const method = 'POST';
1407
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_data`;
1408
+ const meta = {
1409
+ name: 'ml.post_data',
1410
+ pathParts: {
1411
+ job_id: params.job_id
1412
+ }
1413
+ };
1414
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1415
+ }
1416
+ async previewDataFrameAnalytics(params, options) {
1417
+ const acceptedPath = ['id'];
1418
+ const acceptedBody = ['config'];
1419
+ const querystring = {};
1420
+ // @ts-expect-error
1421
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1422
+ let body;
1423
+ if (typeof userBody === 'string') {
1424
+ body = userBody;
1425
+ }
1426
+ else {
1427
+ body = userBody != null ? { ...userBody } : undefined;
1428
+ }
1429
+ params = params !== null && params !== void 0 ? params : {};
1430
+ for (const key in params) {
1431
+ if (acceptedBody.includes(key)) {
1432
+ body = body !== null && body !== void 0 ? body : {};
1433
+ // @ts-expect-error
1434
+ body[key] = params[key];
1435
+ }
1436
+ else if (acceptedPath.includes(key)) {
1437
+ continue;
1438
+ }
1439
+ else if (key !== 'body') {
1440
+ // @ts-expect-error
1441
+ querystring[key] = params[key];
1442
+ }
1443
+ }
1444
+ let method = '';
1445
+ let path = '';
1446
+ if (params.id != null) {
1447
+ method = body != null ? 'POST' : 'GET';
1448
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_preview`;
1449
+ }
1450
+ else {
1451
+ method = body != null ? 'POST' : 'GET';
1452
+ path = '/_ml/data_frame/analytics/_preview';
1453
+ }
1454
+ const meta = {
1455
+ name: 'ml.preview_data_frame_analytics',
1456
+ pathParts: {
1457
+ id: params.id
1458
+ }
1459
+ };
1460
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1461
+ }
1462
+ async previewDatafeed(params, options) {
1463
+ const acceptedPath = ['datafeed_id'];
1464
+ const acceptedBody = ['datafeed_config', 'job_config'];
1465
+ const querystring = {};
1466
+ // @ts-expect-error
1467
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1468
+ let body;
1469
+ if (typeof userBody === 'string') {
1470
+ body = userBody;
1471
+ }
1472
+ else {
1473
+ body = userBody != null ? { ...userBody } : undefined;
1474
+ }
1475
+ params = params !== null && params !== void 0 ? params : {};
1476
+ for (const key in params) {
1477
+ if (acceptedBody.includes(key)) {
1478
+ body = body !== null && body !== void 0 ? body : {};
1479
+ // @ts-expect-error
1480
+ body[key] = params[key];
1481
+ }
1482
+ else if (acceptedPath.includes(key)) {
1483
+ continue;
1484
+ }
1485
+ else if (key !== 'body') {
1486
+ // @ts-expect-error
1487
+ querystring[key] = params[key];
1488
+ }
1489
+ }
1490
+ let method = '';
1491
+ let path = '';
1492
+ if (params.datafeed_id != null) {
1493
+ method = body != null ? 'POST' : 'GET';
1494
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_preview`;
1495
+ }
1496
+ else {
1497
+ method = body != null ? 'POST' : 'GET';
1498
+ path = '/_ml/datafeeds/_preview';
1499
+ }
1500
+ const meta = {
1501
+ name: 'ml.preview_datafeed',
1502
+ pathParts: {
1503
+ datafeed_id: params.datafeed_id
1504
+ }
1505
+ };
1506
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1507
+ }
1508
+ async putCalendar(params, options) {
1509
+ const acceptedPath = ['calendar_id'];
1510
+ const acceptedBody = ['job_ids', 'description'];
1511
+ const querystring = {};
1512
+ // @ts-expect-error
1513
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1514
+ let body;
1515
+ if (typeof userBody === 'string') {
1516
+ body = userBody;
1517
+ }
1518
+ else {
1519
+ body = userBody != null ? { ...userBody } : undefined;
1520
+ }
1521
+ for (const key in params) {
1522
+ if (acceptedBody.includes(key)) {
1523
+ body = body !== null && body !== void 0 ? body : {};
1524
+ // @ts-expect-error
1525
+ body[key] = params[key];
1526
+ }
1527
+ else if (acceptedPath.includes(key)) {
1528
+ continue;
1529
+ }
1530
+ else if (key !== 'body') {
1531
+ // @ts-expect-error
1532
+ querystring[key] = params[key];
1533
+ }
1534
+ }
1535
+ const method = 'PUT';
1536
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
1537
+ const meta = {
1538
+ name: 'ml.put_calendar',
1539
+ pathParts: {
1540
+ calendar_id: params.calendar_id
1541
+ }
1542
+ };
1543
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1544
+ }
1545
+ async putCalendarJob(params, options) {
1546
+ const acceptedPath = ['calendar_id', 'job_id'];
1547
+ const querystring = {};
1548
+ const body = undefined;
1549
+ for (const key in params) {
1550
+ if (acceptedPath.includes(key)) {
1551
+ continue;
1552
+ }
1553
+ else if (key !== 'body') {
1554
+ // @ts-expect-error
1555
+ querystring[key] = params[key];
1556
+ }
1557
+ }
1558
+ const method = 'PUT';
1559
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/jobs/${encodeURIComponent(params.job_id.toString())}`;
1560
+ const meta = {
1561
+ name: 'ml.put_calendar_job',
1562
+ pathParts: {
1563
+ calendar_id: params.calendar_id,
1564
+ job_id: params.job_id
1565
+ }
1566
+ };
1567
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1568
+ }
1569
+ async putDataFrameAnalytics(params, options) {
1570
+ const acceptedPath = ['id'];
1571
+ const acceptedBody = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', '_meta', 'model_memory_limit', 'source', 'headers', 'version'];
1572
+ const querystring = {};
1573
+ // @ts-expect-error
1574
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1575
+ let body;
1576
+ if (typeof userBody === 'string') {
1577
+ body = userBody;
1578
+ }
1579
+ else {
1580
+ body = userBody != null ? { ...userBody } : undefined;
1581
+ }
1582
+ for (const key in params) {
1583
+ if (acceptedBody.includes(key)) {
1584
+ body = body !== null && body !== void 0 ? body : {};
1585
+ // @ts-expect-error
1586
+ body[key] = params[key];
1587
+ }
1588
+ else if (acceptedPath.includes(key)) {
1589
+ continue;
1590
+ }
1591
+ else if (key !== 'body') {
1592
+ // @ts-expect-error
1593
+ querystring[key] = params[key];
1594
+ }
1595
+ }
1596
+ const method = 'PUT';
1597
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
1598
+ const meta = {
1599
+ name: 'ml.put_data_frame_analytics',
1600
+ pathParts: {
1601
+ id: params.id
1602
+ }
1603
+ };
1604
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1605
+ }
1606
+ async putDatafeed(params, options) {
1607
+ const acceptedPath = ['datafeed_id'];
1608
+ const acceptedBody = ['aggregations', 'aggs', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size', 'headers'];
1609
+ const querystring = {};
1610
+ // @ts-expect-error
1611
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1612
+ let body;
1613
+ if (typeof userBody === 'string') {
1614
+ body = userBody;
1615
+ }
1616
+ else {
1617
+ body = userBody != null ? { ...userBody } : undefined;
1618
+ }
1619
+ for (const key in params) {
1620
+ if (acceptedBody.includes(key)) {
1621
+ body = body !== null && body !== void 0 ? body : {};
1622
+ // @ts-expect-error
1623
+ body[key] = params[key];
1624
+ }
1625
+ else if (acceptedPath.includes(key)) {
1626
+ continue;
1627
+ }
1628
+ else if (key !== 'body') {
1629
+ // @ts-expect-error
1630
+ querystring[key] = params[key];
1631
+ }
1632
+ }
1633
+ const method = 'PUT';
1634
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
1635
+ const meta = {
1636
+ name: 'ml.put_datafeed',
1637
+ pathParts: {
1638
+ datafeed_id: params.datafeed_id
1639
+ }
1640
+ };
1641
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1642
+ }
1643
+ async putFilter(params, options) {
1644
+ const acceptedPath = ['filter_id'];
1645
+ const acceptedBody = ['description', 'items'];
1646
+ const querystring = {};
1647
+ // @ts-expect-error
1648
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1649
+ let body;
1650
+ if (typeof userBody === 'string') {
1651
+ body = userBody;
1652
+ }
1653
+ else {
1654
+ body = userBody != null ? { ...userBody } : undefined;
1655
+ }
1656
+ for (const key in params) {
1657
+ if (acceptedBody.includes(key)) {
1658
+ body = body !== null && body !== void 0 ? body : {};
1659
+ // @ts-expect-error
1660
+ body[key] = params[key];
1661
+ }
1662
+ else if (acceptedPath.includes(key)) {
1663
+ continue;
1664
+ }
1665
+ else if (key !== 'body') {
1666
+ // @ts-expect-error
1667
+ querystring[key] = params[key];
1668
+ }
1669
+ }
1670
+ const method = 'PUT';
1671
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
1672
+ const meta = {
1673
+ name: 'ml.put_filter',
1674
+ pathParts: {
1675
+ filter_id: params.filter_id
1676
+ }
1677
+ };
1678
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1679
+ }
1680
+ async putJob(params, options) {
1681
+ const acceptedPath = [];
1682
+ const acceptedBody = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'job_id', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'];
1683
+ const querystring = {};
1684
+ // @ts-expect-error
1685
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1686
+ let body;
1687
+ if (typeof userBody === 'string') {
1688
+ body = userBody;
1689
+ }
1690
+ else {
1691
+ body = userBody != null ? { ...userBody } : undefined;
1692
+ }
1693
+ for (const key in params) {
1694
+ if (acceptedBody.includes(key)) {
1695
+ body = body !== null && body !== void 0 ? body : {};
1696
+ // @ts-expect-error
1697
+ body[key] = params[key];
1698
+ }
1699
+ else if (acceptedPath.includes(key)) {
1700
+ continue;
1701
+ }
1702
+ else if (key !== 'body') {
1703
+ // @ts-expect-error
1704
+ querystring[key] = params[key];
1705
+ }
1706
+ }
1707
+ const method = 'PUT';
1708
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
1709
+ const meta = {
1710
+ name: 'ml.put_job',
1711
+ pathParts: {
1712
+ job_id: params.job_id
1713
+ }
1714
+ };
1715
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1716
+ }
1717
+ async putTrainedModel(params, options) {
1718
+ const acceptedPath = ['model_id'];
1719
+ const acceptedBody = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'model_type', 'model_size_bytes', 'platform_architecture', 'tags', 'prefix_strings'];
1720
+ const querystring = {};
1721
+ // @ts-expect-error
1722
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1723
+ let body;
1724
+ if (typeof userBody === 'string') {
1725
+ body = userBody;
1726
+ }
1727
+ else {
1728
+ body = userBody != null ? { ...userBody } : undefined;
1729
+ }
1730
+ for (const key in params) {
1731
+ if (acceptedBody.includes(key)) {
1732
+ body = body !== null && body !== void 0 ? body : {};
1733
+ // @ts-expect-error
1734
+ body[key] = params[key];
1735
+ }
1736
+ else if (acceptedPath.includes(key)) {
1737
+ continue;
1738
+ }
1739
+ else if (key !== 'body') {
1740
+ // @ts-expect-error
1741
+ querystring[key] = params[key];
1742
+ }
1743
+ }
1744
+ const method = 'PUT';
1745
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
1746
+ const meta = {
1747
+ name: 'ml.put_trained_model',
1748
+ pathParts: {
1749
+ model_id: params.model_id
1750
+ }
1751
+ };
1752
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1753
+ }
1754
+ async putTrainedModelAlias(params, options) {
1755
+ const acceptedPath = ['model_alias', 'model_id'];
1756
+ const querystring = {};
1757
+ const body = undefined;
1758
+ for (const key in params) {
1759
+ if (acceptedPath.includes(key)) {
1760
+ continue;
1761
+ }
1762
+ else if (key !== 'body') {
1763
+ // @ts-expect-error
1764
+ querystring[key] = params[key];
1765
+ }
1766
+ }
1767
+ const method = 'PUT';
1768
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/model_aliases/${encodeURIComponent(params.model_alias.toString())}`;
1769
+ const meta = {
1770
+ name: 'ml.put_trained_model_alias',
1771
+ pathParts: {
1772
+ model_alias: params.model_alias,
1773
+ model_id: params.model_id
1774
+ }
1775
+ };
1776
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1777
+ }
1778
+ async putTrainedModelDefinitionPart(params, options) {
1779
+ const acceptedPath = ['model_id', 'part'];
1780
+ const acceptedBody = ['definition', 'total_definition_length', 'total_parts'];
1781
+ const querystring = {};
1782
+ // @ts-expect-error
1783
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1784
+ let body;
1785
+ if (typeof userBody === 'string') {
1786
+ body = userBody;
1787
+ }
1788
+ else {
1789
+ body = userBody != null ? { ...userBody } : undefined;
1790
+ }
1791
+ for (const key in params) {
1792
+ if (acceptedBody.includes(key)) {
1793
+ body = body !== null && body !== void 0 ? body : {};
1794
+ // @ts-expect-error
1795
+ body[key] = params[key];
1796
+ }
1797
+ else if (acceptedPath.includes(key)) {
1798
+ continue;
1799
+ }
1800
+ else if (key !== 'body') {
1801
+ // @ts-expect-error
1802
+ querystring[key] = params[key];
1803
+ }
1804
+ }
1805
+ const method = 'PUT';
1806
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/definition/${encodeURIComponent(params.part.toString())}`;
1807
+ const meta = {
1808
+ name: 'ml.put_trained_model_definition_part',
1809
+ pathParts: {
1810
+ model_id: params.model_id,
1811
+ part: params.part
1812
+ }
1813
+ };
1814
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1815
+ }
1816
+ async putTrainedModelVocabulary(params, options) {
1817
+ const acceptedPath = ['model_id'];
1818
+ const acceptedBody = ['vocabulary', 'merges', 'scores'];
1819
+ const querystring = {};
1820
+ // @ts-expect-error
1821
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1822
+ let body;
1823
+ if (typeof userBody === 'string') {
1824
+ body = userBody;
1825
+ }
1826
+ else {
1827
+ body = userBody != null ? { ...userBody } : undefined;
1828
+ }
1829
+ for (const key in params) {
1830
+ if (acceptedBody.includes(key)) {
1831
+ body = body !== null && body !== void 0 ? body : {};
1832
+ // @ts-expect-error
1833
+ body[key] = params[key];
1834
+ }
1835
+ else if (acceptedPath.includes(key)) {
1836
+ continue;
1837
+ }
1838
+ else if (key !== 'body') {
1839
+ // @ts-expect-error
1840
+ querystring[key] = params[key];
1841
+ }
1842
+ }
1843
+ const method = 'PUT';
1844
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/vocabulary`;
1845
+ const meta = {
1846
+ name: 'ml.put_trained_model_vocabulary',
1847
+ pathParts: {
1848
+ model_id: params.model_id
1849
+ }
1850
+ };
1851
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1852
+ }
1853
+ async resetJob(params, options) {
1854
+ const acceptedPath = ['job_id'];
1855
+ const querystring = {};
1856
+ const body = undefined;
1857
+ for (const key in params) {
1858
+ if (acceptedPath.includes(key)) {
1859
+ continue;
1860
+ }
1861
+ else if (key !== 'body') {
1862
+ // @ts-expect-error
1863
+ querystring[key] = params[key];
1864
+ }
1865
+ }
1866
+ const method = 'POST';
1867
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_reset`;
1868
+ const meta = {
1869
+ name: 'ml.reset_job',
1870
+ pathParts: {
1871
+ job_id: params.job_id
1872
+ }
1873
+ };
1874
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1875
+ }
1876
+ async revertModelSnapshot(params, options) {
1877
+ const acceptedPath = ['job_id', 'snapshot_id'];
1878
+ const acceptedBody = ['delete_intervening_results'];
1879
+ const querystring = {};
1880
+ // @ts-expect-error
1881
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1882
+ let body;
1883
+ if (typeof userBody === 'string') {
1884
+ body = userBody;
1885
+ }
1886
+ else {
1887
+ body = userBody != null ? { ...userBody } : undefined;
1888
+ }
1889
+ for (const key in params) {
1890
+ if (acceptedBody.includes(key)) {
1891
+ body = body !== null && body !== void 0 ? body : {};
1892
+ // @ts-expect-error
1893
+ body[key] = params[key];
1894
+ }
1895
+ else if (acceptedPath.includes(key)) {
1896
+ continue;
1897
+ }
1898
+ else if (key !== 'body') {
1899
+ // @ts-expect-error
1900
+ querystring[key] = params[key];
1901
+ }
1902
+ }
1903
+ const method = 'POST';
1904
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_revert`;
1905
+ const meta = {
1906
+ name: 'ml.revert_model_snapshot',
1907
+ pathParts: {
1908
+ job_id: params.job_id,
1909
+ snapshot_id: params.snapshot_id
1910
+ }
1911
+ };
1912
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1913
+ }
1914
+ async setUpgradeMode(params, options) {
1915
+ const acceptedPath = [];
1916
+ const querystring = {};
1917
+ const body = undefined;
1918
+ params = params !== null && params !== void 0 ? params : {};
1919
+ for (const key in params) {
1920
+ if (acceptedPath.includes(key)) {
1921
+ continue;
1922
+ }
1923
+ else if (key !== 'body') {
1924
+ // @ts-expect-error
1925
+ querystring[key] = params[key];
1926
+ }
1927
+ }
1928
+ const method = 'POST';
1929
+ const path = '/_ml/set_upgrade_mode';
1930
+ const meta = {
1931
+ name: 'ml.set_upgrade_mode'
1932
+ };
1933
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1934
+ }
1935
+ async startDataFrameAnalytics(params, options) {
1936
+ const acceptedPath = [];
1937
+ const acceptedBody = ['id', 'timeout'];
1938
+ const querystring = {};
1939
+ // @ts-expect-error
1940
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1941
+ let body;
1942
+ if (typeof userBody === 'string') {
1943
+ body = userBody;
1944
+ }
1945
+ else {
1946
+ body = userBody != null ? { ...userBody } : undefined;
1947
+ }
1948
+ for (const key in params) {
1949
+ if (acceptedBody.includes(key)) {
1950
+ body = body !== null && body !== void 0 ? body : {};
1951
+ // @ts-expect-error
1952
+ body[key] = params[key];
1953
+ }
1954
+ else if (acceptedPath.includes(key)) {
1955
+ continue;
1956
+ }
1957
+ else if (key !== 'body') {
1958
+ // @ts-expect-error
1959
+ querystring[key] = params[key];
1960
+ }
1961
+ }
1962
+ const method = 'POST';
1963
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_start`;
1964
+ const meta = {
1965
+ name: 'ml.start_data_frame_analytics',
1966
+ pathParts: {
1967
+ id: params.id
1968
+ }
1969
+ };
1970
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1971
+ }
1972
+ async startDatafeed(params, options) {
1973
+ const acceptedPath = ['datafeed_id'];
1974
+ const acceptedBody = ['end', 'start', 'timeout'];
1975
+ const querystring = {};
1976
+ // @ts-expect-error
1977
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1978
+ let body;
1979
+ if (typeof userBody === 'string') {
1980
+ body = userBody;
1981
+ }
1982
+ else {
1983
+ body = userBody != null ? { ...userBody } : undefined;
1984
+ }
1985
+ for (const key in params) {
1986
+ if (acceptedBody.includes(key)) {
1987
+ body = body !== null && body !== void 0 ? body : {};
1988
+ // @ts-expect-error
1989
+ body[key] = params[key];
1990
+ }
1991
+ else if (acceptedPath.includes(key)) {
1992
+ continue;
1993
+ }
1994
+ else if (key !== 'body') {
1995
+ // @ts-expect-error
1996
+ querystring[key] = params[key];
1997
+ }
1998
+ }
1999
+ const method = 'POST';
2000
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_start`;
2001
+ const meta = {
2002
+ name: 'ml.start_datafeed',
2003
+ pathParts: {
2004
+ datafeed_id: params.datafeed_id
2005
+ }
2006
+ };
2007
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2008
+ }
2009
+ async startTrainedModelDeployment(params, options) {
2010
+ const acceptedPath = ['model_id'];
2011
+ const acceptedBody = ['adaptive_allocations'];
2012
+ const querystring = {};
2013
+ // @ts-expect-error
2014
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2015
+ let body;
2016
+ if (typeof userBody === 'string') {
2017
+ body = userBody;
2018
+ }
2019
+ else {
2020
+ body = userBody != null ? { ...userBody } : undefined;
2021
+ }
2022
+ for (const key in params) {
2023
+ if (acceptedBody.includes(key)) {
2024
+ body = body !== null && body !== void 0 ? body : {};
2025
+ // @ts-expect-error
2026
+ body[key] = params[key];
2027
+ }
2028
+ else if (acceptedPath.includes(key)) {
2029
+ continue;
2030
+ }
2031
+ else if (key !== 'body') {
2032
+ // @ts-expect-error
2033
+ querystring[key] = params[key];
2034
+ }
2035
+ }
2036
+ const method = 'POST';
2037
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_start`;
2038
+ const meta = {
2039
+ name: 'ml.start_trained_model_deployment',
2040
+ pathParts: {
2041
+ model_id: params.model_id
2042
+ }
2043
+ };
2044
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2045
+ }
2046
+ async stopDataFrameAnalytics(params, options) {
2047
+ const acceptedPath = [];
2048
+ const acceptedBody = ['id', 'allow_no_match', 'force', 'timeout'];
2049
+ const querystring = {};
2050
+ // @ts-expect-error
2051
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2052
+ let body;
2053
+ if (typeof userBody === 'string') {
2054
+ body = userBody;
2055
+ }
2056
+ else {
2057
+ body = userBody != null ? { ...userBody } : undefined;
2058
+ }
2059
+ for (const key in params) {
2060
+ if (acceptedBody.includes(key)) {
2061
+ body = body !== null && body !== void 0 ? body : {};
2062
+ // @ts-expect-error
2063
+ body[key] = params[key];
2064
+ }
2065
+ else if (acceptedPath.includes(key)) {
2066
+ continue;
2067
+ }
2068
+ else if (key !== 'body') {
2069
+ // @ts-expect-error
2070
+ querystring[key] = params[key];
2071
+ }
2072
+ }
2073
+ const method = 'POST';
2074
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_stop`;
2075
+ const meta = {
2076
+ name: 'ml.stop_data_frame_analytics',
2077
+ pathParts: {
2078
+ id: params.id
2079
+ }
2080
+ };
2081
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2082
+ }
2083
+ async stopDatafeed(params, options) {
2084
+ const acceptedPath = ['datafeed_id'];
2085
+ const acceptedBody = ['allow_no_match', 'force', 'timeout'];
2086
+ const querystring = {};
2087
+ // @ts-expect-error
2088
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2089
+ let body;
2090
+ if (typeof userBody === 'string') {
2091
+ body = userBody;
2092
+ }
2093
+ else {
2094
+ body = userBody != null ? { ...userBody } : undefined;
2095
+ }
2096
+ for (const key in params) {
2097
+ if (acceptedBody.includes(key)) {
2098
+ body = body !== null && body !== void 0 ? body : {};
2099
+ // @ts-expect-error
2100
+ body[key] = params[key];
2101
+ }
2102
+ else if (acceptedPath.includes(key)) {
2103
+ continue;
2104
+ }
2105
+ else if (key !== 'body') {
2106
+ // @ts-expect-error
2107
+ querystring[key] = params[key];
2108
+ }
2109
+ }
2110
+ const method = 'POST';
2111
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_stop`;
2112
+ const meta = {
2113
+ name: 'ml.stop_datafeed',
2114
+ pathParts: {
2115
+ datafeed_id: params.datafeed_id
2116
+ }
2117
+ };
2118
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2119
+ }
2120
+ async stopTrainedModelDeployment(params, options) {
2121
+ const acceptedPath = ['model_id'];
2122
+ const acceptedBody = ['id', 'allow_no_match', 'force'];
2123
+ const querystring = {};
2124
+ // @ts-expect-error
2125
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2126
+ let body;
2127
+ if (typeof userBody === 'string') {
2128
+ body = userBody;
2129
+ }
2130
+ else {
2131
+ body = userBody != null ? { ...userBody } : undefined;
2132
+ }
2133
+ for (const key in params) {
2134
+ if (acceptedBody.includes(key)) {
2135
+ body = body !== null && body !== void 0 ? body : {};
2136
+ // @ts-expect-error
2137
+ body[key] = params[key];
2138
+ }
2139
+ else if (acceptedPath.includes(key)) {
2140
+ continue;
2141
+ }
2142
+ else if (key !== 'body') {
2143
+ // @ts-expect-error
2144
+ querystring[key] = params[key];
2145
+ }
2146
+ }
2147
+ const method = 'POST';
2148
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_stop`;
2149
+ const meta = {
2150
+ name: 'ml.stop_trained_model_deployment',
2151
+ pathParts: {
2152
+ model_id: params.model_id
2153
+ }
2154
+ };
2155
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2156
+ }
2157
+ async updateDataFrameAnalytics(params, options) {
2158
+ const acceptedPath = ['id'];
2159
+ const acceptedBody = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'];
2160
+ const querystring = {};
2161
+ // @ts-expect-error
2162
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2163
+ let body;
2164
+ if (typeof userBody === 'string') {
2165
+ body = userBody;
2166
+ }
2167
+ else {
2168
+ body = userBody != null ? { ...userBody } : undefined;
2169
+ }
2170
+ for (const key in params) {
2171
+ if (acceptedBody.includes(key)) {
2172
+ body = body !== null && body !== void 0 ? body : {};
2173
+ // @ts-expect-error
2174
+ body[key] = params[key];
2175
+ }
2176
+ else if (acceptedPath.includes(key)) {
2177
+ continue;
2178
+ }
2179
+ else if (key !== 'body') {
2180
+ // @ts-expect-error
2181
+ querystring[key] = params[key];
2182
+ }
2183
+ }
2184
+ const method = 'POST';
2185
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_update`;
2186
+ const meta = {
2187
+ name: 'ml.update_data_frame_analytics',
2188
+ pathParts: {
2189
+ id: params.id
2190
+ }
2191
+ };
2192
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2193
+ }
2194
+ async updateDatafeed(params, options) {
2195
+ const acceptedPath = ['datafeed_id'];
2196
+ const acceptedBody = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indexes', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size'];
2197
+ const querystring = {};
2198
+ // @ts-expect-error
2199
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2200
+ let body;
2201
+ if (typeof userBody === 'string') {
2202
+ body = userBody;
2203
+ }
2204
+ else {
2205
+ body = userBody != null ? { ...userBody } : undefined;
2206
+ }
2207
+ for (const key in params) {
2208
+ if (acceptedBody.includes(key)) {
2209
+ body = body !== null && body !== void 0 ? body : {};
2210
+ // @ts-expect-error
2211
+ body[key] = params[key];
2212
+ }
2213
+ else if (acceptedPath.includes(key)) {
2214
+ continue;
2215
+ }
2216
+ else if (key !== 'body') {
2217
+ // @ts-expect-error
2218
+ querystring[key] = params[key];
2219
+ }
2220
+ }
2221
+ const method = 'POST';
2222
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_update`;
2223
+ const meta = {
2224
+ name: 'ml.update_datafeed',
2225
+ pathParts: {
2226
+ datafeed_id: params.datafeed_id
2227
+ }
2228
+ };
2229
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2230
+ }
2231
+ async updateFilter(params, options) {
2232
+ const acceptedPath = ['filter_id'];
2233
+ const acceptedBody = ['add_items', 'description', 'remove_items'];
2234
+ const querystring = {};
2235
+ // @ts-expect-error
2236
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2237
+ let body;
2238
+ if (typeof userBody === 'string') {
2239
+ body = userBody;
2240
+ }
2241
+ else {
2242
+ body = userBody != null ? { ...userBody } : undefined;
2243
+ }
2244
+ for (const key in params) {
2245
+ if (acceptedBody.includes(key)) {
2246
+ body = body !== null && body !== void 0 ? body : {};
2247
+ // @ts-expect-error
2248
+ body[key] = params[key];
2249
+ }
2250
+ else if (acceptedPath.includes(key)) {
2251
+ continue;
2252
+ }
2253
+ else if (key !== 'body') {
2254
+ // @ts-expect-error
2255
+ querystring[key] = params[key];
2256
+ }
2257
+ }
2258
+ const method = 'POST';
2259
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}/_update`;
2260
+ const meta = {
2261
+ name: 'ml.update_filter',
2262
+ pathParts: {
2263
+ filter_id: params.filter_id
2264
+ }
2265
+ };
2266
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2267
+ }
2268
+ async updateJob(params, options) {
2269
+ const acceptedPath = ['job_id'];
2270
+ const acceptedBody = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'model_prune_window', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization'];
2271
+ const querystring = {};
2272
+ // @ts-expect-error
2273
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2274
+ let body;
2275
+ if (typeof userBody === 'string') {
2276
+ body = userBody;
2277
+ }
2278
+ else {
2279
+ body = userBody != null ? { ...userBody } : undefined;
2280
+ }
2281
+ for (const key in params) {
2282
+ if (acceptedBody.includes(key)) {
2283
+ body = body !== null && body !== void 0 ? body : {};
2284
+ // @ts-expect-error
2285
+ body[key] = params[key];
2286
+ }
2287
+ else if (acceptedPath.includes(key)) {
2288
+ continue;
2289
+ }
2290
+ else if (key !== 'body') {
2291
+ // @ts-expect-error
2292
+ querystring[key] = params[key];
2293
+ }
2294
+ }
2295
+ const method = 'POST';
2296
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_update`;
2297
+ const meta = {
2298
+ name: 'ml.update_job',
2299
+ pathParts: {
2300
+ job_id: params.job_id
2301
+ }
2302
+ };
2303
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2304
+ }
2305
+ async updateModelSnapshot(params, options) {
2306
+ const acceptedPath = ['job_id', 'snapshot_id'];
2307
+ const acceptedBody = ['description', 'retain'];
2308
+ const querystring = {};
2309
+ // @ts-expect-error
2310
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2311
+ let body;
2312
+ if (typeof userBody === 'string') {
2313
+ body = userBody;
2314
+ }
2315
+ else {
2316
+ body = userBody != null ? { ...userBody } : undefined;
2317
+ }
2318
+ for (const key in params) {
2319
+ if (acceptedBody.includes(key)) {
2320
+ body = body !== null && body !== void 0 ? body : {};
2321
+ // @ts-expect-error
2322
+ body[key] = params[key];
2323
+ }
2324
+ else if (acceptedPath.includes(key)) {
2325
+ continue;
2326
+ }
2327
+ else if (key !== 'body') {
2328
+ // @ts-expect-error
2329
+ querystring[key] = params[key];
2330
+ }
2331
+ }
2332
+ const method = 'POST';
2333
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_update`;
2334
+ const meta = {
2335
+ name: 'ml.update_model_snapshot',
2336
+ pathParts: {
2337
+ job_id: params.job_id,
2338
+ snapshot_id: params.snapshot_id
2339
+ }
2340
+ };
2341
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2342
+ }
2343
+ async updateTrainedModelDeployment(params, options) {
2344
+ const acceptedPath = ['model_id'];
2345
+ const acceptedBody = ['number_of_allocations', 'adaptive_allocations'];
2346
+ const querystring = {};
2347
+ // @ts-expect-error
2348
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2349
+ let body;
2350
+ if (typeof userBody === 'string') {
2351
+ body = userBody;
2352
+ }
2353
+ else {
2354
+ body = userBody != null ? { ...userBody } : undefined;
2355
+ }
2356
+ for (const key in params) {
2357
+ if (acceptedBody.includes(key)) {
2358
+ body = body !== null && body !== void 0 ? body : {};
2359
+ // @ts-expect-error
2360
+ body[key] = params[key];
2361
+ }
2362
+ else if (acceptedPath.includes(key)) {
2363
+ continue;
2364
+ }
2365
+ else if (key !== 'body') {
2366
+ // @ts-expect-error
2367
+ querystring[key] = params[key];
2368
+ }
2369
+ }
2370
+ const method = 'POST';
2371
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_update`;
2372
+ const meta = {
2373
+ name: 'ml.update_trained_model_deployment',
2374
+ pathParts: {
2375
+ model_id: params.model_id
2376
+ }
2377
+ };
2378
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2379
+ }
2380
+ async upgradeJobSnapshot(params, options) {
2381
+ const acceptedPath = ['job_id', 'snapshot_id'];
2382
+ const querystring = {};
2383
+ const body = undefined;
2384
+ for (const key in params) {
2385
+ if (acceptedPath.includes(key)) {
2386
+ continue;
2387
+ }
2388
+ else if (key !== 'body') {
2389
+ // @ts-expect-error
2390
+ querystring[key] = params[key];
2391
+ }
2392
+ }
2393
+ const method = 'POST';
2394
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_upgrade`;
2395
+ const meta = {
2396
+ name: 'ml.upgrade_job_snapshot',
2397
+ pathParts: {
2398
+ job_id: params.job_id,
2399
+ snapshot_id: params.snapshot_id
2400
+ }
2401
+ };
2402
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2403
+ }
2404
+ async validate(params, options) {
2405
+ const acceptedPath = [];
2406
+ const acceptedBody = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_id', 'model_snapshot_retention_days', 'results_index_name'];
2407
+ const querystring = {};
2408
+ // @ts-expect-error
2409
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
2410
+ let body;
2411
+ if (typeof userBody === 'string') {
2412
+ body = userBody;
2413
+ }
2414
+ else {
2415
+ body = userBody != null ? { ...userBody } : undefined;
2416
+ }
2417
+ params = params !== null && params !== void 0 ? params : {};
2418
+ for (const key in params) {
2419
+ if (acceptedBody.includes(key)) {
2420
+ body = body !== null && body !== void 0 ? body : {};
2421
+ // @ts-expect-error
2422
+ body[key] = params[key];
2423
+ }
2424
+ else if (acceptedPath.includes(key)) {
2425
+ continue;
2426
+ }
2427
+ else if (key !== 'body') {
2428
+ // @ts-expect-error
2429
+ querystring[key] = params[key];
2430
+ }
2431
+ }
2432
+ const method = 'POST';
2433
+ const path = '/_ml/anomaly_detectors/_validate';
2434
+ const meta = {
2435
+ name: 'ml.validate'
2436
+ };
2437
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2438
+ }
2439
+ async validateDetector(params, options) {
2440
+ var _a;
2441
+ const acceptedPath = [];
2442
+ const acceptedBody = ['detector'];
2443
+ const querystring = {};
2444
+ // @ts-expect-error
2445
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
2446
+ for (const key in params) {
2447
+ if (acceptedBody.includes(key)) {
2448
+ // @ts-expect-error
2449
+ body = params[key];
2450
+ }
2451
+ else if (acceptedPath.includes(key)) {
2452
+ continue;
2453
+ }
2454
+ else if (key !== 'body') {
2455
+ // @ts-expect-error
2456
+ querystring[key] = params[key];
2457
+ }
2458
+ }
2459
+ const method = 'POST';
2460
+ const path = '/_ml/anomaly_detectors/_validate/detector';
2461
+ const meta = {
2462
+ name: 'ml.validate_detector'
2463
+ };
2464
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
2465
+ }
2466
+ }
2467
+ exports.default = Ml;
2468
+ //# sourceMappingURL=ml.js.map