(
path: TraversalPath<any, any, any>,
value: SetAssignmentValue,
context?: QueryContext,
)
| 6562 | } |
| 6563 | |
| 6564 | protected resolveValue( |
| 6565 | path: TraversalPath<any, any, any>, |
| 6566 | value: SetAssignmentValue, |
| 6567 | context?: QueryContext, |
| 6568 | ): any { |
| 6569 | if (value.type === "literal") { |
| 6570 | return value.value; |
| 6571 | } else if (value.type === "property") { |
| 6572 | const sourcePath = path.get(value.variable); |
| 6573 | if (!sourcePath) { |
| 6574 | throw new Error(`MERGE: Source variable '${value.variable}' not found`); |
| 6575 | } |
| 6576 | const sourceElement = sourcePath.value; |
| 6577 | if (sourceElement instanceof Vertex || sourceElement instanceof Edge) { |
| 6578 | return sourceElement.get(value.property as never); |
| 6579 | } |
| 6580 | throw new Error(`MERGE: Source variable '${value.variable}' is not a vertex or edge`); |
| 6581 | } else if (value.type === "variable") { |
| 6582 | const sourcePath = path.get(value.variable); |
| 6583 | if (!sourcePath) { |
| 6584 | throw new Error(`MERGE: Source variable '${value.variable}' not found`); |
| 6585 | } |
| 6586 | return sourcePath.value; |
| 6587 | } else if (value.type === "parameter") { |
| 6588 | const params = context?.params ?? getQueryParams(); |
| 6589 | return params[value.name]; |
| 6590 | } else if (value.type === "list") { |
| 6591 | return value.values; |
| 6592 | } |
| 6593 | return undefined; |
| 6594 | } |
| 6595 | |
| 6596 | public override clone(partial?: Partial<MergeStepConfig>) { |
| 6597 | return new MergeStep({ |
no test coverage detected