shownAttestations

tcmts.registry.shownAttestations · #n7osicib · term · runs on the server

uses tcmts.registry.releases, which uses tcmts.server.table, which uses tcmts.server.Table, which uses #tcm/host (database)

What the registry shows of what people say: reviews and advisories checked against their writers' repositories, and yanks only from the release's own author: someone with a release of that namespace the registry checked (shownRelease), saying it's theirs.

import { attestations, releases, shownRelease } from "#codebase/tcmts/registry";
import type { RegistryAttestation } from "#codebase/tcmts/registry";

export async function shownAttestations(): Promise<RegistryAttestation[]> {
  const authors = new Map<string, Set<string>>();
  for (const { value: r } of await releases.find())
    if (shownRelease(r))
      authors.set(r.namespace, (authors.get(r.namespace) ?? new Set()).add(r.did));
  return (await attestations.find({ state: "verified" }))
    .map((a) => a.value)
    .filter(
      (a) =>
        a.kind !== "yank" ||
        (authors.get(a.namespace)?.has(a.did) === true &&
          (a.author === undefined || a.author === a.did)),
    );
}

uses

used by