node-opcua-address-space 2.136.0 → 2.138.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 (270) hide show
  1. package/dist/source/helpers/adjust_browse_direction.js +1 -2
  2. package/dist/source/helpers/adjust_browse_direction.js.map +1 -1
  3. package/dist/source/helpers/argument_list.js +6 -7
  4. package/dist/source/helpers/argument_list.js.map +1 -1
  5. package/dist/source/helpers/call_helpers.js +1 -2
  6. package/dist/source/helpers/call_helpers.js.map +1 -1
  7. package/dist/source/helpers/coerce_enum_value.js +1 -2
  8. package/dist/source/helpers/coerce_enum_value.js.map +1 -1
  9. package/dist/source/helpers/dump_tools.js +5 -6
  10. package/dist/source/helpers/dump_tools.js.map +1 -1
  11. package/dist/source/helpers/ensure_secure_access.js +1 -2
  12. package/dist/source/helpers/ensure_secure_access.js.map +1 -1
  13. package/dist/source/helpers/make_optionals_map.d.ts +1 -3
  14. package/dist/source/helpers/make_optionals_map.js +7 -4
  15. package/dist/source/helpers/make_optionals_map.js.map +1 -1
  16. package/dist/source/helpers/multiform_func.js +2 -3
  17. package/dist/source/helpers/multiform_func.js.map +1 -1
  18. package/dist/source/helpers/resolve_opaque_on_address_space.js +1 -2
  19. package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -1
  20. package/dist/source/index.d.ts +2 -0
  21. package/dist/source/index.js +2 -0
  22. package/dist/source/index.js.map +1 -1
  23. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +0 -3
  24. package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.d.ts +0 -2
  25. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +0 -2
  26. package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.js.map +1 -1
  27. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +1 -1
  28. package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.d.ts +1 -2
  29. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +1 -0
  30. package/dist/source/loader/decode_xml_extension_object.d.ts +1 -1
  31. package/dist/source/loader/decode_xml_extension_object.js +4 -5
  32. package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
  33. package/dist/source/loader/ensure_datatype_extracted.js +32 -4
  34. package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
  35. package/dist/source/loader/generateAddressSpaceRaw.js +3 -4
  36. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
  37. package/dist/source/loader/load_nodeset2.js +145 -737
  38. package/dist/source/loader/load_nodeset2.js.map +1 -1
  39. package/dist/source/loader/make_semver_compatible.js +1 -2
  40. package/dist/source/loader/make_semver_compatible.js.map +1 -1
  41. package/dist/source/loader/make_xml_extension_object_parser.d.ts +1 -6
  42. package/dist/source/loader/make_xml_extension_object_parser.js +52 -73
  43. package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
  44. package/dist/source/loader/namespace_post_step.d.ts +4 -6
  45. package/dist/source/loader/namespace_post_step.js +5 -5
  46. package/dist/source/loader/namespace_post_step.js.map +1 -1
  47. package/dist/source/loader/parsers/extension_object_parser.d.ts +51 -0
  48. package/dist/source/loader/parsers/extension_object_parser.js +269 -0
  49. package/dist/source/loader/parsers/extension_object_parser.js.map +1 -0
  50. package/dist/source/loader/parsers/localized_text_parser.d.ts +25 -0
  51. package/dist/source/loader/parsers/localized_text_parser.js +30 -0
  52. package/dist/source/loader/parsers/localized_text_parser.js.map +1 -0
  53. package/dist/source/loader/parsers/nodeid_parser.d.ts +11 -0
  54. package/dist/source/loader/parsers/nodeid_parser.js +20 -0
  55. package/dist/source/loader/parsers/nodeid_parser.js.map +1 -0
  56. package/dist/source/loader/parsers/qualified_name_parser.d.ts +26 -0
  57. package/dist/source/loader/parsers/qualified_name_parser.js +35 -0
  58. package/dist/source/loader/parsers/qualified_name_parser.js.map +1 -0
  59. package/dist/source/loader/parsers/variant_parser.d.ts +29 -0
  60. package/dist/source/loader/parsers/variant_parser.js +328 -0
  61. package/dist/source/loader/parsers/variant_parser.js.map +1 -0
  62. package/dist/source/loader/register_node_promoter.js +2 -3
  63. package/dist/source/loader/register_node_promoter.js.map +1 -1
  64. package/dist/source/pseudo_session.d.ts +0 -2
  65. package/dist/source/pseudo_session.js +3 -3
  66. package/dist/source/pseudo_session.js.map +1 -1
  67. package/dist/source/session_context.d.ts +1 -1
  68. package/dist/source/session_context.js +3 -3
  69. package/dist/source/session_context.js.map +1 -1
  70. package/dist/source/set_namespace_meta_data.js +1 -2
  71. package/dist/source/set_namespace_meta_data.js.map +1 -1
  72. package/dist/source/ua_addin.d.ts +11 -0
  73. package/dist/source/ua_addin.js +42 -0
  74. package/dist/source/ua_addin.js.map +1 -0
  75. package/dist/source/ua_interface.d.ts +3 -0
  76. package/dist/source/ua_interface.js +45 -0
  77. package/dist/source/ua_interface.js.map +1 -0
  78. package/dist/source/xml_writer.d.ts +3 -5
  79. package/dist/src/_instantiate_helpers.d.ts +1 -1
  80. package/dist/src/_instantiate_helpers.js +7 -8
  81. package/dist/src/_instantiate_helpers.js.map +1 -1
  82. package/dist/src/_mandatory_child_or_requested_optional_filter.d.ts +3 -1
  83. package/dist/src/_mandatory_child_or_requested_optional_filter.js +6 -5
  84. package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
  85. package/dist/src/address_space.d.ts +1 -5
  86. package/dist/src/address_space.js +1 -1
  87. package/dist/src/address_space.js.map +1 -1
  88. package/dist/src/address_space_change_event_tools.js +3 -4
  89. package/dist/src/address_space_change_event_tools.js.map +1 -1
  90. package/dist/src/alarms_and_conditions/condition.d.ts +4 -7
  91. package/dist/src/alarms_and_conditions/condition.js +1 -25
  92. package/dist/src/alarms_and_conditions/condition.js.map +1 -1
  93. package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +2 -20
  94. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +211 -234
  95. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
  96. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +4 -5
  97. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -1
  98. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +0 -2
  99. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -2
  100. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
  101. package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -1
  102. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +0 -2
  103. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +3 -3
  104. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
  105. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +0 -2
  106. package/dist/src/alarms_and_conditions/ua_condition_impl.js +10 -12
  107. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
  108. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
  109. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +1 -1
  110. package/dist/src/apply_condition_refresh.d.ts +1 -3
  111. package/dist/src/apply_condition_refresh.js +4 -5
  112. package/dist/src/apply_condition_refresh.js.map +1 -1
  113. package/dist/src/base_node_impl.d.ts +0 -1
  114. package/dist/src/base_node_impl.js +11 -11
  115. package/dist/src/base_node_impl.js.map +1 -1
  116. package/dist/src/base_node_private.d.ts +4 -7
  117. package/dist/src/base_node_private.js +23 -25
  118. package/dist/src/base_node_private.js.map +1 -1
  119. package/dist/src/check_value_rank_compatibility.js +1 -2
  120. package/dist/src/check_value_rank_compatibility.js.map +1 -1
  121. package/dist/src/data_access/add_dataItem_stuff.js +1 -2
  122. package/dist/src/data_access/add_dataItem_stuff.js.map +1 -1
  123. package/dist/src/data_access/adjust_datavalue_status_code.js +1 -2
  124. package/dist/src/data_access/adjust_datavalue_status_code.js.map +1 -1
  125. package/dist/src/data_access/ua_multistate_discrete_impl.js +3 -3
  126. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
  127. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +5 -5
  128. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
  129. package/dist/src/data_access/ua_two_state_discrete_impl.js +3 -3
  130. package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
  131. package/dist/src/extension_object_array_node.js +4 -5
  132. package/dist/src/extension_object_array_node.js.map +1 -1
  133. package/dist/src/get_basic_datatype.js +2 -3
  134. package/dist/src/get_basic_datatype.js.map +1 -1
  135. package/dist/src/historical_access/address_space_historical_data_node.js +5 -5
  136. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
  137. package/dist/src/index_current.d.ts +3 -1
  138. package/dist/src/index_current.js +3 -1
  139. package/dist/src/index_current.js.map +1 -1
  140. package/dist/src/namespace_impl.d.ts +1 -9
  141. package/dist/src/namespace_impl.js +19 -12
  142. package/dist/src/namespace_impl.js.map +1 -1
  143. package/dist/src/namespace_private.js +1 -2
  144. package/dist/src/namespace_private.js.map +1 -1
  145. package/dist/src/nodeid_manager.js +35 -10
  146. package/dist/src/nodeid_manager.js.map +1 -1
  147. package/dist/src/nodeset_tools/adjust_namespace_array.js +1 -2
  148. package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -1
  149. package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +2 -2
  150. package/dist/src/nodeset_tools/construct_namespace_dependency.js +12 -12
  151. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
  152. package/dist/src/nodeset_tools/dump_to_bsd.js +5 -6
  153. package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
  154. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +1 -1
  155. package/dist/src/nodeset_tools/nodeset_to_xml.js +53 -46
  156. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  157. package/dist/src/private_namespace.js +4 -5
  158. package/dist/src/private_namespace.js.map +1 -1
  159. package/dist/src/reference_impl.js +4 -4
  160. package/dist/src/reference_impl.js.map +1 -1
  161. package/dist/src/role_permissions.js +1 -2
  162. package/dist/src/role_permissions.js.map +1 -1
  163. package/dist/src/state_machine/finite_state_machine.js +6 -6
  164. package/dist/src/state_machine/finite_state_machine.js.map +1 -1
  165. package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +0 -1
  166. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +2 -2
  167. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
  168. package/dist/src/state_machine/ua_two_state_variable.js +4 -4
  169. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
  170. package/dist/src/tool_isSubtypeOf.d.ts +1 -1
  171. package/dist/src/tool_isSubtypeOf.js +18 -16
  172. package/dist/src/tool_isSubtypeOf.js.map +1 -1
  173. package/dist/src/ua_addin.d.ts +11 -0
  174. package/dist/src/ua_addin.js +43 -0
  175. package/dist/src/ua_addin.js.map +1 -0
  176. package/dist/src/ua_data_type_impl.js +7 -6
  177. package/dist/src/ua_data_type_impl.js.map +1 -1
  178. package/dist/src/ua_object_type_impl.d.ts +1 -0
  179. package/dist/src/ua_object_type_impl.js +4 -1
  180. package/dist/src/ua_object_type_impl.js.map +1 -1
  181. package/dist/src/ua_reference_type_impl.js +3 -3
  182. package/dist/src/ua_reference_type_impl.js.map +1 -1
  183. package/dist/src/ua_variable_impl.js +6 -3
  184. package/dist/src/ua_variable_impl.js.map +1 -1
  185. package/dist/src/ua_variable_impl_ext_obj.js +15 -15
  186. package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
  187. package/dist/src/ua_variable_type_impl.d.ts +2 -0
  188. package/dist/src/ua_variable_type_impl.js +8 -4
  189. package/dist/src/ua_variable_type_impl.js.map +1 -1
  190. package/dist/src/validate_data_type_correctness.js +1 -2
  191. package/dist/src/validate_data_type_correctness.js.map +1 -1
  192. package/dist/tsconfig_common.tsbuildinfo +1 -1
  193. package/distHelpers/add_event_generator_object.js +1 -2
  194. package/distHelpers/add_event_generator_object.js.map +1 -1
  195. package/distHelpers/alarms_and_conditions_demo.js +1 -2
  196. package/distHelpers/alarms_and_conditions_demo.js.map +1 -1
  197. package/distHelpers/assertHasMatchingReference.js +1 -2
  198. package/distHelpers/assertHasMatchingReference.js.map +1 -1
  199. package/distHelpers/boiler_system.js +2 -3
  200. package/distHelpers/boiler_system.js.map +1 -1
  201. package/distHelpers/create_minimalist_address_space_nodeset.js +1 -2
  202. package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
  203. package/distHelpers/date_utils.js +1 -2
  204. package/distHelpers/date_utils.js.map +1 -1
  205. package/distHelpers/get_address_space_fixture.js +1 -2
  206. package/distHelpers/get_address_space_fixture.js.map +1 -1
  207. package/distHelpers/get_mini_address_space.js +2 -2
  208. package/distHelpers/get_mini_address_space.js.map +1 -1
  209. package/distNodeJS/generate_address_space.js +2 -3
  210. package/distNodeJS/generate_address_space.js.map +1 -1
  211. package/package.json +24 -24
  212. package/source/helpers/make_optionals_map.ts +9 -6
  213. package/source/index.ts +3 -0
  214. package/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.ts +3 -1
  215. package/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.ts +3 -1
  216. package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.ts +3 -1
  217. package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.ts +3 -1
  218. package/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.ts +3 -1
  219. package/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.ts +18 -16
  220. package/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.ts +5 -3
  221. package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +4 -2
  222. package/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.ts +4 -2
  223. package/source/interfaces/state_machine/ua_program_state_machine_type.ts +3 -1
  224. package/source/interfaces/state_machine/ua_shelved_state_machine_ex.ts +1 -1
  225. package/source/interfaces/state_machine/ua_state_machine_type.ts +14 -7
  226. package/source/loader/decode_xml_extension_object.ts +4 -3
  227. package/source/loader/ensure_datatype_extracted.ts +38 -2
  228. package/source/loader/generateAddressSpaceRaw.ts +4 -4
  229. package/source/loader/load_nodeset2.ts +212 -901
  230. package/source/loader/make_xml_extension_object_parser.ts +87 -123
  231. package/source/loader/namespace_post_step.ts +6 -5
  232. package/source/loader/parsers/extension_object_parser.ts +364 -0
  233. package/source/loader/parsers/localized_text_parser.ts +34 -0
  234. package/source/loader/parsers/nodeid_parser.ts +17 -0
  235. package/source/loader/parsers/qualified_name_parser.ts +43 -0
  236. package/source/loader/parsers/variant_parser.ts +427 -0
  237. package/source/loader/register_node_promoter.ts +2 -5
  238. package/source/session_context.ts +1 -1
  239. package/source/ua_addin.ts +53 -0
  240. package/source/ua_interface.ts +49 -0
  241. package/source/xml_writer.ts +4 -5
  242. package/src/_instantiate_helpers.ts +9 -3
  243. package/src/_mandatory_child_or_requested_optional_filter.ts +9 -7
  244. package/src/address_space.ts +1 -1
  245. package/src/alarms_and_conditions/condition.ts +0 -32
  246. package/src/alarms_and_conditions/condition_snapshot_impl.ts +176 -189
  247. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +1 -3
  248. package/src/alarms_and_conditions/ua_base_event_impl.ts +6 -2
  249. package/src/alarms_and_conditions/ua_condition_impl.ts +11 -13
  250. package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +3 -1
  251. package/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.ts +3 -1
  252. package/src/apply_condition_refresh.ts +4 -4
  253. package/src/base_node_impl.ts +13 -13
  254. package/src/base_node_private.ts +6 -11
  255. package/src/data_access/ua_multistate_value_discrete_impl.ts +1 -1
  256. package/src/historical_access/address_space_historical_data_node.ts +3 -3
  257. package/src/index_current.ts +4 -1
  258. package/src/namespace_impl.ts +21 -10
  259. package/src/nodeid_manager.ts +46 -17
  260. package/src/nodeset_tools/construct_namespace_dependency.ts +9 -8
  261. package/src/nodeset_tools/dump_to_bsd.ts +7 -7
  262. package/src/nodeset_tools/nodeset_to_xml.ts +70 -44
  263. package/src/private_namespace.ts +2 -1
  264. package/src/tool_isSubtypeOf.ts +20 -16
  265. package/src/ua_data_type_impl.ts +5 -4
  266. package/src/ua_object_type_impl.ts +7 -2
  267. package/src/ua_reference_type_impl.ts +6 -6
  268. package/src/ua_variable_impl.ts +4 -0
  269. package/src/ua_variable_impl_ext_obj.ts +2 -1
  270. package/src/ua_variable_type_impl.ts +11 -1
