@elastic/elasticsearch 8.16.2 → 9.0.0-alpha.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 (273) hide show
  1. package/catalog-info.yaml +4 -1
  2. package/lib/api/api/async_search.d.ts +16 -17
  3. package/lib/api/api/async_search.js +5 -16
  4. package/lib/api/api/async_search.js.map +1 -1
  5. package/lib/api/api/autoscaling.d.ts +16 -17
  6. package/lib/api/api/autoscaling.js +5 -7
  7. package/lib/api/api/autoscaling.js.map +1 -1
  8. package/lib/api/api/bulk.d.ts +4 -5
  9. package/lib/api/api/bulk.js +3 -5
  10. package/lib/api/api/bulk.js.map +1 -1
  11. package/lib/api/api/capabilities.d.ts +3 -4
  12. package/lib/api/api/capabilities.js +2 -2
  13. package/lib/api/api/capabilities.js.map +1 -1
  14. package/lib/api/api/cat.d.ts +121 -122
  15. package/lib/api/api/cat.js +26 -26
  16. package/lib/api/api/cat.js.map +1 -1
  17. package/lib/api/api/ccr.d.ts +52 -53
  18. package/lib/api/api/ccr.js +18 -54
  19. package/lib/api/api/ccr.js.map +1 -1
  20. package/lib/api/api/clear_scroll.d.ts +4 -5
  21. package/lib/api/api/clear_scroll.js +3 -12
  22. package/lib/api/api/clear_scroll.js.map +1 -1
  23. package/lib/api/api/close_point_in_time.d.ts +4 -5
  24. package/lib/api/api/close_point_in_time.js +3 -12
  25. package/lib/api/api/close_point_in_time.js.map +1 -1
  26. package/lib/api/api/cluster.d.ts +64 -65
  27. package/lib/api/api/cluster.js +20 -56
  28. package/lib/api/api/cluster.js.map +1 -1
  29. package/lib/api/api/connector.d.ts +132 -133
  30. package/lib/api/api/connector.js +50 -194
  31. package/lib/api/api/connector.js.map +1 -1
  32. package/lib/api/api/count.d.ts +5 -6
  33. package/lib/api/api/count.js +3 -12
  34. package/lib/api/api/count.js.map +1 -1
  35. package/lib/api/api/create.d.ts +4 -5
  36. package/lib/api/api/create.js +3 -5
  37. package/lib/api/api/create.js.map +1 -1
  38. package/lib/api/api/dangling_indices.d.ts +12 -13
  39. package/lib/api/api/dangling_indices.js +3 -3
  40. package/lib/api/api/dangling_indices.js.map +1 -1
  41. package/lib/api/api/delete.d.ts +4 -5
  42. package/lib/api/api/delete.js +2 -2
  43. package/lib/api/api/delete.js.map +1 -1
  44. package/lib/api/api/delete_by_query.d.ts +4 -5
  45. package/lib/api/api/delete_by_query.js +3 -12
  46. package/lib/api/api/delete_by_query.js.map +1 -1
  47. package/lib/api/api/delete_by_query_rethrottle.d.ts +4 -5
  48. package/lib/api/api/delete_by_query_rethrottle.js +2 -2
  49. package/lib/api/api/delete_by_query_rethrottle.js.map +1 -1
  50. package/lib/api/api/delete_script.d.ts +4 -5
  51. package/lib/api/api/delete_script.js +2 -2
  52. package/lib/api/api/delete_script.js.map +1 -1
  53. package/lib/api/api/enrich.d.ts +21 -22
  54. package/lib/api/api/enrich.js +6 -15
  55. package/lib/api/api/enrich.js.map +1 -1
  56. package/lib/api/api/eql.d.ts +20 -21
  57. package/lib/api/api/eql.js +6 -15
  58. package/lib/api/api/eql.js.map +1 -1
  59. package/lib/api/api/esql.d.ts +13 -14
  60. package/lib/api/api/esql.js +4 -13
  61. package/lib/api/api/esql.js.map +1 -1
  62. package/lib/api/api/exists.d.ts +4 -5
  63. package/lib/api/api/exists.js +2 -2
  64. package/lib/api/api/exists.js.map +1 -1
  65. package/lib/api/api/exists_source.d.ts +4 -5
  66. package/lib/api/api/exists_source.js +2 -2
  67. package/lib/api/api/exists_source.js.map +1 -1
  68. package/lib/api/api/explain.d.ts +4 -5
  69. package/lib/api/api/explain.js +3 -12
  70. package/lib/api/api/explain.js.map +1 -1
  71. package/lib/api/api/features.d.ts +8 -9
  72. package/lib/api/api/features.js +2 -2
  73. package/lib/api/api/features.js.map +1 -1
  74. package/lib/api/api/field_caps.d.ts +4 -5
  75. package/lib/api/api/field_caps.js +3 -12
  76. package/lib/api/api/field_caps.js.map +1 -1
  77. package/lib/api/api/fleet.d.ts +22 -23
  78. package/lib/api/api/fleet.js +8 -19
  79. package/lib/api/api/fleet.js.map +1 -1
  80. package/lib/api/api/get.d.ts +4 -5
  81. package/lib/api/api/get.js +2 -2
  82. package/lib/api/api/get.js.map +1 -1
  83. package/lib/api/api/get_script.d.ts +4 -5
  84. package/lib/api/api/get_script.js +2 -2
  85. package/lib/api/api/get_script.js.map +1 -1
  86. package/lib/api/api/get_script_context.d.ts +4 -5
  87. package/lib/api/api/get_script_context.js +2 -2
  88. package/lib/api/api/get_script_context.js.map +1 -1
  89. package/lib/api/api/get_script_languages.d.ts +4 -5
  90. package/lib/api/api/get_script_languages.js +2 -2
  91. package/lib/api/api/get_script_languages.js.map +1 -1
  92. package/lib/api/api/get_source.d.ts +4 -5
  93. package/lib/api/api/get_source.js +2 -2
  94. package/lib/api/api/get_source.js.map +1 -1
  95. package/lib/api/api/graph.d.ts +5 -6
  96. package/lib/api/api/graph.js +2 -11
  97. package/lib/api/api/graph.js.map +1 -1
  98. package/lib/api/api/health_report.d.ts +4 -5
  99. package/lib/api/api/health_report.js +2 -2
  100. package/lib/api/api/health_report.js.map +1 -1
  101. package/lib/api/api/ilm.d.ts +44 -45
  102. package/lib/api/api/ilm.js +14 -41
  103. package/lib/api/api/ilm.js.map +1 -1
  104. package/lib/api/api/index.d.ts +4 -5
  105. package/lib/api/api/index.js +3 -5
  106. package/lib/api/api/index.js.map +1 -1
  107. package/lib/api/api/indices.d.ts +238 -239
  108. package/lib/api/api/indices.js +77 -216
  109. package/lib/api/api/indices.js.map +1 -1
  110. package/lib/api/api/inference.d.ts +20 -21
  111. package/lib/api/api/inference.js +7 -18
  112. package/lib/api/api/inference.js.map +1 -1
  113. package/lib/api/api/info.d.ts +4 -5
  114. package/lib/api/api/info.js +2 -2
  115. package/lib/api/api/info.js.map +1 -1
  116. package/lib/api/api/ingest.d.ts +57 -58
  117. package/lib/api/api/ingest.js +15 -42
  118. package/lib/api/api/ingest.js.map +1 -1
  119. package/lib/api/api/knn_search.d.ts +4 -5
  120. package/lib/api/api/knn_search.js +3 -12
  121. package/lib/api/api/knn_search.js.map +1 -1
  122. package/lib/api/api/license.d.ts +28 -29
  123. package/lib/api/api/license.js +8 -17
  124. package/lib/api/api/license.js.map +1 -1
  125. package/lib/api/api/logstash.d.ts +12 -13
  126. package/lib/api/api/logstash.js +4 -6
  127. package/lib/api/api/logstash.js.map +1 -1
  128. package/lib/api/api/mget.d.ts +4 -5
  129. package/lib/api/api/mget.js +3 -12
  130. package/lib/api/api/mget.js.map +1 -1
  131. package/lib/api/api/migration.d.ts +12 -13
  132. package/lib/api/api/migration.js +3 -3
  133. package/lib/api/api/migration.js.map +1 -1
  134. package/lib/api/api/ml.d.ts +293 -294
  135. package/lib/api/api/ml.js +112 -449
  136. package/lib/api/api/ml.js.map +1 -1
  137. package/lib/api/api/monitoring.d.ts +4 -5
  138. package/lib/api/api/monitoring.js +2 -4
  139. package/lib/api/api/monitoring.js.map +1 -1
  140. package/lib/api/api/msearch.d.ts +4 -5
  141. package/lib/api/api/msearch.js +3 -5
  142. package/lib/api/api/msearch.js.map +1 -1
  143. package/lib/api/api/msearch_template.d.ts +4 -5
  144. package/lib/api/api/msearch_template.js +3 -5
  145. package/lib/api/api/msearch_template.js.map +1 -1
  146. package/lib/api/api/mtermvectors.d.ts +4 -5
  147. package/lib/api/api/mtermvectors.js +3 -12
  148. package/lib/api/api/mtermvectors.js.map +1 -1
  149. package/lib/api/api/nodes.d.ts +28 -29
  150. package/lib/api/api/nodes.js +8 -17
  151. package/lib/api/api/nodes.js.map +1 -1
  152. package/lib/api/api/open_point_in_time.d.ts +4 -5
  153. package/lib/api/api/open_point_in_time.js +3 -12
  154. package/lib/api/api/open_point_in_time.js.map +1 -1
  155. package/lib/api/api/ping.d.ts +4 -5
  156. package/lib/api/api/ping.js +2 -2
  157. package/lib/api/api/ping.js.map +1 -1
  158. package/lib/api/api/profiling.d.ts +16 -17
  159. package/lib/api/api/profiling.js +4 -4
  160. package/lib/api/api/profiling.js.map +1 -1
  161. package/lib/api/api/put_script.d.ts +4 -5
  162. package/lib/api/api/put_script.js +3 -12
  163. package/lib/api/api/put_script.js.map +1 -1
  164. package/lib/api/api/query_rules.d.ts +40 -41
  165. package/lib/api/api/query_rules.js +11 -38
  166. package/lib/api/api/query_rules.js.map +1 -1
  167. package/lib/api/api/rank_eval.d.ts +4 -5
  168. package/lib/api/api/rank_eval.js +3 -12
  169. package/lib/api/api/rank_eval.js.map +1 -1
  170. package/lib/api/api/reindex.d.ts +4 -5
  171. package/lib/api/api/reindex.js +3 -12
  172. package/lib/api/api/reindex.js.map +1 -1
  173. package/lib/api/api/reindex_rethrottle.d.ts +4 -5
  174. package/lib/api/api/reindex_rethrottle.js +2 -2
  175. package/lib/api/api/reindex_rethrottle.js.map +1 -1
  176. package/lib/api/api/render_search_template.d.ts +4 -5
  177. package/lib/api/api/render_search_template.js +3 -12
  178. package/lib/api/api/render_search_template.js.map +1 -1
  179. package/lib/api/api/rollup.d.ts +32 -33
  180. package/lib/api/api/rollup.js +10 -28
  181. package/lib/api/api/rollup.js.map +1 -1
  182. package/lib/api/api/scripts_painless_execute.d.ts +4 -5
  183. package/lib/api/api/scripts_painless_execute.js +3 -12
  184. package/lib/api/api/scripts_painless_execute.js.map +1 -1
  185. package/lib/api/api/scroll.d.ts +4 -5
  186. package/lib/api/api/scroll.js +3 -12
  187. package/lib/api/api/scroll.js.map +1 -1
  188. package/lib/api/api/search.d.ts +4 -5
  189. package/lib/api/api/search.js +3 -14
  190. package/lib/api/api/search.js.map +1 -1
  191. package/lib/api/api/search_application.d.ts +39 -40
  192. package/lib/api/api/search_application.js +12 -23
  193. package/lib/api/api/search_application.js.map +1 -1
  194. package/lib/api/api/search_mvt.d.ts +4 -5
  195. package/lib/api/api/search_mvt.js +3 -12
  196. package/lib/api/api/search_mvt.js.map +1 -1
  197. package/lib/api/api/search_shards.d.ts +4 -5
  198. package/lib/api/api/search_shards.js +2 -2
  199. package/lib/api/api/search_shards.js.map +1 -1
  200. package/lib/api/api/search_template.d.ts +4 -5
  201. package/lib/api/api/search_template.js +3 -12
  202. package/lib/api/api/search_template.js.map +1 -1
  203. package/lib/api/api/searchable_snapshots.d.ts +16 -17
  204. package/lib/api/api/searchable_snapshots.js +5 -14
  205. package/lib/api/api/searchable_snapshots.js.map +1 -1
  206. package/lib/api/api/security.d.ts +253 -254
  207. package/lib/api/api/security.js +92 -337
  208. package/lib/api/api/security.js.map +1 -1
  209. package/lib/api/api/shutdown.d.ts +9 -10
  210. package/lib/api/api/shutdown.js +4 -13
  211. package/lib/api/api/shutdown.js.map +1 -1
  212. package/lib/api/api/simulate.d.ts +4 -5
  213. package/lib/api/api/simulate.js +1 -1
  214. package/lib/api/api/simulate.js.map +1 -1
  215. package/lib/api/api/slm.d.ts +36 -37
  216. package/lib/api/api/slm.js +10 -19
  217. package/lib/api/api/slm.js.map +1 -1
  218. package/lib/api/api/snapshot.d.ts +52 -53
  219. package/lib/api/api/snapshot.js +17 -46
  220. package/lib/api/api/snapshot.js.map +1 -1
  221. package/lib/api/api/sql.d.ts +30 -31
  222. package/lib/api/api/sql.js +9 -36
  223. package/lib/api/api/sql.js.map +1 -1
  224. package/lib/api/api/ssl.d.ts +4 -5
  225. package/lib/api/api/ssl.js +1 -1
  226. package/lib/api/api/ssl.js.map +1 -1
  227. package/lib/api/api/synonyms.d.ts +35 -36
  228. package/lib/api/api/synonyms.js +9 -27
  229. package/lib/api/api/synonyms.js.map +1 -1
  230. package/lib/api/api/tasks.d.ts +12 -13
  231. package/lib/api/api/tasks.js +3 -3
  232. package/lib/api/api/tasks.js.map +1 -1
  233. package/lib/api/api/terms_enum.d.ts +4 -5
  234. package/lib/api/api/terms_enum.js +3 -12
  235. package/lib/api/api/terms_enum.js.map +1 -1
  236. package/lib/api/api/termvectors.d.ts +4 -5
  237. package/lib/api/api/termvectors.js +3 -12
  238. package/lib/api/api/termvectors.js.map +1 -1
  239. package/lib/api/api/text_structure.d.ts +16 -17
  240. package/lib/api/api/text_structure.js +6 -17
  241. package/lib/api/api/text_structure.js.map +1 -1
  242. package/lib/api/api/transform.d.ts +48 -49
  243. package/lib/api/api/transform.js +15 -42
  244. package/lib/api/api/transform.js.map +1 -1
  245. package/lib/api/api/update.d.ts +4 -5
  246. package/lib/api/api/update.js +3 -12
  247. package/lib/api/api/update.js.map +1 -1
  248. package/lib/api/api/update_by_query.d.ts +4 -5
  249. package/lib/api/api/update_by_query.js +3 -12
  250. package/lib/api/api/update_by_query.js.map +1 -1
  251. package/lib/api/api/update_by_query_rethrottle.d.ts +4 -5
  252. package/lib/api/api/update_by_query_rethrottle.js +2 -2
  253. package/lib/api/api/update_by_query_rethrottle.js.map +1 -1
  254. package/lib/api/api/watcher.d.ts +52 -53
  255. package/lib/api/api/watcher.js +16 -43
  256. package/lib/api/api/watcher.js.map +1 -1
  257. package/lib/api/api/xpack.d.ts +8 -9
  258. package/lib/api/api/xpack.js +2 -2
  259. package/lib/api/api/xpack.js.map +1 -1
  260. package/lib/api/index.js +1 -1
  261. package/lib/api/index.js.map +1 -1
  262. package/lib/api/types.d.ts +131 -72
  263. package/lib/client.d.ts +82 -2
  264. package/lib/client.js +11 -4
  265. package/lib/client.js.map +1 -1
  266. package/lib/helpers.d.ts +0 -3
  267. package/lib/helpers.js +8 -7
  268. package/lib/helpers.js.map +1 -1
  269. package/package.json +33 -33
  270. package/renovate.json +29 -0
  271. package/lib/api/typesWithBodyKey.d.ts +0 -18163
  272. package/lib/api/typesWithBodyKey.js +0 -21
  273. package/lib/api/typesWithBodyKey.js.map +0 -1
