(
_source: GraphSource<any>,
input: Iterable<TraversalPath<any, any, any>>,
context?: QueryContext,
)
| 4724 | } |
| 4725 | |
| 4726 | public *traverse( |
| 4727 | _source: GraphSource<any>, |
| 4728 | input: Iterable<TraversalPath<any, any, any>>, |
| 4729 | context?: QueryContext, |
| 4730 | ): IterableIterator<unknown> { |
| 4731 | const { items } = this.config; |
| 4732 | |
| 4733 | // Check if this is a single item and what type it is |
| 4734 | const singleItem = items.length === 1 ? items[0] : null; |
| 4735 | const isPlainVariableRef = |
| 4736 | singleItem && |
| 4737 | typeof singleItem.expression === "object" && |
| 4738 | singleItem.expression !== null && |
| 4739 | "type" in singleItem.expression && |
| 4740 | singleItem.expression.type === "variableRef"; |
| 4741 | |
| 4742 | for (const path of input) { |
| 4743 | this.traversed++; |
| 4744 | |
| 4745 | const results: unknown[] = []; |
| 4746 | for (const item of items) { |
| 4747 | const value = resolveConditionValue(path, item.expression, context); |
| 4748 | results.push(value); |
| 4749 | } |
| 4750 | |
| 4751 | this.emitted++; |
| 4752 | |
| 4753 | // For backward compatibility with SelectStep + ValuesStep behavior: |
| 4754 | // - Plain variable refs (RETURN a) yield array: [value] |
| 4755 | // - Property access/functions (RETURN a.name, RETURN id(a)) yield value directly |
| 4756 | // - Multiple items always yield array |
| 4757 | if (items.length === 1 && !isPlainVariableRef) { |
| 4758 | yield results[0]; |
| 4759 | } else { |
| 4760 | yield results; |
| 4761 | } |
| 4762 | } |
| 4763 | } |
| 4764 | |
| 4765 | public override clone(partial?: Partial<ExpressionReturnStepConfig>): ExpressionReturnStep { |
| 4766 | return new ExpressionReturnStep({ |
nothing calls this directly
no test coverage detected