node-opcua-address-space 2.66.3 → 2.67.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 (42) hide show
  1. package/dist/source/address_space_ts.d.ts +0 -2
  2. package/dist/source/address_space_ts.js.map +1 -1
  3. package/dist/source/continuation_points/continuation_point_manager.js +3 -0
  4. package/dist/source/continuation_points/continuation_point_manager.js.map +1 -1
  5. package/dist/source/index.js +5 -1
  6. package/dist/source/index.js.map +1 -1
  7. package/dist/source/loader/make_xml_extension_object_parser.js +28 -9
  8. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  9. package/dist/source/session_context.js +1 -0
  10. package/dist/source/session_context.js.map +1 -1
  11. package/dist/src/address_space.js +1 -2
  12. package/dist/src/address_space.js.map +1 -1
  13. package/dist/src/alarms_and_conditions/index.js +5 -1
  14. package/dist/src/alarms_and_conditions/index.js.map +1 -1
  15. package/dist/src/base_node_impl.js +1 -1
  16. package/dist/src/base_node_impl.js.map +1 -1
  17. package/dist/src/extension_object_array_node.js +31 -22
  18. package/dist/src/extension_object_array_node.js.map +1 -1
  19. package/dist/src/index_current.js +5 -1
  20. package/dist/src/index_current.js.map +1 -1
  21. package/dist/src/reference_impl.js +1 -1
  22. package/dist/src/reference_impl.js.map +1 -1
  23. package/dist/src/ua_variable_impl.d.ts +9 -8
  24. package/dist/src/ua_variable_impl.js +55 -313
  25. package/dist/src/ua_variable_impl.js.map +1 -1
  26. package/dist/src/ua_variable_impl_ext_obj.d.ts +17 -0
  27. package/dist/src/ua_variable_impl_ext_obj.js +393 -0
  28. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -0
  29. package/distHelpers/index.js +5 -1
  30. package/distHelpers/index.js.map +1 -1
  31. package/distNodeJS/index.js +5 -1
  32. package/distNodeJS/index.js.map +1 -1
  33. package/package.json +36 -36
  34. package/source/address_space_ts.ts +0 -2
  35. package/source/continuation_points/continuation_point_manager.ts +8 -6
  36. package/source/loader/make_xml_extension_object_parser.ts +32 -11
  37. package/src/base_node_impl.ts +1 -1
  38. package/src/extension_object_array_node.ts +43 -28
  39. package/src/reference_impl.ts +1 -1
  40. package/src/ua_variable_impl.ts +66 -379
  41. package/src/ua_variable_impl_ext_obj.ts +472 -0
  42. package/test_helpers/test_fixtures/issue_1132_variable_with_nodeid_value.xml +68 -0
@@ -22,7 +22,6 @@ const node_opcua_service_write_1 = require("node-opcua-service-write");
22
22
  const node_opcua_status_code_1 = require("node-opcua-status-code");
23
23
  const node_opcua_types_1 = require("node-opcua-types");
24
24
  const utils = require("node-opcua-utils");
25
- const node_opcua_utils_1 = require("node-opcua-utils");
26
25
  const node_opcua_variant_1 = require("node-opcua-variant");
27
26
  const session_context_1 = require("../source/session_context");
28
27
  const multiform_func_1 = require("../source/helpers/multiform_func");
@@ -30,6 +29,7 @@ const base_node_impl_1 = require("./base_node_impl");
30
29
  const base_node_private_1 = require("./base_node_private");
31
30
  const ua_data_type_impl_1 = require("./ua_data_type_impl");
32
31
  const apply_condition_refresh_1 = require("./apply_condition_refresh");
32
+ const ua_variable_impl_ext_obj_1 = require("./ua_variable_impl_ext_obj");
33
33
  const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
34
34
  const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
35
35
  const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
@@ -460,7 +460,6 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
460
460
  return (0, node_opcua_variant_1.adjustVariant)(variant, this.valueRank, this.getBasicDataType());
