( allSubBlocks: SubBlockConfig[], changedSubBlockId: string )
| 111 | * Finds subblocks that depend on a changed field, accounting for canonical pairs. |
| 112 | */ |
| 113 | export function getSubBlocksDependingOnChange( |
| 114 | allSubBlocks: SubBlockConfig[], |
| 115 | changedSubBlockId: string |
| 116 | ): SubBlockConfig[] { |
| 117 | const canonicalIndex = buildCanonicalIndex(allSubBlocks) |
| 118 | const canonicalId = canonicalIndex.canonicalIdBySubBlockId[changedSubBlockId] |
| 119 | const group = canonicalId ? canonicalIndex.groupsById[canonicalId] : undefined |
| 120 | const changedFields = new Set<string>([changedSubBlockId]) |
| 121 | |
| 122 | if (canonicalId) changedFields.add(canonicalId) |
| 123 | if (group?.basicId) changedFields.add(group.basicId) |
| 124 | for (const advancedId of group?.advancedIds || []) { |
| 125 | changedFields.add(advancedId) |
| 126 | } |
| 127 | |
| 128 | return allSubBlocks.filter((subBlock) => |
| 129 | getDependsOnFields(subBlock.dependsOn).some((field) => changedFields.has(field)) |
| 130 | ) |
| 131 | } |
| 132 | |
| 133 | export function resolveOutputType( |
| 134 | outputs: Record<string, OutputFieldDefinition> |
no test coverage detected