From 3d6527a78f6998149890e1e34acabe8fb0459692 Mon Sep 17 00:00:00 2001 From: Char Date: Wed, 22 Jul 2026 11:10:11 +0200 Subject: [PATCH 1/3] feat(elements): add Serenity Data Insights topics + topic-prompts endpoints (LLMO-6418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add two Serenity/Semrush brand-presence endpoints backing the Data Insights table: - GET .../serenity/brand-presence/topics — per-topic aggregates + each topic's embedded prompts - GET .../serenity/brand-presence/topics/:topicId/prompts — per-prompt drill-down (paged) Both are built from the single PROMPTS_BY_TOPIC element (78864493) — grouped by topic (server-side aggregation) / scoped via CBF_topic — rather than the wiki's 3-element fan-out (141adc88 currently 500s, 0564b061 lacks position; the live MFE also uses only 78864493). Adds unit tests for both definitions plus OpenAPI + contract-test coverage. Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/index.html | 156 +++++++++++++-- docs/openapi/api.yaml | 4 + docs/openapi/schemas.yaml | 127 ++++++++++++ docs/openapi/serenity-api.yaml | 187 ++++++++++++++++++ src/controllers/elements.js | 165 ++++++++++++++++ src/routes/facs-capabilities.js | 2 + src/routes/index.js | 5 + src/routes/required-capabilities.js | 2 + src/support/elements/definitions/index.js | 2 + .../elements/definitions/topic-prompts.js | 130 ++++++++++++ .../elements/definitions/topics-insights.js | 109 ++++++++++ src/support/elements/elements-service.js | 46 +++++ test/openapi-contract/serenity-api.test.js | 66 +++++++ .../definitions/topic-prompts.test.js | 168 ++++++++++++++++ .../definitions/topics-insights.test.js | 136 +++++++++++++ 15 files changed, 1288 insertions(+), 17 deletions(-) create mode 100644 src/support/elements/definitions/topic-prompts.js create mode 100644 src/support/elements/definitions/topics-insights.js create mode 100644 test/support/elements/definitions/topic-prompts.test.js create mode 100644 test/support/elements/definitions/topics-insights.test.js diff --git a/docs/index.html b/docs/index.html index 7d7cb39423..dbb629afb7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -489,7 +489,7 @@ " aria-expanded="false" class="sc-tYrig hNMAOR">