import type { ChannelGroup } from "./channelGroups"; import { CONTRACT } from "./corpus"; import { pageFileName } from "./archive/contract"; export type ChannelEntry = { name: string; count: number; // Channel slug (directory name under transcripts/channels/). Optional for // backwards compat with older manifests. Carried so a federating hub can key // channels by (origin, slug) without collisions — display names collide // across sites, slugs don't. slug?: string; // Group this channel belongs to (resolved against SiteSettings.groups at // index-build time). Optional for backwards compat with older manifests: // a missing groupId implies the default group. groupId?: string; }; export type Manifest = { version: number; totalCount: number; pageSize: number; pageCount: number; generatedAt: string; channels: ChannelEntry[]; // Channel groups + default-group id, surfaced to clients so they can render // grouped checkboxes without a second roundtrip. Optional for backwards // compat — clients fall back to a synthesized single group. groups?: ChannelGroup[]; defaultGroupId?: string; // The site this manifest was built for. The channel/group set is now // site-scoped (a subset of the global pool). Optional for backwards compat. siteId?: string; }; // v3: manifests are now per-site (channels/groups are a site selection, not the // whole pool). Bumped so a stale single-site manifest forces a rebuild. export const MANIFEST_VERSION = CONTRACT.manifest; export const SUMMARIES_PAGE_SIZE = CONTRACT.summariesPageSize; // THE page-shard file name, for every layer. It was three identical copies // in this file (summaries, transcripts, subs) plus one per layer module; // `page-0.json` is a 404 on every published archive, so a copy that lost the // padding would 404 silently against a real site and pass every unit test. // // Defined in `archive/contract.ts` — beside CONTRACT.pagePad and the URL // builders that use it — and re-exported here so the twelve call sites that // import it from `./manifest` (and the three per-layer aliases in stats.ts / // posts.ts / digests.ts) are unchanged. export { pageFileName }; export const TRANSCRIPTS_MANIFEST_VERSION = CONTRACT.transcriptsManifest; export type ChannelTranscriptsManifest = { version: number; channelSlug: string; pageCount: number; maxPageBytes: number; generatedAt: string; slugToPage: Record; }; // v4: per-site subs manifest (channels/groups are a site selection). export const SUBS_MANIFEST_VERSION = CONTRACT.subsManifest; export type SubsChannelEntry = { name: string; slug: string; videoCount: number; tracks: string[]; // Number of videos in this channel that contain a live_chat track. Optional // for backwards compat — older manifests don't have it. liveChatCount?: number; groupId?: string; }; export type SubsManifest = { version: number; channels: SubsChannelEntry[]; totalCount: number; // Sum of liveChatCount across all channels; used by the export UI to label // the Live chat tab. Optional for backwards compat. liveChatTotalCount?: number; generatedAt: string; groups?: ChannelGroup[]; defaultGroupId?: string; siteId?: string; }; export const SUBS_CHANNEL_MANIFEST_VERSION = CONTRACT.subsChannelManifest; export type ChannelSubsManifest = { version: number; channelSlug: string; pageCount: number; maxPageBytes: number; generatedAt: string; tracks: string[]; slugToPage: Record; };