package graph import ( "maps" "slices" "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshcatalog" ) // NodeOf is the node of the module graph a catalog graph entry carries, as the indexer took it in (design 47, *Two // graphs*): the catalog half's holder reads its graph back from its newest trunk revision, and every part that reads the // catalog half reads the module graph from its entries, never from the holder's state. func NodeOf(e meshcatalog.CatalogEntry) Node { n := Node{V: Version, FP: e.Fp, None: e.None, Repository: e.Repository, Path: e.Path, Bases: e.Bases, Provides: e.Provides, Requires: e.Requires, Awaits: e.Awaits, Invokes: e.Invokes, Serves: e.Serves, LeftOut: e.LeftOut} if len(e.Packages) > 0 { n.Packages = slices.Sorted(maps.Keys(e.Packages)) } for language, t := range e.Toolchains { if n.Toolchains == nil { n.Toolchains = map[string]Toolchain{} } n.Toolchains[language] = Toolchain{Module: t.Module, Version: t.Version, Recipe: t.Recipe} } return n }