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

Function toForkBlockPairs

apps/sim/lib/workspaces/fork/mapping/block-map-store.ts:54–72  ·  view source on GitHub ↗
(
  blockIdMapping: ReadonlyMap<string, string>,
  sourceIsParent: boolean,
  sourceWorkflowId: string,
  targetWorkflowId: string
)

Source from the content-addressed store, hash-verified

52 * fixed for the whole mapping (one source workflow copied into one target workflow).
53 */
54export function toForkBlockPairs(
55 blockIdMapping: ReadonlyMap<string, string>,
56 sourceIsParent: boolean,
57 sourceWorkflowId: string,
58 targetWorkflowId: string
59): ForkBlockPair[] {
60 const parentWorkflowId = sourceIsParent ? sourceWorkflowId : targetWorkflowId
61 const childWorkflowId = sourceIsParent ? targetWorkflowId : sourceWorkflowId
62 const pairs: ForkBlockPair[] = []
63 for (const [sourceBlockId, targetBlockId] of blockIdMapping) {
64 pairs.push({
65 parentWorkflowId,
66 childWorkflowId,
67 parentBlockId: sourceIsParent ? sourceBlockId : targetBlockId,
68 childBlockId: sourceIsParent ? targetBlockId : sourceBlockId,
69 })
70 }
71 return pairs
72}
73
74/**
75 * Replace the persisted pairs for the promoted SOURCE workflows with the live ones. Deleting

Callers 3

createForkFunction · 0.90
promoteForkFunction · 0.90

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected