(node: AnyNode, parentId: AnyNodeId | null)
| 462 | } |
| 463 | |
| 464 | function parseCreatedNode(node: AnyNode, parentId: AnyNodeId | null): AnyNode { |
| 465 | const candidate = { ...node, parentId } |
| 466 | const parsed = AnyNodeSchema.safeParse(candidate) |
| 467 | if (parsed.success) return parsed.data |
| 468 | |
| 469 | const schema = getNodeSchemaForType(candidate.type) |
| 470 | const sanitized = sanitizeNumericValue(schema, candidate, undefined, []) |
| 471 | |
| 472 | if (sanitized.issues.length === 0) { |
| 473 | return candidate as AnyNode |
| 474 | } |
| 475 | |
| 476 | warnSanitizedNodeMutation('create', node.id, sanitized.issues) |
| 477 | |
| 478 | return sanitized.value as AnyNode |
| 479 | } |
| 480 | |
| 481 | function parseUpdatedNode(currentNode: AnyNode, data: Partial<AnyNode>): AnyNode { |
| 482 | const candidate = { ...currentNode, ...data } |
no test coverage detected
searching dependent graphs…