ADR 0593 §7: the composer with its refusals leaves mesh-sdk, so mesh-sdk carries no composition rule. The catalogue functions only the node-engine's composition reaches (Resolve, Resolution's Compose, Declaration, DataItems, LeftOut, Rules and the rest, the settings, placeholder and template refusals, the rendering helpers) are copied with their tests into internal/compose/resolution; a method of a mesh-sdk shape becomes a function taking it first. The composition calls its own copies, and the captured catalogue its tests read lives here now, shared by mesh-compose's tests. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
32 lines
1.2 KiB
Go
32 lines
1.2 KiB
Go
package resolution
|
|
|
|
import (
|
|
mcat "git.novox.be/novox/mesh-sdk/go/catalogue"
|
|
)
|
|
|
|
// DataItems is every data item the resolution's modules declare, placed on its node with the rendering given: the text
|
|
// the node-backup holder is handed, read. A module left out of the node's declaration keeps its items, as its data is
|
|
// still on the node (ADR 0262); an item that cannot be placed is said in unplaced and left out.
|
|
func DataItems(r mcat.Resolution, with mcat.Rendering) (items map[string][]mcat.PlacedDataItem, unplaced []string, err error) {
|
|
left := LeftOut(r, with.Settings, with.Adopted)
|
|
for module, why := range with.NotPlaced {
|
|
if _, already := left[module]; !already {
|
|
left[module] = why
|
|
}
|
|
}
|
|
modules := make([]mcat.Manifest, 0, len(r.Modules))
|
|
for _, m := range r.Modules {
|
|
if _, isLeft := left[m.Module]; isLeft {
|
|
m = backupView(m)
|
|
}
|
|
modules = append(modules, m)
|
|
}
|
|
text, unplaced, err := seatContributions(modules, mcat.Manifest{}, mcat.BackupSeat+":"+mcat.BackupKindData, with,
|
|
machineFacts(r, with.Names, with.MeshRange), r.Capabilities)
|
|
if err != nil {
|
|
return nil, unplaced, err
|
|
}
|
|
items, err = mcat.ParseDataItems(text)
|
|
return items, unplaced, err
|
|
}
|