(executionGraph: dataform.ExecutionGraph, asJson: boolean)
| 277 | } |
| 278 | |
| 279 | export function printExecutionGraph(executionGraph: dataform.ExecutionGraph, asJson: boolean) { |
| 280 | if (asJson) { |
| 281 | writeStdOut(prettyJsonStringify(executionGraph.toJSON())); |
| 282 | } else { |
| 283 | const actionsByType = { |
| 284 | table: [] as dataform.IExecutionAction[], |
| 285 | assertion: [] as dataform.IExecutionAction[], |
| 286 | operation: [] as dataform.IExecutionAction[] |
| 287 | }; |
| 288 | executionGraph.actions.forEach(action => { |
| 289 | if ( |
| 290 | !(action.type === "table" || action.type === "assertion" || action.type === "operation") |
| 291 | ) { |
| 292 | throw new Error(`Unrecognized action type: ${action.type}`); |
| 293 | } |
| 294 | actionsByType[action.type].push(action); |
| 295 | }); |
| 296 | const datasetActions = actionsByType.table; |
| 297 | if (datasetActions && datasetActions.length) { |
| 298 | writeStdOut(`${datasetActions.length} dataset(s):`); |
| 299 | datasetActions.forEach(datasetAction => |
| 300 | writeStdOut( |
| 301 | datasetString(datasetAction.target, datasetAction.type, datasetAction.tasks.length === 0), |
| 302 | 1 |
| 303 | ) |
| 304 | ); |
| 305 | } |
| 306 | const assertionActions = actionsByType.assertion; |
| 307 | if (assertionActions && assertionActions.length) { |
| 308 | writeStdOut(`${assertionActions.length} assertion(s):`); |
| 309 | assertionActions.forEach(assertionAction => |
| 310 | writeStdOut(assertionString(assertionAction.target, assertionAction.tasks.length === 0), 1) |
| 311 | ); |
| 312 | } |
| 313 | const operationActions = actionsByType.operation; |
| 314 | if (operationActions && operationActions.length) { |
| 315 | writeStdOut(`${operationActions.length} operation(s):`); |
| 316 | operationActions.forEach(operationAction => |
| 317 | writeStdOut(operationString(operationAction.target, operationAction.tasks.length === 0), 1) |
| 318 | ); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | export function printExecutedAction( |
| 324 | executedAction: dataform.IActionResult, |
no test coverage detected