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

    Type Alias Slice<S, T>

    Slice: { inferred from <S, T> }

    Resolves the models for retrieving a resource restricted to a single collection.

    A slice is a specialised model of the holding shape that targets a single collection, a property holding any number of resources. It names that property and nothing else, and states under it a template or a projection over the item shape, merged with filtering, ordering and pagination criteria for the collection. This way a collection retrieval is checked against the holding shape alone, just like a resource retrieval.

    items reads the retrieved items from the match. collection resolves the property a slice names, and blueprint the shape new items of that collection must satisfy.

    Slices fail to compile if they name no property or more than one, or a property the shape doesn't declare. They also fail if the property isn't a collection, because it is single-valued or holds values other than resources, or if they request a member the item shape doesn't declare.

    The bare ResourceShape accepts any model naming a single property, and a generic Template is accepted as Model accepts it, so collection retrievals still compile where only a generic shape or model is known.

    Type Parameters

    • S extends Lazy<ResourceShape>

      The shape of the resource holding the collection, possibly deferred to break definition cycles

    • T

      The supplied model, typically inferred from the argument