"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.auth = void 0; var _betterAuth = await jitiImport("better-auth"); var _drizzle = await jitiImport("better-auth/adapters/drizzle"); // CODEGEN-ONLY config for `pnpm db:auth:gen` (Plan 04-07). // // This file is consumed exclusively by `@better-auth/cli generate` to emit the // Drizzle schema for Better-Auth's session/account/verification tables to // `packages/db/src/auth-tables.ts`. It is NOT imported by the runtime — the // runtime uses `apps/server/src/auth.ts` which builds a Better-Auth instance // against the live SQLite database injected at boot time. // // The CLI inspects the static options on the exported `auth` instance to // derive the schema; the drizzle adapter only needs the provider tag for // dialect routing. // // Reconciliation of overlap with Phase 3 `accounts` table (RESEARCH A8): // - Phase 3 `accounts` (packages/db/src/tables.ts) has shape // { id, username, passwordHash, email?, role, createdAt, lastLoginAt, // forceReset } — designed for the legacy-account migration surface // (Plan 04-10). // - Better-Auth's default `user` model has shape // { id, name, email, emailVerified, image, createdAt, updatedAt } — its // credential `password` lives on the separate `account` table. // - Renaming Better-Auth's user model to `accounts` would CONFLICT (both // declare a `accounts` sqliteTable with disjoint column sets). We // therefore keep Better-Auth's default `user` model name and treat the // two tables as independent identity surfaces. Plan 04-10 reconciles // the legacy account migration by moving username/role/forceReset onto // the Better-Auth `user` table via additionalFields, and treats Phase 3 // `accounts` as the legacy_credentials_staging counterpart. const auth = exports.auth = (0, _betterAuth.betterAuth)({ // Pass a stub Drizzle handle to the adapter — codegen never runs queries, // it only reads the adapter's `provider` tag and `options` shape to choose // the SQLite generator. database: (0, _drizzle.drizzleAdapter)({}, { provider: 'sqlite' }), emailAndPassword: { enabled: true }, user: { // Default model name 'user' kept — see header note. Phase 3 `accounts` // remains a distinct table; Plan 04-10 wires the migration bridge. additionalFields: { username: { type: 'string', required: false, unique: true }, role: { type: 'string', defaultValue: 'player' }, forceReset: { type: 'boolean', defaultValue: false, fieldName: 'force_reset' } } } }); /* v9-bc0b33eaad7c86ab */