(entry: CachedComponentMetadata)
| 13 | import { categorizeComponent, getCategoryConfig } from './utils/categorization'; |
| 14 | |
| 15 | function serializeComponent(entry: CachedComponentMetadata) { |
| 16 | const component = entry.definition; |
| 17 | const metadata = component.ui ?? { |
| 18 | slug: component.id, |
| 19 | version: '1.0.0', |
| 20 | type: 'process', |
| 21 | category: 'transform', |
| 22 | }; |
| 23 | |
| 24 | // Categorize the component using the new backend logic |
| 25 | const category = categorizeComponent(component); |
| 26 | const categoryConfig = getCategoryConfig(category); |
| 27 | |
| 28 | return { |
| 29 | id: component.id, |
| 30 | slug: metadata.slug ?? component.id, |
| 31 | name: component.label, |
| 32 | version: metadata.version ?? '1.0.0', |
| 33 | type: metadata.type ?? 'process', |
| 34 | category: category, |
| 35 | categoryConfig: categoryConfig, |
| 36 | description: metadata.description ?? component.docs ?? '', |
| 37 | documentation: metadata.documentation ?? component.docs ?? '', |
| 38 | documentationUrl: metadata.documentationUrl ?? null, |
| 39 | icon: metadata.icon ?? null, |
| 40 | logo: metadata.logo ?? null, |
| 41 | author: metadata.author ?? null, |
| 42 | isLatest: metadata.isLatest ?? true, |
| 43 | deprecated: metadata.deprecated ?? false, |
| 44 | example: metadata.example ?? null, |
| 45 | runner: component.runner, |
| 46 | inputs: entry.inputs ?? [], |
| 47 | outputs: entry.outputs ?? [], |
| 48 | parameters: entry.parameters ?? [], |
| 49 | examples: metadata.examples ?? [], |
| 50 | toolProvider: component.toolProvider ?? null, |
| 51 | toolSchema: isAgentCallable(component) ? getToolSchema(component) : null, |
| 52 | }; |
| 53 | } |
| 54 | |
| 55 | @ApiTags('components') |
| 56 | @Controller('components') |
no test coverage detected