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,1982 @@
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 Security {
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 activateUserProfile(params, options) {
32
+ const acceptedPath = [];
33
+ const acceptedBody = ['access_token', 'grant_type', 'password', 'username'];
34
+ const querystring = {};
35
+ // @ts-expect-error
36
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
37
+ let body;
38
+ if (typeof userBody === 'string') {
39
+ body = userBody;
40
+ }
41
+ else {
42
+ body = userBody != null ? { ...userBody } : undefined;
43
+ }
44
+ for (const key in params) {
45
+ if (acceptedBody.includes(key)) {
46
+ body = body !== null && body !== void 0 ? body : {};
47
+ // @ts-expect-error
48
+ body[key] = params[key];
49
+ }
50
+ else if (acceptedPath.includes(key)) {
51
+ continue;
52
+ }
53
+ else if (key !== 'body') {
54
+ // @ts-expect-error
55
+ querystring[key] = params[key];
56
+ }
57
+ }
58
+ const method = 'POST';
59
+ const path = '/_security/profile/_activate';
60
+ const meta = {
61
+ name: 'security.activate_user_profile'
62
+ };
63
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
64
+ }
65
+ async authenticate(params, options) {
66
+ const acceptedPath = [];
67
+ const querystring = {};
68
+ const body = undefined;
69
+ params = params !== null && params !== void 0 ? params : {};
70
+ for (const key in params) {
71
+ if (acceptedPath.includes(key)) {
72
+ continue;
73
+ }
74
+ else if (key !== 'body') {
75
+ // @ts-expect-error
76
+ querystring[key] = params[key];
77
+ }
78
+ }
79
+ const method = 'GET';
80
+ const path = '/_security/_authenticate';
81
+ const meta = {
82
+ name: 'security.authenticate'
83
+ };
84
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
85
+ }
86
+ async bulkDeleteRole(params, options) {
87
+ const acceptedPath = [];
88
+ const acceptedBody = ['names'];
89
+ const querystring = {};
90
+ // @ts-expect-error
91
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
92
+ let body;
93
+ if (typeof userBody === 'string') {
94
+ body = userBody;
95
+ }
96
+ else {
97
+ body = userBody != null ? { ...userBody } : undefined;
98
+ }
99
+ for (const key in params) {
100
+ if (acceptedBody.includes(key)) {
101
+ body = body !== null && body !== void 0 ? body : {};
102
+ // @ts-expect-error
103
+ body[key] = params[key];
104
+ }
105
+ else if (acceptedPath.includes(key)) {
106
+ continue;
107
+ }
108
+ else if (key !== 'body') {
109
+ // @ts-expect-error
110
+ querystring[key] = params[key];
111
+ }
112
+ }
113
+ const method = 'DELETE';
114
+ const path = '/_security/role';
115
+ const meta = {
116
+ name: 'security.bulk_delete_role'
117
+ };
118
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
119
+ }
120
+ async bulkPutRole(params, options) {
121
+ const acceptedPath = [];
122
+ const acceptedBody = ['roles'];
123
+ const querystring = {};
124
+ // @ts-expect-error
125
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
126
+ let body;
127
+ if (typeof userBody === 'string') {
128
+ body = userBody;
129
+ }
130
+ else {
131
+ body = userBody != null ? { ...userBody } : undefined;
132
+ }
133
+ for (const key in params) {
134
+ if (acceptedBody.includes(key)) {
135
+ body = body !== null && body !== void 0 ? body : {};
136
+ // @ts-expect-error
137
+ body[key] = params[key];
138
+ }
139
+ else if (acceptedPath.includes(key)) {
140
+ continue;
141
+ }
142
+ else if (key !== 'body') {
143
+ // @ts-expect-error
144
+ querystring[key] = params[key];
145
+ }
146
+ }
147
+ const method = 'POST';
148
+ const path = '/_security/role';
149
+ const meta = {
150
+ name: 'security.bulk_put_role'
151
+ };
152
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
153
+ }
154
+ async bulkUpdateApiKeys(params, options) {
155
+ const acceptedPath = [];
156
+ const acceptedBody = ['expiration', 'ids', 'metadata', 'role_descriptors'];
157
+ const querystring = {};
158
+ // @ts-expect-error
159
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
160
+ let body;
161
+ if (typeof userBody === 'string') {
162
+ body = userBody;
163
+ }
164
+ else {
165
+ body = userBody != null ? { ...userBody } : undefined;
166
+ }
167
+ for (const key in params) {
168
+ if (acceptedBody.includes(key)) {
169
+ body = body !== null && body !== void 0 ? body : {};
170
+ // @ts-expect-error
171
+ body[key] = params[key];
172
+ }
173
+ else if (acceptedPath.includes(key)) {
174
+ continue;
175
+ }
176
+ else if (key !== 'body') {
177
+ // @ts-expect-error
178
+ querystring[key] = params[key];
179
+ }
180
+ }
181
+ const method = 'POST';
182
+ const path = '/_security/api_key/_bulk_update';
183
+ const meta = {
184
+ name: 'security.bulk_update_api_keys'
185
+ };
186
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
187
+ }
188
+ async changePassword(params, options) {
189
+ const acceptedPath = ['username'];
190
+ const acceptedBody = ['password', 'password_hash'];
191
+ const querystring = {};
192
+ // @ts-expect-error
193
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
194
+ let body;
195
+ if (typeof userBody === 'string') {
196
+ body = userBody;
197
+ }
198
+ else {
199
+ body = userBody != null ? { ...userBody } : undefined;
200
+ }
201
+ params = params !== null && params !== void 0 ? params : {};
202
+ for (const key in params) {
203
+ if (acceptedBody.includes(key)) {
204
+ body = body !== null && body !== void 0 ? body : {};
205
+ // @ts-expect-error
206
+ body[key] = params[key];
207
+ }
208
+ else if (acceptedPath.includes(key)) {
209
+ continue;
210
+ }
211
+ else if (key !== 'body') {
212
+ // @ts-expect-error
213
+ querystring[key] = params[key];
214
+ }
215
+ }
216
+ let method = '';
217
+ let path = '';
218
+ if (params.username != null) {
219
+ method = 'PUT';
220
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}/_password`;
221
+ }
222
+ else {
223
+ method = 'PUT';
224
+ path = '/_security/user/_password';
225
+ }
226
+ const meta = {
227
+ name: 'security.change_password',
228
+ pathParts: {
229
+ username: params.username
230
+ }
231
+ };
232
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
233
+ }
234
+ async clearApiKeyCache(params, options) {
235
+ const acceptedPath = ['ids'];
236
+ const querystring = {};
237
+ const body = undefined;
238
+ for (const key in params) {
239
+ if (acceptedPath.includes(key)) {
240
+ continue;
241
+ }
242
+ else if (key !== 'body') {
243
+ // @ts-expect-error
244
+ querystring[key] = params[key];
245
+ }
246
+ }
247
+ const method = 'POST';
248
+ const path = `/_security/api_key/${encodeURIComponent(params.ids.toString())}/_clear_cache`;
249
+ const meta = {
250
+ name: 'security.clear_api_key_cache',
251
+ pathParts: {
252
+ ids: params.ids
253
+ }
254
+ };
255
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
256
+ }
257
+ async clearCachedPrivileges(params, options) {
258
+ const acceptedPath = ['application'];
259
+ const querystring = {};
260
+ const body = undefined;
261
+ for (const key in params) {
262
+ if (acceptedPath.includes(key)) {
263
+ continue;
264
+ }
265
+ else if (key !== 'body') {
266
+ // @ts-expect-error
267
+ querystring[key] = params[key];
268
+ }
269
+ }
270
+ const method = 'POST';
271
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/_clear_cache`;
272
+ const meta = {
273
+ name: 'security.clear_cached_privileges',
274
+ pathParts: {
275
+ application: params.application
276
+ }
277
+ };
278
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
279
+ }
280
+ async clearCachedRealms(params, options) {
281
+ const acceptedPath = ['realms'];
282
+ const querystring = {};
283
+ const body = undefined;
284
+ for (const key in params) {
285
+ if (acceptedPath.includes(key)) {
286
+ continue;
287
+ }
288
+ else if (key !== 'body') {
289
+ // @ts-expect-error
290
+ querystring[key] = params[key];
291
+ }
292
+ }
293
+ const method = 'POST';
294
+ const path = `/_security/realm/${encodeURIComponent(params.realms.toString())}/_clear_cache`;
295
+ const meta = {
296
+ name: 'security.clear_cached_realms',
297
+ pathParts: {
298
+ realms: params.realms
299
+ }
300
+ };
301
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
302
+ }
303
+ async clearCachedRoles(params, options) {
304
+ const acceptedPath = ['name'];
305
+ const querystring = {};
306
+ const body = undefined;
307
+ for (const key in params) {
308
+ if (acceptedPath.includes(key)) {
309
+ continue;
310
+ }
311
+ else if (key !== 'body') {
312
+ // @ts-expect-error
313
+ querystring[key] = params[key];
314
+ }
315
+ }
316
+ const method = 'POST';
317
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}/_clear_cache`;
318
+ const meta = {
319
+ name: 'security.clear_cached_roles',
320
+ pathParts: {
321
+ name: params.name
322
+ }
323
+ };
324
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
325
+ }
326
+ async clearCachedServiceTokens(params, options) {
327
+ const acceptedPath = ['namespace', 'service', 'name'];
328
+ const querystring = {};
329
+ const body = undefined;
330
+ for (const key in params) {
331
+ if (acceptedPath.includes(key)) {
332
+ continue;
333
+ }
334
+ else if (key !== 'body') {
335
+ // @ts-expect-error
336
+ querystring[key] = params[key];
337
+ }
338
+ }
339
+ const method = 'POST';
340
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}/_clear_cache`;
341
+ const meta = {
342
+ name: 'security.clear_cached_service_tokens',
343
+ pathParts: {
344
+ namespace: params.namespace,
345
+ service: params.service,
346
+ name: params.name
347
+ }
348
+ };
349
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
350
+ }
351
+ async createApiKey(params, options) {
352
+ const acceptedPath = [];
353
+ const acceptedBody = ['expiration', 'name', 'role_descriptors', 'metadata'];
354
+ const querystring = {};
355
+ // @ts-expect-error
356
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
357
+ let body;
358
+ if (typeof userBody === 'string') {
359
+ body = userBody;
360
+ }
361
+ else {
362
+ body = userBody != null ? { ...userBody } : undefined;
363
+ }
364
+ params = params !== null && params !== void 0 ? params : {};
365
+ for (const key in params) {
366
+ if (acceptedBody.includes(key)) {
367
+ body = body !== null && body !== void 0 ? body : {};
368
+ // @ts-expect-error
369
+ body[key] = params[key];
370
+ }
371
+ else if (acceptedPath.includes(key)) {
372
+ continue;
373
+ }
374
+ else if (key !== 'body') {
375
+ // @ts-expect-error
376
+ querystring[key] = params[key];
377
+ }
378
+ }
379
+ const method = 'PUT';
380
+ const path = '/_security/api_key';
381
+ const meta = {
382
+ name: 'security.create_api_key'
383
+ };
384
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
385
+ }
386
+ async createCrossClusterApiKey(params, options) {
387
+ const acceptedPath = [];
388
+ const acceptedBody = ['access', 'expiration', 'metadata', 'name'];
389
+ const querystring = {};
390
+ // @ts-expect-error
391
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
392
+ let body;
393
+ if (typeof userBody === 'string') {
394
+ body = userBody;
395
+ }
396
+ else {
397
+ body = userBody != null ? { ...userBody } : undefined;
398
+ }
399
+ for (const key in params) {
400
+ if (acceptedBody.includes(key)) {
401
+ body = body !== null && body !== void 0 ? body : {};
402
+ // @ts-expect-error
403
+ body[key] = params[key];
404
+ }
405
+ else if (acceptedPath.includes(key)) {
406
+ continue;
407
+ }
408
+ else if (key !== 'body') {
409
+ // @ts-expect-error
410
+ querystring[key] = params[key];
411
+ }
412
+ }
413
+ const method = 'POST';
414
+ const path = '/_security/cross_cluster/api_key';
415
+ const meta = {
416
+ name: 'security.create_cross_cluster_api_key'
417
+ };
418
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
419
+ }
420
+ async createServiceToken(params, options) {
421
+ const acceptedPath = ['namespace', 'service', 'name'];
422
+ const querystring = {};
423
+ const body = undefined;
424
+ for (const key in params) {
425
+ if (acceptedPath.includes(key)) {
426
+ continue;
427
+ }
428
+ else if (key !== 'body') {
429
+ // @ts-expect-error
430
+ querystring[key] = params[key];
431
+ }
432
+ }
433
+ let method = '';
434
+ let path = '';
435
+ if (params.namespace != null && params.service != null && params.name != null) {
436
+ method = 'PUT';
437
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
438
+ }
439
+ else {
440
+ method = 'POST';
441
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token`;
442
+ }
443
+ const meta = {
444
+ name: 'security.create_service_token',
445
+ pathParts: {
446
+ namespace: params.namespace,
447
+ service: params.service,
448
+ name: params.name
449
+ }
450
+ };
451
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
452
+ }
453
+ async delegatePki(params, options) {
454
+ const acceptedPath = [];
455
+ const acceptedBody = ['x509_certificate_chain'];
456
+ const querystring = {};
457
+ // @ts-expect-error
458
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
459
+ let body;
460
+ if (typeof userBody === 'string') {
461
+ body = userBody;
462
+ }
463
+ else {
464
+ body = userBody != null ? { ...userBody } : undefined;
465
+ }
466
+ for (const key in params) {
467
+ if (acceptedBody.includes(key)) {
468
+ body = body !== null && body !== void 0 ? body : {};
469
+ // @ts-expect-error
470
+ body[key] = params[key];
471
+ }
472
+ else if (acceptedPath.includes(key)) {
473
+ continue;
474
+ }
475
+ else if (key !== 'body') {
476
+ // @ts-expect-error
477
+ querystring[key] = params[key];
478
+ }
479
+ }
480
+ const method = 'POST';
481
+ const path = '/_security/delegate_pki';
482
+ const meta = {
483
+ name: 'security.delegate_pki'
484
+ };
485
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
486
+ }
487
+ async deletePrivileges(params, options) {
488
+ const acceptedPath = ['application', 'name'];
489
+ const querystring = {};
490
+ const body = undefined;
491
+ for (const key in params) {
492
+ if (acceptedPath.includes(key)) {
493
+ continue;
494
+ }
495
+ else if (key !== 'body') {
496
+ // @ts-expect-error
497
+ querystring[key] = params[key];
498
+ }
499
+ }
500
+ const method = 'DELETE';
501
+ const path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
502
+ const meta = {
503
+ name: 'security.delete_privileges',
504
+ pathParts: {
505
+ application: params.application,
506
+ name: params.name
507
+ }
508
+ };
509
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
510
+ }
511
+ async deleteRole(params, options) {
512
+ const acceptedPath = ['name'];
513
+ const querystring = {};
514
+ const body = undefined;
515
+ for (const key in params) {
516
+ if (acceptedPath.includes(key)) {
517
+ continue;
518
+ }
519
+ else if (key !== 'body') {
520
+ // @ts-expect-error
521
+ querystring[key] = params[key];
522
+ }
523
+ }
524
+ const method = 'DELETE';
525
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
526
+ const meta = {
527
+ name: 'security.delete_role',
528
+ pathParts: {
529
+ name: params.name
530
+ }
531
+ };
532
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
533
+ }
534
+ async deleteRoleMapping(params, options) {
535
+ const acceptedPath = ['name'];
536
+ const querystring = {};
537
+ const body = undefined;
538
+ for (const key in params) {
539
+ if (acceptedPath.includes(key)) {
540
+ continue;
541
+ }
542
+ else if (key !== 'body') {
543
+ // @ts-expect-error
544
+ querystring[key] = params[key];
545
+ }
546
+ }
547
+ const method = 'DELETE';
548
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
549
+ const meta = {
550
+ name: 'security.delete_role_mapping',
551
+ pathParts: {
552
+ name: params.name
553
+ }
554
+ };
555
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
556
+ }
557
+ async deleteServiceToken(params, options) {
558
+ const acceptedPath = ['namespace', 'service', 'name'];
559
+ const querystring = {};
560
+ const body = undefined;
561
+ for (const key in params) {
562
+ if (acceptedPath.includes(key)) {
563
+ continue;
564
+ }
565
+ else if (key !== 'body') {
566
+ // @ts-expect-error
567
+ querystring[key] = params[key];
568
+ }
569
+ }
570
+ const method = 'DELETE';
571
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential/token/${encodeURIComponent(params.name.toString())}`;
572
+ const meta = {
573
+ name: 'security.delete_service_token',
574
+ pathParts: {
575
+ namespace: params.namespace,
576
+ service: params.service,
577
+ name: params.name
578
+ }
579
+ };
580
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
581
+ }
582
+ async deleteUser(params, options) {
583
+ const acceptedPath = ['username'];
584
+ const querystring = {};
585
+ const body = undefined;
586
+ for (const key in params) {
587
+ if (acceptedPath.includes(key)) {
588
+ continue;
589
+ }
590
+ else if (key !== 'body') {
591
+ // @ts-expect-error
592
+ querystring[key] = params[key];
593
+ }
594
+ }
595
+ const method = 'DELETE';
596
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
597
+ const meta = {
598
+ name: 'security.delete_user',
599
+ pathParts: {
600
+ username: params.username
601
+ }
602
+ };
603
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
604
+ }
605
+ async disableUser(params, options) {
606
+ const acceptedPath = ['username'];
607
+ const querystring = {};
608
+ const body = undefined;
609
+ for (const key in params) {
610
+ if (acceptedPath.includes(key)) {
611
+ continue;
612
+ }
613
+ else if (key !== 'body') {
614
+ // @ts-expect-error
615
+ querystring[key] = params[key];
616
+ }
617
+ }
618
+ const method = 'PUT';
619
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_disable`;
620
+ const meta = {
621
+ name: 'security.disable_user',
622
+ pathParts: {
623
+ username: params.username
624
+ }
625
+ };
626
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
627
+ }
628
+ async disableUserProfile(params, options) {
629
+ const acceptedPath = ['uid'];
630
+ const querystring = {};
631
+ const body = undefined;
632
+ for (const key in params) {
633
+ if (acceptedPath.includes(key)) {
634
+ continue;
635
+ }
636
+ else if (key !== 'body') {
637
+ // @ts-expect-error
638
+ querystring[key] = params[key];
639
+ }
640
+ }
641
+ const method = 'PUT';
642
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_disable`;
643
+ const meta = {
644
+ name: 'security.disable_user_profile',
645
+ pathParts: {
646
+ uid: params.uid
647
+ }
648
+ };
649
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
650
+ }
651
+ async enableUser(params, options) {
652
+ const acceptedPath = ['username'];
653
+ const querystring = {};
654
+ const body = undefined;
655
+ for (const key in params) {
656
+ if (acceptedPath.includes(key)) {
657
+ continue;
658
+ }
659
+ else if (key !== 'body') {
660
+ // @ts-expect-error
661
+ querystring[key] = params[key];
662
+ }
663
+ }
664
+ const method = 'PUT';
665
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}/_enable`;
666
+ const meta = {
667
+ name: 'security.enable_user',
668
+ pathParts: {
669
+ username: params.username
670
+ }
671
+ };
672
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
673
+ }
674
+ async enableUserProfile(params, options) {
675
+ const acceptedPath = ['uid'];
676
+ const querystring = {};
677
+ const body = undefined;
678
+ for (const key in params) {
679
+ if (acceptedPath.includes(key)) {
680
+ continue;
681
+ }
682
+ else if (key !== 'body') {
683
+ // @ts-expect-error
684
+ querystring[key] = params[key];
685
+ }
686
+ }
687
+ const method = 'PUT';
688
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_enable`;
689
+ const meta = {
690
+ name: 'security.enable_user_profile',
691
+ pathParts: {
692
+ uid: params.uid
693
+ }
694
+ };
695
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
696
+ }
697
+ async enrollKibana(params, options) {
698
+ const acceptedPath = [];
699
+ const querystring = {};
700
+ const body = undefined;
701
+ params = params !== null && params !== void 0 ? params : {};
702
+ for (const key in params) {
703
+ if (acceptedPath.includes(key)) {
704
+ continue;
705
+ }
706
+ else if (key !== 'body') {
707
+ // @ts-expect-error
708
+ querystring[key] = params[key];
709
+ }
710
+ }
711
+ const method = 'GET';
712
+ const path = '/_security/enroll/kibana';
713
+ const meta = {
714
+ name: 'security.enroll_kibana'
715
+ };
716
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
717
+ }
718
+ async enrollNode(params, options) {
719
+ const acceptedPath = [];
720
+ const querystring = {};
721
+ const body = undefined;
722
+ params = params !== null && params !== void 0 ? params : {};
723
+ for (const key in params) {
724
+ if (acceptedPath.includes(key)) {
725
+ continue;
726
+ }
727
+ else if (key !== 'body') {
728
+ // @ts-expect-error
729
+ querystring[key] = params[key];
730
+ }
731
+ }
732
+ const method = 'GET';
733
+ const path = '/_security/enroll/node';
734
+ const meta = {
735
+ name: 'security.enroll_node'
736
+ };
737
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
738
+ }
739
+ async getApiKey(params, options) {
740
+ const acceptedPath = [];
741
+ const querystring = {};
742
+ const body = undefined;
743
+ params = params !== null && params !== void 0 ? params : {};
744
+ for (const key in params) {
745
+ if (acceptedPath.includes(key)) {
746
+ continue;
747
+ }
748
+ else if (key !== 'body') {
749
+ // @ts-expect-error
750
+ querystring[key] = params[key];
751
+ }
752
+ }
753
+ const method = 'GET';
754
+ const path = '/_security/api_key';
755
+ const meta = {
756
+ name: 'security.get_api_key'
757
+ };
758
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
759
+ }
760
+ async getBuiltinPrivileges(params, options) {
761
+ const acceptedPath = [];
762
+ const querystring = {};
763
+ const body = undefined;
764
+ params = params !== null && params !== void 0 ? params : {};
765
+ for (const key in params) {
766
+ if (acceptedPath.includes(key)) {
767
+ continue;
768
+ }
769
+ else if (key !== 'body') {
770
+ // @ts-expect-error
771
+ querystring[key] = params[key];
772
+ }
773
+ }
774
+ const method = 'GET';
775
+ const path = '/_security/privilege/_builtin';
776
+ const meta = {
777
+ name: 'security.get_builtin_privileges'
778
+ };
779
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
780
+ }
781
+ async getPrivileges(params, options) {
782
+ const acceptedPath = ['application', 'name'];
783
+ const querystring = {};
784
+ const body = undefined;
785
+ params = params !== null && params !== void 0 ? params : {};
786
+ for (const key in params) {
787
+ if (acceptedPath.includes(key)) {
788
+ continue;
789
+ }
790
+ else if (key !== 'body') {
791
+ // @ts-expect-error
792
+ querystring[key] = params[key];
793
+ }
794
+ }
795
+ let method = '';
796
+ let path = '';
797
+ if (params.application != null && params.name != null) {
798
+ method = 'GET';
799
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}/${encodeURIComponent(params.name.toString())}`;
800
+ }
801
+ else if (params.application != null) {
802
+ method = 'GET';
803
+ path = `/_security/privilege/${encodeURIComponent(params.application.toString())}`;
804
+ }
805
+ else {
806
+ method = 'GET';
807
+ path = '/_security/privilege';
808
+ }
809
+ const meta = {
810
+ name: 'security.get_privileges',
811
+ pathParts: {
812
+ application: params.application,
813
+ name: params.name
814
+ }
815
+ };
816
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
817
+ }
818
+ async getRole(params, options) {
819
+ const acceptedPath = ['name'];
820
+ const querystring = {};
821
+ const body = undefined;
822
+ params = params !== null && params !== void 0 ? params : {};
823
+ for (const key in params) {
824
+ if (acceptedPath.includes(key)) {
825
+ continue;
826
+ }
827
+ else if (key !== 'body') {
828
+ // @ts-expect-error
829
+ querystring[key] = params[key];
830
+ }
831
+ }
832
+ let method = '';
833
+ let path = '';
834
+ if (params.name != null) {
835
+ method = 'GET';
836
+ path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
837
+ }
838
+ else {
839
+ method = 'GET';
840
+ path = '/_security/role';
841
+ }
842
+ const meta = {
843
+ name: 'security.get_role',
844
+ pathParts: {
845
+ name: params.name
846
+ }
847
+ };
848
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
849
+ }
850
+ async getRoleMapping(params, options) {
851
+ const acceptedPath = ['name'];
852
+ const querystring = {};
853
+ const body = undefined;
854
+ params = params !== null && params !== void 0 ? params : {};
855
+ for (const key in params) {
856
+ if (acceptedPath.includes(key)) {
857
+ continue;
858
+ }
859
+ else if (key !== 'body') {
860
+ // @ts-expect-error
861
+ querystring[key] = params[key];
862
+ }
863
+ }
864
+ let method = '';
865
+ let path = '';
866
+ if (params.name != null) {
867
+ method = 'GET';
868
+ path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
869
+ }
870
+ else {
871
+ method = 'GET';
872
+ path = '/_security/role_mapping';
873
+ }
874
+ const meta = {
875
+ name: 'security.get_role_mapping',
876
+ pathParts: {
877
+ name: params.name
878
+ }
879
+ };
880
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
881
+ }
882
+ async getServiceAccounts(params, options) {
883
+ const acceptedPath = ['namespace', 'service'];
884
+ const querystring = {};
885
+ const body = undefined;
886
+ params = params !== null && params !== void 0 ? params : {};
887
+ for (const key in params) {
888
+ if (acceptedPath.includes(key)) {
889
+ continue;
890
+ }
891
+ else if (key !== 'body') {
892
+ // @ts-expect-error
893
+ querystring[key] = params[key];
894
+ }
895
+ }
896
+ let method = '';
897
+ let path = '';
898
+ if (params.namespace != null && params.service != null) {
899
+ method = 'GET';
900
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}`;
901
+ }
902
+ else if (params.namespace != null) {
903
+ method = 'GET';
904
+ path = `/_security/service/${encodeURIComponent(params.namespace.toString())}`;
905
+ }
906
+ else {
907
+ method = 'GET';
908
+ path = '/_security/service';
909
+ }
910
+ const meta = {
911
+ name: 'security.get_service_accounts',
912
+ pathParts: {
913
+ namespace: params.namespace,
914
+ service: params.service
915
+ }
916
+ };
917
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
918
+ }
919
+ async getServiceCredentials(params, options) {
920
+ const acceptedPath = ['namespace', 'service'];
921
+ const querystring = {};
922
+ const body = undefined;
923
+ for (const key in params) {
924
+ if (acceptedPath.includes(key)) {
925
+ continue;
926
+ }
927
+ else if (key !== 'body') {
928
+ // @ts-expect-error
929
+ querystring[key] = params[key];
930
+ }
931
+ }
932
+ const method = 'GET';
933
+ const path = `/_security/service/${encodeURIComponent(params.namespace.toString())}/${encodeURIComponent(params.service.toString())}/credential`;
934
+ const meta = {
935
+ name: 'security.get_service_credentials',
936
+ pathParts: {
937
+ namespace: params.namespace,
938
+ service: params.service
939
+ }
940
+ };
941
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
942
+ }
943
+ async getSettings(params, options) {
944
+ const acceptedPath = [];
945
+ const querystring = {};
946
+ const body = undefined;
947
+ params = params !== null && params !== void 0 ? params : {};
948
+ for (const key in params) {
949
+ if (acceptedPath.includes(key)) {
950
+ continue;
951
+ }
952
+ else if (key !== 'body') {
953
+ // @ts-expect-error
954
+ querystring[key] = params[key];
955
+ }
956
+ }
957
+ const method = 'GET';
958
+ const path = '/_security/settings';
959
+ const meta = {
960
+ name: 'security.get_settings'
961
+ };
962
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
963
+ }
964
+ async getToken(params, options) {
965
+ const acceptedPath = [];
966
+ const acceptedBody = ['grant_type', 'scope', 'password', 'kerberos_ticket', 'refresh_token', 'username'];
967
+ const querystring = {};
968
+ // @ts-expect-error
969
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
970
+ let body;
971
+ if (typeof userBody === 'string') {
972
+ body = userBody;
973
+ }
974
+ else {
975
+ body = userBody != null ? { ...userBody } : undefined;
976
+ }
977
+ params = params !== null && params !== void 0 ? params : {};
978
+ for (const key in params) {
979
+ if (acceptedBody.includes(key)) {
980
+ body = body !== null && body !== void 0 ? body : {};
981
+ // @ts-expect-error
982
+ body[key] = params[key];
983
+ }
984
+ else if (acceptedPath.includes(key)) {
985
+ continue;
986
+ }
987
+ else if (key !== 'body') {
988
+ // @ts-expect-error
989
+ querystring[key] = params[key];
990
+ }
991
+ }
992
+ const method = 'POST';
993
+ const path = '/_security/oauth2/token';
994
+ const meta = {
995
+ name: 'security.get_token'
996
+ };
997
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
998
+ }
999
+ async getUser(params, options) {
1000
+ const acceptedPath = ['username'];
1001
+ const querystring = {};
1002
+ const body = undefined;
1003
+ params = params !== null && params !== void 0 ? params : {};
1004
+ for (const key in params) {
1005
+ if (acceptedPath.includes(key)) {
1006
+ continue;
1007
+ }
1008
+ else if (key !== 'body') {
1009
+ // @ts-expect-error
1010
+ querystring[key] = params[key];
1011
+ }
1012
+ }
1013
+ let method = '';
1014
+ let path = '';
1015
+ if (params.username != null) {
1016
+ method = 'GET';
1017
+ path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
1018
+ }
1019
+ else {
1020
+ method = 'GET';
1021
+ path = '/_security/user';
1022
+ }
1023
+ const meta = {
1024
+ name: 'security.get_user',
1025
+ pathParts: {
1026
+ username: params.username
1027
+ }
1028
+ };
1029
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1030
+ }
1031
+ async getUserPrivileges(params, options) {
1032
+ const acceptedPath = [];
1033
+ const querystring = {};
1034
+ const body = undefined;
1035
+ params = params !== null && params !== void 0 ? params : {};
1036
+ for (const key in params) {
1037
+ if (acceptedPath.includes(key)) {
1038
+ continue;
1039
+ }
1040
+ else if (key !== 'body') {
1041
+ // @ts-expect-error
1042
+ querystring[key] = params[key];
1043
+ }
1044
+ }
1045
+ const method = 'GET';
1046
+ const path = '/_security/user/_privileges';
1047
+ const meta = {
1048
+ name: 'security.get_user_privileges'
1049
+ };
1050
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1051
+ }
1052
+ async getUserProfile(params, options) {
1053
+ const acceptedPath = ['uid'];
1054
+ const querystring = {};
1055
+ const body = undefined;
1056
+ for (const key in params) {
1057
+ if (acceptedPath.includes(key)) {
1058
+ continue;
1059
+ }
1060
+ else if (key !== 'body') {
1061
+ // @ts-expect-error
1062
+ querystring[key] = params[key];
1063
+ }
1064
+ }
1065
+ const method = 'GET';
1066
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}`;
1067
+ const meta = {
1068
+ name: 'security.get_user_profile',
1069
+ pathParts: {
1070
+ uid: params.uid
1071
+ }
1072
+ };
1073
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1074
+ }
1075
+ async grantApiKey(params, options) {
1076
+ const acceptedPath = [];
1077
+ const acceptedBody = ['api_key', 'grant_type', 'access_token', 'username', 'password', 'run_as'];
1078
+ const querystring = {};
1079
+ // @ts-expect-error
1080
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1081
+ let body;
1082
+ if (typeof userBody === 'string') {
1083
+ body = userBody;
1084
+ }
1085
+ else {
1086
+ body = userBody != null ? { ...userBody } : undefined;
1087
+ }
1088
+ for (const key in params) {
1089
+ if (acceptedBody.includes(key)) {
1090
+ body = body !== null && body !== void 0 ? body : {};
1091
+ // @ts-expect-error
1092
+ body[key] = params[key];
1093
+ }
1094
+ else if (acceptedPath.includes(key)) {
1095
+ continue;
1096
+ }
1097
+ else if (key !== 'body') {
1098
+ // @ts-expect-error
1099
+ querystring[key] = params[key];
1100
+ }
1101
+ }
1102
+ const method = 'POST';
1103
+ const path = '/_security/api_key/grant';
1104
+ const meta = {
1105
+ name: 'security.grant_api_key'
1106
+ };
1107
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1108
+ }
1109
+ async hasPrivileges(params, options) {
1110
+ const acceptedPath = ['user'];
1111
+ const acceptedBody = ['application', 'cluster', 'index'];
1112
+ const querystring = {};
1113
+ // @ts-expect-error
1114
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1115
+ let body;
1116
+ if (typeof userBody === 'string') {
1117
+ body = userBody;
1118
+ }
1119
+ else {
1120
+ body = userBody != null ? { ...userBody } : undefined;
1121
+ }
1122
+ params = params !== null && params !== void 0 ? params : {};
1123
+ for (const key in params) {
1124
+ if (acceptedBody.includes(key)) {
1125
+ body = body !== null && body !== void 0 ? body : {};
1126
+ // @ts-expect-error
1127
+ body[key] = params[key];
1128
+ }
1129
+ else if (acceptedPath.includes(key)) {
1130
+ continue;
1131
+ }
1132
+ else if (key !== 'body') {
1133
+ // @ts-expect-error
1134
+ querystring[key] = params[key];
1135
+ }
1136
+ }
1137
+ let method = '';
1138
+ let path = '';
1139
+ if (params.user != null) {
1140
+ method = body != null ? 'POST' : 'GET';
1141
+ path = `/_security/user/${encodeURIComponent(params.user.toString())}/_has_privileges`;
1142
+ }
1143
+ else {
1144
+ method = body != null ? 'POST' : 'GET';
1145
+ path = '/_security/user/_has_privileges';
1146
+ }
1147
+ const meta = {
1148
+ name: 'security.has_privileges',
1149
+ pathParts: {
1150
+ user: params.user
1151
+ }
1152
+ };
1153
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1154
+ }
1155
+ async hasPrivilegesUserProfile(params, options) {
1156
+ const acceptedPath = [];
1157
+ const acceptedBody = ['uids', 'privileges'];
1158
+ const querystring = {};
1159
+ // @ts-expect-error
1160
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1161
+ let body;
1162
+ if (typeof userBody === 'string') {
1163
+ body = userBody;
1164
+ }
1165
+ else {
1166
+ body = userBody != null ? { ...userBody } : undefined;
1167
+ }
1168
+ for (const key in params) {
1169
+ if (acceptedBody.includes(key)) {
1170
+ body = body !== null && body !== void 0 ? body : {};
1171
+ // @ts-expect-error
1172
+ body[key] = params[key];
1173
+ }
1174
+ else if (acceptedPath.includes(key)) {
1175
+ continue;
1176
+ }
1177
+ else if (key !== 'body') {
1178
+ // @ts-expect-error
1179
+ querystring[key] = params[key];
1180
+ }
1181
+ }
1182
+ const method = body != null ? 'POST' : 'GET';
1183
+ const path = '/_security/profile/_has_privileges';
1184
+ const meta = {
1185
+ name: 'security.has_privileges_user_profile'
1186
+ };
1187
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1188
+ }
1189
+ async invalidateApiKey(params, options) {
1190
+ const acceptedPath = [];
1191
+ const acceptedBody = ['id', 'ids', 'name', 'owner', 'realm_name', 'username'];
1192
+ const querystring = {};
1193
+ // @ts-expect-error
1194
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1195
+ let body;
1196
+ if (typeof userBody === 'string') {
1197
+ body = userBody;
1198
+ }
1199
+ else {
1200
+ body = userBody != null ? { ...userBody } : undefined;
1201
+ }
1202
+ params = params !== null && params !== void 0 ? params : {};
1203
+ for (const key in params) {
1204
+ if (acceptedBody.includes(key)) {
1205
+ body = body !== null && body !== void 0 ? body : {};
1206
+ // @ts-expect-error
1207
+ body[key] = params[key];
1208
+ }
1209
+ else if (acceptedPath.includes(key)) {
1210
+ continue;
1211
+ }
1212
+ else if (key !== 'body') {
1213
+ // @ts-expect-error
1214
+ querystring[key] = params[key];
1215
+ }
1216
+ }
1217
+ const method = 'DELETE';
1218
+ const path = '/_security/api_key';
1219
+ const meta = {
1220
+ name: 'security.invalidate_api_key'
1221
+ };
1222
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1223
+ }
1224
+ async invalidateToken(params, options) {
1225
+ const acceptedPath = [];
1226
+ const acceptedBody = ['token', 'refresh_token', 'realm_name', 'username'];
1227
+ const querystring = {};
1228
+ // @ts-expect-error
1229
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1230
+ let body;
1231
+ if (typeof userBody === 'string') {
1232
+ body = userBody;
1233
+ }
1234
+ else {
1235
+ body = userBody != null ? { ...userBody } : undefined;
1236
+ }
1237
+ params = params !== null && params !== void 0 ? params : {};
1238
+ for (const key in params) {
1239
+ if (acceptedBody.includes(key)) {
1240
+ body = body !== null && body !== void 0 ? body : {};
1241
+ // @ts-expect-error
1242
+ body[key] = params[key];
1243
+ }
1244
+ else if (acceptedPath.includes(key)) {
1245
+ continue;
1246
+ }
1247
+ else if (key !== 'body') {
1248
+ // @ts-expect-error
1249
+ querystring[key] = params[key];
1250
+ }
1251
+ }
1252
+ const method = 'DELETE';
1253
+ const path = '/_security/oauth2/token';
1254
+ const meta = {
1255
+ name: 'security.invalidate_token'
1256
+ };
1257
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1258
+ }
1259
+ async oidcAuthenticate(params, options) {
1260
+ const acceptedPath = [];
1261
+ const acceptedBody = ['nonce', 'realm', 'redirect_uri', 'state'];
1262
+ const querystring = {};
1263
+ // @ts-expect-error
1264
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1265
+ let body;
1266
+ if (typeof userBody === 'string') {
1267
+ body = userBody;
1268
+ }
1269
+ else {
1270
+ body = userBody != null ? { ...userBody } : undefined;
1271
+ }
1272
+ for (const key in params) {
1273
+ if (acceptedBody.includes(key)) {
1274
+ body = body !== null && body !== void 0 ? body : {};
1275
+ // @ts-expect-error
1276
+ body[key] = params[key];
1277
+ }
1278
+ else if (acceptedPath.includes(key)) {
1279
+ continue;
1280
+ }
1281
+ else if (key !== 'body') {
1282
+ // @ts-expect-error
1283
+ querystring[key] = params[key];
1284
+ }
1285
+ }
1286
+ const method = 'POST';
1287
+ const path = '/_security/oidc/authenticate';
1288
+ const meta = {
1289
+ name: 'security.oidc_authenticate'
1290
+ };
1291
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1292
+ }
1293
+ async oidcLogout(params, options) {
1294
+ const acceptedPath = [];
1295
+ const acceptedBody = ['token', 'refresh_token'];
1296
+ const querystring = {};
1297
+ // @ts-expect-error
1298
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1299
+ let body;
1300
+ if (typeof userBody === 'string') {
1301
+ body = userBody;
1302
+ }
1303
+ else {
1304
+ body = userBody != null ? { ...userBody } : undefined;
1305
+ }
1306
+ for (const key in params) {
1307
+ if (acceptedBody.includes(key)) {
1308
+ body = body !== null && body !== void 0 ? body : {};
1309
+ // @ts-expect-error
1310
+ body[key] = params[key];
1311
+ }
1312
+ else if (acceptedPath.includes(key)) {
1313
+ continue;
1314
+ }
1315
+ else if (key !== 'body') {
1316
+ // @ts-expect-error
1317
+ querystring[key] = params[key];
1318
+ }
1319
+ }
1320
+ const method = 'POST';
1321
+ const path = '/_security/oidc/logout';
1322
+ const meta = {
1323
+ name: 'security.oidc_logout'
1324
+ };
1325
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1326
+ }
1327
+ async oidcPrepareAuthentication(params, options) {
1328
+ const acceptedPath = [];
1329
+ const acceptedBody = ['iss', 'login_hint', 'nonce', 'realm', 'state'];
1330
+ const querystring = {};
1331
+ // @ts-expect-error
1332
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1333
+ let body;
1334
+ if (typeof userBody === 'string') {
1335
+ body = userBody;
1336
+ }
1337
+ else {
1338
+ body = userBody != null ? { ...userBody } : undefined;
1339
+ }
1340
+ params = params !== null && params !== void 0 ? params : {};
1341
+ for (const key in params) {
1342
+ if (acceptedBody.includes(key)) {
1343
+ body = body !== null && body !== void 0 ? body : {};
1344
+ // @ts-expect-error
1345
+ body[key] = params[key];
1346
+ }
1347
+ else if (acceptedPath.includes(key)) {
1348
+ continue;
1349
+ }
1350
+ else if (key !== 'body') {
1351
+ // @ts-expect-error
1352
+ querystring[key] = params[key];
1353
+ }
1354
+ }
1355
+ const method = 'POST';
1356
+ const path = '/_security/oidc/prepare';
1357
+ const meta = {
1358
+ name: 'security.oidc_prepare_authentication'
1359
+ };
1360
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1361
+ }
1362
+ async putPrivileges(params, options) {
1363
+ var _a;
1364
+ const acceptedPath = [];
1365
+ const acceptedBody = ['privileges'];
1366
+ const querystring = {};
1367
+ // @ts-expect-error
1368
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1369
+ for (const key in params) {
1370
+ if (acceptedBody.includes(key)) {
1371
+ // @ts-expect-error
1372
+ body = params[key];
1373
+ }
1374
+ else if (acceptedPath.includes(key)) {
1375
+ continue;
1376
+ }
1377
+ else if (key !== 'body') {
1378
+ // @ts-expect-error
1379
+ querystring[key] = params[key];
1380
+ }
1381
+ }
1382
+ const method = 'PUT';
1383
+ const path = '/_security/privilege';
1384
+ const meta = {
1385
+ name: 'security.put_privileges'
1386
+ };
1387
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1388
+ }
1389
+ async putRole(params, options) {
1390
+ const acceptedPath = ['name'];
1391
+ const acceptedBody = ['applications', 'cluster', 'global', 'indices', 'remote_indices', 'remote_cluster', 'metadata', 'run_as', 'description', 'transient_metadata'];
1392
+ const querystring = {};
1393
+ // @ts-expect-error
1394
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1395
+ let body;
1396
+ if (typeof userBody === 'string') {
1397
+ body = userBody;
1398
+ }
1399
+ else {
1400
+ body = userBody != null ? { ...userBody } : undefined;
1401
+ }
1402
+ for (const key in params) {
1403
+ if (acceptedBody.includes(key)) {
1404
+ body = body !== null && body !== void 0 ? body : {};
1405
+ // @ts-expect-error
1406
+ body[key] = params[key];
1407
+ }
1408
+ else if (acceptedPath.includes(key)) {
1409
+ continue;
1410
+ }
1411
+ else if (key !== 'body') {
1412
+ // @ts-expect-error
1413
+ querystring[key] = params[key];
1414
+ }
1415
+ }
1416
+ const method = 'PUT';
1417
+ const path = `/_security/role/${encodeURIComponent(params.name.toString())}`;
1418
+ const meta = {
1419
+ name: 'security.put_role',
1420
+ pathParts: {
1421
+ name: params.name
1422
+ }
1423
+ };
1424
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1425
+ }
1426
+ async putRoleMapping(params, options) {
1427
+ const acceptedPath = ['name'];
1428
+ const acceptedBody = ['enabled', 'metadata', 'roles', 'role_templates', 'rules', 'run_as'];
1429
+ const querystring = {};
1430
+ // @ts-expect-error
1431
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1432
+ let body;
1433
+ if (typeof userBody === 'string') {
1434
+ body = userBody;
1435
+ }
1436
+ else {
1437
+ body = userBody != null ? { ...userBody } : undefined;
1438
+ }
1439
+ for (const key in params) {
1440
+ if (acceptedBody.includes(key)) {
1441
+ body = body !== null && body !== void 0 ? body : {};
1442
+ // @ts-expect-error
1443
+ body[key] = params[key];
1444
+ }
1445
+ else if (acceptedPath.includes(key)) {
1446
+ continue;
1447
+ }
1448
+ else if (key !== 'body') {
1449
+ // @ts-expect-error
1450
+ querystring[key] = params[key];
1451
+ }
1452
+ }
1453
+ const method = 'PUT';
1454
+ const path = `/_security/role_mapping/${encodeURIComponent(params.name.toString())}`;
1455
+ const meta = {
1456
+ name: 'security.put_role_mapping',
1457
+ pathParts: {
1458
+ name: params.name
1459
+ }
1460
+ };
1461
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1462
+ }
1463
+ async putUser(params, options) {
1464
+ const acceptedPath = [];
1465
+ const acceptedBody = ['username', 'email', 'full_name', 'metadata', 'password', 'password_hash', 'roles', 'enabled'];
1466
+ const querystring = {};
1467
+ // @ts-expect-error
1468
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1469
+ let body;
1470
+ if (typeof userBody === 'string') {
1471
+ body = userBody;
1472
+ }
1473
+ else {
1474
+ body = userBody != null ? { ...userBody } : undefined;
1475
+ }
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
+ const method = 'PUT';
1491
+ const path = `/_security/user/${encodeURIComponent(params.username.toString())}`;
1492
+ const meta = {
1493
+ name: 'security.put_user',
1494
+ pathParts: {
1495
+ username: params.username
1496
+ }
1497
+ };
1498
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1499
+ }
1500
+ async queryApiKeys(params, options) {
1501
+ const acceptedPath = [];
1502
+ const acceptedBody = ['aggregations', 'aggs', 'query', 'from', 'sort', 'size', 'search_after'];
1503
+ const querystring = {};
1504
+ // @ts-expect-error
1505
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1506
+ let body;
1507
+ if (typeof userBody === 'string') {
1508
+ body = userBody;
1509
+ }
1510
+ else {
1511
+ body = userBody != null ? { ...userBody } : undefined;
1512
+ }
1513
+ params = params !== null && params !== void 0 ? params : {};
1514
+ for (const key in params) {
1515
+ if (acceptedBody.includes(key)) {
1516
+ body = body !== null && body !== void 0 ? body : {};
1517
+ // @ts-expect-error
1518
+ body[key] = params[key];
1519
+ }
1520
+ else if (acceptedPath.includes(key)) {
1521
+ continue;
1522
+ }
1523
+ else if (key !== 'body') {
1524
+ // @ts-expect-error
1525
+ querystring[key] = params[key];
1526
+ }
1527
+ }
1528
+ const method = body != null ? 'POST' : 'GET';
1529
+ const path = '/_security/_query/api_key';
1530
+ const meta = {
1531
+ name: 'security.query_api_keys'
1532
+ };
1533
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1534
+ }
1535
+ async queryRole(params, options) {
1536
+ const acceptedPath = [];
1537
+ const acceptedBody = ['query', 'from', 'sort', 'size', 'search_after'];
1538
+ const querystring = {};
1539
+ // @ts-expect-error
1540
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1541
+ let body;
1542
+ if (typeof userBody === 'string') {
1543
+ body = userBody;
1544
+ }
1545
+ else {
1546
+ body = userBody != null ? { ...userBody } : undefined;
1547
+ }
1548
+ params = params !== null && params !== void 0 ? params : {};
1549
+ for (const key in params) {
1550
+ if (acceptedBody.includes(key)) {
1551
+ body = body !== null && body !== void 0 ? body : {};
1552
+ // @ts-expect-error
1553
+ body[key] = params[key];
1554
+ }
1555
+ else if (acceptedPath.includes(key)) {
1556
+ continue;
1557
+ }
1558
+ else if (key !== 'body') {
1559
+ // @ts-expect-error
1560
+ querystring[key] = params[key];
1561
+ }
1562
+ }
1563
+ const method = body != null ? 'POST' : 'GET';
1564
+ const path = '/_security/_query/role';
1565
+ const meta = {
1566
+ name: 'security.query_role'
1567
+ };
1568
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1569
+ }
1570
+ async queryUser(params, options) {
1571
+ const acceptedPath = [];
1572
+ const acceptedBody = ['query', 'from', 'sort', 'size', 'search_after'];
1573
+ const querystring = {};
1574
+ // @ts-expect-error
1575
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1576
+ let body;
1577
+ if (typeof userBody === 'string') {
1578
+ body = userBody;
1579
+ }
1580
+ else {
1581
+ body = userBody != null ? { ...userBody } : undefined;
1582
+ }
1583
+ params = params !== null && params !== void 0 ? params : {};
1584
+ for (const key in params) {
1585
+ if (acceptedBody.includes(key)) {
1586
+ body = body !== null && body !== void 0 ? body : {};
1587
+ // @ts-expect-error
1588
+ body[key] = params[key];
1589
+ }
1590
+ else if (acceptedPath.includes(key)) {
1591
+ continue;
1592
+ }
1593
+ else if (key !== 'body') {
1594
+ // @ts-expect-error
1595
+ querystring[key] = params[key];
1596
+ }
1597
+ }
1598
+ const method = body != null ? 'POST' : 'GET';
1599
+ const path = '/_security/_query/user';
1600
+ const meta = {
1601
+ name: 'security.query_user'
1602
+ };
1603
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1604
+ }
1605
+ async samlAuthenticate(params, options) {
1606
+ const acceptedPath = [];
1607
+ const acceptedBody = ['content', 'ids', 'realm'];
1608
+ const querystring = {};
1609
+ // @ts-expect-error
1610
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1611
+ let body;
1612
+ if (typeof userBody === 'string') {
1613
+ body = userBody;
1614
+ }
1615
+ else {
1616
+ body = userBody != null ? { ...userBody } : undefined;
1617
+ }
1618
+ for (const key in params) {
1619
+ if (acceptedBody.includes(key)) {
1620
+ body = body !== null && body !== void 0 ? body : {};
1621
+ // @ts-expect-error
1622
+ body[key] = params[key];
1623
+ }
1624
+ else if (acceptedPath.includes(key)) {
1625
+ continue;
1626
+ }
1627
+ else if (key !== 'body') {
1628
+ // @ts-expect-error
1629
+ querystring[key] = params[key];
1630
+ }
1631
+ }
1632
+ const method = 'POST';
1633
+ const path = '/_security/saml/authenticate';
1634
+ const meta = {
1635
+ name: 'security.saml_authenticate'
1636
+ };
1637
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1638
+ }
1639
+ async samlCompleteLogout(params, options) {
1640
+ const acceptedPath = [];
1641
+ const acceptedBody = ['realm', 'ids', 'query_string', 'content'];
1642
+ const querystring = {};
1643
+ // @ts-expect-error
1644
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1645
+ let body;
1646
+ if (typeof userBody === 'string') {
1647
+ body = userBody;
1648
+ }
1649
+ else {
1650
+ body = userBody != null ? { ...userBody } : undefined;
1651
+ }
1652
+ for (const key in params) {
1653
+ if (acceptedBody.includes(key)) {
1654
+ body = body !== null && body !== void 0 ? body : {};
1655
+ // @ts-expect-error
1656
+ body[key] = params[key];
1657
+ }
1658
+ else if (acceptedPath.includes(key)) {
1659
+ continue;
1660
+ }
1661
+ else if (key !== 'body') {
1662
+ // @ts-expect-error
1663
+ querystring[key] = params[key];
1664
+ }
1665
+ }
1666
+ const method = 'POST';
1667
+ const path = '/_security/saml/complete_logout';
1668
+ const meta = {
1669
+ name: 'security.saml_complete_logout'
1670
+ };
1671
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1672
+ }
1673
+ async samlInvalidate(params, options) {
1674
+ const acceptedPath = [];
1675
+ const acceptedBody = ['acs', 'query_string', 'realm'];
1676
+ const querystring = {};
1677
+ // @ts-expect-error
1678
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1679
+ let body;
1680
+ if (typeof userBody === 'string') {
1681
+ body = userBody;
1682
+ }
1683
+ else {
1684
+ body = userBody != null ? { ...userBody } : undefined;
1685
+ }
1686
+ for (const key in params) {
1687
+ if (acceptedBody.includes(key)) {
1688
+ body = body !== null && body !== void 0 ? body : {};
1689
+ // @ts-expect-error
1690
+ body[key] = params[key];
1691
+ }
1692
+ else if (acceptedPath.includes(key)) {
1693
+ continue;
1694
+ }
1695
+ else if (key !== 'body') {
1696
+ // @ts-expect-error
1697
+ querystring[key] = params[key];
1698
+ }
1699
+ }
1700
+ const method = 'POST';
1701
+ const path = '/_security/saml/invalidate';
1702
+ const meta = {
1703
+ name: 'security.saml_invalidate'
1704
+ };
1705
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1706
+ }
1707
+ async samlLogout(params, options) {
1708
+ const acceptedPath = [];
1709
+ const acceptedBody = ['token', 'refresh_token'];
1710
+ const querystring = {};
1711
+ // @ts-expect-error
1712
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1713
+ let body;
1714
+ if (typeof userBody === 'string') {
1715
+ body = userBody;
1716
+ }
1717
+ else {
1718
+ body = userBody != null ? { ...userBody } : undefined;
1719
+ }
1720
+ for (const key in params) {
1721
+ if (acceptedBody.includes(key)) {
1722
+ body = body !== null && body !== void 0 ? body : {};
1723
+ // @ts-expect-error
1724
+ body[key] = params[key];
1725
+ }
1726
+ else if (acceptedPath.includes(key)) {
1727
+ continue;
1728
+ }
1729
+ else if (key !== 'body') {
1730
+ // @ts-expect-error
1731
+ querystring[key] = params[key];
1732
+ }
1733
+ }
1734
+ const method = 'POST';
1735
+ const path = '/_security/saml/logout';
1736
+ const meta = {
1737
+ name: 'security.saml_logout'
1738
+ };
1739
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1740
+ }
1741
+ async samlPrepareAuthentication(params, options) {
1742
+ const acceptedPath = [];
1743
+ const acceptedBody = ['acs', 'realm', 'relay_state'];
1744
+ const querystring = {};
1745
+ // @ts-expect-error
1746
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1747
+ let body;
1748
+ if (typeof userBody === 'string') {
1749
+ body = userBody;
1750
+ }
1751
+ else {
1752
+ body = userBody != null ? { ...userBody } : undefined;
1753
+ }
1754
+ params = params !== null && params !== void 0 ? params : {};
1755
+ for (const key in params) {
1756
+ if (acceptedBody.includes(key)) {
1757
+ body = body !== null && body !== void 0 ? body : {};
1758
+ // @ts-expect-error
1759
+ body[key] = params[key];
1760
+ }
1761
+ else if (acceptedPath.includes(key)) {
1762
+ continue;
1763
+ }
1764
+ else if (key !== 'body') {
1765
+ // @ts-expect-error
1766
+ querystring[key] = params[key];
1767
+ }
1768
+ }
1769
+ const method = 'POST';
1770
+ const path = '/_security/saml/prepare';
1771
+ const meta = {
1772
+ name: 'security.saml_prepare_authentication'
1773
+ };
1774
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1775
+ }
1776
+ async samlServiceProviderMetadata(params, options) {
1777
+ const acceptedPath = ['realm_name'];
1778
+ const querystring = {};
1779
+ const body = undefined;
1780
+ for (const key in params) {
1781
+ if (acceptedPath.includes(key)) {
1782
+ continue;
1783
+ }
1784
+ else if (key !== 'body') {
1785
+ // @ts-expect-error
1786
+ querystring[key] = params[key];
1787
+ }
1788
+ }
1789
+ const method = 'GET';
1790
+ const path = `/_security/saml/metadata/${encodeURIComponent(params.realm_name.toString())}`;
1791
+ const meta = {
1792
+ name: 'security.saml_service_provider_metadata',
1793
+ pathParts: {
1794
+ realm_name: params.realm_name
1795
+ }
1796
+ };
1797
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1798
+ }
1799
+ async suggestUserProfiles(params, options) {
1800
+ const acceptedPath = [];
1801
+ const acceptedBody = ['name', 'size', 'data', 'hint'];
1802
+ const querystring = {};
1803
+ // @ts-expect-error
1804
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1805
+ let body;
1806
+ if (typeof userBody === 'string') {
1807
+ body = userBody;
1808
+ }
1809
+ else {
1810
+ body = userBody != null ? { ...userBody } : undefined;
1811
+ }
1812
+ params = params !== null && params !== void 0 ? params : {};
1813
+ for (const key in params) {
1814
+ if (acceptedBody.includes(key)) {
1815
+ body = body !== null && body !== void 0 ? body : {};
1816
+ // @ts-expect-error
1817
+ body[key] = params[key];
1818
+ }
1819
+ else if (acceptedPath.includes(key)) {
1820
+ continue;
1821
+ }
1822
+ else if (key !== 'body') {
1823
+ // @ts-expect-error
1824
+ querystring[key] = params[key];
1825
+ }
1826
+ }
1827
+ const method = body != null ? 'POST' : 'GET';
1828
+ const path = '/_security/profile/_suggest';
1829
+ const meta = {
1830
+ name: 'security.suggest_user_profiles'
1831
+ };
1832
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1833
+ }
1834
+ async updateApiKey(params, options) {
1835
+ const acceptedPath = ['id'];
1836
+ const acceptedBody = ['role_descriptors', 'metadata', 'expiration'];
1837
+ const querystring = {};
1838
+ // @ts-expect-error
1839
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1840
+ let body;
1841
+ if (typeof userBody === 'string') {
1842
+ body = userBody;
1843
+ }
1844
+ else {
1845
+ body = userBody != null ? { ...userBody } : undefined;
1846
+ }
1847
+ for (const key in params) {
1848
+ if (acceptedBody.includes(key)) {
1849
+ body = body !== null && body !== void 0 ? body : {};
1850
+ // @ts-expect-error
1851
+ body[key] = params[key];
1852
+ }
1853
+ else if (acceptedPath.includes(key)) {
1854
+ continue;
1855
+ }
1856
+ else if (key !== 'body') {
1857
+ // @ts-expect-error
1858
+ querystring[key] = params[key];
1859
+ }
1860
+ }
1861
+ const method = 'PUT';
1862
+ const path = `/_security/api_key/${encodeURIComponent(params.id.toString())}`;
1863
+ const meta = {
1864
+ name: 'security.update_api_key',
1865
+ pathParts: {
1866
+ id: params.id
1867
+ }
1868
+ };
1869
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1870
+ }
1871
+ async updateCrossClusterApiKey(params, options) {
1872
+ const acceptedPath = ['id'];
1873
+ const acceptedBody = ['access', 'expiration', 'metadata'];
1874
+ const querystring = {};
1875
+ // @ts-expect-error
1876
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1877
+ let body;
1878
+ if (typeof userBody === 'string') {
1879
+ body = userBody;
1880
+ }
1881
+ else {
1882
+ body = userBody != null ? { ...userBody } : undefined;
1883
+ }
1884
+ for (const key in params) {
1885
+ if (acceptedBody.includes(key)) {
1886
+ body = body !== null && body !== void 0 ? body : {};
1887
+ // @ts-expect-error
1888
+ body[key] = params[key];
1889
+ }
1890
+ else if (acceptedPath.includes(key)) {
1891
+ continue;
1892
+ }
1893
+ else if (key !== 'body') {
1894
+ // @ts-expect-error
1895
+ querystring[key] = params[key];
1896
+ }
1897
+ }
1898
+ const method = 'PUT';
1899
+ const path = `/_security/cross_cluster/api_key/${encodeURIComponent(params.id.toString())}`;
1900
+ const meta = {
1901
+ name: 'security.update_cross_cluster_api_key',
1902
+ pathParts: {
1903
+ id: params.id
1904
+ }
1905
+ };
1906
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1907
+ }
1908
+ async updateSettings(params, options) {
1909
+ const acceptedPath = [];
1910
+ const acceptedBody = ['security', 'security-profile', 'security-tokens'];
1911
+ const querystring = {};
1912
+ // @ts-expect-error
1913
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1914
+ let body;
1915
+ if (typeof userBody === 'string') {
1916
+ body = userBody;
1917
+ }
1918
+ else {
1919
+ body = userBody != null ? { ...userBody } : undefined;
1920
+ }
1921
+ params = params !== null && params !== void 0 ? params : {};
1922
+ for (const key in params) {
1923
+ if (acceptedBody.includes(key)) {
1924
+ body = body !== null && body !== void 0 ? body : {};
1925
+ // @ts-expect-error
1926
+ body[key] = params[key];
1927
+ }
1928
+ else if (acceptedPath.includes(key)) {
1929
+ continue;
1930
+ }
1931
+ else if (key !== 'body') {
1932
+ // @ts-expect-error
1933
+ querystring[key] = params[key];
1934
+ }
1935
+ }
1936
+ const method = 'PUT';
1937
+ const path = '/_security/settings';
1938
+ const meta = {
1939
+ name: 'security.update_settings'
1940
+ };
1941
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1942
+ }
1943
+ async updateUserProfileData(params, options) {
1944
+ const acceptedPath = ['uid'];
1945
+ const acceptedBody = ['labels', 'data'];
1946
+ const querystring = {};
1947
+ // @ts-expect-error
1948
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1949
+ let body;
1950
+ if (typeof userBody === 'string') {
1951
+ body = userBody;
1952
+ }
1953
+ else {
1954
+ body = userBody != null ? { ...userBody } : undefined;
1955
+ }
1956
+ for (const key in params) {
1957
+ if (acceptedBody.includes(key)) {
1958
+ body = body !== null && body !== void 0 ? body : {};
1959
+ // @ts-expect-error
1960
+ body[key] = params[key];
1961
+ }
1962
+ else if (acceptedPath.includes(key)) {
1963
+ continue;
1964
+ }
1965
+ else if (key !== 'body') {
1966
+ // @ts-expect-error
1967
+ querystring[key] = params[key];
1968
+ }
1969
+ }
1970
+ const method = 'PUT';
1971
+ const path = `/_security/profile/${encodeURIComponent(params.uid.toString())}/_data`;
1972
+ const meta = {
1973
+ name: 'security.update_user_profile_data',
1974
+ pathParts: {
1975
+ uid: params.uid
1976
+ }
1977
+ };
1978
+ return await this.transport.request({ path, method, querystring, body, meta }, options);
1979
+ }
1980
+ }
1981
+ exports.default = Security;
1982
+ //# sourceMappingURL=security.js.map