def sources
bendvy-ecs-core@0.1.0.4 · restore_graph_validation.bend:32
import bendvy-ecs-core@0.1.0.4/restore_graph_validation.bend as RestoreGraphValidation
import Base
import bendvy-ecs-core@0.1.0.4/restore_graph_data.bend as R
import bendvy-ecs-core@0.1.0.4/entity_key.bend as Key
import bendvy-ecs-core@0.1.0.4/snapshot_data.bend as Basic
import bendvy-ecs-core@0.1.0.4/relation_types.bend as G
import bendvy-ecs-core@0.1.0.4/relation_graph.bend as Graph
32def sources(~S:Data,values:List<&2,Key.Key>,+target:Key.Key,+descriptor:G.Descriptor<S>,+entities:List<&2,Basic.Entity>,+graph:G.Graph<S>,next:G.Graph<S> -> R.GraphResult<S>) -> R.GraphResult<S>:
33 match values:
34 case []:next(graph)
35 case +source <> rest:source_checked(~S,Bool.and(contains(source,entities),Bool.and(contains(target,entities),Bool.and(Bool.not(Key.equal(source,target)),absent(~S,Graph.target(~S,graph,descriptor,source))))),graph,descriptor,source,target,graph => sources(~S,rest,target,descriptor,entities,graph,next))