@@ -1,4 +1,10 @@
1
1
  "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _ConditionSnapshotImpl_instances, _a, _ConditionSnapshotImpl__ensure_condition_values_correctness, _ConditionSnapshotImpl__visit, _ConditionSnapshotImpl__installOnChangeEventHandlers, _ConditionSnapshotImpl__record_condition_state, _ConditionSnapshotImpl__get_var, _ConditionSnapshotImpl__set_var, _ConditionSnapshotImpl__set_twoStateVariable, _ConditionSnapshotImpl__get_twoStateVariable;
2
8
  Object.defineProperty(exports, "__esModule", { value: true });
3
9
  exports.ConditionSnapshotImpl = void 0;
4
10
  /**
@@ -14,7 +20,6 @@ const node_opcua_types_1 = require("node-opcua-types");
14
20
  const node_opcua_variant_1 = require("node-opcua-variant");
15
21
  const event_data_1 = require("../event_data");
16
22
  const ua_two_state_variable_1 = require("../state_machine/ua_two_state_variable");
17
- const condition_1 = require("./condition");
18
23
  const ua_condition_impl_1 = require("./ua_condition_impl");
19
24
  const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
20
25
  const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
@@ -22,74 +27,6 @@ function normalizeName(str) {
22
27
  // return str.split(".").map(utils.lowerFirstLetter).join(".");
23
28
  return str;
24
29
  }
25
- function _visit(self, node, prefix) {
26
- const aggregates = node.getAggregates();
27
- for (const aggregate of aggregates) {
28
- if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
29
- const name = aggregate.browseName.toString();
30
- const key = prefix + name;
31
- // istanbul ignore next
32
- if (doDebug) {
33
- debugLog("adding key =", key);
34
- }
35
- const aggregateVariable = aggregate;
36
- self._map[key] = aggregateVariable.readValue().value;
37
- self._node_index[key] = aggregateVariable;
38
- _visit(self, aggregate, prefix + name + ".");
39
- }
40
- }
41
- }
42
- function _record_condition_state(self, condition) {
43
- self._map = {};
44
- self._node_index = {};
45
- (0, node_opcua_assert_1.assert)(condition instanceof ua_condition_impl_1.UAConditionImpl);
46
- _visit(self, condition, "");
47
- }
48
- function _installOnChangeEventHandlers(self, node, prefix) {
49
- const aggregates = node.getAggregates();
50
- for (const aggregate of aggregates) {
51
- if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
52
- const name = aggregate.browseName.toString();
53
- const key = prefix + name;
54
- // istanbul ignore next
55
- if (doDebug) {
56
- debugLog("adding key =", key);
57
- }
58
- aggregate.on("value_changed", (newDataValue) => {
59
- self._map[key] = newDataValue.value;
60
- self._node_index[key] = aggregate;
61
- });
62
- _installOnChangeEventHandlers(self, aggregate, prefix + name + ".");
63
- }
64
- }
65
- }
66
- function _ensure_condition_values_correctness(self, node, prefix, error) {
67
- const displayError = !!error;
68
- error = error || [];
69
- const aggregates = node.getAggregates();
70
- for (const aggregate of aggregates) {
71
- if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
72
- const name = aggregate.browseName.toString();
73
- const key = prefix + name;
74
- const snapshot_value = self._map[key].toString();
75
- const aggregateVariable = aggregate;
76
- const condition_value = aggregateVariable.readValue().value.toString();
77
- if (snapshot_value !== condition_value) {
78
- error.push(" Condition Branch0 is not in sync with node values for " +
79
- key +
80
- "\n v1= " +
81
- snapshot_value +
82
- "\n v2= " +
83
- condition_value);
84
- }
85
- self._node_index[key] = aggregate;
86
- _ensure_condition_values_correctness(self, aggregate, prefix + name + ".", error);
87
- }
88
- }
89
- if (displayError && error.length) {
90
- throw new Error(error.join("\n"));
91
- }
92
- }
93
30
  const disabledVar = new node_opcua_variant_1.Variant({
94
31
  dataType: "StatusCode",
95
32
  value: node_opcua_status_code_1.StatusCodes.BadConditionDisabled
@@ -118,30 +55,31 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
118
55
  */