package/lib/api/api/ml.js CHANGED
@@ -36,7 +36,7 @@ class Ml {
36
36
  if (acceptedPath.includes(key)) {
37
37
  continue;
38
38
  }
39
- else if (key !== 'body') {
39
+ else {
40
40
  // @ts-expect-error
41
41
  querystring[key] = params[key];
42
42
  }
@@ -55,25 +55,16 @@ class Ml {
55
55
  const acceptedPath = ['job_id'];
56
56
  const acceptedBody = ['allow_no_match', 'force', 'timeout'];
57
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
- }
58
+ const body = {};
67
59
  for (const key in params) {
68
60
  if (acceptedBody.includes(key)) {
69
- body = body !== null && body !== void 0 ? body : {};
70
61
  // @ts-expect-error
71
62
  body[key] = params[key];
72
63
  }
73
64
  else if (acceptedPath.includes(key)) {
74
65
  continue;
75
66
  }
76
- else if (key !== 'body') {
67
+ else {
77
68
  // @ts-expect-error
78
69
  querystring[key] = params[key];
79
70
  }
@@ -96,7 +87,7 @@ class Ml {
96
87
  if (acceptedPath.includes(key)) {
97
88
  continue;
98
89
  }
99
- else if (key !== 'body') {
90
+ else {
100
91
  // @ts-expect-error
101
92
  querystring[key] = params[key];
102
93
  }
@@ -119,7 +110,7 @@ class Ml {
119
110
  if (acceptedPath.includes(key)) {
120
111
  continue;
121
112
  }
122
- else if (key !== 'body') {
113
+ else {
123
114
  // @ts-expect-error
124
115
  querystring[key] = params[key];
125
116
  }
@@ -143,7 +134,7 @@ class Ml {
143
134
  if (acceptedPath.includes(key)) {
144
135
  continue;
145
136
  }
146
- else if (key !== 'body') {
137
+ else {
147
138
  // @ts-expect-error
148
139
  querystring[key] = params[key];
149
140
  }
@@ -167,7 +158,7 @@ class Ml {
167
158
  if (acceptedPath.includes(key)) {
168
159
  continue;
169
160
  }
170
- else if (key !== 'body') {
161
+ else {
171
162
  // @ts-expect-error
172
163
  querystring[key] = params[key];
173
164
  }
@@ -190,7 +181,7 @@ class Ml {
190
181
  if (acceptedPath.includes(key)) {
191
182
  continue;
192
183
  }
193
- else if (key !== 'body') {
184
+ else {
194
185
  // @ts-expect-error
195
186
  querystring[key] = params[key];
196
187
  }
@@ -209,26 +200,17 @@ class Ml {
209
200
  const acceptedPath = ['job_id'];
210
201
  const acceptedBody = ['requests_per_second', 'timeout'];
211
202
  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
- }
203
+ const body = {};
221
204
  params = params !== null && params !== void 0 ? params : {};
222
205
  for (const key in params) {
223
206
  if (acceptedBody.includes(key)) {
224
- body = body !== null && body !== void 0 ? body : {};
225
207
  // @ts-expect-error
226
208
  body[key] = params[key];
227
209
  }
228
210
  else if (acceptedPath.includes(key)) {
229
211
  continue;
230
212
  }
231
- else if (key !== 'body') {
213
+ else {
232
214
  // @ts-expect-error
233
215
  querystring[key] = params[key];
234
216
  }
@@ -259,7 +241,7 @@ class Ml {
259
241
  if (acceptedPath.includes(key)) {
260
242
  continue;
261
243
  }
262
- else if (key !== 'body') {
244
+ else {
263
245
  // @ts-expect-error
264
246
  querystring[key] = params[key];
265
247
  }
@@ -282,7 +264,7 @@ class Ml {
282
264
  if (acceptedPath.includes(key)) {
283
265
  continue;
284
266
  }
285
- else if (key !== 'body') {
267
+ else {
286
268
  // @ts-expect-error
287
269
  querystring[key] = params[key];
288
270
  }
@@ -314,7 +296,7 @@ class Ml {
314
296
  if (acceptedPath.includes(key)) {
315
297
  continue;
316
298
  }
317
- else if (key !== 'body') {
299
+ else {
318
300
  // @ts-expect-error
319
301
  querystring[key] = params[key];
320
302
  }
@@ -337,7 +319,7 @@ class Ml {
337
319
  if (acceptedPath.includes(key)) {
338
320
  continue;
339
321
  }
340
- else if (key !== 'body') {
322
+ else {
341
323
  // @ts-expect-error
342
324
  querystring[key] = params[key];
343
325
  }
@@ -361,7 +343,7 @@ class Ml {
361
343
  if (acceptedPath.includes(key)) {
362
344
  continue;
363
345
  }
364
- else if (key !== 'body') {
346
+ else {
365
347
  // @ts-expect-error
366
348
  querystring[key] = params[key];
367
349
  }
@@ -384,7 +366,7 @@ class Ml {
384
366
  if (acceptedPath.includes(key)) {
385
367
  continue;
386
368
  }
387
- else if (key !== 'body') {
369
+ else {
388
370
  // @ts-expect-error
389
371
  querystring[key] = params[key];
390
372
  }
@@ -404,26 +386,17 @@ class Ml {
404
386
  const acceptedPath = [];
405
387
  const acceptedBody = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'];
406
388
  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
- }
389
+ const body = {};
416
390
  params = params !== null && params !== void 0 ? params : {};
417
391
  for (const key in params) {
418
392
  if (acceptedBody.includes(key)) {
419
- body = body !== null && body !== void 0 ? body : {};
420
393
  // @ts-expect-error
421
394
  body[key] = params[key];
422
395
  }
423
396
  else if (acceptedPath.includes(key)) {
424
397
  continue;
425
398
  }
426
- else if (key !== 'body') {
399
+ else {
427
400
  // @ts-expect-error
428
401
  querystring[key] = params[key];
429
402
  }
@@ -439,25 +412,16 @@ class Ml {
439
412
  const acceptedPath = [];
440
413
  const acceptedBody = ['evaluation', 'index', 'query'];
441
414
  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
- }
415
+ const body = {};
451
416
  for (const key in params) {
452
417
  if (acceptedBody.includes(key)) {
453
- body = body !== null && body !== void 0 ? body : {};
454
418
  // @ts-expect-error
455
419
  body[key] = params[key];
456
420
  }
457
421
  else if (acceptedPath.includes(key)) {
458
422
  continue;
459
423
  }
460
- else if (key !== 'body') {
424
+ else {
461
425
  // @ts-expect-error
462
426
  querystring[key] = params[key];
463
427
  }
@@ -473,26 +437,17 @@ class Ml {
473
437
  const acceptedPath = ['id'];
474
438
  const acceptedBody = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'];
475
439
  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
- }
440
+ const body = {};
485
441
  params = params !== null && params !== void 0 ? params : {};
486
442
  for (const key in params) {
487
443
  if (acceptedBody.includes(key)) {
488
- body = body !== null && body !== void 0 ? body : {};
489
444
  // @ts-expect-error
490
445
  body[key] = params[key];
491
446
  }
492
447
  else if (acceptedPath.includes(key)) {
493
448
  continue;
494
449
  }
495
- else if (key !== 'body') {
450
+ else {
496
451
  // @ts-expect-error
497
452
  querystring[key] = params[key];
498
453
  }
@@ -519,25 +474,16 @@ class Ml {
519
474
  const acceptedPath = ['job_id'];
520
475
  const acceptedBody = ['advance_time', 'calc_interim', 'end', 'skip_time', 'start'];
521
476
  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
- }
477
+ const body = {};
531
478
  for (const key in params) {
532
479
  if (acceptedBody.includes(key)) {
533
- body = body !== null && body !== void 0 ? body : {};
534
480
  // @ts-expect-error
535
481
  body[key] = params[key];
536
482
  }
537
483
  else if (acceptedPath.includes(key)) {
538
484
  continue;
539
485
  }
540
- else if (key !== 'body') {
486
+ else {
541
487
  // @ts-expect-error
542
488
  querystring[key] = params[key];
543
489
  }
@@ -556,25 +502,16 @@ class Ml {
556
502
  const acceptedPath = ['job_id'];
557
503
  const acceptedBody = ['duration', 'expires_in', 'max_model_memory'];
558
504
  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
- }
505
+ const body = {};
568
506
  for (const key in params) {
569
507
  if (acceptedBody.includes(key)) {
570
- body = body !== null && body !== void 0 ? body : {};
571
508
  // @ts-expect-error
572
509
  body[key] = params[key];
573
510
  }
574
511
  else if (acceptedPath.includes(key)) {
575
512
  continue;
576
513
  }
577
- else if (key !== 'body') {
514
+ else {
578
515
  // @ts-expect-error
579
516
  querystring[key] = params[key];
580
517
  }
@@ -593,25 +530,16 @@ class Ml {
593
530
  const acceptedPath = ['job_id', 'timestamp'];
594
531
  const acceptedBody = ['anomaly_score', 'desc', 'end', 'exclude_interim', 'expand', 'page', 'sort', 'start'];
595
532
  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
- }
533
+ const body = {};
605
534
  for (const key in params) {
606
535
  if (acceptedBody.includes(key)) {
607
- body = body !== null && body !== void 0 ? body : {};
608
536
  // @ts-expect-error
609
537
  body[key] = params[key];
610
538
  }
611
539
  else if (acceptedPath.includes(key)) {
612
540
  continue;
613
541
  }
614
- else if (key !== 'body') {
542
+ else {
615
543
  // @ts-expect-error
616
544
  querystring[key] = params[key];
617
545
  }
@@ -643,7 +571,7 @@ class Ml {
643
571
  if (acceptedPath.includes(key)) {
644
572
  continue;
645
573
  }
646
- else if (key !== 'body') {
574
+ else {
647
575
  // @ts-expect-error
648
576
  querystring[key] = params[key];
649
577
  }
@@ -662,26 +590,17 @@ class Ml {
662
590
  const acceptedPath = ['calendar_id'];
663
591
  const acceptedBody = ['page'];
664
592
  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
- }
593
+ const body = {};
674
594
  params = params !== null && params !== void 0 ? params : {};
675
595
  for (const key in params) {
676
596
  if (acceptedBody.includes(key)) {
677
- body = body !== null && body !== void 0 ? body : {};
678
597
  // @ts-expect-error
679
598
  body[key] = params[key];
680
599
  }
681
600
  else if (acceptedPath.includes(key)) {
682
601
  continue;
683
602
  }
684
- else if (key !== 'body') {
603
+ else {
685
604
  // @ts-expect-error
686
605
  querystring[key] = params[key];
687
606
  }
@@ -708,25 +627,16 @@ class Ml {
708
627
  const acceptedPath = ['job_id', 'category_id'];
709
628
  const acceptedBody = ['page'];
710
629
  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
- }
630
+ const body = {};
720
631
  for (const key in params) {
721
632
  if (acceptedBody.includes(key)) {
722
- body = body !== null && body !== void 0 ? body : {};
723
633
  // @ts-expect-error
724
634
  body[key] = params[key];
725
635
  }
726
636
  else if (acceptedPath.includes(key)) {
727
637
  continue;
728
638
  }
729
- else if (key !== 'body') {
639
+ else {
730
640
  // @ts-expect-error
731
641
  querystring[key] = params[key];
732
642
  }
@@ -759,7 +669,7 @@ class Ml {
759
669
  if (acceptedPath.includes(key)) {
760
670
  continue;
761
671
  }
762
- else if (key !== 'body') {
672
+ else {
763
673
  // @ts-expect-error
764
674
  querystring[key] = params[key];
765
675
  }
@@ -791,7 +701,7 @@ class Ml {
791
701
  if (acceptedPath.includes(key)) {
792
702
  continue;
793
703
  }
794
- else if (key !== 'body') {
704
+ else {
795
705
  // @ts-expect-error
796
706
  querystring[key] = params[key];
797
707
  }
@@ -823,7 +733,7 @@ class Ml {
823
733
  if (acceptedPath.includes(key)) {
824
734
  continue;
825
735
  }
826
- else if (key !== 'body') {
736
+ else {
827
737
  // @ts-expect-error
828
738
  querystring[key] = params[key];
829
739
  }
@@ -855,7 +765,7 @@ class Ml {
855
765
  if (acceptedPath.includes(key)) {
856
766
  continue;
857
767
  }
858
- else if (key !== 'body') {
768
+ else {
859
769
  // @ts-expect-error
860
770
  querystring[key] = params[key];
861
771
  }
@@ -887,7 +797,7 @@ class Ml {
887
797
  if (acceptedPath.includes(key)) {
888
798
  continue;
889
799
  }
890
- else if (key !== 'body') {
800
+ else {
891
801
  // @ts-expect-error
892
802
  querystring[key] = params[key];
893
803
  }
@@ -914,25 +824,16 @@ class Ml {
914
824
  const acceptedPath = ['job_id'];
915
825
  const acceptedBody = ['page'];
916
826
  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
- }
827
+ const body = {};
926
828
  for (const key in params) {
927
829
  if (acceptedBody.includes(key)) {
928
- body = body !== null && body !== void 0 ? body : {};
929
830
  // @ts-expect-error
930
831
  body[key] = params[key];
931
832
  }
932
833
  else if (acceptedPath.includes(key)) {
933
834
  continue;
934
835
  }
935
- else if (key !== 'body') {
836
+ else {
936
837
  // @ts-expect-error
937
838
  querystring[key] = params[key];
938
839
  }
@@ -956,7 +857,7 @@ class Ml {
956
857
  if (acceptedPath.includes(key)) {
957
858
  continue;
958
859
  }
959
- else if (key !== 'body') {
860
+ else {
960
861
  // @ts-expect-error
961
862
  querystring[key] = params[key];
962
863
  }
@@ -988,7 +889,7 @@ class Ml {
988
889
  if (acceptedPath.includes(key)) {
989
890
  continue;
990
891
  }
991
- else if (key !== 'body') {
892
+ else {
992
893
  // @ts-expect-error
993
894
  querystring[key] = params[key];
994
895
  }
@@ -1020,7 +921,7 @@ class Ml {
1020
921
  if (acceptedPath.includes(key)) {
1021
922
  continue;
1022
923
  }
1023
- else if (key !== 'body') {
924
+ else {
1024
925
  // @ts-expect-error
1025
926
  querystring[key] = params[key];
1026
927
  }
@@ -1051,7 +952,7 @@ class Ml {
1051
952
  if (acceptedPath.includes(key)) {
1052
953
  continue;
1053
954
  }
1054
- else if (key !== 'body') {
955
+ else {
1055
956
  // @ts-expect-error
1056
957
  querystring[key] = params[key];
1057
958
  }
@@ -1071,25 +972,16 @@ class Ml {
1071
972
  const acceptedPath = ['job_id', 'snapshot_id'];
1072
973
  const acceptedBody = ['desc', 'end', 'page', 'sort', 'start'];
1073
974
  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
- }
975
+ const body = {};
1083
976
  for (const key in params) {
1084
977
  if (acceptedBody.includes(key)) {
1085
- body = body !== null && body !== void 0 ? body : {};
1086
978
  // @ts-expect-error
1087
979
  body[key] = params[key];
1088
980
  }
1089
981
  else if (acceptedPath.includes(key)) {
1090
982
  continue;
1091
983
  }
1092
- else if (key !== 'body') {
984
+ else {
1093
985
  // @ts-expect-error
1094
986
  querystring[key] = params[key];
1095
987
  }
@@ -1117,25 +1009,16 @@ class Ml {
1117
1009
  const acceptedPath = ['job_id'];
1118
1010
  const acceptedBody = ['allow_no_match', 'bucket_span', 'end', 'exclude_interim', 'overall_score', 'start', 'top_n'];
1119
1011
  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
- }
1012
+ const body = {};
1129
1013
  for (const key in params) {
1130
1014
  if (acceptedBody.includes(key)) {
1131
- body = body !== null && body !== void 0 ? body : {};
1132
1015
  // @ts-expect-error
1133
1016
  body[key] = params[key];
1134
1017
  }
1135
1018
  else if (acceptedPath.includes(key)) {
1136
1019
  continue;
1137
1020
  }
1138
- else if (key !== 'body') {
1021
+ else {
1139
1022
  // @ts-expect-error
1140
1023
  querystring[key] = params[key];
1141
1024
  }
@@ -1154,25 +1037,16 @@ class Ml {
1154
1037
  const acceptedPath = ['job_id'];
1155
1038
  const acceptedBody = ['desc', 'end', 'exclude_interim', 'page', 'record_score', 'sort', 'start'];
1156
1039
  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
- }
1040
+ const body = {};
1166
1041
  for (const key in params) {
1167
1042
  if (acceptedBody.includes(key)) {
1168
- body = body !== null && body !== void 0 ? body : {};
1169
1043
  // @ts-expect-error
1170
1044
  body[key] = params[key];
1171
1045
  }
1172
1046
  else if (acceptedPath.includes(key)) {
1173
1047
  continue;
1174
1048
  }
1175
- else if (key !== 'body') {
1049
+ else {
1176
1050
  // @ts-expect-error
1177
1051
  querystring[key] = params[key];
1178
1052
  }
@@ -1196,7 +1070,7 @@ class Ml {
1196
1070
  if (acceptedPath.includes(key)) {
1197
1071
  continue;
1198
1072
  }
1199
- else if (key !== 'body') {
1073
+ else {
1200
1074
  // @ts-expect-error
1201
1075
  querystring[key] = params[key];
1202
1076
  }
@@ -1228,7 +1102,7 @@ class Ml {
1228
1102
  if (acceptedPath.includes(key)) {
1229
1103
  continue;
1230
1104
  }
1231
- else if (key !== 'body') {
1105
+ else {
1232
1106
  // @ts-expect-error
1233
1107
  querystring[key] = params[key];
1234
1108
  }
@@ -1255,25 +1129,16 @@ class Ml {
1255
1129
  const acceptedPath = ['model_id'];
1256
1130
  const acceptedBody = ['docs', 'inference_config'];
1257
1131
  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
- }
1132
+ const body = {};
1267
1133
  for (const key in params) {
1268
1134
  if (acceptedBody.includes(key)) {
1269
- body = body !== null && body !== void 0 ? body : {};
1270
1135
  // @ts-expect-error
1271
1136
  body[key] = params[key];
1272
1137
  }
1273
1138
  else if (acceptedPath.includes(key)) {
1274
1139
  continue;
1275
1140
  }
1276
- else if (key !== 'body') {
1141
+ else {
1277
1142
  // @ts-expect-error
1278
1143
  querystring[key] = params[key];
1279
1144
  }
@@ -1297,7 +1162,7 @@ class Ml {
1297
1162
  if (acceptedPath.includes(key)) {
1298
1163
  continue;
1299
1164
  }
1300
- else if (key !== 'body') {
1165
+ else {
1301
1166
  // @ts-expect-error
1302
1167
  querystring[key] = params[key];
1303
1168
  }
@@ -1313,25 +1178,16 @@ class Ml {
1313
1178
  const acceptedPath = ['job_id'];
1314
1179
  const acceptedBody = ['timeout'];
1315
1180
  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
- }
1181
+ const body = {};
1325
1182
  for (const key in params) {
1326
1183
  if (acceptedBody.includes(key)) {
1327
- body = body !== null && body !== void 0 ? body : {};
1328
1184
  // @ts-expect-error
1329
1185
  body[key] = params[key];
1330
1186
  }
1331
1187
  else if (acceptedPath.includes(key)) {
1332
1188
  continue;
1333
1189
  }
1334
- else if (key !== 'body') {
1190
+ else {
1335
1191
  // @ts-expect-error
1336
1192
  querystring[key] = params[key];
1337
1193
  }
@@ -1350,25 +1206,16 @@ class Ml {
1350
1206
  const acceptedPath = ['calendar_id'];
1351
1207
  const acceptedBody = ['events'];
1352
1208
  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
- }
1209
+ const body = {};
1362
1210
  for (const key in params) {
1363
1211
  if (acceptedBody.includes(key)) {
1364
- body = body !== null && body !== void 0 ? body : {};
1365
1212
  // @ts-expect-error
1366
1213
  body[key] = params[key];
1367
1214
  }
1368
1215
  else if (acceptedPath.includes(key)) {
1369
1216
  continue;
1370
1217
  }
1371
- else if (key !== 'body') {
1218
+ else {
1372
1219
  // @ts-expect-error
1373
1220
  querystring[key] = params[key];
1374
1221
  }
@@ -1384,12 +1231,10 @@ class Ml {
1384
1231
  return await this.transport.request({ path, method, querystring, body, meta }, options);
1385
1232
  }
1386
1233
  async postData(params, options) {
1387
- var _a;
1388
1234
  const acceptedPath = ['job_id'];
1389
1235
  const acceptedBody = ['data'];
1390
1236
  const querystring = {};
1391
- // @ts-expect-error
1392
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1237
+ let body;
1393
1238
  for (const key in params) {
1394
1239
  if (acceptedBody.includes(key)) {
1395
1240
  // @ts-expect-error
@@ -1398,7 +1243,7 @@ class Ml {
1398
1243
  else if (acceptedPath.includes(key)) {
1399
1244
  continue;
1400
1245
  }
1401
- else if (key !== 'body') {
1246
+ else {
1402
1247
  // @ts-expect-error
1403
1248
  querystring[key] = params[key];
1404
1249
  }
@@ -1417,26 +1262,17 @@ class Ml {
1417
1262
  const acceptedPath = ['id'];
1418
1263
  const acceptedBody = ['config'];
1419
1264
  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
- }
1265
+ const body = {};
1429
1266
  params = params !== null && params !== void 0 ? params : {};
1430
1267
  for (const key in params) {
1431
1268
  if (acceptedBody.includes(key)) {
1432
- body = body !== null && body !== void 0 ? body : {};
1433
1269
  // @ts-expect-error
1434
1270
  body[key] = params[key];
1435
1271
  }
1436
1272
  else if (acceptedPath.includes(key)) {
1437
1273
  continue;
1438
1274
  }
1439
- else if (key !== 'body') {
1275
+ else {
1440
1276
  // @ts-expect-error
1441
1277
  querystring[key] = params[key];
1442
1278
  }
@@ -1463,26 +1299,17 @@ class Ml {
1463
1299
  const acceptedPath = ['datafeed_id'];
1464
1300
  const acceptedBody = ['datafeed_config', 'job_config'];
1465
1301
  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
- }
1302
+ const body = {};
1475
1303
  params = params !== null && params !== void 0 ? params : {};
1476
1304
  for (const key in params) {
1477
1305
  if (acceptedBody.includes(key)) {
1478
- body = body !== null && body !== void 0 ? body : {};
1479
1306
  // @ts-expect-error
1480
1307
  body[key] = params[key];
1481
1308
  }
1482
1309
  else if (acceptedPath.includes(key)) {
1483
1310
  continue;
1484
1311
  }
1485
- else if (key !== 'body') {
1312
+ else {
1486
1313
  // @ts-expect-error
1487
1314
  querystring[key] = params[key];
1488
1315
  }
@@ -1509,25 +1336,16 @@ class Ml {
1509
1336
  const acceptedPath = ['calendar_id'];
1510
1337
  const acceptedBody = ['job_ids', 'description'];
1511
1338
  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
- }
1339
+ const body = {};
1521
1340
  for (const key in params) {
1522
1341
  if (acceptedBody.includes(key)) {
1523
- body = body !== null && body !== void 0 ? body : {};
1524
1342
  // @ts-expect-error
1525
1343
  body[key] = params[key];
1526
1344
  }
1527
1345
  else if (acceptedPath.includes(key)) {
1528
1346
  continue;
1529
1347
  }
1530
- else if (key !== 'body') {
1348
+ else {
1531
1349
  // @ts-expect-error
1532
1350
  querystring[key] = params[key];
1533
1351
  }
@@ -1550,7 +1368,7 @@ class Ml {
1550
1368
  if (acceptedPath.includes(key)) {
1551
1369
  continue;
1552
1370
  }
1553
- else if (key !== 'body') {
1371
+ else {
1554
1372
  // @ts-expect-error
1555
1373
  querystring[key] = params[key];
1556
1374
  }
@@ -1570,25 +1388,16 @@ class Ml {
1570
1388
  const acceptedPath = ['id'];
1571
1389
  const acceptedBody = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', 'model_memory_limit', 'source', 'headers', 'version'];
1572
1390
  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
- }
1391
+ const body = {};
1582
1392
  for (const key in params) {
1583
1393
  if (acceptedBody.includes(key)) {
1584
- body = body !== null && body !== void 0 ? body : {};
1585
1394
  // @ts-expect-error
1586
1395
  body[key] = params[key];
1587
1396
  }
1588
1397
  else if (acceptedPath.includes(key)) {
1589
1398
  continue;
1590
1399
  }
1591
- else if (key !== 'body') {
1400
+ else {
1592
1401
  // @ts-expect-error
1593
1402
  querystring[key] = params[key];
1594
1403
  }
@@ -1607,25 +1416,16 @@ class Ml {
1607
1416
  const acceptedPath = ['datafeed_id'];
1608
1417
  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', 'headers'];
1609
1418
  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
- }
1419
+ const body = {};
1619
1420
  for (const key in params) {
1620
1421
  if (acceptedBody.includes(key)) {
1621
- body = body !== null && body !== void 0 ? body : {};
1622
1422
  // @ts-expect-error
1623
1423
  body[key] = params[key];
1624
1424
  }
1625
1425
  else if (acceptedPath.includes(key)) {
1626
1426
  continue;
1627
1427
  }
1628
- else if (key !== 'body') {
1428
+ else {
1629
1429
  // @ts-expect-error
1630
1430
  querystring[key] = params[key];
1631
1431
  }
@@ -1644,25 +1444,16 @@ class Ml {
1644
1444
  const acceptedPath = ['filter_id'];
1645
1445
  const acceptedBody = ['description', 'items'];
1646
1446
  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
- }
1447
+ const body = {};
1656
1448
  for (const key in params) {
1657
1449
  if (acceptedBody.includes(key)) {
1658
- body = body !== null && body !== void 0 ? body : {};
1659
1450
  // @ts-expect-error
1660
1451
  body[key] = params[key];
1661
1452
  }
1662
1453
  else if (acceptedPath.includes(key)) {
1663
1454
  continue;
1664
1455
  }
1665
- else if (key !== 'body') {
1456
+ else {
1666
1457
  // @ts-expect-error
1667
1458
  querystring[key] = params[key];
1668
1459
  }
@@ -1681,25 +1472,16 @@ class Ml {
1681
1472
  const acceptedPath = ['job_id'];
1682
1473
  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', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'];
1683
1474
  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
- }
1475
+ const body = {};
1693
1476
  for (const key in params) {
1694
1477
  if (acceptedBody.includes(key)) {
1695
- body = body !== null && body !== void 0 ? body : {};
1696
1478
  // @ts-expect-error
1697
1479
  body[key] = params[key];
1698
1480
  }
1699
1481
  else if (acceptedPath.includes(key)) {
1700
1482
  continue;
1701
1483
  }
1702
- else if (key !== 'body') {
1484
+ else {
1703
1485
  // @ts-expect-error
1704
1486
  querystring[key] = params[key];
1705
1487
  }
@@ -1718,25 +1500,16 @@ class Ml {
1718
1500
  const acceptedPath = ['model_id'];
1719
1501
  const acceptedBody = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'model_type', 'model_size_bytes', 'platform_architecture', 'tags', 'prefix_strings'];
1720
1502
  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
- }
1503
+ const body = {};
1730
1504
  for (const key in params) {
1731
1505
  if (acceptedBody.includes(key)) {
1732
- body = body !== null && body !== void 0 ? body : {};
1733
1506
  // @ts-expect-error
1734
1507
  body[key] = params[key];
1735
1508
  }
1736
1509
  else if (acceptedPath.includes(key)) {
1737
1510
  continue;
1738
1511
  }
1739
- else if (key !== 'body') {
1512
+ else {
1740
1513
  // @ts-expect-error
1741
1514
  querystring[key] = params[key];
1742
1515
  }
@@ -1759,7 +1532,7 @@ class Ml {
1759
1532
  if (acceptedPath.includes(key)) {
1760
1533
  continue;
1761
1534
  }
1762
- else if (key !== 'body') {
1535
+ else {
1763
1536
  // @ts-expect-error
1764
1537
  querystring[key] = params[key];
1765
1538
  }
@@ -1779,25 +1552,16 @@ class Ml {
1779
1552
  const acceptedPath = ['model_id', 'part'];
1780
1553
  const acceptedBody = ['definition', 'total_definition_length', 'total_parts'];
1781
1554
  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
- }
1555
+ const body = {};
1791
1556
  for (const key in params) {
1792
1557
  if (acceptedBody.includes(key)) {
1793
- body = body !== null && body !== void 0 ? body : {};
1794
1558
  // @ts-expect-error
1795
1559
  body[key] = params[key];
1796
1560
  }
1797
1561
  else if (acceptedPath.includes(key)) {
1798
1562
  continue;
1799
1563
  }
1800
- else if (key !== 'body') {
1564
+ else {
1801
1565
  // @ts-expect-error
1802
1566
  querystring[key] = params[key];
1803
1567
  }
@@ -1817,25 +1581,16 @@ class Ml {
1817
1581
  const acceptedPath = ['model_id'];
1818
1582
  const acceptedBody = ['vocabulary', 'merges', 'scores'];
1819
1583
  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
- }
1584
+ const body = {};
1829
1585
  for (const key in params) {
1830
1586
  if (acceptedBody.includes(key)) {
1831
- body = body !== null && body !== void 0 ? body : {};
1832
1587
  // @ts-expect-error
1833
1588
  body[key] = params[key];
1834
1589
  }
1835
1590
  else if (acceptedPath.includes(key)) {
1836
1591
  continue;
1837
1592
  }
1838
- else if (key !== 'body') {
1593
+ else {
1839
1594
  // @ts-expect-error
1840
1595
  querystring[key] = params[key];
1841
1596
  }
@@ -1858,7 +1613,7 @@ class Ml {
1858
1613
  if (acceptedPath.includes(key)) {
1859
1614
  continue;
1860
1615
  }
1861
- else if (key !== 'body') {
1616
+ else {
1862
1617
  // @ts-expect-error
1863
1618
  querystring[key] = params[key];
1864
1619
  }
@@ -1877,25 +1632,16 @@ class Ml {
1877
1632
  const acceptedPath = ['job_id', 'snapshot_id'];
1878
1633
  const acceptedBody = ['delete_intervening_results'];
1879
1634
  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
- }
1635
+ const body = {};
1889
1636
  for (const key in params) {
1890
1637
  if (acceptedBody.includes(key)) {
1891
- body = body !== null && body !== void 0 ? body : {};
1892
1638
  // @ts-expect-error
1893
1639
  body[key] = params[key];
1894
1640
  }
1895
1641
  else if (acceptedPath.includes(key)) {
1896
1642
  continue;
1897
1643
  }
1898
- else if (key !== 'body') {
1644
+ else {
1899
1645
  // @ts-expect-error
1900
1646
  querystring[key] = params[key];
1901
1647
  }
@@ -1920,7 +1666,7 @@ class Ml {
1920
1666
  if (acceptedPath.includes(key)) {
1921
1667
  continue;
1922
1668
  }
1923
- else if (key !== 'body') {
1669
+ else {
1924
1670
  // @ts-expect-error
1925
1671
  querystring[key] = params[key];
1926
1672
  }
@@ -1940,7 +1686,7 @@ class Ml {
1940
1686
  if (acceptedPath.includes(key)) {
1941
1687
  continue;
1942
1688
  }
1943
- else if (key !== 'body') {
1689
+ else {
1944
1690
  // @ts-expect-error
1945
1691
  querystring[key] = params[key];
1946
1692
  }
@@ -1959,25 +1705,16 @@ class Ml {
1959
1705
  const acceptedPath = ['datafeed_id'];
1960
1706
  const acceptedBody = ['end', 'start', 'timeout'];
1961
1707
  const querystring = {};
1962
- // @ts-expect-error
1963
- const userBody = params === null || params === void 0 ? void 0 : params.body;
1964
- let body;
1965
- if (typeof userBody === 'string') {
1966
- body = userBody;
1967
- }
1968
- else {
1969
- body = userBody != null ? { ...userBody } : undefined;
1970
- }
1708
+ const body = {};
1971
1709
  for (const key in params) {
1972
1710
  if (acceptedBody.includes(key)) {
1973
- body = body !== null && body !== void 0 ? body : {};
1974
1711
  // @ts-expect-error
1975
1712
  body[key] = params[key];
1976
1713
  }
1977
1714
  else if (acceptedPath.includes(key)) {
1978
1715
  continue;
1979
1716
  }
1980
- else if (key !== 'body') {
1717
+ else {
1981
1718
  // @ts-expect-error
1982
1719
  querystring[key] = params[key];
1983
1720
  }
@@ -2000,7 +1737,7 @@ class Ml {
2000
1737
  if (acceptedPath.includes(key)) {
2001
1738
  continue;
2002
1739
  }
2003
- else if (key !== 'body') {
1740
+ else {
2004
1741
  // @ts-expect-error
2005
1742
  querystring[key] = params[key];
2006
1743
  }
@@ -2023,7 +1760,7 @@ class Ml {
2023
1760
  if (acceptedPath.includes(key)) {
2024
1761
  continue;
2025
1762
  }
2026
- else if (key !== 'body') {
1763
+ else {
2027
1764
  // @ts-expect-error
2028
1765
  querystring[key] = params[key];
2029
1766
  }
@@ -2042,25 +1779,16 @@ class Ml {
2042
1779
  const acceptedPath = ['datafeed_id'];
2043
1780
  const acceptedBody = ['allow_no_match', 'force', 'timeout'];
2044
1781
  const querystring = {};
2045
- // @ts-expect-error
2046
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2047
- let body;
2048
- if (typeof userBody === 'string') {
2049
- body = userBody;
2050
- }
2051
- else {
2052
- body = userBody != null ? { ...userBody } : undefined;
2053
- }
1782
+ const body = {};
2054
1783
  for (const key in params) {
2055
1784
  if (acceptedBody.includes(key)) {
2056
- body = body !== null && body !== void 0 ? body : {};
2057
1785
  // @ts-expect-error
2058
1786
  body[key] = params[key];
2059
1787
  }
2060
1788
  else if (acceptedPath.includes(key)) {
2061
1789
  continue;
2062
1790
  }
2063
- else if (key !== 'body') {
1791
+ else {
2064
1792
  // @ts-expect-error
2065
1793
  querystring[key] = params[key];
2066
1794
  }
@@ -2083,7 +1811,7 @@ class Ml {
2083
1811
  if (acceptedPath.includes(key)) {
2084
1812
  continue;
2085
1813
  }
2086
- else if (key !== 'body') {
1814
+ else {
2087
1815
  // @ts-expect-error
2088
1816
  querystring[key] = params[key];
2089
1817
  }
@@ -2102,25 +1830,16 @@ class Ml {
2102
1830
  const acceptedPath = ['id'];
2103
1831
  const acceptedBody = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'];
2104
1832
  const querystring = {};
2105
- // @ts-expect-error
2106
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2107
- let body;
2108
- if (typeof userBody === 'string') {
2109
- body = userBody;
2110
- }
2111
- else {
2112
- body = userBody != null ? { ...userBody } : undefined;
2113
- }
1833
+ const body = {};
2114
1834
  for (const key in params) {
2115
1835
  if (acceptedBody.includes(key)) {
2116
- body = body !== null && body !== void 0 ? body : {};
2117
1836
  // @ts-expect-error
2118
1837
  body[key] = params[key];
2119
1838
  }
2120
1839
  else if (acceptedPath.includes(key)) {
2121
1840
  continue;
2122
1841
  }
2123
- else if (key !== 'body') {
1842
+ else {
2124
1843
  // @ts-expect-error
2125
1844
  querystring[key] = params[key];
2126
1845
  }
@@ -2139,25 +1858,16 @@ class Ml {
2139
1858
  const acceptedPath = ['datafeed_id'];
2140
1859
  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'];
2141
1860
  const querystring = {};
2142
- // @ts-expect-error
2143
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2144
- let body;
2145
- if (typeof userBody === 'string') {
2146
- body = userBody;
2147
- }
2148
- else {
2149
- body = userBody != null ? { ...userBody } : undefined;
2150
- }
1861
+ const body = {};
2151
1862
  for (const key in params) {
2152
1863
  if (acceptedBody.includes(key)) {
2153
- body = body !== null && body !== void 0 ? body : {};
2154
1864
  // @ts-expect-error
2155
1865
  body[key] = params[key];
2156
1866
  }
2157
1867
  else if (acceptedPath.includes(key)) {
2158
1868
  continue;
2159
1869
  }
2160
- else if (key !== 'body') {
1870
+ else {
2161
1871
  // @ts-expect-error
2162
1872
  querystring[key] = params[key];
2163
1873
  }
@@ -2176,25 +1886,16 @@ class Ml {
2176
1886
  const acceptedPath = ['filter_id'];
2177
1887
  const acceptedBody = ['add_items', 'description', 'remove_items'];
2178
1888
  const querystring = {};
2179
- // @ts-expect-error
2180
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2181
- let body;
2182
- if (typeof userBody === 'string') {
2183
- body = userBody;
2184
- }
2185
- else {
2186
- body = userBody != null ? { ...userBody } : undefined;
2187
- }
1889
+ const body = {};
2188
1890
  for (const key in params) {
2189
1891
  if (acceptedBody.includes(key)) {
2190
- body = body !== null && body !== void 0 ? body : {};
2191
1892
  // @ts-expect-error
2192
1893
  body[key] = params[key];
2193
1894
  }
2194
1895
  else if (acceptedPath.includes(key)) {
2195
1896
  continue;
2196
1897
  }
2197
- else if (key !== 'body') {
1898
+ else {
2198
1899
  // @ts-expect-error
2199
1900
  querystring[key] = params[key];
2200
1901
  }
@@ -2213,25 +1914,16 @@ class Ml {
2213
1914
  const acceptedPath = ['job_id'];
2214
1915
  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'];
2215
1916
  const querystring = {};
2216
- // @ts-expect-error
2217
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2218
- let body;
2219
- if (typeof userBody === 'string') {
2220
- body = userBody;
2221
- }
2222
- else {
2223
- body = userBody != null ? { ...userBody } : undefined;
2224
- }
1917
+ const body = {};
2225
1918
  for (const key in params) {
2226
1919
  if (acceptedBody.includes(key)) {
2227
- body = body !== null && body !== void 0 ? body : {};
2228
1920
  // @ts-expect-error
2229
1921
  body[key] = params[key];
2230
1922
  }
2231
1923
  else if (acceptedPath.includes(key)) {
2232
1924
  continue;
2233
1925
  }
2234
- else if (key !== 'body') {
1926
+ else {
2235
1927
  // @ts-expect-error
2236
1928
  querystring[key] = params[key];
2237
1929
  }
@@ -2250,25 +1942,16 @@ class Ml {
2250
1942
  const acceptedPath = ['job_id', 'snapshot_id'];
2251
1943
  const acceptedBody = ['description', 'retain'];
2252
1944
  const querystring = {};
2253
- // @ts-expect-error
2254
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2255
- let body;
2256
- if (typeof userBody === 'string') {
2257
- body = userBody;
2258
- }
2259
- else {
2260
- body = userBody != null ? { ...userBody } : undefined;
2261
- }
1945
+ const body = {};
2262
1946
  for (const key in params) {
2263
1947
  if (acceptedBody.includes(key)) {
2264
- body = body !== null && body !== void 0 ? body : {};
2265
1948
  // @ts-expect-error
2266
1949
  body[key] = params[key];
2267
1950
  }
2268
1951
  else if (acceptedPath.includes(key)) {
2269
1952
  continue;
2270
1953
  }
2271
- else if (key !== 'body') {
1954
+ else {
2272
1955
  // @ts-expect-error
2273
1956
  querystring[key] = params[key];
2274
1957
  }
@@ -2288,25 +1971,16 @@ class Ml {
2288
1971
  const acceptedPath = ['model_id'];
2289
1972
  const acceptedBody = ['number_of_allocations'];
2290
1973
  const querystring = {};
2291
- // @ts-expect-error
2292
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2293
- let body;
2294
- if (typeof userBody === 'string') {
2295
- body = userBody;
2296
- }
2297
- else {
2298
- body = userBody != null ? { ...userBody } : undefined;
2299
- }
1974
+ const body = {};
2300
1975
  for (const key in params) {
2301
1976
  if (acceptedBody.includes(key)) {
2302
- body = body !== null && body !== void 0 ? body : {};
2303
1977
  // @ts-expect-error
2304
1978
  body[key] = params[key];
2305
1979
  }
2306
1980
  else if (acceptedPath.includes(key)) {
2307
1981
  continue;
2308
1982
  }
2309
- else if (key !== 'body') {
1983
+ else {
2310
1984
  // @ts-expect-error
2311
1985
  querystring[key] = params[key];
2312
1986
  }
@@ -2329,7 +2003,7 @@ class Ml {
2329
2003
  if (acceptedPath.includes(key)) {
2330
2004
  continue;
2331
2005
  }
2332
- else if (key !== 'body') {
2006
+ else {
2333
2007
  // @ts-expect-error
2334
2008
  querystring[key] = params[key];
2335
2009
  }
@@ -2349,26 +2023,17 @@ class Ml {
2349
2023
  const acceptedPath = [];
2350
2024
  const acceptedBody = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_id', 'model_snapshot_retention_days', 'results_index_name'];
2351
2025
  const querystring = {};
2352
- // @ts-expect-error
2353
- const userBody = params === null || params === void 0 ? void 0 : params.body;
2354
- let body;
2355
- if (typeof userBody === 'string') {
2356
- body = userBody;
2357
- }
2358
- else {
2359
- body = userBody != null ? { ...userBody } : undefined;
2360
- }
2026
+ const body = {};
2361
2027
  params = params !== null && params !== void 0 ? params : {};
2362
2028
  for (const key in params) {
2363
2029
  if (acceptedBody.includes(key)) {
2364
- body = body !== null && body !== void 0 ? body : {};
2365
2030
  // @ts-expect-error
2366
2031
  body[key] = params[key];
2367
2032
  }
2368
2033
  else if (acceptedPath.includes(key)) {
2369
2034
  continue;
2370
2035
  }
2371
- else if (key !== 'body') {
2036
+ else {
2372
2037
  // @ts-expect-error
2373
2038
  querystring[key] = params[key];
2374
2039
  }
@@ -2381,12 +2046,10 @@ class Ml {
2381
2046
  return await this.transport.request({ path, method, querystring, body, meta }, options);
2382
2047
  }
2383
2048
  async validateDetector(params, options) {
2384
- var _a;
2385
2049
  const acceptedPath = [];
2386
2050
  const acceptedBody = ['detector'];
2387
2051
  const querystring = {};
2388
- // @ts-expect-error
2389
- let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
2052
+ let body;
2390
2053
  for (const key in params) {
2391
2054
  if (acceptedBody.includes(key)) {
2392
2055
  // @ts-expect-error
@@ -2395,7 +2058,7 @@ class Ml {
2395
2058
  else if (acceptedPath.includes(key)) {
2396
2059
  continue;
2397
2060
  }
2398
- else if (key !== 'body') {
2061
+ else {
2399
2062
  // @ts-expect-error
2400
2063
  querystring[key] = params[key];
2401
2064
  }