-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from allen-munsch/typescript-typing
Adds an initial typescript typing
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
declare module 'athena-express' { | ||
import * as aws from 'aws-sdk'; | ||
interface ConnectionConfigInterface { | ||
aws: typeof aws; | ||
s3: string; | ||
getStats: boolean; | ||
db: string, | ||
workgroup: string, | ||
formatJson: boolean, | ||
retry: number, | ||
ignoreEmpty: boolean, | ||
encryption: Record<string, string>, | ||
skipResults: boolean, | ||
waitForResults: boolean | ||
} | ||
|
||
interface QueryResultsInterface<T> { | ||
Items: T[]; | ||
DataScannedInMB: number; | ||
QueryCostInUSD: number; | ||
EngineExecutionTimeInMillis: number; | ||
S3Location: string; | ||
QueryExecutionId: 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 { | ||
public new: (config: Partial<ConnectionConfigInterface>) => any; | ||
public query: QueryFunc; | ||
constructor(config: Partial<ConnectionConfigInterface>); | ||
query: QueryFunc; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters