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

Function convertNestedPropertyValue

packages/graph/src/astToSteps.ts:594–623  ·  view source on GitHub ↗

* Convert a single property value, handling NestedMap, ListLiteral, and ParameterRef.

(value: unknown)

Source from the content-addressed store, hash-verified

592 * Convert a single property value, handling NestedMap, ListLiteral, and ParameterRef.
593 */
594function convertNestedPropertyValue(value: unknown): unknown {
595 if (value === null || value === undefined) {
596 return value;
597 }
598
599 if (typeof value !== "object") {
600 return value;
601 }
602
603 const obj = value as Record<string, unknown>;
604
605 // Handle NestedMap - convert to plain object recursively
606 if (obj.type === "NestedMap") {
607 return convertPropertyMap(obj.value as Record<string, unknown>);
608 }
609
610 // Handle ListLiteral - convert to plain array recursively
611 if (obj.type === "ListLiteral") {
612 return (obj.values as unknown[]).map(convertNestedPropertyValue);
613 }
614
615 // Handle ParameterRef - preserve as-is for runtime resolution
616 // The Steps expect the original ParameterRef format
617 if (obj.type === "ParameterRef") {
618 return obj;
619 }
620
621 // For other objects (shouldn't happen in valid AST), return as-is
622 return value;
623}
624
625/**
626 * Convert a CREATE clause into a CreateStep.

Callers 1

convertPropertyMapFunction · 0.85

Calls 2

convertPropertyMapFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected