node-opcua-address-space 2.112.0 → 2.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +2 -0
  2. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +2 -1
  3. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +3 -2
  4. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +2 -1
  5. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +2 -1
  6. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +2 -1
  7. package/dist/source/interfaces/i_set_state_options.d.ts +4 -0
  8. package/dist/source/interfaces/i_set_state_options.js +3 -0
  9. package/dist/source/interfaces/i_set_state_options.js.map +1 -0
  10. package/dist/source/loader/decode_xml_extension_object.js +0 -2
  11. package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
  12. package/dist/source/loader/load_nodeset2.js +4 -2
  13. package/dist/source/loader/load_nodeset2.js.map +1 -1
  14. package/dist/source/loader/make_xml_extension_object_parser.js +1 -3
  15. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  16. package/dist/source/loader/namespace_post_step.js +1 -0
  17. package/dist/source/loader/namespace_post_step.js.map +1 -1
  18. package/dist/source/ua_two_state_variable_ex.d.ts +2 -1
  19. package/dist/src/address_space.js +6 -14
  20. package/dist/src/address_space.js.map +1 -1
  21. package/dist/src/alarms_and_conditions/condition.js.map +1 -1
  22. package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +6 -5
  23. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +13 -15
  24. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  25. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -2
  26. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  27. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +5 -5
  28. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  29. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +0 -1
  30. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  31. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +3 -2
  32. package/dist/src/alarms_and_conditions/ua_condition_impl.js +12 -14
  33. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  34. package/dist/src/base_node_impl.js +9 -19
  35. package/dist/src/base_node_impl.js.map +1 -1
  36. package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +3 -2
  37. package/dist/src/data_access/ua_multistate_discrete_impl.js +2 -2
  38. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
  39. package/dist/src/data_access/ua_multistate_value_discrete_impl.d.ts +3 -2
  40. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +3 -3
  41. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
  42. package/dist/src/data_access/ua_two_state_discrete_impl.d.ts +2 -1
  43. package/dist/src/data_access/ua_two_state_discrete_impl.js +3 -3
  44. package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
  45. package/dist/src/namespace_impl.js +5 -6
  46. package/dist/src/namespace_impl.js.map +1 -1
  47. package/dist/src/nodeset_tools/construct_namespace_dependency.js +11 -6
  48. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  49. package/dist/src/nodeset_tools/nodeset_to_xml.js +8 -9
  50. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  51. package/dist/src/reference_impl.js +4 -1
  52. package/dist/src/reference_impl.js.map +1 -1
  53. package/dist/src/state_machine/finite_state_machine.js +2 -3
  54. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  55. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +2 -2
  56. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
  57. package/dist/src/state_machine/ua_two_state_variable.d.ts +2 -1
  58. package/dist/src/state_machine/ua_two_state_variable.js +10 -9
  59. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  60. package/dist/src/ua_data_type_impl.js +0 -23
  61. package/dist/src/ua_data_type_impl.js.map +1 -1
  62. package/dist/src/ua_variable_impl_ext_obj.js +15 -8
  63. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  64. package/dist/tsconfig_common.tsbuildinfo +1 -1
  65. package/distHelpers/add_event_generator_object.js +0 -4
  66. package/distHelpers/add_event_generator_object.js.map +1 -1
  67. package/package.json +30 -30
  68. package/source/interfaces/alarms_and_conditions/condition_info_i.ts +3 -0
  69. package/source/interfaces/alarms_and_conditions/condition_snapshot.ts +2 -1
  70. package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +4 -2
  71. package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +2 -1
  72. package/source/interfaces/data_access/ua_multistate_value_discrete_ex.ts +2 -1
  73. package/source/interfaces/data_access/ua_two_state_discrete_ex.ts +2 -1
  74. package/source/interfaces/i_set_state_options.ts +4 -0
  75. package/source/loader/decode_xml_extension_object.ts +0 -2
  76. package/source/loader/load_nodeset2.ts +4 -2
  77. package/source/loader/make_xml_extension_object_parser.ts +1 -4
  78. package/source/loader/namespace_post_step.ts +1 -0
  79. package/source/ua_two_state_variable_ex.ts +2 -1
  80. package/src/address_space.ts +7 -15
  81. package/src/alarms_and_conditions/condition.ts +1 -1
  82. package/src/alarms_and_conditions/condition_snapshot_impl.ts +16 -16
  83. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +6 -3
  84. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +6 -6
  85. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +0 -1
  86. package/src/alarms_and_conditions/ua_condition_impl.ts +13 -14
  87. package/src/base_node_impl.ts +12 -20
  88. package/src/data_access/ua_multistate_discrete_impl.ts +5 -3
  89. package/src/data_access/ua_multistate_value_discrete_impl.ts +5 -4
  90. package/src/data_access/ua_two_state_discrete_impl.ts +5 -3
  91. package/src/namespace_impl.ts +5 -6
  92. package/src/nodeset_tools/construct_namespace_dependency.ts +12 -7
  93. package/src/nodeset_tools/nodeset_to_xml.ts +8 -9
  94. package/src/reference_impl.ts +5 -1
  95. package/src/state_machine/finite_state_machine.ts +3 -4
  96. package/src/state_machine/ua_shelving_state_machine_ex.ts +2 -3
  97. package/src/state_machine/ua_two_state_variable.ts +14 -9
  98. package/src/ua_data_type_impl.ts +0 -24
  99. package/src/ua_variable_impl_ext_obj.ts +110 -82