119
56
  constructor(condition, branchId) {
120
57
  super();
58
+ _ConditionSnapshotImpl_instances.add(this);
121
59
  this.eventData = null;
122
60
  this.branchId = null;
123
- this._map = {};
124
- this._node_index = {};
61
+ this._map = new Map();
62
+ this._node_index = new Map();
125
63
  (0, node_opcua_assert_1.assert)(branchId instanceof node_opcua_nodeid_1.NodeId);
126
64
  // xx self.branchId = branchId;
127
65
  this.condition = condition;
128
66
  this.eventData = new event_data_1.EventData(condition);
129
67
  // a nodeId/Variant map
130
- _record_condition_state(this, condition);
68
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__record_condition_state).call(this, condition);
131
69
  if ((0, node_opcua_nodeid_1.sameNodeId)(branchId, node_opcua_nodeid_1.NodeId.nullNodeId)) {
132
- _installOnChangeEventHandlers(this, condition, "");
70
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__installOnChangeEventHandlers).call(this, condition, "");
133
71
  }
134
- this._set_var("BranchId", node_opcua_variant_1.DataType.NodeId, branchId);
72
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "BranchId", node_opcua_variant_1.DataType.NodeId, branchId);
135
73
  }
136
74
  _constructEventData() {
137
75
  if (this.branchId && (0, node_opcua_nodeid_1.sameNodeId)(this.branchId, node_opcua_nodeid_1.NodeId.nullNodeId)) {
138
- _ensure_condition_values_correctness(this, this.condition, "", []);
76
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__ensure_condition_values_correctness).call(this, this.condition, "", []);
139
77
  }
