@elastic/elasticsearch 7.12.0 → 7.13.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.
package/lib/Transport.js CHANGED
@@ -306,8 +306,8 @@ class Transport {
306
306
  return callback(err, result)
307
307
  }
308
308
  } else {
309
- // cast to boolean if the request method was HEAD
310
- result.body = isHead === true ? true : payload
309
+ // cast to boolean if the request method was HEAD and there was no error
310
+ result.body = isHead === true && result.statusCode < 400 ? true : payload
311
311
  }
312
312
 
313
313
  // we should ignore the statusCode if the user has configured the `ignore` field with
package/lib/errors.js CHANGED
@@ -90,7 +90,16 @@ class ResponseError extends ElasticsearchClientError {
90
90
  super('Response Error')
91
91
  Error.captureStackTrace(this, ResponseError)
92
92
  this.name = 'ResponseError'
93
- this.message = (meta.body && meta.body.error && meta.body.error.type) || 'Response Error'
93
+ if (meta.body && meta.body.error && meta.body.error.type) {
94
+ if (Array.isArray(meta.body.error.root_cause)) {
95
+ this.message = meta.body.error.type + ': '
96
+ this.message += meta.body.error.root_cause.map(entry => `[${entry.type}] Reason: ${entry.reason}`).join('; ')
97
+ } else {
98
+ this.message = meta.body.error.type
99
+ }
100
+ } else {
101
+ this.message = 'Response Error'
102
+ }
94
103
  this.meta = meta
95
104
  }
96
105
 
@@ -108,6 +117,10 @@ class ResponseError extends ElasticsearchClientError {
108
117
  get headers () {
109
118
  return this.meta.headers
110
119
  }
120
+
121
+ toString () {
122
+ return JSON.stringify(this.meta.body)
123
+ }
111
124
  }
112
125
 
113
126
  class RequestAbortedError extends ElasticsearchClientError {
package/package.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "./": "./"
12
12
  },
13
13
  "homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
14
- "version": "7.12.0",
15
- "versionCanary": "7.12.0-canary.3",
14
+ "version": "7.13.0",
15
+ "versionCanary": "7.13.0-canary.5",
16
16
  "keywords": [
17
17
  "elasticsearch",
18
18
  "elastic",
@@ -48,37 +48,38 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
51
- "@types/node": "^14.14.28",
52
- "convert-hrtime": "^3.0.0",
51
+ "@types/node": "^15.3.1",
52
+ "convert-hrtime": "^5.0.0",
53
+ "cross-zip": "^4.0.0",
53
54
  "dedent": "^0.7.0",
54
55
  "deepmerge": "^4.2.2",
55
56
  "dezalgo": "^1.0.3",
56
57
  "fast-deep-equal": "^3.1.3",
57
58
  "into-stream": "^6.0.0",
58
- "js-yaml": "^4.0.0",
59
+ "js-yaml": "^4.1.0",
59
60
  "license-checker": "^25.0.1",
60
61
  "minimist": "^1.2.5",
61
- "ora": "^5.3.0",
62
+ "node-fetch": "^2.6.1",
63
+ "ora": "^5.4.0",
62
64
  "pretty-hrtime": "^1.0.3",
63
65
  "proxy": "^1.0.2",
64
66
  "rimraf": "^3.0.2",
65
- "semver": "^7.3.4",
66
- "simple-git": "^2.35.0",
67
- "simple-statistics": "^7.4.1",
67
+ "semver": "^7.3.5",
68
+ "simple-git": "^2.39.0",
69
+ "simple-statistics": "^7.7.0",
68
70
  "split2": "^3.2.2",
69
71
  "standard": "^16.0.3",
70
72
  "stoppable": "^1.1.0",
71
- "tap": "^14.11.0",
72
- "tsd": "^0.14.0",
73
+ "tap": "^15.0.9",
74
+ "tsd": "^0.15.1",
73
75
  "workq": "^3.0.0",
74
- "xmlbuilder2": "^2.4.0"
76
+ "xmlbuilder2": "^2.4.1"
75
77
  },
76
78
  "dependencies": {
77
79
  "debug": "^4.3.1",
78
80
  "hpagent": "^0.1.1",
79
81
  "ms": "^2.1.3",
80
- "pump": "^3.0.0",
81
- "secure-json-parse": "^2.3.1"
82
+ "secure-json-parse": "^2.4.0"
82
83
  },
83
84
  "license": "Apache-2.0",
84
85
  "repository": {
@@ -89,13 +90,12 @@
89
90
  "url": "https://github.com/elastic/elasticsearch-js/issues"
90
91
  },
91
92
  "engines": {
92
- "node": ">=10"
93
+ "node": ">=12"
93
94
  },
94
95
  "tsd": {
95
96
  "directory": "test/types"
96
97
  },
97
98
  "tap": {
98
- "esm": false,
99
99
  "ts": false,
100
100
  "jsx": false,
101
101
  "flow": false,