node-opcua-address-space 2.163.1 → 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 +37 -37
  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
@@ -62,7 +62,7 @@ export function _recomputeRequiredModelsFromTypes(
62
62
  if (_visitedDataType.has(dataType.toString())) {
63
63
  return;
64
64
  }
65
- // istanbul ignore next
65
+ // c8 ignore next
66
66
  if (dataTypeNode.nodeClass !== NodeClass.DataType) {
67
67
  warningLog("exploreDataTypes! ignoring ", dataTypeNode.toString());
68
68
  return;
@@ -83,12 +83,12 @@ export function _recomputeRequiredModelsFromTypes(
83
83
  assert(!(e instanceof Variant));
84
84
  const nodeId = e.schema.encodingDefaultXml || e.schema.dataTypeNodeId || e.schema.dataTypeNodeId;
85
85
  consider(nodeId.namespace);
86
- // istanbul ignore next
86
+ // c8 ignore next
87
87
  if (e.schema.dataTypeNodeId.isEmpty()) {
88
88
  warningLog("Cannot find dataTypeNodeId for ", e.schema.name);
89
89
  }
90
90
  const d = addressSpace.findNode(e.schema.dataTypeNodeId) as UADataType | null;
91
- // istanbul ignore next
91
+ // c8 ignore next
92
92
  if (!d) return;
93
93
  exploreDataTypes(d);
94
94
  }
@@ -133,7 +133,7 @@ export function _recomputeRequiredModelsFromTypes(
133
133
  if (dataTypeNode) {
134
134
  consider(dataTypeNode.nodeId.namespace);
135
135
  } else {
136
- // istanbul ignore next
136
+ // c8 ignore next
137
137
  if (dataTypeNodeId.value != 0) {
138
138
  warningLog("Warning: Cannot find dataType", dataTypeNodeId.toString());
139
139
  }
@@ -28,7 +28,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number,string>
28
28
  return "ua:ExtensionObject";
29
29
  }
30
30
  const node = addressSpace.findNode(nodeId);
31
- // istanbul ignore next
31
+ // c8 ignore next
32
32
  if (!node) {
33
33
  throw new Error("Cannot find Node for" + nodeId?.toString());
34
34
  }
@@ -75,7 +75,7 @@ function dumpDataTypeStructure(
75
75
  }
76
76
  }
77
77
 
78
- // istanbul ignore next
78
+ // c8 ignore next
79
79
  if (optionalsCount >= 32) {
80
80
  throw new Error("Too many optionals fields");
81
81
  }
@@ -260,7 +260,7 @@ function findXsdNamespaceUri(xw: XmlWriter, nodeId: NodeId): string {
260
260
  if (namespace === "http://opcfoundation.org/UA/") {
261
261
  return "http://opcfoundation.org/UA/2008/02/Types.xsd";
262
262
  }
263
- // istanbul ignore next
263
+ // c8 ignore next
264
264
  if (!namespace) {
265
265
  return "";
266
266
  }
@@ -651,7 +651,7 @@ function _isDefaultValue(value: Variant): boolean {
651
651
  function _dumpValue(xw: XmlWriter, node: UAVariable | UAVariableType, variant: Variant) {
652
652
  const addressSpace = node.addressSpace;
653
653
 
654
- // istanbul ignore next
654
+ // c8 ignore next
655
655
  if (variant === null || variant === undefined) {
656
656
  return;
657
657
  }
@@ -659,7 +659,7 @@ function _dumpValue(xw: XmlWriter, node: UAVariable | UAVariableType, variant: V
659
659
 
660
660
  const dataTypeNode = addressSpace.findDataType(node.dataType);
661
661
 
662
- // istanbul ignore next
662
+ // c8 ignore next
663
663
  if (!dataTypeNode) {
664
664
  debugLog("Cannot find dataType:", node.dataType.toString());
665
665
  return;
@@ -1229,7 +1229,7 @@ function dumpUAMethod(xw: XmlWriter, node: UAMethod) {
1229
1229
  }
1230
1230
  function resolveDataTypeName(addressSpace: IAddressSpace, dataType: string | NodeId): QualifiedName {
1231
1231
  let dataTypeNode = null;
1232
- // istanbul ignore next
1232
+ // c8 ignore next
1233
1233
  if (typeof dataType === "string") {
1234
1234
  dataTypeNode = addressSpace.findDataType(dataType);
1235
1235
  } else {
@@ -1250,7 +1250,7 @@ function buildUpAliases(node: BaseNode, xw: XmlWriter, data: BuildAliasesData) {
1250
1250
  if (!data.aliases_visited) data.aliases_visited = new Set();
1251
1251
 
1252
1252
  const k = _hash(node);
1253
- // istanbul ignore next
1253
+ // c8 ignore next
1254
1254
  if (data.aliases_visited.has(k)) {
1255
1255
  return;
1256
1256
  }
@@ -92,13 +92,13 @@ export function getFiniteStateMachineTypeStates(uaFiniteStateMachineType: UAObje
92
92
  const addressSpace = uaFiniteStateMachineType.addressSpace;
93
93
 
94
94
  const initialStateType = addressSpace.findObjectType("InitialStateType");
95
- // istanbul ignore next
95
+ // c8 ignore next
96
96
  if (!initialStateType) {
97
97
  throw new Error("cannot find InitialStateType");
98
98
  }
99
99
 
100
100
  const stateType = addressSpace.findObjectType("StateType");
101
- // istanbul ignore next
101
+ // c8 ignore next
102
102
  if (!stateType) {
103
103
  throw new Error("cannot find StateType");
104
104
  }
@@ -113,7 +113,7 @@ export function getFiniteStateMachineTypeTransitions(uaFiniteStateMachineType: U
113
113
  const addressSpace = uaFiniteStateMachineType.addressSpace;
114
114
 
115
115
  const transitionType = addressSpace.findObjectType("TransitionType");
116
- // istanbul ignore next
116
+ // c8 ignore next
117
117
  if (!transitionType) {
118
118
  throw new Error("cannot find TransitionType");
119
119
  }
@@ -173,7 +173,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
173
173
  const typeDef = this.typeDefinitionObj;
174
174
 
175
175
  const comp = getComponentOfType(typeDef, initialStateType);
176
- // istanbul ignore next
176
+ // c8 ignore next
177
177
  if (comp.length > 1) {
178
178
  throw new Error(" More than 1 initial state in stateMachine");
179
179
  }
@@ -209,7 +209,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
209
209
  // to be executed there must be a transition from currentState to toState
210
210
  const transition = this.findTransitionNode(this.currentStateNode, toStateNode, predicate);
211
211
  if (!transition) {
212
- // istanbul ignore next
212
+ // c8 ignore next
213
213
  if (doDebug) {
214
214
  debugLog(" No transition from ", this.currentStateNode.browseName.toString(), " to ", toStateNode.toString());
215
215
  }
@@ -237,18 +237,18 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
237
237
  return null;
238
238
  }
239
239
 
240
- // istanbul ignore next
240
+ // c8 ignore next
241
241
  if (_fromStateNode.nodeClass !== NodeClass.Object) {
242
242
  throw new Error("Internal Error");
243
243
  }
244
- // istanbul ignore next
244
+ // c8 ignore next
245
245
  if (_toStateNode && _toStateNode.nodeClass !== NodeClass.Object) {
246
246
  throw new Error("Internal Error");
247
247
  }
248
248
 
249
249
  const stateType = addressSpace.findObjectType("StateType");
250
250
 
251
- // istanbul ignore next
251
+ // c8 ignore next
252
252
  if (!stateType) {
253
253
  throw new Error("Cannot find StateType");
254
254
  }
@@ -265,7 +265,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
265
265
  // cannot find a transition from fromState to toState
266
266
  return null;
267
267
  }
268
- // istanbul ignore next
268
+ // c8 ignore next
269
269
  if (transitions.length > 1) {
270
270
  const selectedTransition = (predicate || defaultPredicate)(
271
271
  transitions,
@@ -311,7 +311,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
311
311
 
312
312
  if (typeof toStateNode === "string") {
313
313
  const state = this.getStateByName(toStateNode);
314
- // istanbul ignore next
314
+ // c8 ignore next
315
315
  if (!state) {
316
316
  throw new Error("Cannot find state with name " + toStateNode);
317
317
  }
@@ -421,7 +421,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
421
421
  } else {
422
422
  const retVal = r[0];
423
423
 
424
- // istanbul ignore next
424
+ // c8 ignore next
425
425
  if (retVal.nodeClass !== NodeClass.Variable && retVal.nodeClass !== NodeClass.Object) {
426
426
  throw new Error("find: expecting only object and variable here");
427
427
  }
@@ -553,7 +553,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
553
553
  });
554
554
  } else {
555
555
  if (fromStateNode && fromStateNode !== toStateNode) {
556
- // istanbul ignore next
556
+ // c8 ignore next
557
557
  if (doDebug) {
558
558
  const f = fromStateNode.browseName.toString();
559
559
  const t = toStateNode.browseName.toString();
@@ -576,7 +576,7 @@ export class UAStateMachineImpl extends UAObjectImpl implements UAStateMachineEx
576
576
  const addressSpace = this.addressSpace;
577
577
  const finiteStateMachineType = addressSpace.findObjectType("FiniteStateMachineType");
578
578
 
579
- // istanbul ignore next
579
+ // c8 ignore next
580
580
  if (!finiteStateMachineType) {
581
581
  throw new Error("cannot find FiniteStateMachineType");
582
582
  }
@@ -133,7 +133,7 @@ function _automatically_unshelve(shelvingState: UAShelvedStateMachineExImpl) {
133
133
  assert(shelvingState._timer, "expecting timerId to be set");
134
134
  shelvingState._timer = null;
135
135
 
136
- // istanbul ignore next
136
+ // c8 ignore next
137
137
  if (doDebug) {
138
138
  debugLog("Automatically un-shelving variable ", shelvingState.browseName.toString());
139
139
  }
@@ -157,7 +157,7 @@ function _start_timer_for_automatic_unshelve(shelvingState: UAShelvedStateMachin
157
157
  shelvingState._shelvedTime = new Date(); // now
158
158
  shelvingState._duration = duration;
159
159
 
160
- // istanbul ignore next
160
+ // c8 ignore next
161
161
  if (doDebug) {
162
162
  debugLog("shelvingState._duration", shelvingState._duration);
163
163
  }
@@ -206,7 +206,7 @@ function _timedShelve_method(
206
206
  // checking duration ...
207
207
  const alarmNode = shelvingState.parent;
208
208
 
209
- // istanbul ignore next
209
+ // c8 ignore next
210
210
  if (!(alarmNode instanceof UAAlarmConditionImpl)) {
211
211
  return callback(null, {
212
212
  statusCode: StatusCodes.BadNodeIdInvalid
@@ -263,7 +263,7 @@ function _oneShotShelve_method(
263
263
  // checking duration ...
264
264
  const alarmNode = shelvingState.parent;
265
265
 
266
- // istanbul ignore next
266
+ // c8 ignore next
267
267
  if (!(alarmNode instanceof UAAlarmConditionImpl)) {
268
268
  return callback(null, {
269
269
  statusCode: StatusCodes.BadNodeIdInvalid
@@ -145,7 +145,7 @@ export function promoteToTwoStateVariable(node: UAVariable): UATwoStateVariableE
145
145
  if (node instanceof UATwoStateVariableImpl) {
146
146
  return node as unknown as UATwoStateVariableEx;
147
147
  }
148
- // istanbul ignore next
148
+ // c8 ignore next
149
149
  if (!(node instanceof UAVariableImpl)) {
150
150
  throw new Error("Trying to promote a invalid object");
151
151
  }
@@ -43,7 +43,7 @@ function _slow_isSubtypeOf<T extends UAType>(this: T, Class: typeof BaseNodeImpl
43
43
  for (const subType1 of subTypes) {
44
44
  const subTypeId = subType1.nodeId;
45
45
  const subTypeNode = this.addressSpace.findNode(subTypeId) as any as T;
46
- // istanbul ignore next
46
+ // c8 ignore next
47
47
  if (!subTypeNode) {
48
48
  throw new Error("Cannot find object with nodeId " + subTypeId.toString());
49
49
  }
@@ -368,9 +368,11 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
368
368
 
369
369
  public getDefinition(): DataTypeDefinition {
370
370
  const d = this._getDefinition();
371
+ /* c8 ignore start */
371
372
  if (!d) {
372
373
  throw new Error("DataType has no definition property");
373
374
  }
375
+ /* c8 ignore stop */
374
376
  return d;
375
377
  }
376
378
 
@@ -155,7 +155,7 @@ export class UAMethodImpl extends BaseNodeImpl implements UAMethod {
155
155
  context: ISessionContext,
156
156
  callback?: CallbackT<CallMethodResultOptions>
157
157
  ): any {
158
- // istanbul ignore next
158
+ // c8 ignore next
159
159
  if (!callback) {
160
160
  throw new Error("execute need to be promisified");
161
161
  }
@@ -168,7 +168,7 @@ export class UAMethodImpl extends BaseNodeImpl implements UAMethod {
168
168
 
169
169
  object = object || (this.parent as UAObject);
170
170
 
171
- // istanbul ignore next
171
+ // c8 ignore next
172
172
  if (!object) {
173
173
  errorLog("UAMethod#execute expects a valid object");
174
174
  return callback(null, { statusCode: StatusCodes.BadInternalError });
@@ -59,7 +59,7 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
59
59
  public readonly symbolicName: string | null;
60
60
 
61
61
  get typeDefinitionObj(): UAObjectType {
62
- // istanbul ignore next
62
+ // c8 ignore next
63
63
  if (super.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
64
64
  const msg = `Invalid type definition node class , expecting a ObjectType got ${
65
65
  NodeClass[super.typeDefinitionObj.nodeClass]
@@ -170,7 +170,7 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
170
170
  eventType = eventType as UAEventType;
171
171
 
172
172
  let eventTypeNode: UAEventType = eventType as UAEventType;
173
- // istanbul ignore next
173
+ // c8 ignore next
174
174
  if (!eventTypeNode) {
175
175
  throw new Error("UAObject#raiseEventType : Cannot find event type :" + eventType.toString());
176
176
  }
@@ -31,7 +31,7 @@ import {
31
31
  import { extractRange, sameDataValue, DataValue, DataValueLike, DataValueT } from "node-opcua-data-value";
32
32
  import { coerceClock, getCurrentClock, PreciseClock } from "node-opcua-date-time";
33
33
  import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
34
- import { ExtensionObject } from "node-opcua-extension-object";
34
+ import { ExtensionObject, OpaqueStructure } from "node-opcua-extension-object";
35
35
  import { NodeId, NodeIdLike } from "node-opcua-nodeid";
36
36
  import { NumericRange } from "node-opcua-numeric-range";
37
37
  import { WriteValue } from "node-opcua-service-write";
@@ -234,7 +234,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
234
234
  public __waiting_callbacks?: any[];
235
235
 
236
236
  get typeDefinitionObj(): UAVariableType {
237
- // istanbul ignore next
237
+ // c8 ignore next
238
238
  if (super.typeDefinitionObj && super.typeDefinitionObj.nodeClass !== NodeClass.VariableType) {
239
239
  // this could happen in faulty external nodeset and has been seen once
240
240
  // in an nano server
@@ -439,17 +439,17 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
439
439
  dataValue = extractRange(dataValue, indexRange);
440
440
  }
441
441
 
442
- /* istanbul ignore next */
442
+ /* c8 ignore next */
443
443
  if (
444
444
  dataValue.statusCode.equals(StatusCodes.BadWaitingForInitialData) ||
445
445
  dataValue.statusCode.equals(StatusCodes.UncertainInitialValue)
446
446
  ) {
447
447
  debugLog(
448
448
  chalk.red(" Warning: UAVariable#readValue ") +
449
- chalk.cyan(this.browseName.toString()) +
450
- " (" +
451
- chalk.yellow(this.nodeId.toString()) +
452
- ") exists but dataValue has not been defined"
449
+ chalk.cyan(this.browseName.toString()) +
450
+ " (" +
451
+ chalk.yellow(this.nodeId.toString()) +
452
+ ") exists but dataValue has not been defined"
453
453
  );
454
454
  }
455
455
  return dataValue;
@@ -527,7 +527,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
527
527
  }
528
528
  try {
529
529
  this.refreshFunc.call(this, (err: Error | null, dataValue?: DataValueLike) => {
530
- // istanbul ignore next
530
+ // c8 ignore next
531
531
  if (err || !dataValue) {
532
532
  errorLog(
533
533
  "-------------- refresh call failed",
@@ -646,14 +646,14 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
646
646
  }
647
647
  public verifyVariantCompatibility(variant: Variant): void {
648
648
  try {
649
- // istanbul ignore next
649
+ // c8 ignore next
650
650
  if (Object.prototype.hasOwnProperty.call(variant, "value")) {
651
651
  if (variant.dataType === null || variant.dataType === undefined) {
652
652
  throw new Error(
653
653
  "Variant must provide a valid dataType : variant = " +
654
- variant.toString() +
655
- " this.dataType= " +
656
- this.dataType.toString()
654
+ variant.toString() +
655
+ " this.dataType= " +
656
+ this.dataType.toString()
657
657
  );
658
658
  }
659
659
  if (
@@ -662,9 +662,9 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
662
662
  ) {
663
663
  throw new Error(
664
664
  "Variant must provide a valid Boolean : variant = " +
665
- variant.toString() +
666
- " this.dataType= " +
667
- this.dataType.toString()
665
+ variant.toString() +
666
+ " this.dataType= " +
667
+ this.dataType.toString()
668
668
  );
669
669
  }
670
670
  if (
@@ -675,9 +675,9 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
675
675
  ) {
676
676
  throw new Error(
677
677
  "Variant must provide a valid LocalizedText : variant = " +
678
- variant.toString() +
679
- " this.dataType= " +
680
- this.dataType.toString()
678
+ variant.toString() +
679
+ " this.dataType= " +
680
+ this.dataType.toString()
681
681
  );
682
682
  }
683
683
  }
@@ -942,7 +942,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
942
942
  writeValueOptions: WriteValueOptions,
943
943
  callback?: (err: Error | null, statusCode?: StatusCode) => void
944
944
  ): any {
945
- // istanbul ignore next
945
+ // c8 ignore next
946
946
  if (!callback) {
947
947
  throw new Error("Internal error");
948
948
  }
@@ -1241,7 +1241,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1241
1241
  try {
1242
1242
  func.call(this, satisfy_callbacks);
1243
1243
  } catch (err) {
1244
- // istanbul ignore next
1244
+ // c8 ignore next
1245
1245
  if (doDebug) {
1246
1246
  debugLog(chalk.red("func readValueAsync has failed "));
1247
1247
  if (types.isNativeError(err)) {
@@ -1315,7 +1315,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1315
1315
  this.dataType = this.resolveNodeId(DataType.Variant);
1316
1316
  }
1317
1317
  const dt = addressSpace.findNode(this.dataType);
1318
- // istanbul ignore next
1318
+ // c8 ignore next
1319
1319
  if (!dt) {
1320
1320
  throw new Error("getDataTypeNode: cannot find dataType " + this.dataType.toString());
1321
1321
  }
@@ -1332,7 +1332,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1332
1332
  }
1333
1333
  const addressSpace = this.addressSpace;
1334
1334
  if (!addressSpace) {
1335
-
1335
+
1336
1336
  return true;
1337
1337
  }
1338
1338
  const dataType = addressSpace.findDataType(this.dataType);
@@ -1379,18 +1379,34 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1379
1379
  }
1380
1380
  function checkExtensionObjectIsCorrectScalar(
1381
1381
  this: UAVariableImpl,
1382
- extObj: ExtensionObject | ExtensionObject[] | null
1382
+ extObj: ExtensionObject | null
1383
1383
  ): boolean {
1384
- // istanbul ignore next
1384
+ // c8 ignore next
1385
1385
  if (!(extObj && extObj.constructor)) {
1386
1386
  errorLog(extObj);
1387
1387
  throw new Error("expecting an valid extension object");
1388
1388
  }
1389
- return extObj.constructor.name === Constructor.name;
1389
+
1390
+ if (extObj.constructor.name === Constructor.name) {
1391
+ return true;
1392
+ }
1393
+
1394
+ if (extObj instanceof OpaqueStructure) {
1395
+ throw new Error("An opaque structure is not expected here");
1396
+ }
1397
+ // let's verify that the constructor is a sub-class of Constructor
1398
+ let current: IStructuredTypeSchema | null = extObj.schema;
1399
+ while (current) {
1400
+ if (current.name === Constructor.name) {
1401
+ return true;
1402
+ }
1403
+ current = current.getBaseSchema();
1404
+ }
1405
+ return false;
1390
1406
  }
1391
1407
 
1392
1408
  function checkExtensionObjectIsCorrectArray(this: UAVariableImpl, extObjArray: ExtensionObject[]): boolean {
1393
- // istanbul ignore next
1409
+ // c8 ignore next
1394
1410
  for (const extObj of extObjArray) {
1395
1411
  if (!(extObj && extObj.constructor)) {
1396
1412
  errorLog(extObj);
@@ -1663,13 +1679,13 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1663
1679
 
1664
1680
  const addressSpace = this.addressSpace;
1665
1681
 
1666
- // istanbul ignore next
1682
+ // c8 ignore next
1667
1683
  if (!addressSpace) {
1668
1684
  warningLog("UAVariable#_internal_set_dataValue : no addressSpace ! may be node has already been deleted ?");
1669
1685
  return;
1670
1686
  }
1671
1687
 
1672
- // istanbul ignore next
1688
+ // c8 ignore next
1673
1689
  if (dataValue.value.arrayType === VariantArrayType.Matrix) {
1674
1690
  if (!dataValue.value.dimensions) {
1675
1691
  throw new Error("missing dimensions: a Matrix Variant needs a dimension");
@@ -1677,16 +1693,15 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1677
1693
  const nbElements = dataValue.value.dimensions.reduce((acc, x) => acc * x, 1);
1678
1694
  if (dataValue.value.value.length !== 0 && dataValue.value.value.length !== nbElements) {
1679
1695
  throw new Error(
1680
- `Internal Error: matrix dimension doesn't match the number of element in the array : ${dataValue.toString()} "\n expecting ${nbElements} elements but got ${
1681
- dataValue.value.value.length
1696
+ `Internal Error: matrix dimension doesn't match the number of element in the array : ${dataValue.toString()} "\n expecting ${nbElements} elements but got ${dataValue.value.value.length
1682
1697
  }`
1683
1698
  );
1684
1699
  }
1685
1700
  }
1686
1701
 
1687
- // istanbul ignore next
1702
+ // c8 ignore next
1688
1703
  if (dataValue.value.dataType === DataType.ExtensionObject) {
1689
- // istanbul ignore next
1704
+ // c8 ignore next
1690
1705
  if (!this.checkExtensionObjectIsCorrect(dataValue.value.value)) {
1691
1706
  warningLog(dataValue.toString());
1692
1707
  throw new Error("Invalid Extension Object on nodeId =" + this.nodeId.toString());
@@ -1859,6 +1874,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1859
1874
 
1860
1875
  // tslint:disable:no-var-requires
1861
1876
  import { withCallback } from "thenify-ex";
1877
+ import { IStructuredTypeSchema } from "node-opcua-factory";
1862
1878
  UAVariableImpl.prototype.asyncRefresh = withCallback(UAVariableImpl.prototype.asyncRefresh);
1863
1879
  UAVariableImpl.prototype.writeValue = withCallback(UAVariableImpl.prototype.writeValue);
1864
1880
  UAVariableImpl.prototype.writeAttribute = withCallback(UAVariableImpl.prototype.writeAttribute);
@@ -1872,7 +1888,7 @@ export interface UAVariableImplExtArray {
1872
1888
  $$extensionObjectArray: ExtensionObject[];
1873
1889
  $$indexPropertyName: string;
1874
1890
  }
1875
- export interface UAVariableImpl extends UAVariableImplExtArray {}
1891
+ export interface UAVariableImpl extends UAVariableImplExtArray { }
1876
1892
  function check_valid_array(dataType: DataType, array: any): boolean {
1877
1893
  if (Array.isArray(array)) {
1878
1894
  return true;
@@ -2074,12 +2090,12 @@ function _Variable_bind_with_timestamped_get(
2074
2090
 
2075
2091
  const dataValue_verify = timestamped_get.call(pThis);
2076
2092
  // dataValue_verify should be a DataValue or a Promise
2077
- /* istanbul ignore next */
2093
+ /* c8 ignore next */
2078
2094
  if (!(dataValue_verify instanceof DataValue) && typeof dataValue_verify.then !== "function") {
2079
2095
  errorLog(
2080
2096
  chalk.red(" Bind variable error: "),
2081
2097
  " the timestamped_get function must return a DataValue or a Promise<DataValue>" +
2082
- "\n value_check.constructor.name ",
2098
+ "\n value_check.constructor.name ",
2083
2099
  dataValue_verify ? dataValue_verify.constructor.name : "null"
2084
2100
  );
2085
2101
 
@@ -2108,7 +2124,7 @@ function _Variable_bind_with_simple_get(this: UAVariableImpl, options: GetterOpt
2108
2124
  const timestamped_get_func_from__Variable_bind_with_simple_get = () => {
2109
2125
  const value: Variant | StatusCode = this._get_func();
2110
2126
 
2111
- /* istanbul ignore next */
2127
+ /* c8 ignore next */
2112
2128
  if (!is_Variant_or_StatusCode(value)) {
2113
2129
  errorLog(
2114
2130
  chalk.red(" Bind variable error: "),
@@ -2166,7 +2182,7 @@ function _Variable_bind_with_simple_set(this: UAVariableImpl, options: SimpleSet
2166
2182
  ) => {
2167
2183
  assert(timestamped_value instanceof DataValue);
2168
2184
  this._set_func(timestamped_value.value, (err: Error | null, statusCode: StatusCode) => {
2169
- // istanbul ignore next
2185
+ // c8 ignore next
2170
2186
  if (!err && !statusCode) {
2171
2187
  errorLog(
2172
2188
  chalk.red("UAVariable Binding Error _set_func must return a StatusCode, check the bindVariable parameters")
@@ -2298,20 +2314,20 @@ export interface UAVariableImplT<T, DT extends DataType> extends UAVariableImpl,
2298
2314
  writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, callback: StatusCodeCallback): void;
2299
2315
  writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange?: NumericRange | null): Promise<StatusCode>;
2300
2316
  }
2301
- export class UAVariableImplT<T, DT extends DataType> extends UAVariableImpl {}
2317
+ export class UAVariableImplT<T, DT extends DataType> extends UAVariableImpl { }
2302
2318
 
2303
2319
  function changeUAVariableDataType(uaVariable: UAVariableImpl, newDataType: NodeIdLike, valueLike?: VariantLike) {
2304
2320
  let value: Variant | null = valueLike ? (valueLike instanceof Variant ? valueLike : new Variant(valueLike)) : null;
2305
2321
 
2306
2322
  const addressSpace = uaVariable.addressSpace;
2307
2323
  const newDataTypeNode = addressSpace.findNode(newDataType) as UADataType;
2308
- // istanbul ignore next
2324
+ // c8 ignore next
2309
2325
  if (!newDataTypeNode || !(newDataTypeNode instanceof UADataTypeImpl)) {
2310
2326
  throw new Error("Cannot find newDataTypeNode " + newDataType.toString());
2311
2327
  }
2312
2328
 
2313
2329
  const newBaseDataType: DataType = newDataTypeNode.basicDataType;
2314
- // istanbul ignore next
2330
+ // c8 ignore next
2315
2331
  if (newBaseDataType === DataType.Null) {
2316
2332
  throw new Error("newDataTypeNode must be a DataType");
2317
2333
  }