From 576d9b48c92ad918e884a3875a5c313b66e5fd41 Mon Sep 17 00:00:00 2001 From: lutovich Date: Tue, 11 Jul 2017 18:20:43 +0200 Subject: [PATCH] Add TypeScript declaration for LB strategy --- test/types/v1/driver.test.ts | 3 +++ types/v1/driver.d.ts | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/types/v1/driver.test.ts b/test/types/v1/driver.test.ts index 1a05f15b6..8a92f1443 100644 --- a/test/types/v1/driver.test.ts +++ b/test/types/v1/driver.test.ts @@ -21,6 +21,7 @@ import Driver, { AuthToken, Config, EncryptionLevel, + LoadBalancingStrategy, READ, SessionMode, TrustStrategy, @@ -54,6 +55,8 @@ const trustedCertificates: undefined | string[] = config.trustedCertificates; const knownHosts: undefined | string = config.knownHosts; const connectionPoolSize: undefined | number = config.connectionPoolSize; const maxTransactionRetryTime: undefined | number = config.maxTransactionRetryTime; +const loadBalancingStrategy1: string = config.loadBalancingStrategy; +const loadBalancingStrategy2: LoadBalancingStrategy = config.loadBalancingStrategy; const sessionMode: SessionMode = dummy; const sessionModeStr: string = sessionMode; diff --git a/types/v1/driver.d.ts b/types/v1/driver.d.ts index c669502f3..3bbc59fe4 100644 --- a/types/v1/driver.d.ts +++ b/types/v1/driver.d.ts @@ -36,6 +36,8 @@ declare type TrustStrategy = "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES" | "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES"; +declare type LoadBalancingStrategy = "least_connected" | "round_robin"; + declare interface Config { encrypted?: boolean | EncryptionLevel; trust?: TrustStrategy; @@ -43,6 +45,7 @@ declare interface Config { knownHosts?: string; connectionPoolSize?: number; maxTransactionRetryTime?: number; + loadBalancingStrategy?: LoadBalancingStrategy; } declare type SessionMode = "READ" | "WRITE"; @@ -56,6 +59,6 @@ declare interface Driver { close(): void; } -export {Driver, READ, WRITE, AuthToken, Config, EncryptionLevel, TrustStrategy, SessionMode} +export {Driver, READ, WRITE, AuthToken, Config, EncryptionLevel, TrustStrategy, LoadBalancingStrategy, SessionMode} export default Driver;