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

Include Package Version with User-Agent #38

Merged
merged 3 commits into from
Mar 25, 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
3 changes: 2 additions & 1 deletion src/api/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
payloadJSON,
payloadSearchParams,
} from "../types/requestPayload";
import { version } from "../../package.json";

const BASE_URL = "https://api.dune.com/api";

Expand Down Expand Up @@ -88,7 +89,7 @@ export class Router {
method,
headers: {
"x-dune-api-key": this.apiKey,
"User-Agent": `ts-client-sdk (https://www.npmjs.com/package/@duneanalytics/client-sdk)`,
"User-Agent": `client-sdk@${version} (https://www.npmjs.com/package/@duneanalytics/client-sdk)`,
},
// conditionally add the body property
...(method !== RequestMethod.GET && {
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e/executionAPI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("ExecutionAPI: native routes", () => {

// This doesn't work if run too many times at once:
// https://discord.com/channels/757637422384283659/1019910980634939433/1026840715701010473
it("returns expected results on sequence execute-cancel-get_status", async () => {
it.skip("returns expected results on sequence execute-cancel-get_status", async () => {
// Long running query ID.
const queryID = 1229120;
// Execute and check state
Expand Down Expand Up @@ -87,14 +87,13 @@ describe("ExecutionAPI: native routes", () => {
});
});

it("getResults", async () => {
it("gets Results", async () => {
const execution = await client.executeQuery(testQueryId);
await sleep(1);
// expect basic query has completed after 1s
await sleep(5);
// expect basic query has completed after 5s
const status = await client.getExecutionStatus(execution.execution_id);
expect(status.state).to.be.eq(ExecutionState.COMPLETED);

// let resultJSON = await client.getExecutionResults(execution.execution_id);
await expect(() => client.getExecutionResults(execution.execution_id)).to.not.throw();

const resultCSV = await client.getResultCSV(execution.execution_id);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"target": "ES2018",
"module": "CommonJS",
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"declaration": true,
"outDir": "dist",
Expand Down