def both
import bendvy-ecs-core@0.1.0.4/ordinary_owned_event_declaration.bend as OrdinaryOwnedEventDeclarationimport Base
import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
import bendvy-ecs-core@0.1.0.4/capabilities.bend as Cap
71# Compose owned-event declarations for the same schema and staged State.
72# The body receives Cap.Bundle{left, right}; recovery is the corresponding
73# Product.Owner<LeftRecovery, RightRecovery>. Access/domain lists remain left
74# first, with duplicates; opaque metadata on either side remains opaque.
75# One shared staged journal preserves actual emission order across families,
76# not declaration grouping. The publisher commits payload owners only on success;
77# on abort it publishes none and returns staged owners through the typed recovery
78# product, preserving each family's order. The declaration itself executes none
79# of these actions. No owner restored by another required ECS rollback may also
80# be returned as recovered event data, and no automatic IO finalizer is implied.
81# Use ordinary-owned-event-family-write.declaration for each canonical leaf and
82# ordinary-owned-event-family-publisher for execution. Reader projection,
83# retention and retirement use their separate owned-event APIs.
84def both(~S:Data,~State:Type,~L:Type,~R:Type,~LOps:Type -> Type,~ROps:Type -> Type,~leftBuilder:Builder(~State,~L,~LOps),~rightBuilder:Builder(~State,~R,~ROps),~left:Declaration<S,State,L,LOps,leftBuilder>,~right:Declaration<S,State,R,ROps,rightBuilder>) -> Declaration<S,State,Product.Owner<L,R>,PairOps(~LOps,~ROps),pair_grant(~S,~State,~L,~R,~LOps,~ROps,~leftBuilder,~rightBuilder)>:
85 Described{pair_empty(~L,~R,~empty(~S,~State,~L,~LOps,~leftBuilder,left),~empty(~S,~State,~R,~ROps,~rightBuilder,right)),List.append(&2,String,access(~S,~State,~L,~LOps,~leftBuilder,left),access(~S,~State,~R,~ROps,~rightBuilder,right)),pair_description(description(~S,~State,~L,~LOps,~leftBuilder,left),description(~S,~State,~R,~ROps,~rightBuilder,right))}
Uses (12)
Used by (0)
No other definition uses this definition.