MCPcopy Index your code
hub / github.com/simstudioai/sim / loadForkBlockMap

Function loadForkBlockMap

apps/sim/lib/workspaces/fork/mapping/block-map-store.ts:21–47  ·  view source on GitHub ↗
(
  executor: DbOrTx,
  childWorkspaceId: string
)

Source from the content-addressed store, hash-verified

19 * block id then derives, exactly as before).
20 */
21export async function loadForkBlockMap(
22 executor: DbOrTx,
23 childWorkspaceId: string
24): Promise<ForkBlockMap> {
25 const rows = await executor
26 .select({
27 parentWorkflowId: workspaceForkBlockMap.parentWorkflowId,
28 parentBlockId: workspaceForkBlockMap.parentBlockId,
29 childWorkflowId: workspaceForkBlockMap.childWorkflowId,
30 childBlockId: workspaceForkBlockMap.childBlockId,
31 })
32 .from(workspaceForkBlockMap)
33 .where(eq(workspaceForkBlockMap.childWorkspaceId, childWorkspaceId))
34 const parentToChild = new Map<string, { targetBlockId: string; targetWorkflowId: string }>()
35 const childToParent = new Map<string, { targetBlockId: string; targetWorkflowId: string }>()
36 for (const row of rows) {
37 parentToChild.set(row.parentBlockId, {
38 targetBlockId: row.childBlockId,
39 targetWorkflowId: row.childWorkflowId,
40 })
41 childToParent.set(row.childBlockId, {
42 targetBlockId: row.parentBlockId,
43 targetWorkflowId: row.parentWorkflowId,
44 })
45 }
46 return { parentToChild, childToParent }
47}
48
49/**
50 * Orient one workflow's copy mapping (`sourceBlockId -> targetBlockId`) into block pairs.

Callers 2

promoteForkFunction · 0.90
route.tsFile · 0.90

Calls 2

setMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected