This class holds a OPC-UA node identifier.

Nodes are unambiguously identified using a constructed identifier called the NodeId. Some Servers may accept alternative NodeIds in addition to the canonical NodeId represented in this Attribute.

A Server shall persist the NodeId of a Node, that is, it shall not generate new NodeIds when rebooting.

Hierarchy (view full)

Constructors

  • construct a node Id from a type, a value and a namespace index.

    Parameters

    • OptionalidentifierType: null | NodeIdType

      the nodeID type

    • Optionalvalue: string | number | Buffer

      the node id value. The type of Value depends on identifierType.

    • Optionalnamespace: number

      the index of the related namespace (optional , default value = 0 )

    Returns NodeId

    const nodeId = new NodeId(NodeIdType.NUMERIC,123,1);
    

Properties

identifierType: NodeIdType
namespace: number
value: string | number | Buffer
NodeIdType: typeof NodeIdType
nullNodeId: NodeId
resolveNodeId: ((a: string | NodeId) => NodeId)
sameNodeId: ((n1: NodeId, n2: NodeId) => boolean)

Methods

  • Returns string

  • returns true if the NodeId is null or empty

    Returns boolean

  • convert nodeId to a JSON string. same as NodeId.toString

    Parameters

    • Optionaloptions: {
          namespaceArray?: string[];
      }
      • OptionalnamespaceArray?: string[]

    Returns string

  • get the string representation of the nodeID.

    Parameters

    • Optionaloptions: {
          addressSpace?: any;
          namespaceArray?: string[];
      }
      • OptionaladdressSpace?: any

        {AddressSpace}

      • OptionalnamespaceArray?: string[]

    Returns string

    by default, toString will return the "ns=" representation

    const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
    console.log(nodeid.toString());
    >"ns=1;i=123"
    

    toString can also be used to make the nsu= version of the nodeid.

    const namespaceArray = ["http://opcfoundation.com/UA/","http://mynamespace2"];
    const nodeid = new NodeId(NodeIdType.STRING, "Hello",1);
    console.log(nodeid.toString({namespaceArray}));
    >"nsu=http://mynamespace;i=123"
    

    passing an addressSpace to the toString options will decorate the nodeId with the BrowseName of the node.

    const addressSpace = getAddressSpace();
    const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
    console.log(nodeid.toString({addressSpace}));
    >"nsu=http://mynamespace;i=123 (MyBrowseName)"