| 7 | import { dataform } from "df/protos/ts"; |
| 8 | |
| 9 | export async function build( |
| 10 | compiledGraph: dataform.ICompiledGraph, |
| 11 | runConfig: dataform.IRunConfig, |
| 12 | dbadapter: dbadapters.IDbAdapter |
| 13 | ) { |
| 14 | const prunedGraph = prune(compiledGraph, runConfig); |
| 15 | |
| 16 | const allInvolvedTargets = new Set<string>( |
| 17 | prunedGraph.tables.map(table => targetStringifier.stringify(table.target)) |
| 18 | ); |
| 19 | |
| 20 | return new Builder( |
| 21 | prunedGraph, |
| 22 | runConfig, |
| 23 | await state( |
| 24 | dbadapter, |
| 25 | Array.from(allInvolvedTargets).map(target => targetStringifier.parse(target)) |
| 26 | ) |
| 27 | ).build(); |
| 28 | } |
| 29 | |
| 30 | export class Builder { |
| 31 | private readonly executionSql: ExecutionSql; |