def constructed_write
import bendvy-ecs-core@0.1.0.4/ordinary_query_declaration.bend as OrdinaryQueryDeclarationimport Base
import bendvy-ecs-core@0.1.0.4/persistence_declaration.bend as Recipe
import bendvy-ecs-core@0.1.0.4/ordinary_declaration.bend as Identity
import bendvy-ecs-core@0.1.0.4/declared_family.bend as Family
import bendvy-ecs-core@0.1.0.4/snapshot_leaf.bend as Leaf
import bendvy-ecs-core@0.1.0.4/decode_data.bend as D
import bendvy-ecs-core@0.1.0.4/compose.bend as Q
import bendvy-ecs-core@0.1.0.4/capabilities.bend as Cap
50# Constructed-component counterpart of write, using the declaration-bound save recipe.
51# take/put must preserve the matching Leaf.Component and all remaining storage.
52# Requires presence and grants transactional payload replacement, including rollback.
53# Failed sets retain an error in Frame; Compose reports AccessError and rolls back.
54# The set grant consumes P and does not return rejected input to the caller.
55def constructed_write(~S:Data,~P:Type,~Store:Type,~R:Type,~E:Data,~Rest:Type,~V:Data,~Token:Data,~identity:Identity.Declaration<S,P>,~save:P -> P & D.Raw,~view:P -> P & V,~take:Store -> Rest & Leaf.Component<S,P,identity,save>,~put:Rest -> Leaf.Component<S,P,identity,save> -> Store) -> Declaration<S,Q.Frame<S,Store,R,E>,Cap.Write<Q.Frame<S,Store,R,E>,P,V>>:
56 Declaration{Q.write_family(~S,~Store,~R,~E,~(Rest & Recipe.Constructed<S,P,identity,save>),~P,~V,~Token,~Family.take_column(~S,~P,~Store,~Rest,~identity,~save,~take),~Family.put_column(~S,~P,~Store,~Rest,~identity,~save,~put),~view,~Family.family(~S,~P,~Store,~Rest,~V,~Token,~identity,~save,~view,~take,~put)),Q.family_match(~S,~Store,~R,~E,~(Rest & Recipe.Constructed<S,P,identity,save>),~P,~V,~Token,~Family.take_column(~S,~P,~Store,~Rest,~identity,~save,~take),~Family.put_column(~S,~P,~Store,~Rest,~identity,~save,~put),~view,~Family.family(~S,~P,~Store,~Rest,~V,~Token,~identity,~save,~view,~take,~put),~Q.Required{}),[Clause{Identity.key(~S,~P,identity),Write{}}]}
Uses (18)
Used by (0)
No other definition uses this definition.