@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.
Files changed (94) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +31 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +13 -31
  6. package/CHANGELOG.md +24 -0
  7. package/COMPATIBILITY.md +27 -0
  8. package/DEVELOPER_GUIDE.md +22 -5
  9. package/MAINTAINERS.md +15 -70
  10. package/Makefile +2 -12
  11. package/README.md +19 -123
  12. package/RELEASING.md +3 -3
  13. package/SECURITY.md +1 -1
  14. package/USER_GUIDE.md +197 -0
  15. package/api/api/bulk.js +54 -28
  16. package/api/api/cat.js +355 -266
  17. package/api/api/clear_scroll.js +18 -19
  18. package/api/api/cluster.js +367 -221
  19. package/api/api/count.js +56 -26
  20. package/api/api/create.js +51 -26
  21. package/api/api/dangling_indices.js +96 -53
  22. package/api/api/delete.js +50 -24
  23. package/api/api/delete_by_query.js +89 -27
  24. package/api/api/delete_by_query_rethrottle.js +34 -21
  25. package/api/api/delete_script.js +32 -19
  26. package/api/api/exists.js +56 -24
  27. package/api/api/exists_source.js +61 -29
  28. package/api/api/explain.js +61 -24
  29. package/api/api/features.js +57 -37
  30. package/api/api/field_caps.js +37 -20
  31. package/api/api/get.js +56 -24
  32. package/api/api/get_script.js +31 -19
  33. package/api/api/get_script_context.js +16 -17
  34. package/api/api/get_script_languages.js +16 -17
  35. package/api/api/get_source.js +56 -24
  36. package/api/api/index.js +61 -30
  37. package/api/api/indices.js +1069 -859
  38. package/api/api/info.js +16 -17
  39. package/api/api/ingest.js +133 -98
  40. package/api/api/mget.js +51 -28
  41. package/api/api/msearch.js +50 -28
  42. package/api/api/msearch_template.js +54 -28
  43. package/api/api/mtermvectors.js +49 -26
  44. package/api/api/nodes.js +282 -156
  45. package/api/api/ping.js +16 -17
  46. package/api/api/put_script.js +41 -27
  47. package/api/api/rank_eval.js +38 -22
  48. package/api/api/reindex.js +39 -19
  49. package/api/api/reindex_rethrottle.js +33 -21
  50. package/api/api/render_search_template.js +19 -20
  51. package/api/api/scripts_painless_execute.js +16 -17
  52. package/api/api/scroll.js +32 -19
  53. package/api/api/search.js +109 -26
  54. package/api/api/search_shards.js +37 -20
  55. package/api/api/search_template.js +65 -28
  56. package/api/api/shutdown.js +67 -56
  57. package/api/api/snapshot.js +348 -226
  58. package/api/api/tasks.js +66 -48
  59. package/api/api/terms_enum.js +18 -19
  60. package/api/api/termvectors.js +58 -28
  61. package/api/api/update.js +65 -26
  62. package/api/api/update_by_query.js +90 -25
  63. package/api/api/update_by_query_rethrottle.js +34 -21
  64. package/api/index.js +268 -181
  65. package/api/new.d.ts +2043 -531
  66. package/api/opensearch_dashboards.d.ts +240 -238
  67. package/api/requestParams.d.ts +302 -71
  68. package/api/types.d.ts +6205 -5721
  69. package/api/utils.js +23 -24
  70. package/codecov.yml +2 -2
  71. package/index.d.ts +5203 -1037
  72. package/index.js +154 -143
  73. package/index.mjs +10 -11
  74. package/jenkins/release.JenkinsFile +11 -0
  75. package/lib/Connection.d.ts +38 -28
  76. package/lib/Connection.js +166 -170
  77. package/lib/Helpers.d.ts +108 -68
  78. package/lib/Helpers.js +401 -378
  79. package/lib/Serializer.d.ts +3 -4
  80. package/lib/Serializer.js +40 -41
  81. package/lib/Transport.d.ts +39 -15
  82. package/lib/Transport.js +381 -337
  83. package/lib/aws/AwsSigv4Signer.js +167 -0
  84. package/lib/aws/errors.js +24 -0
  85. package/lib/aws/index.d.ts +39 -0
  86. package/lib/aws/index.js +19 -0
  87. package/lib/errors.d.ts +26 -9
  88. package/lib/errors.js +76 -73
  89. package/lib/pool/BaseConnectionPool.js +101 -99
  90. package/lib/pool/CloudConnectionPool.js +17 -18
  91. package/lib/pool/ConnectionPool.js +106 -107
  92. package/lib/pool/index.d.ts +9 -8
  93. package/lib/pool/index.js +7 -8
  94. package/package.json +37 -15
