@opensearch-project/opensearch 2.2.0 → 2.3.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.
@@ -31,7 +31,7 @@
31
31
 
32
32
  import { URL } from 'url';
33
33
  import { SecureContextOptions } from 'tls';
34
- import Connection, { AgentOptions } from '../Connection';
34
+ import Connection, { AgentOptions, ConnectionOptions } from '../Connection';
35
35
  import { nodeFilterFn, nodeSelectorFn } from '../Transport';
36
36
 
37
37
  interface BaseConnectionPoolOptions {
@@ -115,13 +115,20 @@ declare class BaseConnectionPool {
115
115
  * @returns {object|null} connection
116
116
  */
117
117
  getConnection(opts?: getConnectionOptions): Connection | null;
118
+
119
+ /**
120
+ * Creates a new connection instance.
121
+ * @param {object|string} opts
122
+ * @returns {Connection}
123
+ */
124
+ createConnection(opts: ConnectionOptions | string): Connection;
118
125
  /**
119
126
  * Adds a new connection to the pool.
120
127
  *
121
128
  * @param {object|string} host
122
129
  * @returns {ConnectionPool}
123
130
  */
124
- addConnection(opts: any): Connection;
131
+ addConnection(opts: string | ConnectionOptions | ConnectionOptions[]): Connection;
125
132
  /**
126
133
  * Removes a new connection to the pool.
127
134
  *
@@ -132,16 +139,15 @@ declare class BaseConnectionPool {
132
139
  /**
133
140
  * Empties the connection pool.
134
141
  *
135
- * @returns {ConnectionPool}
136
142
  */
137
- empty(): this;
143
+ empty(callback?: () => void): void;
138
144
  /**
139
145
  * Update the ConnectionPool with new connections.
140
146
  *
141
147
  * @param {array} array of connections
142
148
  * @returns {ConnectionPool}
143
149
  */
144
- update(connections: any[]): this;
150
+ update(connections: Connection[]): this;
145
151
  /**
146
152
  * Transforms the nodes objects to a host object.
147
153
  *
@@ -155,7 +161,7 @@ declare class BaseConnectionPool {
155
161
  * @param {string} url
156
162
  * @returns {object} host
157
163
  */
158
- urlToHost(url: string): { url: URL };
164
+ urlToHost(url: string): ConnectionOptions;
159
165
  }
160
166
 
161
167
  declare class ConnectionPool extends BaseConnectionPool {
@@ -183,12 +189,35 @@ declare class ConnectionPool extends BaseConnectionPool {
183
189
  opts: resurrectOptions,
184
190
  callback?: (isAlive: boolean | null, connection: Connection | null) => void
185
191
  ): void;
192
+
193
+ /**
194
+ * Empties the connection pool.
195
+ */
196
+ empty(callback?: () => void): void;
197
+ /**
198
+ * Update the ConnectionPool with new connections.
199
+ *
200
+ * @param {array} array of connections
201
+ * @returns {ConnectionPool}
202
+ */
203
+ update(connections: Connection[]): this;
186
204
  }
187
205
 
188
206
  declare class CloudConnectionPool extends BaseConnectionPool {
189
207
  cloudConnection: Connection | null;
190
208
  constructor(opts?: BaseConnectionPoolOptions);
191
209
  getConnection(): Connection | null;
210
+ /**
211
+ * Empties the connection pool.
212
+ */
213
+ empty(callback?: () => void): void;
214
+ /**
215
+ * Update the ConnectionPool with new connections.
216
+ *
217
+ * @param {array} array of connections
218
+ * @returns {ConnectionPool}
219
+ */
220
+ update(connections: Connection[]): this;
192
221
  }
193
222
 
194
223
  declare function defaultNodeFilter(node: Connection): boolean;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "import": "./index.mjs"
11
11
  },
12
12
  "./aws": "./lib/aws/index.js",
13
- "./": "./"
13
+ "./*": "./*"
14
14
  },
15
15
  "typesVersions": {
16
16
  "*": {
@@ -23,7 +23,7 @@
23
23
  }
24
24
  },
25
25
  "homepage": "https://www.opensearch.org/",
26
- "version": "2.2.0",
26
+ "version": "2.3.0",
27
27
  "versionCanary": "7.10.0-canary.6",
28
28
  "keywords": [
29
29
  "opensearch",
@@ -59,7 +59,7 @@
59
59
  "@aws-sdk/types": "^3.160.0",
60
60
  "@babel/eslint-parser": "^7.19.1",
61
61
  "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
62
- "@types/node": "^18.11.18",
62
+ "@types/node": "^18.15.3",
63
63
  "convert-hrtime": "^5.0.0",
64
64
  "cross-zip": "^4.0.0",
65
65
  "dedent": "^0.7.0",
@@ -75,18 +75,18 @@
75
75
  "license-checker": "^25.0.1",
76
76
  "minimist": "^1.2.5",
77
77
  "node-fetch": "^3.2.10",
78
- "ora": "^5.4.0",
78
+ "ora": "^6.1.2",
79
79
  "prettier": "^2.6.2",
80
80
  "pretty-hrtime": "^1.0.3",
81
81
  "proxy": "^1.0.2",
82
- "rimraf": "^4.1.1",
82
+ "rimraf": "^5.0.0",
83
83
  "semver": "^7.3.5",
84
84
  "simple-git": "^3.15.0",
85
85
  "simple-statistics": "^7.7.0",
86
86
  "split2": "^4.1.0",
87
87
  "stoppable": "^1.1.0",
88
88
  "tap": "^16.3.0",
89
- "tsd": "^0.24.1",
89
+ "tsd": "^0.27.0",
90
90
  "workq": "^3.0.0",
91
91
  "xmlbuilder2": "^3.0.2"
92
92
  },