NodeOPCUA API Documentation
    Preparing search index...

    Interface AddressSpace

    The address space: the set of nodes a server exposes, and the namespaces they live in.

    Obtain one with AddressSpace.create. This is the published shape of it; the class behind it carries a great deal more, none of which is API.

    interface AddressSpace {
        historizingNodes?: Set<UAVariable<UAVariableEvents>>;
        isFrugal: boolean;
        rootFolder: UARootFolder;
        suspendModelChangeEvents: boolean;
        addMethodCallInterceptor(interceptor: MethodCallInterceptor): void;
        browsePath(browsePath: BrowsePath): BrowsePathResult;
        browseSingleNode(
            nodeId: NodeIdLike,
            browseDescription: BrowseDescription,
            context?: ISessionContext,
        ): BrowseResult;
        constructEventData(
            eventTypeId: UAEventType,
            data: Record<string, unknown>,
        ): IEventData;
        constructExtensionObject(
            dataType: NodeId | UADataType,
            options?: Record<string, unknown>,
        ): ExtensionObject;
        deleteNamespace(namespaceIndexOrUri: string | number): void;
        deleteNode(node: NodeId | BaseNode<BaseNodeEvents>): void;
        dispose(): void;
        findCorrespondingBasicDataType(dataType: NodeIdLike | UADataType): DataType;
        findDataType(
            dataType: string | NodeId | DataType | UADataType,
            namespaceIndex?: number,
        ): UADataType | null;
        findEventType(
            eventTypeId: NodeIdLike | UAObjectType,
            namespaceIndex?: number,
        ): UAObjectType | null;
        findMethod(nodeId: NodeIdLike): UAMethod<UAMethodEvents> | null;
        findNode(node: NodeIdLike): BaseNode<BaseNodeEvents> | null;
        findObjectType(
            objectTypeId: NodeIdLike,
            namespaceIndex?: number,
        ): UAObjectType | null;
        findReferenceType(
            referenceTypeId: NodeIdLike | UAReferenceType,
            namespaceIndex?: number,
        ): UAReferenceType | null;
        findReferenceTypeFromInverseName(
            inverseName: string,
        ): UAReferenceType | null;
        findVariableType(
            variableTypeId: NodeIdLike,
            namespaceIndex?: number,
        ): UAVariableType | null;
        generateEventId(): VariantByteString;
        getDefaultNamespace(): INamespace;
        getExtensionObjectConstructor(
            dataType: NodeId | UADataType,
        ): AnyConstructable;
        getNamespace(indexOrName: string | number): INamespace;
        getNamespaceArray(): INamespace[];
        getNamespaceIndex(namespaceUri: string): number;
        getNamespaceUri(namespaceIndex: number): string;
        getOwnNamespace(): Namespace;
        installAlarmsAndConditionsService(): void;
        installHistoricalDataNode(
            variableNode: UAVariable,
            options?: IHistoricalDataNodeOptions,
        ): void;
        inverseReferenceType(referenceType: string): string;
        modelChangeTransaction(action: () => void): void;
        normalizeReferenceType(params: AddReferenceOpts | UAReference): UAReference;
        onHistorizingNodeAdded?(node: UAVariable): void;
        registerChildAccessorNames(browseNames: string[]): void;
        registerNamespace(namespaceUri: string): Namespace;
        registerShutdownTask(task: ShutdownTask): void;
        removeMethodCallInterceptor(interceptor: MethodCallInterceptor): void;
        resolveNodeId(nodeIdLike: NodeIdLike): NodeId;
        shutdown(): Promise<void>;
    }

    Hierarchy (View Summary)

    Index
    historizingNodes?: Set<UAVariable<UAVariableEvents>>
    isFrugal: boolean

    when this flag is set, properties and components are not added as javascript member of the UAObject/UAVariable node

    rootFolder: UARootFolder
    suspendModelChangeEvents: boolean

    Stop collecting GeneralModelChangeEventType material, and stop bumping NodeVersion.

    Defaults to false. Set it only while nothing subscribes to model change events - around a bulk load or a bulk delete - where the per-node probe the bookkeeping performs is pure cost.

    • Register a method call interceptor. Interceptors are called sequentially before each UAMethod.execute(). If any interceptor returns a non-Good StatusCode, the method call is rejected and subsequent interceptors are skipped.

      Parameters

      Returns void

    • construct a simple javascript object with all the default properties of the event

      eventTypeId can be a UAObjectType deriving from EventType or an instance of a ConditionType

      Parameters

      • eventTypeId: UAEventType
      • data: Record<string, unknown>

      Returns IEventData

    • Empty a namespace, leaving the rest of the address space exactly as it was before that namespace was populated, and the namespace itself registered under the same index and uri, ready to be populated again.

      This is what lets an address space be recycled rather than rebuilt: the base nodesets stay loaded and only the namespace being edited is rebuilt. Every node of the namespace goes, and so does every reference between one of them and a node of another namespace, in one model-change transaction.

      Namespace 0 cannot be deleted.

      Parameters

      • namespaceIndexOrUri: string | number

        the namespace index, or its uri

      Returns void

    • Returns void

    • find an EventType node in the address space

      Parameters

      • eventTypeId: NodeIdLike | UAObjectType

        the eventType to find

      • OptionalnamespaceIndex: number

        an optional index to restrict the search in a given namespace

      Returns UAObjectType | null

      the EventType found or null.

      note:

      • the method with throw an exception if a node is found that is not a BaseEventType or a subtype of it.
      • if eventTypeId is of type NodeId, the namespaceIndex shall not be specified
       const evtType = addressSpace.findEventType("AuditEventType");
      
    • find an EventType node in the address space

      Parameters

      • objectTypeId: NodeIdLike

        the eventType to find

      • OptionalnamespaceIndex: number

        an optional index to restrict the search in a given namespace

      Returns UAObjectType | null

      the EventType found or null.

      notes:

      • if objectTypeId is of type NodeId, the namespaceIndex shall not be specified
          const objectType = addressSpace.findObjectType("ns=0;i=58");
      objectType.browseName.toString().should.eql("BaseObjectType");

      const objectType = addressSpace.findObjectType("BaseObjectType");
      objectType.browseName.toString().should.eql("BaseObjectType");

      const objectType = addressSpace.findObjectType(resolveNodeId("ns=0;i=58"));
      objectType.browseName.toString().should.eql("BaseObjectType");

      const objectType = addressSpace.findObjectType("CustomObjectType",36);
      objectType.nodeId.namespace.should.eql(36);
      objectType.browseName.toString().should.eql("BaseObjectType");

      const objectType = addressSpace.findObjectType("36:CustomObjectType");
      objectType.nodeId.namespace.should.eql(36);
      objectType.browseName.toString().should.eql("BaseObjectType");
    • find a ReferenceType by its inverse name.

      Parameters

      • inverseName: string

        the inverse name of the ReferenceType to find

      Returns UAReferenceType | null

    • Parameters

      • variableTypeId: NodeIdLike
      • OptionalnamespaceIndex: number

      Returns UAVariableType | null

          const variableType = addressSpace.findVariableType("ns=0;i=62");
      variableType.browseName.toString().should.eql("BaseVariableType");

      const variableType = addressSpace.findVariableType("BaseVariableType");
      variableType.browseName.toString().should.eql("BaseVariableType");

      const variableType = addressSpace.findVariableType(resolveNodeId("ns=0;i=62"));
      variableType.browseName.toString().should.eql("BaseVariableType");
    • get the extension object constructor from a DataType nodeID or UADataType object

      Parameters

      Returns AnyConstructable

    • Parameters

      • indexOrName: string | number

      Returns INamespace

    • Parameters

      • namespaceUri: string

      Returns number

    • Parameters

      • namespaceIndex: number

      Returns string

    • Parameters

      • referenceType: string

      Returns string

    • Run action with the model-change bookkeeping batched: the changes every node addition and deletion inside it collects are reported as one GeneralModelChangeEventType event when the outermost transaction ends, rather than one event per change.

      Re-entrant - a nested call joins the transaction already open.

      Parameters

      • action: () => void

      Returns void

    • Called once a Variable has been turned into a HistoricalDataNode by installHistoricalDataNode, after the node has been recorded in historizingNodes.

      A Server uses this hook to advertise a history-related Profile or Facet URI (OPC 10000-7) only once it actually has a historized Variable to back it, since an AddressSpace with no historian installed has nothing for a HistoryRead conformance test to read. node-opcua-server sets this hook to add the HistoricalRawData Facet.

      Parameters

      Returns void

    • Give browse names created at runtime the treatment of the names a nodeset declares: parent.<name> then resolves through one getter shared by every node instead of an accessor installed on each parent. Nodes created before the call are covered too.

      Only worth it when many nodes carry the same browse name; a name used once costs the same either way.

      Parameters

      • browseNames: string[]

      Returns void

    • Parameters

      • namespaceUri: string

      Returns Namespace

    • register a task that will be executed just before the address space is disposed.

      Parameters

      Returns void

    • shutdown the address space by executingthe registered shutdown tasks.

      Returns Promise<void>

      registerShutdownTask, dispose