node-opcua-address-space 2.164.2 → 2.165.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.
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ /**
3
+ * @module node-opcua-address-space
4
+ */
2
5
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
7
  };
@@ -6,13 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
9
  exports.BaseNodeImpl = void 0;
7
10
  exports.makeAttributeEventName = makeAttributeEventName;
8
11
  exports.getReferenceType = getReferenceType;
9
- /**
10
- * @module node-opcua-address-space
11
- */
12
- const events_1 = require("events");
12
+ const node_events_1 = require("node:events");
13
13
  const chalk_1 = __importDefault(require("chalk"));
14
14
  const lodash_1 = require("lodash");
15
15
  const node_opcua_assert_1 = require("node-opcua-assert");
16
+ const node_opcua_constants_1 = require("node-opcua-constants");
16
17
  const node_opcua_data_model_1 = require("node-opcua-data-model");
17
18
  const node_opcua_data_value_1 = require("node-opcua-data-value");
18
19
  const node_opcua_debug_1 = require("node-opcua-debug");
@@ -21,7 +22,6 @@ const node_opcua_status_code_1 = require("node-opcua-status-code");
21
22
  const node_opcua_types_1 = require("node-opcua-types");
22
23
  const node_opcua_utils_1 = require("node-opcua-utils");
23
24
  const node_opcua_variant_1 = require("node-opcua-variant");
24
- const node_opcua_constants_1 = require("node-opcua-constants");
25
25
  const dump_tools_1 = require("../source/helpers/dump_tools");
26
26
  const session_context_1 = require("../source/session_context");
27
27
  const address_space_change_event_tools_1 = require("./address_space_change_event_tools");
@@ -37,11 +37,11 @@ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
37
37
  const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
38
38
  const HasEventSourceReferenceType = (0, node_opcua_nodeid_1.resolveNodeId)("HasEventSource");
39
39
  const HasNotifierReferenceType = (0, node_opcua_nodeid_1.resolveNodeId)("HasNotifier");