package/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,121 +27,131 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
32
-
33
- const { EventEmitter } = require('events')
34
- const { URL } = require('url')
35
- const debug = require('debug')('opensearch')
36
- const Transport = require('./lib/Transport')
37
- const Connection = require('./lib/Connection')
38
- const { ConnectionPool, CloudConnectionPool } = require('./lib/pool')
39
- const Helpers = require('./lib/Helpers')
40
- const Serializer = require('./lib/Serializer')
41
- const errors = require('./lib/errors')
42
- const { ConfigurationError } = errors
43
- const { prepareHeaders } = Connection.internals
44
- let clientVersion = require('./package.json').version
30
+ 'use strict';
31
+
32
+ const { EventEmitter } = require('events');
33
+ const { URL } = require('url');
34
+ const debug = require('debug')('opensearch');
35
+ const Transport = require('./lib/Transport');
36
+ const Connection = require('./lib/Connection');
37
+ const { ConnectionPool, CloudConnectionPool } = require('./lib/pool');
38
+ const Helpers = require('./lib/Helpers');
39
+ const Serializer = require('./lib/Serializer');
40
+ const errors = require('./lib/errors');
41
+ const { ConfigurationError } = errors;
42
+ const { prepareHeaders } = Connection.internals;
43
+ let clientVersion = require('./package.json').version;
45
44
  /* istanbul ignore next */
46
45
  if (clientVersion.includes('-')) {
47
46
  // clean prerelease
48
- clientVersion = clientVersion.slice(0, clientVersion.indexOf('-')) + 'p'
47
+ clientVersion = clientVersion.slice(0, clientVersion.indexOf('-')) + 'p';
49
48
  }
50
49
 
51
- const kInitialOptions = Symbol('opensearchjs-initial-options')
52
- const kChild = Symbol('opensearchjs-child')
53
- const kExtensions = Symbol('opensearchjs-extensions')
54
- const kEventEmitter = Symbol('opensearchjs-event-emitter')
50
+ const kInitialOptions = Symbol('opensearchjs-initial-options');
51
+ const kChild = Symbol('opensearchjs-child');
52
+ const kExtensions = Symbol('opensearchjs-extensions');
53
+ const kEventEmitter = Symbol('opensearchjs-event-emitter');
55
54
 
56
- const OpenSearchAPI = require('./api')
55
+ const OpenSearchAPI = require('./api');
57
56
 
