import type { DataSource } from '@prisma/generator-helper' ; import type { DatasourceOverwrite } from './extractSqliteSources' ; export function serializeDatasources ( datasources ) { const str = JSON . stringify ( datasources , null , 2 ) ; const replaceRegex = /"('file:'.*'\))"/ ; return str . split ( '\n' ) . map ( ( line ) => { return line . replace ( replaceRegex , ( match ) => { return match . slice ( 1 , match . length - 1 ) ; } ) ; } ) . join ( '\n' ) ; } export function datasourceToDatasourceOverwrite ( datasource ) { return { name : datasource . name , url : datasource . url . fromEnvVar ? `env("${ datasource . url . fromEnvVar }")` : datasource . url . value , } ; }