export async function createPostgresAdapter(options) {
    try {
        // @ts-ignore — pg types may not be available
        const pg = await import('pg');
        const { PrismaPg } = await import('@prisma/adapter-pg');
        // @ts-ignore — generated at build time
        const { PrismaClient } = await import('../../generated/client.js');
        const pool = new pg.default.Pool({
            connectionString: options.url,
            max: options.poolSize ?? 10,
        });
        const adapter = new PrismaPg(pool);
        return new PrismaClient({ adapter });
    }
    catch {
        throw new Error('PostgreSQL support requires pg and @prisma/adapter-pg. ' +
            'Install them with: pnpm add pg @prisma/adapter-pg');
    }
}
//# sourceMappingURL=postgres.js.map