node-opcua-address-space 2.68.1 → 2.69.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/source/index.js +5 -1
- package/dist/source/index.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +4 -0
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.js +2 -1
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/src/address_space.d.ts +3 -2
- package/dist/src/address_space.js +20 -9
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +1 -0
- package/dist/src/alarms_and_conditions/index.js +5 -1
- package/dist/src/alarms_and_conditions/index.js.map +1 -1
- package/dist/src/base_node_private.js +33 -26
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/index_current.js +5 -1
- package/dist/src/index_current.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +1 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/ua_variable_impl.js +1 -2
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js +1 -1
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/distHelpers/index.js +5 -1
- package/distHelpers/index.js.map +1 -1
- package/distNodeJS/index.js +5 -1
- package/distNodeJS/index.js.map +1 -1
- package/package.json +38 -38
- package/source/loader/load_nodeset2.ts +6 -1
- package/source/loader/make_xml_extension_object_parser.ts +3 -2
- package/src/address_space.ts +9 -10
- package/src/base_node_private.ts +46 -38
- package/src/nodeset_tools/nodeset_to_xml.ts +1 -0
- package/src/ua_variable_type_impl.ts +2 -3
package/src/base_node_private.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
NodeClass,
|
|
14
14
|
ResultMask
|
|
15
15
|
} from "node-opcua-data-model";
|
|
16
|
-
import { make_warningLog } from "node-opcua-debug";
|
|
16
|
+
import { checkDebugFlag, make_warningLog } from "node-opcua-debug";
|
|
17
17
|
import { NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
18
18
|
import { ReferenceDescription } from "node-opcua-types";
|
|
19
19
|
import {
|
|
@@ -42,7 +42,7 @@ import { BaseNodeImpl, getReferenceType } from "./base_node_impl";
|
|
|
42
42
|
import { AddressSpacePrivate } from "./address_space_private";
|
|
43
43
|
|
|
44
44
|
// eslint-disable-next-line prefer-const
|
|
45
|
-
let
|
|
45
|
+
let doTrace = checkDebugFlag("INSTANTIATE");
|
|
46
46
|
const traceLog = console.log.bind(console);
|
|
47
47
|
|
|
48
48
|
const g_weakMap = new WeakMap();
|
|
@@ -484,7 +484,7 @@ function _clone_collection_new(
|
|
|
484
484
|
}
|
|
485
485
|
|
|
486
486
|
if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
|
|
487
|
-
|
|
487
|
+
doTrace && traceLog(extraInfo.pad(), "skipping optional ", node.browseName.toString(), "that doesn't appear in the filter");
|
|
488
488
|
continue; // skip this node
|
|
489
489
|
}
|
|
490
490
|
const key = node.browseName.toString();
|
|
@@ -501,7 +501,7 @@ function _clone_collection_new(
|
|
|
501
501
|
copyAlsoModellingRules
|
|
502
502
|
};
|
|
503
503
|
|
|
504
|
-
|
|
504
|
+
doTrace &&
|
|
505
505
|
traceLog(
|
|
506
506
|
extraInfo.pad(),
|
|
507
507
|
"cloning => ",
|
|
@@ -554,7 +554,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
|
|
|
554
554
|
|
|
555
555
|
const baseInterfaces: UAInterface[] = [];
|
|
556
556
|
for (const iface of interfaces) {
|
|
557
|
-
|
|
557
|
+
doTrace &&
|
|
558
558
|
traceLog(
|
|
559
559
|
extraInfo.pad(),
|
|
560
560
|
typeDefinitionNode.browseName.toString(),
|
|
@@ -570,7 +570,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
|
|
|
570
570
|
}
|
|
571
571
|
interfaces.push(...baseInterfaces);
|
|
572
572
|
if (typeDefinitionNode.subtypeOfObj) {
|
|
573
|
-
|
|
573
|
+
doTrace &&
|
|
574
574
|
traceLog(
|
|
575
575
|
extraInfo.pad(),
|
|
576
576
|
typeDefinitionNode.browseName.toString(),
|
|
@@ -583,7 +583,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
|
|
|
583
583
|
}
|
|
584
584
|
const dedupedInterfaces = [...new Set(interfaces)];
|
|
585
585
|
|
|
586
|
-
|
|
586
|
+
doTrace &&
|
|
587
587
|
traceLog(
|
|
588
588
|
extraInfo.pad(),
|
|
589
589
|
chalk.yellow("Interface for ", typeDefinitionNode.browseName.toString()),
|
|
@@ -635,7 +635,7 @@ function _crap_extractInterfaces(typeDefinitionNode: UAObjectType | UAVariableTy
|
|
|
635
635
|
const interfacesRef = typeDefinitionNode.findReferencesEx("HasInterface", BrowseDirection.Forward);
|
|
636
636
|
const interfaces = interfacesRef.map((r) => r.node! as UAInterface);
|
|
637
637
|
for (const iface of interfaces) {
|
|
638
|
-
|
|
638
|
+
doTrace && traceLog(extraInfo.pad(), " interface ", iface.browseName.toString());
|
|
639
639
|
}
|
|
640
640
|
|
|
641
641
|
return interfaces;
|
|
@@ -648,7 +648,7 @@ function _cloneInterface(
|
|
|
648
648
|
extraInfo: CloneExtraInfo,
|
|
649
649
|
browseNameMap: Set<string>
|
|
650
650
|
): void {
|
|
651
|
-
|
|
651
|
+
doTrace &&
|
|
652
652
|
traceLog(
|
|
653
653
|
extraInfo?.pad(),
|
|
654
654
|
chalk.green("-------------------- now cloning interfaces of ", node.browseName.toString(), node.nodeId.toString())
|
|
@@ -660,23 +660,30 @@ function _cloneInterface(
|
|
|
660
660
|
if (!typeDefinitionNode) {
|
|
661
661
|
return;
|
|
662
662
|
}
|
|
663
|
-
dotrace && traceLog(extraInfo.pad(), " --- {");
|
|
664
663
|
const interfaces = _extractInterfaces2(typeDefinitionNode, extraInfo);
|
|
665
|
-
|
|
666
|
-
|
|
664
|
+
if (interfaces.length === 0) {
|
|
665
|
+
if (doTrace) {
|
|
666
|
+
traceLog(
|
|
667
|
+
extraInfo.pad(),
|
|
668
|
+
chalk.yellow("No interface for ", node.browseName.toString(), node.nodeId.toString())
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
doTrace && traceLog(extraInfo?.pad(), chalk.green("-------------------- interfaces are ", interfaces.length));
|
|
667
674
|
|
|
668
675
|
const localFilter = optionalFilter.filterFor(node);
|
|
669
676
|
|
|
670
677
|
for (const iface of interfaces) {
|
|
671
678
|
const aggregates = iface.findReferencesEx("Aggregates", BrowseDirection.Forward);
|
|
672
|
-
|
|
679
|
+
doTrace &&
|
|
673
680
|
traceLog(
|
|
674
681
|
extraInfo.pad(),
|
|
675
682
|
chalk.magentaBright(" interface ", iface.browseName.toString()),
|
|
676
683
|
"\n" + extraInfo?.pad(),
|
|
677
684
|
aggregates.map((r) => r.toString({ addressSpace })).join("\n" + extraInfo?.pad())
|
|
678
685
|
);
|
|
679
|
-
_clone_collection_new(
|
|
686
|
+
_clone_collection_new(node, aggregates, false, localFilter, extraInfo, browseNameMap);
|
|
680
687
|
}
|
|
681
688
|
}
|
|
682
689
|
export function _clone_children_references(
|
|
@@ -775,36 +782,37 @@ export function _clone<T extends UAObject | UAVariable | UAMethod>(
|
|
|
775
782
|
const cloneObj = new Constructor(constructorOptions);
|
|
776
783
|
(this.addressSpace as AddressSpacePrivate)._register(cloneObj);
|
|
777
784
|
|
|
778
|
-
|
|
785
|
+
if (!options.ignoreChildren) {
|
|
786
|
+
// clone children and the rest ....
|
|
787
|
+
options.copyAlsoModellingRules = options.copyAlsoModellingRules || false;
|
|
779
788
|
|
|
780
|
-
|
|
789
|
+
const newFilter = optionalFilter.filterFor(cloneObj);
|
|
781
790
|
|
|
782
|
-
|
|
783
|
-
|
|
791
|
+
const browseNameMap = new Set<string>();
|
|
792
|
+
_clone_children_references(this, cloneObj, options.copyAlsoModellingRules, newFilter!, extraInfo, browseNameMap);
|
|
784
793
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
794
|
+
//
|
|
795
|
+
let typeDefinitionNode: UAVariableType | UAObjectType | null = this.typeDefinitionObj;
|
|
796
|
+
while (typeDefinitionNode) {
|
|
797
|
+
doTrace &&
|
|
798
|
+
traceLog(
|
|
799
|
+
extraInfo?.pad(),
|
|
800
|
+
chalk.blueBright("---------------------- Exploring ", typeDefinitionNode.browseName.toString())
|
|
801
|
+
);
|
|
802
|
+
_clone_children_references(
|
|
803
|
+
typeDefinitionNode,
|
|
804
|
+
cloneObj,
|
|
805
|
+
options.copyAlsoModellingRules,
|
|
806
|
+
newFilter,
|
|
807
|
+
extraInfo,
|
|
808
|
+
browseNameMap
|
|
792
809
|
);
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
cloneObj,
|
|
796
|
-
options.copyAlsoModellingRules,
|
|
797
|
-
newFilter,
|
|
798
|
-
extraInfo,
|
|
799
|
-
browseNameMap
|
|
800
|
-
);
|
|
801
|
-
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
_clone_non_hierarchical_references(this, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
810
|
+
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
811
|
+
}
|
|
805
812
|
|
|
813
|
+
_clone_non_hierarchical_references(this, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
814
|
+
}
|
|
806
815
|
cloneObj.propagate_back_references();
|
|
807
|
-
|
|
808
816
|
cloneObj.install_extra_properties();
|
|
809
817
|
|
|
810
818
|
return cloneObj;
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
UAVariableType,
|
|
22
22
|
CloneFilter
|
|
23
23
|
} from "node-opcua-address-space-base";
|
|
24
|
-
import {
|
|
24
|
+
import { ReferenceTypeIds } from "node-opcua-constants";
|
|
25
25
|
import { coerceQualifiedName, NodeClass, QualifiedName, BrowseDirection, AttributeIds } from "node-opcua-data-model";
|
|
26
26
|
import { DataValue, DataValueLike } from "node-opcua-data-value";
|
|
27
27
|
import { checkDebugFlag, make_debugLog, make_warningLog, make_errorLog } from "node-opcua-debug";
|
|
@@ -40,7 +40,6 @@ import { _clone_children_references, ToStringBuilder, UAVariableType_toString }
|
|
|
40
40
|
import * as tools from "./tool_isSupertypeOf";
|
|
41
41
|
import { get_subtypeOfObj } from "./tool_isSupertypeOf";
|
|
42
42
|
import { get_subtypeOf } from "./tool_isSupertypeOf";
|
|
43
|
-
import { resolveReferenceNode } from "./reference_impl";
|
|
44
43
|
|
|
45
44
|
const debugLog = make_debugLog(__filename);
|
|
46
45
|
const doDebug = checkDebugFlag(__filename);
|
|
@@ -48,7 +47,7 @@ const warningLog = make_warningLog(__filename);
|
|
|
48
47
|
const errorLog = make_errorLog(__filename);
|
|
49
48
|
|
|
50
49
|
// eslint-disable-next-line prefer-const
|
|
51
|
-
let doTrace =
|
|
50
|
+
let doTrace = checkDebugFlag("INSTANTIATE");
|
|
52
51
|
const traceLog = errorLog;
|
|
53
52
|
|
|
54
53
|
interface InstantiateS {
|