/* ============================================================================ CMS CONTENT MODEL - Knowledge and Impact + News ---------------------------------------------------------------------------- SERVER ONLY. Everything here reaches ~/lib/strapi, which imports ~/lib/env.server, so these helpers may only be called from a `loader`. The three collections below are what the Strapi agent has to create; the API ids and field names are the contract. Nothing in this file invents content: when a collection does not exist yet, or Strapi is unreachable, a listing degrades to `available: false` and the route renders its localised empty state instead of a 500. resources Reports, research and official documents (§6 of the draft) knowledge-items Training modules, guides, case studies, FAQs (§7) news-articles SHARP-ER news and network updates (§5) plus the two taxonomies that supply filter options: topics partners FIELD NAMES ARE THE ONES IN apps/cms/src/api//content-types// schema.json - not a guess. `resource.authors` in particular is a plain STRING field, not a relation, so there is no /api/authors to read. ========================================================================= */ import type { CmsLocalizable } from "./alternates"; import { findFirst, getBySlug, getMany, isStrapiError, mediaAlt, mediaFormatUrl, mediaUrl, type StrapiEntity, type StrapiMedia, type StrapiPagination, type StrapiQuery, } from "~/lib/strapi"; /* --------------------------------------------------------------------------- RESOURCE NAMES ------------------------------------------------------------------------ */ export const CMS = { resources: "resources", knowledgeItems: "knowledge-items", newsArticles: "news-articles", topics: "topics", partners: "partners", } as const; /* --------------------------------------------------------------------------- SHARED SHAPES ------------------------------------------------------------------------ */ /** A taxonomy entry. Only `name` and `slug` are ever read. */ export interface CmsTaxonomy extends StrapiEntity { readonly name: string; readonly slug: string; } /** One option of a filter `