Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): Export ConnectionAuthentication and ConnectionOptions #1615

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/connection.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
};
Loading