export function transformFields ( fields ) { return Object . fromEntries ( Object . entries ( fields ) . filter ( ( [ key , value ] ) => ! key . startsWith ( "__" ) ) . map < [ string , any ] > ( ( [ key , value ] ) => { if ( Object . keys ( value ) . length === 0 ) { return [ key , true ] ; } return [ key , transformFields ( value ) ] ; } ) ) ; } export function getPrismaFromContext ( context ) { const prismaClient = context . prisma ; if ( ! prismaClient ) { throw new Error ( "Unable to find Prisma Client in GraphQL context. Please provide it under the `context.prisma` key." ) ; } return prismaClient ; } export function transformCountFieldIntoSelectRelationsCount ( _count ) { return { include : { _count : { select : { ... Object . fromEntries ( Object . entries ( _count ) . filter ( ( [ _ , v ] ) => v != null ) ) , } } , } , } ; }