@opensearch-project/opensearch 1.1.0 → 2.1.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/.eslintignore +2 -0
- package/.eslintrc.json +31 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +13 -31
- package/CHANGELOG.md +24 -0
- package/COMPATIBILITY.md +27 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +15 -70
- package/Makefile +2 -12
- package/README.md +19 -123
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/USER_GUIDE.md +197 -0
- package/api/api/bulk.js +54 -28
- package/api/api/cat.js +355 -266
- package/api/api/clear_scroll.js +18 -19
- package/api/api/cluster.js +367 -221
- package/api/api/count.js +56 -26
- package/api/api/create.js +51 -26
- package/api/api/dangling_indices.js +96 -53
- package/api/api/delete.js +50 -24
- package/api/api/delete_by_query.js +89 -27
- package/api/api/delete_by_query_rethrottle.js +34 -21
- package/api/api/delete_script.js +32 -19
- package/api/api/exists.js +56 -24
- package/api/api/exists_source.js +61 -29
- package/api/api/explain.js +61 -24
- package/api/api/features.js +57 -37
- package/api/api/field_caps.js +37 -20
- package/api/api/get.js +56 -24
- package/api/api/get_script.js +31 -19
- package/api/api/get_script_context.js +16 -17
- package/api/api/get_script_languages.js +16 -17
- package/api/api/get_source.js +56 -24
- package/api/api/index.js +61 -30
- package/api/api/indices.js +1069 -859
- package/api/api/info.js +16 -17
- package/api/api/ingest.js +133 -98
- package/api/api/mget.js +51 -28
- package/api/api/msearch.js +50 -28
- package/api/api/msearch_template.js +54 -28
- package/api/api/mtermvectors.js +49 -26
- package/api/api/nodes.js +282 -156
- package/api/api/ping.js +16 -17
- package/api/api/put_script.js +41 -27
- package/api/api/rank_eval.js +38 -22
- package/api/api/reindex.js +39 -19
- package/api/api/reindex_rethrottle.js +33 -21
- package/api/api/render_search_template.js +19 -20
- package/api/api/scripts_painless_execute.js +16 -17
- package/api/api/scroll.js +32 -19
- package/api/api/search.js +109 -26
- package/api/api/search_shards.js +37 -20
- package/api/api/search_template.js +65 -28
- package/api/api/shutdown.js +67 -56
- package/api/api/snapshot.js +348 -226
- package/api/api/tasks.js +66 -48
- package/api/api/terms_enum.js +18 -19
- package/api/api/termvectors.js +58 -28
- package/api/api/update.js +65 -26
- package/api/api/update_by_query.js +90 -25
- package/api/api/update_by_query_rethrottle.js +34 -21
- package/api/index.js +268 -181
- package/api/new.d.ts +2043 -531
- package/api/opensearch_dashboards.d.ts +240 -238
- package/api/requestParams.d.ts +302 -71
- package/api/types.d.ts +6205 -5721
- package/api/utils.js +23 -24
- package/codecov.yml +2 -2
- package/index.d.ts +5203 -1037
- package/index.js +154 -143
- package/index.mjs +10 -11
- package/jenkins/release.JenkinsFile +11 -0
- package/lib/Connection.d.ts +38 -28
- package/lib/Connection.js +166 -170
- package/lib/Helpers.d.ts +108 -68
- package/lib/Helpers.js +401 -378
- package/lib/Serializer.d.ts +3 -4
- package/lib/Serializer.js +40 -41
- package/lib/Transport.d.ts +39 -15
- package/lib/Transport.js +381 -337
- package/lib/aws/AwsSigv4Signer.js +167 -0
- package/lib/aws/errors.js +24 -0
- package/lib/aws/index.d.ts +39 -0
- package/lib/aws/index.js +19 -0
- package/lib/errors.d.ts +26 -9
- package/lib/errors.js +76 -73
- package/lib/pool/BaseConnectionPool.js +101 -99
- package/lib/pool/CloudConnectionPool.js +17 -18
- package/lib/pool/ConnectionPool.js +106 -107
- package/lib/pool/index.d.ts +9 -8
- package/lib/pool/index.js +7 -8
- package/package.json +37 -15
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
2
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
*
|
|
4
5
|
* The OpenSearch Contributors require contributions made to
|
|
5
6
|
* this file be licensed under the Apache-2.0 license or a
|
|
6
7
|
* compatible open source license.
|
|
7
8
|
*
|
|
8
|
-
* Modifications Copyright OpenSearch Contributors. See
|
|
9
|
-
* GitHub history for details.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
/*
|
|
@@ -28,33 +27,30 @@
|
|
|
28
27
|
* under the License.
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
|
-
'use strict'
|
|
30
|
+
'use strict';
|
|
32
31
|
|
|
33
|
-
const BaseConnectionPool = require('./BaseConnectionPool')
|
|
34
|
-
const assert = require('assert')
|
|
35
|
-
const debug = require('debug')('opensearch')
|
|
36
|
-
const Connection = require('../Connection')
|
|
37
|
-
const noop = () => {
|
|
32
|
+
const BaseConnectionPool = require('./BaseConnectionPool');
|
|
33
|
+
const assert = require('assert');
|
|
34
|
+
const debug = require('debug')('opensearch');
|
|
35
|
+
const Connection = require('../Connection');
|
|
36
|
+
const noop = () => {};
|
|
38
37
|
|
|
39
38
|
class ConnectionPool extends BaseConnectionPool {
|
|
40
|
-
constructor
|
|
41
|
-
super(opts)
|
|
39
|
+
constructor(opts) {
|
|
40
|
+
super(opts);
|
|
42
41
|
|
|
43
|
-
this.dead = []
|
|
42
|
+
this.dead = [];
|
|
44
43
|
// the resurrect timeout is 60s
|
|
45
|
-
this.resurrectTimeout = 1000 * 60
|
|
44
|
+
this.resurrectTimeout = 1000 * 60;
|
|
46
45
|
// number of consecutive failures after which
|
|
47
46
|
// the timeout doesn't increase
|
|
48
|
-
this.resurrectTimeoutCutoff = 5
|
|
49
|
-
this.pingTimeout = opts.pingTimeout
|
|
50
|
-
this._sniffEnabled = opts.sniffEnabled || false
|
|
47
|
+
this.resurrectTimeoutCutoff = 5;
|
|
48
|
+
this.pingTimeout = opts.pingTimeout;
|
|
49
|
+
this._sniffEnabled = opts.sniffEnabled || false;
|
|
51
50
|
|
|
52
|
-
const resurrectStrategy = opts.resurrectStrategy || 'ping'
|
|
53
|
-
this.resurrectStrategy = ConnectionPool.resurrectStrategies[resurrectStrategy]
|
|
54
|
-
assert(
|
|
55
|
-
this.resurrectStrategy != null,
|
|
56
|
-
`Invalid resurrection strategy: '${resurrectStrategy}'`
|
|
57
|
-
)
|
|
51
|
+
const resurrectStrategy = opts.resurrectStrategy || 'ping';
|
|
52
|
+
this.resurrectStrategy = ConnectionPool.resurrectStrategies[resurrectStrategy];
|
|
53
|
+
assert(this.resurrectStrategy != null, `Invalid resurrection strategy: '${resurrectStrategy}'`);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
/**
|
|
@@ -64,15 +60,15 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
64
60
|
*
|
|
65
61
|
* @param {object} connection
|
|
66
62
|
*/
|
|
67
|
-
markAlive
|
|
68
|
-
const { id } = connection
|
|
69
|
-
debug(`Marking as 'alive' connection '${id}'`)
|
|
70
|
-
const index = this.dead.indexOf(id)
|
|
71
|
-
if (index > -1) this.dead.splice(index, 1)
|
|
72
|
-
connection.status = Connection.statuses.ALIVE
|
|
73
|
-
connection.deadCount = 0
|
|
74
|
-
connection.resurrectTimeout = 0
|
|
75
|
-
return this
|
|
63
|
+
markAlive(connection) {
|
|
64
|
+
const { id } = connection;
|
|
65
|
+
debug(`Marking as 'alive' connection '${id}'`);
|
|
66
|
+
const index = this.dead.indexOf(id);
|
|
67
|
+
if (index > -1) this.dead.splice(index, 1);
|
|
68
|
+
connection.status = Connection.statuses.ALIVE;
|
|
69
|
+
connection.deadCount = 0;
|
|
70
|
+
connection.resurrectTimeout = 0;
|
|
71
|
+
return this;
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
/**
|
|
@@ -82,9 +78,9 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
82
78
|
*
|
|
83
79
|
* @param {object} connection
|
|
84
80
|
*/
|
|
85
|
-
markDead
|
|
86
|
-
const { id } = connection
|
|
87
|
-
debug(`Marking as 'dead' connection '${id}'`)
|
|
81
|
+
markDead(connection) {
|
|
82
|
+
const { id } = connection;
|
|
83
|
+
debug(`Marking as 'dead' connection '${id}'`);
|
|
88
84
|
if (this.dead.indexOf(id) === -1) {
|
|
89
85
|
// It might happen that `markDead` is called jsut after
|
|
90
86
|
// a pool update, and in such case we will add to the dead
|
|
@@ -93,28 +89,29 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
93
89
|
// marking it as dead.
|
|
94
90
|
for (let i = 0; i < this.size; i++) {
|
|
95
91
|
if (this.connections[i].id === id) {
|
|
96
|
-
this.dead.push(id)
|
|
97
|
-
break
|
|
92
|
+
this.dead.push(id);
|
|
93
|
+
break;
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
|
-
connection.status = Connection.statuses.DEAD
|
|
102
|
-
connection.deadCount
|
|
97
|
+
connection.status = Connection.statuses.DEAD;
|
|
98
|
+
connection.deadCount++;
|
|
103
99
|
// resurrectTimeout formula:
|
|
104
100
|
// `resurrectTimeout * 2 ** min(deadCount - 1, resurrectTimeoutCutoff)`
|
|
105
|
-
connection.resurrectTimeout =
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
connection.resurrectTimeout =
|
|
102
|
+
Date.now() +
|
|
103
|
+
this.resurrectTimeout *
|
|
104
|
+
Math.pow(2, Math.min(connection.deadCount - 1, this.resurrectTimeoutCutoff));
|
|
108
105
|
|
|
109
106
|
// sort the dead list in ascending order
|
|
110
107
|
// based on the resurrectTimeout
|
|
111
108
|
this.dead.sort((a, b) => {
|
|
112
|
-
const conn1 = this.connections.find(c => c.id === a)
|
|
113
|
-
const conn2 = this.connections.find(c => c.id === b)
|
|
114
|
-
return conn1.resurrectTimeout - conn2.resurrectTimeout
|
|
115
|
-
})
|
|
109
|
+
const conn1 = this.connections.find((c) => c.id === a);
|
|
110
|
+
const conn2 = this.connections.find((c) => c.id === b);
|
|
111
|
+
return conn1.resurrectTimeout - conn2.resurrectTimeout;
|
|
112
|
+
});
|
|
116
113
|
|
|
117
|
-
return this
|
|
114
|
+
return this;
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
/**
|
|
@@ -124,103 +121,105 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
124
121
|
* @param {object} { now, requestId }
|
|
125
122
|
* @param {function} callback (isAlive, connection)
|
|
126
123
|
*/
|
|
127
|
-
resurrect
|
|
124
|
+
resurrect(opts, callback = noop) {
|
|
128
125
|
if (this.resurrectStrategy === 0 || this.dead.length === 0) {
|
|
129
|
-
debug('Nothing to resurrect')
|
|
130
|
-
callback(null, null)
|
|
131
|
-
return
|
|
126
|
+
debug('Nothing to resurrect');
|
|
127
|
+
callback(null, null);
|
|
128
|
+
return;
|
|
132
129
|
}
|
|
133
130
|
|
|
134
131
|
// the dead list is sorted in ascending order based on the timeout
|
|
135
132
|
// so the first element will always be the one with the smaller timeout
|
|
136
|
-
const connection = this.connections.find(c => c.id === this.dead[0])
|
|
133
|
+
const connection = this.connections.find((c) => c.id === this.dead[0]);
|
|
137
134
|
if ((opts.now || Date.now()) < connection.resurrectTimeout) {
|
|
138
|
-
debug('Nothing to resurrect')
|
|
139
|
-
callback(null, null)
|
|
140
|
-
return
|
|
135
|
+
debug('Nothing to resurrect');
|
|
136
|
+
callback(null, null);
|
|
137
|
+
return;
|
|
141
138
|
}
|
|
142
139
|
|
|
143
|
-
const { id } = connection
|
|
140
|
+
const { id } = connection;
|
|
144
141
|
|
|
145
142
|
// ping strategy
|
|
146
143
|
if (this.resurrectStrategy === 1) {
|
|
147
|
-
connection.request(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
144
|
+
connection.request(
|
|
145
|
+
{
|
|
146
|
+
method: 'HEAD',
|
|
147
|
+
path: '/',
|
|
148
|
+
timeout: this.pingTimeout,
|
|
149
|
+
},
|
|
150
|
+
(err, response) => {
|
|
151
|
+
let isAlive = true;
|
|
152
|
+
const statusCode = response !== null ? response.statusCode : 0;
|
|
153
|
+
if (err != null || statusCode === 502 || statusCode === 503 || statusCode === 504) {
|
|
154
|
+
debug(`Resurrect: connection '${id}' is still dead`);
|
|
155
|
+
this.markDead(connection);
|
|
156
|
+
isAlive = false;
|
|
157
|
+
} else {
|
|
158
|
+
debug(`Resurrect: connection '${id}' is now alive`);
|
|
159
|
+
this.markAlive(connection);
|
|
160
|
+
}
|
|
161
|
+
this.emit('resurrect', null, {
|
|
162
|
+
strategy: 'ping',
|
|
163
|
+
name: opts.name,
|
|
164
|
+
request: { id: opts.requestId },
|
|
165
|
+
isAlive,
|
|
166
|
+
connection,
|
|
167
|
+
});
|
|
168
|
+
callback(isAlive, connection);
|
|
162
169
|
}
|
|
163
|
-
|
|
164
|
-
strategy: 'ping',
|
|
165
|
-
name: opts.name,
|
|
166
|
-
request: { id: opts.requestId },
|
|
167
|
-
isAlive,
|
|
168
|
-
connection
|
|
169
|
-
})
|
|
170
|
-
callback(isAlive, connection)
|
|
171
|
-
})
|
|
170
|
+
);
|
|
172
171
|
// optimistic strategy
|
|
173
172
|
} else {
|
|
174
|
-
debug(`Resurrect: optimistic resurrection for connection '${id}'`)
|
|
175
|
-
this.dead.splice(this.dead.indexOf(id), 1)
|
|
176
|
-
connection.status = Connection.statuses.ALIVE
|
|
173
|
+
debug(`Resurrect: optimistic resurrection for connection '${id}'`);
|
|
174
|
+
this.dead.splice(this.dead.indexOf(id), 1);
|
|
175
|
+
connection.status = Connection.statuses.ALIVE;
|
|
177
176
|
this.emit('resurrect', null, {
|
|
178
177
|
strategy: 'optimistic',
|
|
179
178
|
name: opts.name,
|
|
180
179
|
request: { id: opts.requestId },
|
|
181
180
|
isAlive: true,
|
|
182
|
-
connection
|
|
183
|
-
})
|
|
184
|
-
callback(true, connection) // eslint-disable-line
|
|
181
|
+
connection,
|
|
182
|
+
});
|
|
183
|
+
callback(true, connection); // eslint-disable-line
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
|
|
188
187
|
/**
|
|
189
188
|
* Returns an alive connection if present,
|
|
190
189
|
* otherwise returns a dead connection.
|
|
191
|
-
* By default it filters the `master` only nodes.
|
|
190
|
+
* By default it filters the `cluster_manager` or `master` only nodes.
|
|
192
191
|
* It uses the selector to choose which
|
|
193
192
|
* connection return.
|
|
194
193
|
*
|
|
195
194
|
* @param {object} options (filter and selector)
|
|
196
195
|
* @returns {object|null} connection
|
|
197
196
|
*/
|
|
198
|
-
getConnection
|
|
199
|
-
const filter = opts.filter || (() => true)
|
|
200
|
-
const selector = opts.selector || (c => c[0])
|
|
197
|
+
getConnection(opts = {}) {
|
|
198
|
+
const filter = opts.filter || (() => true);
|
|
199
|
+
const selector = opts.selector || ((c) => c[0]);
|
|
201
200
|
|
|
202
201
|
this.resurrect({
|
|
203
202
|
now: opts.now,
|
|
204
203
|
requestId: opts.requestId,
|
|
205
|
-
name: opts.name
|
|
206
|
-
})
|
|
204
|
+
name: opts.name,
|
|
205
|
+
});
|
|
207
206
|
|
|
208
|
-
const noAliveConnections = this.size === this.dead.length
|
|
207
|
+
const noAliveConnections = this.size === this.dead.length;
|
|
209
208
|
|
|
210
209
|
// TODO: can we cache this?
|
|
211
|
-
const connections = []
|
|
210
|
+
const connections = [];
|
|
212
211
|
for (let i = 0; i < this.size; i++) {
|
|
213
|
-
const connection = this.connections[i]
|
|
212
|
+
const connection = this.connections[i];
|
|
214
213
|
if (noAliveConnections || connection.status === Connection.statuses.ALIVE) {
|
|
215
214
|
if (filter(connection) === true) {
|
|
216
|
-
connections.push(connection)
|
|
215
|
+
connections.push(connection);
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
219
|
|
|
221
|
-
if (connections.length === 0) return null
|
|
220
|
+
if (connections.length === 0) return null;
|
|
222
221
|
|
|
223
|
-
return selector(connections)
|
|
222
|
+
return selector(connections);
|
|
224
223
|
}
|
|
225
224
|
|
|
226
225
|
/**
|
|
@@ -228,11 +227,11 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
228
227
|
*
|
|
229
228
|
* @returns {ConnectionPool}
|
|
230
229
|
*/
|
|
231
|
-
empty
|
|
230
|
+
empty(callback) {
|
|
232
231
|
super.empty(() => {
|
|
233
|
-
this.dead = []
|
|
234
|
-
callback()
|
|
235
|
-
})
|
|
232
|
+
this.dead = [];
|
|
233
|
+
callback();
|
|
234
|
+
});
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
/**
|
|
@@ -241,17 +240,17 @@ class ConnectionPool extends BaseConnectionPool {
|
|
|
241
240
|
* @param {array} array of connections
|
|
242
241
|
* @returns {ConnectionPool}
|
|
243
242
|
*/
|
|
244
|
-
update
|
|
245
|
-
super.update(connections)
|
|
246
|
-
this.dead = []
|
|
247
|
-
return this
|
|
243
|
+
update(connections) {
|
|
244
|
+
super.update(connections);
|
|
245
|
+
this.dead = [];
|
|
246
|
+
return this;
|
|
248
247
|
}
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
ConnectionPool.resurrectStrategies = {
|
|
252
251
|
none: 0,
|
|
253
252
|
ping: 1,
|
|
254
|
-
optimistic: 2
|
|
255
|
-
}
|
|
253
|
+
optimistic: 2,
|
|
254
|
+
};
|
|
256
255
|
|
|
257
|
-
module.exports = ConnectionPool
|
|
256
|
+
module.exports = ConnectionPool;
|
package/lib/pool/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
2
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
*
|
|
4
5
|
* The OpenSearch Contributors require contributions made to
|
|
5
6
|
* this file be licensed under the Apache-2.0 license or a
|
|
6
7
|
* compatible open source license.
|
|
7
8
|
*
|
|
8
|
-
* Modifications Copyright OpenSearch Contributors. See
|
|
9
|
-
* GitHub history for details.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
/*
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
|
|
31
30
|
/// <reference types="node" />
|
|
32
31
|
|
|
33
|
-
import { URL } from 'url'
|
|
32
|
+
import { URL } from 'url';
|
|
34
33
|
import { SecureContextOptions } from 'tls';
|
|
35
34
|
import Connection, { AgentOptions } from '../Connection';
|
|
36
35
|
import { nodeFilterFn, nodeSelectorFn } from '../Transport';
|
|
@@ -79,7 +78,6 @@ interface ResurrectEvent {
|
|
|
79
78
|
};
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
|
|
83
81
|
declare class BaseConnectionPool {
|
|
84
82
|
connections: Connection[];
|
|
85
83
|
size: number;
|
|
@@ -109,7 +107,7 @@ declare class BaseConnectionPool {
|
|
|
109
107
|
/**
|
|
110
108
|
* Returns an alive connection if present,
|
|
111
109
|
* otherwise returns a dead connection.
|
|
112
|
-
* By default it filters the `master` only nodes.
|
|
110
|
+
* By default it filters the `cluster_manager` or `master` only nodes.
|
|
113
111
|
* It uses the selector to choose which
|
|
114
112
|
* connection return.
|
|
115
113
|
*
|
|
@@ -181,11 +179,14 @@ declare class ConnectionPool extends BaseConnectionPool {
|
|
|
181
179
|
* @param {object} { now, requestId, name }
|
|
182
180
|
* @param {function} callback (isAlive, connection)
|
|
183
181
|
*/
|
|
184
|
-
resurrect(
|
|
182
|
+
resurrect(
|
|
183
|
+
opts: resurrectOptions,
|
|
184
|
+
callback?: (isAlive: boolean | null, connection: Connection | null) => void
|
|
185
|
+
): void;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
declare class CloudConnectionPool extends BaseConnectionPool {
|
|
188
|
-
cloudConnection: Connection | null
|
|
189
|
+
cloudConnection: Connection | null;
|
|
189
190
|
constructor(opts?: BaseConnectionPoolOptions);
|
|
190
191
|
getConnection(): Connection | null;
|
|
191
192
|
}
|
|
@@ -211,5 +212,5 @@ export {
|
|
|
211
212
|
// Classes
|
|
212
213
|
BaseConnectionPool,
|
|
213
214
|
ConnectionPool,
|
|
214
|
-
CloudConnectionPool
|
|
215
|
+
CloudConnectionPool,
|
|
215
216
|
};
|
package/lib/pool/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
+
* Copyright OpenSearch Contributors
|
|
2
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
3
4
|
*
|
|
4
5
|
* The OpenSearch Contributors require contributions made to
|
|
5
6
|
* this file be licensed under the Apache-2.0 license or a
|
|
6
7
|
* compatible open source license.
|
|
7
8
|
*
|
|
8
|
-
* Modifications Copyright OpenSearch Contributors. See
|
|
9
|
-
* GitHub history for details.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
/*
|
|
@@ -28,14 +27,14 @@
|
|
|
28
27
|
* under the License.
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
|
-
'use strict'
|
|
30
|
+
'use strict';
|
|
32
31
|
|
|
33
|
-
const BaseConnectionPool = require('./BaseConnectionPool')
|
|
34
|
-
const ConnectionPool = require('./ConnectionPool')
|
|
35
|
-
const CloudConnectionPool = require('./CloudConnectionPool')
|
|
32
|
+
const BaseConnectionPool = require('./BaseConnectionPool');
|
|
33
|
+
const ConnectionPool = require('./ConnectionPool');
|
|
34
|
+
const CloudConnectionPool = require('./CloudConnectionPool');
|
|
36
35
|
|
|
37
36
|
module.exports = {
|
|
38
37
|
BaseConnectionPool,
|
|
39
38
|
ConnectionPool,
|
|
40
|
-
CloudConnectionPool
|
|
41
|
-
}
|
|
39
|
+
CloudConnectionPool,
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -6,12 +6,24 @@
|
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"require": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
9
10
|
"import": "./index.mjs"
|
|
10
11
|
},
|
|
12
|
+
"./aws": "./lib/aws/index.js",
|
|
11
13
|
"./": "./"
|
|
12
14
|
},
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
"*": {
|
|
17
|
+
".": [
|
|
18
|
+
"index.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"aws": [
|
|
21
|
+
"./lib/aws/index.d.ts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
13
25
|
"homepage": "https://www.opensearch.org/",
|
|
14
|
-
"version": "
|
|
26
|
+
"version": "2.1.0",
|
|
15
27
|
"versionCanary": "7.10.0-canary.6",
|
|
16
28
|
"keywords": [
|
|
17
29
|
"opensearch",
|
|
@@ -23,20 +35,20 @@
|
|
|
23
35
|
"index"
|
|
24
36
|
],
|
|
25
37
|
"scripts": {
|
|
26
|
-
"test": "npm run lint && tap test/{unit,acceptance}/{
|
|
27
|
-
"test:unit": "tap test/unit/{
|
|
38
|
+
"test": "npm run lint && tap test/{unit,acceptance}/{*,**/*,**/**/*}.test.js && npm run test:types",
|
|
39
|
+
"test:unit": "tap test/unit/{*,**/*,**/**/*}.test.js",
|
|
28
40
|
"test:acceptance": "tap test/acceptance/*.test.js",
|
|
29
41
|
"test:integration": "node test/integration/index.js",
|
|
30
42
|
"test:integration:helpers": "tap test/integration/helpers/*.test.js",
|
|
31
43
|
"test:integration:helpers-secure": "tap test/integration/helpers-secure/*.test.js",
|
|
32
44
|
"test:types": "tsd",
|
|
33
|
-
"test:coverage-90": "tap test/{unit,acceptance}/{
|
|
34
|
-
"test:coverage-report": "tap test/{unit,acceptance}/{
|
|
35
|
-
"test:coverage-ui": "tap test/{unit,acceptance}/{
|
|
36
|
-
"lint": "
|
|
37
|
-
"lint:fix": "
|
|
45
|
+
"test:coverage-90": "tap test/{unit,acceptance}/{*,**/*,**/**/*}.test.js --coverage --branches=90 --functions=90 --lines=90 --statements=90 --nyc-arg=\"--exclude=api\"",
|
|
46
|
+
"test:coverage-report": "tap test/{unit,acceptance}/{*,**/*,**/**/*}.test.js --coverage --branches=90 --functions=90 --lines=90 --statements=90 --nyc-arg=\"--exclude=api\" && nyc report --reporter=text-lcov > coverage.lcov",
|
|
47
|
+
"test:coverage-ui": "tap test/{unit,acceptance}/{*,**/*,**/**/*}.test.js --coverage --coverage-report=html --nyc-arg=\"--exclude=api\"",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"lint:fix": "eslint . --fix",
|
|
38
50
|
"license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause'",
|
|
39
|
-
"build-esm": "npx gen-esm-wrapper . index.mjs &&
|
|
51
|
+
"build-esm": "npx gen-esm-wrapper . index.mjs && eslint --fix index.mjs"
|
|
40
52
|
},
|
|
41
53
|
"author": "opensearch-project",
|
|
42
54
|
"original-author": {
|
|
@@ -44,40 +56,49 @@
|
|
|
44
56
|
"company": "Elasticsearch BV"
|
|
45
57
|
},
|
|
46
58
|
"devDependencies": {
|
|
59
|
+
"@aws-sdk/types": "^3.160.0",
|
|
47
60
|
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
|
|
48
61
|
"@types/node": "^15.3.1",
|
|
62
|
+
"babel-eslint": "^10.1.0",
|
|
49
63
|
"convert-hrtime": "^5.0.0",
|
|
50
64
|
"cross-zip": "^4.0.0",
|
|
51
65
|
"dedent": "^0.7.0",
|
|
52
66
|
"deepmerge": "^4.2.2",
|
|
53
67
|
"dezalgo": "^1.0.3",
|
|
68
|
+
"eslint": "^7.32.0",
|
|
69
|
+
"eslint-config-prettier": "^8.5.0",
|
|
70
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
54
71
|
"fast-deep-equal": "^3.1.3",
|
|
55
72
|
"into-stream": "^6.0.0",
|
|
56
73
|
"js-yaml": "^4.1.0",
|
|
57
74
|
"license-checker": "^25.0.1",
|
|
58
75
|
"minimist": "^1.2.5",
|
|
59
|
-
"node-fetch": "^2.
|
|
76
|
+
"node-fetch": "^3.2.10",
|
|
60
77
|
"ora": "^5.4.0",
|
|
78
|
+
"prettier": "^2.6.2",
|
|
61
79
|
"pretty-hrtime": "^1.0.3",
|
|
62
80
|
"proxy": "^1.0.2",
|
|
63
81
|
"rimraf": "^3.0.2",
|
|
64
82
|
"semver": "^7.3.5",
|
|
65
|
-
"simple-git": "^
|
|
83
|
+
"simple-git": "^3.5.0",
|
|
66
84
|
"simple-statistics": "^7.7.0",
|
|
67
85
|
"split2": "^3.2.2",
|
|
68
|
-
"standard": "^16.0.3",
|
|
69
86
|
"stoppable": "^1.1.0",
|
|
70
|
-
"tap": "^
|
|
71
|
-
"tsd": "^0.
|
|
87
|
+
"tap": "^16.3.0",
|
|
88
|
+
"tsd": "^0.24.1",
|
|
72
89
|
"workq": "^3.0.0",
|
|
73
90
|
"xmlbuilder2": "^2.4.1"
|
|
74
91
|
},
|
|
75
92
|
"dependencies": {
|
|
93
|
+
"aws4": "^1.11.0",
|
|
76
94
|
"debug": "^4.3.1",
|
|
77
95
|
"hpagent": "^0.1.1",
|
|
78
96
|
"ms": "^2.1.3",
|
|
79
97
|
"secure-json-parse": "^2.4.0"
|
|
80
98
|
},
|
|
99
|
+
"resolutions": {
|
|
100
|
+
"**/strip-ansi": "^6.0.1"
|
|
101
|
+
},
|
|
81
102
|
"license": "Apache-2.0",
|
|
82
103
|
"repository": {
|
|
83
104
|
"type": "git",
|
|
@@ -87,7 +108,8 @@
|
|
|
87
108
|
"url": "https://github.com/opensearch-project/opensearch-js/issues"
|
|
88
109
|
},
|
|
89
110
|
"engines": {
|
|
90
|
-
"node": ">=10"
|
|
111
|
+
"node": ">=10",
|
|
112
|
+
"yarn": "^1.22.10"
|
|
91
113
|
},
|
|
92
114
|
"tsd": {
|
|
93
115
|
"directory": "test/types"
|