Skip to content

Commit 1659f3f

Browse files
committed
chore: support both es-module and commonjs
1 parent e31fa6f commit 1659f3f

12 files changed

+2328
-6323
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
node-version:
15-
- '18'
15+
- "18"
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v3
@@ -21,4 +21,4 @@ jobs:
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323
- run: npm ci
24-
- run: npm test
24+
- run: npm test run

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
node-version: 18
1818
registry-url: "https://registry.npmjs.org"
1919
- run: npm ci
20-
- run: npm test
20+
- run: npm test run
2121
- run: npm publish
2222
env:
2323
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ node_modules/
88

99
lib/*.js
1010
test/*.js
11+
12+
dist

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { AthenaQuery } from "./lib/athena-query";
2+
3+
export default AthenaQuery;

jest.config.js

Lines changed: 0 additions & 192 deletions
This file was deleted.

lib/helper.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { setTimeout } from "node:timers/promises";
21
import {
32
Athena,
43
Datum,
@@ -16,9 +15,9 @@ async function startQueryExecution(params: {
1615
const output = await params.athena.startQueryExecution({
1716
QueryString: params.sql,
1817
ExecutionParameters: params.executionParameters,
19-
WorkGroup: params.workgroup,
18+
WorkGroup: params.workgroup || "primary",
2019
QueryExecutionContext: {
21-
Database: params.db,
20+
Database: params.db || "default",
2221
Catalog: params.catalog,
2322
},
2423
});
@@ -46,7 +45,7 @@ async function waitExecutionCompleted(params: {
4645
} else if (state === "FAILED") {
4746
throw new Error(reason);
4847
} else {
49-
await setTimeout(200);
48+
await wait(200);
5049
await waitExecutionCompleted(params);
5150
}
5251
}
@@ -147,4 +146,6 @@ async function getDataTypes(
147146
return columnInfoObject;
148147
}
149148

149+
const wait = (ms: number) => new Promise((res) => setTimeout(res, ms));
150+
150151
export { startQueryExecution, waitExecutionCompleted, getQueryResults };

lib/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)