Class BaseChannelTypeAbstract

A NotificationChannelType that handles the base case of parsing and serializing a notification channel. Note that the extractModes call always requires Read permissions on the target resource.

Uses SHACL to validate the incoming data in initChannel. Classes extending this can pass extra SHACL properties in the constructor to extend the validation check.

The completeChannel implementation is an empty function.

Hierarchy

Implements

Constructors

  • Parameters

    • type: NamedNode<string>

      The URI of the notification channel type. This will be added to the SHACL shape to validate incoming subscription data.

    • route: InteractionRoute

      The route corresponding to the URL of the subscription service of this channel type. Channel identifiers will be generated by appending a value to this URL.

    • features: string[] = DEFAULT_NOTIFICATION_FEATURES

      The features that should be enabled for this channel type. Values are expected to be full URIs, but the notify: prefix can also be used.

    • additionalShaclProperties: unknown[] = []

      Any additional properties that need to be added to the default SHACL shape.

    Returns BaseChannelType

Properties

features: NamedNode<string>[]
path: string
shacl: unknown
shaclQuads?: Store<Quad, Quad, Quad, Quad>
type: NamedNode<string>

Methods

  • Returns an N3.js Store containing quads corresponding to the stored SHACL representation. Caches this result so the conversion from JSON-LD to quads only has to happen once.

    Returns Promise<Store<Quad, Quad, Quad, Quad>>

  • Converts a set of quads to a NotificationChannel. Assumes the data is valid, so this should be called after validateSubscription.

    The generated identifier will be a URL made by combining the base URL of the channel type with a unique identifier.

    The values of the default features will be added to the resulting channel, subclasses with additional features that need to be added are responsible for parsing those quads.

    Parameters

    • data: Store<Quad, Quad, Quad, Quad>

      Data to convert.

    • subject: Term

      The identifier of the notification channel description in the dataset.

    Returns Promise<NotificationChannel>

    The generated NotificationChannel.

  • Validates whether the given data conforms to the stored SHACL shape. Will throw an UnprocessableEntityHttpError if validation fails. Along with the SHACL check, this also makes sure there is only one matching entry in the dataset.

    Parameters

    • data: Store<Quad, Quad, Quad, Quad>

      The data to validate.

    Returns Promise<Term>

    The focus node that corresponds to the subject of the found notification channel description.