node-opcua-address-space 2.186.7 → 2.186.9

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.
@@ -1042,12 +1042,13 @@ export class AddressSpaceImpl implements AddressSpacePrivate {
1042
1042
  if (!structureDataType) {
1043
1043
  throw new Error("getExtensionObjectConstructor: cannot find 'Structure' DataType in standard address Space");
1044
1044
  }
1045
- /* c8 ignore next */
1046
1045
  if (!_dataType.isSubtypeOf(structureDataType)) {
1047
- // c8 ignore next
1048
1046
  doDebug && debugLog(_dataType.toString());
1047
+ throw new Error(
1048
+ `getExtensionObjectConstructor: ${_dataType.browseName.toString()} (${_dataType.nodeId.toString()}) ` +
1049
+ "is not a Structure, so it has no extension object constructor"
1050
+ );
1049
1051
  }
1050
- assert(_dataType.isSubtypeOf(structureDataType));
1051
1052
  if (!_dataType._extensionObjectConstructor) {
1052
1053
  if (!this.$$extraDataTypeManager) {
1053
1054
  throw new Error(
@@ -1468,6 +1468,15 @@ export class UAVariableImpl<T extends UAVariableEvents & ListenerSignature<T> =
1468
1468
  if (dataType.nodeId.namespace === 0 && dataType.nodeId.value === DataType.ExtensionObject) {
1469
1469
  return true;
1470
1470
  }
1471
+ // A variable declared with a dataType that is not a Structure admits any extension
1472
+ // object - BaseDataType is the usual case (AutoID's LastScanData, or any variable that
1473
+ // holds whatever its source produces) - so there is no constructor to compare the value
1474
+ // with. Asking getExtensionObjectConstructor for one used to fail an assert with no
1475
+ // message, which turned a legitimate write from a method into a failed call.
1476
+ const structureDataType = addressSpace.findDataType("Structure");
1477
+ if (structureDataType && !dataType.isSubtypeOf(structureDataType)) {
1478
+ return true;
1479
+ }
1471
1480
  const Constructor = addressSpace.getExtensionObjectConstructor(this.dataType);
1472
1481
 
1473
1482
  if (this.valueRank === -1) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-opcua-address-space",
3
3
  "type": "module",
4
- "version": "2.186.7",
4
+ "version": "2.186.9",
5
5
  "description": "pure nodejs OPCUA SDK - module address-space",
6
6
  "main": "./dist/api/index.js",
7
7
  "types": "./dist/api/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "node-opcua-assert": "2.186.7",
28
28
  "node-opcua-basic-types": "2.186.7",
29
29
  "node-opcua-binary-stream": "2.186.7",
30
- "node-opcua-client-dynamic-extension-object": "2.186.7",
30
+ "node-opcua-client-dynamic-extension-object": "2.186.8",
31
31
  "node-opcua-constants": "2.185.0",
32
32
  "node-opcua-crypto": "6.1.2",
33
33
  "node-opcua-data-access": "2.186.7",
@@ -42,7 +42,7 @@
42
42
  "node-opcua-nodeset-ua": "2.186.7",
43
43
  "node-opcua-numeric-range": "2.186.7",
44
44
  "node-opcua-object-registry": "2.186.7",
45
- "node-opcua-pseudo-session": "2.186.7",
45
+ "node-opcua-pseudo-session": "2.186.8",
46
46
  "node-opcua-service-browse": "2.186.7",
47
47
  "node-opcua-service-call": "2.186.7",
48
48
  "node-opcua-service-history": "2.186.7",
@@ -83,7 +83,7 @@
83
83
  "internet of things"
84
84
  ],
85
85
  "homepage": "http://node-opcua.github.io/",
86
- "gitHead": "8a4f79f3ff854bf6bed6dce299ad56809093aa5b",
86
+ "gitHead": "b63bbd461cbfc04d32fb39da3b15c88448867e7d",
87
87
  "files": [
88
88
  "dist",
89
89
  "distHelpers",