Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @rdfdev/actions

js.rdf.dev/actions

Read the Docs npm (tag) npm bundle size

Utilities for working with link actions.

Getting started

Just install the package and its peer dependencies.

npm i @rdfdev/collections @ontologies/core

yarn add @rdfdev/collections @ontologies/core

Documentation

See the js.rdf.dev/actions documentation

See the complete js.rdf.dev documentation

Need help with linked data?

This package is brought to you by Ontola. We build production-grade linked data solutions and can help you from advice to building custom web services.

Index

Type aliases

BoundActionDispatcher

BoundActionDispatcher<ParamMap>: function

Type parameters

Type declaration

    • (action: string, payload?: Partial<ParamMap>): Promise<any>
    • Parameters

      • action: string
      • Optional payload: Partial<ParamMap>

      Returns Promise<any>

IRIParams

IRIParams<T>: Record<keyof T, SomeTerm | string>

Type parameters

  • T

MiddlewareActionHandler

MiddlewareActionHandler<Args>: function

Type parameters

  • Args

Type declaration

    • (action: NamedNode, args: Args): Promise<any>
    • Parameters

      • action: NamedNode
      • args: Args

      Returns Promise<any>

MiddlewareFn

MiddlewareFn<Store>: function

Type parameters

  • Store

Type declaration

SerializableDataTypes

SerializablePrimitives

SerializablePrimitives: boolean | DataObject | Date | File | number | string | NamedNode | BlankNode | Literal

StoreBoundMiddleware

StoreBoundMiddleware: function

Functions

actionIRI

  • actionIRI<ParamMap>(action: string, payload?: Partial<ParamMap>): string
  • Generate a path?query combination for the given {action} and {payload}.

    see

    {createActionIRI}

    see

    {createActionPair}

    Type parameters

    Parameters

    • action: string

      The path of the action.

    • Optional payload: Partial<ParamMap>

    Returns string

Const createActionIRI

  • createActionIRI<ParamMap>(base: Namespace): (Anonymous function)
  • Create an action generator to easy in IRI generation.

    Type parameters

    Parameters

    • base: Namespace

      The base Namespace to which the action/payload is added.

    Returns (Anonymous function)

Const createActionNS

  • Create a action creator with the store and namespace already bound.

    Type parameters

    Parameters

    • base: Namespace

      The namespace to which the action name should be appended.

    • store: Store

      The store where the action should be dispatched.

    Returns BoundActionDispatcher<ParamMap>

Const createActionPair

  • createActionPair<ParamMap, Store>(base: Namespace, store: Store): object
  • Create a dispatch-parse pair for use in middleware.

    Type parameters

    Parameters

    • base: Namespace

      The namespace to create actions on.

    • store: Store

      The store to dispatch actions on.

    Returns object

Const createExecFilter

  • Filter to prevent superfluous unhandled middleware action from going to execActionByIRI

    Acts as a security filter as well, to prevent cross-site action injections.

    Parameters

    • Default value executableSites: any[] = defaultExecutableSites

    Returns MiddlewareFn

Const loggingMiddleware

  • loggingMiddleware(): (Anonymous function)

Const parseAction

  • parseAction<ParamMap>(action: NamedNode): ParsedAction<ParamMap>
  • Parse an action for its base IRI and parameters separated.

    Only the last value of each param is included, so duplicates are omitted.

    The param values are parsed and converted for n-quads syntax, otherwise their literal value is used. The resulting {return.params} is not guaranteed to be correct with the given {ParamMap}, it is for typing purposes only.

    Type parameters

    Parameters

    • action: NamedNode

    Returns ParsedAction<ParamMap>

Generated using TypeDoc