Skip to content

Commit

Permalink
[CCI] feat: add missing createConnection type (opensearch-project#490)
Browse files Browse the repository at this point in the history
* feat: add missing createConnection type

Signed-off-by: Timur Bolotov <bolotovtmr@gmail.com>
  • Loading branch information
timursaurus authored and AMoo-Miki committed Jul 12, 2023
1 parent c87780b commit e8d88fd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Removed unnecessary `data` argument when invoking `OpenSearchClientError` ([#421](https://github.com/opensearch-project/opensearch-js/pull/421))
- Fixed typos in `ConnectionPool` ([#427](https://github.com/opensearch-project/opensearch-js/pull/427))
- Added the solution for the possible error during yarn installation on Windows OS ([#435](https://github.com/opensearch-project/opensearch-js/issues/435))
- Added missing `createConnection` method type definition in `BaseConnectionPool` )([#490](https://github.com/opensearch-project/opensearch-js/pull/490))

### Dependencies

Expand Down
7 changes: 7 additions & 0 deletions lib/pool/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ declare class BaseConnectionPool {
* @returns {object|null} connection
*/
getConnection(opts?: getConnectionOptions): Connection | null;

/**
* Creates a new connection instance.
* @param {object|string} opts
* @returns {Connection}
*/
createConnection(opts: ConnectionOptions | string): Connection;
/**
* Adds a new connection to the pool.
*
Expand Down
1 change: 1 addition & 0 deletions test/types/connection-pool.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import { ConnectionOptions } from '../../lib/Connection';
now: Date.now(),
})
);
expectType<Connection>(pool.createConnection({ url: new URL('url') }));
expectType<Connection>(pool.addConnection({ url: new URL('url') }));
expectType<BaseConnectionPool>(pool.removeConnection(new Connection()));
expectType<void>(pool.empty());
Expand Down

0 comments on commit e8d88fd

Please sign in to comment.