node-opcua-address-space 2.88.0 → 2.89.0

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 (55) hide show
  1. package/dist/source/address_space_ts.d.ts +4 -4
  2. package/dist/source/address_space_ts.js +3 -3
  3. package/dist/source/address_space_ts.js.map +1 -1
  4. package/dist/source/helpers/argument_list.js +8 -12
  5. package/dist/source/helpers/argument_list.js.map +1 -1
  6. package/dist/source/helpers/call_helpers.d.ts +1 -1
  7. package/dist/source/helpers/multiform_func.d.ts +8 -8
  8. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +1 -1
  9. package/dist/source/interfaces/extension_object_constructor.d.ts +1 -1
  10. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +2 -2
  11. package/dist/source/loader/generateAddressSpaceRaw.d.ts +2 -2
  12. package/dist/source/loader/make_xml_extension_object_parser.d.ts +1 -1
  13. package/dist/source/loader/namespace_post_step.d.ts +1 -1
  14. package/dist/source/session_context.d.ts +1 -1
  15. package/dist/src/address_space.js +11 -11
  16. package/dist/src/address_space.js.map +1 -1
  17. package/dist/src/apply_condition_refresh.d.ts +1 -1
  18. package/dist/src/base_node_impl.js +44 -44
  19. package/dist/src/base_node_impl.js.map +1 -1
  20. package/dist/src/event_data.d.ts +2 -2
  21. package/dist/src/extension_object_array_node.d.ts +1 -1
  22. package/dist/src/extension_object_array_node.js +11 -9
  23. package/dist/src/extension_object_array_node.js.map +1 -1
  24. package/dist/src/nodeid_manager.d.ts +3 -3
  25. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +1 -1
  26. package/dist/src/reference_impl.js +6 -6
  27. package/dist/src/reference_impl.js.map +1 -1
  28. package/dist/src/tool_isSupertypeOf.d.ts +4 -4
  29. package/dist/src/ua_data_type_impl.js +12 -12
  30. package/dist/src/ua_data_type_impl.js.map +1 -1
  31. package/dist/src/ua_method_impl.js +6 -6
  32. package/dist/src/ua_method_impl.js.map +1 -1
  33. package/dist/src/ua_object_impl.js +7 -7
  34. package/dist/src/ua_object_impl.js.map +1 -1
  35. package/dist/src/ua_object_type_impl.js +6 -6
  36. package/dist/src/ua_object_type_impl.js.map +1 -1
  37. package/dist/src/ua_reference_type_impl.js +6 -6
  38. package/dist/src/ua_reference_type_impl.js.map +1 -1
  39. package/dist/src/ua_variable_impl.d.ts +4 -0
  40. package/dist/src/ua_variable_impl.js +41 -54
  41. package/dist/src/ua_variable_impl.js.map +1 -1
  42. package/dist/src/ua_variable_impl_ext_obj.d.ts +10 -8
  43. package/dist/src/ua_variable_impl_ext_obj.js +287 -240
  44. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  45. package/dist/src/ua_variable_type_impl.js +7 -7
  46. package/dist/src/ua_variable_type_impl.js.map +1 -1
  47. package/dist/src/ua_view_impl.js +3 -3
  48. package/dist/src/ua_view_impl.js.map +1 -1
  49. package/package.json +26 -26
  50. package/source/address_space_ts.ts +1 -1
  51. package/source/helpers/argument_list.ts +26 -26
  52. package/src/extension_object_array_node.ts +11 -10
  53. package/src/ua_variable_impl.ts +40 -51
  54. package/src/ua_variable_impl_ext_obj.ts +333 -288
  55. package/src/ua_variable_type_impl.ts +4 -4
@@ -85,13 +85,12 @@ import { EnumerationInfo, IEnumItem, UADataTypeImpl } from "./ua_data_type_impl"
85
85
  import { apply_condition_refresh, ConditionRefreshCache } from "./apply_condition_refresh";
86
86
  import {
87
87
  extractPartialData,
88
+ incrementElement,
88
89
  propagateTouchValueUpward,
89
- setExtensionObjectValue,
90
+ setExtensionObjectPartialValue,
90
91
  _bindExtensionObject,
91
- _bindExtensionObjectArray,
92
- _bindExtensionObjectMatrix,
92
+ _bindExtensionObjectArrayOrMatrix,
93
93
  _installExtensionObjectBindingOnProperties,
94
- _setExtensionObject,
95
94
  _touchValue
96
95
  } from "./ua_variable_impl_ext_obj";
97
96
 