140
78
  const c = this.condition;
141
79
  const isDisabled = !c.getEnabledState();
142
80
  const eventData = new event_data_1.EventData(this.condition);
143
- for (const fullBrowsePath of Object.keys(this._map)) {
144
- const node = this._node_index[fullBrowsePath];
81
+ for (const fullBrowsePath of this._map.keys()) {
82
+ const node = this._node_index.get(fullBrowsePath);
145
83
  if (!node) {
146
84
  debugLog("cannot node for find key", fullBrowsePath);
147
85
  continue;
@@ -150,112 +88,35 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
150
88
  eventData._createValue(fullBrowsePath, node, disabledVar);
151
89
  }
152
90
  else {
153
- eventData._createValue(fullBrowsePath, node, this._map[fullBrowsePath]);
91
+ eventData._createValue(fullBrowsePath, node, this._map.get(fullBrowsePath));
154
92
  }
155
93
  }
156
94
  return eventData;
157
95
  }
158
- // /**
159
- // *
160
- // */
161
- // public readValue(sessionContext: ISessionContext, nodeId: NodeId, selectClause: SimpleAttributeOperand): Variant {
162
- // const c = this.condition as UAConditionImpl;
163
- // const isDisabled = !c.getEnabledState();
164
- // if (isDisabled) {
165
- // return disabledVar;
166
- // }
167
- // const key = nodeId.toString();
168
- // const variant = this._map[key];
169
- // if (!variant) {
170
- // // the value is not handled by us .. let's delegate
171
- // // to the eventData helper object
172
- // return this.eventData?.readValue(sessionContext, nodeId, selectClause) || disabledVar;
173
- // }
174
- // return variant;
175
- // }
176
- /**
177
- * @internal
178
- */
179
- _get_var(varName) {
180
- const c = this.condition;
181
- if (!c.getEnabledState() && !Object.prototype.hasOwnProperty.call(_varTable, varName)) {
182
- // xx debuglog("ConditionSnapshot#_get_var condition enabled =", self.condition.getEnabledState());
183
- return disabledVar;
184
- }
185
- const key = normalizeName(varName);
186
- const variant = this._map[key];
187
- if (!variant) {
188
- throw new Error("cannot find key " + key);
189
- }
190
- return variant.value;
191
- }
192
- /**
193
- * @internal
194
- */
195
- _set_var(varName, dataType, value, options) {
196
- const key = normalizeName(varName);
197
- // istanbul ignore next
198
- if (!Object.prototype.hasOwnProperty.call(this._map, key)) {
199
- // istanbul ignore next
200
- if (doDebug) {
201
- debugLog(" cannot find node " + varName);
202
- debugLog(" map=", Object.keys(this._map).join(" "));
203
- }
204
- }
205
- this._map[key] = new node_opcua_variant_1.Variant({
206
- dataType,
207
- value
208
- });
209
- const sourceTimestamp = options?.sourceTimestamp || new Date();
210
- const sourceTimestampKey = key + ".SourceTimestamp";
211
- if (this._map[sourceTimestampKey]) {
212
- // from spec 1.03 : 5.3 condition variables
213
- // a condition VariableType has a sourceTimeStamp exposed property
214
- // SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
215
- // It shall be the same time that would be returned from the Read Service inside the DataValue
216
- // structure for the ConditionVariable Value Attribute.
217
- const variant = new node_opcua_variant_1.Variant({
218
- dataType: node_opcua_variant_1.DataType.DateTime,
219
- value: sourceTimestamp
220
- });
221
- this._map[sourceTimestampKey] = variant;
222
- const node = this._node_index[sourceTimestampKey];
223
- this.emit("valueChanged", node, variant, { sourceTimestamp });
224
- }
225
- const variant = this._map[key];
226
- const node = this._node_index[key];
227
- if (!node) {
228
- // for instance localTime is optional
229
- debugLog("Cannot serVar " + varName + " dataType " + node_opcua_variant_1.DataType[dataType]);
230
- return;
231
- }
232
- (0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_1.NodeClass.Variable);
233
- this.emit("valueChanged", node, variant, { sourceTimestamp });
234
- }
235
96
  /**
236
97
  *
237
98
  */
