Remove Node.js v8 support (#1402)

This commit is contained in:
Tomas Della Vedova
2021-02-19 08:27:20 +01:00
committed by delvedor
parent 496b2bb6d1
commit 6c2d4acac6
43 changed files with 247 additions and 291 deletions

View File

@ -27,8 +27,7 @@ const debug = require('debug')('elasticsearch')
const Transport = require('./lib/Transport')
const Connection = require('./lib/Connection')
const { ConnectionPool, CloudConnectionPool } = require('./lib/pool')
// Helpers works only in Node.js >= 10
const Helpers = nodeMajor < 10 ? /* istanbul ignore next */ null : require('./lib/Helpers')
const Helpers = require('./lib/Helpers')
const Serializer = require('./lib/Serializer')
const errors = require('./lib/errors')
const { ConfigurationError } = errors
@ -48,15 +47,6 @@ const kEventEmitter = Symbol('elasticsearchjs-event-emitter')
const ESAPI = require('./api')
/* istanbul ignore next */
if (nodeMajor < 10) {
process.emitWarning('You are using a version of Node.js that is currently in EOL. ' +
'The support for this version will be dropped in 7.12. ' +
'Please refer to https://ela.st/nodejs-support for additional information.',
'DeprecationWarning'
)
}
/* istanbul ignore next */
if (nodeMajor >= 10 && nodeMajor < 12) {
process.emitWarning('You are using a version of Node.js that will reach EOL in April 2021. ' +
@ -189,16 +179,13 @@ class Client extends ESAPI {
context: options.context
})
/* istanbul ignore else */
if (Helpers !== null) {
this.helpers = new Helpers({
client: this,
maxRetries: options.maxRetries,
metaHeader: options.enableMetaHeader
? `es=${clientVersion},js=${nodeVersion},t=${clientVersion},hc=${nodeVersion}`
: null
})
}
this.helpers = new Helpers({
client: this,
maxRetries: options.maxRetries,
metaHeader: options.enableMetaHeader
? `es=${clientVersion},js=${nodeVersion},t=${clientVersion},hc=${nodeVersion}`
: null
})
}
get emit () {
@ -223,7 +210,7 @@ class Client extends ESAPI {
opts = {}
}
var [namespace, method] = name.split('.')
let [namespace, method] = name.split('.')
if (method == null) {
method = namespace
namespace = null