From 93c14d2c7289de962b55f1fad8d3363f4501de4b Mon Sep 17 00:00:00 2001 From: Ricardo Devis Agullo Date: Thu, 21 Aug 2025 19:50:48 +0200 Subject: [PATCH] add meta query for components --- src/registry/routes/index.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/registry/routes/index.ts b/src/registry/routes/index.ts index 72344887..38a79bdc 100644 --- a/src/registry/routes/index.ts +++ b/src/registry/routes/index.ts @@ -106,6 +106,7 @@ export default function (repository: Repository) { ); } else { const state = req.query['state'] || ''; + const meta = req.query['meta'] === 'true' && res.conf.discovery.ui; let list = componentResults; if (!res.conf.discovery.experimental) { list = list.filter( @@ -118,9 +119,20 @@ export default function (repository: Repository) { res.status(200).json( Object.assign(baseResponse, { - components: list.map((component) => - urlBuilder.component(component.name, res.conf.baseUrl) - ) + components: list.map((component) => { + const href = urlBuilder.component(component.name, res.conf.baseUrl); + + return meta + ? { + href, + name: component.name, + version: component.version, + description: component.description, + state: component.oc.state, + publishDate: new Date(component.oc.date).toISOString() + } + : href; + }) }) ); }