Options
All
  • Public
  • Public/Protected
  • All
Menu

This extension allows an app to declare that the domain data must conform to some defined shapes. A collection of shapes is like a 'schema' or 'object model'.

The extension can be declared in the data using declare, or instantiated and provided to the clone function in the app parameter, e.g.

api = await clone(
  new MemoryLevel, MqttRemotes, config,
  new ShapeConstrained(new PropertyShape({
    path: 'name', count: 1
  }))
);
see

https://www.w3.org/TR/shacl/

experimental

Hierarchy

  • ShapeConstrained

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • Rest ...shapes: Shape[]

      The shapes to which domain data must conform

    Returns ShapeConstrained

Properties

shapes

shapes: Shape[]

The shapes to which domain data must conform.

Methods

Static declare

  • Extension declaration. Insert into the domain data to install the extension. For example (assuming a m-ld clone object):

    clone.write(ShapeConstrained.declare(0, PropertyShape.declare({
      path: 'name', count: 1
    })));
    

    Note that declaration of shapes will not retrospectively apply constraints to any existing subjects in the domain. It's the app's responsibility to correct existing data, if necessary.

    Parameters

    • priority: number

      the preferred index into the existing list of extensions (lower value is higher priority).

    • Rest ...controlledShapes: (Subject | Reference)[]

      shape Subjects, or References to pre-existing shapes

    Returns Subject

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method
  • Protected method

Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.10.0-edge.9 Source code licensed MIT. Privacy policy