import { createId } from "@paralleldrive/cuid2"; import { SessionState, Edge } from "indite-js/schemas"; export const addEdgeToBot = ( state: SessionState, edge: Edge ): SessionState => ({ ...state, botsQueue: state.botsQueue.map((bot, index) => index === 0 ? { ...bot, bot: { ...bot.bot, edges: [...bot.bot.edges, edge], }, } : bot ), }); export const createPortalEdge = ({ to }: Pick) => ({ id: "virtual-" + createId(), from: { blockId: "", groupId: "" }, to, });