58
57
  class Client extends OpenSearchAPI {
59
- constructor (opts = {}) {
60
- super({ ConfigurationError })
58
+ constructor(opts = {}) {
59
+ super({ ConfigurationError });
61
60
  if (opts.cloud && opts[kChild] === undefined) {
62
- const { id, username, password } = opts.cloud
61
+ const { id, username, password } = opts.cloud;
63
62
  // the cloud id is `cluster-name:base64encodedurl`
64
63
  // the url is a string divided by two '$', the first is the cloud url
65
64
  // the second the opensearch instance, the third the opensearchDashboards instance
66
- const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$')
65
+ const cloudUrls = Buffer.from(id.split(':')[1], 'base64').toString().split('$');
67
66
 
68
67
  // TODO: remove username and password here in 8
69
68
  if (username && password) {
70
- opts.auth = Object.assign({}, opts.auth, { username, password })
69
+ opts.auth = Object.assign({}, opts.auth, { username, password });
71
70
  }
72
- opts.node = `https://${cloudUrls[1]}.${cloudUrls[0]}`
71
+ opts.node = `https://${cloudUrls[1]}.${cloudUrls[0]}`;
73
72
 
74
73
  // Cloud has better performances with compression enabled
75
74
  // see https://github.com/elastic/elasticsearch-py/pull/704.
76
75
  // So unless the user specifies otherwise, we enable compression.
77
- if (opts.compression == null) opts.compression = 'gzip'
78
- if (opts.suggestCompression == null) opts.suggestCompression = true
79
- if (opts.ssl == null ||
80
- (opts.ssl && opts.ssl.secureProtocol == null)) {
81
- opts.ssl = opts.ssl || {}
82
- opts.ssl.secureProtocol = 'TLSv1_2_method'
76
+ if (opts.compression == null) opts.compression = 'gzip';
77
+ if (opts.suggestCompression == null) opts.suggestCompression = true;
78
+ if (opts.ssl == null || (opts.ssl && opts.ssl.secureProtocol == null)) {
79
+ opts.ssl = opts.ssl || {};
80
+ opts.ssl.secureProtocol = 'TLSv1_2_method';
83
81
  }
84
82
  }
85
83
 
86
84
  if (!opts.node && !opts.nodes) {
87
- throw new ConfigurationError('Missing node(s) option')
85
+ throw new ConfigurationError('Missing node(s) option');
88
86
  }
89
87
 
90
88
  if (opts[kChild] === undefined) {
91
- const checkAuth = getAuth(opts.node || opts.nodes)
89
+ const checkAuth = getAuth(opts.node || opts.nodes);
92
90
  if (checkAuth && checkAuth.username && checkAuth.password) {
93
- opts.auth = Object.assign({}, opts.auth, { username: checkAuth.username, password: checkAuth.password })
91
+ opts.auth = Object.assign({}, opts.auth, {
92
+ username: checkAuth.username,
93
+ password: checkAuth.password,
94
+ });
94
95
  }
95
96
  }
96
97
 
97
- const options = opts[kChild] !== undefined
98
- ? opts[kChild].initialOptions
99
- : Object.assign({}, {
100
- Connection,
101
- Transport,
102
- Serializer,
103
- ConnectionPool: opts.cloud ? CloudConnectionPool : ConnectionPool,
104
- maxRetries: 3,
105
- requestTimeout: 30000,
106
- pingTimeout: 3000,
107
- sniffInterval: false,
108
- sniffOnStart: false,
109
- sniffEndpoint: '_nodes/_all/http',
110
- sniffOnConnectionFault: false,
111
- resurrectStrategy: 'ping',
112
- suggestCompression: false,
113
- compression: false,
114
- ssl: null,
115
- agent: null,
116
- headers: {},
117
- nodeFilter: null,
118
- nodeSelector: 'round-robin',
119
- generateRequestId: null,
120
- name: 'opensearch-js',
121
- auth: null,
122
- opaqueIdPrefix: null,
123
- context: null,
124
- proxy: null,
125
- enableMetaHeader: true,
126
- disablePrototypePoisoningProtection: false
127
- }, opts)
98
+ const options =
99
+ opts[kChild] !== undefined
100
+ ? opts[kChild].initialOptions
101
+ : Object.assign(
102
+ {},
103
+ {
104
+ Connection,
105
+ Transport,
106
+ Serializer,
107
+ ConnectionPool: opts.cloud ? CloudConnectionPool : ConnectionPool,
108
+ maxRetries: 3,
109
+ requestTimeout: 30000,
110
+ pingTimeout: 3000,
111
+ sniffInterval: false,
112
+ sniffOnStart: false,
113
+ sniffEndpoint: '_nodes/_all/http',
114
+ sniffOnConnectionFault: false,
115
+ resurrectStrategy: 'ping',
116
+ suggestCompression: false,
117
+ compression: false,
118
+ ssl: null,
119
+ agent: null,
120
+ headers: {},
121
+ nodeFilter: null,
122
+ nodeSelector: 'round-robin',
123
+ generateRequestId: null,
124
+ name: 'opensearch-js',
125
+ auth: null,
126
+ opaqueIdPrefix: null,
127
+ context: null,
128
+ proxy: null,
129
+ enableMetaHeader: true,
130
+ disablePrototypePoisoningProtection: false,
131
+ },
132
+ opts
133
+ );
128
134
 
129
135
  if (process.env.OPENSEARCH_CLIENT_APIVERSIONING === 'true') {
130
- options.headers = Object.assign({ accept: 'application/vnd.opensearch+json; compatible-with=7' }, options.headers)
136
+ options.headers = Object.assign(
137
+ { accept: 'application/vnd.opensearch+json; compatible-with=7' },
138
+ options.headers
139
+ );
131
140
  }
132
141
 
133
- this[kInitialOptions] = options
134
- this[kExtensions] = []
135
- this.name = options.name
142
+ this[kInitialOptions] = options;
143
+ this[kExtensions] = [];
144
+ this.name = options.name;
136
145
 
137
146
  if (opts[kChild] !== undefined) {
138
- this.serializer = options[kChild].serializer
139
- this.connectionPool = options[kChild].connectionPool
140
- this[kEventEmitter] = options[kChild].eventEmitter
147
+ this.serializer = options[kChild].serializer;
148
+ this.connectionPool = options[kChild].connectionPool;
149
+ this[kEventEmitter] = options[kChild].eventEmitter;
141
150
  } else {
142
- this[kEventEmitter] = new EventEmitter()
151
+ this[kEventEmitter] = new EventEmitter();
143
152
  this.serializer = new options.Serializer({
144
- disablePrototypePoisoningProtection: options.disablePrototypePoisoningProtection
145
- })
153
+ disablePrototypePoisoningProtection: options.disablePrototypePoisoningProtection,
154
+ });
146
155
  this.connectionPool = new options.ConnectionPool({
147
156
  pingTimeout: options.pingTimeout,
148
157
  resurrectStrategy: options.resurrectStrategy,
@@ -152,12 +161,13 @@ class Client extends OpenSearchAPI {
152
161
  Connection: options.Connection,
153
162
  auth: options.auth,
154
163
  emit: this[kEventEmitter].emit.bind(this[kEventEmitter]),
155
- sniffEnabled: options.sniffInterval !== false ||
164
+ sniffEnabled:
165
+ options.sniffInterval !== false ||
156
166
  options.sniffOnStart !== false ||
157
- options.sniffOnConnectionFault !== false
158
- })
167
+ options.sniffOnConnectionFault !== false,
168
+ });
159
169
  // Add the connections before initialize the Transport
160
- this.connectionPool.addConnection(options.node || options.nodes)
170
+ this.connectionPool.addConnection(options.node || options.nodes);
161
171
  }
162
172
 
163
173
  this.transport = new options.Transport({
@@ -179,142 +189,143 @@ class Client extends OpenSearchAPI {
179
189
  name: options.name,
180
190
  opaqueIdPrefix: options.opaqueIdPrefix,
181
191
  context: options.context,
182
- memoryCircuitBreaker: options.memoryCircuitBreaker
183
- })
192
+ memoryCircuitBreaker: options.memoryCircuitBreaker,
193
+ });
184
194
 
