summaryOf

tcmts.share.summaryOf · #pq363scn · term · runs anywhere

A history entry's changes by name (EntrySummary), from what diffNamespaces says it changed.

import { keyPath } from "#codebase/tcmts/cli/diff";
import type { NamespaceDiff } from "#codebase/tcmts/cli/diff";
import type { EntrySummary } from "#codebase/tcmts/share";

export function summaryOf(d: NamespaceDiff): EntrySummary {
  return {
    edited: [...d.edited, ...d.reworded].map((x) => keyPath(x.path)).sort(),
    added: d.added.map((x) => keyPath(x.path)).sort(),
    removed: d.removed.map((x) => keyPath(x.path)).sort(),
    renamed: d.renamed.map((x) => ({ from: keyPath(x.from), to: keyPath(x.to) })),
    propagated: d.propagated.length,
  };
}

uses

used by