238
99
  getBranchId() {
239
- return this._get_var("BranchId");
100
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "BranchId");
240
101
  }
241
102
  /**
242
103
  *
243
104
  */
244
105
  getEventId() {
245
- return this._get_var("EventId");
106
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "EventId");
246
107
  }
247
108
  /**
248
109
  *
249
110
  */
250
111
  getRetain() {
251
- return this._get_var("Retain");
112
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "Retain");
252
113
  }
253
114
  /**
254
115
  *
255
116
  */
256
117
  setRetain(retainFlag) {
257
118
  retainFlag = !!retainFlag;
258
- return this._set_var("Retain", node_opcua_variant_1.DataType.Boolean, retainFlag);
119
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Retain", node_opcua_variant_1.DataType.Boolean, retainFlag);
259
120
  }
260
121
  /**
261
122
  *
@@ -264,32 +125,32 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
264
125
  const addressSpace = this.condition.addressSpace;
265
126
  // create a new event Id for this new condition
266
127
  const eventId = addressSpace.generateEventId();
267
- const ret = this._set_var("EventId", node_opcua_variant_1.DataType.ByteString, eventId.value);
128
+ const ret = __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "EventId", node_opcua_variant_1.DataType.ByteString, eventId.value);
268
129
  return ret;
269
130
  }
270
131
  /**
271
132
  *
272
133
  */
273
134
  getEnabledState() {
274
- return this._get_twoStateVariable("EnabledState");
135
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "EnabledState");
275
136
  }
276
137
  /**
277
138
  *
278
139
  */
279
140
  setEnabledState(value, options) {
280
- return this._set_twoStateVariable("EnabledState", value, options);
141
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "EnabledState", value, options);
281
142
  }
282
143
  /**
283
144
  *
284
145
  */
285
146
  getEnabledStateAsString() {
286
- return this._get_var("EnabledState").text;
147
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "EnabledState").text;
287
148
  }
288
149
  /**
289
150
  *
290
151
  */
291
152
  getComment() {
292
- return this._get_var("Comment");
153
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "Comment");
293
154
  }
294
155
  /**
295
156
  * Set condition comment
@@ -303,20 +164,20 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
303
164
  */
304
165
  setComment(txtMessage, options) {
305
166
  const txtMessage1 = (0, node_opcua_data_model_1.coerceLocalizedText)(txtMessage);
306
- this._set_var("Comment", node_opcua_variant_1.DataType.LocalizedText, txtMessage1, options);
167
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Comment", node_opcua_variant_1.DataType.LocalizedText, txtMessage1, options);
307
168
  }
308
169
  /**
309
170
  * set the condition message (localized text)
310
171
  */
311
172
  setMessage(txtMessage) {
312
173
  const txtMessage1 = (0, node_opcua_data_model_1.coerceLocalizedText)(txtMessage);
313
- return this._set_var("Message", node_opcua_variant_1.DataType.LocalizedText, txtMessage1);
174
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Message", node_opcua_variant_1.DataType.LocalizedText, txtMessage1);
314
175
  }
315
176
  /**
316
177
  *
317
178
  */
318
179
  setClientUserId(userIdentity) {
319
- return this._set_var("ClientUserId", node_opcua_variant_1.DataType.String, userIdentity.toString());
180
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "ClientUserId", node_opcua_variant_1.DataType.String, userIdentity.toString());
320
181
  }
321
182
  /*
322
183
  *
@@ -359,13 +220,13 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
359
220
  * it is up to the application to determine what quality is displayed as part of the condition.
360
221
  */
361
222
  setQuality(quality, options) {
362
- this._set_var("Quality", node_opcua_variant_1.DataType.StatusCode, quality, options);
223
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Quality", node_opcua_variant_1.DataType.StatusCode, quality, options);
363
224
  }
364
225
  /**
365
226
  *
366
227
  */
367
228
  getQuality() {
368
- return this._get_var("Quality");
229
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "Quality");
369
230
  }
370
231
  /**
371
232
  * **as per spec 1.0.3 - Part 9**
@@ -421,14 +282,14 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
421
282
  const lastSeverity = this.getSeverity();
422
283
  const sourceTimestamp = this.getSeveritySourceTimestamp();
423
284
  this.setLastSeverity(lastSeverity, { sourceTimestamp });
424
- this._set_var("Severity", node_opcua_variant_1.DataType.UInt16, severity, options);
285
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Severity", node_opcua_variant_1.DataType.UInt16, severity, options);
425
286
  }
426
287
  /**
427
288
  */
