hostRefusal

tcmts.cli.roles.hostRefusal · #ae4e6fss · term · runs on the server

uses tcmts.cli.roles.manifestsIn, which uses tcmts.cli.config.configValue, which uses node:path

Why an app using these definitions (its closure, by hash) can't be built by this tcm, if it can't: a package it uses speaks a version of tcm's host protocol this tcm doesn't serve (HOST_PROTOCOLS).

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { HOST_PROTOCOLS, manifestsIn } from "#codebase/tcmts/cli/roles";
import type { NameRow } from "#codebase/tcmts/store";

export function hostRefusal(
  cb: Codebase,
  closure: ReadonlySet<string>,
  rows: NameRow[] = cb.store.names(),
): string | undefined {
  for (const { namespace, manifest } of manifestsIn(cb, rows)) {
    if (manifest.host === undefined || HOST_PROTOCOLS.includes(manifest.host)) continue;
    const uses = rows.some(
      (r) => (!namespace || r.path.startsWith(`${namespace}.`)) && closure.has(r.hash),
    );
    if (uses)
      return `${manifest.name} (${namespace || "the root namespace"}) speaks version ${manifest.host} of tcm's host protocol, and this tcm serves ${HOST_PROTOCOLS.join(", ")}: use a tcm that serves it, or a release of ${manifest.name} for this one`;
  }
  return undefined;
}

uses

used by