-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathIDBSQLClient.ts
More file actions
69 lines (61 loc) · 1.72 KB
/
IDBSQLClient.ts
File metadata and controls
69 lines (61 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import IDBSQLLogger from './IDBSQLLogger';
import IDBSQLSession from './IDBSQLSession';
import IAuthentication from '../connection/contracts/IAuthentication';
import { ProxyOptions } from '../connection/contracts/IConnectionOptions';
import OAuthPersistence from '../connection/auth/DatabricksOAuth/OAuthPersistence';
import ITokenProvider from '../connection/auth/tokenProvider/ITokenProvider';
export interface ClientOptions {
logger?: IDBSQLLogger;
}
/**
* Type for the callback function that retrieves tokens from external sources.
*/
export type TokenCallback = () => Promise<string>;
type AuthOptions =
| {
authType?: 'access-token';
token: string;
}
| {
authType: 'databricks-oauth';
persistence?: OAuthPersistence;
azureTenantId?: string;
oauthClientId?: string;
oauthClientSecret?: string;
useDatabricksOAuthInAzure?: boolean;
}
| {
authType: 'custom';
provider: IAuthentication;
}
| {
authType: 'token-provider';
tokenProvider: ITokenProvider;
}
| {
authType: 'external-token';
getToken: TokenCallback;
}
| {
authType: 'static-token';
staticToken: string;
};
export type ConnectionOptions = {
host: string;
port?: number;
path: string;
userAgentEntry?: string;
socketTimeout?: number;
proxy?: ProxyOptions;
enableMetricViewMetadata?: boolean;
} & AuthOptions;
export interface OpenSessionRequest {
initialCatalog?: string;
initialSchema?: string;
configuration?: { [key: string]: string };
}
export default interface IDBSQLClient {
connect(options: ConnectionOptions): Promise<IDBSQLClient>;
openSession(request?: OpenSessionRequest): Promise<IDBSQLSession>;
close(): Promise<void>;
}