185
195
  this.helpers = new Helpers({
186
196
  client: this,
187
- maxRetries: options.maxRetries
188
- })
197
+ maxRetries: options.maxRetries,
198
+ });
189
199
  }
190
200
 
191
- get emit () {
192
- return this[kEventEmitter].emit.bind(this[kEventEmitter])
201
+ get emit() {
202
+ return this[kEventEmitter].emit.bind(this[kEventEmitter]);
193
203
  }
194
204
 
195
- get on () {
196
- return this[kEventEmitter].on.bind(this[kEventEmitter])
205
+ get on() {
206
+ return this[kEventEmitter].on.bind(this[kEventEmitter]);
197
207
  }
198
208
 
199
- get once () {
200
- return this[kEventEmitter].once.bind(this[kEventEmitter])
209
+ get once() {
210
+ return this[kEventEmitter].once.bind(this[kEventEmitter]);
201
211
  }
202
212
 
203
- get off () {
204
- return this[kEventEmitter].off.bind(this[kEventEmitter])
213
+ get off() {
214
+ return this[kEventEmitter].off.bind(this[kEventEmitter]);
205
215
  }
206
216
 
207
- extend (name, opts, fn) {
217
+ extend(name, opts, fn) {
208
218
  if (typeof opts === 'function') {
209
- fn = opts
210
- opts = {}
219
+ fn = opts;
220
+ opts = {};
211
221
  }
212
222
 
213
- let [namespace, method] = name.split('.')
223
+ let [namespace, method] = name.split('.');
214
224
  if (method == null) {
215
- method = namespace
216
- namespace = null
225
+ method = namespace;
226
+ namespace = null;
217
227
  }
218
228
 
219
229
  if (namespace != null) {
220
230
  if (this[namespace] != null && this[namespace][method] != null && opts.force !== true) {
221
- throw new Error(`The method "${method}" already exists on namespace "${namespace}"`)
231
+ throw new Error(`The method "${method}" already exists on namespace "${namespace}"`);
222
232
  }
223
233
 
224
- if (this[namespace] == null) this[namespace] = {}
234
+ if (this[namespace] == null) this[namespace] = {};
225
235
  this[namespace][method] = fn({
226
236
  makeRequest: this.transport.request.bind(this.transport),
227
237
  result: { body: null, statusCode: null, headers: null, warnings: null },
228
- ConfigurationError
229
- })
238
+ ConfigurationError,
239
+ });
230
240
  } else {
231
241
  if (this[method] != null && opts.force !== true) {
232
- throw new Error(`The method "${method}" already exists`)
242
+ throw new Error(`The method "${method}" already exists`);
233
243
  }
234
244
 
235
245
  this[method] = fn({
236
246
  makeRequest: this.transport.request.bind(this.transport),
237
247
  result: { body: null, statusCode: null, headers: null, warnings: null },
238
- ConfigurationError
239
- })
248
+ ConfigurationError,
249
+ });
240
250
  }
241
251
 
242
- this[kExtensions].push({ name, opts, fn })
252
+ this[kExtensions].push({ name, opts, fn });
243
253
  }
244
254
 
245
- child (opts) {
255
+ child(opts) {
246
256
  // Merge the new options with the initial ones
247
- const options = Object.assign({}, this[kInitialOptions], opts)
257
+ const options = Object.assign({}, this[kInitialOptions], opts);
248
258
  // Pass to the child client the parent instances that cannot be overriden
249
259
  options[kChild] = {
250
260
  connectionPool: this.connectionPool,
251
261
  serializer: this.serializer,
252
262
  eventEmitter: this[kEventEmitter],
253
- initialOptions: options
254
- }
263
+ initialOptions: options,
264
+ };
255
265
 
256
266
  /* istanbul ignore else */
257
267
  if (options.auth !== undefined) {
258
- options.headers = prepareHeaders(options.headers, options.auth)
268
+ options.headers = prepareHeaders(options.headers, options.auth);
259
269
  }
260
270
 
261
- const client = new Client(options)
271
+ const client = new Client(options);
262
272
  // sync compatible check
263
- const tSymbol = Object.getOwnPropertySymbols(this.transport)
264
- .filter(symbol => symbol.description === 'compatible check')[0]
265
- client.transport[tSymbol] = this.transport[tSymbol]
273
+ const tSymbol = Object.getOwnPropertySymbols(this.transport).filter(
274
+ (symbol) => symbol.description === 'compatible check'
275
+ )[0];
276
+ client.transport[tSymbol] = this.transport[tSymbol];
266
277
  // Add parent extensions
267
278
  if (this[kExtensions].length > 0) {
268
279
  this[kExtensions].forEach(({ name, opts, fn }) => {
269
- client.extend(name, opts, fn)
270
- })
280
+ client.extend(name, opts, fn);
281
+ });
271
282
  }