40
- function defaultBrowseFilterFunc(context) {
40
+ function defaultBrowseFilterFunc(_context) {
41
41
  return true;
42
42
  }
43
43
  function _get_QualifiedBrowseName(browseName) {
44
- return (0, node_opcua_data_model_1.coerceQualifiedName)(browseName);
44
+ return (0, node_opcua_data_model_1.coerceQualifiedName)(browseName) || "";
45
45
  }
46
46
  function _is_valid_BrowseDirection(browseDirection) {
47
47
  return (browseDirection === node_opcua_data_model_1.BrowseDirection.Forward ||
@@ -50,7 +50,7 @@ function _is_valid_BrowseDirection(browseDirection) {
50
50
  }
51
51
  function makeAttributeEventName(attributeId) {
52
52
  const attributeName = node_opcua_data_model_1.attributeNameById[attributeId];
53
- return attributeName + "_changed";
53
+ return `${attributeName}_changed`;
54
54
  }
55
55
  /**
56
56
  * Base class for all Node classes
@@ -69,7 +69,7 @@ function makeAttributeEventName(attributeId) {
69
69
  *
70
70
  *
71
71
  */
72
- class BaseNodeImpl extends events_1.EventEmitter {
72
+ class BaseNodeImpl extends node_events_1.EventEmitter {
73
73
  static makeAttributeEventName(attributeId) {
74
74
  return makeAttributeEventName(attributeId);
75
75
  }
@@ -80,7 +80,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
80
80
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
81
81
  // c8 ignore next
82
82
  if (!_private) {
83
- throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
83
+ throw new Error(`Internal error , cannot extract private data from ${this.browseName.toString()}`);
84
84
  }
85
85
  return _private.__address_space;
86
86
  }
@@ -88,7 +88,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
88
88
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
89
89
  // c8 ignore next
90
90
  if (!_private) {
91
- throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
91
+ throw new Error(`Internal error , cannot extract private data from ${this.browseName.toString()}`);
92
92
  }
93
93
  return _private.__address_space;
94
94
  }
@@ -98,7 +98,8 @@ class BaseNodeImpl extends events_1.EventEmitter {
98
98
  }
99
99
  setDisplayName(value) {
100
100
  if (!Array.isArray(value)) {
101
- return this.setDisplayName([value]);
101
+ this.setDisplayName([value]);
102
+ return;
102
103
  }
103
104
  this._setDisplayName(value);
104
105
  /**
@@ -110,7 +111,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
110
111
  }
111
112
  get description() {
112
113
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
113
- return _private._description;
114
+ return _private._description || new node_opcua_data_model_1.LocalizedText({ text: "" });
114
115
  }
115
116
  setDescription(value) {
116
117
  this._setDescription(value);
@@ -224,11 +225,11 @@ class BaseNodeImpl extends events_1.EventEmitter {
224
225
  */
225
226
  this.browseName = _get_QualifiedBrowseName(options.browseName);
226
227
  // re-use browseName as displayName if displayName is missing
227
- options.displayName = options.displayName || this.browseName.name.toString();
228
+ options.displayName = options.displayName || this.browseName.name?.toString();
228
229
  if (options.description === undefined) {
229
230
  options.description = null;
230
231
  }
231
- this._setDisplayName(options.displayName);
232
+ this._setDisplayName(options.displayName || "");
232
233
  this._setDescription(options.description);
233
234
  // user defined filter function for browsing
234
235
  const _browseFilter = options.browseFilter || defaultBrowseFilterFunc;
@@ -244,9 +245,9 @@ class BaseNodeImpl extends events_1.EventEmitter {
244
245
  this._accessRestrictions = options.accessRestrictions;
245
246
  this._rolePermissions = (0, role_permissions_1.coerceRolePermissions)(options.rolePermissions);
246
247
  }
247
- getDisplayName(locale) {
248
+ getDisplayName(_locale) {
248
249
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
249
- return _private._displayName[0].text;
250
+ return _private._displayName[0].text || "";
250
251
  }
251
252
  get namespace() {
252
253
  return this.addressSpacePrivate.getNamespace(this.nodeId.namespace);
@@ -308,11 +309,11 @@ class BaseNodeImpl extends events_1.EventEmitter {
308
309
  _cache._ref = _cache._ref || new Map();
309
310
  const hash = `r|${referenceTypeNode.nodeId.toString()}|${isForward ? "f" : "b"}`;
310
311
  if (_cache._ref.has(hash)) {
311
- return _cache._ref.get(hash);
312
+ return _cache._ref.get(hash) || [];
312
313
  }
313
314
  // c8 ignore next
314
315
  if (doDebug && !this.addressSpace.findReferenceType(referenceTypeNode.nodeId)) {
315
- throw new Error("expecting valid reference name " + referenceType);
316
+ throw new Error(`expecting valid reference name ${referenceType}`);
316
317
  }
317
318
  const result = this.findReferences_no_cache(referenceTypeNode, isForward);
318
319
  _cache._ref.set(hash, result);
@@ -358,7 +359,6 @@ class BaseNodeImpl extends events_1.EventEmitter {
358
359
  if (!_cache._children) {
359
360
  _cache._children = this.findReferencesExAsObject(BaseNodeImpl._hasChild, node_opcua_data_model_1.BrowseDirection.Forward);
360
361
  }
361
- ;
362
362
  return _cache._children;
363
363
  }
364
364
  /**
@@ -460,7 +460,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
460
460
  options.value = { dataType: node_opcua_variant_1.DataType.NodeId, value: this.nodeId };
461
461
  break;
462
462
  case node_opcua_data_model_1.AttributeIds.NodeClass: // NodeClass
463
- (0, node_opcua_assert_1.assert)(isFinite(this.nodeClass));
463
+ (0, node_opcua_assert_1.assert)(Number.isFinite(this.nodeClass));
464
464
  options.value = { dataType: node_opcua_variant_1.DataType.Int32, value: this.nodeClass };
465
465
  break;
466
466
  case node_opcua_data_model_1.AttributeIds.BrowseName: // QualifiedName
@@ -500,10 +500,12 @@ class BaseNodeImpl extends events_1.EventEmitter {
500
500
  if (writeValue.attributeId === undefined ||
501
501
  writeValue.attributeId <= 0 ||
502
502
  writeValue.attributeId > node_opcua_data_model_1.AttributeIds.AccessLevelEx) {
503
- return callback(null, node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid);
503
+ callback(null, node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid);
504
+ return;
504
505
  }
505
506
  if (!this.canUserWriteAttribute(context, writeValue.attributeId)) {
506
- return callback(null, node_opcua_status_code_1.StatusCodes.BadUserAccessDenied);
507
+ callback(null, node_opcua_status_code_1.StatusCodes.BadUserAccessDenied);
508
+ return;
507
509
  }
508
510
  // by default Node is read-only,
509
511
  // this method needs to be overridden to change the behavior
@@ -514,10 +516,10 @@ class BaseNodeImpl extends events_1.EventEmitter {
514
516
  const parent = this.addressSpace.findNode(this.parentNodeId);
515
517
  // c8 ignore next
516
518
  if (parent) {
517
- return parent.fullName() + "." + this.browseName.toString() + "";
519
+ return `${parent.fullName()}.${this.browseName.toString()}`;
518
520
  }
519
521
  else {
520
- return "NOT YET REGISTERED" + this.parentNodeId.toString() + "." + this.browseName.toString() + "";
522
+ return `NOT YET REGISTERED${this.parentNodeId.toString()}.${this.browseName.toString()}`;
521
523
  }
522
524
  }
523
525
  return this.browseName.toString();
@@ -542,7 +544,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
542
544
  // The current path cannot be followed any further if no targets with the specified BrowseName exist.
543
545
  (0, node_opcua_assert_1.assert)(relativePathElement.targetName instanceof node_opcua_data_model_1.QualifiedName);
544
546
  (0, node_opcua_assert_1.assert)(relativePathElement.targetName.namespaceIndex >= 0);
545
- (0, node_opcua_assert_1.assert)(relativePathElement.targetName.name.length > 0);
547
+ (0, node_opcua_assert_1.assert)((relativePathElement.targetName.name?.length || 0) > 0);
546
548
  // The type of reference to follow from the current node.
547
549
  // The current path cannot be followed any further if the referenceTypeId is not available on the Node instance.
548
550
  // If not specified then all References are included and the parameter includeSubtypes is ignored.
@@ -586,7 +588,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
586
588
  const obj = resolveReferenceNode(this.addressSpace, reference);
587
589
  // c8 ignore next
588
590
  if (!obj) {
589
- throw new Error(" cannot find node with id " + reference.nodeId.toString());
591
+ throw new Error(` cannot find node with id ${reference.nodeId.toString()}`);
590
592
  }
591
593
  if ((0, lodash_1.isEqual)(obj.browseName, relativePathElement.targetName)) {
592
594
  // compare QualifiedName
@@ -616,7 +618,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
616
618
  *
617
619
  */
618
620
  browseNode(browseDescription, context) {
619
- (0, node_opcua_assert_1.assert)(isFinite(browseDescription.nodeClassMask));
621
+ (0, node_opcua_assert_1.assert)(Number.isFinite(browseDescription.nodeClassMask));
620
622
  const do_debug = false;
621
623
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
622
624
  const addressSpace = this.addressSpace;
@@ -667,7 +669,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
667
669
  const referenceNode = this.__addReference(reference);
668
670
  const addressSpace = this.addressSpace;
669
671
  if (!resolveReferenceType(addressSpace, referenceNode)) {
670
- throw new Error("BaseNode#addReference : invalid reference " + reference.toString());
672
+ throw new Error(`BaseNode#addReference : invalid reference ${reference.toString()}`);
671
673
  }
672
674
  _propagate_ref.call(this, addressSpace, referenceNode);
673
675
  this.install_extra_properties();
@@ -679,9 +681,13 @@ class BaseNodeImpl extends events_1.EventEmitter {
679
681
  // xx isForward is optional : assert(Object.prototype.hasOwnProperty.call(reference,"isForward"));
680
682
  (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(referenceOpts, "nodeId"));
681
683
  const addressSpace = this.addressSpace;
682
- const reference = addressSpace.normalizeReferenceTypes([referenceOpts])[0];
684
+ const reference = addressSpace.normalizeReferenceTypes([referenceOpts])?.[0];
683
685
  const h = reference.hash;
684
686
  const relatedNode = addressSpace.findNode(reference.nodeId);
687
+ // c8 ignore next
688
+ if (!relatedNode) {
689
+ return;
690
+ }
685
691
  const backwardReference = new reference_impl_1.ReferenceImpl({
686
692
  isForward: !reference.isForward,
687
693
  nodeId: this.nodeId,
@@ -695,10 +701,10 @@ class BaseNodeImpl extends events_1.EventEmitter {
695
701
  this._clear_caches();
696
702
  }
697
703
  else if (_private._back_referenceIdx.has(h)) {
698
- return relatedNode.removeReference(backwardReference);
704
+ relatedNode.removeReference(backwardReference);
699
705
  }
700
706
  else {
701
- warningLog("Cannot find reference to remove: " + reference.toString());
707
+ warningLog(`Cannot find reference to remove: ${reference.toString()}`);
702
708
  }
703
709
  }
704
710
  /**
@@ -748,12 +754,12 @@ class BaseNodeImpl extends events_1.EventEmitter {
748
754
  });
749
755
  }
750
756
  const childNode = resolveReferenceNode(addressSpace, reference);
751
- const name = (0, node_opcua_utils_1.lowerFirstLetter)(childNode.browseName.name.toString());
757
+ const name = (0, node_opcua_utils_1.lowerFirstLetter)(childNode.browseName.name || "");
752
758
  if (Object.prototype.hasOwnProperty.call(reservedNames, name)) {
753
759
  // c8 ignore next
754
760
  if (doDebug) {
755
761
  // tslint:disable-next-line:no-console
756
- debugLog(chalk_1.default.bgWhite.red("Ignoring reserved keyword " + name));
762
+ debugLog(chalk_1.default.bgWhite.red(`Ignoring reserved keyword ${name}`));
757
763
  }
758
764
  return;
759
765
  }
@@ -810,11 +816,11 @@ class BaseNodeImpl extends events_1.EventEmitter {
810
816
  findHierarchicalReferences() {
811
817
  return this.findReferencesEx("HierarchicalReferences", node_opcua_data_model_1.BrowseDirection.Forward);
812
818
  }
813
- //
819
+ //
814
820
  getChildByName(browseName, namespaceIndex) {
815
821
  var childrenMap = (0, base_node_private_1._get_HierarchicalReference)(this);
816
822
  const select = _select_by_browse_name(childrenMap, browseName, namespaceIndex);
817
- if (select.length == 0) {
823
+ if (select.length === 0) {
818
824
  return null;
819
825
  }
820
826
  const ref = select[0];
@@ -826,7 +832,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
826
832
  return null; // too early, bmy be namespace 0 is still loading
827
833
  }
828
834
  if (r.isSubtypeOf(hasChild)) {
829
- return ref.node;
835
+ return ref.node || null;
830
836
  }
831
837
  return null;
832
838
  }
@@ -843,7 +849,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
843
849
  get nodeVersion() {
844
850
  return this.getNodeVersion() || undefined;
845
851
  }
846
- set nodeVersion(n) {
852
+ set nodeVersion(_n) {
847
853
  (0, node_opcua_assert_1.assert)(false);
848
854
  }
849
855
  get toStateNode() {
@@ -884,10 +890,10 @@ class BaseNodeImpl extends events_1.EventEmitter {
884
890
  this.removeAllListeners();
885
891
  this._clear_caches();
886
892
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
887
- for (let ref of _private._back_referenceIdx.values()) {
893
+ for (const ref of _private._back_referenceIdx.values()) {
888
894
  ref.dispose();
889
895
  }
890
- for (let ref of _private._referenceIdx.values()) {
896
+ for (const ref of _private._referenceIdx.values()) {
891
897
  ref.dispose();
892
898
  }
893
899
  (0, base_node_private_1.BaseNode_removePrivate)(this);
@@ -931,7 +937,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
931
937
  return;
932
938
  }
933
939
  function chain(f1, f2) {
934
- return function chaiFunc(...args) {
940
+ return function chainingFunc(...args) {
935
941
  if (f1) {
936
942
  f1.apply(this, args);
937
943
  }
@@ -953,10 +959,10 @@ class BaseNodeImpl extends events_1.EventEmitter {
953
959
  newCache._versionNode = tmpV;
954
960
  newCache._children = tmpC;
955
961
  if (newCache._children) {
956
- newCache._children.push(childNode);
962
+ newCache._children?.push(childNode);
957
963
  }
958
964
  }
959
- _on_child_removed(obj) {
965
+ _on_child_removed(_obj) {
960
966
  // obj; // unused;
961
967
  this._clear_caches();
962
968
  }
@@ -968,13 +974,13 @@ class BaseNodeImpl extends events_1.EventEmitter {
968
974
  base_node_private_1.BaseNode_add_backward_reference.call(this, reference);
969
975
  }
970
976
  _coerceReferenceType(referenceType) {
971
- let result;
977
+ let result = null;
972
978
  if (typeof referenceType === "string") {
973
979
  result = this.addressSpace.findReferenceType(referenceType);
974
980
  /* c8 ignore next */
975
981
  if (!result) {
976
982
  errorLog("referenceType ", referenceType, " cannot be found");
977
- throw new Error("Cannot coerce reference with name " + referenceType);
983
+ throw new Error(`Cannot coerce reference with name ${referenceType}`);
978
984
  }
979
985
  }
980
986
  else if (referenceType instanceof node_opcua_nodeid_1.NodeId) {
@@ -1015,7 +1021,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
1015
1021
  _setDescription(description) {
1016
1022
  const __description = (0, node_opcua_data_model_1.coerceLocalizedText)(description);
1017
1023
  const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
1018
- _private._description = __description;
1024
+ _private._description = __description || new node_opcua_data_model_1.LocalizedText({ text: "" });
1019
1025
  }
1020
1026
  _notifyAttributeChange(attributeId) {
1021
1027
  const event_name = BaseNodeImpl.makeAttributeEventName(attributeId);
@@ -1040,7 +1046,7 @@ class BaseNodeImpl extends events_1.EventEmitter {
1040
1046
  }
1041
1047
  return context.checkPermission(this, node_opcua_types_1.PermissionType.WriteAttribute);
1042
1048
  }
1043
- _readAccessRestrictions(context) {
1049
+ _readAccessRestrictions(_context) {
1044
1050
  // https://reference.opcfoundation.org/v104/Core/docs/Part3/8.56/
1045
1051
  if (this.accessRestrictions === undefined) {
1046
1052
  return new node_opcua_data_value_1.DataValue({ statusCode: node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid });
@@ -1160,7 +1166,7 @@ function toString_ReferenceDescription(ref, options) {
1160
1166
  const addressSpace = options.addressSpace;
1161
1167
  const refNode = addressSpace.findNode(ref.referenceType);
1162
1168
  if (!refNode) {
1163
- return "Unknown Ref : " + ref;
1169
+ return `Unknown Ref : ${ref}`;
1164
1170
  }
1165
1171
  const r = new reference_impl_1.ReferenceImpl({
1166
1172
  isForward: ref.isForward,
@@ -1208,7 +1214,7 @@ function toObject(addressSpace, reference) {
1208
1214
  return obj;
1209
1215
  }
1210
1216
  function _asObject(references, addressSpace) {
1211
- return references.map((a) => toObject(addressSpace, a)).filter((o) => o != null && o != undefined);
1217
+ return references.map((a) => toObject(addressSpace, a)).filter((o) => !!o);
1212
1218
  }
1213
1219
  function _select_by_browse_name(map, browseName, namespaceIndex) {
1214
1220
  if ((namespaceIndex === null || namespaceIndex === undefined) && typeof browseName === "string") {
@@ -1223,14 +1229,18 @@ function _select_by_browse_name(map, browseName, namespaceIndex) {
1223
1229
  }
1224
1230
  else {
1225
1231
  const _browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(typeof browseName === "string" ? { name: browseName, namespaceIndex } : browseName);
1232
+ // c8 ignore next
1233
+ if (!_browseName) {
1234
+ return [];
1235
+ }
1226
1236
  const result = map.get(_browseName.name || "");
1227
1237
  if (result) {
1228
1238
  if (Array.isArray(result)) {
1229
1239
  // only select the one with the matching namepsace index
1230
- return result.filter((t) => t.node.browseName.namespaceIndex == _browseName.namespaceIndex);
1240
+ return result.filter((t) => t.node.browseName.namespaceIndex === _browseName.namespaceIndex);
1231
1241
  }
1232
1242
  else {
1233
- if (result.node.browseName.namespaceIndex == _browseName.namespaceIndex) {
1243
+ if (result.node.browseName.namespaceIndex === _browseName.namespaceIndex) {
1234
1244
  return [result];
1235
1245
  }
1236
1246
  return [];
@@ -1249,6 +1259,9 @@ function _filter_by_browse_name(components, browseName, namespaceIndex) {
1249
1259
  }
1250
1260
  else {
1251
1261
  const _browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(typeof browseName === "string" ? { name: browseName, namespaceIndex } : browseName);
1262
+ if (!_browseName) {
1263
+ return [];
1264
+ }
1252
1265
  select = components.filter((c) => c.browseName.name === _browseName.name && c.browseName.namespaceIndex === _browseName.namespaceIndex);
1253
1266
  }
1254
1267
  return select;
@@ -1343,7 +1356,7 @@ function _filter_by_referenceType(browseDescription, references, referenceTypeId
1343
1356
  const ref = resolveReferenceType(this.addressSpace, reference);
1344
1357
  // c8 ignore next
1345
1358
  if (!ref) {
1346
- throw new Error("Cannot find reference type " + reference.toString());
1359
+ throw new Error(`Cannot find reference type ${reference.toString()}`);
1347
1360
  }
1348
1361
  // unknown type ... this may happen when the address space is not fully build
1349
1362
  (0, node_opcua_assert_1.assert)(ref.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType);
@@ -1392,7 +1405,7 @@ function _filter_by_context(node, references, context) {
1392
1405
  return references.filter((reference) => !context.isBrowseAccessRestricted(resolveReferenceNode(addressSpace, reference)));
1393
1406
  }
1394
1407
  function _filter_by_nodeClass(references, nodeClassMask) {
1395
- (0, node_opcua_assert_1.assert)(isFinite(nodeClassMask));
1408
+ (0, node_opcua_assert_1.assert)(Number.isFinite(nodeClassMask));
1396
1409
  if (nodeClassMask === 0) {
1397
1410
  return references;
1398
1411
  }
@@ -1450,18 +1463,20 @@ function install_components_as_object_properties(parentObj) {
1450
1463
  continue;
1451
1464
  }
1452
1465
  // assumption: we ignore namespace here .
1453
- const name = (0, node_opcua_utils_1.lowerFirstLetter)(child.browseName.name.toString());
1466
+ const name = (0, node_opcua_utils_1.lowerFirstLetter)(child.browseName.name || "");
1454
1467
  if (Object.prototype.hasOwnProperty.call(reservedNames, name)) {
1455
1468
  // ignore reserved names
1456
1469
  if (doDebug) {
1457
- debugLog(chalk_1.default.bgWhite.red("Ignoring reserved keyword " + name));
1470
+ debugLog(chalk_1.default.bgWhite.red(`Ignoring reserved keyword ${name}`));
1458
1471
  }
1459
1472
  continue;
1460
1473
  }
1461
1474
  // ignore reserved names
1462
- doDebug && debugLog("Installing property " + name, " on ", parentObj.browseName.toString());
1475
+ doDebug && debugLog(`Installing property ${name}`, " on ", parentObj.browseName.toString());
1463
1476
  const hasProperty = Object.prototype.hasOwnProperty.call(parentObj, name);
1464
- if (hasProperty && parentObj[name] !== null && parentObj[name] !== undefined) {
1477
+ if (hasProperty &&
1478
+ parentObj[name] !== null &&
1479
+ parentObj[name] !== undefined) {
1465
1480
  continue;
1466
1481
  }
1467
1482
  Object.defineProperty(parentObj, name, {
@@ -1476,6 +1491,11 @@ function install_components_as_object_properties(parentObj) {
1476
1491
  }
1477
1492
  }
1478
1493
  function getReferenceType(reference) {
1479
- return reference._referenceType;
1494
+ const r = reference._referenceType;
1495
+ // c8 ignore next
1496
+ if (!r) {
1497
+ throw new Error("Internal error : cannot find referenceType");
1498
+ }
1499
+ return r;
1480
1500
  }
1481
1501
  //# sourceMappingURL=base_node_impl.js.map