| 7105 | } |
| 7106 | |
| 7107 | function resolveProjectedOrderValue( |
| 7108 | path: TraversalPath<any, any, any>, |
| 7109 | key: string | undefined, |
| 7110 | ): unknown { |
| 7111 | if (key === undefined) { |
| 7112 | return path.value; |
| 7113 | } |
| 7114 | |
| 7115 | // First try to get the value as a bound variable (for aliases like `WITH a.num AS val`) |
| 7116 | // then fall back to property access (for expressions like `ORDER BY a.num`) |
| 7117 | const pathNode = path.get(key); |
| 7118 | return pathNode !== undefined ? pathNode.value : path.property(key as never); |
| 7119 | } |
| 7120 | |
| 7121 | /** |
| 7122 | * Expression type for UNWIND - can be a literal list, null, property access, variable reference, parameter, function call, or general expression. |