()
| 43 | } |
| 44 | |
| 45 | public build(): dataform.ExecutionGraph { |
| 46 | if (utils.graphHasErrors(this.prunedGraph)) { |
| 47 | throw new Error(`Project has unresolved compilation or validation errors.`); |
| 48 | } |
| 49 | |
| 50 | const tableMetadataByTarget = new Map<string, dataform.ITableMetadata>(); |
| 51 | |
| 52 | this.warehouseState.tables.forEach(tableState => { |
| 53 | tableMetadataByTarget.set(targetStringifier.stringify(tableState.target), tableState); |
| 54 | }); |
| 55 | |
| 56 | const actions: dataform.IExecutionAction[] = [].concat( |
| 57 | this.prunedGraph.tables.map(t => |
| 58 | this.buildTable( |
| 59 | t, |
| 60 | tableMetadataByTarget.get(targetStringifier.stringify(t.target)), |
| 61 | this.runConfig |
| 62 | ) |
| 63 | ), |
| 64 | this.prunedGraph.operations.map(o => this.buildOperation(o)), |
| 65 | this.prunedGraph.assertions.map(a => this.buildAssertion(a)) |
| 66 | ); |
| 67 | return dataform.ExecutionGraph.create({ |
| 68 | projectConfig: this.prunedGraph.projectConfig, |
| 69 | runConfig: this.runConfig, |
| 70 | warehouseState: this.warehouseState, |
| 71 | declarationTargets: this.prunedGraph.declarations.map(declaration => declaration.target), |
| 72 | actions |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | private buildTable( |
| 77 | table: dataform.ITable, |
no test coverage detected