(
nodes: SnapshotState['nodes'],
refInput: string,
options: {
fallbackLabel: string;
},
)
| 304 | } |
| 305 | |
| 306 | function tryResolveRefNode( |
| 307 | nodes: SnapshotState['nodes'], |
| 308 | refInput: string, |
| 309 | options: { |
| 310 | fallbackLabel: string; |
| 311 | }, |
| 312 | ): { ref: string; node: SnapshotNode } | null { |
| 313 | const ref = normalizeRef(refInput); |
| 314 | if (!ref) throw new AppError('INVALID_ARGS', `Invalid ref: ${refInput}`); |
| 315 | const refNode = findNodeByRef(nodes, ref); |
| 316 | if (isUsableResolvedNode(refNode)) return { ref, node: refNode }; |
| 317 | const fallbackNode = |
| 318 | options.fallbackLabel.length > 0 ? findNodeByLabel(nodes, options.fallbackLabel) : null; |
| 319 | if (isUsableResolvedNode(fallbackNode)) { |
| 320 | return { ref, node: fallbackNode }; |
| 321 | } |
| 322 | return null; |
| 323 | } |
| 324 | |
| 325 | function resolveNodeCenter(node: SnapshotNode, message: string): Point { |
| 326 | const point = resolveRectCenter(node.rect); |
no test coverage detected
searching dependent graphs…