How to use the node-opcua-common.ModelChangeStructureDataType function in node-opcua-common

To help you get started, we’ve selected a few node-opcua-common 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 / address_space_change_event_tools.ts View on Github external
addressSpace.modelChangeTransaction(() => {
            // ...
            for (const r of references) {

                const target = addressSpace.findNode(r.nodeId)!;

                const modelChangeSrc_l = new ModelChangeStructureDataType({
                    affected: target.nodeId,
                    affectedType: null,
                    verb: makeVerb("ReferenceDeleted")
                });

                addressSpace._collectModelChange(null, modelChangeSrc_l);
            }

            const modelChangeSrc = new ModelChangeStructureDataType({
                affected: node.nodeId,
                affectedType: node.typeDefinition,
                verb: makeVerb("NodeDeleted")
            });

            addressSpace._collectModelChange(null, modelChangeSrc);
        });
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_change_event_tools.ts View on Github external
affected: node.nodeId,
                affectedType: typeDefinitionNodeId,
                verb: makeVerb("NodeAdded")
            });
            addressSpace._collectModelChange(null, modelChange1);

            const modelChangeSrc = new ModelChangeStructureDataType({
                affected: parent.nodeId,
                affectedType: null,
                verb: makeVerb("ReferenceAdded")
            });
            addressSpace._collectModelChange(null, modelChangeSrc);

            // bidirectional
            if (node.nodeVersion) {
                const modelChangeTgt = new ModelChangeStructureDataType({
                    affected: node.nodeId,
                    affectedType: typeDefinitionNodeId,
                    verb: makeVerb("ReferenceAdded")
                });
                addressSpace._collectModelChange(null, modelChangeTgt);
            }
        });
    }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_change_event_tools.ts View on Github external
addressSpace.modelChangeTransaction(() => {

            let typeDefinitionNodeId = null;

            if (node.nodeClass === NodeClass.Object || node.nodeClass === NodeClass.Variable) {
                typeDefinitionNodeId = node.typeDefinitionObj.nodeId;
            }

            const modelChange1 = new ModelChangeStructureDataType({
                affected: node.nodeId,
                affectedType: typeDefinitionNodeId,
                verb: makeVerb("NodeAdded")
            });
            addressSpace._collectModelChange(null, modelChange1);

            const modelChangeSrc = new ModelChangeStructureDataType({
                affected: parent.nodeId,
                affectedType: null,
                verb: makeVerb("ReferenceAdded")
            });
            addressSpace._collectModelChange(null, modelChangeSrc);

            // bidirectional
            if (node.nodeVersion) {
                const modelChangeTgt = new ModelChangeStructureDataType({
                    affected: node.nodeId,
                    affectedType: typeDefinitionNodeId,
                    verb: makeVerb("ReferenceAdded")
                });
                addressSpace._collectModelChange(null, modelChangeTgt);
            }
        });
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_change_event_tools.ts View on Github external
addressSpace.modelChangeTransaction(() => {

            let typeDefinitionNodeId = null;

            if (node.nodeClass === NodeClass.Object || node.nodeClass === NodeClass.Variable) {
                typeDefinitionNodeId = node.typeDefinitionObj.nodeId;
            }

            const modelChange1 = new ModelChangeStructureDataType({
                affected: node.nodeId,
                affectedType: typeDefinitionNodeId,
                verb: makeVerb("NodeAdded")
            });
            addressSpace._collectModelChange(null, modelChange1);

            const modelChangeSrc = new ModelChangeStructureDataType({
                affected: parent.nodeId,
                affectedType: null,
                verb: makeVerb("ReferenceAdded")
            });
            addressSpace._collectModelChange(null, modelChangeSrc);

            // bidirectional
            if (node.nodeVersion) {
                const modelChangeTgt = new ModelChangeStructureDataType({
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_change_event_tools.ts View on Github external
function _getTypeDef(node: BaseNode) {
                if (node.nodeClass === NodeClass.Object || node.nodeClass === NodeClass.Variable) {
                    return node.typeDefinitionObj.nodeId;
                }
                return null;
            }

            let modelChangeTgt = new ModelChangeStructureDataType({
                affected: node1.nodeId,
                affectedType: _getTypeDef(node1),
                verb: makeVerb("ReferenceAdded")
            });
            addressSpace._collectModelChange(null, modelChangeTgt);

            modelChangeTgt = new ModelChangeStructureDataType({
                affected: node2.nodeId,
                affectedType: _getTypeDef(node2),
                verb: makeVerb("ReferenceAdded")
            });
            addressSpace._collectModelChange(null, modelChangeTgt);
        });
    }