Compare commits

...

6 Commits

Author SHA1 Message Date
af385f0bac Update changelog for 7.17.13 (#2020) 2023-09-26 11:11:58 -05:00
02c5b8664e Skip adding new nodes that aren't ready yet (#1994) 2023-08-31 12:23:49 -05:00
63cd655e79 Bump 7.17.12-canary.1 2023-07-14 11:03:09 -05:00
11a5711409 7.17.12 changelog (#1941) 2023-07-14 10:20:00 -05:00
3f01fafd9e [Backport 7.17] fix: add types to exports (v7.x) (#1930) (#1940)
Co-authored-by: Nicolas Morel <nicolas@morel.io>
2023-07-13 16:12:31 -05:00
cca9a7b212 Bumps 7.17 to 7.17.12 (#1926)
Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2023-06-29 14:13:50 -05:00
5 changed files with 69 additions and 6 deletions

View File

@ -1,6 +1,6 @@
---
STACK_VERSION:
- "7.17.11-SNAPSHOT"
- "7.17.12-SNAPSHOT"
NODE_JS_VERSION:
- 16

View File

@ -1,6 +1,35 @@
[[changelog-client]]
== Release notes
[discrete]
=== 7.17.13
[discrete]
==== Fixes
Fixes a bug where newly-added nodes that don't have HTTP information yet should be skipped during sniffing, to prevent an unexpected `TypeError`. https://github.com/elastic/elasticsearch-js/issues/1230[#1230]
[discrete]
=== 7.17.12
[discrete]
==== Notes
This is the first 7.x release where patch versions of the client will no longer (intentionally) align with patch versions of Elasticsearch. The latest patch release of the client will always be compatible with the corresponding minor release of Elasticsearch.
[discrete]
==== Fixes
[discrete]
===== TypeScript build failure
Fixes a type declaration bug that caused TypeScript builds to fail. https://github.com/elastic/elasticsearch-js/pull/1927[#1927]
[discrete]
===== Add TypeScript type declarations to exports
Adds TypeScript type declarations file to package.json `exports` https://github.com/elastic/elasticsearch-js/pull/1930[#1930]
[discrete]
=== 7.17.11
@ -54,7 +83,6 @@ https://www.elastic.co/guide/en/elasticsearch/reference/7.16/release-notes-7.16.
[discrete]
===== Fixed export field deprecation log https://github.com/elastic/elasticsearch-js/pull/1593#[#1593]
[discrete]
=== 7.15.0
@ -70,7 +98,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/7.15/release-notes-7.15.
[discrete]
===== Support mapbox content type https://github.com/elastic/elasticsearch-js/pull/1500[#1500]
If you call an API that returns a mapbox conten type, the response body will be a buffer.
If you call an API that returns a mapbox content type, the response body will be a buffer.
[discrete]
===== Support CA fingerprint validation https://github.com/elastic/elasticsearch-js/pull/1499[#1499]

View File

@ -206,6 +206,10 @@ class BaseConnectionPool {
for (let i = 0, len = ids.length; i < len; i++) {
const node = nodes[ids[i]]
// newly-added nodes do not have http assigned yet, so skip
if (node.http === undefined) continue
// If there is no protocol in
// the `publish_address` new URL will throw
// the publish_address can have two forms:

View File

@ -6,13 +6,14 @@
"exports": {
".": {
"require": "./index.js",
"import": "./index.mjs"
"import": "./index.mjs",
"types": "./index.d.ts"
},
"./*": "./*.js"
},
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
"version": "7.17.11-patch.1",
"versionCanary": "7.17.11-canary.2",
"version": "7.17.13",
"versionCanary": "7.17.13-canary.1",
"keywords": [
"elasticsearch",
"elastic",

View File

@ -313,6 +313,36 @@ test('API', t => {
t.end()
})
t.test('Should skip nodes that do not have an http property yet', t => {
const pool = new BaseConnectionPool({ Connection })
const nodes = {
a1: {
http: {
publish_address: '127.0.0.1:9200'
},
roles: ['master', 'data', 'ingest']
},
a2: {
roles: ['master', 'data', 'ingest']
}
}
t.same(pool.nodesToHost(nodes, 'http:'), [{
url: new URL('http://127.0.0.1:9200'),
id: 'a1',
roles: {
master: true,
data: true,
ingest: true,
ml: false
}
}])
t.equal(pool.nodesToHost(nodes, 'http:').length, 1)
t.equal(pool.nodesToHost(nodes, 'http:')[0].url.host, '127.0.0.1:9200')
t.end()
})
t.end()
})