428
289
  getSeverity() {
429
290
  const c = this.condition;
430
291
  (0, node_opcua_assert_1.assert)(c.getEnabledState(), "condition must be enabled");
431
- const value = this._get_var("Severity");
292
+ const value = __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "Severity");
432
293
  return +value;
433
294
  }
434
295
  getSeveritySourceTimestamp() {
@@ -448,13 +309,13 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
448
309
  */
449
310
  setLastSeverity(severity, options) {
450
311
  severity = +severity;
451
- return this._set_var("LastSeverity", node_opcua_variant_1.DataType.UInt16, severity, options);
312
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "LastSeverity", node_opcua_variant_1.DataType.UInt16, severity, options);
452
313
  }
453
314
  /**
454
315
  *
455
316
  */
456
317
  getLastSeverity() {
457
- const value = this._get_var("LastSeverity");
318
+ const value = __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "LastSeverity");
458
319
  return +value;
459
320
  }
460
321
  /**
@@ -475,7 +336,7 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
475
336
  *
476
337
  */
477
338
  setReceiveTime(time) {
478
- return this._set_var("ReceiveTime", node_opcua_variant_1.DataType.DateTime, time, { sourceTimestamp: time || undefined });
339
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "ReceiveTime", node_opcua_variant_1.DataType.DateTime, time, { sourceTimestamp: time || undefined });
479
340
  }
480
341
  /**
481
342
  * Time provides the time the Event occurred.
@@ -489,7 +350,7 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
489
350
  *
490
351
  */
491
352
  setTime(time) {
492
- return this._set_var("Time", node_opcua_variant_1.DataType.DateTime, time, { sourceTimestamp: time });
353
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "Time", node_opcua_variant_1.DataType.DateTime, time, { sourceTimestamp: time });
493
354
  }
494
355
  /**
495
356
  * LocalTime is a structure containing the Offset and the DaylightSavingInOffset flag.
@@ -507,29 +368,29 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
507
368
  */
508
369
  setLocalTime(localTime) {
509
370
  (0, node_opcua_assert_1.assert)(localTime instanceof node_opcua_types_1.TimeZoneDataType);
510
- return this._set_var("LocalTime", node_opcua_variant_1.DataType.ExtensionObject, new node_opcua_types_1.TimeZoneDataType(localTime));
371
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_var).call(this, "LocalTime", node_opcua_variant_1.DataType.ExtensionObject, new node_opcua_types_1.TimeZoneDataType(localTime));
511
372
  }
512
373
  // read only !
513
374
  getSourceName() {
514
- return this._get_var("SourceName");
375
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "SourceName");
515
376
  }
516
377
  /**
517
378
  *
518
379
  */
519
380
  getSourceNode() {
520
- return this._get_var("SourceNode");
381
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "SourceNode");
521
382
  }
522
383
  /**
523
384
  *
524
385
  */
525
386
  getEventType() {
526
- return this._get_var("EventType");
387
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "EventType");
527
388
  }
528
389
  getMessage() {
529
- return this._get_var("Message");
390
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "Message");
530
391
  }
531
392
  isCurrentBranch() {
532
- return (0, node_opcua_nodeid_1.sameNodeId)(this._get_var("BranchId"), node_opcua_nodeid_1.NodeId.nullNodeId);
393
+ return (0, node_opcua_nodeid_1.sameNodeId)(__classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_var).call(this, "BranchId"), node_opcua_nodeid_1.NodeId.nullNodeId);
533
394
  }
534
395
  // -- ACKNOWLEDGEABLE -------------------------------------------------------------------
535
396
  getAckedState() {
@@ -541,16 +402,16 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
541
402
  acknowledgeableCondition.typeDefinitionObj.browseName.toString() +
542
403
  " has no AckedState");
543
404
  }
544
- return this._get_twoStateVariable("AckedState");
405
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "AckedState");
545
406
  }
546
407
  setAckedState(ackedState, options) {
547
408
  ackedState = !!ackedState;
548
- return (0, condition_1._setAckedState)(this, ackedState, undefined, undefined, options);
409
+ return this._setAckedState(ackedState, undefined, undefined, options);
549
410
  }
550
411
  getConfirmedState() {
551
412
  const acknowledgeableCondition = this.condition;
552
413
  (0, node_opcua_assert_1.assert)(acknowledgeableCondition.confirmedState, "Must have a confirmed state");
553
- return this._get_twoStateVariable("ConfirmedState");
414
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "ConfirmedState");
554
415
  }
555
416
  setConfirmedStateIfExists(confirmedState, options) {
556
417
  confirmedState = !!confirmedState;
@@ -561,7 +422,7 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
561
422
  return;
562
423
  }
563
424
  // todo deal with Error code BadConditionBranchAlreadyConfirmed
564
- return this._set_twoStateVariable("ConfirmedState", confirmedState, options);
425
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "ConfirmedState", confirmedState, options);
565
426
  }
566
427
  setConfirmedState(confirmedState) {
567
428
  const acknowledgeableCondition = this.condition;
@@ -570,43 +431,43 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
570
431
  }
571
432
  // ---- Shelving
572
433
  getSuppressedState() {
573
- return this._get_twoStateVariable("SuppressedState");
434
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "SuppressedState");
574
435
  }
575
436
  setSuppressedState(suppressed, options) {
576
437
  suppressed = !!suppressed;
577
- this._set_twoStateVariable("SuppressedState", suppressed, options);
438
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "SuppressedState", suppressed, options);
578
439
  }
579
440
  getActiveState() {
580
- return this._get_twoStateVariable("ActiveState");
441
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "ActiveState");
581
442
  }
582
443
  setActiveState(newActiveState, options) {
583
444
  // xx var activeState = self.getActiveState();
584
445
  // xx if (activeState === newActiveState) {
585
446
  // xx return StatusCodes.Bad;
586
447
  // xx }
587
- this._set_twoStateVariable("ActiveState", newActiveState, options);
448
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "ActiveState", newActiveState, options);
588
449
  return node_opcua_status_code_1.StatusCodes.Good;
589
450
  }
