* Convert a REMOVE clause into a RemoveStep.
(removeClause: RemoveClause)
| 725 | * Convert a REMOVE clause into a RemoveStep. |
| 726 | */ |
| 727 | function convertRemoveClause(removeClause: RemoveClause): RemoveStep { |
| 728 | const items: RemoveStepItem[] = removeClause.items.map((item) => { |
| 729 | if (item.type === "RemoveProperty") { |
| 730 | return { |
| 731 | type: "property" as const, |
| 732 | variable: item.variable, |
| 733 | property: item.property, |
| 734 | }; |
| 735 | } else { |
| 736 | // Label removal is not supported - validate early |
| 737 | throw new Error( |
| 738 | `REMOVE: Label removal is not supported. Labels are immutable. ` + |
| 739 | `Cannot remove label '${item.label}' from '${item.variable}'.`, |
| 740 | ); |
| 741 | } |
| 742 | }); |
| 743 | |
| 744 | return new RemoveStep({ items }); |
| 745 | } |
| 746 | |
| 747 | /** |
| 748 | * Convert a MERGE clause into a MergeStep. |
no test coverage detected