272
- return client
283
+ return client;
273
284
  }
274
285
 
275
- close (callback) {
286
+ close(callback) {
276
287
  if (callback == null) {
277
- return new Promise((resolve, reject) => {
278
- this.close(resolve)
279
- })
288
+ return new Promise((resolve) => {
289
+ this.close(resolve);
290
+ });
280
291
  }
281
- debug('Closing the client')
282
- this.connectionPool.empty(callback)
292
+ debug('Closing the client');
293
+ this.connectionPool.empty(callback);
283
294
  }
284
295
  }
285
296
 
286
- function getAuth (node) {
297
+ function getAuth(node) {
287
298
  if (Array.isArray(node)) {
288
299
  for (const url of node) {
289
- const auth = getUsernameAndPassword(url)
300
+ const auth = getUsernameAndPassword(url);
290
301
  if (auth.username !== '' && auth.password !== '') {
291
- return auth
302
+ return auth;
292
303
  }
293
304
  }
294
305
 
295
- return null
306
+ return null;
296
307
  }
297
308
 
298
- const auth = getUsernameAndPassword(node)
309
+ const auth = getUsernameAndPassword(node);
299
310
  if (auth.username !== '' && auth.password !== '') {
300
- return auth
311
+ return auth;
301
312
  }
302
313
 
303
- return null
314
+ return null;
304
315
 
305
- function getUsernameAndPassword (node) {
316
+ function getUsernameAndPassword(node) {
306
317
  /* istanbul ignore else */
307
318
  if (typeof node === 'string') {
308
- const { username, password } = new URL(node)
319
+ const { username, password } = new URL(node);
309
320
  return {
310
321
  username: decodeURIComponent(username),
311
- password: decodeURIComponent(password)
312
- }
322
+ password: decodeURIComponent(password),
323
+ };
313
324
  } else if (node.url instanceof URL) {
314
325
  return {
315
326
  username: decodeURIComponent(node.url.username),
316
- password: decodeURIComponent(node.url.password)
317
- }
327
+ password: decodeURIComponent(node.url.password),
328
+ };
318
329
  }
319
330
  }
320
331
  }
