UNPKG

longcelot-sheet-db

Version:

Google Sheets-backed staging database adapter for Node.js with schema-first design

28 lines 1.54 kB
import { SheetAdapterConfig } from './sheetAdapter'; import { PostgresAdapterConfig } from './sql/postgresAdapter'; import { MySQLAdapterConfig } from './sql/mysqlAdapter'; import type { DatabaseAdapter } from './types'; /** * `'prisma'` is deliberately not a driver here — createPrismaAdapter() requires an * already-constructed PrismaClient instance from the consumer (see prismaAdapter.ts), and there * is no environment variable that can contain a live object. Prisma-track consumers keep one * line of branching in their own app instead (`driver === 'prisma' ? createPrismaAdapter({...}) * : createDatabaseAdapter()`) — see FAQ.md #13. */ export type DBDriver = 'sheets' | 'postgres' | 'mysql'; export interface DatabaseAdapterFactoryConfig { /** Falls back to $DB_DRIVER, then 'sheets'. */ driver?: DBDriver; sheets?: SheetAdapterConfig; postgres?: PostgresAdapterConfig; mysql?: MySQLAdapterConfig; } /** * Single top-level factory: pick the storage engine via one config value (or one env var), not a * different import per environment. This is simultaneously Phase 16.2's "single top-level * factory" and Phase 16.7's "env-driven adapter selection" — a dev's `.env` points at * `DB_DRIVER=sheets`, a CI/CD pipeline's env points at `DB_DRIVER=postgres` (+ `$DATABASE_URL`), * with zero application code branching for those two tracks. */ export declare function createDatabaseAdapter(config?: DatabaseAdapterFactoryConfig): DatabaseAdapter; //# sourceMappingURL=createDatabaseAdapter.d.ts.map