(gateway: GatewayClient)
| 8 | import type { ToolResponse } from '../types'; |
| 9 | import { validateGraph } from './base'; |
| 10 | import { arrangeNodes, type LayoutMode, type LayoutReport } from './layout'; |
| 11 | import { validateGraphCapabilitiesWithGateway } from './capabilityValidation'; |
| 12 | import { getDeviceList, invalidateGraph, scanGraphs } from './gatewayCache'; |
| 13 | |
| 14 | function nextGraphId(): string { |
| 15 | return String(randomInt(1_000_000_000_000, 10_000_000_000_000)); |
| 16 | } |
| 17 | |
| 18 | function replaceRuleScope(value: unknown, scope: string): unknown { |
| 19 | if (Array.isArray(value)) return value.map((item) => replaceRuleScope(item, scope)); |
| 20 | if (!value || typeof value !== 'object') return value; |
| 21 | return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, key === 'scope' && item === 'rule' ? scope : replaceRuleScope(item, scope)])); |
| 22 | } |
| 23 | |
| 24 | function comparableNodes(nodes: Graph['nodes']): unknown { |
| 25 | return nodes.map((node) => { |
| 26 | const { pos: _pos, ...cfg } = node.cfg || {}; |
| 27 | return { ...node, cfg }; |
| 28 | }); |
| 29 | } |
| 30 |
no outgoing calls
no test coverage detected