MCPcopy
hub / github.com/simstudioai/sim / resolveSkillsLabel

Function resolveSkillsLabel

apps/sim/lib/workflows/subblocks/display.ts:485–509  ·  view source on GitHub ↗
(
  subBlock: SubBlockConfig | undefined,
  rawValue: unknown,
  skills: Array<{ id: string; name: string }>
)

Source from the content-addressed store, hash-verified

483 * reference. Unresolvable entries are skipped rather than shown as raw ids.
484 */
485export function resolveSkillsLabel(
486 subBlock: SubBlockConfig | undefined,
487 rawValue: unknown,
488 skills: Array<{ id: string; name: string }>
489): string | null {
490 if (subBlock?.type !== 'skill-input') return null
491 if (!Array.isArray(rawValue) || rawValue.length === 0) return null
492
493 const names = rawValue
494 .map((skill: unknown) => {
495 if (!skill || typeof skill !== 'object') return null
496 const s = skill as { skillId?: string; name?: string }
497
498 if (s.skillId) {
499 const found = skills.find((candidate) => candidate.id === s.skillId)
500 if (found?.name) return found.name
501 }
502 if (typeof s.name === 'string' && s.name) return s.name
503
504 return null
505 })
506 .filter((name): name is string => !!name)
507
508 return summarizeNames(names)
509}

Callers 3

display.test.tsFile · 0.90
block.tsxFile · 0.90
workflow-block.tsxFile · 0.90

Calls 1

summarizeNamesFunction · 0.85

Tested by

no test coverage detected