import { ClientEngineType } from '@prisma/sdk' ; import type { InternalDatasource } from '../../runtime/utils/printDatasources' ; export type InlineDatasources = { [ name in InternalDatasource [ 'name' ] ] : { url : InternalDatasource [ 'url' ] ; } ; } ; param engineType param internalDatasources returns export function buildInlineDatasource ( engineType , internalDatasources ) { if ( engineType === ClientEngineType . DataProxy ) { const datasources = internalToInlineDatasources ( internalDatasources ) ; return `
config.inlineDatasources = ${ JSON . stringify ( datasources , null , 2 ) }` ; } return `` ; } param internalDatasources returns function internalToInlineDatasources ( internalDatasources ) { return internalDatasources . reduce ( ( acc , ds ) => { acc [ ds . name ] = { url : ds . url } ; return acc ; } , { } as InlineDatasources ) ; }