librariesUsed
uses tcmts.registry.releases, which uses tcmts.server.table, which uses tcmts.server.Table, which uses #tcm/host (database)
The libraries someone uses, by libraryKey: those the releases they've announced hold (the registry knows them by
hash), and those a codebase they named holds (codebase, a tcm serve URL: its main branch's library records).
import { cached, librariesOfCodebase, libraryKey, registryCodebase, releases, shownRelease, uses, } from "#codebase/tcmts/registry"; export async function librariesUsed(did: string, codebase?: string): Promise<Set<string>> { const out = new Set<string>(); const keyOf = async (namespace: string) => (await releases.find({ namespace })).map((r) => r.value).find(shownRelease); for (const r of (await releases.find({ did })).map((x) => x.value)) for (const u of await uses.find({ uri: r.uri })) { const lib = await keyOf(u.value.namespace); if (lib) out.add(libraryKey(lib)); } if (codebase) for (const k of await cached(`codebase ${codebase}`, () => librariesOfCodebase(registryCodebase(), codebase), )) out.add(k); return out; }
uses
- tcmts.registry.cached
- tcmts.registry.librariesOfCodebase
- tcmts.registry.libraryKey
- tcmts.registry.registryCodebase
- tcmts.registry.releases
- tcmts.registry.shownRelease
- tcmts.registry.uses