From 395f9547bcf3b617ff7632b68a5eb4515f5e879d Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Wed, 12 Apr 2023 22:31:04 +0600 Subject: [PATCH 1/2] feat: add missing createConnection type Signed-off-by: Timur Bolotov --- lib/pool/index.d.ts | 7 +++++++ test/types/connection-pool.test-d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/pool/index.d.ts b/lib/pool/index.d.ts index 97cbde41f..9a1296673 100644 --- a/lib/pool/index.d.ts +++ b/lib/pool/index.d.ts @@ -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. * diff --git a/test/types/connection-pool.test-d.ts b/test/types/connection-pool.test-d.ts index e2df1334f..e4acf1988 100644 --- a/test/types/connection-pool.test-d.ts +++ b/test/types/connection-pool.test-d.ts @@ -60,6 +60,7 @@ import { ConnectionOptions } from '../../lib/Connection'; now: Date.now(), }) ); + expectType(pool.createConnection({ url: new URL('url') })); expectType(pool.addConnection({ url: new URL('url') })); expectType(pool.removeConnection(new Connection())); expectType(pool.empty()); From d04d5633862313d6e402a639d2257b1a9c0456b8 Mon Sep 17 00:00:00 2001 From: Timur Bolotov Date: Thu, 13 Apr 2023 21:50:59 +0600 Subject: [PATCH 2/2] chore: add changelog Signed-off-by: Timur Bolotov --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb3acb456..34f3eaf50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,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