1 import Base
2 import ./world.bend as W
3 import ./owner_product.bend as Product
4 import ./owned_event_log.bend as Log
5 import ./ordinary_owned_event.bend as Pub
6 import ./ordinary_owned_event_binding.bend as Binding
7 import ./ordinary_owned_event_declaration.bend as D
8 import ./owned_event_journal.bend as Journal
9 # Normal setup receives a canonical binding; all executable log/receipt paths
10 # remain erased until the declaration is specialized at its full recovery tree.
11 # Nominal owned-publication capability family bound to one domain identity.
12 # The opaque owner is the staged journal; no runtime log alias is exposed.
13 def Ops(~S:Data,~P:Type,~identity:Pub.Domain,H:Type) -> Type:Pub.Write
14 def empty(~P:Type,unit:Unit) -> List
:[]
15 def emit_named(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens ,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{}}}
,~All:Type,~RecoveryRest:Type,~recovery:Product.Lens,~All,Pub.name(~S,~P,identity),stage),payload)
17 # Advanced closed grant constructor for the selected log/recovery paths.
18 # Payload emit stages one owned P; canonical binding and erased lenses must
19 # refer to the same schema/log. Raw adapters are trusted engine setup.
20 def grant(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens,~All:Type,~RecoveryRest:Type,~recovery:Product.Lens,All>>:
21 Pub.Write{emit_named(~S,~C,~R,~P,~Rest,~E,~path,~inject,~identity,~All,~RecoveryRest,~recovery)}
22 # Declare owned publication from the canonical family binding, deriving
23 # both operational authority and complete event description. Staged owners
24 # commit to logs on success or return in the typed recovery product on abort;
25 # this constructor performs neither. Compose heterogeneous domains with
26 # ordinary-owned-event-declaration.both; see docs/parity/affine-events.md.
27 def declaration(~S:Data,~C:Type,~R:Type,~P:Type,~Rest:Type,~E:Data,~path:Product.Lens,~binding:Binding.Binding) -> D.Declaration,List