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');
        // Generated client lives outside the bundle graph (emitted at build time);
        // ignore it so the bundler doesn't warn about an unresolved relative import.
        // The `@ts-ignore` sits directly above the specifier line because, for a
        // multi-line dynamic import, that is the line tsc reports the error on.
        const { PrismaClient } = await import(
        // @ts-ignore — generated at build time, resolved outside the bundle graph
        /* webpackIgnore: true */ /* turbopackIgnore: true */ '../../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