MCPcopy
hub / github.com/simstudioai/sim / toDbBlock

Function toDbBlock

apps/sim/lib/workflows/persistence/utils.test.ts:139–158  ·  view source on GitHub ↗

* Converts a BlockState to a mock database block row format.

(block: ReturnType<typeof createBlock>, workflowId: string)

Source from the content-addressed store, hash-verified

137 * Converts a BlockState to a mock database block row format.
138 */
139function 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
160const mockBlocksFromDb = [
161 toDbBlock(

Callers 1

utils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected