* Converts a BlockState to a mock database block row format.
(block: ReturnType<typeof createBlock>, workflowId: string)
| 137 | * Converts a BlockState to a mock database block row format. |
| 138 | */ |
| 139 | function toDbBlock(block: ReturnType<typeof createBlock>, workflowId: string) { |
| 140 | return { |
| 141 | id: block.id, |
| 142 | workflowId, |
| 143 | type: block.type, |
| 144 | name: block.name, |
| 145 | positionX: block.position.x, |
| 146 | positionY: block.position.y, |
| 147 | enabled: block.enabled, |
| 148 | horizontalHandles: block.horizontalHandles, |
| 149 | advancedMode: block.advancedMode ?? false, |
| 150 | triggerMode: block.triggerMode ?? false, |
| 151 | height: block.height ?? 150, |
| 152 | subBlocks: block.subBlocks ?? {}, |
| 153 | outputs: block.outputs ?? {}, |
| 154 | data: block.data ?? {}, |
| 155 | parentId: block.data?.parentId ?? null, |
| 156 | extent: block.data?.extent ?? null, |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | const mockBlocksFromDb = [ |
| 161 | toDbBlock( |