@@ -485,8 +484,11 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
485
484
  if (this._timestamped_get_func.length === 0) {
486
485
  const dataValueOrPromise = (this._timestamped_get_func as VariableDataValueGetterSync)();
487
486
  if (!Object.prototype.hasOwnProperty.call(dataValueOrPromise, "then")) {
488
- this.$dataValue = dataValueOrPromise as DataValue;
489
- this.verifyVariantCompatibility(this.$dataValue.value);
487
+ if (dataValueOrPromise !== this.$dataValue) {
488
+ // TO DO : is this necessary ? this may interfere with current use of $dataValue
489
+ this.$dataValue = dataValueOrPromise as DataValue;
490
+ this.verifyVariantCompatibility(this.$dataValue.value);
491
+ }
490
492
  } else {
491
493
  errorLog("Unsupported: _timestamped_get_func returns a Promise !");
492
494
  }
@@ -822,8 +824,8 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
822
824
  if (this.$extensionObject) {
823
825
  // we have an extension object already bound to this node
824
826
  // the client is asking us to replace the object entierly by a new one
825
- const ext = dataValue.value.value;
826
- _setExtensionObject(this, ext);
827
+ // const ext = dataValue.value.value;
828
+ this._internal_set_dataValue(dataValue);
827
829
  return;
828
830
  }
829
831
  } else {
@@ -1460,14 +1462,6 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1460
1462
  */
1461
1463
  public installExtensionObjectVariables(): void {
1462
1464
  _installExtensionObjectBindingOnProperties(this, { createMissingProp: true });
1463
- // now recursively install extension object on children
1464
- for (const child of this.getComponents()) {
1465
- if (child.nodeClass === NodeClass.Variable && child instanceof UAVariableImpl) {
1466
- if (child.isExtensionObject()) {
1467
- child.installExtensionObjectVariables();
1468
- }
1469
- }
1470
- }
1471
1465
  }
1472
1466
  /**
1473
1467
  * @method bindExtensionObject
@@ -1477,6 +1471,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1477
1471
  optionalExtensionObject?: ExtensionObject,
1478
1472
  options?: BindExtensionObjectOptions
1479
1473
  ): ExtensionObject | null {
1474
+ assert(this.valueRank === -1, "expecting an Scalar variable here");
1480
1475
  return _bindExtensionObject(this, optionalExtensionObject, options) as ExtensionObject;
1481
1476
  }
1482
1477
 
@@ -1484,8 +1479,8 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1484
1479
  optionalExtensionObject?: ExtensionObject[],
1485
1480
  options?: BindExtensionObjectOptions
1486
1481
  ): ExtensionObject[] | null {
1487
- assert(this.valueRank === 1, "expecting a Array variable here");
1488
- return _bindExtensionObjectArray(this, optionalExtensionObject, options) as ExtensionObject[];
1482
+ assert(this.valueRank >= 1, "expecting an Array or a Matrix variable here");
1483
+ return _bindExtensionObjectArrayOrMatrix(this, optionalExtensionObject, options);
1489
1484
  }
1490
1485
 
1491
1486
  public bindExtensionObject(
@@ -1494,32 +1489,35 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1494
1489
  ): ExtensionObject | ExtensionObject[] | null {
1495
1490
  if (optionalExtensionObject) {
1496
1491
  if (optionalExtensionObject instanceof Array) {
1497
- return this.bindExtensionObjectArray(optionalExtensionObject, options);
1492
+ assert(this.valueRank >= 1, "expecting an Array of Matrix variable here");
1493
+ return _bindExtensionObjectArrayOrMatrix(this, optionalExtensionObject, options);
1498
1494
  } else {
1499
- return this.bindExtensionObjectScalar(optionalExtensionObject, options);
1495
+ assert(this.valueRank === -1, "expecting an Scalar variable here");
1496
+ return _bindExtensionObject(this, optionalExtensionObject, options) as ExtensionObject;
1500
1497
  }
1501
1498
  }
1502
1499
  assert(optionalExtensionObject === undefined);
1503
1500
  if (this.valueRank === -1) {
1504
- return this.bindExtensionObjectScalar(undefined, options);
1501
+ return _bindExtensionObject(this, undefined, options) as ExtensionObject;
1505
1502
  } else if (this.valueRank === 1) {
1506
- return this.bindExtensionObjectArray(undefined, options);
1503
+ return _bindExtensionObjectArrayOrMatrix(this, undefined, options);
1507
1504
  } else if (this.valueRank > 1) {
1508
- return _bindExtensionObjectMatrix(this, undefined, options);
1505
+ return _bindExtensionObjectArrayOrMatrix(this, undefined, options);
1509
1506
  }
1510
1507
  // unsupported case ...
1511
1508
  return null;
1512
1509
  }
1513
1510
 
1514
1511
  public updateExtensionObjectPartial(partialExtensionObject?: { [key: string]: any }): ExtensionObject {
1515
- setExtensionObjectValue(this, partialExtensionObject);
1512
+ setExtensionObjectPartialValue(this, partialExtensionObject);
1516
1513
  return this.$extensionObject;
1517
1514
  }
1518
1515
 
1519
1516
  public incrementExtensionObjectPartial(path: string | string[]): void {
1520
1517
  const extensionObject = this.readValue().value.value as ExtensionObject;
1521
1518
  const partialData = extractPartialData(path, extensionObject);
1522
- setExtensionObjectValue(this, partialData);
1519
+ incrementElement(path, partialData);
1520
+ setExtensionObjectPartialValue(this, partialData);
1523
1521
  }
1524
1522
 
1525
1523
  public toString(): string {
@@ -1685,10 +1683,14 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1685
1683
  assert(dataValue !== this.$dataValue, "expecting dataValue to be different from previous DataValue instance");
1686
1684
 
1687
1685
  const addressSpace = this.addressSpace;
1686
+
1687
+ // istanbul ignore next
1688
1688
  if (!addressSpace) {
1689
1689
  warningLog("UAVariable#_internal_set_dataValue : no addressSpace ! may be node has already been deleted ?");
1690
1690
  return;
1691
1691
  }
1692
+
1693
+ // istanbul ignore next
1692
1694
  if (dataValue.value.arrayType === VariantArrayType.Matrix) {
1693
1695
  if (!dataValue.value.dimensions) {
1694
1696
  throw new Error("missing dimensions: a Matrix Variant needs a dimension");
@@ -1701,31 +1703,25 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1701
1703
  );
1702
1704
  }
1703
1705
  }
1706
+
1707
+ // istanbul ignore next
1704
1708
  if (dataValue.value.dataType === DataType.ExtensionObject) {
1709
+ // istanbul ignore next
1705
1710
  if (!this.checkExtensionObjectIsCorrect(dataValue.value.value)) {
1706
1711
  warningLog(dataValue.toString());
1707
1712
  throw new Error("Invalid Extension Object on nodeId =" + this.nodeId.toString());
1708
1713
  }
1709
- // ----------------------------------
1710
- // if (this.$extensionObject) {
1711
- // // we have an extension object already bound to this node
1712
- // // the client is asking us to replace the object entierly by a new one
1713
- // const ext = dataValue.value.value;
1714
- // _setExtensionObject(this, ext);
1715
- // return;
1716
- // }
1717
1714
  }
1718
- // // istanbul ignore next
1719
- // if (this.dataType.namespace === 0) {
1720
- // if (this.dataType.value === DataType.LocalizedText && dataValue.value.dataType !== DataType.LocalizedText) {
1721
- // const message = "Invalid dataValue provided (expecting a LocalizedText) but got " + dataValue.toString();
1722
- // errorLog(message);
1723
- // // throw new Error(message);
1724
- // }
1725
- // }
1726
-
1715
+
1727
1716
  this.verifyVariantCompatibility(dataValue.value);
1728
1717
 
1718
+ this._inner_replace_dataValue(dataValue, indexRange);
1719
+ }
1720
+
1721
+ /**
1722
+ * @private
1723
+ */
1724
+ public _inner_replace_dataValue(dataValue: DataValue, indexRange?: NumericRange | null) {
1729
1725
  const old_dataValue = this.$dataValue;
1730
1726
 
1731
1727
  this.$dataValue = dataValue;
@@ -1999,9 +1995,6 @@ function _Variable_bind_with_async_refresh(this: UAVariableImpl, options: any) {
1999
1995
 
2000
1996
  this.refreshFunc = options.refreshFunc;
2001
1997
 
2002
- // assert(this.readValue().statusCode.equals(StatusCodes.BadNodeIdUnknown));
2003
- this.$dataValue.statusCode = StatusCodes.UncertainInitialValue;
2004
-
2005
1998
  // TO DO : REVISIT THIS ASSUMPTION
2006
1999
  if (false && this.minimumSamplingInterval === 0) {
2007
2000
  // when a getter /timestamped_getter or async_getter is provided
@@ -2140,10 +2133,9 @@ function _Variable_bind_with_timestamped_set(
2140
2133
  set: undefined;
2141
2134
  }
2142
2135
  ) {
2143
- assert(typeof options.timestamped_set === "function");
2144
2136
  assert(
2145
- options.timestamped_set.length === 2,
2146
- "timestamped_set must have 2 parameters timestamped_set: function(dataValue,callback){}"
2137
+ options.timestamped_set.length === 2 || options.timestamped_set.length === 1,
2138
+ "timestamped_set must have 2 parameters timestamped_set: function(dataValue,callback){} or one paramater timestamped_set: function(dataValue): Promise<StatusCode>{}"
2147
2139
  );
2148
2140
  assert(!options.set, "should not specify set when timestamped_set_func exists ");
2149
2141
  this._timestamped_set_func = convertToCallbackFunction1<StatusCode, DataValue, UAVariable>(options.timestamped_set);
@@ -2242,6 +2234,3 @@ export interface UAVariableImplT<T, DT extends DataType> extends UAVariableImpl,
2242
2234
  writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange?: NumericRange | null): Promise<StatusCode>;
2243
2235
  }
2244
2236
  export class UAVariableImplT<T, DT extends DataType> extends UAVariableImpl { }
2245
- // x TO DO
2246
- // require("./data_access/ua_variable_data_access");
2247
- // require("./historical_access/ua_variable_history");