node-opcua-address-space 2.178.0 → 2.180.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 (185) hide show
  1. package/dist/source/address_space_ts.d.ts +16 -6
  2. package/dist/source/address_space_ts.js +1 -1
  3. package/dist/source/address_space_ts.js.map +1 -1
  4. package/dist/source/helpers/argument_list.js +2 -2
  5. package/dist/source/helpers/argument_list.js.map +1 -1
  6. package/dist/source/helpers/call_helpers.js +3 -0
  7. package/dist/source/helpers/call_helpers.js.map +1 -1
  8. package/dist/source/helpers/dump_tools.js +6 -2
  9. package/dist/source/helpers/dump_tools.js.map +1 -1
  10. package/dist/source/helpers/make_optionals_map.d.ts +3 -1
  11. package/dist/source/helpers/make_optionals_map.js.map +1 -1
  12. package/dist/source/interfaces/extension_object_constructor.d.ts +1 -1
  13. package/dist/source/interfaces/state_machine/ua_state_machine_type.js +0 -1
  14. package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -1
  15. package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
  16. package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
  17. package/dist/source/loader/generateAddressSpaceRaw.js +2 -1
  18. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
  19. package/dist/source/loader/load_nodeset2.js +12 -8
  20. package/dist/source/loader/load_nodeset2.js.map +1 -1
  21. package/dist/source/loader/make_xml_extension_object_parser.js +26 -7
  22. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  23. package/dist/source/loader/namespace_post_step.js.map +1 -1
  24. package/dist/source/loader/parsers/extension_object_parser.d.ts +6 -4
  25. package/dist/source/loader/parsers/extension_object_parser.js +12 -6
  26. package/dist/source/loader/parsers/extension_object_parser.js.map +1 -1
  27. package/dist/source/loader/parsers/localized_text_parser.d.ts +1 -1
  28. package/dist/source/loader/parsers/nodeid_parser.d.ts +10 -2
  29. package/dist/source/loader/parsers/nodeid_parser.js.map +1 -1
  30. package/dist/source/loader/parsers/qualified_name_parser.d.ts +1 -2
  31. package/dist/source/loader/parsers/variant_parser.d.ts +8 -2
  32. package/dist/source/loader/parsers/variant_parser.js +11 -8
  33. package/dist/source/loader/parsers/variant_parser.js.map +1 -1
  34. package/dist/source/pseudo_session.js +70 -24
  35. package/dist/source/pseudo_session.js.map +1 -1
  36. package/dist/source/session_context.js +26 -19
  37. package/dist/source/session_context.js.map +1 -1
  38. package/dist/source/xml_writer.d.ts +1 -1
  39. package/dist/src/_instantiate_helpers.js +0 -3
  40. package/dist/src/_instantiate_helpers.js.map +1 -1
  41. package/dist/src/_mandatory_child_or_requested_optional_filter.d.ts +3 -2
  42. package/dist/src/_mandatory_child_or_requested_optional_filter.js +0 -2
  43. package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
  44. package/dist/src/address_space.d.ts +7 -2
  45. package/dist/src/address_space.js +36 -28
  46. package/dist/src/address_space.js.map +1 -1
  47. package/dist/src/address_space_private.d.ts +1 -0
  48. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +6 -9
  49. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  50. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -6
  51. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  52. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +8 -4
  53. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
  54. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  55. package/dist/src/alarms_and_conditions/ua_condition_impl.js +6 -5
  56. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  57. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +3 -0
  58. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
  59. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +0 -1
  60. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
  61. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
  62. package/dist/src/base_node_impl.js +17 -8
  63. package/dist/src/base_node_impl.js.map +1 -1
  64. package/dist/src/base_node_private.js +0 -6
  65. package/dist/src/base_node_private.js.map +1 -1
  66. package/dist/src/extension_object_array_node.d.ts +9 -1
  67. package/dist/src/extension_object_array_node.js +20 -3
  68. package/dist/src/extension_object_array_node.js.map +1 -1
  69. package/dist/src/get_basic_datatype.js +3 -1
  70. package/dist/src/get_basic_datatype.js.map +1 -1
  71. package/dist/src/historical_access/address_space_historical_data_node.js +2 -4
  72. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
  73. package/dist/src/namespace_impl.js +6 -5
  74. package/dist/src/namespace_impl.js.map +1 -1
  75. package/dist/src/nodeid_manager.js +4 -5
  76. package/dist/src/nodeid_manager.js.map +1 -1
  77. package/dist/src/nodeset_tools/construct_namespace_dependency.js +10 -11
  78. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  79. package/dist/src/nodeset_tools/dump_to_bsd.js +2 -4
  80. package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
  81. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +1 -1
  82. package/dist/src/nodeset_tools/nodeset_to_xml.js +71 -43
  83. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  84. package/dist/src/private_namespace.js.map +1 -1
  85. package/dist/src/reference_impl.d.ts +2 -2
  86. package/dist/src/reference_impl.js +5 -4
  87. package/dist/src/reference_impl.js.map +1 -1
  88. package/dist/src/state_machine/finite_state_machine.js +1 -1
  89. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  90. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
  91. package/dist/src/state_machine/ua_two_state_variable.js +9 -7
  92. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  93. package/dist/src/tool_isSubtypeOf.js.map +1 -1
  94. package/dist/src/ua_data_type_impl.js +4 -4
  95. package/dist/src/ua_data_type_impl.js.map +1 -1
  96. package/dist/src/ua_method_impl.js +21 -11
  97. package/dist/src/ua_method_impl.js.map +1 -1
  98. package/dist/src/ua_object_type_impl.d.ts +5 -2
  99. package/dist/src/ua_object_type_impl.js +4 -3
  100. package/dist/src/ua_object_type_impl.js.map +1 -1
  101. package/dist/src/ua_reference_type_impl.js +1 -2
  102. package/dist/src/ua_reference_type_impl.js.map +1 -1
  103. package/dist/src/ua_variable_impl.d.ts +9 -11
  104. package/dist/src/ua_variable_impl.js +103 -65
  105. package/dist/src/ua_variable_impl.js.map +1 -1
  106. package/dist/src/ua_variable_impl_ext_obj.d.ts +6 -6
  107. package/dist/src/ua_variable_impl_ext_obj.js +33 -22
  108. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  109. package/dist/src/ua_variable_type_impl.js +6 -2
  110. package/dist/src/ua_variable_type_impl.js.map +1 -1
  111. package/dist/tsconfig_base.tsbuildinfo +1 -1
  112. package/distHelpers/add_event_generator_object.js +3 -0
  113. package/distHelpers/add_event_generator_object.js.map +1 -1
  114. package/distHelpers/boiler_system.js +27 -6
  115. package/distHelpers/boiler_system.js.map +1 -1
  116. package/distHelpers/create_minimalist_address_space_nodeset.js +3 -3
  117. package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
  118. package/distHelpers/date_utils.js.map +1 -1
  119. package/distHelpers/dump_statemachine.js +1 -1
  120. package/distHelpers/dump_statemachine.js.map +1 -1
  121. package/distHelpers/get_address_space_fixture.js +0 -1
  122. package/distHelpers/get_address_space_fixture.js.map +1 -1
  123. package/package.json +41 -41
  124. package/source/address_space_ts.ts +19 -9
  125. package/source/helpers/argument_list.ts +2 -2
  126. package/source/helpers/call_helpers.ts +4 -1
  127. package/source/helpers/dump_tools.ts +7 -3
  128. package/source/helpers/make_optionals_map.ts +4 -2
  129. package/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.ts +4 -3
  130. package/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.ts +10 -11
  131. package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +6 -7
  132. package/source/interfaces/extension_object_constructor.ts +1 -1
  133. package/source/interfaces/state_machine/ua_program_state_machine_type.ts +0 -1
  134. package/source/interfaces/state_machine/ua_state_machine_type.ts +0 -1
  135. package/source/loader/decode_xml_extension_object.ts +3 -3
  136. package/source/loader/ensure_datatype_extracted.ts +6 -2
  137. package/source/loader/generateAddressSpaceRaw.ts +5 -4
  138. package/source/loader/load_nodeset2.ts +12 -8
  139. package/source/loader/make_xml_extension_object_parser.ts +78 -45
  140. package/source/loader/namespace_post_step.ts +1 -1
  141. package/source/loader/parsers/extension_object_parser.ts +36 -27
  142. package/source/loader/parsers/localized_text_parser.ts +1 -1
  143. package/source/loader/parsers/nodeid_parser.ts +10 -2
  144. package/source/loader/parsers/qualified_name_parser.ts +1 -1
  145. package/source/loader/parsers/variant_parser.ts +53 -40
  146. package/source/pseudo_session.ts +81 -28
  147. package/source/session_context.ts +28 -19
  148. package/source/xml_writer.ts +1 -1
  149. package/src/_instantiate_helpers.ts +0 -3
  150. package/src/_mandatory_child_or_requested_optional_filter.ts +3 -4
  151. package/src/address_space.ts +58 -42
  152. package/src/address_space_private.ts +2 -0
  153. package/src/alarms_and_conditions/condition_snapshot_impl.ts +6 -10
  154. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +5 -7
  155. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +20 -13
  156. package/src/alarms_and_conditions/ua_base_event_impl.ts +1 -1
  157. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +1 -1
  158. package/src/alarms_and_conditions/ua_condition_impl.ts +12 -10
  159. package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +8 -5
  160. package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +0 -1
  161. package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +0 -1
  162. package/src/apply_condition_refresh.ts +1 -1
  163. package/src/base_node_impl.ts +30 -35
  164. package/src/base_node_private.ts +0 -6
  165. package/src/extension_object_array_node.ts +44 -15
  166. package/src/get_basic_datatype.ts +4 -1
  167. package/src/historical_access/address_space_historical_data_node.ts +2 -5
  168. package/src/namespace_impl.ts +24 -17
  169. package/src/nodeid_manager.ts +8 -11
  170. package/src/nodeset_tools/construct_namespace_dependency.ts +18 -15
  171. package/src/nodeset_tools/dump_to_bsd.ts +6 -8
  172. package/src/nodeset_tools/nodeset_to_xml.ts +105 -75
  173. package/src/private_namespace.ts +7 -2
  174. package/src/reference_impl.ts +11 -10
  175. package/src/state_machine/finite_state_machine.ts +12 -10
  176. package/src/state_machine/ua_shelving_state_machine_ex.ts +4 -4
  177. package/src/state_machine/ua_two_state_variable.ts +12 -9
  178. package/src/tool_isSubtypeOf.ts +2 -9
  179. package/src/ua_data_type_impl.ts +4 -4
  180. package/src/ua_method_impl.ts +24 -14
  181. package/src/ua_object_type_impl.ts +12 -6
  182. package/src/ua_reference_type_impl.ts +2 -3
  183. package/src/ua_variable_impl.ts +142 -96
  184. package/src/ua_variable_impl_ext_obj.ts +110 -82
  185. package/src/ua_variable_type_impl.ts +17 -5
