@metreeca/blue - v0.12.0
    Preparing search index...

    Type Alias ResourceConstraints

    Constraints accepted by the resource shape factory.

    States what a resource is called, where its members resolve their predicates, what class it belongs to and which identifiers it may be named by; the members it carries are stated apart.

    type ResourceConstraints = {
        name?: string | Dictionary;
        description?: string | Dictionary;
        space?: Namespace;
        class?: Reference;
        pattern?: string;
        in?: readonly Reference[];
        hasValue?: readonly Reference[];
        validators?: readonly Validator<Resource>[];
    }
    Index

    Properties

    name?: string | Dictionary

    Human-readable name for the shape.

    Accepts a localised Dictionary or, as a shorthand for the English-only case, a plain text string, expanded to { en: <value> } on the built shape.

    Inheritance — always from the child; not inherited.

    SHACL defines sh:name only for property shapes; extended here to node shapes.

    description?: string | Dictionary

    Human-readable description of the shape.

    Accepts a localised Dictionary or, as a shorthand for the English-only case, a Markdown string, expanded to { en: <value> } on the built shape.

    Inheritance — always from the child; not inherited.

    SHACL defines sh:description only for property shapes; extended here to node shapes.

    space?: Namespace

    Default namespace for mapping member names to predicates.

    A member stating neither a forward nor a reverse mapping is stored under its own name resolved against this space.

    Inheritance — inherited; conflicting parents without a child override are reported as an error.

    the app namespace (app:/#)

    class?: Reference

    Target class for resource instances.

    The absolute IRI naming the primary class a resource belongs to, stated by each shape in its own right. Where the shape declares a type member, that member carries this class as its value; the classes inherited on top of it are read off classes.

    A class is an obligation on the resources a shape describes, so a shape standing in for another as a member range must belong to every class that one declares, whether stated in its own right or inherited: a shape merely repeating the members of the one it stands in for is rejected.

    Inheritance — always from the child; not inherited.

    pattern?: string

    IRI path pattern that resource identifiers must match.

    Patterns are IRI-like templates using {name} placeholders for single path segments and /* for trailing wildcards. Patterns may be absolute or root-relative; root-relative patterns match absolute IRIs, ignoring the origin.

    Inheritance — only the trailing /* wildcard admits narrowing: a child may replace /* with more specific segments (for example, /products/* to /products/{id}/reviews/{rid}), provided the fixed prefix matches. All other cases require exact equality; a mismatch is reported as an error.

    undefined (no pattern constraint)

    https://example.org/products/{sku}  → https://example.org/products/ABC-456
    https://example.org/categories/* → https://example.org/categories/electronics/phones

    /employees/{id} → https://example.org/employees/123
    /departments/* → https://example.org/departments/sales/emea
    in?: readonly Reference[]

    Allowed resource identifiers (closed enumeration).

    When specified, resource identifiers must be members of this list. IRIs must be absolute. Empty arrays are ignored.

    Inheritance — child may only drop allowed identifiers.

    undefined (no enumeration constraint)

    hasValue?: readonly Reference[]

    Resource identifiers a resource must be named by.

    When specified, the identifier must equal every listed value, so a shape listing two or more admits no resource at all. IRIs must be absolute. Empty arrays are ignored.

    Inheritance — child may only add required identifiers.

    undefined (no required values)

    validators?: readonly Validator<Resource>[]

    Custom checks a resource must pass beyond the declarative constraints.

    Carries the constraints a shape cannot state declaratively: each is handed the whole resource and reports what it finds as a Trace, or undefined where the resource passes. Every check runs, so a resource is told everything that is wrong with it at once rather than one thing at a time, and each trace is keyed by the name of the check reporting it.

    Inheritance — union of the checks stated and the ones inherited; every check applies.