(graph: dataform.ICompiledGraph, outputType: compiledGraphOutputType, quietCompilation: boolean)
| 188 | } |
| 189 | |
| 190 | export function printCompiledGraph(graph: dataform.ICompiledGraph, outputType: compiledGraphOutputType, quietCompilation: boolean) { |
| 191 | |
| 192 | const interactive = isInteractive(); |
| 193 | |
| 194 | if (outputType === compiledGraphOutputType.Json) { |
| 195 | writeStdOut(prettyJsonStringify(graph)); |
| 196 | } else if (outputType === compiledGraphOutputType.Dot) { |
| 197 | writeStdOut(dotRepresentation(graph, interactive)); |
| 198 | } else { |
| 199 | const actionCount = |
| 200 | 0 + |
| 201 | (graph.tables ? graph.tables.length : 0) + |
| 202 | (graph.assertions ? graph.assertions.length : 0) + |
| 203 | (graph.operations ? graph.operations.length : 0); |
| 204 | writeStdOut(successOutput(`Compiled ${actionCount} action(s).`)); |
| 205 | if (graph.tables && graph.tables.length) { |
| 206 | graph.tables.forEach(setOrValidateTableEnumType); |
| 207 | writeStdOut(`${graph.tables.length} dataset(s)${quietCompilation ? "." : ":"}`); |
| 208 | if(!quietCompilation){ |
| 209 | graph.tables.forEach(compiledTable => { |
| 210 | writeStdOut( |
| 211 | `${datasetString( |
| 212 | compiledTable.target, |
| 213 | tableTypeEnumToString(compiledTable.enumType), |
| 214 | compiledTable.disabled |
| 215 | )}`, |
| 216 | 1 |
| 217 | ); |
| 218 | }); |
| 219 | } |
| 220 | } |
| 221 | if (graph.assertions && graph.assertions.length) { |
| 222 | writeStdOut(`${graph.assertions.length} assertion(s)${quietCompilation ? "." : ":"}`); |
| 223 | if(!quietCompilation){ |
| 224 | graph.assertions.forEach(assertion => { |
| 225 | writeStdOut(assertionString(assertion.target, assertion.disabled), 1); |
| 226 | }); |
| 227 | } |
| 228 | } |
| 229 | if (graph.operations && graph.operations.length) { |
| 230 | writeStdOut(`${graph.operations.length} operation(s)${quietCompilation ? "." : ":"}`); |
| 231 | if(!quietCompilation){ |
| 232 | graph.operations.forEach(operation => { |
| 233 | writeStdOut(operationString(operation.target, operation.disabled), 1); |
| 234 | }); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | function formatStackTraceForQuietCompilation(compileError: dataform.ICompilationError): string { |
| 241 | // Show only first 3 or available lines for cleaner error output |
no test coverage detected