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.
Files changed (151) hide show
  1. package/dist/source/helpers/adjust_browse_direction.js +1 -1
  2. package/dist/source/helpers/adjust_browse_direction.js.map +1 -1
  3. package/dist/source/helpers/argument_list.js +8 -8
  4. package/dist/source/helpers/argument_list.js.map +1 -1
  5. package/dist/source/helpers/dump_tools.js +1 -1
  6. package/dist/source/helpers/dump_tools.js.map +1 -1
  7. package/dist/source/loader/decode_xml_extension_object.js +3 -3
  8. package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
  9. package/dist/source/loader/load_nodeset2.js +7 -7
  10. package/dist/source/loader/load_nodeset2.js.map +1 -1
  11. package/dist/source/loader/make_xml_extension_object_parser.js +3 -3
  12. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  13. package/dist/source/loader/namespace_post_step.js +1 -1
  14. package/dist/source/loader/namespace_post_step.js.map +1 -1
  15. package/dist/source/loader/parsers/extension_object_parser.js +1 -1
  16. package/dist/source/loader/parsers/extension_object_parser.js.map +1 -1
  17. package/dist/source/pseudo_session.js +1 -1
  18. package/dist/source/pseudo_session.js.map +1 -1
  19. package/dist/source/set_namespace_meta_data.js +3 -3
  20. package/dist/source/set_namespace_meta_data.js.map +1 -1
  21. package/dist/src/_instantiate_helpers.js +1 -1
  22. package/dist/src/_instantiate_helpers.js.map +1 -1
  23. package/dist/src/_mandatory_child_or_requested_optional_filter.js +3 -3
  24. package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
  25. package/dist/src/address_space.js +27 -27
  26. package/dist/src/address_space.js.map +1 -1
  27. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +5 -5
  28. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  29. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -1
  30. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  31. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +2 -2
  32. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  33. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +1 -0
  34. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +14 -2
  35. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  36. package/dist/src/alarms_and_conditions/ua_condition_impl.js +31 -14
  37. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  38. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +2 -2
  39. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
  40. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +1 -1
  41. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -1
  42. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +2 -2
  43. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
  44. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +1 -1
  45. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -1
  46. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +2 -2
  47. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
  48. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +1 -1
  49. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
  50. package/dist/src/base_node_impl.js +20 -20
  51. package/dist/src/base_node_impl.js.map +1 -1
  52. package/dist/src/base_node_private.js +20 -20
  53. package/dist/src/base_node_private.js.map +1 -1
  54. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +1 -1
  55. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
  56. package/dist/src/data_access/ua_two_state_discrete_impl.js +2 -2
  57. package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
  58. package/dist/src/extension_object_array_node.js +7 -7
  59. package/dist/src/extension_object_array_node.js.map +1 -1
  60. package/dist/src/historical_access/address_space_historical_data_node.js +7 -2
  61. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
  62. package/dist/src/namespace_impl.js +18 -18
  63. package/dist/src/namespace_impl.js.map +1 -1
  64. package/dist/src/nodeid_manager.js +1 -1
  65. package/dist/src/nodeid_manager.js.map +1 -1
  66. package/dist/src/nodeset_tools/construct_namespace_dependency.js +4 -4
  67. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  68. package/dist/src/nodeset_tools/dump_to_bsd.js +2 -2
  69. package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
  70. package/dist/src/nodeset_tools/nodeset_to_xml.js +5 -5
  71. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  72. package/dist/src/state_machine/finite_state_machine.js +13 -13
  73. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  74. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +4 -4
  75. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
  76. package/dist/src/state_machine/ua_two_state_variable.js +1 -1
  77. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  78. package/dist/src/tool_isSubtypeOf.js +1 -1
  79. package/dist/src/tool_isSubtypeOf.js.map +1 -1
  80. package/dist/src/ua_data_type_impl.js +2 -0
  81. package/dist/src/ua_data_type_impl.js.map +1 -1
  82. package/dist/src/ua_method_impl.js +2 -2
  83. package/dist/src/ua_method_impl.js.map +1 -1
  84. package/dist/src/ua_object_impl.js +2 -2
  85. package/dist/src/ua_object_impl.js.map +1 -1
  86. package/dist/src/ua_variable_impl.js +33 -19
  87. package/dist/src/ua_variable_impl.js.map +1 -1
  88. package/dist/src/ua_variable_impl_ext_obj.js +15 -15
  89. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  90. package/dist/src/ua_variable_type_impl.js +2 -2
  91. package/dist/src/ua_variable_type_impl.js.map +1 -1
  92. package/dist/src/validate_data_type_correctness.js +7 -7
  93. package/dist/src/validate_data_type_correctness.js.map +1 -1
  94. package/dist/tsconfig_base.tsbuildinfo +1 -1
  95. package/distHelpers/boiler_system.js +2 -2
  96. package/distHelpers/boiler_system.js.map +1 -1
  97. package/distHelpers/get_address_space_fixture.js +2 -2
  98. package/distHelpers/get_address_space_fixture.js.map +1 -1
  99. package/distHelpers/mock_session.d.ts +1 -0
  100. package/distHelpers/mock_session.js +3 -0
  101. package/distHelpers/mock_session.js.map +1 -1
  102. package/distNodeJS/generate_address_space.js +1 -1
  103. package/distNodeJS/generate_address_space.js.map +1 -1
  104. package/package.json +38 -38
  105. package/source/helpers/adjust_browse_direction.ts +1 -1
  106. package/source/helpers/argument_list.ts +8 -8
  107. package/source/helpers/dump_tools.ts +1 -1
  108. package/source/loader/decode_xml_extension_object.ts +3 -3
  109. package/source/loader/load_nodeset2.ts +7 -7
  110. package/source/loader/make_xml_extension_object_parser.ts +3 -3
  111. package/source/loader/namespace_post_step.ts +1 -1
  112. package/source/loader/parsers/extension_object_parser.ts +1 -1
  113. package/source/pseudo_session.ts +1 -1
  114. package/source/set_namespace_meta_data.ts +3 -3
  115. package/source_nodejs/generate_address_space.ts +1 -1
  116. package/src/_instantiate_helpers.ts +1 -1
  117. package/src/_mandatory_child_or_requested_optional_filter.ts +3 -3
  118. package/src/address_space.ts +27 -27
  119. package/src/alarms_and_conditions/condition_snapshot_impl.ts +5 -5
  120. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +1 -1
  121. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +2 -2
  122. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +16 -2
  123. package/src/alarms_and_conditions/ua_condition_impl.ts +38 -18
  124. package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +2 -2
  125. package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +1 -1
  126. package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +2 -2
  127. package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +1 -1
  128. package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +2 -2
  129. package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +1 -1
  130. package/src/base_node_impl.ts +20 -20
  131. package/src/base_node_private.ts +20 -20
  132. package/src/data_access/ua_multistate_value_discrete_impl.ts +1 -1
  133. package/src/data_access/ua_two_state_discrete_impl.ts +6 -4
  134. package/src/extension_object_array_node.ts +7 -7
  135. package/src/historical_access/address_space_historical_data_node.ts +9 -4
  136. package/src/namespace_impl.ts +18 -18
  137. package/src/nodeid_manager.ts +1 -1
  138. package/src/nodeset_tools/construct_namespace_dependency.ts +4 -4
  139. package/src/nodeset_tools/dump_to_bsd.ts +2 -2
  140. package/src/nodeset_tools/nodeset_to_xml.ts +5 -5
  141. package/src/state_machine/finite_state_machine.ts +13 -13
  142. package/src/state_machine/ua_shelving_state_machine_ex.ts +4 -4
  143. package/src/state_machine/ua_two_state_variable.ts +1 -1
  144. package/src/tool_isSubtypeOf.ts +1 -1
  145. package/src/ua_data_type_impl.ts +2 -0
  146. package/src/ua_method_impl.ts +2 -2
  147. package/src/ua_object_impl.ts +2 -2
  148. package/src/ua_variable_impl.ts +56 -40
  149. package/src/ua_variable_impl_ext_obj.ts +17 -16
  150. package/src/ua_variable_type_impl.ts +2 -2
  151. package/src/validate_data_type_correctness.ts +7 -7
