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

    Function resource

    Creates a resource shape.

    • Creates a resource shape extending other shapes.

      Extends the shapes given, carrying their members and constraints without adding or narrowing any member. A shape extending nothing admits only resources carrying no members.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      Parameters

      • ...args: [...inheritance: I[]]

        The shapes extended

      Returns ResourceShape<I, {}>

      An immutable shape admitting the resources the inherited members bound

      TraceError Where the extended shapes disagree on an inherited constraint, or the merged shape states two identifiers, two types, or two members mapping to the same predicate

    • Creates a resource shape extending other shapes with shape-level constraints.

      Extends the shapes given first, carrying their members and constraints, and holds every resource to the constraints stated after them. The shape carries only the members it inherits: a shape extending nothing admits only resources carrying no members.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      Parameters

      Returns ResourceShape<I, {}>

      An immutable shape admitting the resources the inherited members and the constraints bound

      TraceError Where the extended shapes disagree on an inherited constraint, or the merged shape states two identifiers, two types, or two members mapping to the same predicate

    • Creates a resource shape stating shape-level constraints.

      Extends the shapes given first, carrying their members and constraints on top of the ones declared here, and holds every resource to the constraints stated between them and the members: what it is called, the class it belongs to, the space its members resolve their predicates against, and the identifiers it may be named by.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      • M extends Members

        The members declared in the shape's own right

      Parameters

      • ...args: [
            ...inheritance: I[],
            constraints: ResourceConstraints & { kind?: undefined },
            members: M,
        ]

        The shapes extended, followed by the shape constraints and the members declared

      Returns ResourceShape<I, M>

      An immutable shape admitting the resources the members and constraints bound

      TraceError Where a member fails to narrow the one it overrides, the extended shapes disagree on an inherited constraint, the merged shape states two identifiers, two types, or two members mapping to the same predicate, or a member admitting literals states a reverse mapping

    • Creates a resource shape.

      Extends the shapes given ahead of the members, carrying their members and constraints on top of the ones declared here; a member redeclared over an inherited one narrows it. The shape is built merged, so that a caller reads the members a resource carries off the shape itself rather than by walking the inheritance chain.

      Type Parameters

      • I extends Parents

        The shapes extended, possibly deferred to break definition cycles

      • M extends Members

        The members declared in the shape's own right

      Parameters

      • ...args: [...inheritance: I[], members: M]

        The shapes extended, followed by the members declared

      Returns ResourceShape<I, M>

      An immutable shape admitting the resources the members bound

      TraceError Where a member fails to narrow the one it overrides, the extended shapes disagree on an inherited constraint, the merged shape states two identifiers, two types, or two members mapping to the same predicate, or a member admitting literals states a reverse mapping