def export_owner
import bendvy-ecs-core@0.1.0.4/snapshot_gate.bend as SnapshotGateimport Base
import bendvy-ecs-core@0.1.0.4/ordinary_declaration.bend as C
20# Static eligibility mirrors TS Gate: export itself does not run its decoder.
21# This low-level operation consumes Gate; snapshot-leaf reconstructs it from
22# the retained ordinary declaration for repeated owner-preserving saves.
23def export_owner(~S:Data,~P:Type,~declaration:C.Declaration<S,P>,gate:Gate<S,P,declaration>,owner:P) -> P & Field:
24 match gate:
25 case Transient{}:(owner,Omitted{C.key(~S,~P,declaration)})
26 case Persisted{_,project}:projected(~P,C.key(~S,~P,declaration),project(owner))