diff --git a/src/connection.ts b/src/connection.ts index f41e0b509..6f368d163 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -328,9 +328,11 @@ interface ErrorWithCode extends Error { code?: string; } +export type ConnectionAuthentication = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication; + interface InternalConnectionConfig { server: string; - authentication: DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryServicePrincipalSecret | AzureActiveDirectoryDefaultAuthentication; + authentication: ConnectionAuthentication; options: InternalConnectionOptions; } @@ -1065,7 +1067,7 @@ class Connection extends EventEmitter { this.fedAuthRequired = false; - let authentication: InternalConnectionConfig['authentication']; + let authentication: ConnectionAuthentication; if (config.authentication !== undefined) { if (typeof config.authentication !== 'object' || config.authentication === null) { throw new TypeError('The "config.authentication" property must be of type Object.'); diff --git a/src/tedious.ts b/src/tedious.ts index 056a8e8e0..723eeefaa 100644 --- a/src/tedious.ts +++ b/src/tedious.ts @@ -1,5 +1,5 @@ import BulkLoad from './bulk-load'; -import Connection, { type ConnectionConfiguration } from './connection'; +import Connection, { type ConnectionAuthentication, type ConnectionConfiguration, type ConnectionOptions } from './connection'; import Request from './request'; import { name } from './library'; @@ -30,5 +30,7 @@ export { }; export type { - ConnectionConfiguration + ConnectionAuthentication, + ConnectionConfiguration, + ConnectionOptions };