Skip to content

Commit b06d319

Browse files
committed
get rid of BASIC and PLUS keys
1 parent ce0cae7 commit b06d319

File tree

7 files changed

+36
-41
lines changed

7 files changed

+36
-41
lines changed

tests/e2e/client.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DuneClient, QueryParameter } from "../../src/";
22
import log from "loglevel";
3-
import { BASIC_KEY, PLUS_KEY } from "./util";
3+
import { API_KEY } from "./util";
44
import * as fs from "fs/promises";
55

66
log.setLevel("silent", true);
@@ -11,7 +11,7 @@ describe("DuneClient Extensions", () => {
1111
let multiRowQuery: number;
1212

1313
beforeAll(() => {
14-
client = new DuneClient(BASIC_KEY);
14+
client = new DuneClient(API_KEY);
1515
parameterizedQuery = 1215383;
1616
multiRowQuery = 3463180;
1717
});
@@ -107,15 +107,14 @@ describe("DuneClient Extensions", () => {
107107
});
108108

109109
it("runSQL", async () => {
110-
const premiumClient = new DuneClient(PLUS_KEY);
111-
const results = await premiumClient.runSql({
110+
const results = await client.runSql({
112111
query_sql: "select 1",
113112
archiveAfter: true,
114113
isPrivate: true,
115114
});
116115
const queryID = results.query_id;
117116
expect(results.result?.rows).toEqual([{ _col0: 1 }]);
118-
const query = await premiumClient.query.readQuery(queryID);
117+
const query = await client.query.readQuery(queryID);
119118
expect(query.is_archived).toEqual(true);
120119
});
121120
});

tests/e2e/custom.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CustomAPI } from "../../src/";
22
import log from "loglevel";
3-
import { BASIC_KEY } from "./util";
3+
import { API_KEY } from "./util";
44

55
log.setLevel("silent", true);
66

@@ -9,7 +9,7 @@ describe("Custom API", () => {
99
const slug = "test-custom-api";
1010

1111
beforeAll(() => {
12-
client = new CustomAPI(BASIC_KEY);
12+
client = new CustomAPI(API_KEY);
1313
});
1414

1515
// Skip: This endpoint is very "user specific"

tests/e2e/execution.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { QueryParameter, ExecutionState, ExecutionAPI, DuneClient } from "../../src";
22
import log from "loglevel";
33
import { QueryEngine } from "../../src/types/requestArgs";
4-
import { BASIC_KEY, PLUS_KEY, expectAsyncThrow } from "./util";
4+
import { API_KEY, expectAsyncThrow } from "./util";
55
import { sleep } from "../../src/utils";
66

77
log.setLevel("silent", true);
@@ -15,7 +15,7 @@ describe("ExecutionAPI: native routes", () => {
1515
let simpleExecutionId: string;
1616

1717
beforeAll(async () => {
18-
client = new ExecutionAPI(BASIC_KEY);
18+
client = new ExecutionAPI(API_KEY);
1919
// https://dune.com/queries/1215383
2020
testQueryId = 1215383;
2121
// https://dune.com/queries/3463180
@@ -85,8 +85,8 @@ describe("ExecutionAPI: native routes", () => {
8585
expect(execution.execution_id).not.toEqual(null);
8686
});
8787

88-
it("executes with Large tier performance", async () => {
89-
client = new ExecutionAPI(PLUS_KEY);
88+
it.skip("executes with Large tier performance", async () => {
89+
// Skipped: This test requires specific premium permissions
9090
const execution = await client.executeQuery(testQueryId, {
9191
performance: QueryEngine.Large,
9292
});
@@ -228,7 +228,7 @@ describe("ExecutionAPI: Errors", () => {
228228
let client: ExecutionAPI;
229229

230230
beforeAll(() => {
231-
client = new ExecutionAPI(BASIC_KEY);
231+
client = new ExecutionAPI(API_KEY);
232232
});
233233

234234
beforeEach((done) => {
@@ -276,7 +276,7 @@ describe("ExecutionAPI: Errors", () => {
276276

277277
it("returns error when query execution fails", async () => {
278278
// Use DuneClient to create a query with bad SQL, execute it, and check the error
279-
const fullClient = new DuneClient(PLUS_KEY);
279+
const fullClient = new DuneClient(API_KEY);
280280

281281
// Create a query with intentionally bad SQL
282282
const queryId = await fullClient.query.createQuery({
@@ -286,13 +286,13 @@ describe("ExecutionAPI: Errors", () => {
286286
});
287287

288288
try {
289-
// Execute the query - use fullClient.exec (with PLUS_KEY) since query is private
289+
// Execute the query
290290
const execution = await fullClient.exec.executeQuery(queryId);
291291

292292
// Wait a bit for it to fail
293293
await sleep(3);
294294

295-
// Get the results - should have an error - use fullClient.exec (with PLUS_KEY)
295+
// Get the results - should have an error
296296
const result = await fullClient.exec.getExecutionResults(execution.execution_id);
297297

298298
// Verify error structure exists

tests/e2e/paginator.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { DuneClient, Paginator } from "../../src/";
2-
import { BASIC_KEY } from "./util";
2+
import { API_KEY } from "./util";
33

44
describe("Paginator Class", () => {
55
let client: DuneClient;
66

77
beforeAll(() => {
8-
client = new DuneClient(BASIC_KEY);
8+
client = new DuneClient(API_KEY);
99
});
1010
it("Paginator does the stuff", async () => {
1111
// Ususally the user would call: client.refreshResults(:966920);

tests/e2e/query.spec.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { QueryParameter, QueryAPI } from "../../src";
2-
import { PLUS_KEY } from "./util";
2+
import { API_KEY } from "./util";
33

4-
describe("QueryAPI: Premium - CRUD Operations", () => {
5-
let plusClient: QueryAPI;
4+
describe("QueryAPI: CRUD Operations", () => {
5+
let client: QueryAPI;
66

77
beforeAll(() => {
8-
plusClient = new QueryAPI(PLUS_KEY);
8+
client = new QueryAPI(API_KEY);
99
});
1010

1111
// This creates too many queries!
1212
it.skip("create, get & update", async () => {
13-
const newQueryId = await plusClient.createQuery({
13+
const newQueryId = await client.createQuery({
1414
name: "Query Name",
1515
query_sql: "select 1",
1616
query_parameters: [QueryParameter.text("What", "name")],
1717
is_private: true,
1818
});
19-
const recoveredQuery = await plusClient.readQuery(newQueryId);
19+
const recoveredQuery = await client.readQuery(newQueryId);
2020
expect(newQueryId).toEqual(newQueryId);
21-
const updatedQueryId = await plusClient.updateQuery(newQueryId, {
21+
const updatedQueryId = await client.updateQuery(newQueryId, {
2222
name: "New Name",
2323
query_sql: "select 10",
2424
});
@@ -27,17 +27,17 @@ describe("QueryAPI: Premium - CRUD Operations", () => {
2727

2828
it.skip("unarchive, make public, make private, rearchive", async () => {
2929
const queryId = 3530410;
30-
let query = await plusClient.readQuery(queryId);
30+
let query = await client.readQuery(queryId);
3131

32-
await plusClient.unarchiveQuery(queryId);
33-
await plusClient.makePublic(queryId);
34-
query = await plusClient.readQuery(queryId);
32+
await client.unarchiveQuery(queryId);
33+
await client.makePublic(queryId);
34+
query = await client.readQuery(queryId);
3535
expect(query.is_archived).toEqual(false);
3636
expect(query.is_private).toEqual(false);
3737

38-
await plusClient.archiveQuery(queryId);
39-
await plusClient.makePrivate(queryId);
40-
query = await plusClient.readQuery(queryId);
38+
await client.archiveQuery(queryId);
39+
await client.makePrivate(queryId);
40+
query = await client.readQuery(queryId);
4141
expect(query.is_archived).toEqual(true);
4242
expect(query.is_private).toEqual(true);
4343
});

tests/e2e/table.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import log from "loglevel";
2-
import { PLUS_KEY, USER_NAME } from "./util";
2+
import { API_KEY, USER_NAME } from "./util";
33
import * as fs from "fs/promises";
44
import { TableAPI } from "../../src/api";
55
import { ColumnType, ContentType } from "../../src";
@@ -12,7 +12,7 @@ describe("Table API", () => {
1212
const table_name = "dataset_e2e_test";
1313

1414
beforeAll(() => {
15-
tableClient = new TableAPI(PLUS_KEY);
15+
tableClient = new TableAPI(API_KEY);
1616
namespace = USER_NAME;
1717
});
1818

tests/e2e/util.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { DuneError } from "../../src";
22

3-
const { BASIC_API_KEY, PLUS_API_KEY, DUNE_USER_NAME, CUSTOM_SLUG } = process.env;
4-
if (BASIC_API_KEY === undefined) {
5-
throw Error("Missing ENV var: BASIC_API_KEY");
3+
const { DUNE_API_KEY, DUNE_USER_NAME, CUSTOM_SLUG } = process.env;
4+
if (DUNE_API_KEY === undefined) {
5+
throw Error("Missing ENV var: DUNE_API_KEY");
66
}
7-
if (PLUS_API_KEY === undefined) {
8-
throw Error("Missing ENV var: PLUS_API_KEY");
9-
}
10-
export const BASIC_KEY: string = BASIC_API_KEY!;
11-
export const PLUS_KEY: string = PLUS_API_KEY!;
7+
export const API_KEY: string = DUNE_API_KEY!;
128
export const USER_NAME: string = DUNE_USER_NAME || "your_username";
139
export const CUSTOM_API_SLUG: string = CUSTOM_SLUG || "test-custom-api";
1410

0 commit comments

Comments
 (0)