From 1029ba0e4df7b2e544cf6de8acf5e9f784c04496 Mon Sep 17 00:00:00 2001 From: waleed Date: Thu, 8 Jan 2026 19:33:04 -0800 Subject: [PATCH] remove unused code --- apps/sim/stores/undo-redo/utils.ts | 145 ----------------------------- 1 file changed, 145 deletions(-) diff --git a/apps/sim/stores/undo-redo/utils.ts b/apps/sim/stores/undo-redo/utils.ts index 94c2c43fde..aef24740a4 100644 --- a/apps/sim/stores/undo-redo/utils.ts +++ b/apps/sim/stores/undo-redo/utils.ts @@ -163,148 +163,3 @@ export function createInverseOperation(operation: Operation): Operation { } } } - -export function operationToCollaborativePayload(operation: Operation): { - operation: string - target: string - payload: Record -} { - switch (operation.type) { - case 'batch-add-blocks': { - const op = operation as BatchAddBlocksOperation - return { - operation: 'batch-add-blocks', - target: 'blocks', - payload: { - blocks: op.data.blockSnapshots, - edges: op.data.edgeSnapshots, - loops: {}, - parallels: {}, - subBlockValues: op.data.subBlockValues, - }, - } - } - - case 'batch-remove-blocks': { - const op = operation as BatchRemoveBlocksOperation - return { - operation: 'batch-remove-blocks', - target: 'blocks', - payload: { ids: op.data.blockSnapshots.map((b) => b.id) }, - } - } - - case 'add-edge': - return { - operation: 'add', - target: 'edge', - payload: { id: operation.data.edgeId }, - } - - case 'batch-add-edges': { - const op = operation as BatchAddEdgesOperation - return { - operation: 'batch-add-edges', - target: 'edges', - payload: { - edges: op.data.edgeSnapshots.map((e) => ({ - id: e.id, - source: e.source, - target: e.target, - sourceHandle: e.sourceHandle ?? null, - targetHandle: e.targetHandle ?? null, - })), - }, - } - } - - case 'batch-remove-edges': { - const op = operation as BatchRemoveEdgesOperation - return { - operation: 'batch-remove-edges', - target: 'edges', - payload: { ids: op.data.edgeSnapshots.map((e) => e.id) }, - } - } - - case 'batch-move-blocks': { - const op = operation as BatchMoveBlocksOperation - return { - operation: 'batch-update-positions', - target: 'blocks', - payload: { - moves: op.data.moves.map((m) => ({ - id: m.blockId, - x: m.after.x, - y: m.after.y, - parentId: m.after.parentId, - })), - }, - } - } - - case 'update-parent': - return { - operation: 'update-parent', - target: 'block', - payload: { - id: operation.data.blockId, - parentId: operation.data.newParentId, - x: operation.data.newPosition.x, - y: operation.data.newPosition.y, - }, - } - - case 'apply-diff': - return { - operation: 'apply-diff', - target: 'workflow', - payload: { - diffAnalysis: operation.data.diffAnalysis, - }, - } - - case 'accept-diff': - return { - operation: 'accept-diff', - target: 'workflow', - payload: { - diffAnalysis: operation.data.diffAnalysis, - }, - } - - case 'reject-diff': - return { - operation: 'reject-diff', - target: 'workflow', - payload: { - diffAnalysis: operation.data.diffAnalysis, - }, - } - - case 'batch-toggle-enabled': - return { - operation: 'batch-toggle-enabled', - target: 'blocks', - payload: { - blockIds: operation.data.blockIds, - previousStates: operation.data.previousStates, - }, - } - - case 'batch-toggle-handles': - return { - operation: 'batch-toggle-handles', - target: 'blocks', - payload: { - blockIds: operation.data.blockIds, - previousStates: operation.data.previousStates, - }, - } - - default: { - const exhaustiveCheck: never = operation - throw new Error(`Unhandled operation type: ${(exhaustiveCheck as Operation).type}`) - } - } -}