import fs from 'fs' ; import crypto from 'crypto' ; import { ClientEngineType } from '@prisma/sdk' ; const readFile = fs . promises . readFile ; param clientEngineType param schemaPath returns export async function buildInlineSchema ( clientEngineType , schemaPath ) { if ( clientEngineType === ClientEngineType . DataProxy ) { const b64Schema = ( await readFile ( schemaPath ) ) . toString ( 'base64' ) ; const schemaHash = crypto . createHash ( 'sha256' ) . update ( b64Schema ) . digest ( 'hex' ) ; return `
config.inlineSchema = '${ b64Schema }'
config.inlineSchemaHash = '${ schemaHash }'` ; } return `` ; }