- Add comprehensive e2e tests for me.get, me.authStatus, me.setupProfile, me.updateProfile, me.setPassword, and me.delete (21 tests) - Make createDb require explicit connection string (no default env lookup) - Add database name validation to prevent SQL injection in CREATE DATABASE - Fix getTestDatabaseUrl to throw instead of returning empty string - Replace brittle relative path with findRepoRoot() function - Extract magic numbers (SESSION_EXPIRY_MS, API_TOKEN_EXPIRY_MS, ONE_DAY_MS) - Consolidate duplicate createAPIContext functions - Add hasPassword field to meAuthStatus and toUserResponse Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
794 B
TypeScript
36 lines
794 B
TypeScript
/**
|
|
* Database client for RevIQ Publisher Dashboard
|
|
*
|
|
* @module @reviq/db
|
|
*
|
|
* Usage:
|
|
* import { createDb } from "@reviq/db";
|
|
* const db = createDb(process.env.DATABASE_URL); // Requires connection URL
|
|
* // ... use db ...
|
|
* await db.destroy();
|
|
*/
|
|
|
|
/**
|
|
* Re-export database types from db-schema
|
|
*/
|
|
export type { Database } from "@reviq/db-schema";
|
|
/**
|
|
* Export createDb for creating database instances
|
|
* Callers should create their own database instance and pass it to functions
|
|
*/
|
|
export { createDb } from "./client.js";
|
|
/**
|
|
* Export helper functions
|
|
*/
|
|
export {
|
|
type BootstrapInput,
|
|
type BootstrapResult,
|
|
executeBootstrap,
|
|
} from "./helpers/execute-bootstrap.js";
|
|
export {
|
|
generateToken,
|
|
hashToken,
|
|
parseToken,
|
|
TOKEN_PREFIX,
|
|
} from "./helpers/token.js";
|