461
461
  }
462
462
  verifyVariantCompatibility(variant) {
463
- var _a;
464
463
  try {
465
464
  // istanbul ignore next
466
465
  if (Object.prototype.hasOwnProperty.call(variant, "value")) {
@@ -479,7 +478,8 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
479
478
  }
480
479
  if (this.dataType.namespace === 0 &&
481
480
  this.dataType.value === node_opcua_variant_1.DataType.LocalizedText &&
482
- variant.dataType !== node_opcua_variant_1.DataType.LocalizedText && variant.dataType !== node_opcua_variant_1.DataType.Null) {
481
+ variant.dataType !== node_opcua_variant_1.DataType.LocalizedText &&
482
+ variant.dataType !== node_opcua_variant_1.DataType.Null) {
483
483
  throw new Error("Variant must provide a valid LocalizedText : variant = " +
484
484
  variant.toString() +
485
485
  " this.dataType= " +
@@ -517,7 +517,7 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
517
517
  }
518
518
  }
519
519
  catch (err) {
520
- errorLog("UAVariable ", (_a = err) === null || _a === void 0 ? void 0 : _a.message, this.browseName.toString(), " nodeId=", this.nodeId.toString());
520
+ errorLog("UAVariable ", err === null || err === void 0 ? void 0 : err.message, this.browseName.toString(), " nodeId=", this.nodeId.toString());
521
521
  errorLog(err.message);
522
522
  errorLog(err.stack);
523
523
  throw err;
@@ -548,7 +548,21 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
548
548
  dataValue.sourceTimestamp = now.timestamp;
549
549
  dataValue.statusCode = statusCode;
550
550
  dataValue.value = variant1;
551
- this._internal_set_dataValue(dataValue);
551
+ if (dataValue.value.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
552
+ this.$dataValue = dataValue;
553
+ (0, node_opcua_assert_1.assert)(this.checkExtensionObjectIsCorrect(dataValue.value.value));
554
+ // ----------------------------------
555
+ if (this.$extensionObject) {
556
+ // we have an extension object already bound to this node
557
+ // the client is asking us to replace the object entierly by a new one
558
+ const ext = dataValue.value.value;
559
+ (0, ua_variable_impl_ext_obj_1._setExtensionObject)(this, ext);
560
+ return;
561
+ }
562
+ }
563
+ else {
564
+ this._internal_set_dataValue(dataValue);
565
+ }
552
566
  }
553
567
  catch (err) {
554
568
  errorLog("UAVariable#setValueFromString Error : ", this.browseName.toString(), this.nodeId.toString());
@@ -731,30 +745,12 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
731
745
  return node_opcua_status_code_1.StatusCodes.Good;
732
746
  }
733
747
  /**
734
- * @method touchValue
735
748
  * touch the source timestamp of a Variable and cascade up the change
736
749
  * to the parent variable if any.
737
- *
738
- * @param [optionalNow=null] {Object}
739
- * @param optionalNow.timestamp {Date}
740
- * @param optionalNow.picoseconds {Number}
741
750
  */
742
751
  touchValue(optionalNow) {
743
752
  const now = optionalNow || (0, node_opcua_date_time_1.getCurrentClock)();
744
- this.$dataValue.sourceTimestamp = now.timestamp;
745
- this.$dataValue.sourcePicoseconds = now.picoseconds;
746
- this.$dataValue.serverTimestamp = now.timestamp;
747
- this.$dataValue.serverPicoseconds = now.picoseconds;
748
- this.$dataValue.statusCode = node_opcua_status_code_1.StatusCodes.Good;
749
- if (this.minimumSamplingInterval === 0) {
750
- if (this.listenerCount("value_changed") > 0) {
751
- const clonedDataValue = this.readValue();
752
- this.emit("value_changed", clonedDataValue);
753
- }
754
- }
755
- if (this.parent && this.parent.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
756
- this.parent.touchValue(now);
757
- }
753
+ (0, ua_variable_impl_ext_obj_1.propagateTouchValueUpward)(this, now);
758
754
  }
759
755
  /**
760
756
  * bind a variable with a get and set functions.
@@ -973,6 +969,11 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
973
969
  (0, node_opcua_assert_1.assert)(typeof newVariable._timestamped_set_func === "function");
974
970
  (0, node_opcua_assert_1.assert)(newVariable.dataType === this.dataType);
975
971
  newVariable.$dataValue = this.$dataValue.clone();
972
+ // also bind extension object
973
+ const v = newVariable.$dataValue.value;
974
+ if (v.dataType === node_opcua_variant_1.DataType.ExtensionObject && v.value && v.arrayType === node_opcua_variant_1.VariantArrayType.Scalar) {
975
+ newVariable.bindExtensionObject(newVariable.$dataValue.value.value);
976
+ }
976
977
  return newVariable;
977
978
  }
978
979
  getDataTypeNode() {
@@ -1027,262 +1028,37 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
1027
1028
  }
1028
1029
  }
1029
1030
  /**
1030
- * @method bindExtensionObject
1031
- * @return {ExtensionObject}
1031
+ * @private
1032
+ * install UAVariable to exposed th
1033
+ *
1034
+ * precondition:
1032
1035
  */
1033
- bindExtensionObject(optionalExtensionObject) {
1034
- var _a, _b;
1035
- const addressSpace = this.addressSpace;
1036
- const structure = addressSpace.findDataType("Structure");
1037
- let extensionObject_;
1038
- if (!structure) {
1039
- // the addressSpace is limited and doesn't provide extension object
1040
- // bindExtensionObject cannot be performed and shall finish here.
1041
- return null;
1042
- }
1043
- // istanbul ignore next
1044
- if (doDebug) {
1045
- debugLog(" ------------------------------ binding ", this.browseName.toString(), this.nodeId.toString());
1046
- }
1047
- (0, node_opcua_assert_1.assert)(structure && structure.browseName.toString() === "Structure", "expecting DataType Structure to be in IAddressSpace");
1048
- const dt = this.getDataTypeNode();
1049
- if (!dt.isSupertypeOf(structure)) {
1050
- return null;
1051
- }
1052
- // the namespace for the structure browse name elements
1053
- const structureNamespace = dt.nodeId.namespace;
1054
- // -------------------- make sure we do not bind a variable twice ....
1055
- if (this.$extensionObject) {
1056
- // istanbul ignore next
1057
- // if (!force && !utils.isNullOrUndefined(optionalExtensionObject)) {
1058
- // throw new Error(
1059
- // "bindExtensionObject: unsupported case : $extensionObject already exists on " +
1060
- // this.browseName.toString() +
1061
- // " " +
1062
- // this.nodeId.toString()
1063
- // );
1064
- // }
1065
- // istanbul ignore next
1066
- if (!this.checkExtensionObjectIsCorrect(this.$extensionObject)) {
1067
- warningLog("on node : ", this.browseName.toString(), this.nodeId.toString(), "dataType=", this.dataType.toString({ addressSpace: this.addressSpace }));
1068
- warningLog((_a = this.$extensionObject) === null || _a === void 0 ? void 0 : _a.toString());
1069
- throw new Error("bindExtensionObject: $extensionObject is incorrect: we are expecting a " +
1070
- this.dataType.toString({ addressSpace: this.addressSpace }) +
1071
- " but we got a " +
1072
- ((_b = this.$extensionObject) === null || _b === void 0 ? void 0 : _b.constructor.name));
1073
- }
1074
- return this.$extensionObject;
1075
- // throw new Error("Variable already bound");
1076
- }
1077
- this.$extensionObject = optionalExtensionObject;
1078
- // ------------------------------------------------------------------
1079
- function prepareVariantValue(dataType, value) {
1080
- if ((dataType === node_opcua_variant_1.DataType.Int32 || dataType === node_opcua_variant_1.DataType.UInt32) && value && value.key) {
1081
- value = value.value;
1082
- }
1083
- return value;
1084
- }
1085
- const bindProperty = (propertyNode, name, extensionObject, dataType) => {
1086
- // eslint-disable-next-line @typescript-eslint/no-this-alias
1087
- const self = this;
1088
- propertyNode.bindVariable({
1089
- timestamped_get: () => {
1090
- const propertyValue = self.$extensionObject[name];
1091
- if (propertyValue === undefined) {
1092
- propertyNode.$dataValue.value.dataType = node_opcua_variant_1.DataType.Null;
1093
- propertyNode.$dataValue.statusCode = node_opcua_status_code_1.StatusCodes.Good;
1094
- propertyNode.$dataValue.value.value = null;
1095
- return new node_opcua_data_value_1.DataValue(propertyNode.$dataValue);
1096
- }
1097
- const value = prepareVariantValue(dataType, propertyValue);
1098
- propertyNode.$dataValue.statusCode = node_opcua_status_code_1.StatusCodes.Good;
1099
- propertyNode.$dataValue.value.dataType = dataType;
1100
- propertyNode.$dataValue.value.value = value;
1101
- return new node_opcua_data_value_1.DataValue(propertyNode.$dataValue);
1102
- },
1103
- timestamped_set: (dataValue, callback) => {
1104
- dataValue;
1105
- callback(null, node_opcua_status_code_1.StatusCodes.BadNotWritable);
1106
- }
1107
- }, true);
1108
- };
1109
- const components = this.getComponents();
1110
- // ------------------------------------------------------
1111
- // make sure we have a structure
1112
- // ------------------------------------------------------
1113
- const s = this.readValue();
1114
- // istanbul ignore next
1115
- if (this.dataTypeObj.isAbstract) {
1116
- warningLog("Warning the DataType associated with this Variable is abstract ", this.dataTypeObj.browseName.toString());
1117
- warningLog("You need to provide a extension object yourself ");
1118
- throw new Error("bindExtensionObject requires a extensionObject as associated dataType is only abstract");
1119
- }
1120
- if (s.value && (s.value.dataType === node_opcua_variant_1.DataType.Null || (s.value.dataType === node_opcua_variant_1.DataType.ExtensionObject && !s.value.value))) {
1121
- // create a structure and bind it
1122
- extensionObject_ = this.$extensionObject || addressSpace.constructExtensionObject(this.dataType, {});
1123
- extensionObject_ = new Proxy(extensionObject_, makeHandler(this));
1124
- this.$extensionObject = extensionObject_;
1125
- const theValue = new node_opcua_variant_1.Variant({
1126
- dataType: node_opcua_variant_1.DataType.ExtensionObject,
1127
- value: this.$extensionObject
1128
- });
1129
- this.setValueFromSource(theValue, node_opcua_status_code_1.StatusCodes.Good);
1130
- // eslint-disable-next-line @typescript-eslint/no-this-alias
1131
- const self = this;
1132
- this.bindVariable({
1133
- timestamped_get() {
1134
- self.$dataValue.value.value = self.$extensionObject;
1135
- const d = new node_opcua_data_value_1.DataValue(self.$dataValue);
1136
- d.value = new node_opcua_variant_1.Variant(d.value);
1137
- return d;
1138
- },
1139
- timestamped_set(dataValue, callback) {
1140
- const ext = dataValue.value.value;
1141
- if (!self.checkExtensionObjectIsCorrect(ext)) {
1142
- return callback(null, node_opcua_status_code_1.StatusCodes.BadInvalidArgument);
1143
- }
1144
- self.$extensionObject = new Proxy(ext, makeHandler(self));
1145
- self.touchValue();
1146
- callback(null, node_opcua_status_code_1.StatusCodes.Good);
1147
- }
1148
- }, true);
1149
- }
1150
- else {
1151
- // verify that variant has the correct type
1152
- (0, node_opcua_assert_1.assert)(s.value.dataType === node_opcua_variant_1.DataType.ExtensionObject);
1153
- this.$extensionObject = s.value.value;
1154
- (0, node_opcua_assert_1.assert)(this.checkExtensionObjectIsCorrect(this.$extensionObject));
1155
- (0, node_opcua_assert_1.assert)(s.statusCode.equals(node_opcua_status_code_1.StatusCodes.Good));
1156
- }
1157
- // ------------------------------------------------------
1158
- // now bind each member
1159
- // ------------------------------------------------------
1160
- const definition = dt._getDefinition();
1161
- // istanbul ignore next
1162
- if (!definition) {
1163
- throw new Error("xx definition missing in " + dt.toString());
1164
- }
1165
- const getOrCreateProperty = (field) => {
1166
- let property;
1167
- const selectedComponents = components.filter((f) => f instanceof UAVariableImpl && f.browseName.name.toString() === field.name);
1168
- if (field.dataType.value === node_opcua_variant_1.DataType.Variant) {
1169
- warningLog("Warning : variant is not supported in ExtensionObject");
1170
- }
1171
- if (selectedComponents.length === 1) {
1172
- property = selectedComponents[0];
1173
- /* istanbul ignore next */
1174
- }
1175
- else {
1176
- debugLog("adding missing array variable", field.name, this.browseName.toString(), this.nodeId.toString());
1177
- // todo: Handle array appropriately...
1178
- (0, node_opcua_assert_1.assert)(selectedComponents.length === 0);
1179
- // create a variable (Note we may use ns=1;s=parentName/0:PropertyName)
1180
- property = this.namespace.addVariable({
1181
- browseName: { namespaceIndex: structureNamespace, name: field.name.toString() },
1182
- componentOf: this,
1183
- dataType: field.dataType,
1184
- minimumSamplingInterval: this.minimumSamplingInterval
1185
- });
1186
- (0, node_opcua_assert_1.assert)(property.minimumSamplingInterval === this.minimumSamplingInterval);
1187
- }
1188
- return property;
1189
- };
1190
- for (const field of definition.fields || []) {
1191
- if (node_opcua_nodeid_1.NodeId.sameNodeId(node_opcua_nodeid_1.NodeId.nullNodeId, field.dataType)) {
1192
- warningLog("field.dataType is null ! ", field.toString(), node_opcua_nodeid_1.NodeId.nullNodeId.toString());
1193
- warningLog(" dataType replaced with BaseDataType ");
1194
- warningLog(definition.toString());
1195
- field.dataType = this.resolveNodeId("BaseDataType");
1196
- }
1197
- const camelCaseName = (0, node_opcua_utils_1.lowerFirstLetter)(field.name);
1198
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(this.$extensionObject, camelCaseName));
1199
- const propertyNode = getOrCreateProperty(field);
1200
- propertyNode.$dataValue.statusCode = node_opcua_status_code_1.StatusCodes.Good;
1201
- propertyNode.touchValue();
1202
- const basicDataType = addressSpace.findCorrespondingBasicDataType(field.dataType);
1203
- // istanbul ignore next
1204
- if (doDebug) {
1205
- const x = addressSpace.findNode(field.dataType).browseName.toString();
1206
- debugLog(chalk.cyan("xxx"), " dataType", w(field.dataType.toString(), 8), w(field.name, 35), "valueRank", chalk.cyan(w((0, base_node_private_1.valueRankToString)(field.valueRank), 10)), chalk.green(w(x, 25)), "basicType = ", chalk.yellow(w(basicDataType.toString(), 20)), propertyNode.nodeId.toString(), propertyNode.readValue().statusCode.toString());
1207
- }
1208
- if (this.$extensionObject[camelCaseName] !== undefined && basicDataType === node_opcua_variant_1.DataType.ExtensionObject) {
1209
- (0, node_opcua_assert_1.assert)(this.$extensionObject[camelCaseName] instanceof Object);
1210
- this.$extensionObject[camelCaseName] = new Proxy(this.$extensionObject[camelCaseName], makeHandler(propertyNode));
1211
- propertyNode._internal_set_value(new node_opcua_variant_1.Variant({
1212
- dataType: node_opcua_variant_1.DataType.ExtensionObject,
1213
- value: this.$extensionObject[camelCaseName]
1214
- }));
1215
- propertyNode.bindExtensionObject();
1216
- propertyNode.$extensionObject = this.$extensionObject[camelCaseName];
1217
- }
1218
- else {
1219
- const prop = this.$extensionObject[camelCaseName];
1220
- if (prop === undefined) {
1221
- propertyNode._internal_set_value(new node_opcua_variant_1.Variant({
1222
- dataType: node_opcua_variant_1.DataType.Null
1223
- }));
1224
- }
1225
- else {
1226
- const preparedValue = prepareVariantValue(basicDataType, prop);
1227
- propertyNode._internal_set_value(new node_opcua_variant_1.Variant({
1228
- dataType: basicDataType,
1229
- value: preparedValue
1230
- }));
1036
+ installExtensionObjectVariables() {
1037
+ (0, ua_variable_impl_ext_obj_1._installExtensionObjectBindingOnProperties)(this, { createMissingProp: true });
1038
+ // now recursively install extension object on children
1039
+ for (const child of this.getComponents()) {
1040
+ if (child.nodeClass === node_opcua_data_model_1.NodeClass.Variable && child instanceof UAVariableImpl) {
1041
+ if (child.isExtensionObject()) {
1042
+ child.installExtensionObjectVariables();
1231
1043
  }
1232
- // eslint-disable-next-line @typescript-eslint/no-this-alias
1233
- const self = this;
1234
- // property.camelCaseName = camelCaseName;
1235
- propertyNode.setValueFromSource = function (variant) {
1236
- // eslint-disable-next-line @typescript-eslint/no-this-alias
1237
- const inner_this = this;
1238
- const variant1 = node_opcua_variant_1.Variant.coerce(variant);
1239
- inner_this.verifyVariantCompatibility(variant1);
1240
- self.$extensionObject[camelCaseName] = variant1.value;
1241
- self.touchValue();
1242
- };
1243
1044
  }
1244
- (0, node_opcua_assert_1.assert)(propertyNode.readValue().statusCode.equals(node_opcua_status_code_1.StatusCodes.Good));
1245
- bindProperty(propertyNode, camelCaseName, this.$extensionObject, basicDataType);
1246
1045
  }
1247
- (0, node_opcua_assert_1.assert)(this.$extensionObject instanceof Object);
1248
- return this.$extensionObject;
1046
+ }
1047
+ /**
1048
+ * @method bindExtensionObject
1049
+ * @return {ExtensionObject}
1050
+ */
1051
+ bindExtensionObject(optionalExtensionObject, options) {
1052
+ return (0, ua_variable_impl_ext_obj_1._bindExtensionObject)(this, optionalExtensionObject, options);
1249
1053
  }
1250
1054
  updateExtensionObjectPartial(partialExtensionObject) {
1251
- setExtensionObjectValue(this, partialExtensionObject);
1055
+ (0, ua_variable_impl_ext_obj_1.setExtensionObjectValue)(this, partialExtensionObject);
1252
1056
  return this.$extensionObject;
1253
1057
  }
1254
1058
  incrementExtensionObjectPartial(path) {
1255
- let name;
1256
- if (typeof path === "string") {
1257
- path = path.split(".");
1258
- }
1259
- (0, node_opcua_assert_1.assert)(path instanceof Array);
1260
- const extensionObject = this.constructExtensionObjectFromComponents();
1261
- let i;
1262
- // read partial value
1263
- const partialData = {};
1264
- let p = partialData;
1265
- for (i = 0; i < path.length - 1; i++) {
1266
- name = path[i];
1267
- p[name] = {};
1268
- p = p[name];
1269
- }
1270
- name = path[path.length - 1];
1271
- p[name] = 0;
1272
- let c1 = partialData;
1273
- let c2 = extensionObject;
1274
- for (i = 0; i < path.length - 1; i++) {
1275
- name = path[i];
1276
- c1 = partialData[name];
1277
- c2 = extensionObject[name];
1278
- }
1279
- name = path[path.length - 1];
1280
- c1[name] = c2[name];
1281
- c1[name] += 1;
1282
- setExtensionObjectValue(this, partialData);
1283
- }
1284
- constructExtensionObjectFromComponents() {
1285
- return this.readValue().value.value;
1059
+ const extensionObject = this.readValue().value.value;
1060
+ const partialData = (0, ua_variable_impl_ext_obj_1.extractPartialData)(path, extensionObject);
1061
+ (0, ua_variable_impl_ext_obj_1.setExtensionObjectValue)(this, partialData);
1286
1062
  }
1287
1063
  toString() {
1288
1064
  const options = new base_node_private_1.ToStringBuilder();
@@ -1357,6 +1133,14 @@ class UAVariableImpl extends base_node_impl_1.BaseNodeImpl {
1357
1133
  warningLog(dataValue.toString());
1358
1134
  throw new Error("Invalid Extension Object on nodeId =" + this.nodeId.toString());
1359
1135
  }
1136
+ // ----------------------------------
1137
+ // if (this.$extensionObject) {
1138
+ // // we have an extension object already bound to this node
1139
+ // // the client is asking us to replace the object entierly by a new one
1140
+ // const ext = dataValue.value.value;
1141
+ // _setExtensionObject(this, ext);
1142
+ // return;
1143
+ // }
1360
1144
  }
1361
1145
  // // istanbul ignore next
1362
1146
  // if (this.dataType.namespace === 0) {
@@ -1751,48 +1535,6 @@ function bind_getter(options) {
1751
1535
  }
1752
1536
  }
1753
1537
  }
1754
- function w(str, n) {
1755
- return (str + " ").substr(0, n);
1756
- }
1757
- function _getter(target, key /*, receiver*/) {
1758
- if (target[key] === undefined) {
1759
- return undefined;
1760
- }
1761
- return target[key];
1762
- }
1763
- function _setter(variable, target, key, value /*, receiver*/) {
1764
- target[key] = value;
1765
- const child = variable[key];
1766
- if (child && child.touchValue) {
1767
- child.touchValue();
1768
- }
1769
- return true; // true means the set operation has succeeded
1770
- }
1771
- function makeHandler(variable) {
1772
- const handler = {
1773
- get: _getter,
1774
- set: _setter.bind(null, variable)
1775
- };
1776
- return handler;
1777
- }
1778
- function setExtensionObjectValue(node, partialObject) {
1779
- const extensionObject = node.$extensionObject;
1780
- if (!extensionObject) {
1781
- throw new Error("setExtensionObjectValue node has no extension object " + node.browseName.toString());
1782
- }
1783
- function _update_extension_object(extObject, partialObject1) {
1784
- const keys = Object.keys(partialObject1);
1785
- for (const prop of keys) {
1786
- if (extObject[prop] instanceof Object) {
1787
- _update_extension_object(extObject[prop], partialObject1[prop]);
1788
- }
1789
- else {
1790
- extObject[prop] = partialObject1[prop];
1791
- }
1792
- }
1793
- }
1794
- _update_extension_object(extensionObject, partialObject);
1795
- }
1796
1538
  class UAVariableImplT extends UAVariableImpl {
1797
1539
  }
1798
1540
  exports.UAVariableImplT = UAVariableImplT;