(
source: GraphSource<any>,
input: Iterable<TraversalPath<any, any, any>>,
context?: QueryContext,
)
| 7165 | } |
| 7166 | |
| 7167 | public *traverse( |
| 7168 | source: GraphSource<any>, |
| 7169 | input: Iterable<TraversalPath<any, any, any>>, |
| 7170 | context?: QueryContext, |
| 7171 | ): IterableIterator<TraversalPath<any, any, any>> { |
| 7172 | const { expression, alias } = this.config; |
| 7173 | |
| 7174 | for (const path of input) { |
| 7175 | this.traversed++; |
| 7176 | |
| 7177 | // Get the list to unwind |
| 7178 | const listValue = this.resolveListExpression(path, expression, context); |
| 7179 | |
| 7180 | // If the expression is null/undefined or not an array, yield nothing (standard Cypher behavior) |
| 7181 | if (!Array.isArray(listValue)) { |
| 7182 | continue; |
| 7183 | } |
| 7184 | |
| 7185 | // If the list is empty, yield nothing |
| 7186 | if (listValue.length === 0) { |
| 7187 | continue; |
| 7188 | } |
| 7189 | |
| 7190 | // For each element, create a new path with the element bound to the alias |
| 7191 | for (const element of listValue) { |
| 7192 | // Create a new path that extends the input path with the unwound element |
| 7193 | const newPath = path.with(element, [alias]); |
| 7194 | this.emitted++; |
| 7195 | yield newPath; |
| 7196 | } |
| 7197 | } |
| 7198 | } |
| 7199 | |
| 7200 | protected resolveListExpression( |
| 7201 | path: TraversalPath<any, any, any>, |
nothing calls this directly
no test coverage detected