node-opcua-address-space 2.51.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 (598) hide show
  1. package/.mocharc.yml +12 -0
  2. package/LICENSE +20 -0
  3. package/dist/source/address_space_ts.d.ts +122 -0
  4. package/dist/source/address_space_ts.js +18 -0
  5. package/dist/source/address_space_ts.js.map +1 -0
  6. package/dist/source/continuation_points/continuation_point_manager.d.ts +21 -0
  7. package/dist/source/continuation_points/continuation_point_manager.js +100 -0
  8. package/dist/source/continuation_points/continuation_point_manager.js.map +1 -0
  9. package/dist/source/helpers/adjust_browse_direction.d.ts +5 -0
  10. package/dist/source/helpers/adjust_browse_direction.js +12 -0
  11. package/dist/source/helpers/adjust_browse_direction.js.map +1 -0
  12. package/dist/source/helpers/argument_list.d.ts +30 -0
  13. package/dist/source/helpers/argument_list.js +237 -0
  14. package/dist/source/helpers/argument_list.js.map +1 -0
  15. package/dist/source/helpers/call_helpers.d.ts +6 -0
  16. package/dist/source/helpers/call_helpers.js +71 -0
  17. package/dist/source/helpers/call_helpers.js.map +1 -0
  18. package/dist/source/helpers/check_event_clause.d.ts +17 -0
  19. package/dist/source/helpers/check_event_clause.js +53 -0
  20. package/dist/source/helpers/check_event_clause.js.map +1 -0
  21. package/dist/source/helpers/coerce_enum_value.d.ts +6 -0
  22. package/dist/source/helpers/coerce_enum_value.js +34 -0
  23. package/dist/source/helpers/coerce_enum_value.js.map +1 -0
  24. package/dist/source/helpers/dump_tools.d.ts +14 -0
  25. package/dist/source/helpers/dump_tools.js +79 -0
  26. package/dist/source/helpers/dump_tools.js.map +1 -0
  27. package/dist/source/helpers/ensure_secure_access.d.ts +9 -0
  28. package/dist/source/helpers/ensure_secure_access.js +90 -0
  29. package/dist/source/helpers/ensure_secure_access.js.map +1 -0
  30. package/dist/source/helpers/make_optionals_map.d.ts +21 -0
  31. package/dist/source/helpers/make_optionals_map.js +30 -0
  32. package/dist/source/helpers/make_optionals_map.js.map +1 -0
  33. package/dist/source/helpers/resolve_opaque_on_address_space.d.ts +3 -0
  34. package/dist/source/helpers/resolve_opaque_on_address_space.js +37 -0
  35. package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -0
  36. package/dist/source/index.d.ts +39 -0
  37. package/dist/source/index.js +62 -0
  38. package/dist/source/index.js.map +1 -0
  39. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +12 -0
  40. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js +3 -0
  41. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js.map +1 -0
  42. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.d.ts +1 -0
  43. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js +3 -0
  44. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js.map +1 -0
  45. package/dist/source/interfaces/data_access/ua_discrete_item.d.ts +4 -0
  46. package/dist/source/interfaces/data_access/ua_discrete_item.js +3 -0
  47. package/dist/source/interfaces/data_access/ua_discrete_item.js.map +1 -0
  48. package/dist/source/interfaces/data_access/ua_multistate_discrete.d.ts +25 -0
  49. package/dist/source/interfaces/data_access/ua_multistate_discrete.js +3 -0
  50. package/dist/source/interfaces/data_access/ua_multistate_discrete.js.map +1 -0
  51. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +21 -0
  52. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js +3 -0
  53. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js.map +1 -0
  54. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.d.ts +27 -0
  55. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js +3 -0
  56. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js.map +1 -0
  57. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +24 -0
  58. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js +3 -0
  59. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js.map +1 -0
  60. package/dist/source/interfaces/data_access/ua_two_state_discrete.d.ts +17 -0
  61. package/dist/source/interfaces/data_access/ua_two_state_discrete.js +3 -0
  62. package/dist/source/interfaces/data_access/ua_two_state_discrete.js.map +1 -0
  63. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +12 -0
  64. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js +3 -0
  65. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js.map +1 -0
  66. package/dist/source/interfaces/data_access/ua_y_array_item.d.ts +4 -0
  67. package/dist/source/interfaces/data_access/ua_y_array_item.js +3 -0
  68. package/dist/source/interfaces/data_access/ua_y_array_item.js.map +1 -0
  69. package/dist/source/interfaces/data_access/ua_y_array_item_ex.d.ts +8 -0
  70. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js +3 -0
  71. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js.map +1 -0
  72. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.d.ts +11 -0
  73. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js +3 -0
  74. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js.map +1 -0
  75. package/dist/source/interfaces/state_machine/finite_state_machine.d.ts +69 -0
  76. package/dist/source/interfaces/state_machine/finite_state_machine.js +3 -0
  77. package/dist/source/interfaces/state_machine/finite_state_machine.js.map +1 -0
  78. package/dist/source/interfaces/state_machine/program_finite_state_machine.d.ts +74 -0
  79. package/dist/source/interfaces/state_machine/program_finite_state_machine.js +3 -0
  80. package/dist/source/interfaces/state_machine/program_finite_state_machine.js.map +1 -0
  81. package/dist/source/interfaces/state_machine/state_machine.d.ts +342 -0
  82. package/dist/source/interfaces/state_machine/state_machine.js +3 -0
  83. package/dist/source/interfaces/state_machine/state_machine.js.map +1 -0
  84. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +12 -0
  85. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js +3 -0
  86. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js.map +1 -0
  87. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.d.ts +49 -0
  88. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js +3 -0
  89. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js.map +1 -0
  90. package/dist/source/interfaces/state_machine/ua_finite_state_variable.d.ts +18 -0
  91. package/dist/source/interfaces/state_machine/ua_finite_state_variable.js +3 -0
  92. package/dist/source/interfaces/state_machine/ua_finite_state_variable.js.map +1 -0
  93. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.d.ts +11 -0
  94. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js +3 -0
  95. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js.map +1 -0
  96. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +222 -0
  97. package/dist/source/interfaces/state_machine/ua_state_machine_type.js +3 -0
  98. package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -0
  99. package/dist/source/interfaces/state_machine/ua_state_variable.d.ts +29 -0
  100. package/dist/source/interfaces/state_machine/ua_state_variable.js +3 -0
  101. package/dist/source/interfaces/state_machine/ua_state_variable.js.map +1 -0
  102. package/dist/source/interfaces/state_machine/ua_transition_ex.d.ts +6 -0
  103. package/dist/source/interfaces/state_machine/ua_transition_ex.js +3 -0
  104. package/dist/source/interfaces/state_machine/ua_transition_ex.js.map +1 -0
  105. package/dist/source/interfaces/state_machine/ua_two_state_variable.d.ts +26 -0
  106. package/dist/source/interfaces/state_machine/ua_two_state_variable.js +3 -0
  107. package/dist/source/interfaces/state_machine/ua_two_state_variable.js.map +1 -0
  108. package/dist/source/interfaces/subscription_diagnostics_variable.d.ts +41 -0
  109. package/dist/source/interfaces/subscription_diagnostics_variable.js +3 -0
  110. package/dist/source/interfaces/subscription_diagnostics_variable.js.map +1 -0
  111. package/dist/source/interfaces/ua_authorisation_service.d.ts +1 -0
  112. package/dist/source/interfaces/ua_authorisation_service.js +3 -0
  113. package/dist/source/interfaces/ua_authorisation_service.js.map +1 -0
  114. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.d.ts +8 -0
  115. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js +3 -0
  116. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js.map +1 -0
  117. package/dist/source/loader/generateAddressSpaceRaw.d.ts +10 -0
  118. package/dist/source/loader/generateAddressSpaceRaw.js +59 -0
  119. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -0
  120. package/dist/source/loader/load_nodeset2.d.ts +13 -0
  121. package/dist/source/loader/load_nodeset2.js +1392 -0
  122. package/dist/source/loader/load_nodeset2.js.map +1 -0
  123. package/dist/source/loader/namespace_post_step.d.ts +6 -0
  124. package/dist/source/loader/namespace_post_step.js +48 -0
  125. package/dist/source/loader/namespace_post_step.js.map +1 -0
  126. package/dist/source/loader/register_node_promoter.d.ts +3 -0
  127. package/dist/source/loader/register_node_promoter.js +10 -0
  128. package/dist/source/loader/register_node_promoter.js.map +1 -0
  129. package/dist/source/namespace.d.ts +6 -0
  130. package/dist/source/namespace.js +3 -0
  131. package/dist/source/namespace.js.map +1 -0
  132. package/dist/source/namespace_alarm_and_condition.d.ts +24 -0
  133. package/dist/source/namespace_alarm_and_condition.js +3 -0
  134. package/dist/source/namespace_alarm_and_condition.js.map +1 -0
  135. package/dist/source/namespace_data_access.d.ts +42 -0
  136. package/dist/source/namespace_data_access.js +3 -0
  137. package/dist/source/namespace_data_access.js.map +1 -0
  138. package/dist/source/namespace_machine_state.d.ts +7 -0
  139. package/dist/source/namespace_machine_state.js +3 -0
  140. package/dist/source/namespace_machine_state.js.map +1 -0
  141. package/dist/source/pseudo_session.d.ts +55 -0
  142. package/dist/source/pseudo_session.js +205 -0
  143. package/dist/source/pseudo_session.js.map +1 -0
  144. package/dist/source/session_context.d.ts +111 -0
  145. package/dist/source/session_context.js +266 -0
  146. package/dist/source/session_context.js.map +1 -0
  147. package/dist/source/set_namespace_meta_data.d.ts +2 -0
  148. package/dist/source/set_namespace_meta_data.js +60 -0
  149. package/dist/source/set_namespace_meta_data.js.map +1 -0
  150. package/dist/source/ua_namespace_meta_data_type.d.ts +71 -0
  151. package/dist/source/ua_namespace_meta_data_type.js +3 -0
  152. package/dist/source/ua_namespace_meta_data_type.js.map +1 -0
  153. package/dist/source/ua_root_folder.d.ts +9 -0
  154. package/dist/source/ua_root_folder.js +3 -0
  155. package/dist/source/ua_root_folder.js.map +1 -0
  156. package/dist/source/ua_two_state_variable_ex.d.ts +23 -0
  157. package/dist/source/ua_two_state_variable_ex.js +3 -0
  158. package/dist/source/ua_two_state_variable_ex.js.map +1 -0
  159. package/dist/source/xml_writer.d.ts +9 -0
  160. package/dist/source/xml_writer.js +3 -0
  161. package/dist/source/xml_writer.js.map +1 -0
  162. package/dist/src/address_space.d.ts +393 -0
  163. package/dist/src/address_space.js +1375 -0
  164. package/dist/src/address_space.js.map +1 -0
  165. package/dist/src/address_space_change_event_tools.d.ts +6 -0
  166. package/dist/src/address_space_change_event_tools.js +150 -0
  167. package/dist/src/address_space_change_event_tools.js.map +1 -0
  168. package/dist/src/address_space_private.d.ts +44 -0
  169. package/dist/src/address_space_private.js +3 -0
  170. package/dist/src/address_space_private.js.map +1 -0
  171. package/dist/src/alarms_and_conditions/base_event_type.d.ts +26 -0
  172. package/dist/src/alarms_and_conditions/base_event_type.js +41 -0
  173. package/dist/src/alarms_and_conditions/base_event_type.js.map +1 -0
  174. package/dist/src/alarms_and_conditions/check_where_clause.d.ts +4 -0
  175. package/dist/src/alarms_and_conditions/check_where_clause.js +110 -0
  176. package/dist/src/alarms_and_conditions/check_where_clause.js.map +1 -0
  177. package/dist/src/alarms_and_conditions/condition.d.ts +5 -0
  178. package/dist/src/alarms_and_conditions/condition.js +81 -0
  179. package/dist/src/alarms_and_conditions/condition.js.map +1 -0
  180. package/dist/src/alarms_and_conditions/condition_info.d.ts +27 -0
  181. package/dist/src/alarms_and_conditions/condition_info.js +55 -0
  182. package/dist/src/alarms_and_conditions/condition_info.js.map +1 -0
  183. package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +232 -0
  184. package/dist/src/alarms_and_conditions/condition_snapshot.js +667 -0
  185. package/dist/src/alarms_and_conditions/condition_snapshot.js.map +1 -0
  186. package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +21 -0
  187. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +47 -0
  188. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -0
  189. package/dist/src/alarms_and_conditions/extract_event_fields.d.ts +10 -0
  190. package/dist/src/alarms_and_conditions/extract_event_fields.js +90 -0
  191. package/dist/src/alarms_and_conditions/extract_event_fields.js.map +1 -0
  192. package/dist/src/alarms_and_conditions/index.d.ts +18 -0
  193. package/dist/src/alarms_and_conditions/index.js +31 -0
  194. package/dist/src/alarms_and_conditions/index.js.map +1 -0
  195. package/dist/src/alarms_and_conditions/shelving_state_machine.d.ts +22 -0
  196. package/dist/src/alarms_and_conditions/shelving_state_machine.js +241 -0
  197. package/dist/src/alarms_and_conditions/shelving_state_machine.js.map +1 -0
  198. package/dist/src/alarms_and_conditions/trip_alarm.d.ts +16 -0
  199. package/dist/src/alarms_and_conditions/trip_alarm.js +21 -0
  200. package/dist/src/alarms_and_conditions/trip_alarm.js.map +1 -0
  201. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.d.ts +54 -0
  202. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js +255 -0
  203. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js.map +1 -0
  204. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +62 -0
  205. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +244 -0
  206. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -0
  207. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.d.ts +138 -0
  208. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js +460 -0
  209. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js.map +1 -0
  210. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +118 -0
  211. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +417 -0
  212. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -0
  213. package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +29 -0
  214. package/dist/src/alarms_and_conditions/ua_base_event_impl.js +39 -0
  215. package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -0
  216. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.d.ts +35 -0
  217. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js +32 -0
  218. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js.map +1 -0
  219. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +21 -0
  220. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +26 -0
  221. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -0
  222. package/dist/src/alarms_and_conditions/ua_condition_base.d.ts +191 -0
  223. package/dist/src/alarms_and_conditions/ua_condition_base.js +1029 -0
  224. package/dist/src/alarms_and_conditions/ua_condition_base.js.map +1 -0
  225. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +182 -0
  226. package/dist/src/alarms_and_conditions/ua_condition_impl.js +1021 -0
  227. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -0
  228. package/dist/src/alarms_and_conditions/ua_discrete_alarm.d.ts +11 -0
  229. package/dist/src/alarms_and_conditions/ua_discrete_alarm.js +58 -0
  230. package/dist/src/alarms_and_conditions/ua_discrete_alarm.js.map +1 -0
  231. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.d.ts +17 -0
  232. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +58 -0
  233. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -0
  234. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.d.ts +24 -0
  235. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js +59 -0
  236. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js.map +1 -0
  237. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +27 -0
  238. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +57 -0
  239. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -0
  240. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.d.ts +14 -0
  241. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js +17 -0
  242. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js.map +1 -0
  243. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.d.ts +9 -0
  244. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js +12 -0
  245. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js.map +1 -0
  246. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.d.ts +22 -0
  247. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js +87 -0
  248. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js.map +1 -0
  249. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +38 -0
  250. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +87 -0
  251. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -0
  252. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.d.ts +6 -0
  253. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js +11 -0
  254. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js.map +1 -0
  255. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.d.ts +10 -0
  256. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js +8 -0
  257. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +1 -0
  258. package/dist/src/alarms_and_conditions/ua_limit_alarm.d.ts +76 -0
  259. package/dist/src/alarms_and_conditions/ua_limit_alarm.js +237 -0
  260. package/dist/src/alarms_and_conditions/ua_limit_alarm.js.map +1 -0
  261. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +98 -0
  262. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +233 -0
  263. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -0
  264. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.d.ts +27 -0
  265. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js +62 -0
  266. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js.map +1 -0
  267. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +28 -0
  268. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +51 -0
  269. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -0
  270. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.d.ts +49 -0
  271. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js +176 -0
  272. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js.map +1 -0
  273. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +25 -0
  274. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +163 -0
  275. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -0
  276. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.d.ts +47 -0
  277. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js +151 -0
  278. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js.map +1 -0
  279. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +39 -0
  280. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +136 -0
  281. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -0
  282. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.d.ts +16 -0
  283. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js +18 -0
  284. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js.map +1 -0
  285. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.d.ts +16 -0
  286. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js +18 -0
  287. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js.map +1 -0
  288. package/dist/src/apply_condition_refresh.d.ts +6 -0
  289. package/dist/src/apply_condition_refresh.js +28 -0
  290. package/dist/src/apply_condition_refresh.js.map +1 -0
  291. package/dist/src/base_node.d.ts +279 -0
  292. package/dist/src/base_node.js +1364 -0
  293. package/dist/src/base_node.js.map +1 -0
  294. package/dist/src/base_node_impl.d.ts +281 -0
  295. package/dist/src/base_node_impl.js +1394 -0
  296. package/dist/src/base_node_impl.js.map +1 -0
  297. package/dist/src/base_node_private.d.ts +61 -0
  298. package/dist/src/base_node_private.js +521 -0
  299. package/dist/src/base_node_private.js.map +1 -0
  300. package/dist/src/data_access/add_dataItem_stuff.d.ts +11 -0
  301. package/dist/src/data_access/add_dataItem_stuff.js +62 -0
  302. package/dist/src/data_access/add_dataItem_stuff.js.map +1 -0
  303. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.d.ts +1 -0
  304. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js +35 -0
  305. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js.map +1 -0
  306. package/dist/src/data_access/ua_analog_item.d.ts +13 -0
  307. package/dist/src/data_access/ua_analog_item.js +37 -0
  308. package/dist/src/data_access/ua_analog_item.js.map +1 -0
  309. package/dist/src/data_access/ua_data_item.d.ts +16 -0
  310. package/dist/src/data_access/ua_data_item.js +66 -0
  311. package/dist/src/data_access/ua_data_item.js.map +1 -0
  312. package/dist/src/data_access/ua_multistate_discrete.d.ts +23 -0
  313. package/dist/src/data_access/ua_multistate_discrete.js +131 -0
  314. package/dist/src/data_access/ua_multistate_discrete.js.map +1 -0
  315. package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +32 -0
  316. package/dist/src/data_access/ua_multistate_discrete_impl.js +131 -0
  317. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -0
  318. package/dist/src/data_access/ua_multistate_value_discrete.d.ts +51 -0
  319. package/dist/src/data_access/ua_multistate_value_discrete.js +249 -0
  320. package/dist/src/data_access/ua_multistate_value_discrete.js.map +1 -0
  321. package/dist/src/data_access/ua_two_state_discrete.d.ts +25 -0
  322. package/dist/src/data_access/ua_two_state_discrete.js +154 -0
  323. package/dist/src/data_access/ua_two_state_discrete.js.map +1 -0
  324. package/dist/src/event_data.d.ts +29 -0
  325. package/dist/src/event_data.js +96 -0
  326. package/dist/src/event_data.js.map +1 -0
  327. package/dist/src/extension_object_array_node.d.ts +61 -0
  328. package/dist/src/extension_object_array_node.js +266 -0
  329. package/dist/src/extension_object_array_node.js.map +1 -0
  330. package/dist/src/historical_access/address_space_historical_data_node.d.ts +26 -0
  331. package/dist/src/historical_access/address_space_historical_data_node.js +662 -0
  332. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -0
  333. package/dist/src/index_current.d.ts +42 -0
  334. package/dist/src/index_current.js +71 -0
  335. package/dist/src/index_current.js.map +1 -0
  336. package/dist/src/namespace.d.ts +475 -0
  337. package/dist/src/namespace.js +1775 -0
  338. package/dist/src/namespace.js.map +1 -0
  339. package/dist/src/namespace_impl.d.ts +463 -0
  340. package/dist/src/namespace_impl.js +1763 -0
  341. package/dist/src/namespace_impl.js.map +1 -0
  342. package/dist/src/namespace_private.d.ts +21 -0
  343. package/dist/src/namespace_private.js +29 -0
  344. package/dist/src/namespace_private.js.map +1 -0
  345. package/dist/src/nodeid_manager.d.ts +36 -0
  346. package/dist/src/nodeid_manager.js +196 -0
  347. package/dist/src/nodeid_manager.js.map +1 -0
  348. package/dist/src/nodeset_tools/adjust_namespace_array.d.ts +2 -0
  349. package/dist/src/nodeset_tools/adjust_namespace_array.js +14 -0
  350. package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -0
  351. package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +2 -0
  352. package/dist/src/nodeset_tools/construct_namespace_dependency.js +39 -0
  353. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -0
  354. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +2 -0
  355. package/dist/src/nodeset_tools/nodeset_to_xml.js +1155 -0
  356. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -0
  357. package/dist/src/nodeset_tools/typedictionary_to_xml.d.ts +2 -0
  358. package/dist/src/nodeset_tools/typedictionary_to_xml.js +147 -0
  359. package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +1 -0
  360. package/dist/src/reference.d.ts +43 -0
  361. package/dist/src/reference.js +138 -0
  362. package/dist/src/reference.js.map +1 -0
  363. package/dist/src/reference_impl.d.ts +43 -0
  364. package/dist/src/reference_impl.js +138 -0
  365. package/dist/src/reference_impl.js.map +1 -0
  366. package/dist/src/role_permissions.d.ts +2 -0
  367. package/dist/src/role_permissions.js +11 -0
  368. package/dist/src/role_permissions.js.map +1 -0
  369. package/dist/src/session_context.d.ts +4 -0
  370. package/dist/src/session_context.js +9 -0
  371. package/dist/src/session_context.js.map +1 -0
  372. package/dist/src/state_machine/finite_state_machine.d.ts +67 -0
  373. package/dist/src/state_machine/finite_state_machine.js +354 -0
  374. package/dist/src/state_machine/finite_state_machine.js.map +1 -0
  375. package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +34 -0
  376. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +244 -0
  377. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -0
  378. package/dist/src/state_machine/ua_two_state_variable.d.ts +61 -0
  379. package/dist/src/state_machine/ua_two_state_variable.js +332 -0
  380. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -0
  381. package/dist/src/tool_isSupertypeOf.d.ts +17 -0
  382. package/dist/src/tool_isSupertypeOf.js +103 -0
  383. package/dist/src/tool_isSupertypeOf.js.map +1 -0
  384. package/dist/src/ua_condition_type.d.ts +8 -0
  385. package/dist/src/ua_condition_type.js +3 -0
  386. package/dist/src/ua_condition_type.js.map +1 -0
  387. package/dist/src/ua_data_type.d.ts +83 -0
  388. package/dist/src/ua_data_type.js +289 -0
  389. package/dist/src/ua_data_type.js.map +1 -0
  390. package/dist/src/ua_data_type_impl.d.ts +83 -0
  391. package/dist/src/ua_data_type_impl.js +291 -0
  392. package/dist/src/ua_data_type_impl.js.map +1 -0
  393. package/dist/src/ua_method.d.ts +42 -0
  394. package/dist/src/ua_method.js +204 -0
  395. package/dist/src/ua_method.js.map +1 -0
  396. package/dist/src/ua_method_impl.d.ts +40 -0
  397. package/dist/src/ua_method_impl.js +203 -0
  398. package/dist/src/ua_method_impl.js.map +1 -0
  399. package/dist/src/ua_object.d.ts +29 -0
  400. package/dist/src/ua_object.js +153 -0
  401. package/dist/src/ua_object.js.map +1 -0
  402. package/dist/src/ua_object_impl.d.ts +29 -0
  403. package/dist/src/ua_object_impl.js +156 -0
  404. package/dist/src/ua_object_impl.js.map +1 -0
  405. package/dist/src/ua_object_type.d.ts +49 -0
  406. package/dist/src/ua_object_type.js +124 -0
  407. package/dist/src/ua_object_type.js.map +1 -0
  408. package/dist/src/ua_object_type_impl.d.ts +48 -0
  409. package/dist/src/ua_object_type_impl.js +124 -0
  410. package/dist/src/ua_object_type_impl.js.map +1 -0
  411. package/dist/src/ua_reference_type.d.ts +42 -0
  412. package/dist/src/ua_reference_type.js +138 -0
  413. package/dist/src/ua_reference_type.js.map +1 -0
  414. package/dist/src/ua_reference_type_impl.d.ts +43 -0
  415. package/dist/src/ua_reference_type_impl.js +138 -0
  416. package/dist/src/ua_reference_type_impl.js.map +1 -0
  417. package/dist/src/ua_variable.d.ts +346 -0
  418. package/dist/src/ua_variable.js +1721 -0
  419. package/dist/src/ua_variable.js.map +1 -0
  420. package/dist/src/ua_variable_impl.d.ts +353 -0
  421. package/dist/src/ua_variable_impl.js +1719 -0
  422. package/dist/src/ua_variable_impl.js.map +1 -0
  423. package/dist/src/ua_variable_type.d.ts +54 -0
  424. package/dist/src/ua_variable_type.js +555 -0
  425. package/dist/src/ua_variable_type.js.map +1 -0
  426. package/dist/src/ua_variable_type_impl.d.ts +63 -0
  427. package/dist/src/ua_variable_type_impl.js +556 -0
  428. package/dist/src/ua_variable_type_impl.js.map +1 -0
  429. package/dist/src/ua_view.d.ts +16 -0
  430. package/dist/src/ua_view.js +42 -0
  431. package/dist/src/ua_view.js.map +1 -0
  432. package/dist/src/ua_view_impl.d.ts +15 -0
  433. package/dist/src/ua_view_impl.js +37 -0
  434. package/dist/src/ua_view_impl.js.map +1 -0
  435. package/distHelpers/add_event_generator_object.d.ts +3 -0
  436. package/distHelpers/add_event_generator_object.js +66 -0
  437. package/distHelpers/add_event_generator_object.js.map +1 -0
  438. package/distHelpers/alarms_and_conditions_demo.d.ts +10 -0
  439. package/distHelpers/alarms_and_conditions_demo.js +115 -0
  440. package/distHelpers/alarms_and_conditions_demo.js.map +1 -0
  441. package/distHelpers/assertHasMatchingReference.d.ts +19 -0
  442. package/distHelpers/assertHasMatchingReference.js +41 -0
  443. package/distHelpers/assertHasMatchingReference.js.map +1 -0
  444. package/distHelpers/boiler_system.d.ts +113 -0
  445. package/distHelpers/boiler_system.js +397 -0
  446. package/distHelpers/boiler_system.js.map +1 -0
  447. package/distHelpers/create_minimalist_address_space_nodeset.d.ts +5 -0
  448. package/distHelpers/create_minimalist_address_space_nodeset.js +171 -0
  449. package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -0
  450. package/distHelpers/dump_statemachine.d.ts +6 -0
  451. package/distHelpers/dump_statemachine.js +116 -0
  452. package/distHelpers/dump_statemachine.js.map +1 -0
  453. package/distHelpers/get_address_space_fixture.d.ts +1 -0
  454. package/distHelpers/get_address_space_fixture.js +31 -0
  455. package/distHelpers/get_address_space_fixture.js.map +1 -0
  456. package/distHelpers/get_mini_address_space.d.ts +7 -0
  457. package/distHelpers/get_mini_address_space.js +37 -0
  458. package/distHelpers/get_mini_address_space.js.map +1 -0
  459. package/distHelpers/index.d.ts +11 -0
  460. package/distHelpers/index.js +24 -0
  461. package/distHelpers/index.js.map +1 -0
  462. package/distNodeJS/generate_address_space.d.ts +4 -0
  463. package/distNodeJS/generate_address_space.js +31 -0
  464. package/distNodeJS/generate_address_space.js.map +1 -0
  465. package/distNodeJS/index.d.ts +1 -0
  466. package/distNodeJS/index.js +14 -0
  467. package/distNodeJS/index.js.map +1 -0
  468. package/generate.js +1 -0
  469. package/nodeJS.d.ts +1 -0
  470. package/nodeJS.js +1 -0
  471. package/package.json +87 -0
  472. package/source/address_space_ts.ts +217 -0
  473. package/source/continuation_points/continuation_point_manager.ts +121 -0
  474. package/source/helpers/adjust_browse_direction.ts +15 -0
  475. package/source/helpers/argument_list.ts +286 -0
  476. package/source/helpers/call_helpers.ts +112 -0
  477. package/source/helpers/check_event_clause.ts +62 -0
  478. package/source/helpers/coerce_enum_value.ts +33 -0
  479. package/source/helpers/dump_tools.ts +92 -0
  480. package/source/helpers/ensure_secure_access.ts +88 -0
  481. package/source/helpers/make_optionals_map.ts +49 -0
  482. package/source/helpers/resolve_opaque_on_address_space.ts +23 -0
  483. package/source/index.ts +49 -0
  484. package/source/interfaces/alarms_and_conditions/condition_info_i.ts +13 -0
  485. package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +26 -0
  486. package/source/interfaces/data_access/ua_multistate_value_discrete_ex.ts +34 -0
  487. package/source/interfaces/data_access/ua_two_state_discrete_ex.ts +14 -0
  488. package/source/interfaces/data_access/ua_y_array_item_ex.ts +10 -0
  489. package/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.ts +14 -0
  490. package/source/interfaces/state_machine/ua_finite_state_machine_type.ts +50 -0
  491. package/source/interfaces/state_machine/ua_program_state_machine_type.ts +13 -0
  492. package/source/interfaces/state_machine/ua_state_machine_type.ts +261 -0
  493. package/source/interfaces/state_machine/ua_transition_ex.ts +7 -0
  494. package/source/interfaces/ua_subscription_diagnostics_variable_ex.ts +8 -0
  495. package/source/loader/generateAddressSpaceRaw.ts +79 -0
  496. package/source/loader/load_nodeset2.ts +1600 -0
  497. package/source/loader/namespace_post_step.ts +36 -0
  498. package/source/loader/register_node_promoter.ts +8 -0
  499. package/source/namespace.ts +9 -0
  500. package/source/namespace_alarm_and_condition.ts +47 -0
  501. package/source/namespace_data_access.ts +60 -0
  502. package/source/namespace_machine_state.ts +13 -0
  503. package/source/pseudo_session.ts +288 -0
  504. package/source/session_context.ts +345 -0
  505. package/source/set_namespace_meta_data.ts +68 -0
  506. package/source/ua_root_folder.ts +10 -0
  507. package/source/ua_two_state_variable_ex.ts +35 -0
  508. package/source/xml_writer.ts +15 -0
  509. package/source_nodejs/generate_address_space.ts +36 -0
  510. package/source_nodejs/index.ts +1 -0
  511. package/src/address_space.ts +1575 -0
  512. package/src/address_space_change_event_tools.ts +177 -0
  513. package/src/address_space_private.ts +98 -0
  514. package/src/alarms_and_conditions/check_where_clause.ts +148 -0
  515. package/src/alarms_and_conditions/condition.ts +89 -0
  516. package/src/alarms_and_conditions/condition_info.ts +66 -0
  517. package/src/alarms_and_conditions/condition_snapshot.ts +766 -0
  518. package/src/alarms_and_conditions/deviation_alarm_helper.ts +66 -0
  519. package/src/alarms_and_conditions/extract_event_fields.ts +104 -0
  520. package/src/alarms_and_conditions/index.ts +18 -0
  521. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +339 -0
  522. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +513 -0
  523. package/src/alarms_and_conditions/ua_base_event_impl.ts +55 -0
  524. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +50 -0
  525. package/src/alarms_and_conditions/ua_condition_impl.ts +1298 -0
  526. package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +81 -0
  527. package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +110 -0
  528. package/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.ts +19 -0
  529. package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +130 -0
  530. package/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.ts +24 -0
  531. package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +305 -0
  532. package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +108 -0
  533. package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +224 -0
  534. package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +186 -0
  535. package/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.ts +27 -0
  536. package/src/apply_condition_refresh.ts +30 -0
  537. package/src/base_node_impl.ts +1749 -0
  538. package/src/base_node_private.ts +690 -0
  539. package/src/data_access/add_dataItem_stuff.ts +75 -0
  540. package/src/data_access/check_variant_compatibility_ua_analog_item.ts +41 -0
  541. package/src/data_access/ua_multistate_discrete_impl.ts +168 -0
  542. package/src/data_access/ua_multistate_value_discrete.ts +299 -0
  543. package/src/data_access/ua_two_state_discrete.ts +185 -0
  544. package/src/event_data.ts +117 -0
  545. package/src/extension_object_array_node.ts +325 -0
  546. package/src/historical_access/address_space_historical_data_node.ts +828 -0
  547. package/src/index_current.ts +52 -0
  548. package/src/namespace_impl.ts +2181 -0
  549. package/src/namespace_private.ts +60 -0
  550. package/src/nodeid_manager.ts +228 -0
  551. package/src/nodeset_tools/adjust_namespace_array.ts +11 -0
  552. package/src/nodeset_tools/construct_namespace_dependency.ts +40 -0
  553. package/src/nodeset_tools/nodeset_to_xml.ts +1317 -0
  554. package/src/nodeset_tools/typedictionary_to_xml.ts +175 -0
  555. package/src/reference_impl.ts +169 -0
  556. package/src/role_permissions.ts +6 -0
  557. package/src/state_machine/finite_state_machine.ts +428 -0
  558. package/src/state_machine/ua_shelving_state_machine_ex.ts +314 -0
  559. package/src/state_machine/ua_two_state_variable.ts +421 -0
  560. package/src/tool_isSupertypeOf.ts +129 -0
  561. package/src/ua_condition_type.ts +10 -0
  562. package/src/ua_data_type_impl.ts +356 -0
  563. package/src/ua_method_impl.ts +278 -0
  564. package/src/ua_object_impl.ts +203 -0
  565. package/src/ua_object_type_impl.ts +158 -0
  566. package/src/ua_reference_type_impl.ts +174 -0
  567. package/src/ua_variable_impl.ts +2277 -0
  568. package/src/ua_variable_type_impl.ts +741 -0
  569. package/src/ua_view_impl.ts +54 -0
  570. package/testHelpers.d.ts +1 -0
  571. package/testHelpers.js +1 -0
  572. package/test_helpers/add_event_generator_object.ts +71 -0
  573. package/test_helpers/alarms_and_conditions_demo.ts +147 -0
  574. package/test_helpers/assertHasMatchingReference.ts +43 -0
  575. package/test_helpers/boiler_system.ts +618 -0
  576. package/test_helpers/create_minimalist_address_space_nodeset.ts +208 -0
  577. package/test_helpers/dump_statemachine.ts +155 -0
  578. package/test_helpers/get_address_space_fixture.ts +30 -0
  579. package/test_helpers/get_mini_address_space.ts +42 -0
  580. package/test_helpers/index.ts +11 -0
  581. package/test_helpers/test_fixtures/dataType_in_separateNamespace.xml +150 -0
  582. package/test_helpers/test_fixtures/dataType_in_separateNamespace_basic.xml +57 -0
  583. package/test_helpers/test_fixtures/dataType_in_separateNamespace_mix.xml +136 -0
  584. package/test_helpers/test_fixtures/dataType_withEnumeration.xml +82 -0
  585. package/test_helpers/test_fixtures/dataType_with_isOptionSet.xml +194 -0
  586. package/test_helpers/test_fixtures/dataType_with_structures.xml +605 -0
  587. package/test_helpers/test_fixtures/dataType_with_union.xml +1 -0
  588. package/test_helpers/test_fixtures/datatype_as_per_1.04.xml +91 -0
  589. package/test_helpers/test_fixtures/fixture_empty_nodeset2.xml +106 -0
  590. package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +1303 -0
  591. package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +362 -0
  592. package/test_helpers/test_fixtures/issue_846.xml +3172 -0
  593. package/test_helpers/test_fixtures/issue_899_variable_with_nodeid_value.xml +33 -0
  594. package/test_helpers/test_fixtures/mini.Node.Set2.xml +4508 -0
  595. package/test_helpers/test_fixtures/mini.nodeset.withVariousVariables.xml +194 -0
  596. package/test_helpers/test_fixtures/minimalist_nodeset_with_models.xml +8 -0
  597. package/test_helpers/test_fixtures/minimalist_nodeset_with_models_more_complex.xml +16 -0
  598. package/test_helpers/test_fixtures/nodeset_with_analog_items.xml +45 -0
