lib.ts
Language TypeScript804 B19 lines
import { readFile } from 'node:fs/promises'import type { RosterEntry } from '@meridian/ninety-client'/*** Pinned roster entries from `roster.json` at the repo root, or undefined when* there is no usable file. Pinning keeps someone with an empty plate on the* board: GET /todos/company only returns people who have open work, and absent* reads as untracked, not as idle. Entries still holding a `REPLACE` id are* template lines and are dropped.*/export async function loadRoster(): Promise<RosterEntry[] | undefined> {try {const raw = JSON.parse(await readFile(new URL('../roster.json', import.meta.url), 'utf8'))const entries = (raw.entries ?? raw) as RosterEntry[]return entries.filter((e) => e.id && !e.id.startsWith('REPLACE'))} catch {return undefined}}