starCounts
uses tcmts.registry.stars, which uses tcmts.server.table, which uses tcmts.server.Table, which uses #tcm/host (database)
Each library's stars, by libraryKey.
import { libraryKey, stars } from "#codebase/tcmts/registry"; export async function starCounts(): Promise<Map<string, number>> { // (each person once: their star's place is one per library) const who = new Map<string, Set<string>>(); for (const { value: s } of await stars.find({ state: "verified" })) { const k = libraryKey({ did: s.author, package: s.package }); who.set(k, (who.get(k) ?? new Set()).add(s.did)); } return new Map([...who].map(([k, dids]) => [k, dids.size])); }