@elastic/elasticsearch 7.7.0-rc.2 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +2 -0
  2. package/api/api/async_search.submit.js +4 -0
  3. package/api/api/autoscaling.delete_autoscaling_policy.js +78 -0
  4. package/api/api/autoscaling.get_autoscaling_policy.js +78 -0
  5. package/api/api/autoscaling.put_autoscaling_policy.js +82 -0
  6. package/api/api/bulk.js +4 -0
  7. package/api/api/cluster.delete_component_template.js +1 -1
  8. package/api/api/cluster.delete_voting_config_exclusions.js +79 -0
  9. package/api/api/cluster.exists_component_template.js +86 -0
  10. package/api/api/cluster.get_component_template.js +1 -1
  11. package/api/api/cluster.post_voting_config_exclusions.js +82 -0
  12. package/api/api/cluster.put_component_template.js +1 -1
  13. package/api/api/delete_by_query.js +4 -0
  14. package/api/api/eql.search.js +1 -1
  15. package/api/api/exists.js +4 -0
  16. package/api/api/exists_source.js +4 -0
  17. package/api/api/explain.js +4 -0
  18. package/api/api/get.js +4 -0
  19. package/api/api/get_source.js +4 -0
  20. package/api/api/indices.delete_index_template.js +86 -0
  21. package/api/api/indices.exists_index_template.js +88 -0
  22. package/api/api/indices.get_index_template.js +87 -0
  23. package/api/api/indices.put_index_template.js +91 -0
  24. package/api/api/indices.simulate_index_template.js +87 -0
  25. package/api/api/mget.js +4 -0
  26. package/api/api/ml.delete_data_frame_analytics.js +2 -1
  27. package/api/api/ml.validate.js +1 -0
  28. package/api/api/ml.validate_detector.js +1 -0
  29. package/api/api/search.js +4 -0
  30. package/api/api/searchable_snapshots.clear_cache.js +83 -0
  31. package/api/api/searchable_snapshots.mount.js +94 -0
  32. package/api/api/searchable_snapshots.repository_stats.js +78 -0
  33. package/api/api/searchable_snapshots.stats.js +77 -0
  34. package/api/api/snapshot.cleanup_repository.js +1 -1
  35. package/api/api/tasks.cancel.js +2 -0
  36. package/api/api/update.js +4 -0
  37. package/api/api/update_by_query.js +4 -0
  38. package/api/index.js +39 -1
  39. package/api/requestParams.d.ts +119 -3
  40. package/index.d.ts +156 -16
  41. package/index.js +9 -2
  42. package/lib/Connection.js +8 -2
  43. package/lib/Helpers.d.ts +22 -5
  44. package/lib/Helpers.js +328 -32
  45. package/lib/Transport.js +30 -15
  46. package/lib/pool/BaseConnectionPool.js +2 -0
  47. package/lib/pool/CloudConnectionPool.js +1 -1
  48. package/lib/pool/ConnectionPool.js +12 -2
  49. package/package.json +21 -13
@@ -11,7 +11,7 @@ const Connection = require('../Connection')
11
11
  const noop = () => {}
12
12
 