@@ -325,8 +336,8 @@ const events = {
325
336
  SNIFF: 'sniff',
326
337
  RESURRECT: 'resurrect',
327
338
  SERIALIZATION: 'serialization',
328
- DESERIALIZATION: 'deserialization'
329
- }
339
+ DESERIALIZATION: 'deserialization',
340
+ };
330
341
 
331
342
  module.exports = {
332
343
  Client,
@@ -335,5 +346,5 @@ module.exports = {
335
346
  Connection,
336
347
  Serializer,
337
348
  events,
338
- errors
339
- }
349
+ errors,
350
+ };
package/index.mjs 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,13 +27,13 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- import mod from './index.js'
30
+ import mod from './index.js';
32
31
 
33
- export default mod
34
- export const Client = mod.Client
35
- export const Transport = mod.Transport
36
- export const ConnectionPool = mod.ConnectionPool
37
- export const Connection = mod.Connection
38
- export const Serializer = mod.Serializer
39
- export const events = mod.events
40
- export const errors = mod.errors
32
+ export default mod;
33
+ export const Client = mod.Client;
34
+ export const Transport = mod.Transport;
35
+ export const ConnectionPool = mod.ConnectionPool;
36
+ export const Connection = mod.Connection;
37
+ export const Serializer = mod.Serializer;
38
+ export const events = mod.events;
39
+ export const errors = mod.errors;
@@ -0,0 +1,11 @@
1
+ lib = library(identifier: 'jenkins@1.1.0', retriever: modernSCM([
2
+ $class: 'GitSCMSource',
3
+ remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
4
+ ]))
5
+
6
+ standardReleasePipelineWithGenericTrigger(
7
+ tokenIdCredential: 'jenkins-opensearch-js-generic-webhook-token',
8
+ causeString: 'A tag was cut on opensearch-project/opensearch-js repository causing this workflow to run',
9
+ publishRelease: true){
10
+ publishToNpm(repository: 'https://github.com/opensearch-project/opensearch-js', tag: "$tag")
11
+ }
@@ -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
  /*
@@ -31,13 +30,13 @@
31
30
  /// <reference types="node" />
32
31
 
33
32
  import { URL } from 'url';
34
- import { inspect, InspectOptions } from 'util'
33
+ import { inspect, InspectOptions } from 'util';
35
34
  import { Readable as ReadableStream } from 'stream';
36
- import { BasicAuth } from './pool'
37
- import * as http from 'http'
38
- import * as https from 'https'
39
- import * as hpagent from 'hpagent'
40
- import { ConnectionOptions as TlsConnectionOptions } from 'tls'
35
+ import { BasicAuth } from './pool';
36
+ import * as http from 'http';
37
+ import * as https from 'https';
38
+ import * as hpagent from 'hpagent';
39
+ import { ConnectionOptions as TlsConnectionOptions } from 'tls';
41
40
 
42
41
  export declare type agentFn = (opts: ConnectionOptions) => any;
43
42
 
@@ -54,6 +53,10 @@ export interface ConnectionOptions {
54
53
  }
55
54
 
56
55
  interface ConnectionRoles {
56
+ cluster_manager?: boolean
57
+ /**
58
+ * @deprecated use cluster_manager instead
59
+ */
57
60
  master?: boolean
