def constructed
bendvy-ecs-core@0.1.0.4 · decode_constructed_requests.bend:23
import bendvy-ecs-core@0.1.0.4/decode_constructed_requests.bend as DecodeConstructedRequests
import Base
import decode_data.bend as D
import bundle_construction.bend as Build
import decode_requests.bend as Request
import bundle_requests.bend as Commands
import capabilities.bend as Cap
23def constructed(~S:Data,~I:Type,~P:Type,~H:Type,~request:Cap.OwnedRequest<H,Request.Input<S,P>,Request.Output<S,P>>,ctx:H,operation:Commands.Operation<S>,result:Build.Construction<I,P,D.Error>) -> H & Output<S,I,P>:
24 match result:
25 case Build.Invalid{owner,error}:(ctx,Refused{Some{owner},Request.Validation{error}})
26 case Build.Constructed{owner,undo}:returned(~S,~I,~P,~H,undo,Cap.owned_request(~H,~Request.Input<S,P>,~Request.Output<S,P>,~request,ctx,Request.Input{operation,owner}))