@@ -0,0 +1,828 @@
1
+ /**
2
+ * @module node-opcua-address-space
3
+ * @class IAddressSpace
4
+ */
5
+ // tslint:disable:no-console
6
+
7
+ import * as chalk from "chalk";
8
+
9
+ import { assert } from "node-opcua-assert";
10
+ import { AccessLevelFlag, NodeClass, QualifiedNameLike } from "node-opcua-data-model";
11
+ import { DataValue } from "node-opcua-data-value";
12
+ import { isMinDate } from "node-opcua-date-time";
13
+ import { UAHistoricalDataConfiguration } from "node-opcua-nodeset-ua";
14
+ import { NumericRange } from "node-opcua-numeric-range";
15
+ import {
16
+ HistoryData,
17
+ HistoryReadResult,
18
+ ReadAtTimeDetails,
19
+ ReadEventDetails,
20
+ ReadProcessedDetails,
21
+ ReadRawModifiedDetails
22
+ } from "node-opcua-service-history";
23
+ import { StatusCodes } from "node-opcua-status-code";
24
+ import { CallbackT } from "node-opcua-status-code";
25
+ import { DataType } from "node-opcua-variant";
26
+ import {
27
+ IAddressSpace,
28
+ ContinuationPoint,
29
+ ContinuationPointData,
30
+ IVariableHistorian,
31
+ IVariableHistorianOptions,
32
+ UAVariable
33
+ } from "node-opcua-address-space-base";
34
+ import { ISessionContext } from "node-opcua-address-space-base";
35
+
36
+ import { UAVariableImpl } from "../ua_variable_impl";
37
+ import { AddressSpace } from "../../source/address_space_ts";
38
+ import { AddressSpacePrivate } from "../address_space_private";
39
+
40
+ // tslint:disable:no-var-requires
41
+ const Dequeue = require("dequeue");
42
+
43
+ /* interface Historian */
44
+ // {
45
+ //
46
+ // }
47
+ function inInTimeRange(historyReadDetails: any, dataValue: DataValue): boolean {
48
+ if (
49
+ historyReadDetails.startTime &&
50
+ !isMinDate(historyReadDetails.startTime) &&
51
+ dataValue.sourceTimestamp! < historyReadDetails.startTime
52
+ ) {
53
+ return false;
54
+ }
55
+ if (
56
+ historyReadDetails.endTime &&
57
+ !isMinDate(historyReadDetails.endTime) &&
58
+ dataValue.sourceTimestamp! > historyReadDetails.endTime
59
+ ) {
60
+ return false;
61
+ }
62
+ return true;
63
+ }
64
+
65
+ function inInTimeRange2(historyReadDetails: any, dataValue: DataValue): boolean {
66
+ if (
67
+ historyReadDetails.endTime &&
68
+ !isMinDate(historyReadDetails.endTime) &&
69
+ dataValue.sourceTimestamp! > historyReadDetails.endTime
70
+ ) {
71
+ return false;
72
+ }
73
+ return !(
74
+ historyReadDetails.startTime &&
75
+ !isMinDate(historyReadDetails.startTime) &&
76
+ dataValue.sourceTimestamp! < historyReadDetails.startTime
77
+ );
78
+ }
79
+
80
+ function filter_dequeue(
81
+ q: any,
82
+ historyReadRawModifiedDetails: ReadRawModifiedDetails,
83
+ onlyThisNumber: number,
84
+ isReversed: boolean
85
+ ) {
86
+ const r: any[] = [];
87
+ const predicate = isReversed
88
+ ? inInTimeRange2.bind(null, historyReadRawModifiedDetails)
89
+ : inInTimeRange.bind(null, historyReadRawModifiedDetails);
90
+
91
+ if (isReversed) {
92
+ let c = q.head.prev;
93
+ while (c.data) {
94
+ if (predicate(c.data)) {
95
+ r.push(c.data);
96
+ }
97
+ c = c.prev;
98
+ if (onlyThisNumber && r.length === onlyThisNumber) {
99
+ return r;
100
+ }
101
+ }
102
+ } else {
103
+ let c = q.head.next;
104
+ while (c.data) {
105
+ if (predicate(c.data)) {
106
+ r.push(c.data);
107
+ }
108
+ c = c.next;
109
+ if (onlyThisNumber && r.length === onlyThisNumber) {
110
+ return r;
111
+ }
112
+ }
113
+ }
114
+ return r;
115
+ }
116
+
117
+ export class VariableHistorian implements IVariableHistorian {
118
+ public readonly node: UAVariable;
119
+ private readonly _timeline: any /* Dequeue */;
120
+ private readonly _maxOnlineValues: number;
121
+ private lastDate: Date;
122
+ private lastDatePicoSeconds: number;
123
+
124
+ constructor(node: UAVariable, options: IVariableHistorianOptions) {
125
+ this._timeline = new Dequeue(); // is is ordered here ??????
126
+ this._maxOnlineValues = options.maxOnlineValues || 1000;
127
+ this.lastDate = new Date(1600, 0, 1, 0, 0, 0);
128
+ this.lastDatePicoSeconds = 0;
129
+ this.node = node;
130
+ }
131
+
132
+ /* public */
133
+ public push(newDataValue: DataValue): any {
134
+ this._timeline.push(newDataValue);
135
+
136
+ const sourceTime = newDataValue.sourceTimestamp || new Date();
137
+ const sourcePicoSeconds = newDataValue.sourcePicoseconds || 0;
138
+
139
+ // ensure that values are set with date increasing
140
+ if (sourceTime.getTime() <= this.lastDate.getTime()) {
141
+ if (!(sourceTime.getTime() === this.lastDate.getTime() && sourcePicoSeconds > this.lastDatePicoSeconds)) {
142
+ console.log(
143
+ chalk.red("Warning date not increasing "),
144
+ newDataValue.toString(),
145
+ " last known date = ",
146
+ this.lastDate
147
+ );
148
+ }
149
+ }
150
+
151
+ this.lastDate = sourceTime;
152
+ this.lastDatePicoSeconds = newDataValue.sourcePicoseconds || 0;
153
+
154
+ // we keep only a limited amount in main memory
155
+ if (this._timeline.length > this._maxOnlineValues) {
156
+ assert(typeof this._maxOnlineValues === "number" && this._maxOnlineValues > 0);
157
+ while (this._timeline.length > this._maxOnlineValues) {
158
+ this._timeline.shift();
159
+ }
160
+ }
161
+
162
+ if (this._timeline.length >= this._maxOnlineValues || this._timeline.length === 1) {
163
+ const first = this._timeline.first();
164
+ (this.node as UAVariableImpl)._update_startOfOnlineArchive(first.sourceTimestamp);
165
+ // we update the node startOnlineDate
166
+ }
167
+ }
168
+
169
+ public extractDataValues(
170
+ historyReadRawModifiedDetails: ReadRawModifiedDetails,
171
+ maxNumberToExtract: number,
172
+ isReversed: boolean,
173
+ reverseDataValue: boolean,
174
+ callback: CallbackT<DataValue[]>
175
+ ): void {
176
+ assert(callback instanceof Function);
177
+
178
+ let dataValues = filter_dequeue(this._timeline, historyReadRawModifiedDetails, maxNumberToExtract, isReversed);
179
+
180
+ if (reverseDataValue) {
181
+ dataValues = dataValues.reverse();
182
+ }
183
+ callback(null, dataValues);
184
+ }
185
+ }
186
+
187
+ function _get_startOfOfflineArchive(node: UAVariableImpl) {
188
+ if (!node.$historicalDataConfiguration) {
189
+ throw new Error("this variable has no HistoricalDataConfiguration");
190
+ }
191
+ return node.$historicalDataConfiguration.startOfArchive?.readValue();
192
+ }
193
+
194
+ function _get_startOfArchive(node: UAVariableImpl) {
195
+ if (!node.$historicalDataConfiguration) {
196
+ throw new Error("this variable has no HistoricalDataConfiguration");
197
+ }
198
+ return node.$historicalDataConfiguration!.startOfArchive?.readValue();
199
+ }
200
+
201
+ function _update_startOfArchive(this: UAVariableImpl, newDate: Date): void {
202
+ if (!this.$historicalDataConfiguration) {
203
+ throw new Error("this variable has no HistoricalDataConfiguration");
204
+ }
205
+ this.$historicalDataConfiguration.startOfArchive?.setValueFromSource({
206
+ dataType: DataType.DateTime,
207
+ value: newDate
208
+ });
209
+ }
210
+
211
+ function _update_startOfOnlineArchive(this: UAVariableImpl, newDate: Date): void {
212
+ if (!this.$historicalDataConfiguration) {
213
+ throw new Error("this variable has no HistoricalDataConfiguration");
214
+ }
215
+
216
+ // The StartOfArchive Variable specifies the date before which there is no data
217
+ // in the archive either online or offline.
218
+ // The StartOfOnlineArchive Variable specifies the date of the earliest data
219
+ // in the online archive.
220
+ this.$historicalDataConfiguration.startOfOnlineArchive?.setValueFromSource({
221
+ dataType: DataType.DateTime,
222
+ value: newDate
223
+ });
224
+
225
+ const startOfArchiveDataValue = _get_startOfOfflineArchive(this);
226
+ if (
227
+ startOfArchiveDataValue &&
228
+ (startOfArchiveDataValue.statusCode !== StatusCodes.Good ||
229
+ !startOfArchiveDataValue.value ||
230
+ !startOfArchiveDataValue.value.value ||
231
+ startOfArchiveDataValue.value.value.getTime() >= newDate.getTime())
232
+ ) {
233
+ this._update_startOfArchive(newDate);
234
+ }
235
+ }
236
+
237
+ UAVariableImpl.prototype._update_startOfOnlineArchive = _update_startOfOnlineArchive;
238
+ UAVariableImpl.prototype._update_startOfArchive = _update_startOfArchive;
239
+
240
+ function _historyPush(this: UAVariableImpl, newDataValue: DataValue) {
241
+ if (!this.varHistorian) {
242
+ throw new Error("this variable has no HistoricalDataConfiguration");
243
+ }
244
+ assert(Object.prototype.hasOwnProperty.call(this, "historizing"), "expecting a historizing attribute on node");
245
+ if (!this.historizing) {
246
+ return; //
247
+ }
248
+ assert(this.historizing === true);
249
+ this.varHistorian.push(newDataValue);
250
+ }
251
+
252
+ function createContinuationPoint(): ContinuationPoint {
253
+ // todo: improve
254
+ return Buffer.from("ABCDEF");
255
+ }
256
+
257
+ function _historyReadModify(
258
+ this: UAVariable,
259
+ context: ISessionContext,
260
+ historyReadRawModifiedDetails: any,
261
+ indexRange: NumericRange | null,
262
+ dataEncoding: QualifiedNameLike | null,
263
+ continuationPoint: ContinuationPoint | null,
264
+ callback: CallbackT<HistoryReadResult>
265
+ ) {
266
+ //
267
+ // 6.4.3.3 Read modified functionality
268
+ // Release 1.03 26 OPC Unified Architecture, Part 11
269
+ //
270
+ // When this structure is used for reading Modified Values (isReadModified is set to TRUE), it
271
+ // reads the modified values, StatusCodes, timestamps, modification type, the user identifier,
272
+ // and the timestamp of the modification from the history database for the specified time domain
273
+ // for one or more HistoricalDataNodes. If there are multiple replaced values the Server shall
274
+ // return all of them. The updateType specifies what value is returned in the modification record.
275
+ // If the updateType is INSERT the value is the new value that was inserted. If the updateType
276
+ // is anything else the value is the old value that was changed. See 6.8 HistoryUpdateDetails
277
+ // parameter for details on what updateTypes are available.
278
+ // The purpose of this function is to read values from history that have been Modified. The
279
+ // returnBounds parameter shall be set to FALSE for this case, otherwise the Server returns a
280
+ // BadInvalidArgument StatusCode.
281
+ // The domain of the request is defined by startTime, endTime, and numValuesPerNode; at least
282
+ // two of these shall be specified. If endTime is less than startTime, or endTime and
283
+ // numValuesPerNode alone are specified, then the data shall be returned in reverse order with
284
+ // the later data coming first. If all three are specified then the call shall return up to
285
+ // numValuesPerNode results going from StartTime to EndTime, in either ascending or
286
+ // descending order depending on the relative values of StartTime and EndTime. If more than
287
+ // numValuesPerNode values exist within that time range for a given Node then only
288
+ // numValuesPerNode values per Node are returned along with a continuationPoint. When a
289
+ // continuationPoint is returned, a Client wanting the next numValuesPerNode values should call
290
+ // ReadRaw again with the continuationPoint set. If numValuesPerNode is 0 then all of the
291
+ // values in the range are returned. If the Server cannot return all modified values for a given
292
+ // timestamp in a single response then it shall return modified values with the same timestamp
293
+ // in subsequent calls.
294
+ // If the request takes a long time to process then the Server can return partial results with a
295
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
296
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results. In this case
297
+ // the Server may return zero results with a ContinuationPoint that allows the Server to resume
298
+ // the calculation on the next Client HistoryRead call.
299
+ // If a value has been modified multiple times then all values for the time are returned. This
300
+ // means that a timestamp can appear in the array more than once. The order of the returned
301
+ // values with the same timestamp should be from the most recent to oldest modification
302
+ // timestamp, if startTime is less than or equal to endTime. If endTime is less than startTime,
303
+ // then the order of the returned values will be from the oldest modification timestamp to the
304
+ // most recent. It is Server dependent whether multiple modifications are kept or only the most
305
+ // recent.
306
+ // A Server does not have to create a modification record for data when it is first added to the
307
+ // historical collection. If it does then it shall set the ExtraData bit and the Client can read the
308
+ // modification record using a ReadModified call. If the data is subsequently modified the Server
309
+ // shall create a second modification record which is returned along with the original
310
+ // modification record whenever a Client uses the ReadModified call if the Server supports
311
+ // multiple modification records per timestamp.
312
+ // If the requested TimestampsToReturn is not supported for a Node then the operation shall
313
+ // return the BadTimestampNotSupported StatusCode.
314
+
315
+ // todo : provide correct implementation
316
+ const result = new HistoryReadResult({
317
+ historyData: new HistoryData({ dataValues: [] }),
318
+ statusCode: StatusCodes.BadUnexpectedError
319
+ });
320
+ return callback(null, result);
321
+ }
322
+
323
+ function _historyReadRawAsync(
324
+ this: UAVariableImpl,
325
+ historyReadRawModifiedDetails: ReadRawModifiedDetails,
326
+ maxNumberToExtract: number,
327
+ isReversed: boolean,
328
+ reverseDataValue: boolean,
329
+ callback: CallbackT<DataValue[]>
330
+ ) {
331
+ assert(callback instanceof Function);
332
+ this.varHistorian!.extractDataValues(historyReadRawModifiedDetails, maxNumberToExtract, isReversed, reverseDataValue, callback);
333
+ }
334
+
335
+ function _historyReadRaw(
336
+ this: UAVariable,
337
+ context: ISessionContext,
338
+ historyReadRawModifiedDetails: ReadRawModifiedDetails,
339
+ indexRange: NumericRange | null,
340
+ dataEncoding: QualifiedNameLike | null,
341
+ continuationPoint: ContinuationPoint | null,
342
+ callback: CallbackT<HistoryReadResult>
343
+ ): void {
344
+ assert(historyReadRawModifiedDetails instanceof ReadRawModifiedDetails);
345
+
346
+ // 6.4.3.2 Read raw functionality
347
+ //
348
+ // When this structure is used for reading Raw Values (isReadModified is set to FALSE), it reads
349
+ // the values, qualities, and timestamps from the history database for the specified time domain
350
+ // for one or more HistoricalDataNodes.
351
+ //
352
+ // This parameter is intended for use by a Client that wants the actual data saved within the historian.
353
+ //
354
+ // The actual data may be compressed or may be all raw data collected for the item depending on the
355
+ // historian and the storage rules invoked when the item values were saved.
356
+ //
357
+ // When returnBounds is TRUE, the Bounding Values for the time domain are returned. The optional Bounding
358
+ // Values are provided to allow the Client to interpolate values for the start and end times when trending
359
+ // the actual data on a display.
360
+ //
361
+ // The time domain of the request is defined by startTime, endTime, and numValuesPerNode;
362
+ // at least two of these shall be specified.
363
+ //
364
+ // If endTime is less than startTime, or endTime and numValuesPerNode alone are specified
365
+ // then the data will be returned in reverse order, with later data coming first as if time
366
+ // were flowing backward.
367
+ //
368
+ // If all three are specified then the call shall return up to numValuesPerNode results going from
369
+ // startTime to endTime, in either ascending or descending order depending on the relative values
370
+ // of startTime and endTime.
371
+ //
372
+ // If numValuesPerNode is 0, then all the values in the range are returned.
373
+ //
374
+ // A default value of DateTime.MinValue (see Part 6) is used to indicate when startTime or
375
+ // endTime is not specified.
376
+ //
377
+ // It is specifically allowed for the startTime and the endTime to be identical.
378
+ // This allows the Client to request just one value.
379
+ // When the startTime and endTime are identical then time is presumed to be flowing forward.
380
+ // It is specifically not allowed for the Server to return a Bad_InvalidArgument StatusCode
381
+ // if the requested time domain is outside of the Server's range. Such a case shall be treated
382
+ // as an interval in which no data exists.
383
+ //
384
+ // If a startTime, endTime and numValuesPerNode are all provided and if more than
385
+ // numValuesPerNode values exist within that time range for a given Node then only
386
+ // numValuesPerNode values per Node are returned along with a continuationPoint.
387
+ //
388
+ // When a continuationPoint is returned, a Client wanting the next numValuesPerNode values
389
+ // should call ReadRaw again with the continuationPoint set.
390
+ //
391
+ // If the request takes a long time to process then the Server can return partial results with a
392
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
393
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results.
394
+ // In this case the Server may return zero results with a ContinuationPoint that allows the
395
+ // Server to resume the calculation on the next Client HistoryRead call.
396
+ //
397
+ // If Bounding Values are requested and a non-zero numValuesPerNode was specified then any
398
+ // Bounding Values returned are included in the numValuesPerNode count.
399
+ //
400
+ // If numValuesPerNode is 1 then only the start bound is returned (the end bound if the reverse
401
+ // order is needed).
402
+ //
403
+ // If numValuesPerNode is 2 then the start bound and the first data point are
404
+ // returned (the end bound if reverse order is needed).
405
+ //
406
+ // When Bounding Values are requested and no bounding value is found then the corresponding
407
+ // StatusCode entry will be set to Bad_BoundNotFound, a timestamp equal to the start or end time
408
+ // as appropriate, and a value of null.
409
+ // How far back or forward to look in history for Bounding Values is Server dependent.
410
+ //
411
+ // For an interval in which no data exists, if Bounding Values are not requested, then the
412
+ // corresponding StatusCode shall be Good_NoData. If Bounding Values are requested and one
413
+ // or both exist, then the result code returned is Success and the bounding value(s) are
414
+ // returned.
415
+ //
416
+ // For cases where there are multiple values for a given timestamp, all but the most recent are
417
+ // considered to be Modified values and the Server shall return the most recent value. If the
418
+ // Server returns a value which hides other values at a timestamp then it shall set the ExtraData
419
+ // bit in the StatusCode associated with that value. If the Server contains additional information
420
+ // regarding a value then the ExtraData bit shall also be set. It indicates that ModifiedValues are
421
+ // available for retrieval, see 6.4.3.3.
422
+ //
423
+ // If the requested TimestampsToReturn is not supported for a Node, the operation shall return
424
+ // the Bad_TimestampNotSupported StatusCode.
425
+
426
+ if (continuationPoint) {
427
+ const cnt: ContinuationPointData | null = context.continuationPoints
428
+ ? context.continuationPoints[continuationPoint.toString("hex")]
429
+ : null;
430
+ if (!cnt) {
431
+ // invalid continuation point
432
+ const result1 = new HistoryReadResult({
433
+ historyData: new HistoryData({ dataValues: [] }),
434
+ statusCode: StatusCodes.BadContinuationPointInvalid
435
+ });
436
+ return callback(null, result1);
437
+ }
438
+ const dataValues = cnt.dataValues.splice(0, historyReadRawModifiedDetails.numValuesPerNode);
439
+ if (cnt.dataValues.length > 0) {
440
+ //
441
+ } else {
442
+ context.continuationPoints![continuationPoint.toString("hex")] = null;
443
+ continuationPoint = null;
444
+ }
445
+ const result2 = new HistoryReadResult({
446
+ continuationPoint: continuationPoint || undefined,
447
+ historyData: new HistoryData({ dataValues }),
448
+ statusCode: StatusCodes.Good
449
+ });
450
+ return callback(null, result2);
451
+ }
452
+
453
+ // todo add special treatment for when startTime > endTime
454
+ // ( in this case series must be return in reverse order )
455
+
456
+ let maxNumberToExtract = 0;
457
+ let isReversed = false;
458
+ let reverseDataValue = false;
459
+ if (isMinDate(historyReadRawModifiedDetails.endTime!)) {
460
+ // end time is not specified
461
+ maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
462
+ if (isMinDate(historyReadRawModifiedDetails.startTime!)) {
463
+ // end start and start time are not specified, this is invalid
464
+ const result = new HistoryReadResult({
465
+ statusCode: StatusCodes.BadHistoryOperationUnsupported // should be an error
466
+ });
467
+ return callback(null, result);
468
+ }
469
+ } else if (isMinDate(historyReadRawModifiedDetails.startTime!)) {
470
+ // start time is not specified
471
+ // end time is specified
472
+ maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
473
+ isReversed = true;
474
+ reverseDataValue = false;
475
+
476
+ if (historyReadRawModifiedDetails.numValuesPerNode === 0) {
477
+ // when start time is not specified
478
+ // and end time is specified
479
+ // numValuesPerNode shall be greater than 0
480
+ const result = new HistoryReadResult({
481
+ statusCode: StatusCodes.BadHistoryOperationUnsupported // should be an error
482
+ });
483
+ return callback(null, result);
484
+ }
485
+ } else {
486
+ // start time is specified
487
+ // end time is specified
488
+ if (historyReadRawModifiedDetails.endTime!.getTime() < historyReadRawModifiedDetails.startTime!.getTime()) {
489
+ reverseDataValue = true;
490
+ const tmp = historyReadRawModifiedDetails.endTime;
491
+ historyReadRawModifiedDetails.endTime = historyReadRawModifiedDetails.startTime;
492
+ historyReadRawModifiedDetails.startTime = tmp;
493
+ }
494
+ }
495
+
496
+ (this as UAVariableImpl)._historyReadRawAsync(
497
+ historyReadRawModifiedDetails,
498
+ maxNumberToExtract,
499
+ isReversed,
500
+ reverseDataValue,
501
+ (err: Error | null, dataValues?: DataValue[]) => {
502
+ if (err || !dataValues) {
503
+ return callback(err);
504
+ }
505
+
506
+ // now make sure that only the requested number of value is returned
507
+ if (historyReadRawModifiedDetails.numValuesPerNode >= 1) {
508
+ if (dataValues.length === 0) {
509
+ const result1 = new HistoryReadResult({
510
+ historyData: new HistoryData({ dataValues: [] }),
511
+ statusCode: StatusCodes.GoodNoData
512
+ });
513
+ return callback(null, result1);
514
+ } else {
515
+ const remaining = dataValues;
516
+ dataValues = remaining.splice(0, historyReadRawModifiedDetails.numValuesPerNode);
517
+
518
+ if (remaining.length > 0 && !isMinDate(historyReadRawModifiedDetails.endTime)) {
519
+ continuationPoint = createContinuationPoint();
520
+ context.continuationPoints = context.continuationPoints || {};
521
+ context.continuationPoints[continuationPoint.toString("hex")] = {
522
+ dataValues: remaining
523
+ };
524
+ }
525
+ }
526
+ }
527
+ const result = new HistoryReadResult({
528
+ continuationPoint: continuationPoint || undefined,
529
+ historyData: new HistoryData({ dataValues }),
530
+ statusCode: StatusCodes.Good
531
+ });
532
+ callback(null, result);
533
+ }
534
+ );
535
+ }
536
+
537
+ function _historyReadRawModify(
538
+ this: UAVariable,
539
+ context: ISessionContext,
540
+ historyReadRawModifiedDetails: ReadRawModifiedDetails,
541
+ indexRange: NumericRange | null,
542
+ dataEncoding: QualifiedNameLike | null,
543
+ continuationPoint: ContinuationPoint | null,
544
+ callback: CallbackT<HistoryReadResult>
545
+ ) {
546
+ const node = this as UAVariableImpl;
547
+
548
+ assert(historyReadRawModifiedDetails instanceof ReadRawModifiedDetails);
549
+
550
+ if (!historyReadRawModifiedDetails.isReadModified) {
551
+ return node._historyReadRaw(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback);
552
+ } else {
553
+ return node._historyReadModify(
554
+ context,
555
+ historyReadRawModifiedDetails,
556
+ indexRange,
557
+ dataEncoding,
558
+ continuationPoint,
559
+ callback
560
+ );
561
+ }
562
+ }
563
+
564
+ function _historyRead(
565
+ this: UAVariableImpl,
566
+ context: ISessionContext,
567
+ historyReadDetails: ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails,
568
+ indexRange: NumericRange | null,
569
+ dataEncoding: QualifiedNameLike | null,
570
+ continuationPoint: ContinuationPoint | null,
571
+ callback: CallbackT<HistoryReadResult>
572
+ ) {
573
+ assert(callback instanceof Function);
574
+ if (historyReadDetails instanceof ReadRawModifiedDetails) {
575
+ // note: only ReadRawModifiedDetails supported at this time
576
+ return this._historyReadRawModify(context, historyReadDetails, indexRange, dataEncoding, continuationPoint, callback);
577
+ } else if (historyReadDetails instanceof ReadEventDetails) {
578
+ // The ReadEventDetails structure is used to read the Events from the history database for the
579
+ // specified time domain for one or more HistoricalEventNodes. The Events are filtered based on
580
+ // the filter structure provided. This filter includes the EventFields that are to be returned. For a
581
+ // complete description of filter refer to Part 4.
582
+ // The startTime and endTime are used to filter on the Time field for Events.
583
+ // The time domain of the request is defined by startTime, endTime, and numValuesPerNode; at
584
+ // least two of these shall be specified. If endTime is less than startTime, or endTime and
585
+ // numValuesPerNode alone are specified then the data will be returned in reverse order with
586
+ // later/newer data provided first as if time were flowing backward. If all three are specified then
587
+ // the call shall return up to numValuesPerNode results going from startTime to endTime, in
588
+ // either ascending or descending order depending on the relative values of startTime and
589
+ // endTime. If numValuesPerNode is 0 then all of the values in the range are returned. The
590
+ // default value is used to indicate when startTime, endTime or numValuesPerNode are not
591
+ // specified.
592
+ // It is specifically allowed for the startTime and the endTime to be identical. This allows the
593
+ // Client to request the Event at a single instance in time. When the startTime and endTime are
594
+ // identical then time is presumed to be flowing forward. If no data exists at the time specified
595
+ // then the Server shall return the Good_NoData StatusCode.
596
+ // If a startTime, endTime and numValuesPerNode are all provided, and if more than
597
+ // numValuesPerNode Events exist within that time range for a given Node, then only
598
+ // numValuesPerNode Events per Node are returned along with a ContinuationPoint. When a
599
+ // ContinuationPoint is returned, a Client wanting the next numValuesPerNode values should
600
+ // call HistoryRead again with the continuationPoint set.
601
+ // If the request takes a long time to process then the Server can return partial results with a
602
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
603
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results. In this case
604
+ // the Server may return zero results with a ContinuationPoint that allows the Server to resume
605
+ // the calculation on the next Client HistoryRead call.
606
+ // For an interval in which no data exists, the corresponding StatusCode shall be Good_NoData.
607
+ // The filter parameter is used to determine which historical Events and their corresponding
608
+ // fields are returned. It is possible that the fields of an EventType are available for real time
609
+ // updating, but not available from the historian. In this case a StatusCode value will be returned
610
+ // for any Event field that cannot be returned. The value of the StatusCode shall be
611
+ // Bad_NoData.
612
+ // If the requested TimestampsToReturn is not supported for a Node then the operation shall
613
+ // return the Bad_TimestampNotSupported StatusCode. When reading Events this only applies
614
+ // to Event fields that are of type DataValue.
615
+
616
+ // todo provide correct implementation
617
+ const result = new HistoryReadResult({
618
+ historyData: new HistoryData({ dataValues: [] }),
619
+ statusCode: StatusCodes.BadHistoryOperationUnsupported
620
+ });
621
+ return callback(null, result);
622
+ } else if (historyReadDetails instanceof ReadProcessedDetails) {
623
+ const addressSpace = this.addressSpace as AddressSpacePrivate;
624
+ if (!addressSpace._readProcessedDetails) {
625
+ const result = new HistoryReadResult({
626
+ historyData: new HistoryData({}),
627
+ statusCode: StatusCodes.BadHistoryOperationUnsupported
628
+ });
629
+ return callback(null, result);
630
+ } else {
631
+ return addressSpace._readProcessedDetails(
632
+ this,
633
+ context,
634
+ historyReadDetails,
635
+ indexRange,
636
+ dataEncoding,
637
+ continuationPoint,
638
+ callback
639
+ );
640
+ }
641
+ } else if (historyReadDetails instanceof ReadAtTimeDetails) {
642
+ // Release 1.03 28 OPC Unified Architecture, Part 11
643
+ // The ReadAtTimeDetails structure reads the values and qualities from the history database for
644
+ // the specified timestamps for one or more HistoricalDataNodes. This function is intended to
645
+ // provide values to correlate with other values with a known timestamp. For example, a Client
646
+ // may need to read the values of sensors when lab samples were collected.
647
+ // The order of the values and qualities returned shall match the order of the timestamps
648
+ // supplied in the request.
649
+ // When no value exists for a specified timestamp, a value shall be Interpolated from the
650
+ // surrounding values to represent the value at the specified timestamp. The interpolation will
651
+ // follow the same rules as the standard Interpolated Aggregate as outlined in Part 13.
652
+ // If the useSimpleBounds flag is True and Interpolation is required then simple bounding values
653
+ // will be used to calculate the data value. If useSimpleBounds is False and Interpolation is
654
+ // required then interpolated bounding values will be used to calculate the data value. See
655
+ // Part 13 for the definition of simple bounding values and interpolated bounding values.
656
+ // If a value is found for the specified timestamp, then the Server will set the StatusCode
657
+ // InfoBits to be Raw. If the value is Interpolated from the surrounding values, then the Server
658
+ // will set the StatusCode InfoBits to be Interpolated.
659
+ // If the read request is taking a long time to calculate then the Server may return zero results
660
+ // with a ContinuationPoint that allows the Server to resume the calculation on the next Client
661
+ // HistoryRead call.
662
+ // If the requested TimestampsToReturn is not supported for a Node, then the operation shall
663
+ // return the Bad_TimestampNotSupported StatusCode.
664
+
665
+ // todo provide correct implementation
666
+ const result = new HistoryReadResult({
667
+ historyData: new HistoryData({ dataValues: [] }),
668
+ statusCode: StatusCodes.BadHistoryOperationUnsupported
669
+ });
670
+ return callback(null, result);
671
+ } else {
672
+ const result = new HistoryReadResult({
673
+ historyData: new HistoryData({ dataValues: [] }),
674
+ statusCode: StatusCodes.BadHistoryOperationUnsupported
675
+ });
676
+ return callback(null, result);
677
+ }
678
+ }
679
+
680
+ function on_value_change(this: UAVariableImpl, newDataValue: DataValue): void {
681
+ this._historyPush.call(this, newDataValue);
682
+ }
683
+
684
+ /**
685
+ * @method installHistoricalDataNode
686
+ * @param node UAVariable
687
+ * @param [options] {Object}
688
+ * @param [options.maxOnlineValues = 1000]
689
+ */
690
+ export function AddressSpace_installHistoricalDataNode(
691
+ this: IAddressSpace,
692
+ node: UAVariableImpl,
693
+ options?: IVariableHistorianOptions
694
+ ): void {
695
+ AddressSpace.historizerFactory = AddressSpace.historizerFactory || {
696
+ create(node1: UAVariable, options1: IVariableHistorianOptions) {
697
+ return new VariableHistorian(node1, options1);
698
+ }
699
+ };
700
+
701
+ assert(node.nodeClass === NodeClass.Variable);
702
+ options = options || {};
703
+
704
+ const addressSpace = node.addressSpace;
705
+
706
+ // install specific history behavior
707
+ node._historyRead = _historyRead;
708
+ node._historyPush = _historyPush;
709
+
710
+ node._historyReadRawModify = _historyReadRawModify;
711
+ node._historyReadModify = _historyReadModify;
712
+ node._historyReadRaw = _historyReadRaw;
713
+ node._historyReadRawAsync = _historyReadRawAsync;
714
+
715
+ node.varHistorian = (options as any).historian || AddressSpace.historizerFactory.create(node, options);
716
+
717
+ const historicalDataConfigurationType = addressSpace.findObjectType("HistoricalDataConfigurationType");
718
+ if (!historicalDataConfigurationType) {
719
+ throw new Error("cannot find HistoricalDataConfigurationType");
720
+ }
721
+ node.historizing = true;
722
+
723
+ // tslint:disable:no-bitwise
724
+ node.accessLevel = node.accessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
725
+ if (node.userAccessLevel !== undefined) {
726
+ node.userAccessLevel = node.userAccessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
727
+ }
728
+
729
+ const optionals = ["Stepped", "Definition", "MaxTimeInterval", "MinTimeInterval", "StartOfArchive", "StartOfOnlineArchive"];
730
+
731
+ // Note from spec : If a HistoricalDataNode has configuration defined then one
732
+ // instance shall have a BrowseName of ‘HA Configuration’
733
+ const historicalDataConfiguration = historicalDataConfigurationType.instantiate({
734
+ browseName: { name: "HA Configuration", namespaceIndex: 0 },
735
+ optionals
736
+ }) as UAHistoricalDataConfiguration;
737
+
738
+ // All Historical Configuration Objects shall be referenced using the HasHistoricalConfiguration ReferenceType.
739
+ node.addReference({
740
+ isForward: true,
741
+ nodeId: historicalDataConfiguration.nodeId,
742
+ referenceType: "HasHistoricalConfiguration"
743
+ });
744
+
745
+ // The Stepped Variable specifies whether the historical data was collected in such a manner
746
+ // that it should be displayed as SlopedInterpolation (sloped line between points) or as
747
+ // SteppedInterpolation (vertically-connected horizontal lines between points) when raw data is
748
+ // examined. This Property also effects how some Aggregates are calculated. A value of True
749
+ // indicates the stepped interpolation mode. A value of False indicates SlopedInterpolation
750
+ // mode. The default value is False.
751
+ historicalDataConfiguration.stepped.setValueFromSource({ dataType: "Boolean", value: false });
752
+
753
+ // The MaxTimeInterval Variable specifies the maximum interval between data points in the
754
+ // history repository regardless of their value change (see Part 3 for definition of Duration).
755
+ historicalDataConfiguration.maxTimeInterval?.setValueFromSource({ dataType: "Duration", value: 10 * 1000 });
756
+
757
+ // The MinTimeInterval Variable specifies the minimum interval between data points in the
758
+ // history repository regardless of their value change
759
+ historicalDataConfiguration.minTimeInterval?.setValueFromSource({ dataType: "Duration", value: 0.1 * 1000 });
760
+
761
+ // The StartOfArchive Variable specifies the date before which there is no data in the archive
762
+ // either online or offline.
763
+
764
+ // The StartOfOnlineArchive Variable specifies the date of the earliest data in the online archive.
765
+ const startOfOnlineArchive = new Date();
766
+ historicalDataConfiguration.startOfOnlineArchive?.setValueFromSource({
767
+ dataType: DataType.DateTime,
768
+ value: startOfOnlineArchive
769
+ });
770
+
771
+ // TreatUncertainAsBad
772
+ // The TreatUncertainAsBad Variable indicates how the Server treats data returned with a
773
+ // StatusCode severity Uncertain with respect to Aggregate calculations. A value of True indicates
774
+ // the Server considers the severity equivalent to Bad, a value of False indicates the Server
775
+ // considers the severity equivalent to Good, unless the Aggregate definition says otherwise. The
776
+ // default value is True. Note that the value is still treated as Uncertain when the StatusCode for
777
+ // the result is calculated.
778
+ historicalDataConfiguration.aggregateConfiguration.treatUncertainAsBad.setValueFromSource({
779
+ dataType: "Boolean",
780
+ value: true
781
+ });
782
+
783
+ // The PercentDataBad Variable indicates the minimum percentage of Bad data in a given interval required for the
784
+ // StatusCode for the given interval for processed data request to be set to Bad.
785
+ // (Uncertain is treated as defined above.) Refer to 5.4.3 for details on using this Variable when assigning
786
+ // StatusCodes. For details on which Aggregates use the PercentDataBad Variable, see
787
+ // the definition of each Aggregate. The default value is 100.
788
+ historicalDataConfiguration.aggregateConfiguration.percentDataBad.setValueFromSource({
789
+ dataType: "Byte",
790
+ value: 100
791
+ });
792
+
793
+ // The PercentDataGood Variable indicates the minimum percentage of Good data in a given
794
+ // interval required for the StatusCode for the given interval for the processed data requests to be
795
+ // set to Good. Refer to 5.4.3 for details on using this Variable when assigning StatusCodes. For
796
+ // details on which Aggregates use the PercentDataGood Variable, see the definition of each
797
+ // Aggregate. The default value is 100.
798
+ historicalDataConfiguration.aggregateConfiguration.percentDataGood.setValueFromSource({
799
+ dataType: "Byte",
800
+ value: 100
801
+ });
802
+
803
+ //
804
+ // The PercentDataGood and PercentDataBad shall follow the following relationship
805
+ // PercentDataGood ≥ (100 – PercentDataBad). If they are equal the result of the
806
+ // PercentDataGood calculation is used. If the values entered for PercentDataGood and
807
+ //
808
+ // PercentDataBad do not result in a valid calculation (e.g. Bad = 80; Good = 0) the result will
809
+ // have a StatusCode of Bad_AggregateInvalidInputs The StatusCode
810
+ //
811
+ // Bad_AggregateInvalidInputs will be returned if the value of PercentDataGood or
812
+ // PercentDataBad exceed 100.
813
+
814
+ node.$historicalDataConfiguration = historicalDataConfiguration;
815
+
816
+ const dataValue = node.readValue();
817
+ if (
818
+ dataValue.statusCode !== StatusCodes.BadWaitingForInitialData &&
819
+ dataValue.statusCode !== StatusCodes.UncertainInitialValue
820
+ ) {
821
+ on_value_change.call(node, dataValue);
822
+ }
823
+ node.on("value_changed", on_value_change);
824
+
825
+ // update the index of historizing nodes in the addressSpace
826
+ node.addressSpace.historizingNodes = node.addressSpace.historizingNodes || {};
827
+ node.addressSpace.historizingNodes[node.nodeId.toString()] = node;
828
+ }