@elastic/elasticsearch-canary
Advanced tools
Comparing version 7.15.0-canary.3 to 7.15.0-canary.4
@@ -34,3 +34,3 @@ /* | ||
NodesApi.prototype.clearMeteringArchive = function nodesClearMeteringArchiveApi (params, options, callback) { | ||
NodesApi.prototype.clearRepositoriesMeteringArchive = function nodesClearRepositoriesMeteringArchiveApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
@@ -72,3 +72,3 @@ | ||
NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi (params, options, callback) { | ||
NodesApi.prototype.getRepositoriesMeteringInfo = function nodesGetRepositoriesMeteringInfoApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
@@ -264,4 +264,4 @@ | ||
Object.defineProperties(NodesApi.prototype, { | ||
clear_metering_archive: { get () { return this.clearMeteringArchive } }, | ||
get_metering_info: { get () { return this.getMeteringInfo } }, | ||
clear_repositories_metering_archive: { get () { return this.clearRepositoriesMeteringArchive } }, | ||
get_repositories_metering_info: { get () { return this.getRepositoriesMeteringInfo } }, | ||
hot_threads: { get () { return this.hotThreads } }, | ||
@@ -268,0 +268,0 @@ reload_secure_settings: { get () { return this.reloadSecureSettings } } |
@@ -32,2 +32,8 @@ /* | ||
// check required parameters | ||
if (params.index == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, ...querystring } = params | ||
@@ -37,9 +43,4 @@ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((index) != null) { | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_pit' | ||
} else { | ||
if (method == null) method = 'POST' | ||
path = '/' + '_pit' | ||
} | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_pit' | ||
@@ -46,0 +47,0 @@ // build request object |
@@ -1035,2 +1035,23 @@ /* | ||
SecurityApi.prototype.queryApiKeys = function securityQueryApiKeysApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + '_security' + '/' + '_query' + '/' + 'api_key' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.samlAuthenticate = function securitySamlAuthenticateApi (params, options, callback) { | ||
@@ -1232,2 +1253,3 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
put_user: { get () { return this.putUser } }, | ||
query_api_keys: { get () { return this.queryApiKeys } }, | ||
saml_authenticate: { get () { return this.samlAuthenticate } }, | ||
@@ -1234,0 +1256,0 @@ saml_complete_logout: { get () { return this.samlCompleteLogout } }, |
@@ -326,5 +326,5 @@ /* | ||
if (Array.isArray(node)) { | ||
return node.some((n) => new URL(n).protocol === 'http:') | ||
return node.some((n) => (typeof n === 'string' ? new URL(n).protocol : n.url.protocol) === 'http:') | ||
} else { | ||
return new URL(node).protocol === 'http:' | ||
return (typeof node === 'string' ? new URL(node).protocol : node.url.protocol) === 'http:' | ||
} | ||
@@ -331,0 +331,0 @@ } |
@@ -116,3 +116,10 @@ /* | ||
this._openRequests-- | ||
callback(new ConnectionError(err.message), null) | ||
let message = err.message | ||
if (err.code === 'ECONNRESET') { | ||
/* istanbul ignore next */ | ||
const socket = request.socket || {} | ||
/* istanbul ignore next */ | ||
message += ` - Local: ${socket.localAddress || 'unknown'}:${socket.localPort || 'unknown'}, Remote: ${socket.remoteAddress || 'unknown'}:${socket.remotePort || 'unknown'}` | ||
} | ||
callback(new ConnectionError(message), null) | ||
} | ||
@@ -119,0 +126,0 @@ |
@@ -39,3 +39,2 @@ /* | ||
const productCheckEmitter = new EventEmitter() | ||
const clientVersion = require('../package.json').version | ||
@@ -47,2 +46,3 @@ const userAgent = `elasticsearch-js/${clientVersion} (${os.platform()} ${os.release()}-${os.arch()}; Node.js ${process.version})` | ||
const kApiVersioning = Symbol('api versioning') | ||
const kEventEmitter = Symbol('event emitter') | ||
@@ -76,2 +76,3 @@ class Transport { | ||
this[kApiVersioning] = process.env.ELASTIC_CLIENT_APIVERSIONING === 'true' | ||
this[kEventEmitter] = new EventEmitter() | ||
@@ -188,2 +189,3 @@ this.nodeFilter = opts.nodeFilter || defaultNodeFilter | ||
if (meta.aborted === true) { | ||
this.emit('request', new RequestAbortedError(), result) | ||
return process.nextTick(callback, new RequestAbortedError(), result) | ||
@@ -427,4 +429,2 @@ } | ||
if (options.asStream === true) params.asStream = true | ||
meta.request.params = params | ||
meta.request.options = options | ||
@@ -460,2 +460,4 @@ // handle compression | ||
meta.request.params = params | ||
meta.request.options = options | ||
// still need to check the product or waiting for the check to finish | ||
@@ -468,3 +470,3 @@ if (this[kProductCheck] === 0 || this[kProductCheck] === 1) { | ||
// wait for product check to finish | ||
productCheckEmitter.once('product-check', (error, status) => { | ||
this[kEventEmitter].once('product-check', (error, status) => { | ||
if (status === false) { | ||
@@ -569,7 +571,10 @@ const err = error || new ProductNotSupportedError(result) | ||
this[kProductCheck] = 2 | ||
process.emitWarning('The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.') | ||
productCheckEmitter.emit('product-check', null, true) | ||
process.emitWarning( | ||
'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.', | ||
'ProductNotSupportedSecurityError' | ||
) | ||
this[kEventEmitter].emit('product-check', null, true) | ||
} else { | ||
this[kProductCheck] = 0 | ||
productCheckEmitter.emit('product-check', err, false) | ||
this[kEventEmitter].emit('product-check', err, false) | ||
} | ||
@@ -580,3 +585,3 @@ } else { | ||
debug('Can\'t access Elasticsearch version') | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} | ||
@@ -588,7 +593,7 @@ const tagline = result.body.tagline | ||
if (major < 6) { | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} else if (major >= 6 && major < 7) { | ||
if (tagline !== 'You Know, for Search') { | ||
debug('Bad tagline') | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} | ||
@@ -598,3 +603,3 @@ } else if (major === 7 && minor < 14) { | ||
debug('Bad tagline') | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} | ||
@@ -605,3 +610,3 @@ | ||
this[kProductCheck] = 4 | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} | ||
@@ -611,3 +616,3 @@ } else { | ||
debug('x-elastic-product not recognized') | ||
return productCheckEmitter.emit('product-check', null, false) | ||
return this[kEventEmitter].emit('product-check', null, false) | ||
} | ||
@@ -617,3 +622,3 @@ } | ||
this[kProductCheck] = 2 | ||
productCheckEmitter.emit('product-check', null, true) | ||
this[kEventEmitter].emit('product-check', null, true) | ||
} | ||
@@ -620,0 +625,0 @@ }) |
@@ -14,4 +14,4 @@ { | ||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", | ||
"version": "7.15.0-canary.3", | ||
"versionCanary": "7.15.0-canary.3", | ||
"version": "7.15.0-canary.4", | ||
"versionCanary": "7.15.0-canary.4", | ||
"keywords": [ | ||
@@ -107,3 +107,3 @@ "elasticsearch", | ||
}, | ||
"commitHash": "791cfdb1" | ||
"commitHash": "5a88a2f3" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36315
1991133
104