How to use the node-opcua-debug.dumpIf function in node-opcua-debug

To help you get started, we’ve selected a few node-opcua-debug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.js View on Github external
function _filter_by_referenceType(self, browseDescription, references, referenceTypeId) {

    // make sure we have a valid referenceTypeId if not null
    if (!nodeid_is_nothing(referenceTypeId)) {

        assert(referenceTypeId instanceof NodeId);
        const referenceType = self.addressSpace.findNode(referenceTypeId);

        dumpIf(!referenceType, referenceTypeId);
        assert(referenceType instanceof ReferenceType);

        references = references.filter((reference) => {

            const ref = _resolveReferenceType(self.addressSpace, reference);

            if (!ref) {
                return false;
            } // unknown type ... this may happen when the address space is not fully build
            assert(ref instanceof ReferenceType);

            const is_of_type = ref.nodeId.toString() === referenceType.nodeId.toString();
            if (is_of_type) {
                return true;
            }
            if (browseDescription.includeSubtypes) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.ts View on Github external
function _filter_by_referenceType(
    this: BaseNode,
    browseDescription: BrowseDescription,
    references: Reference[],
    referenceTypeId: any
) {

    // make sure we have a valid referenceTypeId if not null
    if (!nodeid_is_nothing(referenceTypeId)) {

        assert(referenceTypeId instanceof NodeId);
        const referenceType = this.addressSpace.findNode(referenceTypeId);

        dumpIf(!referenceType, referenceTypeId);

        if (!referenceType || referenceType.nodeClass !== NodeClass.ReferenceType) {
            throw new Error("Cannot find reference type");
        }

        references = references.filter((reference: Reference) => {

            const ref = resolveReferenceType(this.addressSpace, reference)!;

            if (!ref) {
                return false;
            } // unknown type ... this may happen when the address space is not fully build
            assert(ref.nodeClass === NodeClass.ReferenceType);

            const is_of_type = ref.nodeId.toString() === referenceType.nodeId.toString();
            if (is_of_type) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / namespace.js View on Github external
options.browseName = new QualifiedName({name: options.browseName, namespaceIndex: self.index});

    } else if (!(options.browseName instanceof QualifiedName)) {
        options.browseName = new QualifiedName(options.browseName);
    }
    assert(options.browseName instanceof QualifiedName, "Expecting options.browseName to be instanceof  QualifiedName ");

    // ------------- set display name
    if (!options.displayName) {
        assert(typeof(options.browseName.name) === "string" );
        options.displayName= options.browseName.name;
    }

    //--- nodeId adjustment
    options.nodeId = self._construct_nodeId(options);
    dumpIf(!options.nodeId, options); // missing node Id
    assert(options.nodeId instanceof NodeId);

    //assert(options.browseName.namespaceIndex === self.index,"Expecting browseName to have the same namepsaceIndex as the namespace");

    const Constructor = _constructors_map[NodeClass[options.nodeClass]];

    if (!Constructor) {
        throw new Error(" missing constructor for NodeClass " + NodeClass[options.nodeClass]);
    }

    options.addressSpace = self.addressSpace;
    const node = new Constructor(options);

    assert(node.nodeId);
    assert(node.nodeId instanceof NodeId);
    this._register(node);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / namespace.ts View on Github external
} else if (!(options.browseName instanceof QualifiedName)) {
            options.browseName = new QualifiedName(options.browseName);
        }
        assert(options.browseName instanceof QualifiedName,
            "Expecting options.browseName to be instanceof  QualifiedName ");

        // ------------- set display name
        if (!options.displayName) {
            assert(typeof (options.browseName.name) === "string");
            options.displayName = options.browseName.name;
        }

        // --- nodeId adjustment
        options.nodeId = this._construct_nodeId(options);
        dumpIf(!options.nodeId, options); // missing node Id
        assert(options.nodeId instanceof NodeId);

        // assert(options.browseName.namespaceIndex === this.index,"Expecting browseName to have
        // the same namepsaceIndex as the namespace");

        const Constructor = _constructors_map[NodeClass[options.nodeClass]];

        if (!Constructor) {
            throw new Error(" missing constructor for NodeClass " + NodeClass[options.nodeClass]);
        }

        options.addressSpace = this.addressSpace;
        const node = new Constructor(options);

        assert(node.nodeId);
        assert(node.nodeId instanceof NodeId);