chore: switch package manager to bun and create docs for codebase

This commit is contained in:
Tasnim Kabir Sadik
2026-05-16 17:27:47 +06:00
parent b35df41f08
commit a69118aa2d
16 changed files with 1008 additions and 2360 deletions

View File

@ -12,7 +12,8 @@ const waitTimeoutMs = Number(process.env.WRENN_TEST_WAIT_TIMEOUT_MS ?? 120_000);
const testTimeoutMs = waitTimeoutMs + 45_000;
const describeWithApiKey = apiKey ? describe : describe.skip;
const clientOpts = { apiKey, baseUrl } satisfies CapsuleCreateOptions;
const clientOpts: CapsuleCreateOptions = { baseUrl };
if (apiKey) clientOpts.apiKey = apiKey;
async function withLiveCapsule(
fn: (capsule: Capsule) => Promise<void>,

View File

@ -9,7 +9,8 @@ const template = process.env.WRENN_TEST_TEMPLATE ?? "minimal";
const waitTimeoutMs = Number(process.env.WRENN_TEST_WAIT_TIMEOUT_MS ?? 120_000);
const describeWithApiKey = apiKey ? describe : describe.skip;
const clientOpts = { apiKey, baseUrl } satisfies CapsuleCreateOptions;
const clientOpts: CapsuleCreateOptions = { baseUrl };
if (apiKey) clientOpts.apiKey = apiKey;
describeWithApiKey("Capsule live integration", () => {
it(

View File

@ -1,7 +1,7 @@
import { beforeAll, describe, expect, it } from "vitest";
import { WrennClient } from "../../src/client.js";
import { DEFAULT_BASE_URL } from "../../src/config.js";
import { type ClientConfig, DEFAULT_BASE_URL } from "../../src/config.js";
const baseUrl = process.env.WRENN_BASE_URL ?? DEFAULT_BASE_URL;
const apiKey = process.env.WRENN_API_KEY;
@ -11,8 +11,11 @@ const testPassword = process.env.WRENN_TEST_PASS;
const describeWithApiKey = apiKey ? describe : describe.skip;
const describeWithLogin = testEmail && testPassword ? describe : describe.skip;
const apiKeyClientOpts: ClientConfig = { baseUrl };
if (apiKey) apiKeyClientOpts.apiKey = apiKey;
describeWithApiKey("WrennClient live API key integration", () => {
const client = new WrennClient({ apiKey, baseUrl });
const client = new WrennClient(apiKeyClientOpts);
it("lists capsules from the real Wrenn API", async () => {
const capsules = await client.capsules.list();
@ -50,7 +53,9 @@ describeWithLogin("WrennClient live login integration", () => {
});
expect(auth.token).toBeTypeOf("string");
client = new WrennClient({ baseUrl, token: auth.token });
const token = auth.token;
if (!token) throw new Error("Login response did not include a token");
client = new WrennClient({ baseUrl, token });
});
it("gets the current account profile from the real Wrenn API", async () => {

View File

@ -14,7 +14,8 @@ const waitTimeoutMs = Number(process.env.WRENN_TEST_WAIT_TIMEOUT_MS ?? 120_000);
const testTimeoutMs = waitTimeoutMs + 60_000;
const describeWithApiKey = apiKey ? describe : describe.skip;
const clientOpts = { apiKey, baseUrl } satisfies CapsuleCreateOptions;
const clientOpts: CapsuleCreateOptions = { baseUrl };
if (apiKey) clientOpts.apiKey = apiKey;
function delay(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));