ordinary_owned_event_family_write.bend
bendvy-ecs-core@0.1.0.4 · 28 lines · 5 definitions
1import Base
2import bendvy-ecs-core@0.1.0.4/world.bend as W
3import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
4import bendvy-ecs-core@0.1.0.4/owned_event_log.bend as Log
5import bendvy-ecs-core@0.1.0.4/ordinary_owned_event.bend as Pub
6import bendvy-ecs-core@0.1.0.4/ordinary_owned_event_binding.bend as Binding
7import bendvy-ecs-core@0.1.0.4/ordinary_owned_event_declaration.bend as D
8import bendvy-ecs-core@0.1.0.4/owned_event_journal.bend as Journal
9
10
11
12
13def Ops(~S:Data,~P:Type,~identity:Pub.Domain<S,P>,H:Type) -> Type:Pub.Write<S,P,identity,H>
14def empty(~P:Type,unit:Unit) -> List<P>:[]
15def emit_named(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens<R,Log.Log<P>,Rest>,~inject:Nat -> E,~identity:Pub.Domain<S,P>,~All:Type,~RecoveryRest:Type,~recovery:Product.Lens<All,List<P>,RecoveryRest>,stage:Journal.Stage<W.World<S,C,R,E>,All>,payload:P) -> Journal.Stage<W.World<S,C,R,E>,All>:
16 Journal.emit(~S,~C,~R,~P,~Rest,~E,~path,~inject,~All,~RecoveryRest,~recovery,Journal.record_named(~W.World<S,C,R,E>,~All,Pub.name(~S,~P,identity),stage),payload)
17
18
19
20def grant(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens<R,Log.Log<P>,Rest>,~inject:Nat -> E,~identity:Pub.Domain<S,P>,~All:Type,~RecoveryRest:Type,~recovery:Product.Lens<All,List<P>,RecoveryRest>,unit:Unit) -> Pub.Write<S,P,identity,Journal.Stage<W.World<S,C,R,E>,All>>:
21 Pub.Write{emit_named(~S,~C,~R,~P,~Rest,~E,~path,~inject,~identity,~All,~RecoveryRest,~recovery)}
22
23
24
25
26
27def declaration(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens<R,Log.Log<P>,Rest>,~inject:Nat -> E,~select:List<&2,E> -> List<&2,Nat>,~identity:Pub.Domain<S,P>,~binding:Binding.Binding<S,R,P,Rest,E,path,inject,select,identity>) -> D.Declaration<S,W.World<S,C,R,E>,List<P>,Ops(~S,~P,~identity),grant(~S,~C,~R,~P,~Rest,~E,~path,~inject,~identity)>:
28 D.Described{empty(~P),[Pub.access(~S,~P,identity,":write")],D.Description{[Pub.name(~S,~P,identity)],False{}}}