node-opcua-address-space 2.83.0 → 2.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/base_node_impl.js +1 -1
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +8 -7
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +29 -36
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +1 -1
- package/dist/src/ua_variable_impl.js +1 -1
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/package.json +18 -18
- package/src/base_node_impl.ts +8 -3
- package/src/base_node_private.ts +17 -17
- package/src/nodeset_tools/nodeset_to_xml.ts +41 -43
- package/src/ua_variable_impl.ts +1 -1
package/src/base_node_private.ts
CHANGED
|
@@ -813,25 +813,25 @@ export function _clone<T extends UAObject | UAVariable | UAMethod>(
|
|
|
813
813
|
const browseNameMap = new Set<string>();
|
|
814
814
|
_clone_children_references(this, cloneObj, options.copyAlsoModellingRules, newFilter!, extraInfo, browseNameMap);
|
|
815
815
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
816
|
+
if (this.nodeClass === NodeClass.Object || this.nodeClass === NodeClass.Variable) {
|
|
817
|
+
let typeDefinitionNode: UAVariableType | UAObjectType | null = this.typeDefinitionObj;
|
|
818
|
+
while (typeDefinitionNode) {
|
|
819
|
+
doTrace &&
|
|
820
|
+
traceLog(
|
|
821
|
+
extraInfo?.pad(),
|
|
822
|
+
chalk.blueBright("---------------------- Exploring ", typeDefinitionNode.browseName.toString())
|
|
823
|
+
);
|
|
824
|
+
_clone_children_references(
|
|
825
|
+
typeDefinitionNode,
|
|
826
|
+
cloneObj,
|
|
827
|
+
options.copyAlsoModellingRules,
|
|
828
|
+
newFilter,
|
|
829
|
+
extraInfo,
|
|
830
|
+
browseNameMap
|
|
823
831
|
);
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
cloneObj,
|
|
827
|
-
options.copyAlsoModellingRules,
|
|
828
|
-
newFilter,
|
|
829
|
-
extraInfo,
|
|
830
|
-
browseNameMap
|
|
831
|
-
);
|
|
832
|
-
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
832
|
+
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
833
|
+
}
|
|
833
834
|
}
|
|
834
|
-
|
|
835
835
|
_clone_non_hierarchical_references(this, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
836
836
|
}
|
|
837
837
|
cloneObj.propagate_back_references();
|
|
@@ -50,7 +50,11 @@ import { SessionContext } from "../index_current";
|
|
|
50
50
|
|
|
51
51
|
import { DefinitionMap2, TypeInfo } from "../../source/loader/make_xml_extension_object_parser";
|
|
52
52
|
import { makeDefinitionMap } from "../../source/loader/decode_xml_extension_object";
|
|
53
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
constructNamespaceDependency,
|
|
55
|
+
constructNamespacePriorityTable,
|
|
56
|
+
hasHigherPriorityThan
|
|
57
|
+
} from "./construct_namespace_dependency";
|
|
54
58
|
|
|
55
59
|
// tslint:disable:no-var-requires
|
|
56
60
|
const XMLWriter = require("xml-writer");
|
|
@@ -628,37 +632,37 @@ function _dumpValue(xw: XmlWriter, node: UAVariable | UAVariableType, value: Var
|
|
|
628
632
|
if (isExtensionObject) {
|
|
629
633
|
const encodeXml = _dumpVariantExtensionObjectValue2.bind(null, xw, dataTypeNode);
|
|
630
634
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
635
|
+
switch (value.arrayType) {
|
|
636
|
+
case VariantArrayType.Matrix:
|
|
637
|
+
case VariantArrayType.Array:
|
|
638
|
+
startElementEx(xw, uax, `ListOf${baseDataTypeName}`, "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
639
|
+
value.value.forEach(encodeXml);
|
|
640
|
+
restoreDefaultNamespace(xw);
|
|
641
|
+
xw.endElement();
|
|
642
|
+
break;
|
|
643
|
+
case VariantArrayType.Scalar:
|
|
644
|
+
encodeXml(value.value);
|
|
645
|
+
break;
|
|
646
|
+
default:
|
|
647
|
+
errorLog(node.toString());
|
|
648
|
+
errorLog("_dumpValue : unsupported arrayType: ", value.arrayType);
|
|
642
649
|
}
|
|
643
650
|
} else {
|
|
644
651
|
const encodeXml = _dumpVariantValue.bind(null, xw, value.dataType, node);
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
errorLog(node.toString());
|
|
660
|
-
errorLog("_dumpValue : unsupported case , Matrix");
|
|
661
|
-
// xx throw new Error("Unsupported case");
|
|
652
|
+
switch (value.arrayType) {
|
|
653
|
+
case VariantArrayType.Matrix:
|
|
654
|
+
case VariantArrayType.Array:
|
|
655
|
+
startElementEx(xw, uax, `ListOf${dataTypeName}`, "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
656
|
+
value.value.forEach(encodeXml);
|
|
657
|
+
restoreDefaultNamespace(xw);
|
|
658
|
+
xw.endElement();
|
|
659
|
+
break;
|
|
660
|
+
case VariantArrayType.Scalar:
|
|
661
|
+
encodeXml(value.value);
|
|
662
|
+
break;
|
|
663
|
+
default:
|
|
664
|
+
errorLog(node.toString());
|
|
665
|
+
errorLog("_dumpValue : unsupported arrayType: ", value.arrayType);
|
|
662
666
|
}
|
|
663
667
|
}
|
|
664
668
|
|
|
@@ -675,7 +679,6 @@ function _dumpArrayDimensionsAttribute(xw: XmlWriter, node: UAVariableType | UAV
|
|
|
675
679
|
}
|
|
676
680
|
|
|
677
681
|
function visitUANode(node: BaseNode, data: DumpData, forward: boolean) {
|
|
678
|
-
|
|
679
682
|
const addressSpace = node.addressSpace;
|
|
680
683
|
|
|
681
684
|
// visit references
|
|
@@ -800,7 +803,7 @@ function dumpCommonAttributes(xw: XmlWriter, node: BaseNode) {
|
|
|
800
803
|
}
|
|
801
804
|
}
|
|
802
805
|
if (Object.prototype.hasOwnProperty.call(node, "minimumSamplingInterval")) {
|
|
803
|
-
const minimumSamplingInterval =(node as UAVariable).minimumSamplingInterval;
|
|
806
|
+
const minimumSamplingInterval = (node as UAVariable).minimumSamplingInterval;
|
|
804
807
|
if (minimumSamplingInterval > 0) {
|
|
805
808
|
xw.writeAttribute("MinimumSamplingInterval", minimumSamplingInterval);
|
|
806
809
|
}
|
|
@@ -1030,11 +1033,11 @@ function dumpUAVariableType(xw: XmlWriter, node: UAVariableType) {
|
|
|
1030
1033
|
// throw new Error(" cannot find datatype " + node.dataType);
|
|
1031
1034
|
console.log(
|
|
1032
1035
|
" cannot find datatype " +
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1036
|
+
node.dataType +
|
|
1037
|
+
" for node " +
|
|
1038
|
+
node.browseName.toString() +
|
|
1039
|
+
" id =" +
|
|
1040
|
+
node.nodeId.toString()
|
|
1038
1041
|
);
|
|
1039
1042
|
} else {
|
|
1040
1043
|
const dataTypeName = b(xw, resolveDataTypeName(addressSpace, dataTypeNode.nodeId));
|
|
@@ -1063,6 +1066,7 @@ function dumpUAObject(xw: XmlWriter, node: UAObject) {
|
|
|
1063
1066
|
_dumpUAObject(xw, node);
|
|
1064
1067
|
xw.writeComment("Object - " + b(xw, node.browseName) + " }}}} ");
|
|
1065
1068
|
}
|
|
1069
|
+
|
|
1066
1070
|
function _dumpUAObject(xw: XmlWriter, node: UAObject) {
|
|
1067
1071
|
assert(node.nodeClass === NodeClass.Object);
|
|
1068
1072
|
xw.visitedNode = xw.visitedNode || {};
|
|
@@ -1101,9 +1105,7 @@ function dumpElementInFolder(xw: XmlWriter, node: BaseNodeImpl) {
|
|
|
1101
1105
|
|
|
1102
1106
|
function dumpAggregates(xw: XmlWriter, node: BaseNode) {
|
|
1103
1107
|
// Xx xw.writeComment("Aggregates {{ ");
|
|
1104
|
-
const aggregates = node
|
|
1105
|
-
.getAggregates()
|
|
1106
|
-
.sort(sortByBrowseName);
|
|
1108
|
+
const aggregates = node.getAggregates().sort(sortByBrowseName);
|
|
1107
1109
|
// const aggregates = node.findReferencesExAsObject("Aggregates", BrowseDirection.Forward);
|
|
1108
1110
|
|
|
1109
1111
|
for (const aggregate of aggregates.sort(sortByNodeId)) {
|
|
@@ -1242,7 +1244,6 @@ function writeAliases(xw: XmlWriter, aliases: Record<string, NodeIdString>) {
|
|
|
1242
1244
|
xw.endElement();
|
|
1243
1245
|
}
|
|
1244
1246
|
|
|
1245
|
-
|
|
1246
1247
|
export function constructNamespaceTranslationTable(dependency: INamespace[]): ITranslationTable {
|
|
1247
1248
|
const translationTable: ITranslationTable = {};
|
|
1248
1249
|
for (let i = 0; i < dependency.length; i++) {
|
|
@@ -1329,8 +1330,6 @@ function makeTypeXsd(namespaceUri: string): string {
|
|
|
1329
1330
|
|
|
1330
1331
|
// eslint-disable-next-line max-statements
|
|
1331
1332
|
NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
1333
|
const namespaceArrayNode = this.addressSpace.findNode(VariableIds.Server_NamespaceArray);
|
|
1335
1334
|
const namespaceArray: string[] = namespaceArrayNode
|
|
1336
1335
|
? namespaceArrayNode.readAttribute(null, AttributeIds.Value).value.value
|
|
@@ -1343,7 +1342,6 @@ NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
|
|
|
1343
1342
|
const translationTable = constructNamespaceTranslationTable(dependency);
|
|
1344
1343
|
xw.translationTable = translationTable;
|
|
1345
1344
|
|
|
1346
|
-
|
|
1347
1345
|
xw.startDocument({ encoding: "utf-8", version: "1.0" });
|
|
1348
1346
|
xw.startElement("UANodeSet");
|
|
1349
1347
|
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -1388,7 +1388,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1388
1388
|
return false;
|
|
1389
1389
|
}
|
|
1390
1390
|
return checkExtensionObjectIsCorrectScalar.call(this, extObj);
|
|
1391
|
-
} else if (this.valueRank
|
|
1391
|
+
} else if (this.valueRank >= 1) {
|
|
1392
1392
|
/** array */
|
|
1393
1393
|
if (!(extObj instanceof Array)) {
|
|
1394
1394
|
// let's coerce this scalar into an 1-element array if it is a valid extension object
|