Merge branch 'cli-improvements-1' with @reviq/utils password hashing

- Use executeBootstrap helper from @reviq/db for CLI bootstrap
- Update @reviq/db to use @reviq/utils for PBKDF2-SHA256 password hashing
  (Cloudflare Workers compatible)
- Keep @scure/base for base58 token encoding
- Remove redundant password.ts from @reviq/db (import directly from @reviq/utils)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
RevIQ
2026-01-09 18:17:45 +08:00
19 changed files with 785 additions and 154 deletions

View File

@@ -2,24 +2,34 @@
* Database client for RevIQ Publisher Dashboard
*
* @module @reviq/db
*/
import type { Database } from "@reviq/db-schema";
import type { Kysely } from "kysely";
import { createDb } from "./client.js";
/**
* Default database instance
*
* Uses DATABASE_URL environment variable for connection
* Usage:
* import { createDb } from "@reviq/db";
* const db = createDb(); // Uses DATABASE_URL env var
* // ... use db ...
* await db.destroy();
*/
export const db: Kysely<Database> = createDb();
/**
* Re-export database types from db-schema
*/
export type { Database } from "@reviq/db-schema";
/**
* Export createDb for creating custom database instances
* 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";