- token.test.ts: Unit tests for generateToken, parseToken, hashToken - client.test.ts: Tests for createDb validation and e2e connectivity - execute-bootstrap.test.ts: Comprehensive e2e tests for bootstrap operation including overwrite mode and related record cleanup Coverage: client.ts 100%, token.ts 100%, execute-bootstrap.ts 98.69% Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@reviq/db
Database client and helper functions for the RevIQ platform.
Usage
import { createDb } from "@reviq/db";
const db = createDb(process.env.DATABASE_URL);
// Use db with Kysely queries
const users = await db.selectFrom("users").selectAll().execute();
// Clean up when done
await db.destroy();
Exports
Client
createDb(url)- Create a Kysely database instance
Helper Functions
executeBootstrap(trx, input)- Bootstrap a new database with superuser and orggenerateToken()- Generate an API tokenhashToken(token)- Hash a token for storageparseToken(token)- Parse and validate a tokenTOKEN_PREFIX- Thereviq_prefix for API tokens
Types
Database- Re-exported from@reviq/db-schemaBootstrapInput/BootstrapResult- Types for bootstrap operation