@@ -167,7 +167,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
167
167
 
168
168
  public get addressSpace(): IAddressSpace {
169
169
  const _private = BaseNode_getPrivate(this);
170
- // istanbul ignore next
170
+ // c8 ignore next
171
171
  if (!_private) {
172
172
  throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
173
173
  }
@@ -176,7 +176,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
176
176
 
177
177
  protected get addressSpacePrivate(): AddressSpacePrivate {
178
178
  const _private = BaseNode_getPrivate(this);
179
- // istanbul ignore next
179
+ // c8 ignore next
180
180
  if (!_private) {
181
181
  throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
182
182
  }
@@ -445,7 +445,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
445
445
  if (_cache._ref.has(hash)) {
446
446
  return _cache._ref.get(hash)!;
447
447
  }
448
- // istanbul ignore next
448
+ // c8 ignore next
449
449
  if (doDebug && !this.addressSpace.findReferenceType(referenceTypeNode.nodeId)) {
450
450
  throw new Error("expecting valid reference name " + referenceType);
451
451
  }
@@ -711,7 +711,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
711
711
  if (this.parentNodeId) {
712
712
  const parent = this.addressSpace.findNode(this.parentNodeId) as BaseNode;
713
713
 
714
- // istanbul ignore else
714
+ // c8 ignore next
715
715
  if (parent) {
716
716
  return parent.fullName() + "." + this.browseName.toString() + "";
717
717
  } else {
@@ -796,7 +796,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
796
796
 
797
797
  const obj = resolveReferenceNode(this.addressSpace, reference);
798
798
 
799
- // istanbul ignore next
799
+ // c8 ignore next
800
800
  if (!obj) {
801
801
  throw new Error(" cannot find node with id " + reference.nodeId.toString());
802
802
  }
@@ -850,7 +850,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
850
850
  // get all possible references
851
851
  let references = this.allReferences();
852
852
 
853
- /* istanbul ignore next */
853
+ /* c8 ignore next */
854
854
  if (do_debug) {
855
855
  debugLog("all references :", this.nodeId.toString(), this.browseName.toString());
856
856
  dumpReferences(addressSpace, _private._referenceIdx.values());
@@ -870,7 +870,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
870
870
  }
871
871
  const referenceDescriptions = _constructReferenceDescription(addressSpace, references, browseDescription.resultMask);
872
872
 
873
- /* istanbul ignore next */
873
+ /* c8 ignore next */
874
874
  if (do_debug) {
875
875
  dumpReferenceDescriptions(this.addressSpace, referenceDescriptions);
876
876
  }
@@ -1004,14 +1004,14 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
1004
1004
 
1005
1005
  const name = lowerFirstLetter(childNode.browseName.name!.toString());
1006
1006
  if (Object.prototype.hasOwnProperty.call(reservedNames, name)) {
1007
- // istanbul ignore next
1007
+ // c8 ignore next
1008
1008
  if (doDebug) {
1009
1009
  // tslint:disable-next-line:no-console
1010
1010
  debugLog(chalk.bgWhite.red("Ignoring reserved keyword " + name));
1011
1011
  }
1012
1012
  return;
1013
1013
  }
1014
- /* istanbul ignore next */
1014
+ /* c8 ignore next */
1015
1015
  if (!Object.prototype.hasOwnProperty.call(this, name)) {
1016
1016
  return;
1017
1017
  }
@@ -1170,7 +1170,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
1170
1170
  return !this.addressSpacePrivate;
1171
1171
  }
1172
1172
 
1173
- // istanbul ignore next
1173
+ // c8 ignore next
1174
1174
  public dumpXML(xmlWriter: XmlWriter): void {
1175
1175
  console.error(" This ", (NodeClass as any)[this.nodeClass]);
1176
1176
  assert(false, "BaseNode#dumpXML NOT IMPLEMENTED !");
@@ -1189,7 +1189,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
1189
1189
  // filter out non Hierarchical References
1190
1190
  const referenceType = resolveReferenceType(addressSpace, reference);
1191
1191
 
1192
- // istanbul ignore next
1192
+ // c8 ignore next
1193
1193
  if (!referenceType) {
1194
1194
  console.error(chalk.red(" ERROR"), " cannot find reference ", reference.referenceType, reference.toString());
1195
1195
  }
@@ -1262,7 +1262,7 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
1262
1262
  let result: UAReferenceType;
1263
1263
  if (typeof referenceType === "string") {
1264
1264
  result = this.addressSpace.findReferenceType(referenceType)!;
1265
- /* istanbul ignore next */
1265
+ /* c8 ignore next */
1266
1266
  if (!result) {
1267
1267
  errorLog("referenceType ", referenceType, " cannot be found");
1268
1268
  throw new Error("Cannot coerce reference with name " + referenceType);
@@ -1497,7 +1497,7 @@ function _setup_parent_item(this: BaseNode, referencesMap: Map<string, UAReferen
1497
1497
  references = this.findReferencesEx("Aggregates", BrowseDirection.Inverse);
1498
1498
 
1499
1499
  if (references.length >= 1) {
1500
- // istanbul ignore next
1500
+ // c8 ignore next
1501
1501
  if (references.length > 1) {
1502
1502
  if (displayWarning) {
1503
1503
  const options = { addressSpace };
@@ -1519,7 +1519,7 @@ function _setup_parent_item(this: BaseNode, referencesMap: Map<string, UAReferen
1519
1519
 
1520
1520
  function toObject(addressSpace: IAddressSpace, reference: UAReference): BaseNode {
1521
1521
  const obj = resolveReferenceNode(addressSpace, reference);
1522
- // istanbul ignore next
1522
+ // c8 ignore next
1523
1523
  if (doDebug && !obj) {
1524
1524
  debugLog(
1525
1525
  chalk.red(" Warning : object with nodeId ") +
@@ -1603,7 +1603,7 @@ function _propagate_ref(this: BaseNode, addressSpace: MinimalistAddressSpace, re
1603
1603
  // filter out non Hierarchical References
1604
1604
  const referenceType = ReferenceImpl.resolveReferenceType(addressSpace, reference);
1605
1605
 
1606
- // istanbul ignore next
1606
+ // c8 ignore next
1607
1607
  if (!referenceType) {
1608
1608
  errorLog(chalk.red(" ERROR"), " cannot find reference ", reference.referenceType, reference.toString());
1609
1609
  }
@@ -1622,7 +1622,7 @@ function _propagate_ref(this: BaseNode, addressSpace: MinimalistAddressSpace, re
1622
1622
  if (related_node) {
1623
1623
  // verify that reference doesn't point to object it this (see mantis 3099)
1624
1624
  if (sameNodeId(reference.nodeId, this.nodeId)) {
1625
- // istanbul ignore next
1625
+ // c8 ignore next
1626
1626
  if (displayWarningReferencePointingToItSelf) {
1627
1627
  // this could happen with method
1628
1628
  warningLog(" Warning: a Reference is pointing to source ", this.nodeId.toString(), this.browseName.toString(), ". Is this intentional ?");
@@ -1687,7 +1687,7 @@ function _filter_by_referenceType(
1687
1687
  assert(referenceTypeId instanceof NodeId);
1688
1688
  const referenceType = this.addressSpace.findNode(referenceTypeId) as UAReferenceType;
1689
1689
  dumpIf(!referenceType, referenceTypeId);
1690
- // istanbul ignore next
1690
+ // c8 ignore next
1691
1691
  if (!referenceType || referenceType.nodeClass !== NodeClass.ReferenceType) {
1692
1692
  throw new Error("Cannot find reference type");
1693
1693
  }
@@ -1698,7 +1698,7 @@ function _filter_by_referenceType(
1698
1698
 
1699
1699
  references = references.filter((reference) => {
1700
1700
  const ref = resolveReferenceType(this.addressSpace, reference)!;
1701
- // istanbul ignore next
1701
+ // c8 ignore next
1702
1702
  if (!ref) {
1703
1703
  throw new Error("Cannot find reference type " + reference.toString());
1704
1704
  }
@@ -1775,13 +1775,13 @@ function _filter_by_userFilter(this: BaseNode, references: UAReference[], contex
1775
1775
  const addressSpace = this.addressSpace;
1776
1776
  return references.filter((reference: UAReference) => {
1777
1777
  const obj = resolveReferenceNode(addressSpace, reference) as BaseNode;
1778
- // istanbul ignore next
1778
+ // c8 ignore next
1779
1779
  if (!obj) {
1780
1780
  return false;
1781
1781
  }
1782
1782
 
1783
1783
  const _private = BaseNode_getPrivate(obj);
1784
- // istanbul ignore next
1784
+ // c8 ignore next
1785
1785
  if (!_private._browseFilter) {
1786
1786
  throw Error("Internal error : cannot find browseFilter");
1787
1787
  }
@@ -506,7 +506,7 @@ function _clone_children_on_template(
506
506
  : null;
507
507
  if (!nodeToCloneTypeDefinition) return;
508
508
 
509
- // istanbul ignore next
509
+ // c8 ignore next
510
510
  doTrace &&
511
511
  traceLog(
512
512
  extraInfo?.pad(),
@@ -533,7 +533,7 @@ function _clone_children_on_template(
533
533
 
534
534
  let typeDefinitionNode: UAVariableType | UAObjectType | null = nodeToCloneTypeDefinition;
535
535
  while (typeDefinitionNode) {
536
- // istanbul ignore next
536
+ // c8 ignore next
537
537
  doTrace &&
538
538
  traceLog(
539
539
  extraInfo?.pad(),
@@ -564,7 +564,7 @@ function _clone_children_on_template(
564
564
  const hasAlready = newParentChild.getChildByName(grandChild.browseName) !== null;
565
565
  if (!hasAlready) {
566
566
  if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
567
- // istanbul ignore next
567
+ // c8 ignore next
568
568
  doTrace &&
569
569
  traceLog(
570
570
  extraInfo.pad(),
@@ -635,7 +635,7 @@ function _clone_collection_new(
635
635
  // ensure node is of the correct type,
636
636
  // it may happen that the xml nodeset2 file was malformed
637
637
 
638
- // istanbul ignore next
638
+ // c8 ignore next
639
639
  if (typeof (node as any).clone !== "function") {
640
640
  // tslint:disable-next-line:no-console
641
641
  warningLog(
@@ -649,14 +649,14 @@ function _clone_collection_new(
649
649
  continue;
650
650
  }
651
651
  if (node && !node.modellingRule) {
652
- // istanbul ignore next
652
+ // c8 ignore next
653
653
  doTrace && traceLog(extraInfo.pad(), "skipping with no modelling rule", fullPath2(node));
654
654
  // those node stays in the Type
655
655
  continue; // skip this node
656
656
  }
657
657
 
658
658
  if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
659
- // istanbul ignore next
659
+ // c8 ignore next
660
660
  doTrace && traceLog(extraInfo.pad(), "skipping optional that doesn't appear in the filter", fullPath2(node));
661
661
  continue; // skip this node
662
662
  }
@@ -687,7 +687,7 @@ function _clone_collection_new(
687
687
 
688
688
  const alreadyCloned = extraInfo.getCloned({ originalParent: nodeToClone, clonedParent: newParent, originalNode: node });
689
689
  if (alreadyCloned) {
690
- // istanbul ignore next
690
+ // c8 ignore next
691
691
  doTrace &&
692
692
  traceLog(
693
693
  extraInfo.pad(),
@@ -710,11 +710,11 @@ function _clone_collection_new(
710
710
  nodeId: newParent.nodeId
711
711
  });
712
712
  } else {
713
- // istanbul ignore next
713
+ // c8 ignore next
714
714
  doTrace && traceLog(extraInfo.pad(), "reference to node ", fullPath2(alreadyCloned), " already exists !");
715
715
  }
716
716
  } else {
717
- // istanbul ignore next
717
+ // c8 ignore next
718
718
  doTrace &&
719
719
  traceLog(
720
720
  extraInfo.pad(),
@@ -729,7 +729,7 @@ function _clone_collection_new(
729
729
  const clonedNode = node.clone(options, optionalFilter, extraInfo);
730
730
  extraInfo.level -= 1;
731
731
 
732
- // istanbul ignore next
732
+ // c8 ignore next
733
733
  doTrace &&
734
734
  traceLog(
735
735
  extraInfo.pad(),
@@ -794,7 +794,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
794
794
 
795
795
  const baseInterfaces: UAInterface[] = [];
796
796
  for (const iface of interfaces) {
797
- // istanbul ignore next
797
+ // c8 ignore next
798
798
  doTrace &&
799
799
  traceLog(
800
800
  extraInfo.pad(),
@@ -811,7 +811,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
811
811
  }
812
812
  interfaces.push(...baseInterfaces);
813
813
  if (typeDefinitionNode.subtypeOfObj) {
814
- // istanbul ignore next
814
+ // c8 ignore next
815
815
  doTrace &&
816
816
  traceLog(
817
817
  extraInfo.pad(),
@@ -825,7 +825,7 @@ function _extractInterfaces2(typeDefinitionNode: UAObjectType | UAVariableType,
825
825
  }
826
826
  const deduplicatedInterfaces = [...new Set(interfaces)];
827
827
 
828
- // istanbul ignore next
828
+ // c8 ignore next
829
829
  doTrace &&
830
830
  deduplicatedInterfaces.length &&
831
831
  traceLog(
@@ -845,7 +845,7 @@ function _cloneInterface(
845
845
  extraInfo: CloneExtraInfo,
846
846
  browseNameMap: Set<string>
847
847
  ): void {
848
- // istanbul ignore next
848
+ // c8 ignore next
849
849
  doTrace &&
850
850
  traceLog(
851
851
  extraInfo?.pad(),
@@ -864,14 +864,14 @@ function _cloneInterface(
864
864
  }
865
865
  const interfaces = _extractInterfaces2(typeDefinitionNode, extraInfo);
866
866
  if (interfaces.length === 0) {
867
- // istanbul ignore next
867
+ // c8 ignore next
868
868
  doTrace &&
869
869
  false &&
870
870
  traceLog(extraInfo.pad(), chalk.yellow("No interface for ", node.browseName.toString(), node.nodeId.toString()));
871
871
  return;
872
872
  }
873
873
 
874
- // istanbul ignore next
874
+ // c8 ignore next
875
875
  doTrace && traceLog(extraInfo?.pad(), chalk.green("-------------------- interfaces are ", interfaces.length));
876
876
 
877
877
  const localFilter = optionalFilter.filterFor(node);
@@ -879,7 +879,7 @@ function _cloneInterface(
879
879
  for (const iface of interfaces) {
880
880
  const aggregates = iface.findReferencesEx("Aggregates", BrowseDirection.Forward);
881
881
  if (aggregates.length === 0) continue;
882
- // istanbul ignore next
882
+ // c8 ignore next
883
883
  doTrace &&
884
884
  traceLog(
885
885
  extraInfo.pad(),
@@ -1043,7 +1043,7 @@ export function _clone<T extends UAObject | UAVariable | UAMethod>(
1043
1043
  });
1044
1044
 
1045
1045
  while (typeDefinitionNode) {
1046
- // istanbul ignore next
1046
+ // c8 ignore next
1047
1047
  doTrace &&
1048
1048
  traceLog(
1049
1049
  extraInfo?.pad(),
@@ -1227,14 +1227,14 @@ export function BaseNode_add_backward_reference(this: BaseNodeImpl, reference: U
1227
1227
  const _private = BaseNode_getPrivate(this);
1228
1228
  const h = (<ReferenceImpl>reference).hash;
1229
1229
  assert(typeof h === "string");
1230
- // istanbul ignore next
1230
+ // c8 ignore next
1231
1231
  if (_private._referenceIdx.has(h)) {
1232
1232
  // the reference exists already in the forward references
1233
1233
  // this append for instance when the XML NotSetFile has redundant <UAReference>
1234
1234
  // in this case there is nothing to do
1235
1235
  return;
1236
1236
  }
1237
- // istanbul ignore next
1237
+ // c8 ignore next
1238
1238
  if (_private._back_referenceIdx.has(h)) {
1239
1239
  const opts = { addressSpace: this.addressSpace };
1240
1240
  warningLog(" Warning !", this.browseName.toString());
@@ -216,7 +216,7 @@ export class UAMultiStateValueDiscreteImpl<T, DT extends DataType>
216
216
  // MultiStateValueDiscrete Variables can have any numeric Data Type;
217
217
  // this includes signed and unsigned integers from 8 to 64 Bit length.
218
218
 
219
- // istanbul ignore next
219
+ // c8 ignore next
220
220
  validateIsNumericDataType(this.dataType.value);
221
221
 
222
222
  // find the enum value type
@@ -38,10 +38,11 @@ export class UATwoStateDiscreteImpl extends UAVariableImpl implements UATwoState
38
38
  const handler = this.handle_semantic_changed.bind(this);
39
39
 
40
40
  const falseState = this.getPropertyByName("FalseState");
41
- /* istanbul ignore else */
42
41
  if (falseState) {
43
42
  falseState.on("value_changed", handler);
44
- } else {
43
+ }
44
+ /* c8 ignore next */
45
+ else {
45
46
  console.warn(
46
47
  "warning: UATwoStateDiscrete -> a FalseState property is mandatory ",
47
48
  this.browseName.toString(),
@@ -49,10 +50,11 @@ export class UATwoStateDiscreteImpl extends UAVariableImpl implements UATwoState
49
50
  );
50
51
  }
51
52
  const trueState = this.getPropertyByName("TrueState");
52
- /* istanbul ignore else */
53
53
  if (trueState) {
54
54
  trueState.on("value_changed", handler);
55
- } else {
55
+ }
56
+ /* c8 ignore next */
57
+ else {
56
58
  console.warn(
57
59
  "waring: UATwoStateDiscrete -> a TrueState property is mandatory",
58
60
  this.browseName.toString(),
@@ -83,7 +83,7 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
83
83
  const namespace = parentFolder.namespace;
84
84
 
85
85
  const complexVariableType = addressSpace.findVariableType(options.complexVariableType);
86
- // istanbul ignore next
86
+ // c8 ignore next
87
87
  if (!complexVariableType) {
88
88
  throw new Error("cannot find complex variable type");
89
89
  }
@@ -100,7 +100,7 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
100
100
 
101
101
  const dataType = addressSpace.findDataType(variableType.dataType);
102
102
 
103
- // istanbul ignore next
103
+ // c8 ignore next
104
104
  if (!dataType) {
105
105
  errorLog(variableType.toString());
106
106
  throw new Error("cannot find Data Type");
@@ -149,19 +149,19 @@ export function bindExtObjArrayNode<T extends ExtensionObject>(
149
149
  const addressSpace = uaArrayVariableNode.addressSpace;
150
150
 
151
151
  const variableType = addressSpace.findVariableType(variableTypeNodeId);
152
- // istanbul ignore next
152
+ // c8 ignore next
153
153
  if (!variableType || variableType.nodeId.isEmpty()) {
154
154
  throw new Error("Cannot find VariableType " + variableTypeNodeId.toString());
155
155
  }
156
156
 
157
157
  const structure = addressSpace.findDataType("Structure");
158
- // istanbul ignore next
158
+ // c8 ignore next
159
159
  if (!structure) {
160
160
  throw new Error("Structure Type not found: please check your nodeset file");
161
161
  }
162
162
 
163
163
  let dataType = addressSpace.findDataType(variableType.dataType);
164
- // istanbul ignore next
164
+ // c8 ignore next
165
165
  if (!dataType) {
166
166
  throw new Error("Cannot find DataType " + variableType.dataType.toString());
167
167
  }
@@ -272,7 +272,7 @@ export function removeElement<T extends ExtensionObject>(
272
272
  assert(element, "removeElement: element must exist");
273
273
  const _array = uaArrayVariableNode.$$extensionObjectArray;
274
274
 
275
- // istanbul ignore next
275
+ // c8 ignore next
276
276
  if (_array.length === 0) {
277
277
  throw new Error(" cannot remove an element from an empty array ");
278
278
  }
@@ -295,7 +295,7 @@ export function removeElement<T extends ExtensionObject>(
295
295
  throw new Error("Unsupported anymore!!! please use a functor instead");
296
296
  }
297
297
 
298
- // istanbul ignore next
298
+ // c8 ignore next
299
299
  if (elementIndex < 0) {
300
300
  throw new Error("removeElement: cannot find element matching " + element.toString());
301
301
  }
@@ -8,7 +8,7 @@ import chalk from "chalk";
8
8
  import { assert } from "node-opcua-assert";
9
9
  import { AccessLevelFlag, NodeClass, QualifiedNameLike } from "node-opcua-data-model";
10
10
  import { DataValue } from "node-opcua-data-value";
11
- import { isMinDate } from "node-opcua-date-time";
11
+ import { isMinDate, minDate } from "node-opcua-date-time";
12
12
  import { UAHistoricalDataConfiguration } from "node-opcua-nodeset-ua";
13
13
  import { NumericRange } from "node-opcua-numeric-range";
14
14
  import {
@@ -221,6 +221,10 @@ function _update_startOfOnlineArchive(this: UAVariableImpl, newDate: Date): void
221
221
  if (!this.$historicalDataConfiguration) {
222
222
  throw new Error("this variable has no HistoricalDataConfiguration");
223
223
  }
224
+ newDate = newDate || minDate;
225
+ if (!newDate) {
226
+ throw new Error("newDate must be provided");
227
+ }
224
228
 
225
229
  // The StartOfArchive Variable specifies the date before which there is no data
226
230
  // in the archive either online or offline.
@@ -237,7 +241,8 @@ function _update_startOfOnlineArchive(this: UAVariableImpl, newDate: Date): void
237
241
  (startOfArchiveDataValue.statusCode.isNotGood() ||
238
242
  !startOfArchiveDataValue.value ||
239
243
  !startOfArchiveDataValue.value.value ||
240
- startOfArchiveDataValue.value.value.getTime() >= newDate.getTime())
244
+ !(startOfArchiveDataValue.value.value instanceof Date) ||
245
+ (startOfArchiveDataValue.value.value as Date).getTime() >= newDate.getTime())
241
246
  ) {
242
247
  this._update_startOfArchive(newDate);
243
248
  }
@@ -429,12 +434,12 @@ function _historyReadRaw(
429
434
 
430
435
  const session = context.session;
431
436
 
432
- // istanbul ignore next
437
+ // c8 ignore next
433
438
  if (!session) {
434
439
  throw new Error("Internal Error: context.session not defined");
435
440
  }
436
441
 
437
- // istanbul ignore next
442
+ // c8 ignore next
438
443
  if (!session.continuationPointManager) {
439
444
  throw new Error("Internal Error: context.session.continuationPointManager not defined");
440
445
  }
@@ -131,7 +131,7 @@ function _makeHashKey(nodeId: NodeId): string | number {
131
131
  case NodeIdType.NUMERIC:
132
132
  return nodeId.value as number;
133
133
  default:
134
- // istanbul ignore next
134
+ // c8 ignore next
135
135
  if (nodeId.identifierType !== NodeIdType.BYTESTRING) {
136
136
  throw new Error("invalid nodeIdType");
137
137
  }
@@ -238,15 +238,15 @@ export class NamespaceImpl implements NamespacePrivate {
238
238
  private defaultRolePermissions?: RolePermissionType[];
239
239
 
240
240
  constructor(options: NamespaceConstructorOptions) {
241
- // istanbul ignore next
241
+ // c8 ignore next
242
242
  if (!(typeof options.namespaceUri === "string")) {
243
243
  throw new Error("NamespaceImpl constructor: namespaceUri must exists and be a string : got " + options.namespaceUri);
244
244
  }
245
- // istanbul ignore next
245
+ // c8 ignore next
246
246
  if (typeof options.index !== "number") {
247
247
  throw new Error("NamespaceImpl constructor: index must be a number");
248
248
  }
249
- // istanbul ignore next
249
+ // c8 ignore next
250
250
  if (!options.addressSpace) {
251
251
  throw new Error("NamespaceImpl constructor: Must specify a valid address space");
252
252
  }
@@ -689,7 +689,7 @@ export class NamespaceImpl implements NamespacePrivate {
689
689
  if (nodeOrNodeId instanceof NodeId) {
690
690
  nodeId = nodeOrNodeId;
691
691
  node = this.findNode(nodeId);
692
- // istanbul ignore next
692
+ // c8 ignore next
693
693
  if (!node) {
694
694
  throw new Error(" deleteNode : cannot find node with nodeId" + nodeId.toString());
695
695
  }
@@ -697,7 +697,7 @@ export class NamespaceImpl implements NamespacePrivate {
697
697
  node = nodeOrNodeId;
698
698
  nodeId = node.nodeId;
699
699
  }
700
- // istanbul ignore next
700
+ // c8 ignore next
701
701
  if (nodeId.namespace !== this.index) {
702
702
  throw new Error("this node doesn't belong to this namespace");
703
703
  }
@@ -705,7 +705,7 @@ export class NamespaceImpl implements NamespacePrivate {
705
705
  const addressSpace = this.addressSpace;
706
706
 
707
707
  addressSpace.modelChangeTransaction(() => {
708
- /* istanbul ignore next */
708
+ /* c8 ignore next */
709
709
  if (!node) {
710
710
  throw new Error("this node doesn't belong to this namespace");
711
711
  }
@@ -1473,7 +1473,7 @@ export class NamespaceImpl implements NamespacePrivate {
1473
1473
 
1474
1474
  const fromStateNode = _component.getComponentByName(fromState);
1475
1475
 
1476
- // istanbul ignore next
1476
+ // c8 ignore next
1477
1477
  if (!fromStateNode) {
1478
1478
  throw new Error("Cannot find state with name " + fromState);
1479
1479
  }
@@ -1481,7 +1481,7 @@ export class NamespaceImpl implements NamespacePrivate {
1481
1481
 
1482
1482
  const toStateNode = _component.getComponentByName(toState);
1483
1483
 
1484
- // istanbul ignore next
1484
+ // c8 ignore next
1485
1485
  if (!toStateNode) {
1486
1486
  throw new Error("Cannot find state with name " + toState);
1487
1487
  }
@@ -1639,7 +1639,7 @@ export class NamespaceImpl implements NamespacePrivate {
1639
1639
  public _register(node: BaseNode): void {
1640
1640
  assert(node instanceof BaseNodeImpl, "Expecting a instance of BaseNode in _register");
1641
1641
  assert(node.nodeId instanceof NodeId, "Expecting a NodeId");
1642
- // istanbul ignore next
1642
+ // c8 ignore next
1643
1643
  if (node.nodeId.namespace !== this.index) {
1644
1644
  throw new Error(
1645
1645
  "node must belong to this namespace : " +
@@ -1656,7 +1656,7 @@ export class NamespaceImpl implements NamespacePrivate {
1656
1656
 
1657
1657
  const hashKey = _makeHashKey(node.nodeId);
1658
1658
 
1659
- // istanbul ignore next
1659
+ // c8 ignore next
1660
1660
  if (this._nodeid_index.has(hashKey)) {
1661
1661
  const existingNode = this.findNode(node.nodeId)!;
1662
1662
  throw new Error(
@@ -1784,7 +1784,7 @@ export class NamespaceImpl implements NamespacePrivate {
1784
1784
  this._register(node);
1785
1785
 
1786
1786
  // object shall now be registered
1787
- // istanbul ignore next
1787
+ // c8 ignore next
1788
1788
  if (doDebug) {
1789
1789
  assert(this.findNode(node.nodeId) !== null && typeof this.findNode(node.nodeId) === "object");
1790
1790
  }
@@ -1795,7 +1795,7 @@ export class NamespaceImpl implements NamespacePrivate {
1795
1795
  assert(node instanceof BaseNodeImpl);
1796
1796
 
1797
1797
  const hashKey = _makeHashKey(node.nodeId);
1798
- // istanbul ignore next
1798
+ // c8 ignore next
1799
1799
  if (!this._nodeid_index.has(hashKey)) {
1800
1800
  throw new Error("deleteNode : nodeId " + node.nodeId.displayText() + " is not registered " + node.nodeId.toString());
1801
1801
  }
@@ -1958,14 +1958,14 @@ export class NamespaceImpl implements NamespacePrivate {
1958
1958
 
1959
1959
  options.historizing = !!options.historizing;
1960
1960
 
1961
- // istanbul ignore next
1961
+ // c8 ignore next
1962
1962
  if (Object.prototype.hasOwnProperty.call(options, "hasTypeDefinition")) {
1963
1963
  throw new Error("hasTypeDefinition option is invalid. Do you mean typeDefinition instead ?");
1964
1964
  }
1965
1965
  // ------------------------------------------ TypeDefinition
1966
1966
  let typeDefinition = options.typeDefinition || baseDataVariableTypeId;
1967
1967
  if (typeDefinition instanceof BaseNodeImpl) {
1968
- // istanbul ignore next
1968
+ // c8 ignore next
1969
1969
  if (typeDefinition.nodeClass !== NodeClass.VariableType) {
1970
1970
  const message = `invalid typeDefinition expecting a VariableType got ${NodeClass[typeDefinition.nodeClass]}`;
1971
1971
  errorLog(message);
@@ -1993,7 +1993,7 @@ export class NamespaceImpl implements NamespacePrivate {
1993
1993
  return typeof options.value?.get === "function" || typeof options.value?.timestamped_get === "function";
1994
1994
  };
1995
1995
 
1996
- // istanbul ignore next
1996
+ // c8 ignore next
1997
1997
  if (options.minimumSamplingInterval === undefined && hasGetter(options)) {
1998
1998
  // a getter has been specified and no options.minimumSamplingInterval has been specified
1999
1999
  warningLog(
@@ -2006,7 +2006,7 @@ export class NamespaceImpl implements NamespacePrivate {
2006
2006
 
2007
2007
  options.minimumSamplingInterval = options.minimumSamplingInterval !== undefined ? +options.minimumSamplingInterval : 0;
2008
2008
 
2009
- // istanbul ignore next
2009
+ // c8 ignore next
2010
2010
  if (options.minimumSamplingInterval === 0 && hasGetter(options)) {
2011
2011
  warningLog(
2012
2012
  "[NODE-OPCUA-W31",
@@ -2239,7 +2239,7 @@ function _create_node_version_if_needed(node: BaseNode, options: { nodeVersion?:
2239
2239
  assert(options);
2240
2240
  if (typeof options.nodeVersion == "string") {
2241
2241
  assert(node.nodeClass === NodeClass.Variable || node.nodeClass === NodeClass.Object);
2242
- // istanbul ignore next
2242
+ // c8 ignore next
2243
2243
  if (node.getNodeVersion()) {
2244
2244
  return; // already exists
2245
2245
  }
@@ -59,7 +59,7 @@ function _findParentNodeId(addressSpace: AddressSpacePartial, options: Construct
59
59
  }
60
60
  for (const ref of options.references) {
61
61
  (ref as any)._referenceType = addressSpace.findReferenceType(ref.referenceType);
62
- /* istanbul ignore next */
62
+ /* c8 ignore next */
63
63
  if (!getReferenceType(ref)) {
64
64
  throw new Error("Cannot find referenceType " + JSON.stringify(ref));
65
65
  }