Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Sep 20, 2024
1 parent cc599a7 commit d27d35a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/api/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
} from "../types";
import fetch from "cross-fetch";
import log from "loglevel";
import { getVersion, logPrefix } from "../utils";
import { version } from "../../package.json";
import { logPrefix } from "../utils";

const CLIENT_VERSION = getVersion();
const BASE_URL = "https://api.dune.com/api";

enum RequestMethod {
Expand Down Expand Up @@ -86,7 +86,7 @@ export class Router {
method,
headers: {
"x-dune-api-key": this.apiKey,
"User-Agent": `client-sdk@${CLIENT_VERSION} (https://www.npmjs.com/package/@duneanalytics/client-sdk)`,
"User-Agent": `client-sdk@${version} (https://www.npmjs.com/package/@duneanalytics/client-sdk)`,
"Content-Type": content_type,
},
// conditionally add the body property
Expand Down
12 changes: 0 additions & 12 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,3 @@ export function withDefaults<T>(obj: T, defaults: Partial<T>): T {
}
return result as T;
}

export function getVersion(): string {
try {
// @ts-expect-error: cheeky hack
import { version } from "../package.json";
return version;
} catch {
// @ts-expect-error: cheeky hack
import { version } from "../../package.json";
return version;
}
}

0 comments on commit d27d35a

Please sign in to comment.