MCPcopy Create free account
hub / github.com/dataform-co/dataform / dotRepresentation

Function dotRepresentation

cli/console.ts:530–561  ·  view source on GitHub ↗
(graph: dataform.ICompiledGraph, interactive: boolean)

Source from the content-addressed store, hash-verified

528}
529
530export function dotRepresentation(graph: dataform.ICompiledGraph, interactive: boolean): string {
531 const nodes: string[] = [];
532 const edges: string[] = [];
533
534 const formatTarget = interactive ? targetString : plainTargetString;
535
536 graph.tables?.forEach(table => {
537 const nodeName = `${formatTarget(table.target)}`;
538 nodes.push(`"${nodeName}" [label="${formatTarget(table.target)} [${tableTypeEnumToString(table.enumType)}]"]`);
539 table.dependencyTargets?.forEach(dependencyTarget => {
540 edges.push(`"${formatTarget(dependencyTarget)}" -> "${nodeName}"`);
541 });
542 });
543
544 graph.assertions?.forEach(assertion => {
545 const nodeName = `${formatTarget(assertion.target)}`;
546 nodes.push(`"${nodeName}" [label="${formatTarget(assertion.target)}"]`);
547 assertion.dependencyTargets?.forEach(dependencyTarget => {
548 edges.push(`"${formatTarget(dependencyTarget)}" -> "${nodeName}"`);
549 });
550 });
551
552 graph.operations?.forEach(operation => {
553 const nodeName = `${formatTarget(operation.target)}`;
554 nodes.push(`"${nodeName}" [label="${formatTarget(operation.target)}"`);
555 operation.dependencyTargets?.forEach(dependencyTarget => {
556 edges.push(`"${formatTarget(dependencyTarget)}" -> "${nodeName}"`);
557 });
558 });
559
560 return `digraph {\n${nodes.join(";\n")};\n${edges.join(";\n")};\n}`;
561}
562
563function printExecutedActionErrors(
564 executedAction: dataform.IActionResult,

Callers 1

printCompiledGraphFunction · 0.85

Calls 2

tableTypeEnumToStringFunction · 0.90
pushMethod · 0.45

Tested by

no test coverage detected