This commit is contained in:
Siddharth Ganesan
2025-07-09 10:32:19 -07:00
parent 610ea0b689
commit 8176b37d89
2 changed files with 16 additions and 6 deletions

View File

@@ -165,7 +165,10 @@ function extractBlockInputs(
/**
* Find incoming connections for a given block ID
*/
function findIncomingConnections(blockId: string, edges: any[]): Array<{
function findIncomingConnections(
blockId: string,
edges: any[]
): Array<{
source: string
sourceHandle?: string
targetHandle?: string
@@ -182,7 +185,10 @@ function findIncomingConnections(blockId: string, edges: any[]): Array<{
/**
* Find outgoing connections for a given block ID
*/
function findOutgoingConnections(blockId: string, edges: any[]): Array<{
function findOutgoingConnections(
blockId: string,
edges: any[]
): Array<{
target: string
sourceHandle?: string
targetHandle?: string
@@ -229,11 +235,11 @@ export function generateWorkflowYaml(
// Only include connections if they exist
if (incoming.length > 0 || outgoing.length > 0) {
yamlBlock.connections = {}
if (incoming.length > 0) {
yamlBlock.connections.incoming = incoming
}
if (outgoing.length > 0) {
yamlBlock.connections.outgoing = outgoing
}

View File

@@ -134,7 +134,9 @@ function validateBlockReferences(yamlWorkflow: YamlWorkflow): string[] {
if (block.connections?.incoming) {
block.connections.incoming.forEach((connection) => {
if (!blockIds.has(connection.source)) {
errors.push(`Block '${blockId}' references non-existent source block '${connection.source}'`)
errors.push(
`Block '${blockId}' references non-existent source block '${connection.source}'`
)
}
})
}
@@ -143,7 +145,9 @@ function validateBlockReferences(yamlWorkflow: YamlWorkflow): string[] {
if (block.connections?.outgoing) {
block.connections.outgoing.forEach((connection) => {
if (!blockIds.has(connection.target)) {
errors.push(`Block '${blockId}' references non-existent target block '${connection.target}'`)
errors.push(
`Block '${blockId}' references non-existent target block '${connection.target}'`
)
}
})
}