Base class for all RAAIN nodes in the system. Implements versioning and link management functionality.

Remarks

This is the foundation class for all API entities in the RAAIN system. It provides common functionality for:

  • Version management
  • HATEOAS link handling
  • JSON serialization

Example

const node = new RaainNode({
id: 'node1',
version: '1.0.0',
links: [
new Link('self', '/api/nodes/node1')
]
});

Hierarchy (view full)

Implements

Constructors

  • Creates a new RaainNode instance.

    Parameters

    • json: {
          id: string;
          links?: Link[] | RaainNode[];
          version?: string;
      }

      Configuration object

      • id: string

        Unique identifier

      • Optional links?: Link[] | RaainNode[]

        Array of HATEOAS links

      • Optional version?: string

        Version string

    Returns RaainNode

Properties

id: string

Unique identifier for the node

version: string

Version string of the node

Accessors

Methods

  • Converts the node to a JSON object.

    Returns {
        id: string;
        links: Link[];
        version?: string;
    }

    A JSON object containing the node's data

    • id: string
    • links: Link[]
    • Optional version?: string
  • Gets the count of links, optionally filtered by type.

    Parameters

    • Optional linkType: string

      Optional type of links to count

    Returns number

    The number of links