- Add withTransaction helper that gracefully handles nested transactions (reuses existing transaction in tests, starts new one otherwise) - Update auth procedures to use withTransaction instead of direct .transaction() - Add email config to all e2e test contexts (required by merged code) - Remove duplicate verification token code from signup procedure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
44 lines
953 B
TypeScript
44 lines
953 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";
|
|
export {
|
|
type DbConnection,
|
|
withTransaction,
|
|
} from "./helpers/with-transaction.js";
|
|
/**
|
|
* Export model operations
|
|
*/
|
|
export * from "./models/index.js";
|