import { DMMF as PrismaDMMF } from "@prisma/client/runtime" ; import { GetDMMFOptions } from "@prisma/sdk" ; const PrismaClientGeneratorBuild = require ( "@prisma/client/generator-build" ) ; function getDMMF ( options ) { return PrismaClientGeneratorBuild . getDMMF ( options ) ; } export default async function getPrismaClientDmmfFromPrismaSchema ( prismaSchema , previewFeatures = [ ] ) { const previewFeaturesToEmit = [ ... previewFeatures ] ; const datamodelWithGeneratorBlock = `
    datasource db {
      provider = "postgresql"
      url      = env("DATABASE_URL")
    }
    generator client {
      provider = "prisma-client-js"
      ${ previewFeaturesToEmit . length > 0 ? `previewFeatures = [${ previewFeaturesToEmit . map ( it => `"${ it }"` ) . join ( ", " ) }]` : "" }
    }
    ${ prismaSchema }
  ` ; return await getDMMF ( { datamodel : datamodelWithGeneratorBlock , previewFeatures , } ) ; }