Skip to content

Commit

Permalink
feat(types): Export ConnectionAuthentication and ConnectionOptions (
Browse files Browse the repository at this point in the history
  • Loading branch information
72636c committed Apr 10, 2024
1 parent 7e84a2f commit d37e167
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/connection.ts
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.');
Expand Down
6 changes: 4 additions & 2 deletions 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';

Expand Down Expand Up @@ -30,5 +30,7 @@ export {
};

export type {
ConnectionConfiguration
ConnectionAuthentication,
ConnectionConfiguration,
ConnectionOptions
};

0 comments on commit d37e167

Please sign in to comment.