node-opcua-address-space 2.163.0 → 2.164.2
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/helpers/adjust_browse_direction.js +1 -1
- package/dist/source/helpers/adjust_browse_direction.js.map +1 -1
- package/dist/source/helpers/argument_list.js +8 -8
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/dump_tools.js +1 -1
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/loader/decode_xml_extension_object.js +3 -3
- package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +7 -7
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.js +3 -3
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/source/loader/namespace_post_step.js +1 -1
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/source/loader/parsers/extension_object_parser.js +1 -1
- package/dist/source/loader/parsers/extension_object_parser.js.map +1 -1
- package/dist/source/pseudo_session.js +1 -1
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/source/set_namespace_meta_data.js +3 -3
- package/dist/source/set_namespace_meta_data.js.map +1 -1
- package/dist/src/_instantiate_helpers.js +1 -1
- package/dist/src/_instantiate_helpers.js.map +1 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.js +3 -3
- package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
- package/dist/src/address_space.js +27 -27
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +5 -5
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +2 -2
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +1 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +14 -2
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +31 -14
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +2 -2
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +2 -2
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +2 -2
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +20 -20
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +20 -20
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js +1 -1
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
- package/dist/src/data_access/ua_two_state_discrete_impl.js +2 -2
- package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
- package/dist/src/extension_object_array_node.js +7 -7
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +7 -2
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/namespace_impl.js +18 -18
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeid_manager.js +1 -1
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +4 -4
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.js +2 -2
- package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +5 -5
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +13 -13
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +4 -4
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/tool_isSubtypeOf.js +1 -1
- package/dist/src/tool_isSubtypeOf.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +2 -0
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +2 -2
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_impl.js +2 -2
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.js +33 -19
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +15 -15
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js +2 -2
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/validate_data_type_correctness.js +7 -7
- package/dist/src/validate_data_type_correctness.js.map +1 -1
- package/dist/tsconfig_base.tsbuildinfo +1 -1
- package/distHelpers/boiler_system.js +2 -2
- package/distHelpers/boiler_system.js.map +1 -1
- package/distHelpers/get_address_space_fixture.js +2 -2
- package/distHelpers/get_address_space_fixture.js.map +1 -1
- package/distHelpers/mock_session.d.ts +1 -0
- package/distHelpers/mock_session.js +3 -0
- package/distHelpers/mock_session.js.map +1 -1
- package/distNodeJS/generate_address_space.js +1 -1
- package/distNodeJS/generate_address_space.js.map +1 -1
- package/package.json +38 -38
- package/source/helpers/adjust_browse_direction.ts +1 -1
- package/source/helpers/argument_list.ts +8 -8
- package/source/helpers/dump_tools.ts +1 -1
- package/source/loader/decode_xml_extension_object.ts +3 -3
- package/source/loader/load_nodeset2.ts +7 -7
- package/source/loader/make_xml_extension_object_parser.ts +3 -3
- package/source/loader/namespace_post_step.ts +1 -1
- package/source/loader/parsers/extension_object_parser.ts +1 -1
- package/source/pseudo_session.ts +1 -1
- package/source/set_namespace_meta_data.ts +3 -3
- package/source_nodejs/generate_address_space.ts +1 -1
- package/src/_instantiate_helpers.ts +1 -1
- package/src/_mandatory_child_or_requested_optional_filter.ts +3 -3
- package/src/address_space.ts +27 -27
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +5 -5
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +16 -2
- package/src/alarms_and_conditions/ua_condition_impl.ts +38 -18
- package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +1 -1
- package/src/base_node_impl.ts +20 -20
- package/src/base_node_private.ts +20 -20
- package/src/data_access/ua_multistate_value_discrete_impl.ts +1 -1
- package/src/data_access/ua_two_state_discrete_impl.ts +6 -4
- package/src/extension_object_array_node.ts +7 -7
- package/src/historical_access/address_space_historical_data_node.ts +9 -4
- package/src/namespace_impl.ts +18 -18
- package/src/nodeid_manager.ts +1 -1
- package/src/nodeset_tools/construct_namespace_dependency.ts +4 -4
- package/src/nodeset_tools/dump_to_bsd.ts +2 -2
- package/src/nodeset_tools/nodeset_to_xml.ts +5 -5
- package/src/state_machine/finite_state_machine.ts +13 -13
- package/src/state_machine/ua_shelving_state_machine_ex.ts +4 -4
- package/src/state_machine/ua_two_state_variable.ts +1 -1
- package/src/tool_isSubtypeOf.ts +1 -1
- package/src/ua_data_type_impl.ts +2 -0
- package/src/ua_method_impl.ts +2 -2
- package/src/ua_object_impl.ts +2 -2
- package/src/ua_variable_impl.ts +56 -40
- package/src/ua_variable_impl_ext_obj.ts +17 -16
- package/src/ua_variable_type_impl.ts +2 -2
- package/src/validate_data_type_correctness.ts +7 -7
package/src/address_space.ts
CHANGED
|
@@ -135,7 +135,7 @@ function _extract_namespace_and_browse_name_as_string(
|
|
|
135
135
|
result = [addressSpace.getNamespace(namespaceIndex), browseName];
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
/*
|
|
138
|
+
/* c8 ignore next */
|
|
139
139
|
if (!result || !result[0]) {
|
|
140
140
|
throw new Error(` Cannot find namespace associated with ${browseNameOrNodeId} ${namespaceIndex}`);
|
|
141
141
|
}
|
|
@@ -245,7 +245,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
245
245
|
* @return address space own namespace
|
|
246
246
|
*/
|
|
247
247
|
public getOwnNamespace(): NamespacePrivate {
|
|
248
|
-
/*
|
|
248
|
+
/* c8 ignore next */
|
|
249
249
|
if (this._private_namespaceIndex >= this._namespaceArray.length) {
|
|
250
250
|
throw new Error("please create the private namespace");
|
|
251
251
|
}
|
|
@@ -474,7 +474,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
474
474
|
const _orig_dataTypeNode = dataTypeNode;
|
|
475
475
|
if (typeof dataTypeNode === "string") {
|
|
476
476
|
const resolvedDataType = this.resolveNodeId(dataTypeNode);
|
|
477
|
-
/*
|
|
477
|
+
/* c8 ignore next */
|
|
478
478
|
if (!resolvedDataType) {
|
|
479
479
|
throw new Error("Cannot resolve " + _orig_dataTypeNode.toString());
|
|
480
480
|
}
|
|
@@ -483,12 +483,12 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
483
483
|
|
|
484
484
|
if (dataTypeNode instanceof NodeId) {
|
|
485
485
|
dataTypeNode = this.findDataType(dataTypeNode)!;
|
|
486
|
-
/*
|
|
486
|
+
/* c8 ignore next */
|
|
487
487
|
if (!dataTypeNode) {
|
|
488
488
|
throw Error("cannot find dataTypeNode " + _orig_dataTypeNode.toString());
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
/*
|
|
491
|
+
/* c8 ignore next */
|
|
492
492
|
if (!(dataTypeNode instanceof UADataTypeImpl)) {
|
|
493
493
|
throw new Error(
|
|
494
494
|
"we are expecting an UADataType here : " +
|
|
@@ -562,7 +562,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
562
562
|
}
|
|
563
563
|
if (refType instanceof NodeId) {
|
|
564
564
|
node = this.findNode(refType) as UAReferenceType;
|
|
565
|
-
/*
|
|
565
|
+
/* c8 ignore next */
|
|
566
566
|
if (!(node && node.nodeClass === NodeClass.ReferenceType)) {
|
|
567
567
|
// throw new Error("cannot resolve referenceId "+ refType.toString());
|
|
568
568
|
return null;
|
|
@@ -630,7 +630,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
630
630
|
|
|
631
631
|
const baseEventType = this.findObjectType("BaseEventType");
|
|
632
632
|
|
|
633
|
-
/*
|
|
633
|
+
/* c8 ignore next */
|
|
634
634
|
if (!baseEventType) {
|
|
635
635
|
throw new Error("expecting BaseEventType - please check you nodeset xml file!");
|
|
636
636
|
}
|
|
@@ -639,7 +639,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
639
639
|
return eventType as UAObjectType;
|
|
640
640
|
}
|
|
641
641
|
/* eventTypeNode should be a sub type of "BaseEventType" */
|
|
642
|
-
/*
|
|
642
|
+
/* c8 ignore next */
|
|
643
643
|
if (!eventType.isSubtypeOf(baseEventType)) {
|
|
644
644
|
throw new Error("findEventType: event found is not subType of BaseEventType");
|
|
645
645
|
}
|
|
@@ -697,7 +697,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
697
697
|
eventTypeNode = this.findEventType(eventTypeId)!;
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
-
/*
|
|
700
|
+
/* c8 ignore next */
|
|
701
701
|
if (!eventTypeNode) {
|
|
702
702
|
throw new Error(" cannot find EvenType for " + eventTypeId);
|
|
703
703
|
}
|
|
@@ -750,7 +750,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
750
750
|
// xx assert(eventTypeNode.isAbstract);
|
|
751
751
|
|
|
752
752
|
const baseObjectType = this.findObjectType("BaseObjectType"); // i=58
|
|
753
|
-
/*
|
|
753
|
+
/* c8 ignore next */
|
|
754
754
|
if (!baseObjectType) {
|
|
755
755
|
throw new Error("BaseObjectType must be defined in the address space");
|
|
756
756
|
}
|
|
@@ -775,7 +775,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
775
775
|
// add a property , but with a null variant
|
|
776
776
|
eventData._createValue(fullBrowsePath, node, { dataType: DataType.Null });
|
|
777
777
|
|
|
778
|
-
//
|
|
778
|
+
// c8 ignore next
|
|
779
779
|
if (doDebug) {
|
|
780
780
|
if (node.modellingRule === "Mandatory") {
|
|
781
781
|
// tslint:disable:no-console
|
|
@@ -805,7 +805,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
805
805
|
if (k === "$eventDataSource") {
|
|
806
806
|
return;
|
|
807
807
|
}
|
|
808
|
-
/*
|
|
808
|
+
/* c8 ignore next */
|
|
809
809
|
if (!alreadyVisited(k)) {
|
|
810
810
|
warningLog(
|
|
811
811
|
"constructEventData: cannot find property '" +
|
|
@@ -825,13 +825,13 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
const baseTypeNodeId = self.subtypeOf;
|
|
828
|
-
/*
|
|
828
|
+
/* c8 ignore next */
|
|
829
829
|
if (!baseTypeNodeId) {
|
|
830
830
|
throw new Error("Object " + self.browseName.toString() + " with nodeId " + self.nodeId + " has no Type");
|
|
831
831
|
}
|
|
832
832
|
|
|
833
833
|
const baseType = this.findNode(baseTypeNodeId);
|
|
834
|
-
/*
|
|
834
|
+
/* c8 ignore next */
|
|
835
835
|
if (!baseType) {
|
|
836
836
|
throw new Error(chalk.red("Cannot find object with nodeId ") + baseTypeNodeId);
|
|
837
837
|
}
|
|
@@ -843,7 +843,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
843
843
|
const components = self.getComponents();
|
|
844
844
|
const children = ([] as BaseNode[]).concat(properties, components);
|
|
845
845
|
|
|
846
|
-
//
|
|
846
|
+
// c8 ignore next
|
|
847
847
|
if (doDebug) {
|
|
848
848
|
debugLog(" " + chalk.bgWhite.cyan(self.browseName.toString()));
|
|
849
849
|
}
|
|
@@ -1009,13 +1009,13 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1009
1009
|
|
|
1010
1010
|
if (dataType instanceof NodeId) {
|
|
1011
1011
|
const tmp = this.findNode(dataType);
|
|
1012
|
-
/*
|
|
1012
|
+
/* c8 ignore next */
|
|
1013
1013
|
if (!tmp) {
|
|
1014
1014
|
throw new Error("getExtensionObjectConstructor: cannot resolve dataType " + dataType);
|
|
1015
1015
|
}
|
|
1016
1016
|
dataType = tmp as UADataType;
|
|
1017
1017
|
}
|
|
1018
|
-
/*
|
|
1018
|
+
/* c8 ignore next */
|
|
1019
1019
|
if (!(dataType instanceof UADataTypeImpl)) {
|
|
1020
1020
|
// may be dataType was the NodeId of the "Binary Encoding" node
|
|
1021
1021
|
throw new Error("getExtensionObjectConstructor: dataType has unexpected type" + dataType);
|
|
@@ -1023,7 +1023,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1023
1023
|
const _dataType = dataType as UADataTypeImpl;
|
|
1024
1024
|
|
|
1025
1025
|
// to do verify that dataType is of type "Structure"
|
|
1026
|
-
/*
|
|
1026
|
+
/* c8 ignore next */
|
|
1027
1027
|
if (!_dataType.isSubtypeOf(this.findDataType("Structure")!)) {
|
|
1028
1028
|
debugLog(_dataType.toString());
|
|
1029
1029
|
}
|
|
@@ -1067,7 +1067,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1067
1067
|
public dispose(): void {
|
|
1068
1068
|
this._namespaceArray.map((namespace: NamespacePrivate) => namespace.dispose());
|
|
1069
1069
|
AddressSpace.registry.unregister(this);
|
|
1070
|
-
/*
|
|
1070
|
+
/* c8 ignore next */
|
|
1071
1071
|
if (this._shutdownTask && this._shutdownTask.length > 0) {
|
|
1072
1072
|
throw new Error("AddressSpace#dispose : shutdown has not been called");
|
|
1073
1073
|
}
|
|
@@ -1110,7 +1110,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1110
1110
|
|
|
1111
1111
|
browseDescription.browseDirection = adjustBrowseDirection(browseDescription.browseDirection, BrowseDirection.Forward);
|
|
1112
1112
|
|
|
1113
|
-
/*
|
|
1113
|
+
/* c8 ignore next */
|
|
1114
1114
|
if (typeof nodeId === "number") {
|
|
1115
1115
|
throw new Error("Not Implemented");
|
|
1116
1116
|
}
|
|
@@ -1153,7 +1153,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1153
1153
|
*/
|
|
1154
1154
|
public _coerceFolder(folder: UAObject): BaseNode | null {
|
|
1155
1155
|
folder = this._coerceNode(folder) as UAObject;
|
|
1156
|
-
/*
|
|
1156
|
+
/* c8 ignore next */
|
|
1157
1157
|
if (folder && !_isFolder(this, folder)) {
|
|
1158
1158
|
throw new Error("Parent folder must be of FolderType " + folder.typeDefinition.toString());
|
|
1159
1159
|
}
|
|
@@ -1420,7 +1420,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1420
1420
|
assert(typeof topMostBaseType === "string");
|
|
1421
1421
|
const topMostBaseTypeNode = this.findNode(topMostBaseType) as T;
|
|
1422
1422
|
|
|
1423
|
-
/*
|
|
1423
|
+
/* c8 ignore next */
|
|
1424
1424
|
if (!topMostBaseTypeNode) {
|
|
1425
1425
|
throw new Error("Cannot find topMostBaseTypeNode " + topMostBaseType.toString());
|
|
1426
1426
|
}
|
|
@@ -1438,15 +1438,15 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1438
1438
|
baseTypeNode = this.findNode(baseType as NodeIdLike) as T;
|
|
1439
1439
|
}
|
|
1440
1440
|
|
|
1441
|
-
/*
|
|
1441
|
+
/* c8 ignore next*/
|
|
1442
1442
|
if (!baseTypeNode) {
|
|
1443
1443
|
throw new Error("Cannot find ObjectType or VariableType for " + baseType.toString());
|
|
1444
1444
|
}
|
|
1445
|
-
/*
|
|
1445
|
+
/* c8 ignore next */
|
|
1446
1446
|
if (!(baseTypeNode as any).isSubtypeOf) {
|
|
1447
1447
|
throw new Error("Cannot find ObjectType or VariableType for " + baseType.toString());
|
|
1448
1448
|
}
|
|
1449
|
-
/*
|
|
1449
|
+
/* c8 ignore next */
|
|
1450
1450
|
if (!(baseTypeNode as any).isSubtypeOf(topMostBaseTypeNode)) {
|
|
1451
1451
|
throw new Error("wrong type ");
|
|
1452
1452
|
}
|
|
@@ -1523,7 +1523,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1523
1523
|
} else {
|
|
1524
1524
|
nodeId = resolveNodeId(dataType as NodeIdLike);
|
|
1525
1525
|
}
|
|
1526
|
-
/*
|
|
1526
|
+
/* c8 ignore next */
|
|
1527
1527
|
if (nodeId == null || !(nodeId instanceof NodeId)) {
|
|
1528
1528
|
throw new Error("Expecting valid nodeId ");
|
|
1529
1529
|
}
|
|
@@ -1532,7 +1532,7 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1532
1532
|
if (!el) {
|
|
1533
1533
|
// verify that node Id exists in standard type map typeMap
|
|
1534
1534
|
const find = Object.values(typeMap).filter((a) => a === nodeId!.value);
|
|
1535
|
-
/*
|
|
1535
|
+
/* c8 ignore next */
|
|
1536
1536
|
if (find.length !== 1) {
|
|
1537
1537
|
throw new Error(" cannot find " + dataType.toString() + " in typeMap " + typeMapName + " L = " + find.length);
|
|
1538
1538
|
}
|
|
@@ -150,7 +150,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
150
150
|
const name = aggregate.browseName.toString();
|
|
151
151
|
const key = prefix + name;
|
|
152
152
|
|
|
153
|
-
//
|
|
153
|
+
// c8 ignore next
|
|
154
154
|
if (doDebug) {
|
|
155
155
|
debugLog("adding key =", key);
|
|
156
156
|
}
|
|
@@ -171,7 +171,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
171
171
|
|
|
172
172
|
const key = prefix + name;
|
|
173
173
|
|
|
174
|
-
//
|
|
174
|
+
// c8 ignore next
|
|
175
175
|
if (doDebug) {
|
|
176
176
|
debugLog("adding key =", key);
|
|
177
177
|
}
|
|
@@ -215,9 +215,9 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
215
215
|
*/
|
|
216
216
|
#_set_var(varName: string, dataType: DataType, value: unknown, options?: IConditionVariableTypeSetterOptions): void {
|
|
217
217
|
const key = normalizeName(varName);
|
|
218
|
-
//
|
|
218
|
+
// c8 ignore next
|
|
219
219
|
if (!this._map.has(key)) {
|
|
220
|
-
//
|
|
220
|
+
// c8 ignore next
|
|
221
221
|
if (doDebug) {
|
|
222
222
|
debugLog(" cannot find node " + varName);
|
|
223
223
|
debugLog(" map=", [...this._map.keys()].join(" "));
|
|
@@ -747,7 +747,7 @@ export class ConditionSnapshotImpl extends EventEmitter implements ConditionSnap
|
|
|
747
747
|
const key = ConditionSnapshotImpl.normalizeName(varName) + ".Id";
|
|
748
748
|
const variant = this._map.get(key);
|
|
749
749
|
|
|
750
|
-
//
|
|
750
|
+
// c8 ignore next
|
|
751
751
|
if (!variant) {
|
|
752
752
|
return "???";
|
|
753
753
|
// throw new Error("Cannot find TwoStateVariable with name " + varName);
|
|
@@ -254,7 +254,7 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
254
254
|
assert(!branch.getConfirmedState(), "already confirmed ?");
|
|
255
255
|
const conditionEventId = branch.getEventId();
|
|
256
256
|
|
|
257
|
-
//
|
|
257
|
+
// c8 ignore next
|
|
258
258
|
doDebug && debugLog("autoConfirmBranch getAckedState ", branch.getAckedState());
|
|
259
259
|
this._confirm_branch(conditionEventId, comment, branch, "Server/Confirm");
|
|
260
260
|
}
|
|
@@ -48,13 +48,13 @@ export class UAAlarmConditionImpl extends UAAcknowledgeableConditionImpl impleme
|
|
|
48
48
|
assert(Object.prototype.hasOwnProperty.call(options, "inputNode")); // must provide a inputNode
|
|
49
49
|
const alarmConditionType = addressSpace.findEventType(alarmConditionTypeId);
|
|
50
50
|
|
|
51
|
-
/*
|
|
51
|
+
/* c8 ignore next */
|
|
52
52
|
if (!alarmConditionType) {
|
|
53
53
|
throw new Error(" cannot find Alarm Condition Type for " + alarmConditionTypeId);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const alarmConditionTypeBase = addressSpace.findEventType("AlarmConditionType");
|
|
57
|
-
/*
|
|
57
|
+
/* c8 ignore next */
|
|
58
58
|
if (!alarmConditionTypeBase) {
|
|
59
59
|
throw new Error("cannot find AlarmConditionType");
|
|
60
60
|
}
|
|
@@ -88,6 +88,11 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
private _updateAlarm() {
|
|
91
|
+
if (!this.enabledState) {
|
|
92
|
+
warningLog(`expiry alarm ${this.nodeId.toString()} has no enabledState property`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
const expirationDate = this.getExpirationDate();
|
|
92
97
|
|
|
93
98
|
const now = new Date();
|
|
@@ -184,10 +189,19 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
184
189
|
|
|
185
190
|
stopTimer() {
|
|
186
191
|
if (this.timer) {
|
|
187
|
-
|
|
192
|
+
clearTimeout(this.timer);
|
|
188
193
|
this.timer = null;
|
|
189
194
|
}
|
|
190
195
|
}
|
|
196
|
+
|
|
197
|
+
private _startTimer() {
|
|
198
|
+
this.timer = setTimeout(() => {
|
|
199
|
+
if (!this.timer) return;
|
|
200
|
+
this.update();
|
|
201
|
+
this._startTimer();
|
|
202
|
+
}, OneDayDuration / 48);
|
|
203
|
+
}
|
|
204
|
+
|
|
191
205
|
_post_initialize() {
|
|
192
206
|
if (this.expirationLimit) {
|
|
193
207
|
this.expirationLimit.accessLevel = makeAccessLevelExFlag("CurrentRead | CurrentWrite");
|
|
@@ -204,7 +218,7 @@ class UACertificateExpirationAlarmImpl extends UASystemOffNormalAlarmImpl implem
|
|
|
204
218
|
this.addressSpace.registerShutdownTask(() => {
|
|
205
219
|
this.stopTimer();
|
|
206
220
|
});
|
|
207
|
-
this.
|
|
221
|
+
this._startTimer();
|
|
208
222
|
}
|
|
209
223
|
}
|
|
210
224
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
|
-
import { ByteString } from "node-opcua-basic-types";
|
|
8
|
+
import { ByteString, minDate } from "node-opcua-basic-types";
|
|
9
9
|
import { randomGuid } from "node-opcua-basic-types";
|
|
10
10
|
import {
|
|
11
11
|
AttributeIds,
|
|
@@ -193,7 +193,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
193
193
|
}
|
|
194
194
|
private _branch0: ConditionSnapshot = null as any;
|
|
195
195
|
private _previousRetainFlag = false;
|
|
196
|
-
private _branches: Map<string,ConditionSnapshot> = new Map()
|
|
196
|
+
private _branches: Map<string, ConditionSnapshot> = new Map()
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
199
|
* @private
|
|
@@ -237,7 +237,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
237
237
|
public createBranch(): ConditionSnapshot {
|
|
238
238
|
const branchId = _create_new_branch_id();
|
|
239
239
|
const snapshot = new ConditionSnapshotImpl(this, branchId);
|
|
240
|
-
this._branches.set(branchId.toString(),snapshot);
|
|
240
|
+
this._branches.set(branchId.toString(), snapshot);
|
|
241
241
|
return snapshot;
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -254,6 +254,18 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
254
254
|
/**
|
|
255
255
|
*/
|
|
256
256
|
public getEnabledState(): boolean {
|
|
257
|
+
if (!this.enabledState) {
|
|
258
|
+
// ua variable is missing
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
if (typeof this.enabledState.getValue !== "function") {
|
|
262
|
+
// the enabledState is not initialized yet, probably because the addressSpace is not fully initialized
|
|
263
|
+
// try the id that contains the flag status as a boolean DataValue
|
|
264
|
+
if (!this.enabledState.id) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return this.enabledState.id.readValue().value.value as boolean;
|
|
268
|
+
}
|
|
257
269
|
return this.enabledState.getValue();
|
|
258
270
|
}
|
|
259
271
|
|
|
@@ -468,13 +480,21 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
468
480
|
assert(selfConditionType.isSubtypeOf(conditionType));
|
|
469
481
|
|
|
470
482
|
const branch = this.currentBranch();
|
|
471
|
-
|
|
483
|
+
if (!branch) {
|
|
484
|
+
warningLog(
|
|
485
|
+
"UACondition#raiseNewCondition currentBranch is not defined for node ",
|
|
486
|
+
fullPath2(this)
|
|
487
|
+
);
|
|
488
|
+
throw new Error("UACondition#raiseNewCondition currentBranch is not defined");
|
|
489
|
+
}
|
|
472
490
|
const currentDefaultDate = new Date();
|
|
473
491
|
const time = conditionInfo.time || currentDefaultDate;
|
|
474
492
|
const receiveTime = conditionInfo.receiveTime || currentDefaultDate;
|
|
475
493
|
// install the eventTimestamp
|
|
476
494
|
// set the received Time
|
|
477
|
-
|
|
495
|
+
|
|
496
|
+
branch.setTime(time || minDate);
|
|
497
|
+
|
|
478
498
|
branch.setReceiveTime(receiveTime);
|
|
479
499
|
|
|
480
500
|
// note : in 1.04 LocalTime property is optional
|
|
@@ -607,12 +627,12 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
607
627
|
// xx }
|
|
608
628
|
}
|
|
609
629
|
|
|
610
|
-
public findBranchForEventId(eventId: Buffer| null): ConditionSnapshot | null {
|
|
630
|
+
public findBranchForEventId(eventId: Buffer | null): ConditionSnapshot | null {
|
|
611
631
|
if (sameBuffer(this.eventId!.readValue().value.value, eventId)) {
|
|
612
632
|
return this.currentBranch();
|
|
613
633
|
}
|
|
614
634
|
const e = [...this._branches.values()]
|
|
615
|
-
|
|
635
|
+
.filter((branch: ConditionSnapshot) => sameBuffer(branch.getEventId(), eventId));
|
|
616
636
|
if (e.length === 1) {
|
|
617
637
|
return e[0];
|
|
618
638
|
}
|
|
@@ -662,7 +682,7 @@ function UACondition_instantiate(
|
|
|
662
682
|
|
|
663
683
|
const conditionType = addressSpace.findEventType(conditionTypeId);
|
|
664
684
|
|
|
665
|
-
/*
|
|
685
|
+
/* c8 ignore next */
|
|
666
686
|
if (!conditionType) {
|
|
667
687
|
throw new Error(" cannot find Condition Type for " + conditionTypeId);
|
|
668
688
|
}
|
|
@@ -671,7 +691,7 @@ function UACondition_instantiate(
|
|
|
671
691
|
assert(!conditionType.isAbstract, "Cannot instantiate abstract conditionType");
|
|
672
692
|
|
|
673
693
|
const baseConditionEventType = addressSpace.findEventType("ConditionType");
|
|
674
|
-
/*
|
|
694
|
+
/* c8 ignore next */
|
|
675
695
|
if (!baseConditionEventType) {
|
|
676
696
|
throw new Error("cannot find ConditionType");
|
|
677
697
|
}
|
|
@@ -780,7 +800,7 @@ function UACondition_instantiate(
|
|
|
780
800
|
// check that Variant DataType is compatible with the UAVariable dataType
|
|
781
801
|
// xx var nodeDataType = addressSpace.findNode(varNode.dataType).browseName;
|
|
782
802
|
|
|
783
|
-
/*
|
|
803
|
+
/* c8 ignore next */
|
|
784
804
|
if (!varNode._validate_DataType(variant.dataType)) {
|
|
785
805
|
throw new Error(" Invalid variant dataType " + variant + " " + varNode.browseName.toString());
|
|
786
806
|
}
|
|
@@ -845,14 +865,14 @@ function UACondition_instantiate(
|
|
|
845
865
|
// Types. The Server Object shall be the root of this hierarchy.
|
|
846
866
|
if (!sameNodeId(conditionSourceNode.nodeId, coerceNodeId("ns=0;i=2253"))) {
|
|
847
867
|
// server object
|
|
848
|
-
/*
|
|
868
|
+
/* c8 ignore next */
|
|
849
869
|
if (conditionSourceNode.getEventSourceOfs().length === 0) {
|
|
850
870
|
errorLog("conditionSourceNode = ", conditionSourceNode.browseName.toString());
|
|
851
871
|
errorLog("conditionSourceNode = ", conditionSourceNode.nodeId.toString());
|
|
852
872
|
throw new Error(
|
|
853
873
|
"conditionSourceNode must be an event source " +
|
|
854
|
-
|
|
855
|
-
|
|
874
|
+
conditionSourceNode.browseName.toString() +
|
|
875
|
+
conditionSourceNode.nodeId.toString()
|
|
856
876
|
);
|
|
857
877
|
}
|
|
858
878
|
}
|
|
@@ -980,7 +1000,7 @@ function _disable_method(inputArguments: VariantLike[], context: ISessionContext
|
|
|
980
1000
|
const conditionNode = context.object;
|
|
981
1001
|
assert(conditionNode);
|
|
982
1002
|
|
|
983
|
-
//
|
|
1003
|
+
// c8 ignore next
|
|
984
1004
|
if (!(conditionNode instanceof UAConditionImpl)) {
|
|
985
1005
|
debugLog("conditionNode is not a UACondition ", conditionNode?.toString());
|
|
986
1006
|
return callback(null, {
|
|
@@ -1017,7 +1037,7 @@ function _condition_refresh_method(
|
|
|
1017
1037
|
// arguments : IntegerId SubscriptionId
|
|
1018
1038
|
assert(inputArguments.length === 1);
|
|
1019
1039
|
const addressSpace = context.object!.addressSpace as AddressSpacePrivate;
|
|
1020
|
-
//
|
|
1040
|
+
// c8 ignore next
|
|
1021
1041
|
if (doDebug) {
|
|
1022
1042
|
debugLog(chalk.red(" ConditionType.ConditionRefresh ! subscriptionId ="), inputArguments[0].toString());
|
|
1023
1043
|
}
|
|
@@ -1043,7 +1063,7 @@ function _perform_condition_refresh(addressSpace: AddressSpacePrivate, inputArgu
|
|
|
1043
1063
|
// that owns the Subscription
|
|
1044
1064
|
//
|
|
1045
1065
|
|
|
1046
|
-
//
|
|
1066
|
+
// c8 ignore next
|
|
1047
1067
|
if (addressSpace._condition_refresh_in_progress) {
|
|
1048
1068
|
// a refresh operation is already in progress....
|
|
1049
1069
|
return StatusCodes.BadRefreshInProgress;
|
|
@@ -1083,7 +1103,7 @@ function _condition_refresh2_method(
|
|
|
1083
1103
|
}
|
|
1084
1104
|
const addressSpace = context.object.addressSpace as AddressSpacePrivate;
|
|
1085
1105
|
|
|
1086
|
-
//
|
|
1106
|
+
// c8 ignore next
|
|
1087
1107
|
if (doDebug) {
|
|
1088
1108
|
debugLog(chalk.cyan.bgWhite(" ConditionType.conditionRefresh2 !"));
|
|
1089
1109
|
}
|
|
@@ -1208,7 +1228,7 @@ function _getCompositeKey(node: BaseNode, key: string): UAVariableImpl {
|
|
|
1208
1228
|
let cur = node as any;
|
|
1209
1229
|
const elements = key.split(".");
|
|
1210
1230
|
for (const e of elements) {
|
|
1211
|
-
//
|
|
1231
|
+
// c8 ignore next
|
|
1212
1232
|
if (!Object.prototype.hasOwnProperty.call(cur, e)) {
|
|
1213
1233
|
throw new Error(" cannot extract '" + key + "' from " + node.browseName.toString());
|
|
1214
1234
|
}
|
|
@@ -24,7 +24,7 @@ export class UADiscreteAlarmImpl extends UAAlarmConditionImpl implements UADiscr
|
|
|
24
24
|
const addressSpace = namespace.addressSpace;
|
|
25
25
|
|
|
26
26
|
const discreteAlarmType = addressSpace.findEventType(discreteAlarmTypeId);
|
|
27
|
-
/*
|
|
27
|
+
/* c8 ignore next */
|
|
28
28
|
if (!discreteAlarmType) {
|
|
29
29
|
throw new Error(" cannot find Condition Type for " + discreteAlarmType);
|
|
30
30
|
}
|
|
@@ -33,7 +33,7 @@ export class UADiscreteAlarmImpl extends UAAlarmConditionImpl implements UADiscr
|
|
|
33
33
|
assert(discreteAlarmTypeBase, "expecting DiscreteAlarmType - please check you nodeset xml file!");
|
|
34
34
|
|
|
35
35
|
/* eventTypeNode should be subtypeOf("DiscreteAlarmType"); */
|
|
36
|
-
/*
|
|
36
|
+
/* c8 ignore next */
|
|
37
37
|
if (!discreteAlarmType.isSubtypeOf(discreteAlarmTypeBase as any)) {
|
|
38
38
|
throw new Error("UADiscreteAlarm.instantiate : event found is not subType of DiscreteAlarmType");
|
|
39
39
|
}
|
|
@@ -42,7 +42,7 @@ export class UAExclusiveDeviationAlarmImpl extends UAExclusiveLimitAlarmImpl imp
|
|
|
42
42
|
const addressSpace = namespace.addressSpace;
|
|
43
43
|
|
|
44
44
|
const exclusiveDeviationAlarmType = addressSpace.findEventType("ExclusiveDeviationAlarmType");
|
|
45
|
-
/*
|
|
45
|
+
/* c8 ignore next */
|
|
46
46
|
if (!exclusiveDeviationAlarmType) {
|
|
47
47
|
throw new Error("cannot find ExclusiveDeviationAlarmType");
|
|
48
48
|
}
|
|
@@ -37,13 +37,13 @@ export class UAExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UAExc
|
|
|
37
37
|
|
|
38
38
|
const exclusiveAlarmType = addressSpace.findEventType(type);
|
|
39
39
|
|
|
40
|
-
/*
|
|
40
|
+
/* c8 ignore next */
|
|
41
41
|
if (!exclusiveAlarmType) {
|
|
42
42
|
throw new Error(" cannot find Alarm Condition Type for " + type);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const exclusiveLimitAlarmType = addressSpace.findEventType("ExclusiveLimitAlarmType");
|
|
46
|
-
/*
|
|
46
|
+
/* c8 ignore next */
|
|
47
47
|
if (!exclusiveLimitAlarmType) {
|
|
48
48
|
throw new Error("cannot find ExclusiveLimitAlarmType");
|
|
49
49
|
}
|
|
@@ -38,7 +38,7 @@ export class UANonExclusiveDeviationAlarmImpl extends UANonExclusiveLimitAlarmIm
|
|
|
38
38
|
const addressSpace = namespace.addressSpace;
|
|
39
39
|
|
|
40
40
|
const nonExclusiveDeviationAlarmType = addressSpace.findEventType("NonExclusiveDeviationAlarmType");
|
|
41
|
-
/*
|
|
41
|
+
/* c8 ignore next */
|
|
42
42
|
if (!nonExclusiveDeviationAlarmType) {
|
|
43
43
|
throw new Error("cannot find ExclusiveDeviationAlarmType");
|
|
44
44
|
}
|
|
@@ -48,13 +48,13 @@ export class UANonExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UA
|
|
|
48
48
|
}
|
|
49
49
|
const nonExclusiveAlarmType = addressSpace.findEventType(type);
|
|
50
50
|
|
|
51
|
-
/*
|
|
51
|
+
/* c8 ignore next */
|
|
52
52
|
if (!nonExclusiveAlarmType) {
|
|
53
53
|
throw new Error(" cannot find Alarm Condition Type for " + type);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const nonExclusiveLimitAlarmType = addressSpace.findEventType("NonExclusiveLimitAlarmType");
|
|
57
|
-
/*
|
|
57
|
+
/* c8 ignore next */
|
|
58
58
|
if (!nonExclusiveLimitAlarmType) {
|
|
59
59
|
throw new Error("cannot find NonExclusiveLimitAlarmType");
|
|
60
60
|
}
|
|
@@ -63,7 +63,7 @@ export class UAOffNormalAlarmImpl extends UADiscreteAlarmImpl implements UAOffNo
|
|
|
63
63
|
const addressSpace = namespace.addressSpace as AddressSpacePrivate;
|
|
64
64
|
|
|
65
65
|
const offNormalAlarmType = addressSpace.findEventType("OffNormalAlarmType");
|
|
66
|
-
/*
|
|
66
|
+
/* c8 ignore next */
|
|
67
67
|
if (!offNormalAlarmType) {
|
|
68
68
|
throw new Error("cannot find offNormalAlarmType");
|
|
69
69
|
}
|