590
451
  setLatchedState(newLatchedState, options) {
591
- this._set_twoStateVariable("LatchedState", newLatchedState, options);
452
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "LatchedState", newLatchedState, options);
592
453
  return node_opcua_status_code_1.StatusCodes.Good;
593
454
  }
594
455
  getLatchedState() {
595
- return this._get_twoStateVariable("LatchedState");
456
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "LatchedState");
596
457
  }
597
458
  setOutOfServiceState(newOutOfServiceState, options) {
598
- this._set_twoStateVariable("OutOfServiceState", newOutOfServiceState, options);
459
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "OutOfServiceState", newOutOfServiceState, options);
599
460
  return node_opcua_status_code_1.StatusCodes.Good;
600
461
  }
601
462
  getOutOfServiceState() {
602
- return this._get_twoStateVariable("OutOfServiceState");
463
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "OutOfServiceState");
603
464
  }
604
465
  setSilentState(newSilentState, options) {
605
- this._set_twoStateVariable("SilentState", newSilentState, options);
466
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "SilentState", newSilentState, options);
606
467
  return node_opcua_status_code_1.StatusCodes.Good;
607
468
  }
608
469
  getSilentState() {
609
- return this._get_twoStateVariable("SilentState");
470
+ return __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__get_twoStateVariable).call(this, "SilentState");
610
471
  }
611
472
  setShelvingState() {
612
473
  throw new Error("Method not implemented.");
@@ -637,51 +498,167 @@ class ConditionSnapshotImpl extends events_1.EventEmitter {
637
498
  ", comment: " +
638
499
  this.getComment());
639
500
  }
640
- /**
641
- * @internal
642
- */
643
- _set_twoStateVariable(varName, value, options) {
644
- value = !!value;
645
- const hrKey = ConditionSnapshotImpl.normalizeName(varName);
646
- const idKey = ConditionSnapshotImpl.normalizeName(varName + ".Id");
647
- const variant = new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Boolean, value });
648
- this._map[idKey] = variant;
649
- // also change varName with human readable text
650
- const twoStateNode = this._node_index[hrKey];
651
- if (!twoStateNode) {
652
- throw new Error("Cannot find twoState Variable with name " + varName);
501
+ _setAckedState(requestedAckedState, conditionEventId, comment, options) {
502
+ const ackedState = this.getAckedState();
503
+ if (ackedState && requestedAckedState) {
504
+ return node_opcua_status_code_1.StatusCodes.BadConditionBranchAlreadyAcked;
653
505
  }
654
- if (!(twoStateNode instanceof ua_two_state_variable_1.UATwoStateVariableImpl)) {
655
- throw new Error("Cannot find twoState Variable with name " + varName + " " + twoStateNode);
506
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__set_twoStateVariable).call(this, "AckedState", requestedAckedState, options);
507
+ return node_opcua_status_code_1.StatusCodes.Good;
508
+ }
509
+ }
510
+ exports.ConditionSnapshotImpl = ConditionSnapshotImpl;
511
+ _a = ConditionSnapshotImpl, _ConditionSnapshotImpl_instances = new WeakSet(), _ConditionSnapshotImpl__ensure_condition_values_correctness = function _ConditionSnapshotImpl__ensure_condition_values_correctness(node, prefix, error) {
512
+ const displayError = !!error;
513
+ error = error || [];
514
+ const aggregates = node.getAggregates();
515
+ for (const aggregate of aggregates) {
516
+ if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
517
+ const name = aggregate.browseName.toString();
518
+ const key = prefix + name;
519
+ const snapshot_value = this._map.get(key).toString();
520
+ const aggregateVariable = aggregate;
521
+ const condition_value = aggregateVariable.readValue().value.toString();
522
+ if (snapshot_value !== condition_value) {
523
+ error.push(" Condition Branch0 is not in sync with node values for " +
524
+ key +
525
+ "\n v1= " +
526
+ snapshot_value +
527
+ "\n v2= " +
528
+ condition_value);
529
+ }
530
+ this._node_index.set(key, aggregateVariable);
531
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__ensure_condition_values_correctness).call(this, aggregate, prefix + name + ".", error);
656
532
  }
657
- const hrValue = new node_opcua_variant_1.Variant({
658
- dataType: node_opcua_variant_1.DataType.LocalizedText,
659
- value: value ? twoStateNode.getTrueState() : twoStateNode.getFalseState()
660
- });
661
- this._map[hrKey] = hrValue;
662
- const node = this._node_index[idKey];
663
- // also change ConditionNode if we are on currentBranch
664
- if (this.isCurrentBranch()) {
665
- (0, node_opcua_assert_1.assert)(twoStateNode instanceof ua_two_state_variable_1.UATwoStateVariableImpl);
666
- twoStateNode.setValue(value, options);
533
+ }
534
+ if (displayError && error.length) {
535
+ throw new Error(error.join("\n"));
536
+ }
537
+ }, _ConditionSnapshotImpl__visit = function _ConditionSnapshotImpl__visit(node, prefix) {
538
+ const aggregates = node.getAggregates();
539
+ for (const aggregate of aggregates) {
540
+ if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
541
+ const name = aggregate.browseName.toString();
542
+ const key = prefix + name;
543
+ // istanbul ignore next
544
+ if (doDebug) {
545
+ debugLog("adding key =", key);
546
+ }
547
+ const aggregateVariable = aggregate;
548
+ this._map.set(key, aggregateVariable.readValue().value);
549
+ this._node_index.set(key, aggregateVariable);
550
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__visit).call(this, aggregate, prefix + name + ".");
667
551
  }
668
- const sourceTimestamp = options?.effectiveTransitionTime || new Date();
669
- this.emit("valueChanged", node, variant, { sourceTimestamp });
670
552
  }
