import { getCollection } from 'astro:content'; /** * The single entry of an app's privacy-policy collection. * * The Markdown lives in the app's own repository (see scripts/sync-external.mjs); * this site holds no copy. If the checkout is missing or empty the collection * resolves nothing, and a privacy page that renders nothing is worse than a * failed build — so this throws rather than returning undefined. */ export async function getPolicy(collection: 'calendulaPolicy' | 'agendulaPolicy') { const entries = await getCollection(collection); if (entries.length !== 1) { throw new Error( `[policy] ${collection} resolved ${entries.length} entries, expected exactly 1. ` + 'The app repository under external/ is missing, empty, or holds more than ' + 'one PRIVACY.md. Run `npm run sync:external` and read its output.' ); } return entries[0]; }