MCPcopy Create free account
hub / github.com/codemix/graph / resolveOrderValue

Function resolveOrderValue

packages/graph/src/Steps.ts:3995–4023  ·  view source on GitHub ↗
(
  item: unknown,
  key: string | undefined,
  expression?: ConditionValue,
  context?: QueryContext,
)

Source from the content-addressed store, hash-verified

3993}
3994
3995function resolveOrderValue(
3996 item: unknown,
3997 key: string | undefined,
3998 expression?: ConditionValue,
3999 context?: QueryContext,
4000): unknown {
4001 if (expression !== undefined) {
4002 if (item instanceof TraversalPath) {
4003 return resolveConditionValue(item, expression, context);
4004 }
4005 return undefined;
4006 }
4007
4008 if (key === undefined) {
4009 return item instanceof TraversalPath ? item.value : item;
4010 }
4011
4012 if (item instanceof TraversalPath) {
4013 // First try to get the value as a bound variable (for aliases like UNWIND x)
4014 // then fall back to property access (for expressions like ORDER BY n.name)
4015 return item.get(key)?.value ?? item.property(key as never);
4016 }
4017
4018 if (typeof item === "object" && item !== null) {
4019 return (item as Record<string, unknown>)[key];
4020 }
4021
4022 return undefined;
4023}
4024
4025export interface UnionStepConfig extends StepConfig {}
4026

Callers 1

traverseMethod · 0.85

Calls 3

resolveConditionValueFunction · 0.85
getMethod · 0.65
propertyMethod · 0.45

Tested by

no test coverage detected