schema_fragments.bend checks
raw source on the hub · import bendvy-ecs-core@0.1.0.3/schema_fragments.bend as Schema_fragments
1 import
import Base
Types
type RegistryKind source · line 6 · raw
Data
Metadata is kind-local, as in the pinned Schema merge. Declaration packs stay affine. Descriptor namespace: component/resource/event/relation/service. Keys and names collide within one kind, not across distinct kinds.
ComponentRegistryKind
ResourceRegistryKind
EventRegistryKind
RelationRegistryKind
ServiceRegistryKind
type Descriptor source · line 14 · raw
@S:Data -> @Token:Data -> @Payload:Type -> Data
Schema/token/payload-indexed descriptor metadata without a live payload. Raw construction is trusted schema setup and grants no operational access.
Descriptor@S:Data -> @Token:Data -> @Payload:Type -> @kind:RegistryKind -> @key:String -> @name:String -> Descriptor<S, Token, Payload>
type PersistenceKind source · line 18 · raw
Data
Authored persistence classification for descriptor metadata; does not implement a codec, validate raw input or export a snapshot by itself.
PlainPersistenceKind
TransientPersistenceKind
ConstructedPersistenceKind
type Entry source · line 24 · raw
@S:Data -> Data
Detached descriptor entry, optionally classified by persistence policy. Both variants retain the same kind/key/name collision rules.
Entry@S:Data -> @kind:RegistryKind -> @key:String -> @name:String -> Entry<S>
Classified@S:Data -> @kind:RegistryKind -> @key:String -> @name:String -> @persistence:PersistenceKind -> Entry<S>
type Fragment source · line 29 · raw
@S:Data -> @Owners:Type -> Type
Descriptor entries and their actual affine declaration owners. Metadata is Data; Owners may contain arbitrary Type payloads and are never duplicated.
Fragment@S:Data -> @Owners:Type -> @entries:List<&2, Entry<S>> -> @owners:Owners -> Fragment<S, Owners>
type Error source · line 33 · raw
Data
Schema refusal identifies duplicate kind-local key/name or a descriptor required by a declared initializer but absent from the fragment.
DuplicateKey@kind:RegistryKind -> @key:String -> Error
DuplicateName@kind:RegistryKind -> @name:String -> Error
UndeclaredDescriptor@kind:RegistryKind -> @key:String -> @name:String -> Error
type Validation source · line 38 · raw
Data
Pure metadata-validation result, without consuming declaration owners.
ValidValidation
Invalid@error:Error -> Validation
type Merge source · line 43 · raw
@S:Data -> @L:Type -> @R:Type -> Type
Merged owns the combined fragment; Rejected returns both original affine fragments with the conflict. Refusal does not execute an initializer.
Merged@S:Data -> @L:Type -> @R:Type -> @fragment:Fragment<S, Pair(L, R)> -> Merge<S, L, R>
Rejected@S:Data -> @L:Type -> @R:Type -> @error:Error -> @left:Fragment<S, L> -> @right:Fragment<S, R> -> Merge<S, L, R>
type Bound source · line 48 · raw
@S:Data -> @Owners:Type -> @Output:Type -> Type
Built owns the initializer output; BindRejected returns the original fragment and metadata error, allowing caller recovery without copied owners.
Built@S:Data -> @Owners:Type -> @Output:Type -> @output:Output -> Bound<S, Owners, Output>
BindRejected@S:Data -> @Owners:Type -> @Output:Type -> @error:Error -> @fragment:Fragment<S, Owners> -> Bound<S, Owners, Output>
Definitions
def same_kind source · line 61 · raw
@a:RegistryKind -> @b:RegistryKind -> Bool
def check_entry source · line 95 · raw
@keyConflict:Bool -> @nameConflict:Bool -> @kind:RegistryKind -> @key:String -> @name:String -> Validation
def first_failure source · line 122 · raw
@first:Validation -> @second:Validation -> Validation
def required_continue source · line 162 · raw
@result:Validation -> @next:(@_:Unit -> Validation) -> Validation
Templates
template bare_entry source · line 53 · raw
@-S:Data -> @value:Entry<S> -> Entry<S>
Only the operational extension builders choose a classification. Raw schema construction is trusted.
template bare_entries source · line 57 · raw
@-S:Data -> @values:List<&2, Entry<S>> -> List<&2, Entry<S>>
template entry source · line 71 · raw
@-S:Data -> @-Token:Data -> @-Payload:Type -> @descriptor:Descriptor<S, Token, Payload> -> Entry<S>
Project a typed descriptor to its kind/key/name metadata entry. Does not read payloads or grant access to the descriptor's runtime storage.
template empty source · line 76 · raw
@-S:Data -> @owners:Unit -> Fragment<S, Unit>
Create an empty fragment with a Unit owner and no metadata entries. Use fragment when supplying arbitrary affine declaration owners.
template fragment source · line 81 · raw
@-S:Data -> @-Owners:Type -> @entries:List<&2, Entry<S>> -> @owners:Owners -> Fragment<S, Owners>
Trusted setup constructor pairing authored entries with actual owners. Does not verify their semantic relationship or reject duplicate entries; validate/merge/bind perform their stated metadata checks later.
template key_exists_bare source · line 83 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @+kind:RegistryKind -> @+key:String -> Bool
template key_exists source · line 88 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @kind:RegistryKind -> @key:String -> Bool
template name_exists_bare source · line 89 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @+kind:RegistryKind -> @+name:String -> Bool
template name_exists source · line 94 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @kind:RegistryKind -> @name:String -> Bool
template check_one_bare source · line 100 · raw
@-S:Data -> @+seen:List<&2, Entry<S>> -> @item:Entry<S> -> Validation
template check_one source · line 104 · raw
@-S:Data -> @seen:List<&2, Entry<S>> -> @item:Entry<S> -> Validation
template validation_continue source · line 105 · raw
@-S:Data -> @result:Validation -> @next:(@_:Unit -> Validation) -> Validation
template validate_loop source · line 109 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @+seen:List<&2, Entry<S>> -> Validation
template filter_kind_done source · line 113 · raw
@-S:Data -> @selected:Bool -> @item:Entry<S> -> @rest:List<&2, Entry<S>> -> List<&2, Entry<S>>
template filter_kind source · line 117 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @+kind:RegistryKind -> List<&2, Entry<S>>
template validate source · line 129 · raw
@-S:Data -> @+entries:List<&2, Entry<S>> -> Validation
Check descriptor key/name collisions within each registry kind. Preserves kind-specific error order; this is metadata validation, not proof of lens laws, actual payload values or correctness of arbitrary adapters.
template merge_checked source · line 131 · raw
@-S:Data -> @-L:Type -> @-R:Type -> @result:Validation -> @+entries:List<&2, Entry<S>> -> @left:Fragment<S, L> -> @right:Fragment<S, R> -> Merge<S, L, R>
template merge source · line 138 · raw
@-S:Data -> @-L:Type -> @-R:Type -> @left:Fragment<S, L> -> @right:Fragment<S, R> -> Merge<S, L, R>
Validate both fragments and their combined entries before combining owners. Success retains left-then-right entries and (L & R) owners; refusal returns both original fragments. No initializer or gameplay callback is invoked.
template bind_checked source · line 141 · raw
@-S:Data -> @-Owners:Type -> @-Output:Type -> @-build:(@_:Owners -> Output) -> @result:Validation -> @fragment:Fragment<S, Owners> -> Bound<S, Owners, Output>
template bind source · line 148 · raw
@-S:Data -> @-Owners:Type -> @-Output:Type -> @-build:(@_:Owners -> Output) -> @fragment:Fragment<S, Owners> -> Bound<S, Owners, Output>
Validate fragment metadata before consuming Owners with a trusted builder. BindRejected returns the original fragment; Built contains builder output. For a builder with explicit descriptor prerequisites use bind_declared.
template descriptor_equal source · line 154 · raw
@-S:Data -> @a:Entry<S> -> @b:Entry<S> -> Bool
A closed initializer states its required descriptors before receiving any owners. As with Family lenses, caller-authored adapters remain trusted provisioning.
template descriptor_present source · line 158 · raw
@-S:Data -> @xs:List<&2, Entry<S>> -> @+item:Entry<S> -> Bool
template required_check_bare source · line 166 · raw
@-S:Data -> @present:Bool -> @item:Entry<S> -> Validation
template required_check source · line 171 · raw
@-S:Data -> @present:Bool -> @item:Entry<S> -> Validation
template requirements source · line 172 · raw
@-S:Data -> @required:List<&2, Entry<S>> -> @+entries:List<&2, Entry<S>> -> Validation
template bind_requirements source · line 176 · raw
@-S:Data -> @-Owners:Type -> @-Output:Type -> @-build:(@_:Owners -> Output) -> @result:Validation -> @required:List<&2, Entry<S>> -> @fragment:Fragment<S, Owners> -> Bound<S, Owners, Output>
template bind_declared source · line 185 · raw
@-S:Data -> @-Owners:Type -> @-Output:Type -> @-build:(@_:Owners -> Output) -> @fragment:Fragment<S, Owners> -> @required:List<&2, Entry<S>> -> Bound<S, Owners, Output>
Validate fragment collisions and every explicitly required descriptor before invoking the closed builder. Missing kind/key/name yields BindRejected with the original fragment, without executing build. Trusted builders must still obey their declared requirements; arbitrary callbacks are not runtime-confined by metadata alone.