forked from ghdna/athena-express
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
53 lines (49 loc) · 1.71 KB
/
index.d.ts
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
declare module 'athena-express' {
import { S3 } from '@aws-sdk/client-s3';
import { Athena } from '@aws-sdk/client-athena';
interface ConnectionConfigInterface {
athena: typeof Athena,
s3: typeof S3,
s3Bucket: string;
getStats: boolean;
db: string,
workgroup: string,
formatJson: boolean,
retry: number,
ignoreEmpty: boolean,
encryption: Record<string, string>,
skipResults: boolean,
waitForResults: boolean,
catalog: string,
pagination: string
}
interface QueryResultsInterface<T> {
Items: T[];
DataScannedInMB: number;
QueryCostInUSD: number;
EngineExecutionTimeInMillis: number;
S3Location: string;
QueryExecutionId: string;
NextToken: string;
Count: number;
DataScannedInBytes: number;
TotalExecutionTimeInMillis: number;
QueryQueueTimeInMillis: number;
QueryPlanningTimeInMillis: number;
ServiceProcessingTimeInMillis: number;
}
interface QueryObjectInterface {
sql: string;
db: string;
}
type DirectQueryString = string;
type QueryExecutionId = string;
type OptionalQueryResultsInterface<T> = Partial<QueryResultsInterface<T>> & Pick<QueryResultsInterface<T>, 'QueryExecutionId'>;
type QueryResult<T> = OptionalQueryResultsInterface<T>;
type QueryFunc<T> = (query: QueryObjectInterface|DirectQueryString|QueryExecutionId) => Promise<QueryResult<T>>;
class AthenaExpress<T> {
public new: (config: Partial<ConnectionConfigInterface>) => any;
public query: QueryFunc<T>;
constructor(config: Partial<ConnectionConfigInterface>);
}
}