@@ -2,9 +2,9 @@
2
2
  * @module node-opcua-address-space.Private
3
3
  */
4
4
 
5
- import type { UADataType, UADynamicVariableArray, UAObject, UAReferenceType, UAVariable } from "node-opcua-address-space-base";
5
+ import type { BindVariableOptionsVariation1, UADynamicVariableArray, UAObject, UAVariable } from "node-opcua-address-space-base";
6
6
  import { assert } from "node-opcua-assert";
7
- import { BrowseDirection, NodeClass } from "node-opcua-data-model";
7
+ import { BrowseDirection, NodeClass, type QualifiedName, type QualifiedNameLike } from "node-opcua-data-model";
8
8
  import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
9
9
  import { ExtensionObject } from "node-opcua-extension-object";
10
10
  import type { NodeId } from "node-opcua-nodeid";
@@ -52,7 +52,11 @@ function removeElementByIndex<T extends ExtensionObject>(uaArrayVariableNode: UA
52
52
  throw new Error(" cannot find component ");
53
53
  }
54
54
 
55
- const hasComponent = uaArrayVariableNode.addressSpace.findReferenceType("HasComponent")! as UAReferenceType;
55
+ const hasComponent = uaArrayVariableNode.addressSpace.findReferenceType("HasComponent");
56
+ // c8 ignore next
57
+ if (!hasComponent) {
58
+ throw new Error("cannot find HasComponent reference type: please check your nodeset file");
59
+ }
56
60
 