@@ -21,6 +21,8 @@ import { AddTwoStateVariableOptions } from "../../source/address_space_ts";
21
21
  import { UATwoStateVariableEx } from "../../source/ua_two_state_variable_ex";
22
22
  // private types
23
23
  import { UAVariableImpl, UAVariableImplT } from "../ua_variable_impl";
24
+ import { ISetStateOptions } from "../../source/interfaces/i_set_state_options";
25
+
24
26
 
25
27
  const hasTrueSubState_ReferenceTypeNodeId = resolveNodeId("HasTrueSubState");
26
28
  const hasFalseSubState_ReferenceTypeNodeId = resolveNodeId("HasFalseSubState");
@@ -54,20 +56,23 @@ const hasFalseSubState_ReferenceTypeNodeId = resolveNodeId("HasFalseSubState");
54
56
  // TwoStateVariableType
55
57
  // <StateIdentifier> Defined in Clause 5.4.3 Optional
56
58
 
57
- function _updateTransitionTime(node: UATwoStateVariableEx, _subState?: UAVariable) {
59
+ function _updateTransitionTime(node: UATwoStateVariableEx, _subState?: UAVariable, options?: ISetStateOptions) {
58
60
  // TransitionTime specifies the time when the current state was entered.
59
61
  if (node.transitionTime) {
60
- node.transitionTime.setValueFromSource({ dataType: DataType.DateTime, value: new Date() });
62
+ const transitionTime = options?.transitionTime || new Date();
63
+ node.transitionTime.setValueFromSource({ dataType: DataType.DateTime, value: transitionTime });
61
64
  }
62
65
  }
63
66
 
64
- function _updateEffectiveTransitionTime(node: UATwoStateVariableImpl) {
67
+ function _updateEffectiveTransitionTime(node: UATwoStateVariableImpl,options?: ISetStateOptions) {
65
68
  if (node.effectiveTransitionTime) {
66
- // xx console.log("xxxx _updateEffectiveTransitionTime
69
+
70
+ const effectiveTransitionTime = options?.effectiveTransitionTime || new Date();
71
+
67
72
  // because subStateNode ",subStateNode.browseName.toString());
68
73
  node.effectiveTransitionTime.setValueFromSource({
69
74
  dataType: DataType.DateTime,
70
- value: new Date()
75
+ value: effectiveTransitionTime
71
76
  });
72
77
  }
73
78
  }
@@ -309,7 +314,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
309
314
  * @method setValue
310
315
  * @param boolValue {Boolean}
311
316
  */
312
- public setValue(boolValue: boolean): void {
317
+ public setValue(boolValue: boolean, options?: ISetStateOptions): void {
313
318
  assert(typeof boolValue === "boolean");
314
319
  const dataValue = this.id!.readValue();
315
320
  const oldValue = dataValue.value.value;
@@ -318,8 +323,8 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
318
323
  }
319
324
  //
320
325
  this.id.setValueFromSource(new Variant({ dataType: DataType.Boolean, value: boolValue }));
321
- _updateTransitionTime(this);
322
- _updateEffectiveTransitionTime(this);
326
+ _updateTransitionTime(this, undefined, options);
327
+ _updateEffectiveTransitionTime(this, options);
323
328
  }
324
329
 
325
330
  /**
@@ -370,7 +375,7 @@ export class UATwoStateVariableImpl extends UAVariableImplT<LocalizedText, DataT
370
375
  const addressSpace = this.addressSpace;
371
376
  // add event handle
372
377
  const subState = addressSpace.findNode(reference.nodeId) as UAVariable;
373
- subState.on("value_changed", _updateEffectiveTransitionTime.bind(null, this));
378
+ subState.on("value_changed", _updateEffectiveTransitionTime.bind(null, this, undefined));
374
379
  }
375
380
  }
376
381
  }
@@ -431,27 +431,3 @@ function makeStructureDefinition(
431
431
  });
432
432
  return sd;
433
433
  }
434
-
435
- /*
436
- function lockReadOnlyWithWriteDetection<T>(obj: T): T {
437
- if (obj instanceof Array) {
438
- return obj.map(lockReadOnlyWithWriteDetection) as unknown as T;
439
- }
440
- if (obj instanceof Object) {
441
- const _org = obj;
442
- for (const [key, value] of Object.entries(obj)) {
443
- lockReadOnlyWithWriteDetection(value);
444
- }
445
- obj = new Proxy(obj, {
446
- get: (target: any, prop: string) => {
447
- return target[prop];
448
- },
449
- set: (target: any, prop: string | symbol, value: any, receiver: any) => {
450
- console.log("QQQQQ Cannot modify stuff ");
451
- throw new Error("Invalid");
452
- }
453
- });
454
- }
455
- return obj;
456
- }
457
- */
@@ -70,7 +70,12 @@ function _extensionObjectFieldGetter(getVariable: () => UAVariable | null, targe
70
70
  }
71
71
  return target[key];
72
72
  }
73
- function _extensionObjectFieldSetter(getVariable: () => UAVariable | null, target: any, key: string, value: any /*, receiver*/): boolean {
73
+ function _extensionObjectFieldSetter(
74
+ getVariable: () => UAVariable | null,
75
+ target: any,
76
+ key: string,
77
+ value: any /*, receiver*/
78
+ ): boolean {
74
79
  target[key] = value;
75
80
  if (isProxy(target)) {
76
81
  return true;
@@ -132,7 +137,6 @@ export function propagateTouchValueDownward(self: UAVariableImpl, now: PreciseCl
132
137
  const property = self.getChildByName(field.name!) as UAVariableImpl;
133
138
 
134
139
  if (property) {
135
-
136
140
  if (cache) {
137
141
  if (cache.has(property)) {
138
142
  continue;
@@ -146,9 +150,7 @@ export function propagateTouchValueDownward(self: UAVariableImpl, now: PreciseCl
146
150
  }
147
151
  }
148
152
 
149
-
150
153
  export function setExtensionObjectPartialValue(node: UAVariableImpl, partialObject: any, sourceTimestamp?: PreciseClock) {
151
-
152
154
  const variablesToUpdate: Set<UAVariableImpl> = new Set();
153
155
 
154
156
  const extensionObject = node.$extensionObject;
@@ -162,7 +164,6 @@ export function setExtensionObjectPartialValue(node: UAVariableImpl, partialObje
162
164
  if (extObject[prop] instanceof Object) {
163
165
  _update_extension_object(extObject[prop], partialObject1[prop]);
164
166
  } else {
165
-
166
167
  if (isProxy(extObject)) {
167
168
  // collect element we have to update
168
169
  const target = getProxyTarget(extObject);
@@ -242,8 +243,10 @@ function prepareVariantValue(dataType: DataType, value: VariantLike): VariantLik
242
243
 
243
244
  function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
244
245
  ext = unProxy(ext);
245
- uaVariable.$extensionObject = new Proxy(ext, makeHandler(() => uaVariable));
246
-
246
+ uaVariable.$extensionObject = new Proxy(
247
+ ext,
248
+ makeHandler(() => uaVariable)
249
+ );
247
250
 
248
251
  const addressSpace = uaVariable.addressSpace;
249
252
  const definition = uaVariable.dataTypeObj.getStructureDefinition();
@@ -258,9 +261,12 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
258
261
 
259
262
  const subExtObj = uaVariable.$extensionObject[camelCaseName];
260
263
  if (subExtObj) {
261
- uaVariable.$extensionObject[camelCaseName] = new Proxy(subExtObj, makeHandler(() => {
262
- return uaVariable.getComponentByName(field.name!) as UAVariable | null;
263
- }));
264
+ uaVariable.$extensionObject[camelCaseName] = new Proxy(
265
+ subExtObj,
266
+ makeHandler(() => {
267
+ return uaVariable.getComponentByName(field.name!) as UAVariable | null;
268
+ })
269
+ );
264
270
  } else {
265
271
  doDebug && warningLog("extension object is null");
266
272
  }
@@ -269,11 +275,7 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
269
275
  }
270
276
  }
271
277
 
272
- export function _installExtensionObjectBindingOnProperties(
273
- uaVariable: UAVariableImpl,
274
- options?: BindExtensionObjectOptions
275
- ): void {
276
-
278
+ export function _installExtensionObjectBindingOnProperties(uaVariable: UAVariableImpl, options?: BindExtensionObjectOptions): void {
277
279
  // may be extension object mechanism has alreday been install
278
280
  // in this case we just need to rebind the properties...
279
281
  if (uaVariable.$extensionObject) {
@@ -292,7 +294,6 @@ export function _installExtensionObjectBindingOnProperties(
292
294
  if (extObj instanceof ExtensionObject) {
293
295
  uaVariable.bindExtensionObject(extObj, { createMissingProp: true, force: true });
294
296
  } else if (extObj instanceof Array) {
295
-
296
297
  // istanbul ignore else
297
298
  if (dataValue.value.arrayType === VariantArrayType.Array || dataValue.value.arrayType === VariantArrayType.Matrix) {
298
299
  _bindExtensionObjectArrayOrMatrix(uaVariable, extObj, { createMissingProp: true, force: true });
@@ -302,17 +303,22 @@ export function _installExtensionObjectBindingOnProperties(
302
303
  }
303
304
  }
304
305
 
305
- function _installFields2(uaVariable: UAVariableImpl, { get, set }: {
306
- get: (fieldName: string) => any,
307
- set: (fieldName: string, value: any, sourceTime: PreciseClock) => void;
308
- }, options?: BindExtensionObjectOptions) {
309
-
306
+ function _installFields2(
307
+ uaVariable: UAVariableImpl,
308
+ {
309
+ get,
310
+ set
311
+ }: {
312
+ get: (fieldName: string) => any;
313
+ set: (fieldName: string, value: any, sourceTime: PreciseClock) => void;
314
+ },
315
+ options?: BindExtensionObjectOptions
316
+ ) {
310
317
  options = options || { createMissingProp: false };
311
318
  const dt = uaVariable.getDataTypeNode();
312
319
  const definition = dt.getStructureDefinition();
313
320
 
314
321
  for (const field of definition.fields || []) {
315
-
316
322
  if (NodeId.sameNodeId(NodeId.nullNodeId, field.dataType)) {
317
323
  warningLog("field.dataType is null ! ", field.name, NodeId.nullNodeId.toString());
318
324
  warningLog(field.toString());
@@ -332,7 +338,12 @@ function _installFields2(uaVariable: UAVariableImpl, { get, set }: {
332
338
  propertyNode.$dataValue.serverTimestamp = uaVariable.$dataValue.serverTimestamp;
333
339
  propertyNode.$dataValue.serverPicoseconds = uaVariable.$dataValue.serverPicoseconds;
334
340
  propertyNode.$dataValue.value.dataType = propertyNode.dataTypeObj.basicDataType;
335
- propertyNode.$dataValue.value.arrayType = propertyNode.valueRank === -1 ? VariantArrayType.Scalar : (propertyNode.valueRank === 1 ? VariantArrayType.Array : VariantArrayType.Matrix)
341
+ propertyNode.$dataValue.value.arrayType =
342
+ propertyNode.valueRank === -1
343
+ ? VariantArrayType.Scalar
344
+ : propertyNode.valueRank === 1
345
+ ? VariantArrayType.Array
346
+ : VariantArrayType.Matrix;
336
347
  propertyNode.$dataValue.value.dimensions = propertyNode.valueRank > 1 ? propertyNode.arrayDimensions : null;
337
348
 
338
349
  const fieldName = field.name!;
@@ -344,19 +355,23 @@ function _installFields2(uaVariable: UAVariableImpl, { get, set }: {
344
355
  const value = dataValue.value.value;
345
356
  set(field.name!, value, sourceTime);
346
357
  propertyNode.touchValue(sourceTime);
347
- }
358
+ };
348
359
 
349
360
  if (propertyNode.dataTypeObj.basicDataType === DataType.ExtensionObject) {
350
- _installFields2(propertyNode, {
351
- get: (fieldName: string) => {
352
- const mainFieldName = field.name!;
353
- return get(mainFieldName)[lowerFirstLetter(fieldName)];
361
+ _installFields2(
362
+ propertyNode,
363
+ {
364
+ get: (fieldName: string) => {
365
+ const mainFieldName = field.name!;
366
+ return get(mainFieldName)[lowerFirstLetter(fieldName)];
367
+ },
368
+ set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
369
+ const mainFieldName = field.name!;
370
+ get(mainFieldName)[lowerFirstLetter(fieldName)] = value;
371
+ }
354
372
  },
355
- set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
356
- const mainFieldName = field.name!;
357
- get(mainFieldName)[lowerFirstLetter(fieldName)] = value;
358
- }
359
- }, options);
373
+ options
374
+ );
360
375
  }
361
376
  }
362
377
  }
@@ -393,15 +408,19 @@ function isVariableContainingExtensionObject(uaVariable: UAVariableImpl): boolea
393
408
  return true;
394
409
  }
395
410
 
396
- function _innerBindExtensionObjectScalar(uaVariable: UAVariableImpl,
397
- { get, set, setField }: {
411
+ function _innerBindExtensionObjectScalar(
412
+ uaVariable: UAVariableImpl,
413
+ {
414
+ get,
415
+ set,
416
+ setField
417
+ }: {
398
418
  get: () => ExtensionObject;
399
419
  set: (value: ExtensionObject, sourceTimestamp: PreciseClock, cache: Set<UAVariableImpl>) => void;
400
420
  setField: (fieldName: string, value: any, sourceTimestamp: PreciseClock, cache?: Set<UAVariableImpl>) => void;
401
421
  },
402
422
  options?: BindExtensionObjectOptions
403
423
  ) {
404
-
405
424
  uaVariable.$dataValue.statusCode = StatusCodes.Good;
406
425
  uaVariable.$dataValue.value.dataType = DataType.ExtensionObject;
407
426
  uaVariable.$dataValue.value.arrayType = VariantArrayType.Scalar;
@@ -413,19 +432,21 @@ function _innerBindExtensionObjectScalar(uaVariable: UAVariableImpl,
413
432
  installDataValueGetter(uaVariable, get);
414
433
  uaVariable.$set_ExtensionObject = set;
415
434
 
416
- _installFields2(uaVariable, {
417
- get: (fieldName: string) => {
418
- const extObj = get() as any;
419
- return extObj[lowerFirstLetter(fieldName)];
435
+ _installFields2(
436
+ uaVariable,
437
+ {
438
+ get: (fieldName: string) => {
439
+ const extObj = get() as any;
440
+ return extObj[lowerFirstLetter(fieldName)];
441
+ },
442
+ set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
443
+ setField(fieldName, value, sourceTime);
444
+ }
420
445
  },
421
- set: (fieldName: string, value: any, sourceTime: PreciseClock) => {
422
- setField(fieldName, value, sourceTime);
423
- }
424
- }, options);
425
-
446
+ options
447
+ );
426
448
  }
427
449
 
428
-
429
450
  // eslint-disable-next-line complexity
430
451
  export function _bindExtensionObject(
431
452
  uaVariable: UAVariableImpl,
@@ -441,7 +462,10 @@ export function _bindExtensionObject(
441
462
 
442
463
  // istanbul ignore next
443
464
  if (optionalExtensionObject && uaVariable.valueRank === 0) {
444
- warningLog(uaVariable.browseName.toString() + ": valueRank was zero but needed to be adjusted to -1 (Scalar) in bindExtensionObject");
465
+ warningLog(
466
+ uaVariable.browseName.toString() +
467
+ ": valueRank was zero but needed to be adjusted to -1 (Scalar) in bindExtensionObject"
468
+ );
445
469
  uaVariable.valueRank = -1;
446
470
  }
447
471
  const addressSpace = uaVariable.addressSpace;
@@ -491,9 +515,9 @@ export function _bindExtensionObject(
491
515
  warningLog(uaVariable.$extensionObject?.toString());
492
516
  throw new Error(
493
517
  "bindExtensionObject: $extensionObject is incorrect: we are expecting a " +
494
- uaVariable.dataType.toString({ addressSpace: uaVariable.addressSpace }) +
495
- " but we got a " +
496
- uaVariable.$extensionObject?.schema.name
518
+ uaVariable.dataType.toString({ addressSpace: uaVariable.addressSpace }) +
519
+ " but we got a " +
520
+ uaVariable.$extensionObject?.schema.name
497
521
  );
498
522
  }
499
523
  return uaVariable.$extensionObject;
@@ -516,14 +540,14 @@ export function _bindExtensionObject(
516
540
  return uaVariable.$extensionObject;
517
541
 
518
542
  function innerBindExtensionObject() {
519
-
520
543
  if (s.value && (s.value.dataType === DataType.Null || (s.value.dataType === DataType.ExtensionObject && !s.value.value))) {
521
544
  if (uaVariable.valueRank === -1 /** Scalar */) {
522
545
  extensionObject_ = optionalExtensionObject || addressSpace.constructExtensionObject(uaVariable.dataType, {});
523
546
 
524
547
  installExt(uaVariable, extensionObject_);
525
548
 
526
- _innerBindExtensionObjectScalar(uaVariable,
549
+ _innerBindExtensionObjectScalar(
550
+ uaVariable,
527
551
  {
528
552
  get: () => uaVariable.$extensionObject,
529
553
  set: (value: ExtensionObject) => installExt(uaVariable, value),
@@ -531,8 +555,9 @@ export function _bindExtensionObject(
531
555
  const extObj = uaVariable.$extensionObject;
532
556
  getProxyTarget(extObj)[lowerFirstLetter(fieldName)] = value;
533
557
  }
534
-
535
- }, options);
558
+ },
559
+ options
560
+ );
536
561
  return;
537
562
  } else if (uaVariable.valueRank === 1 /** Array */) {
538
563
  throw new Error("Should not get there ! Please fix me");
@@ -544,7 +569,8 @@ export function _bindExtensionObject(
544
569
  // verify that variant has the correct type
545
570
  assert(s.value.dataType === DataType.ExtensionObject);
546
571
  installExt(uaVariable, s.value.value);
547
- _innerBindExtensionObjectScalar(uaVariable,
572
+ _innerBindExtensionObjectScalar(
573
+ uaVariable,
548
574
  {
549
575
  get: () => uaVariable.$extensionObject,
550
576
  set: (value: ExtensionObject) => installExt(uaVariable, value),
@@ -552,26 +578,26 @@ export function _bindExtensionObject(
552
578
  const extObj = uaVariable.$extensionObject;
553
579
  getProxyTarget(extObj)[lowerFirstLetter(fieldName)] = value;
554
580
  }
555
- }, options);
581
+ },
582
+ options
583
+ );
556
584
  }
557
585
  }
558
586
  }
559
587
 
560
588
  const getIndexAsText = (index: number | number[]): string => {
561
- if (typeof index === "number")
562
- return `${index}`;
589
+ if (typeof index === "number") return `${index}`;
563
590
  return `${index.map((a) => a.toString()).join(",")}`;
564
- }
591
+ };
565
592
  const composeBrowseNameAndNodeId = (uaVariable: UAVariable, indexes: number[]) => {
566
593
  const iAsText = getIndexAsText(indexes);
567
594
  const browseName = coerceQualifiedName(iAsText);
568
595
  let nodeId: NodeId | undefined;
569
596
  if (uaVariable.nodeId.identifierType === NodeIdType.STRING) {
570
- nodeId = new NodeId(NodeIdType.STRING, uaVariable.nodeId.value as string + `[${iAsText}]`, uaVariable.nodeId.namespace);
597
+ nodeId = new NodeId(NodeIdType.STRING, (uaVariable.nodeId.value as string) + `[${iAsText}]`, uaVariable.nodeId.namespace);
571
598
  }
572
599
  return { browseName, nodeId };
573
- }
574
-
600
+ };
575
601
 
576
602
  // eslint-disable-next-line max-statements, complexity
577
603
  export function _bindExtensionObjectArrayOrMatrix(
@@ -579,7 +605,6 @@ export function _bindExtensionObjectArrayOrMatrix(
579
605
  optionalExtensionObjectArray?: ExtensionObject[],
580
606
  options?: BindExtensionObjectOptions
581
607
  ): ExtensionObject[] {
582
-
583
608
  options = options || { createMissingProp: false };
584
609
  options.createMissingProp = options.createMissingProp || false;
585
610
 
@@ -598,7 +623,10 @@ export function _bindExtensionObjectArrayOrMatrix(
598
623
  optionalExtensionObjectArray = uaVariable.$dataValue.value.value;
599
624
  }
600
625
 
601
- if ((arrayDimensions.length === 0 || arrayDimensions.length === 1 && arrayDimensions[0] === 0) && optionalExtensionObjectArray) {
626
+ if (
627
+ (arrayDimensions.length === 0 || (arrayDimensions.length === 1 && arrayDimensions[0] === 0)) &&
628
+ optionalExtensionObjectArray
629
+ ) {
602
630
  arrayDimensions[0] = optionalExtensionObjectArray.length;
603
631
  }
604
632
 
@@ -616,16 +644,15 @@ export function _bindExtensionObjectArrayOrMatrix(
616
644
  if (!optionalExtensionObjectArray) {
617
645
  optionalExtensionObjectArray = [];
618
646
  for (let i = 0; i < totalLength; i++) {
619
- optionalExtensionObjectArray[i] = addressSpace.constructExtensionObject(uaVariable.dataType, {});;
647
+ optionalExtensionObjectArray[i] = addressSpace.constructExtensionObject(uaVariable.dataType, {});
620
648
  }
621
649
  }
622
650
  uaVariable.$$extensionObjectArray = optionalExtensionObjectArray;
623
651
  uaVariable.$dataValue.value.arrayType = uaVariable.valueRank === 1 ? VariantArrayType.Array : VariantArrayType.Matrix;
624
- uaVariable.$dataValue.value.dimensions = uaVariable.valueRank === 1 ? null : (uaVariable.arrayDimensions || []);
652
+ uaVariable.$dataValue.value.dimensions = uaVariable.valueRank === 1 ? null : uaVariable.arrayDimensions || [];
625
653
  uaVariable.$dataValue.value.dataType = DataType.ExtensionObject;
626
654
  uaVariable.$dataValue.value.value = uaVariable.$$extensionObjectArray;
627
655
 
628
-
629
656
  // make sure uaVariable.$dataValue cannot be inadvertantly changed from this point onward
630
657
  const $dataValue = uaVariable.$dataValue;
631
658
  Object.defineProperty(uaVariable, "$dataValue", {
@@ -637,25 +664,25 @@ export function _bindExtensionObjectArrayOrMatrix(
637
664
  },
638
665
  // writable: true,
639
666
  enumerable: true,
640
- configurable: true,
667
+ configurable: true
641
668
  });
642
669
 
643
- uaVariable.bindVariable({
644
- get: () => uaVariable.$dataValue.value
645
- }, true);
646
-
670
+ uaVariable.bindVariable(
671
+ {
672
+ get: () => uaVariable.$dataValue.value
673
+ },
674
+ true
675
+ );
647
676
 
648
677
  const namespace = uaVariable.namespace;
649
678
  const indexIterator = new IndexIterator(arrayDimensions);
650
679
  for (let i = 0; i < totalLength; i++) {
651
-
652
680
  const index = indexIterator.next();
653
681
 
654
682
  const { browseName, nodeId } = composeBrowseNameAndNodeId(uaVariable, index);
655
683
 
656
684
  let uaElement = uaVariable.getComponentByName(browseName) as UAVariableImpl | null;
657
685
  if (!uaElement) {
658
-
659
686
  if (!options.createMissingProp) {
660
687
  continue;
661
688
  }
@@ -681,15 +708,17 @@ export function _bindExtensionObjectArrayOrMatrix(
681
708
  {
682
709
  const capturedIndex = i;
683
710
  const capturedUaElement = uaElement as UAVariableImpl;
684
- _innerBindExtensionObjectScalar(uaElement,
711
+ _innerBindExtensionObjectScalar(
712
+ uaElement,
685
713
  {
686
714
  get: () => uaVariable.$$extensionObjectArray[capturedIndex],
687
715
  set: (newValue: ExtensionObject, sourceTimestamp: PreciseClock, cache: Set<UAVariableImpl>) => {
688
716
  assert(!isProxy(uaVariable.$$extensionObjectArray[capturedIndex]));
689
717
  uaVariable.$$extensionObjectArray[capturedIndex] = newValue;
718
+ // istanbul ignore next
690
719
  if (uaVariable.$$extensionObjectArray !== uaVariable.$dataValue.value.value) {
691
- console.log("uaVariable", uaVariable.nodeId.toString());
692
- console.log("Houston! We have a problem ");
720
+ warningLog("uaVariable", uaVariable.nodeId.toString());
721
+ warningLog("Houston! We have a problem ");
693
722
  }
694
723
  propagateTouchValueDownward(capturedUaElement, sourceTimestamp, cache);
695
724
  propagateTouchValueUpward(capturedUaElement, sourceTimestamp, cache);
@@ -700,8 +729,9 @@ export function _bindExtensionObjectArrayOrMatrix(
700
729
  (isProxy(extObj) ? getProxyTarget(extObj) : extObj)[lowerFirstLetter(fieldName)] = newValue;
701
730
  propagateTouchValueUpward(capturedUaElement, sourceTimestamp, cache);
702
731
  }
703
- }, { ...options, force: true });
704
-
732
+ },
733
+ { ...options, force: true }
734
+ );
705
735
  }
706
736
  }
707
737
  return uaVariable.$$extensionObjectArray;
@@ -764,14 +794,12 @@ export function extractPartialData(path: string | string[], extensionObject: Ext
764
794
  }
765
795
 
766
796
  export function propagateTouchValueDownwardArray(uaVariable: UAVariableImpl, now: PreciseClock, cache: Set<UAVariable>) {
767
-
768
797
  if (!uaVariable.$$extensionObjectArray) return;
769
798
  const arrayDimensions = uaVariable.arrayDimensions || [];
770
799
  const totalLength = uaVariable.$$extensionObjectArray.length;
771
800
 
772
801
  const indexIterator = new IndexIterator(arrayDimensions);
773
802
  for (let i = 0; i < totalLength; i++) {
774
-
775
803
  const index = indexIterator.next();
776
804
 
777
805
  const { browseName, nodeId } = composeBrowseNameAndNodeId(uaVariable, index);
@@ -781,4 +809,4 @@ export function propagateTouchValueDownwardArray(uaVariable: UAVariableImpl, now
781
809
  propagateTouchValueDownward(uaElement, now, cache);
782
810
  }
783
811
  }
784
- }
812
+ }