Something went wrong. Try again.
The IoT platform Cloudflare didn't build. Telemetry, realtime dashboards, and automations on Workers + D1 + R2 + Durable Objects — in your… nodrix.live
Something went wrong. Try again.
1234567891011121314151617181920212223242526// Resolves an automation row to its executable graph from the persisted `graph`// column (the source of truth). Pure graph helpers live in @nodrix/blocks-shared.
import { isGraph, type AutomationGraph } from '@nodrix/blocks-shared';import type { AutomationRow } from './types';
export { triggerNodes, entryNode, nodesById, outgoingEdges, countActionNodes,} from '@nodrix/blocks-shared';
const EMPTY: AutomationGraph = { nodes: [], edges: [] };
export function toGraph(row: AutomationRow): AutomationGraph { if (!row.graph) return EMPTY; try { const parsed = JSON.parse(row.graph); return isGraph(parsed) ? parsed : EMPTY; } catch { return EMPTY; }}