1 import Base 2 import ./ordinary_declaration.bend as Identity 3 import ./component.bend as C 4 import ./column.bend as Col 5 6 # Static trusted schema lenses; this Data binding owns no payload or closure. 7 type Binding<-S:Data,-Store:Type,-Rest:Type,-P:Type,-V:Data,-Token:Data,-take:Store -> Rest & Col.Column,-put:Rest -> Col.Column -> Store,-view:P -> P & V> is Data: 8 Binding{identity:Identity.Declaration,family:C.Family} 9 # Trusted schema setup: connect a component identity to its column take/put 10 # lenses and owner-preserving Data projection. The resulting Data binding owns 11 # no payload. Callers must supply mutually consistent lenses; this constructor 12 # does not prove their laws or establish runtime world identity. 13 # Example: examples/scheduled-health/registration.bend component bindings. 14 def bind(~S:Data,~Store:Type,~Rest:Type,~P:Type,~V:Data,~Token:Data,~take:Store -> Rest & Col.Column,~put:Rest -> Col.Column -> Store,~view:P -> P & V,+identity:Identity.Declaration) -> Binding: 15 Binding{identity,C.Family{Identity.key(~S,~P,identity)}} 16 # Return the schema-scoped component identity from a trusted binding. 17 # This detached declaration does not identify an entity or grant world access. 18 def identity(~S:Data,~Store:Type,~Rest:Type,~P:Type,~V:Data,~Token:Data,~take:Store -> Rest & Col.Column,~put:Rest -> Col.Column -> Store,~view:P -> P & V,binding:Binding) -> Identity.Declaration: 19 match binding: 20 case Binding{identity,_}:identity 21 # Return the typed component family used by lower-level component operations. 22 # Retains the binding's schema, storage and projection indices; does not access 23 # a world. Raw family construction is trusted provisioning, not gameplay access. 24 def family(~S:Data,~Store:Type,~Rest:Type,~P:Type,~V:Data,~Token:Data,~take:Store -> Rest & Col.Column,~put:Rest -> Col.Column -> Store,~view:P -> P & V,binding:Binding) -> C.Family: 25 match binding: 26 case Binding{_,family}:family