57
61
  // remove the hasComponent reference toward node
58
62
  uaArrayVariableNode.removeReference({
@@ -68,11 +72,22 @@ function removeElementByIndex<T extends ExtensionObject>(uaArrayVariableNode: UA
68
72
  }
69
73
  }
70
74
 
75
+ export interface CreateExtObjArrayNodeOptions {
76
+ browseName: QualifiedNameLike;
77
+ complexVariableType: string | NodeId;
78
+ variableType: string | NodeId;
79
+ indexPropertyName: string;
80
+ minimumSamplingInterval?: number;
81
+ }
82
+
71
83
  /**
72
84
  *
73
85
  * create a node Variable that contains a array of ExtensionObject of a given type
74
86
  */
75
- export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: UAObject, options: any): UADynamicVariableArray<T> {
87
+ export function createExtObjArrayNode<T extends ExtensionObject>(
88
+ parentFolder: UAObject,
89
+ options: CreateExtObjArrayNodeOptions
90
+ ): UADynamicVariableArray<T> {
76
91
  assert(typeof options.variableType === "string");
77
92
  assert(typeof options.indexPropertyName === "string");
78
93
 
@@ -93,7 +108,10 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
93
108
  assert(!variableType.nodeId.isEmpty());
94
109
 
95
110
  const structure = addressSpace.findDataType("Structure");
96
- assert(structure, "Structure Type not found: please check your nodeset file");
111
+ // c8 ignore next
112
+ if (!structure) {
113
+ throw new Error("Structure Type not found: please check your nodeset file");
114
+ }
97
115
 
98
116
  const dataType = addressSpace.findDataType(variableType.dataType);
99
117
 
@@ -103,7 +121,7 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
103
121
  throw new Error("cannot find Data Type");
104
122
  }
105
123
 
106
- assert(dataType.isSubtypeOf(structure as any), "expecting a structure (= ExtensionObject) here ");
124
+ assert(dataType.isSubtypeOf(structure), "expecting a structure (= ExtensionObject) here ");
107
125
 
108
126
  const inner_options = {
109
127
  componentOf: parentFolder,
@@ -117,6 +135,10 @@ export function createExtObjArrayNode<T extends ExtensionObject>(parentFolder: U
117
135
 
118
136
  const uaArrayVariableNode = namespace.addVariable(inner_options) as UADynamicVariableArray<T>;
119
137
 
138
+ if (options.minimumSamplingInterval !== undefined) {
139
+ uaArrayVariableNode.minimumSamplingInterval = options.minimumSamplingInterval;
140
+ }
141
+
120
142
  bindExtObjArrayNode(uaArrayVariableNode, options.variableType, options.indexPropertyName);
121
143
 
122
144
  return uaArrayVariableNode;
@@ -134,7 +156,7 @@ function _getElementBrowseName<T extends ExtensionObject>(
134
156
  }
135
157
  // assert(extObj.constructor === addressSpace.constructExtensionObject(dataType));
136
158
  assert(Object.hasOwn(extObj, indexPropertyName1));
137
- const browseName = (extObj as any)[indexPropertyName1].toString();
159
+ const browseName = (extObj as unknown as Record<string, { toString(): string }>)[indexPropertyName1].toString();
138
160
  return browseName;
139
161
  }
140
162
 
@@ -172,18 +194,25 @@ export function bindExtObjArrayNode<T extends ExtensionObject>(
172
194
  uaArrayVariableNode.$$variableType = variableType;
173
195
 
174
196
  // verify that an object with same doesn't already exist
175
- dataType = addressSpace.findDataType(variableType.dataType)! as UADataType;
176
- assert(dataType?.isSubtypeOf(structure), "expecting a structure (= ExtensionObject) here ");
197
+ dataType = addressSpace.findDataType(variableType.dataType);
198
+ // c8 ignore next
199
+ if (!dataType) {
200
+ throw new Error(`Cannot find DataType ${variableType.dataType.toString()}`);
201
+ }
202
+ assert(dataType.isSubtypeOf(structure), "expecting a structure (= ExtensionObject) here ");
177
203
  assert(!uaArrayVariableNode.$$extensionObjectArray, "UAVariable ExtensionObject array already bounded");
178
204
  uaArrayVariableNode.$$dataType = dataType;
179
205
  uaArrayVariableNode.$$extensionObjectArray = [];
180
206
  uaArrayVariableNode.$$indexPropertyName = indexPropertyName;
181
- uaArrayVariableNode.$$getElementBrowseName = _getElementBrowseName;
207
+ // _getElementBrowseName actually returns a plain string (used opaquely via .toString() by every
208
+ // caller), while the base interface declares QualifiedName — cast to preserve exact prior runtime behavior.
209
+ uaArrayVariableNode.$$getElementBrowseName = _getElementBrowseName as unknown as (obj: T, index: number) => QualifiedName;
182
210
  uaArrayVariableNode.$dataValue.value.value = uaArrayVariableNode.$$extensionObjectArray;
183
211
  uaArrayVariableNode.$dataValue.value.arrayType = VariantArrayType.Array;
184
212
 
185
- const bindOptions: any = {
186
- get: getExtObjArrayNodeValue,
213
+ const bindOptions: BindVariableOptionsVariation1 = {
214
+ // getExtObjArrayNodeValue is generic over `this: UADynamicVariableArray<T>`, narrower than GetFunc's `this: UAVariable`
215
+ get: getExtObjArrayNodeValue as unknown as BindVariableOptionsVariation1["get"],
187
216
  set: undefined // readonly
188
217
  };
189
218
  // bind the readonly
@@ -217,7 +246,7 @@ export function addElement<T extends ExtensionObject>(
217
246
 
218
247
  let extensionObject: T;
219
248
  let elVar = null;
220
- let browseName;
249
+ let browseName: QualifiedName;
221
250
 
222
251
  if (options instanceof UAVariableImpl) {
223
252
  elVar = options;
@@ -286,7 +315,7 @@ export function removeElement<T extends ExtensionObject>(
286
315
  } else if (element?.nodeClass) {
287
316
  // find element by name
288
317
  const browseNameToFind = element.browseName.name?.toString();
289
- elementIndex = _array.findIndex((obj: any, _i: number) => {
318
+ elementIndex = _array.findIndex((obj: T, _i: number) => {
290
319
  const browseName = uaArrayVariableNode.$$getElementBrowseName(obj, elementIndex).toString();
291
320
  return browseName === browseNameToFind;
292
321
  });
@@ -298,5 +327,5 @@ export function removeElement<T extends ExtensionObject>(
298
327
  if (elementIndex < 0) {
299
328
  throw new Error(`removeElement: cannot find element matching ${element.toString()}`);
300
329
  }
301
- return removeElementByIndex(uaArrayVariableNode, elementIndex);
330
+ removeElementByIndex(uaArrayVariableNode, elementIndex);
302
331
  }
@@ -14,7 +14,10 @@ export function _getBasicDataTypeFromDataTypeNodeId(
14
14
  addressSpace: IAddressSpace,
15
15
  dataTypeNodeId: { nodeId: NodeIdLike } | NodeIdLike
16
16
  ): DataType {
17
- const dataTypeNodeId_ = (dataTypeNodeId as any).nodeId ? (dataTypeNodeId as any).nodeId : dataTypeNodeId;
17
+ const dataTypeNodeId_ =
18
+ typeof dataTypeNodeId === "object" && dataTypeNodeId !== null && "nodeId" in dataTypeNodeId
19
+ ? dataTypeNodeId.nodeId
20
+ : dataTypeNodeId;
18
21
  const dataTypeNode = addressSpace.findDataType(dataTypeNodeId_);
19
22
  if (!dataTypeNode) {
20
23
  return DataType.Null;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * @module node-opcua-address-space
3
3
  */
4
- // tslint:disable:no-console
5
4
 
6
5
  import chalk from "chalk";
7
6
  import type {
@@ -35,7 +34,6 @@ import { UAVariableImpl } from "../ua_variable_impl";
35
34
 
36
35
  const warningLog = make_warningLog(__filename);
37
36
 
38
- // tslint:disable:no-var-requires
39
37
  interface DequeueItem<T> {
40
38
  data: T | null;
41
39
  next: DequeueItem<T>;
@@ -716,7 +714,7 @@ export function AddressSpace_installHistoricalDataNode(
716
714
  };
717
715
 
718
716
  assert(node.nodeClass === NodeClass.Variable);
719
- options = options || Object.create(null);
717
+ const historianOptions: IVariableHistorianOptions = options || Object.create(null);
720
718
 
721
719
  const addressSpace = node.addressSpace;
722
720
 
@@ -729,7 +727,7 @@ export function AddressSpace_installHistoricalDataNode(
729
727
  node._historyReadRaw = _historyReadRaw;
730
728
  node._historyReadRawAsync = _historyReadRawAsync;
731
729
 
732
- node.varHistorian = (options as { historian?: boolean }).historian || AddressSpace.historizerFactory.create(node, options);
730
+ node.varHistorian = historianOptions.historian || AddressSpace.historizerFactory.create(node, historianOptions);
733
731
 
734
732
  const historicalDataConfigurationType = addressSpace.findObjectType("HistoricalDataConfigurationType");
735
733
  if (!historicalDataConfigurationType) {
@@ -737,7 +735,6 @@ export function AddressSpace_installHistoricalDataNode(
737
735
  }
738
736
  node.historizing = true;
739
737
 
740
- // tslint:disable:no-bitwise
741
738
  node.accessLevel = node.accessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
742
739
  if (node.userAccessLevel !== undefined) {
743
740
  node.userAccessLevel = node.userAccessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * @module node-opcua-address-space
3
3
  */
4
- // tslint:disable:no-console
5
4
  import chalk from "chalk";
6
5
  import type {
7
6
  AddBaseNodeOptions,
@@ -16,7 +15,7 @@ import type {
16
15
  AddViewOptions,
17
16
  AddYArrayItemOptions,
18
17
  BaseNode,
19
-
18
+ BaseNodeEvents,
20
19
  CreateDataTypeOptions,
21
20
  CreateNodeOptions,
22
21
  EnumerationItem,
@@ -102,7 +101,6 @@ import {
102
101
  UAConditionImplBase,
103
102
  UADiscreteAlarmImplBase
104
103
  } from "./alarms_and_conditions";
105
- import { UADiscreteAlarmImpl } from "./alarms_and_conditions/ua_discrete_alarm_impl";
106
104
  import { UAExclusiveDeviationAlarmImplBase } from "./alarms_and_conditions/ua_exclusive_deviation_alarm_impl";
107
105
  import { UAExclusiveLimitAlarmImplBase } from "./alarms_and_conditions/ua_exclusive_limit_alarm_impl";
108
106
  import { UALimitAlarmImplBase } from "./alarms_and_conditions/ua_limit_alarm_impl";
@@ -1019,7 +1017,7 @@ export class NamespaceImpl implements NamespacePrivate {
1019
1017
 
1020
1018
  instrumentRange.on("value_changed", handler);
1021
1019
  }
1022
- (variable as any).acceptValueOutOfRange = options.acceptValueOutOfRange;
1020
+ (variable as unknown as { acceptValueOutOfRange?: boolean }).acceptValueOutOfRange = options.acceptValueOutOfRange;
1023
1021
 
1024
1022
  if (Object.hasOwn(options, "engineeringUnits")) {
1025
1023
  const engineeringUnits = new EUInformation(options.engineeringUnits);
@@ -1209,7 +1207,7 @@ export class NamespaceImpl implements NamespacePrivate {
1209
1207
  })
1210
1208
  );
1211
1209
 
1212
- return variable as any;
1210
+ return variable as unknown as UAYArrayItemEx<DT>;
1213
1211
  }
1214
1212
 
1215
1213
  // - Methods ----------------------------------------------------------------------------------------------------
@@ -1424,7 +1422,7 @@ export class NamespaceImpl implements NamespacePrivate {
1424
1422
  // or OptionSet DataType. It is derived from the DataType EnumValueType. If used for an
1425
1423
  // OptionSet, the corresponding Value in the base type contains the number of the bit associated
1426
1424
  // with the field. The EnumField is formally defined in Table 37.
1427
- (enumType as any).$fullDefinition = new EnumDefinition({
1425
+ (enumType as unknown as { $fullDefinition?: EnumDefinition }).$fullDefinition = new EnumDefinition({
1428
1426
  fields: enumeration.map(
1429
1427
  (x: string, index: number) =>
1430
1428
  new EnumField({
@@ -1463,7 +1461,7 @@ export class NamespaceImpl implements NamespacePrivate {
1463
1461
  });
1464
1462
  assert(enumValues.browseName.toString() === "EnumValues");
1465
1463
 
1466
- (enumType as any).$fullDefinition = new EnumDefinition({
1464
+ (enumType as unknown as { $fullDefinition?: EnumDefinition }).$fullDefinition = new EnumDefinition({
1467
1465
  fields: enumeration.map(
1468
1466
  (x: EnumerationItem, _index: number) =>
1469
1467
  new EnumField({
@@ -1804,7 +1802,6 @@ export class NamespaceImpl implements NamespacePrivate {
1804
1802
  case NodeClass.View:
1805
1803
  break;
1806
1804
  default:
1807
- // tslint:disable-next-line:no-console
1808
1805
  errorLog("Invalid class Name", node.nodeClass);
1809
1806
  throw new Error("Invalid class name specified");
1810
1807
  }
@@ -1885,8 +1882,7 @@ export class NamespaceImpl implements NamespacePrivate {
1885
1882
 
1886
1883
  options.addressSpace = this.addressSpace as AddressSpacePrivate;
1887
1884
 
1888
- // biome-ignore lint/suspicious/noExplicitAny: to fix later
1889
- const node = new Constructor(options as any);
1885
+ const node = new Constructor(options);
1890
1886
  this._register(node);
1891
1887
 
1892
1888
  // object shall now be registered
@@ -1918,7 +1914,6 @@ export class NamespaceImpl implements NamespacePrivate {
1918
1914
  case NodeClass.View:
1919
1915
  break;
1920
1916
  default:
1921
- // tslint:disable:no-console
1922
1917
  warningLog("Invalid class Name", node.nodeClass);
1923
1918
  throw new Error("Invalid class name specified");
1924
1919
  }
@@ -1948,15 +1943,23 @@ export class NamespaceImpl implements NamespacePrivate {
1948
1943
  }
1949
1944
  const references: UAReference[] = [];
1950
1945
 
1951
- function process_subtypeOf_options(this: NamespaceImpl, options2: any, references1: AddReferenceOpts[]) {
1946
+ function process_subtypeOf_options(this: NamespaceImpl, options2: CreateNodeOptions, references1: AddReferenceOpts[]) {
1952
1947
  // check common misspelling mistake
1953
- assert(!options2.subTypeOf, "misspell error : it should be 'subtypeOf' instead");
1948
+ assert(
1949
+ !(options2 as unknown as Record<string, unknown>).subTypeOf,
1950
+ "misspell error : it should be 'subtypeOf' instead"
1951
+ );
1954
1952
  if (Object.hasOwn(options2, "hasTypeDefinition")) {
1955
1953
  throw new Error("hasTypeDefinition option is invalid. Do you mean typeDefinition instead ?");
1956
1954
  }
1957
1955
  assert(!options2.typeDefinition, " do you mean subtypeOf ?");
1958
1956
 
1959
- const subtypeOfNodeId = addressSpace._coerceType(options2.subtypeOf, topMostBaseType, nodeClass);
1957
+ // subtypeOf is optional: _coerceType defaults to topMostBaseType when it's falsy.
1958
+ const subtypeOfNodeId = addressSpace._coerceType(
1959
+ options2.subtypeOf as unknown as string | NodeId | BaseNode,
1960
+ topMostBaseType,
1961
+ nodeClass
1962
+ );
1960
1963
 
1961
1964
  assert(subtypeOfNodeId);
1962
1965
  references1.push({
@@ -2142,7 +2145,7 @@ export class NamespaceImpl implements NamespacePrivate {
2142
2145
  /**
2143
2146
  * @private
2144
2147
  */
2145
- private _addMethod(options: any): UAMethod {
2148
+ private _addMethod(options: AddMethodOptions & { eventNotifier?: number }): UAMethod {
2146
2149
  const addressSpace = this.addressSpace;
2147
2150
 
2148
2151
  assert(isNonEmptyQualifiedName(options.browseName));
@@ -2158,7 +2161,7 @@ export class NamespaceImpl implements NamespacePrivate {
2158
2161
  browseName: options.browseName,
2159
2162
  description: options.description || "",
2160
2163
  displayName: options.displayName,
2161
- eventNotifier: +options.eventNotifier,
2164
+ eventNotifier: +(options.eventNotifier || 0),
2162
2165
  isAbstract: false,
2163
2166
  nodeClass: NodeClass.Method,
2164
2167
  nodeId: options.nodeId,
@@ -2173,7 +2176,11 @@ export class NamespaceImpl implements NamespacePrivate {
2173
2176
  }
2174
2177
  }
2175
2178
 
2176
- const _constructors_map: Record<keyof Omit<typeof NodeClass, "Unspecified">, new (options: any) => BaseNodeImpl<any>> = {
2179
+ // each concrete constructor below takes a different, incompatible options type (UADataTypeOptions,
2180
+ // UAVariableOptions, ...) — the map is only ever indexed by nodeClass and invoked with the matching
2181
+ // options shape by the caller, so a wider `new (options: any) => ...` signature is required here.
2182
+ // biome-ignore lint/suspicious/noExplicitAny: see comment above
2183
+ const _constructors_map: Record<keyof Omit<typeof NodeClass, "Unspecified">, new (options: any) => BaseNodeImpl<BaseNodeEvents>> = {
2177
2184
  DataType: UADataTypeImpl,
2178
2185
  Method: UAMethodImpl,
2179
2186
  Object: UAObjectImpl,
@@ -1,13 +1,10 @@
1
- /* eslint-disable max-depth */
2
- /* eslint-disable max-statements */
3
-
4
1
  import type { BaseNode, UAReference, UAReferenceType } from "node-opcua-address-space-base";
5
2
  import { assert } from "node-opcua-assert";
6
3
  import { NodeClass, type QualifiedName, type QualifiedNameOptions } from "node-opcua-data-model";
7
4
  import { make_debugLog, make_warningLog } from "node-opcua-debug";
8
5
  import { makeNodeId, NodeId, type NodeIdLike, NodeIdType, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
9
- import { BaseNodeImpl, getReferenceType } from "./base_node_impl";
10
- import { resolveReferenceType } from "./reference_impl";
6
+ import { BaseNodeImpl } from "./base_node_impl";
7
+ import { type ReferenceImpl, resolveReferenceType } from "./reference_impl";
11
8
 
12
9
  const _debugLog = make_debugLog(__filename);
13
10
  const _warningLog = make_warningLog(__filename);
@@ -16,7 +13,7 @@ export const NamespaceOptions = {
16
13
  nodeIdNameSeparator: "-"
17
14
  };
18
15
  function _isValidNodeClass(nodeClass: NodeClass) {
19
- return typeof (NodeClass as any)[nodeClass] === "string";
16
+ return typeof NodeClass[nodeClass] === "string";
20
17
  }
21
18
 
22
19
  const regExp1 = /^(s|i|b|g)=/;
@@ -59,12 +56,13 @@ function _findParentNodeId(addressSpace: AddressSpacePartial, options: Construct
59
56
  return null;
60
57
  }
61
58
  for (const ref of options.references) {
62
- (ref as any)._referenceType = addressSpace.findReferenceType(ref.referenceType);
59
+ const _ref = ref as ReferenceImpl;
60
+ _ref._referenceType = addressSpace.findReferenceType(ref.referenceType) ?? undefined;
63
61
  /* c8 ignore next */
64
- if (!getReferenceType(ref)) {
62
+ if (!_ref._referenceType) {
65
63
  throw new Error(`Cannot find referenceType ${JSON.stringify(ref)}`);
66
64
  }
67
- (ref as any).referenceType = (ref as any)._referenceType.nodeId;
65
+ _ref.referenceType = _ref._referenceType.nodeId;
68
66
  }
69
67
  // find HasComponent, or has Property reverse
70
68
  return _filterAggregates(addressSpace, options.references);
@@ -105,7 +103,7 @@ export class NodeIdManager {
105
103
 
106
104
  public setSymbols(symbols: NodeEntry1[]): void {
107
105
  function convertNodeClass(nodeClass: string): NodeClass {
108
- return (NodeClass as any)[nodeClass as any] as NodeClass;
106
+ return (NodeClass as unknown as Record<string, NodeClass>)[nodeClass];
109
107
  }
110
108
  const symbols2 = symbols.map((e: [string, number, string]) => [e[0] as string, e[1] as number, convertNodeClass(e[2])]) as [
111
109
  string,
@@ -243,7 +241,6 @@ export class NodeIdManager {
243
241
  }
244
242
 
245
243
  private _constructNodeId(options: ConstructNodeIdOptions): NodeId {
246
-
247
244
  const resolveNodeIdEx = (nodeId: BaseNode | NodeIdLike) =>
248
245
  nodeId && typeof nodeId === "object" && nodeId instanceof BaseNodeImpl
249
246
  ? nodeId.nodeId
@@ -18,7 +18,6 @@ interface RequiredModel {
18
18
  requiredNamespaceIndexes: number[];
19
19
  nbTypes: number;
20
20
  }
21
- // eslint-disable-next-line max-statements, complexity
22
21
  export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?: Map<number, RequiredModel>): RequiredModel {
23
22
  if (namespace.index === 0) {
24
23
  return { requiredNamespaceIndexes: [], nbTypes: 1 };
@@ -103,12 +102,12 @@ export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?:
103
102
  if (!uaVariable.$dataValue) return;
104
103
  const variant = uaVariable.$dataValue.value;
105
104
  if (!variant) return;
106
- const value: any | any[] = variant.value;
105
+ const value: unknown = variant.value;
107
106
  if (!value) return;
108
107
  if (Array.isArray(value)) {
109
- value.forEach(exploreExtensionObject);
108
+ (value as ExtensionObject[]).forEach(exploreExtensionObject);
110
109
  } else {
111
- exploreExtensionObject(value);
110
+ exploreExtensionObject(value as ExtensionObject);
112
111
  }
113
112
  }
114
113
  for (const node of namespace_.nodeIterator()) {
@@ -132,7 +131,7 @@ export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?:
132
131
  } else if (isInstance !== -1) {
133
132
  if (node.nodeClass === NodeClass.Variable || node.nodeClass === NodeClass.VariableType) {
134
133
  const dataTypeNodeId = (node as UAVariable | UAVariableType).dataType;
135
- const dataTypeNode = addressSpace.findDataType(dataTypeNodeId)!;
134
+ const dataTypeNode = addressSpace.findDataType(dataTypeNodeId);
136
135
  if (dataTypeNode) {
137
136
  consider(dataTypeNode.nodeId.namespace);
138
137
  } else {
@@ -236,9 +235,11 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
236
235
  // always include the target namespace as a dependency
237
236
  // regardless of priority, since the current node owns
238
237
  // this relationship.
239
- if (reference.isForward
240
- && nonHierarchicalReferencesType
241
- && referenceType.isSubtypeOf(nonHierarchicalReferencesType)) {
238
+ if (
239
+ reference.isForward &&
240
+ nonHierarchicalReferencesType &&
241
+ referenceType.isSubtypeOf(nonHierarchicalReferencesType)
242
+ ) {
242
243
  consider(namespaceIndexOfTargetNode);
243
244
  }
244
245
  // For inverse HierarchicalReferences (e.g. Organizes),
@@ -246,9 +247,11 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
246
247
  // regardless of priority, since the reference is
247
248
  // stored on this node (organizedBy pattern).
248
249
  const hierarchicalReferencesType = addressSpace.findReferenceType("HierarchicalReferences");
249
- if (!reference.isForward
250
- && hierarchicalReferencesType
251
- && referenceType.isSubtypeOf(hierarchicalReferencesType)) {
250
+ if (
251
+ !reference.isForward &&
252
+ hierarchicalReferencesType &&
253
+ referenceType.isSubtypeOf(hierarchicalReferencesType)
254
+ ) {
252
255
  consider(namespaceIndexOfTargetNode);
253
256
  }
254
257
  }
@@ -313,14 +316,14 @@ export function constructNamespacePriorityTable(addressSpace: IAddressSpace): {
313
316
  };
314
317
 
315
318
  for (let i = 0; i < namespaces.length; i++) {
316
- const { nbTypes } = map.get(i)!;
317
- if (nbTypes) {
319
+ const entry = map.get(i);
320
+ if (entry?.nbTypes) {
318
321
  h(namespaces[i]);
319
322
  }
320
323
  }
321
324
  for (let i = 0; i < namespaces.length; i++) {
322
- const { nbTypes } = map.get(i)!;
323
- if (!nbTypes) {
325
+ const entry = map.get(i);
326
+ if (!entry?.nbTypes) {
324
327
  h(namespaces[i]);
325
328
  }
326
329
  }
@@ -7,7 +7,6 @@ import type { AddressSpacePrivate } from "../address_space_private";
7
7
  import type { NamespacePrivate } from "../namespace_private";
8
8
  import { constructNamespaceDependency } from "./construct_namespace_dependency";
9
9
 
10
- // tslint:disable-next-line: no-var-requires
11
10
  const XMLWriter = require("xml-writer");
12
11
 
13
12
  function dumpEnumeratedType(xw: XmlWriter, e: EnumDefinition, name: string): void {
@@ -16,7 +15,7 @@ function dumpEnumeratedType(xw: XmlWriter, e: EnumDefinition, name: string): voi
16
15
  xw.writeAttribute("LengthInBits", "32");
17
16
  for (const f of e.fields || []) {
18
17
  xw.startElement("opc:EnumeratedValue");
19
- xw.writeAttribute("Name", f.name|| "");
18
+ xw.writeAttribute("Name", f.name || "");
20
19
  assert(f.value[0] === 0, "unsupported 64 bit value !");
21
20
  xw.writeAttribute("Value", f.value[1].toString());
22
21
  xw.endElement();
@@ -32,7 +31,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number, string
32
31
  if (!node) {
33
32
  throw new Error(`Cannot find Node for${nodeId?.toString()}`);
34
33
  }
35
- const typeName = node.browseName.name!;
34
+ const typeName = node.browseName.name || "";
36
35
 
37
36
  const n = node.nodeId as INodeId;
38
37
  const prefix =
@@ -44,7 +43,6 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number, string
44
43
  return `${prefix}:${typeName === "Structure" && prefix === "ua" ? "ExtensionObject" : typeName}`;
45
44
  }
46
45
 
47
- // eslint-disable-next-line max-statements
48
46
  function dumpDataTypeStructure(
49
47
  xw: XmlWriter,
50
48
  addressSpace: IAddressSpace,
@@ -110,7 +108,7 @@ function dumpDataTypeStructure(
110
108
 
111
109
  if (isArray) {
112
110
  xw.startElement("opc:Field");
113
- xw.writeAttribute("Name", `NoOf${f.name!}`);
111
+ xw.writeAttribute("Name", `NoOf${f.name || ""}`);
114
112
  xw.writeAttribute("TypeName", "opc:Int32");
115
113
  if (f.isOptional) {
116
114
  xw.writeAttribute("SwitchField", `${f.name}Specified`);
@@ -119,15 +117,15 @@ function dumpDataTypeStructure(
119
117
  }
120
118
 
121
119
  xw.startElement("opc:Field");
122
- xw.writeAttribute("Name", f.name|| "");
120
+ xw.writeAttribute("Name", f.name || "");
123
121
 
124
122
  const typeName = buildXmlName(addressSpace as AddressSpacePrivate, map, f.dataType);
125
123
  xw.writeAttribute("TypeName", typeName);
126
124
  if (isArray) {
127
- xw.writeAttribute("LengthField", `NoOf${f.name|| ""}`);
125
+ xw.writeAttribute("LengthField", `NoOf${f.name || ""}`);
128
126
  }
129
127
  if (f.isOptional) {
130
- xw.writeAttribute("SwitchField", `${f.name|| ""}Specified`);
128
+ xw.writeAttribute("SwitchField", `${f.name || ""}Specified`);
131
129
  }
132
130
  xw.endElement();
133
131
  }