node-opcua-address-space 2.68.0 → 2.69.1
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/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/source/session_context.js +0 -1
- package/dist/source/session_context.js.map +1 -1
- package/dist/src/address_space.d.ts +3 -2
- package/dist/src/address_space.js +19 -7
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +1 -0
- package/dist/src/base_node_private.js +33 -26
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +5 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/ua_variable_impl.js +2 -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/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 +12 -4
- package/src/ua_variable_impl.ts +14 -10
- 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;
|
|
@@ -243,11 +243,14 @@ function _dumpVariantInnerExtensionObject(
|
|
|
243
243
|
const lowerFieldName = utils.lowerFirstLetter(fieldName);
|
|
244
244
|
const v = (value as unknown as Record<string, unknown>)[lowerFieldName];
|
|
245
245
|
if (v !== null && v !== undefined) {
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
if (
|
|
247
|
+
dataTypeNodeId.namespace === 0 &&
|
|
248
|
+
dataTypeNodeId.value === 0 &&
|
|
249
|
+
dataTypeNodeId.identifierType === NodeIdType.NUMERIC
|
|
250
|
+
) {
|
|
248
251
|
// to do ?? shall we do a extension Object here ?
|
|
249
252
|
continue; // ns=0;i=0 is reserved
|
|
250
|
-
}
|
|
253
|
+
}
|
|
251
254
|
const { name, definition } = definitionMap.findDefinition(dataTypeNodeId);
|
|
252
255
|
xw.startElement(fieldName);
|
|
253
256
|
|
|
@@ -324,7 +327,9 @@ function _dumpVariantInnerValue(
|
|
|
324
327
|
xw.text(value[1].toString());
|
|
325
328
|
break;
|
|
326
329
|
case DataType.Boolean:
|
|
330
|
+
case DataType.SByte:
|
|
327
331
|
case DataType.Byte:
|
|
332
|
+
case DataType.SByte:
|
|
328
333
|
case DataType.Float:
|
|
329
334
|
case DataType.Double:
|
|
330
335
|
case DataType.Int16:
|
|
@@ -628,7 +633,10 @@ function dumpReferencedNodes(xw: XmlWriter, node: BaseNode, forward: boolean) {
|
|
|
628
633
|
const typeDefinitionObj = ReferenceImpl.resolveReferenceNode(addressSpace, r[0])! as BaseNode;
|
|
629
634
|
if (!typeDefinitionObj) {
|
|
630
635
|
warningLog(node.toString());
|
|
631
|
-
warningLog(
|
|
636
|
+
warningLog(
|
|
637
|
+
"dumpReferencedNodes: Warning : " + node.browseName.toString() + " unknown typeDefinition, ",
|
|
638
|
+
r[0].toString()
|
|
639
|
+
);
|
|
632
640
|
} else {
|
|
633
641
|
assert(typeDefinitionObj instanceof BaseNodeImpl);
|
|
634
642
|
if (typeDefinitionObj.nodeId.namespace === node.nodeId.namespace) {
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -89,7 +89,15 @@ import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
|
|
|
89
89
|
import { _clone, ToStringBuilder, UAVariable_toString, valueRankToString } from "./base_node_private";
|
|
90
90
|
import { EnumerationInfo, IEnumItem, UADataTypeImpl } from "./ua_data_type_impl";
|
|
91
91
|
import { apply_condition_refresh, ConditionRefreshCache } from "./apply_condition_refresh";
|
|
92
|
-
import {
|
|
92
|
+
import {
|
|
93
|
+
extractPartialData,
|
|
94
|
+
propagateTouchValueUpward,
|
|
95
|
+
setExtensionObjectValue,
|
|
96
|
+
_bindExtensionObject,
|
|
97
|
+
_installExtensionObjectBindingOnProperties,
|
|
98
|
+
_setExtensionObject,
|
|
99
|
+
_touchValue
|
|
100
|
+
} from "./ua_variable_impl_ext_obj";
|
|
93
101
|
|
|
94
102
|
const debugLog = make_debugLog(__filename);
|
|
95
103
|
const warningLog = make_warningLog(__filename);
|
|
@@ -774,7 +782,6 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
774
782
|
} else {
|
|
775
783
|
this._internal_set_dataValue(dataValue);
|
|
776
784
|
}
|
|
777
|
-
|
|
778
785
|
} catch (err) {
|
|
779
786
|
errorLog("UAVariable#setValueFromString Error : ", this.browseName.toString(), this.nodeId.toString());
|
|
780
787
|
errorLog((err as Error).message);
|
|
@@ -1167,7 +1174,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1167
1174
|
if (!context) {
|
|
1168
1175
|
context = SessionContext.defaultContext;
|
|
1169
1176
|
}
|
|
1170
|
-
assert(typeof callback
|
|
1177
|
+
assert(typeof callback === "function");
|
|
1171
1178
|
|
|
1172
1179
|
this.__waiting_callbacks = this.__waiting_callbacks || [];
|
|
1173
1180
|
this.__waiting_callbacks.push(callback);
|
|
@@ -1324,8 +1331,8 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1324
1331
|
|
|
1325
1332
|
/**
|
|
1326
1333
|
* @private
|
|
1327
|
-
* install UAVariable to exposed th
|
|
1328
|
-
*
|
|
1334
|
+
* install UAVariable to exposed th
|
|
1335
|
+
*
|
|
1329
1336
|
* precondition:
|
|
1330
1337
|
*/
|
|
1331
1338
|
public installExtensionObjectVariables(): void {
|
|
@@ -1347,10 +1354,9 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1347
1354
|
optionalExtensionObject?: ExtensionObject,
|
|
1348
1355
|
options?: BindExtensionObjectOptions
|
|
1349
1356
|
): ExtensionObject | null {
|
|
1350
|
-
|
|
1357
|
+
return _bindExtensionObject(this, optionalExtensionObject, options);
|
|
1351
1358
|
}
|
|
1352
1359
|
|
|
1353
|
-
|
|
1354
1360
|
public updateExtensionObjectPartial(partialExtensionObject?: { [key: string]: any }): ExtensionObject {
|
|
1355
1361
|
setExtensionObjectValue(this, partialExtensionObject);
|
|
1356
1362
|
return this.$extensionObject;
|
|
@@ -1412,7 +1418,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1412
1418
|
callback?: CallbackT<HistoryReadResult>
|
|
1413
1419
|
): any {
|
|
1414
1420
|
assert(context instanceof SessionContext);
|
|
1415
|
-
assert(typeof callback ===
|
|
1421
|
+
assert(typeof callback === "function");
|
|
1416
1422
|
if (typeof this._historyRead !== "function") {
|
|
1417
1423
|
return callback!(null, new HistoryReadResult({ statusCode: StatusCodes.BadNotReadable }));
|
|
1418
1424
|
}
|
|
@@ -1505,7 +1511,6 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1505
1511
|
this.$dataValue.value = value;
|
|
1506
1512
|
}
|
|
1507
1513
|
|
|
1508
|
-
|
|
1509
1514
|
public _internal_set_dataValue(dataValue: DataValue, indexRange?: NumericRange | null): void {
|
|
1510
1515
|
assert(dataValue, "expecting a dataValue");
|
|
1511
1516
|
assert(dataValue instanceof DataValue, "expecting dataValue to be a DataValue");
|
|
@@ -1686,7 +1691,6 @@ export interface UAVariableImpl {
|
|
|
1686
1691
|
$$indexPropertyName: any;
|
|
1687
1692
|
}
|
|
1688
1693
|
|
|
1689
|
-
|
|
1690
1694
|
function check_valid_array(dataType: DataType, array: any): boolean {
|
|
1691
1695
|
if (Array.isArray(array)) {
|
|
1692
1696
|
return true;
|
|
@@ -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 {
|