yanksOf

tcmts.registry.yanksOf · #w5bivapt · term · runs anywhere

The releases their authors yanked, by URI, each with its yank: one of its namespace, written by the release's own author, of what the registry shows (shownAttestations). Anyone else's yank of it yanks nothing.

import type { RegistryAttestation, RegistryRelease } from "#codebase/tcmts/registry";

export function yanksOf(
  shown: RegistryRelease[],
  said: RegistryAttestation[],
): Map<string, RegistryAttestation> {
  const byAuthor = new Map(
    said.filter((a) => a.kind === "yank").map((a) => [`${a.did} ${a.namespace}`, a]),
  );
  const yanks = new Map<string, RegistryAttestation>();
  for (const r of shown) {
    const y = byAuthor.get(`${r.did} ${r.namespace}`);
    if (y) yanks.set(r.uri, y);
  }
  return yanks;
}

uses

used by