import { normalizeAppTabLocation, rawAppTabRoute } from "./app-tab-location"; import type { ObjectiveStatus } from "./objective-validation"; export const APP_TAB_METADATA_BATCH_SIZE = 100; export interface AppTabMetadata { pages: { id: string; project_id: string; title: string; icon: string | null }[]; objectives: { id: string; project_id: string; name: string; color: string | null; status: ObjectiveStatus }[]; pullRequests: { id: string; number: number; title: string | null }[]; routines: { id: string; title: string }[]; /** Family boards name their tab after the parent issue. */ issues: { id: string; project_id: string; number: number; title: string }[]; } export function appTabMetadataLocations(hrefs: string[]): string[] { return [...new Set(hrefs.map(normalizeAppTabLocation).filter((href): href is string => { if (!href) return false; // As written: a short code the client has not loaded yet still names a record. const route = rawAppTabRoute(href); return !!(route.pageId || route.objectiveId || route.prId || route.routineId || route.familyId); }))].sort(); }