13
13
  class ConnectionPool extends BaseConnectionPool {
14
- constructor (opts = {}) {
14
+ constructor (opts) {
15
15
  super(opts)
16
16
 
17
17
  this.dead = []
@@ -60,7 +60,17 @@ class ConnectionPool extends BaseConnectionPool {
60
60
  const { id } = connection
61
61
  debug(`Marking as 'dead' connection '${id}'`)
62
62
  if (this.dead.indexOf(id) === -1) {
63
- this.dead.push(id)
63
+ // It might happen that `markDead` is called jsut after
64
+ // a pool update, and in such case we will add to the dead
65
+ // list a node that no longer exist. The following check verify
66
+ // that the connection is still part of the pool before
67
+ // marking it as dead.
68
+ for (var i = 0; i < this.size; i++) {
69
+ if (this.connections[i].id === id) {
70
+ this.dead.push(id)
71
+ break
72
+ }
73
+ }
64
74
  }
65
75
  connection.status = Connection.statuses.DEAD
66
76
  connection.deadCount++
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
7
- "version": "7.7.0-rc.2",
7
+ "version": "7.8.0",
8
8
  "keywords": [
9
9
  "elasticsearch",
10
10
  "elastic",
@@ -16,20 +16,19 @@
16
16
  "index"
17
17
  ],
18
18
  "scripts": {
19
- "test": "npm run lint && npm run test:unit && npm run test:behavior && npm run test:types",
20
- "test:unit": "tap test/unit/*.test.js test/unit/**/*.test.js -t 300 --no-coverage",
21
- "test:behavior": "tap test/behavior/*.test.js -t 300 --no-coverage",
19
+ "test": "npm run lint && tap test/{unit,acceptance}/{*,**/*}.test.js && npm run test:types",
20
+ "test:node8": "npm run lint && tap test/{unit,acceptance}/*.test.js && npm run test:types",
21
+ "test:unit": "tap test/unit/{*,**/*}.test.js",
22
+ "test:acceptance": "tap test/acceptance/*.test.js",
22
23
  "test:integration": "node test/integration/index.js",
23
- "test:integration:helpers": "tap test/integration/helpers/*.test.js --no-coverage -J",
24
+ "test:integration:helpers": "tap test/integration/helpers/*.test.js",
24
25
  "test:types": "tsd",
25
- "test:coverage": "tap test/unit/*.test.js test/unit/**/*.test.js test/behavior/*.test.js -t 300 && nyc report --reporter=text-lcov > coverage.lcov",
26
- "test:coverage-ui": "tap test/unit/*.test.js test/unit/**/*.test.js test/behavior/*.test.js -t 300 --coverage-report=html",
26
+ "test:coverage-100": "tap test/{unit,acceptance}/{*,**/*}.test.js --coverage --100 --nyc-arg=\"--exclude=api\"",
27
+ "test:coverage-report": "tap test/{unit,acceptance}/{*,**/*}.test.js --coverage --nyc-arg=\"--exclude=api\" && nyc report --reporter=text-lcov > coverage.lcov",
28
+ "test:coverage-ui": "tap test/{unit,acceptance}/{*,**/*}.test.js --coverage --coverage-report=html --nyc-arg=\"--exclude=api\"",
27
29
  "lint": "standard",
28
30
  "lint:fix": "standard --fix",
29
- "ci": "npm run license-checker && npm test && npm run test:integration:helpers && npm run test:integration && npm run test:coverage",
30
- "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'",
31
- "elasticsearch": "./scripts/es-docker.sh",
32
- "elasticsearch:xpack": "./scripts/es-docker-platinum.sh"
31
+ "license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'"
33
32
  },
34
33
  "author": {
35
34
  "name": "Tomas Della Vedova",
@@ -40,6 +39,7 @@
40
39
  "company": "Elasticsearch BV"
41
40
  },
42
41
  "devDependencies": {
42
+ "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
43
43
  "@types/node": "^12.6.2",
44
44
  "convert-hrtime": "^3.0.0",
45
45
  "dedent": "^0.7.0",
@@ -49,7 +49,6 @@
49
49
  "into-stream": "^5.1.1",
50
50
  "js-yaml": "^3.13.1",
51
51
  "license-checker": "^25.0.1",
52
- "lolex": "^4.0.1",
53
52
  "minimist": "^1.2.0",
54
53
  "ora": "^3.4.0",
55
54
  "pretty-hrtime": "^1.0.3",
@@ -62,7 +61,8 @@
62
61
  "stoppable": "^1.1.0",
63
62
  "tap": "^14.4.1",
64
63
  "tsd": "^0.11.0",
65
- "workq": "^2.1.0"
64
+ "workq": "^2.1.0",
65
+ "xmlbuilder2": "^2.1.2"
66
66
  },
67
67
  "dependencies": {
68
68
  "debug": "^4.1.1",
@@ -84,5 +84,13 @@
84
84
  },
85
85
  "tsd": {
86
86
  "directory": "test/types"
87
+ },
88
+ "tap": {
89
+ "esm": false,
90
+ "ts": false,
91
+ "jsx": false,
92
+ "flow": false,
93
+ "coverage": false,
94
+ "jobs-auto": true
87
95
  }
88
96
  }