671
- /**
672
- * @internal
673
- */
674
- _get_twoStateVariable(varName) {
675
- const key = ConditionSnapshotImpl.normalizeName(varName) + ".Id";
676
- const variant = this._map[key];
553
+ }, _ConditionSnapshotImpl__installOnChangeEventHandlers = function _ConditionSnapshotImpl__installOnChangeEventHandlers(node, prefix) {
554
+ const aggregates = node.getAggregates();
555
+ for (const aggregate of aggregates) {
556
+ if (aggregate.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
557
+ const name = aggregate.browseName.toString();
558
+ const key = prefix + name;
559
+ // istanbul ignore next
560
+ if (doDebug) {
561
+ debugLog("adding key =", key);
562
+ }
563
+ aggregate.on("value_changed", (newDataValue) => {
564
+ this._map.set(key, newDataValue.value);
565
+ this._node_index.set(key, aggregate);
566
+ });
567
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__installOnChangeEventHandlers).call(this, aggregate, prefix + name + ".");
568
+ }
569
+ }
570
+ }, _ConditionSnapshotImpl__record_condition_state = function _ConditionSnapshotImpl__record_condition_state(condition) {
571
+ this._map.clear();
572
+ this._node_index.clear();
573
+ (0, node_opcua_assert_1.assert)(condition instanceof ua_condition_impl_1.UAConditionImpl);
574
+ __classPrivateFieldGet(this, _ConditionSnapshotImpl_instances, "m", _ConditionSnapshotImpl__visit).call(this, condition, "");
575
+ }, _ConditionSnapshotImpl__get_var = function _ConditionSnapshotImpl__get_var(varName) {
576
+ const c = this.condition;
577
+ if (!c.getEnabledState() && !Object.prototype.hasOwnProperty.call(_varTable, varName)) {
578
+ // xx debuglog("ConditionSnapshot#_get_var condition enabled =", self.condition.getEnabledState());
579
+ return disabledVar;
580
+ }
581
+ const key = normalizeName(varName);
582
+ const variant = this._map.get(key);
583
+ if (!variant) {
584
+ throw new Error("cannot find key " + key);
585
+ }
586
+ return variant.value;
587
+ }, _ConditionSnapshotImpl__set_var = function _ConditionSnapshotImpl__set_var(varName, dataType, value, options) {
588
+ const key = normalizeName(varName);
589
+ // istanbul ignore next
590
+ if (!this._map.has(key)) {
677
591
  // istanbul ignore next
678
- if (!variant) {
679
- return "???";
680
- // throw new Error("Cannot find TwoStateVariable with name " + varName);
592
+ if (doDebug) {
593
+ debugLog(" cannot find node " + varName);
594
+ debugLog(" map=", [...this._map.keys()].join(" "));
681
595
  }
682
- return variant.value;
683
596
  }
684
- }
685
- exports.ConditionSnapshotImpl = ConditionSnapshotImpl;
597
+ this._map.set(key, new node_opcua_variant_1.Variant({
598
+ dataType,
599
+ value
600
+ }));
601
+ const sourceTimestamp = options?.sourceTimestamp || new Date();
602
+ const sourceTimestampKey = key + ".SourceTimestamp";
603
+ if (this._map.has(sourceTimestampKey)) {
604
+ // from spec 1.03 : 5.3 condition variables
605
+ // a condition VariableType has a sourceTimeStamp exposed property
606
+ // SourceTimestamp indicates the time of the last change of the Value of this ConditionVariable.
607
+ // It shall be the same time that would be returned from the Read Service inside the DataValue
608
+ // structure for the ConditionVariable Value Attribute.
609
+ const variant = new node_opcua_variant_1.Variant({
610
+ dataType: node_opcua_variant_1.DataType.DateTime,
611
+ value: sourceTimestamp
612
+ });
613
+ this._map.set(sourceTimestampKey, variant);
614
+ const node = this._node_index.get(sourceTimestampKey);
615
+ this.emit("valueChanged", node, variant, { sourceTimestamp });
616
+ }
617
+ const variant = this._map.get(key);
618
+ const node = this._node_index.get(key);
619
+ if (!node) {
620
+ // for instance localTime is optional
621
+ debugLog("Cannot serVar " + varName + " dataType " + node_opcua_variant_1.DataType[dataType]);
622
+ return;
623
+ }
624
+ (0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_1.NodeClass.Variable);
625
+ this.emit("valueChanged", node, variant, { sourceTimestamp });
626
+ }, _ConditionSnapshotImpl__set_twoStateVariable = function _ConditionSnapshotImpl__set_twoStateVariable(varName, value, options) {
627
+ value = !!value;
628
+ const hrKey = _a.normalizeName(varName);
629
+ const idKey = _a.normalizeName(varName + ".Id");
630
+ const variant = new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Boolean, value });
631
+ this._map.set(idKey, variant);
632
+ // also change varName with human readable text
633
+ const twoStateNode = this._node_index.get(hrKey);
634
+ if (!twoStateNode) {
635
+ throw new Error("Cannot find twoState Variable with name " + varName);
636
+ }
637
+ if (!(twoStateNode instanceof ua_two_state_variable_1.UATwoStateVariableImpl)) {
638
+ throw new Error("Cannot find twoState Variable with name " + varName + " " + twoStateNode);
639
+ }
640
+ const hrValue = new node_opcua_variant_1.Variant({
641
+ dataType: node_opcua_variant_1.DataType.LocalizedText,
642
+ value: value ? twoStateNode.getTrueState() : twoStateNode.getFalseState()
643
+ });
644
+ this._map.set(hrKey, hrValue);
645
+ const node = this._node_index.get(idKey);
646
+ // also change ConditionNode if we are on currentBranch
647
+ if (this.isCurrentBranch()) {
648
+ (0, node_opcua_assert_1.assert)(twoStateNode instanceof ua_two_state_variable_1.UATwoStateVariableImpl);
649
+ twoStateNode.setValue(value, options);
650
+ }
651
+ const sourceTimestamp = options?.effectiveTransitionTime || new Date();
652
+ this.emit("valueChanged", node, variant, { sourceTimestamp });
653
+ }, _ConditionSnapshotImpl__get_twoStateVariable = function _ConditionSnapshotImpl__get_twoStateVariable(varName) {
654
+ const key = _a.normalizeName(varName) + ".Id";
655
+ const variant = this._map.get(key);
656
+ // istanbul ignore next
657
+ if (!variant) {
658
+ return "???";
659
+ // throw new Error("Cannot find TwoStateVariable with name " + varName);
660
+ }
661
+ return variant.value;
662
+ };
686
663
  ConditionSnapshotImpl.normalizeName = normalizeName;
687
664
  //# sourceMappingURL=condition_snapshot_impl.js.map