58
61
  data?: boolean
59
62
  ingest?: boolean
@@ -78,30 +81,37 @@ export default class Connection {
78
81
  DEAD: string;
79
82
  };
80
83
  static roles: {
81
- MASTER: string;
84
+ CLUSTER_MANAGER?: string;
85
+ /**
86
+ * @deprecated use CLUSTER_MANAGER instead
87
+ */
88
+ MASTER?: string;
82
89
  DATA: string;
83
90
  INGEST: string;
84
91
  };
85
- url: URL
86
- ssl: TlsConnectionOptions | null
87
- id: string
88
- headers: Record<string, any>
89
- status: string
90
- roles: ConnectionRoles
91
- deadCount: number
92
- resurrectTimeout: number
93
- makeRequest: any
94
- _openRequests: number
95
- _status: string
96
- _agent: http.Agent | https.Agent | hpagent.HttpProxyAgent | hpagent.HttpsProxyAgent
97
- constructor(opts?: ConnectionOptions)
98
- request(params: RequestOptions, callback: (err: Error | null, response: http.IncomingMessage | null) => void): http.ClientRequest
99
- close(): Connection
100
- setRole(role: string, enabled: boolean): Connection
101
- buildRequestObject(params: any): http.ClientRequestArgs
92
+ url: URL;
93
+ ssl: TlsConnectionOptions | null;
94
+ id: string;
95
+ headers: Record<string, any>;
96
+ status: string;
97
+ roles: ConnectionRoles;
98
+ deadCount: number;
99
+ resurrectTimeout: number;
100
+ makeRequest: any;
101
+ _openRequests: number;
102
+ _status: string;
103
+ _agent: http.Agent | https.Agent | hpagent.HttpProxyAgent | hpagent.HttpsProxyAgent;
104
+ constructor(opts?: ConnectionOptions);
105
+ request(
106
+ params: RequestOptions,
107
+ callback: (err: Error | null, response: http.IncomingMessage | null) => void
108
+ ): http.ClientRequest;
109
+ close(): Connection;
110
+ setRole(role: string, enabled: boolean): Connection;
111
+ buildRequestObject(params: any): http.ClientRequestArgs;
102
112
  // @ts-ignore
103
- [inspect.custom](object: any, options: InspectOptions): string
104
- toJSON(): any
113
+ [inspect.custom](object: any, options: InspectOptions): string;
114
+ toJSON(): any;
105
115
  }
106
116
 
107
117
  export { };