MCPcopy Create free account
hub / github.com/astercloud/aster / resolveProps

Method resolveProps

ui/src/protocol/message-processor.ts:640–673  ·  view source on GitHub ↗

* Resolve property values from data model

(
    props: Record<string, unknown>,
    dataModel: DataMap,
  )

Source from the content-addressed store, hash-verified

638 * Resolve property values from data model
639 */
640 private resolveProps(
641 props: Record<string, unknown>,
642 dataModel: DataMap,
643 ): Record<string, unknown> {
644 const resolved: Record<string, unknown> = {};
645
646 for (const [key, value] of Object.entries(props)) {
647 if (key === 'children') {
648 // Skip children, handled separately
649 continue;
650 }
651
652 if (this.isPropertyValue(value)) {
653 resolved[key] = this.resolvePropertyValue(value as PropertyValue, dataModel);
654 }
655 else if (Array.isArray(value)) {
656 // Handle arrays (like tabs)
657 resolved[key] = value.map(item =>
658 typeof item === 'object' && item !== null
659 ? this.resolveProps(item as Record<string, unknown>, dataModel)
660 : item,
661 );
662 }
663 else if (typeof value === 'object' && value !== null) {
664 // Handle nested objects
665 resolved[key] = this.resolveProps(value as Record<string, unknown>, dataModel);
666 }
667 else {
668 resolved[key] = value;
669 }
670 }
671
672 return resolved;
673 }
674
675 /**
676 * Check if value is a PropertyValue

Callers 1

buildComponentNodeMethod · 0.95

Calls 2

isPropertyValueMethod · 0.95
resolvePropertyValueMethod · 0.95

Tested by

no test coverage detected