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,662 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-address-space
4
+ * @class IAddressSpace
5
+ */
6
+ // tslint:disable:no-console
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AddressSpace_installHistoricalDataNode = exports.VariableHistorian = void 0;
9
+ const chalk = require("chalk");
10
+ const node_opcua_assert_1 = require("node-opcua-assert");
11
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
12
+ const node_opcua_date_time_1 = require("node-opcua-date-time");
13
+ const node_opcua_service_history_1 = require("node-opcua-service-history");
14
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
15
+ const node_opcua_variant_1 = require("node-opcua-variant");
16
+ const ua_variable_impl_1 = require("../ua_variable_impl");
17
+ const address_space_ts_1 = require("../../source/address_space_ts");
18
+ // tslint:disable:no-var-requires
19
+ const Dequeue = require("dequeue");
20
+ /* interface Historian */
21
+ // {
22
+ //
23
+ // }
24
+ function inInTimeRange(historyReadDetails, dataValue) {
25
+ if (historyReadDetails.startTime &&
26
+ !(0, node_opcua_date_time_1.isMinDate)(historyReadDetails.startTime) &&
27
+ dataValue.sourceTimestamp < historyReadDetails.startTime) {
28
+ return false;
29
+ }
30
+ if (historyReadDetails.endTime &&
31
+ !(0, node_opcua_date_time_1.isMinDate)(historyReadDetails.endTime) &&
32
+ dataValue.sourceTimestamp > historyReadDetails.endTime) {
33
+ return false;
34
+ }
35
+ return true;
36
+ }
37
+ function inInTimeRange2(historyReadDetails, dataValue) {
38
+ if (historyReadDetails.endTime &&
39
+ !(0, node_opcua_date_time_1.isMinDate)(historyReadDetails.endTime) &&
40
+ dataValue.sourceTimestamp > historyReadDetails.endTime) {
41
+ return false;
42
+ }
43
+ return !(historyReadDetails.startTime &&
44
+ !(0, node_opcua_date_time_1.isMinDate)(historyReadDetails.startTime) &&
45
+ dataValue.sourceTimestamp < historyReadDetails.startTime);
46
+ }
47
+ function filter_dequeue(q, historyReadRawModifiedDetails, onlyThisNumber, isReversed) {
48
+ const r = [];
49
+ const predicate = isReversed
50
+ ? inInTimeRange2.bind(null, historyReadRawModifiedDetails)
51
+ : inInTimeRange.bind(null, historyReadRawModifiedDetails);
52
+ if (isReversed) {
53
+ let c = q.head.prev;
54
+ while (c.data) {
55
+ if (predicate(c.data)) {
56
+ r.push(c.data);
57
+ }
58
+ c = c.prev;
59
+ if (onlyThisNumber && r.length === onlyThisNumber) {
60
+ return r;
61
+ }
62
+ }
63
+ }
64
+ else {
65
+ let c = q.head.next;
66
+ while (c.data) {
67
+ if (predicate(c.data)) {
68
+ r.push(c.data);
69
+ }
70
+ c = c.next;
71
+ if (onlyThisNumber && r.length === onlyThisNumber) {
72
+ return r;
73
+ }
74
+ }
75
+ }
76
+ return r;
77
+ }
78
+ class VariableHistorian {
79
+ constructor(node, options) {
80
+ this._timeline = new Dequeue(); // is is ordered here ??????
81
+ this._maxOnlineValues = options.maxOnlineValues || 1000;
82
+ this.lastDate = new Date(1600, 0, 1, 0, 0, 0);
83
+ this.lastDatePicoSeconds = 0;
84
+ this.node = node;
85
+ }
86
+ /* public */
87
+ push(newDataValue) {
88
+ this._timeline.push(newDataValue);
89
+ const sourceTime = newDataValue.sourceTimestamp || new Date();
90
+ const sourcePicoSeconds = newDataValue.sourcePicoseconds || 0;
91
+ // ensure that values are set with date increasing
92
+ if (sourceTime.getTime() <= this.lastDate.getTime()) {
93
+ if (!(sourceTime.getTime() === this.lastDate.getTime() && sourcePicoSeconds > this.lastDatePicoSeconds)) {
94
+ console.log(chalk.red("Warning date not increasing "), newDataValue.toString(), " last known date = ", this.lastDate);
95
+ }
96
+ }
97
+ this.lastDate = sourceTime;
98
+ this.lastDatePicoSeconds = newDataValue.sourcePicoseconds || 0;
99
+ // we keep only a limited amount in main memory
100
+ if (this._timeline.length > this._maxOnlineValues) {
101
+ (0, node_opcua_assert_1.assert)(typeof this._maxOnlineValues === "number" && this._maxOnlineValues > 0);
102
+ while (this._timeline.length > this._maxOnlineValues) {
103
+ this._timeline.shift();
104
+ }
105
+ }
106
+ if (this._timeline.length >= this._maxOnlineValues || this._timeline.length === 1) {
107
+ const first = this._timeline.first();
108
+ this.node._update_startOfOnlineArchive(first.sourceTimestamp);
109
+ // we update the node startOnlineDate
110
+ }
111
+ }
112
+ extractDataValues(historyReadRawModifiedDetails, maxNumberToExtract, isReversed, reverseDataValue, callback) {
113
+ (0, node_opcua_assert_1.assert)(callback instanceof Function);
114
+ let dataValues = filter_dequeue(this._timeline, historyReadRawModifiedDetails, maxNumberToExtract, isReversed);
115
+ if (reverseDataValue) {
116
+ dataValues = dataValues.reverse();
117
+ }
118
+ callback(null, dataValues);
119
+ }
120
+ }
121
+ exports.VariableHistorian = VariableHistorian;
122
+ function _get_startOfOfflineArchive(node) {
123
+ var _a;
124
+ if (!node.$historicalDataConfiguration) {
125
+ throw new Error("this variable has no HistoricalDataConfiguration");
126
+ }
127
+ return (_a = node.$historicalDataConfiguration.startOfArchive) === null || _a === void 0 ? void 0 : _a.readValue();
128
+ }
129
+ function _get_startOfArchive(node) {
130
+ var _a;
131
+ if (!node.$historicalDataConfiguration) {
132
+ throw new Error("this variable has no HistoricalDataConfiguration");
133
+ }
134
+ return (_a = node.$historicalDataConfiguration.startOfArchive) === null || _a === void 0 ? void 0 : _a.readValue();
135
+ }
136
+ function _update_startOfArchive(newDate) {
137
+ var _a;
138
+ if (!this.$historicalDataConfiguration) {
139
+ throw new Error("this variable has no HistoricalDataConfiguration");
140
+ }
141
+ (_a = this.$historicalDataConfiguration.startOfArchive) === null || _a === void 0 ? void 0 : _a.setValueFromSource({
142
+ dataType: node_opcua_variant_1.DataType.DateTime,
143
+ value: newDate
144
+ });
145
+ }
146
+ function _update_startOfOnlineArchive(newDate) {
147
+ var _a;
148
+ if (!this.$historicalDataConfiguration) {
149
+ throw new Error("this variable has no HistoricalDataConfiguration");
150
+ }
151
+ // The StartOfArchive Variable specifies the date before which there is no data
152
+ // in the archive either online or offline.
153
+ // The StartOfOnlineArchive Variable specifies the date of the earliest data
154
+ // in the online archive.
155
+ (_a = this.$historicalDataConfiguration.startOfOnlineArchive) === null || _a === void 0 ? void 0 : _a.setValueFromSource({
156
+ dataType: node_opcua_variant_1.DataType.DateTime,
157
+ value: newDate
158
+ });
159
+ const startOfArchiveDataValue = _get_startOfOfflineArchive(this);
160
+ if (startOfArchiveDataValue &&
161
+ (startOfArchiveDataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good ||
162
+ !startOfArchiveDataValue.value ||
163
+ !startOfArchiveDataValue.value.value ||
164
+ startOfArchiveDataValue.value.value.getTime() >= newDate.getTime())) {
165
+ this._update_startOfArchive(newDate);
166
+ }
167
+ }
168
+ ua_variable_impl_1.UAVariableImpl.prototype._update_startOfOnlineArchive = _update_startOfOnlineArchive;
169
+ ua_variable_impl_1.UAVariableImpl.prototype._update_startOfArchive = _update_startOfArchive;
170
+ function _historyPush(newDataValue) {
171
+ if (!this.varHistorian) {
172
+ throw new Error("this variable has no HistoricalDataConfiguration");
173
+ }
174
+ (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(this, "historizing"), "expecting a historizing attribute on node");
175
+ if (!this.historizing) {
176
+ return; //
177
+ }
178
+ (0, node_opcua_assert_1.assert)(this.historizing === true);
179
+ this.varHistorian.push(newDataValue);
180
+ }
181
+ function createContinuationPoint() {
182
+ // todo: improve
183
+ return Buffer.from("ABCDEF");
184
+ }
185
+ function _historyReadModify(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback) {
186
+ //
187
+ // 6.4.3.3 Read modified functionality
188
+ // Release 1.03 26 OPC Unified Architecture, Part 11
189
+ //
190
+ // When this structure is used for reading Modified Values (isReadModified is set to TRUE), it
191
+ // reads the modified values, StatusCodes, timestamps, modification type, the user identifier,
192
+ // and the timestamp of the modification from the history database for the specified time domain
193
+ // for one or more HistoricalDataNodes. If there are multiple replaced values the Server shall
194
+ // return all of them. The updateType specifies what value is returned in the modification record.
195
+ // If the updateType is INSERT the value is the new value that was inserted. If the updateType
196
+ // is anything else the value is the old value that was changed. See 6.8 HistoryUpdateDetails
197
+ // parameter for details on what updateTypes are available.
198
+ // The purpose of this function is to read values from history that have been Modified. The
199
+ // returnBounds parameter shall be set to FALSE for this case, otherwise the Server returns a
200
+ // BadInvalidArgument StatusCode.
201
+ // The domain of the request is defined by startTime, endTime, and numValuesPerNode; at least
202
+ // two of these shall be specified. If endTime is less than startTime, or endTime and
203
+ // numValuesPerNode alone are specified, then the data shall be returned in reverse order with
204
+ // the later data coming first. If all three are specified then the call shall return up to
205
+ // numValuesPerNode results going from StartTime to EndTime, in either ascending or
206
+ // descending order depending on the relative values of StartTime and EndTime. If more than
207
+ // numValuesPerNode values exist within that time range for a given Node then only
208
+ // numValuesPerNode values per Node are returned along with a continuationPoint. When a
209
+ // continuationPoint is returned, a Client wanting the next numValuesPerNode values should call
210
+ // ReadRaw again with the continuationPoint set. If numValuesPerNode is 0 then all of the
211
+ // values in the range are returned. If the Server cannot return all modified values for a given
212
+ // timestamp in a single response then it shall return modified values with the same timestamp
213
+ // in subsequent calls.
214
+ // If the request takes a long time to process then the Server can return partial results with a
215
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
216
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results. In this case
217
+ // the Server may return zero results with a ContinuationPoint that allows the Server to resume
218
+ // the calculation on the next Client HistoryRead call.
219
+ // If a value has been modified multiple times then all values for the time are returned. This
220
+ // means that a timestamp can appear in the array more than once. The order of the returned
221
+ // values with the same timestamp should be from the most recent to oldest modification
222
+ // timestamp, if startTime is less than or equal to endTime. If endTime is less than startTime,
223
+ // then the order of the returned values will be from the oldest modification timestamp to the
224
+ // most recent. It is Server dependent whether multiple modifications are kept or only the most
225
+ // recent.
226
+ // A Server does not have to create a modification record for data when it is first added to the
227
+ // historical collection. If it does then it shall set the ExtraData bit and the Client can read the
228
+ // modification record using a ReadModified call. If the data is subsequently modified the Server
229
+ // shall create a second modification record which is returned along with the original
230
+ // modification record whenever a Client uses the ReadModified call if the Server supports
231
+ // multiple modification records per timestamp.
232
+ // If the requested TimestampsToReturn is not supported for a Node then the operation shall
233
+ // return the BadTimestampNotSupported StatusCode.
234
+ // todo : provide correct implementation
235
+ const result = new node_opcua_service_history_1.HistoryReadResult({
236
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
237
+ statusCode: node_opcua_status_code_1.StatusCodes.BadUnexpectedError
238
+ });
239
+ return callback(null, result);
240
+ }
241
+ function _historyReadRawAsync(historyReadRawModifiedDetails, maxNumberToExtract, isReversed, reverseDataValue, callback) {
242
+ (0, node_opcua_assert_1.assert)(callback instanceof Function);
243
+ this.varHistorian.extractDataValues(historyReadRawModifiedDetails, maxNumberToExtract, isReversed, reverseDataValue, callback);
244
+ }
245
+ function _historyReadRaw(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback) {
246
+ (0, node_opcua_assert_1.assert)(historyReadRawModifiedDetails instanceof node_opcua_service_history_1.ReadRawModifiedDetails);
247
+ // 6.4.3.2 Read raw functionality
248
+ //
249
+ // When this structure is used for reading Raw Values (isReadModified is set to FALSE), it reads
250
+ // the values, qualities, and timestamps from the history database for the specified time domain
251
+ // for one or more HistoricalDataNodes.
252
+ //
253
+ // This parameter is intended for use by a Client that wants the actual data saved within the historian.
254
+ //
255
+ // The actual data may be compressed or may be all raw data collected for the item depending on the
256
+ // historian and the storage rules invoked when the item values were saved.
257
+ //
258
+ // When returnBounds is TRUE, the Bounding Values for the time domain are returned. The optional Bounding
259
+ // Values are provided to allow the Client to interpolate values for the start and end times when trending
260
+ // the actual data on a display.
261
+ //
262
+ // The time domain of the request is defined by startTime, endTime, and numValuesPerNode;
263
+ // at least two of these shall be specified.
264
+ //
265
+ // If endTime is less than startTime, or endTime and numValuesPerNode alone are specified
266
+ // then the data will be returned in reverse order, with later data coming first as if time
267
+ // were flowing backward.
268
+ //
269
+ // If all three are specified then the call shall return up to numValuesPerNode results going from
270
+ // startTime to endTime, in either ascending or descending order depending on the relative values
271
+ // of startTime and endTime.
272
+ //
273
+ // If numValuesPerNode is 0, then all the values in the range are returned.
274
+ //
275
+ // A default value of DateTime.MinValue (see Part 6) is used to indicate when startTime or
276
+ // endTime is not specified.
277
+ //
278
+ // It is specifically allowed for the startTime and the endTime to be identical.
279
+ // This allows the Client to request just one value.
280
+ // When the startTime and endTime are identical then time is presumed to be flowing forward.
281
+ // It is specifically not allowed for the Server to return a Bad_InvalidArgument StatusCode
282
+ // if the requested time domain is outside of the Server's range. Such a case shall be treated
283
+ // as an interval in which no data exists.
284
+ //
285
+ // If a startTime, endTime and numValuesPerNode are all provided and if more than
286
+ // numValuesPerNode values exist within that time range for a given Node then only
287
+ // numValuesPerNode values per Node are returned along with a continuationPoint.
288
+ //
289
+ // When a continuationPoint is returned, a Client wanting the next numValuesPerNode values
290
+ // should call ReadRaw again with the continuationPoint set.
291
+ //
292
+ // If the request takes a long time to process then the Server can return partial results with a
293
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
294
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results.
295
+ // In this case the Server may return zero results with a ContinuationPoint that allows the
296
+ // Server to resume the calculation on the next Client HistoryRead call.
297
+ //
298
+ // If Bounding Values are requested and a non-zero numValuesPerNode was specified then any
299
+ // Bounding Values returned are included in the numValuesPerNode count.
300
+ //
301
+ // If numValuesPerNode is 1 then only the start bound is returned (the end bound if the reverse
302
+ // order is needed).
303
+ //
304
+ // If numValuesPerNode is 2 then the start bound and the first data point are
305
+ // returned (the end bound if reverse order is needed).
306
+ //
307
+ // When Bounding Values are requested and no bounding value is found then the corresponding
308
+ // StatusCode entry will be set to Bad_BoundNotFound, a timestamp equal to the start or end time
309
+ // as appropriate, and a value of null.
310
+ // How far back or forward to look in history for Bounding Values is Server dependent.
311
+ //
312
+ // For an interval in which no data exists, if Bounding Values are not requested, then the
313
+ // corresponding StatusCode shall be Good_NoData. If Bounding Values are requested and one
314
+ // or both exist, then the result code returned is Success and the bounding value(s) are
315
+ // returned.
316
+ //
317
+ // For cases where there are multiple values for a given timestamp, all but the most recent are
318
+ // considered to be Modified values and the Server shall return the most recent value. If the
319
+ // Server returns a value which hides other values at a timestamp then it shall set the ExtraData
320
+ // bit in the StatusCode associated with that value. If the Server contains additional information
321
+ // regarding a value then the ExtraData bit shall also be set. It indicates that ModifiedValues are
322
+ // available for retrieval, see 6.4.3.3.
323
+ //
324
+ // If the requested TimestampsToReturn is not supported for a Node, the operation shall return
325
+ // the Bad_TimestampNotSupported StatusCode.
326
+ if (continuationPoint) {
327
+ const cnt = context.continuationPoints
328
+ ? context.continuationPoints[continuationPoint.toString("hex")]
329
+ : null;
330
+ if (!cnt) {
331
+ // invalid continuation point
332
+ const result1 = new node_opcua_service_history_1.HistoryReadResult({
333
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
334
+ statusCode: node_opcua_status_code_1.StatusCodes.BadContinuationPointInvalid
335
+ });
336
+ return callback(null, result1);
337
+ }
338
+ const dataValues = cnt.dataValues.splice(0, historyReadRawModifiedDetails.numValuesPerNode);
339
+ if (cnt.dataValues.length > 0) {
340
+ //
341
+ }
342
+ else {
343
+ context.continuationPoints[continuationPoint.toString("hex")] = null;
344
+ continuationPoint = null;
345
+ }
346
+ const result2 = new node_opcua_service_history_1.HistoryReadResult({
347
+ continuationPoint: continuationPoint || undefined,
348
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues }),
349
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
350
+ });
351
+ return callback(null, result2);
352
+ }
353
+ // todo add special treatment for when startTime > endTime
354
+ // ( in this case series must be return in reverse order )
355
+ let maxNumberToExtract = 0;
356
+ let isReversed = false;
357
+ let reverseDataValue = false;
358
+ if ((0, node_opcua_date_time_1.isMinDate)(historyReadRawModifiedDetails.endTime)) {
359
+ // end time is not specified
360
+ maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
361
+ if ((0, node_opcua_date_time_1.isMinDate)(historyReadRawModifiedDetails.startTime)) {
362
+ // end start and start time are not specified, this is invalid
363
+ const result = new node_opcua_service_history_1.HistoryReadResult({
364
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported // should be an error
365
+ });
366
+ return callback(null, result);
367
+ }
368
+ }
369
+ else if ((0, node_opcua_date_time_1.isMinDate)(historyReadRawModifiedDetails.startTime)) {
370
+ // start time is not specified
371
+ // end time is specified
372
+ maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
373
+ isReversed = true;
374
+ reverseDataValue = false;
375
+ if (historyReadRawModifiedDetails.numValuesPerNode === 0) {
376
+ // when start time is not specified
377
+ // and end time is specified
378
+ // numValuesPerNode shall be greater than 0
379
+ const result = new node_opcua_service_history_1.HistoryReadResult({
380
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported // should be an error
381
+ });
382
+ return callback(null, result);
383
+ }
384
+ }
385
+ else {
386
+ // start time is specified
387
+ // end time is specified
388
+ if (historyReadRawModifiedDetails.endTime.getTime() < historyReadRawModifiedDetails.startTime.getTime()) {
389
+ reverseDataValue = true;
390
+ const tmp = historyReadRawModifiedDetails.endTime;
391
+ historyReadRawModifiedDetails.endTime = historyReadRawModifiedDetails.startTime;
392
+ historyReadRawModifiedDetails.startTime = tmp;
393
+ }
394
+ }
395
+ this._historyReadRawAsync(historyReadRawModifiedDetails, maxNumberToExtract, isReversed, reverseDataValue, (err, dataValues) => {
396
+ if (err || !dataValues) {
397
+ return callback(err);
398
+ }
399
+ // now make sure that only the requested number of value is returned
400
+ if (historyReadRawModifiedDetails.numValuesPerNode >= 1) {
401
+ if (dataValues.length === 0) {
402
+ const result1 = new node_opcua_service_history_1.HistoryReadResult({
403
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
404
+ statusCode: node_opcua_status_code_1.StatusCodes.GoodNoData
405
+ });
406
+ return callback(null, result1);
407
+ }
408
+ else {
409
+ const remaining = dataValues;
410
+ dataValues = remaining.splice(0, historyReadRawModifiedDetails.numValuesPerNode);
411
+ if (remaining.length > 0 && !(0, node_opcua_date_time_1.isMinDate)(historyReadRawModifiedDetails.endTime)) {
412
+ continuationPoint = createContinuationPoint();
413
+ context.continuationPoints = context.continuationPoints || {};
414
+ context.continuationPoints[continuationPoint.toString("hex")] = {
415
+ dataValues: remaining
416
+ };
417
+ }
418
+ }
419
+ }
420
+ const result = new node_opcua_service_history_1.HistoryReadResult({
421
+ continuationPoint: continuationPoint || undefined,
422
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues }),
423
+ statusCode: node_opcua_status_code_1.StatusCodes.Good
424
+ });
425
+ callback(null, result);
426
+ });
427
+ }
428
+ function _historyReadRawModify(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback) {
429
+ const node = this;
430
+ (0, node_opcua_assert_1.assert)(historyReadRawModifiedDetails instanceof node_opcua_service_history_1.ReadRawModifiedDetails);
431
+ if (!historyReadRawModifiedDetails.isReadModified) {
432
+ return node._historyReadRaw(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback);
433
+ }
434
+ else {
435
+ return node._historyReadModify(context, historyReadRawModifiedDetails, indexRange, dataEncoding, continuationPoint, callback);
436
+ }
437
+ }
438
+ function _historyRead(context, historyReadDetails, indexRange, dataEncoding, continuationPoint, callback) {
439
+ (0, node_opcua_assert_1.assert)(callback instanceof Function);
440
+ if (historyReadDetails instanceof node_opcua_service_history_1.ReadRawModifiedDetails) {
441
+ // note: only ReadRawModifiedDetails supported at this time
442
+ return this._historyReadRawModify(context, historyReadDetails, indexRange, dataEncoding, continuationPoint, callback);
443
+ }
444
+ else if (historyReadDetails instanceof node_opcua_service_history_1.ReadEventDetails) {
445
+ // The ReadEventDetails structure is used to read the Events from the history database for the
446
+ // specified time domain for one or more HistoricalEventNodes. The Events are filtered based on
447
+ // the filter structure provided. This filter includes the EventFields that are to be returned. For a
448
+ // complete description of filter refer to Part 4.
449
+ // The startTime and endTime are used to filter on the Time field for Events.
450
+ // The time domain of the request is defined by startTime, endTime, and numValuesPerNode; at
451
+ // least two of these shall be specified. If endTime is less than startTime, or endTime and
452
+ // numValuesPerNode alone are specified then the data will be returned in reverse order with
453
+ // later/newer data provided first as if time were flowing backward. If all three are specified then
454
+ // the call shall return up to numValuesPerNode results going from startTime to endTime, in
455
+ // either ascending or descending order depending on the relative values of startTime and
456
+ // endTime. If numValuesPerNode is 0 then all of the values in the range are returned. The
457
+ // default value is used to indicate when startTime, endTime or numValuesPerNode are not
458
+ // specified.
459
+ // It is specifically allowed for the startTime and the endTime to be identical. This allows the
460
+ // Client to request the Event at a single instance in time. When the startTime and endTime are
461
+ // identical then time is presumed to be flowing forward. If no data exists at the time specified
462
+ // then the Server shall return the Good_NoData StatusCode.
463
+ // If a startTime, endTime and numValuesPerNode are all provided, and if more than
464
+ // numValuesPerNode Events exist within that time range for a given Node, then only
465
+ // numValuesPerNode Events per Node are returned along with a ContinuationPoint. When a
466
+ // ContinuationPoint is returned, a Client wanting the next numValuesPerNode values should
467
+ // call HistoryRead again with the continuationPoint set.
468
+ // If the request takes a long time to process then the Server can return partial results with a
469
+ // ContinuationPoint. This might be done if the request is going to take more time than the Client
470
+ // timeout hint. It may take longer than the Client timeout hint to retrieve any results. In this case
471
+ // the Server may return zero results with a ContinuationPoint that allows the Server to resume
472
+ // the calculation on the next Client HistoryRead call.
473
+ // For an interval in which no data exists, the corresponding StatusCode shall be Good_NoData.
474
+ // The filter parameter is used to determine which historical Events and their corresponding
475
+ // fields are returned. It is possible that the fields of an EventType are available for real time
476
+ // updating, but not available from the historian. In this case a StatusCode value will be returned
477
+ // for any Event field that cannot be returned. The value of the StatusCode shall be
478
+ // Bad_NoData.
479
+ // If the requested TimestampsToReturn is not supported for a Node then the operation shall
480
+ // return the Bad_TimestampNotSupported StatusCode. When reading Events this only applies
481
+ // to Event fields that are of type DataValue.
482
+ // todo provide correct implementation
483
+ const result = new node_opcua_service_history_1.HistoryReadResult({
484
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
485
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported
486
+ });
487
+ return callback(null, result);
488
+ }
489
+ else if (historyReadDetails instanceof node_opcua_service_history_1.ReadProcessedDetails) {
490
+ const addressSpace = this.addressSpace;
491
+ if (!addressSpace._readProcessedDetails) {
492
+ const result = new node_opcua_service_history_1.HistoryReadResult({
493
+ historyData: new node_opcua_service_history_1.HistoryData({}),
494
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported
495
+ });
496
+ return callback(null, result);
497
+ }
498
+ else {
499
+ return addressSpace._readProcessedDetails(this, context, historyReadDetails, indexRange, dataEncoding, continuationPoint, callback);
500
+ }
501
+ }
502
+ else if (historyReadDetails instanceof node_opcua_service_history_1.ReadAtTimeDetails) {
503
+ // Release 1.03 28 OPC Unified Architecture, Part 11
504
+ // The ReadAtTimeDetails structure reads the values and qualities from the history database for
505
+ // the specified timestamps for one or more HistoricalDataNodes. This function is intended to
506
+ // provide values to correlate with other values with a known timestamp. For example, a Client
507
+ // may need to read the values of sensors when lab samples were collected.
508
+ // The order of the values and qualities returned shall match the order of the timestamps
509
+ // supplied in the request.
510
+ // When no value exists for a specified timestamp, a value shall be Interpolated from the
511
+ // surrounding values to represent the value at the specified timestamp. The interpolation will
512
+ // follow the same rules as the standard Interpolated Aggregate as outlined in Part 13.
513
+ // If the useSimpleBounds flag is True and Interpolation is required then simple bounding values
514
+ // will be used to calculate the data value. If useSimpleBounds is False and Interpolation is
515
+ // required then interpolated bounding values will be used to calculate the data value. See
516
+ // Part 13 for the definition of simple bounding values and interpolated bounding values.
517
+ // If a value is found for the specified timestamp, then the Server will set the StatusCode
518
+ // InfoBits to be Raw. If the value is Interpolated from the surrounding values, then the Server
519
+ // will set the StatusCode InfoBits to be Interpolated.
520
+ // If the read request is taking a long time to calculate then the Server may return zero results
521
+ // with a ContinuationPoint that allows the Server to resume the calculation on the next Client
522
+ // HistoryRead call.
523
+ // If the requested TimestampsToReturn is not supported for a Node, then the operation shall
524
+ // return the Bad_TimestampNotSupported StatusCode.
525
+ // todo provide correct implementation
526
+ const result = new node_opcua_service_history_1.HistoryReadResult({
527
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
528
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported
529
+ });
530
+ return callback(null, result);
531
+ }
532
+ else {
533
+ const result = new node_opcua_service_history_1.HistoryReadResult({
534
+ historyData: new node_opcua_service_history_1.HistoryData({ dataValues: [] }),
535
+ statusCode: node_opcua_status_code_1.StatusCodes.BadHistoryOperationUnsupported
536
+ });
537
+ return callback(null, result);
538
+ }
539
+ }
540
+ function on_value_change(newDataValue) {
541
+ this._historyPush.call(this, newDataValue);
542
+ }
543
+ /**
544
+ * @method installHistoricalDataNode
545
+ * @param node UAVariable
546
+ * @param [options] {Object}
547
+ * @param [options.maxOnlineValues = 1000]
548
+ */
549
+ function AddressSpace_installHistoricalDataNode(node, options) {
550
+ var _a, _b, _c;
551
+ address_space_ts_1.AddressSpace.historizerFactory = address_space_ts_1.AddressSpace.historizerFactory || {
552
+ create(node1, options1) {
553
+ return new VariableHistorian(node1, options1);
554
+ }
555
+ };
556
+ (0, node_opcua_assert_1.assert)(node.nodeClass === node_opcua_data_model_1.NodeClass.Variable);
557
+ options = options || {};
558
+ const addressSpace = node.addressSpace;
559
+ // install specific history behavior
560
+ node._historyRead = _historyRead;
561
+ node._historyPush = _historyPush;
562
+ node._historyReadRawModify = _historyReadRawModify;
563
+ node._historyReadModify = _historyReadModify;
564
+ node._historyReadRaw = _historyReadRaw;
565
+ node._historyReadRawAsync = _historyReadRawAsync;
566
+ node.varHistorian = options.historian || address_space_ts_1.AddressSpace.historizerFactory.create(node, options);
567
+ const historicalDataConfigurationType = addressSpace.findObjectType("HistoricalDataConfigurationType");
568
+ if (!historicalDataConfigurationType) {
569
+ throw new Error("cannot find HistoricalDataConfigurationType");
570
+ }
571
+ node.historizing = true;
572
+ // tslint:disable:no-bitwise
573
+ node.accessLevel = node.accessLevel | node_opcua_data_model_1.AccessLevelFlag.CurrentRead | node_opcua_data_model_1.AccessLevelFlag.HistoryRead;
574
+ if (node.userAccessLevel !== undefined) {
575
+ node.userAccessLevel = node.userAccessLevel | node_opcua_data_model_1.AccessLevelFlag.CurrentRead | node_opcua_data_model_1.AccessLevelFlag.HistoryRead;
576
+ }
577
+ const optionals = ["Stepped", "Definition", "MaxTimeInterval", "MinTimeInterval", "StartOfArchive", "StartOfOnlineArchive"];
578
+ // Note from spec : If a HistoricalDataNode has configuration defined then one
579
+ // instance shall have a BrowseName of ‘HA Configuration’
580
+ const historicalDataConfiguration = historicalDataConfigurationType.instantiate({
581
+ browseName: { name: "HA Configuration", namespaceIndex: 0 },
582
+ optionals
583
+ });
584
+ // All Historical Configuration Objects shall be referenced using the HasHistoricalConfiguration ReferenceType.
585
+ node.addReference({
586
+ isForward: true,
587
+ nodeId: historicalDataConfiguration.nodeId,
588
+ referenceType: "HasHistoricalConfiguration"
589
+ });
590
+ // The Stepped Variable specifies whether the historical data was collected in such a manner
591
+ // that it should be displayed as SlopedInterpolation (sloped line between points) or as
592
+ // SteppedInterpolation (vertically-connected horizontal lines between points) when raw data is
593
+ // examined. This Property also effects how some Aggregates are calculated. A value of True
594
+ // indicates the stepped interpolation mode. A value of False indicates SlopedInterpolation
595
+ // mode. The default value is False.
596
+ historicalDataConfiguration.stepped.setValueFromSource({ dataType: "Boolean", value: false });
597
+ // The MaxTimeInterval Variable specifies the maximum interval between data points in the
598
+ // history repository regardless of their value change (see Part 3 for definition of Duration).
599
+ (_a = historicalDataConfiguration.maxTimeInterval) === null || _a === void 0 ? void 0 : _a.setValueFromSource({ dataType: "Duration", value: 10 * 1000 });
600
+ // The MinTimeInterval Variable specifies the minimum interval between data points in the
601
+ // history repository regardless of their value change
602
+ (_b = historicalDataConfiguration.minTimeInterval) === null || _b === void 0 ? void 0 : _b.setValueFromSource({ dataType: "Duration", value: 0.1 * 1000 });
603
+ // The StartOfArchive Variable specifies the date before which there is no data in the archive
604
+ // either online or offline.
605
+ // The StartOfOnlineArchive Variable specifies the date of the earliest data in the online archive.
606
+ const startOfOnlineArchive = new Date();
607
+ (_c = historicalDataConfiguration.startOfOnlineArchive) === null || _c === void 0 ? void 0 : _c.setValueFromSource({
608
+ dataType: node_opcua_variant_1.DataType.DateTime,
609
+ value: startOfOnlineArchive
610
+ });
611
+ // TreatUncertainAsBad
612
+ // The TreatUncertainAsBad Variable indicates how the Server treats data returned with a
613
+ // StatusCode severity Uncertain with respect to Aggregate calculations. A value of True indicates
614
+ // the Server considers the severity equivalent to Bad, a value of False indicates the Server
615
+ // considers the severity equivalent to Good, unless the Aggregate definition says otherwise. The
616
+ // default value is True. Note that the value is still treated as Uncertain when the StatusCode for
617
+ // the result is calculated.
618
+ historicalDataConfiguration.aggregateConfiguration.treatUncertainAsBad.setValueFromSource({
619
+ dataType: "Boolean",
620
+ value: true
621
+ });
622
+ // The PercentDataBad Variable indicates the minimum percentage of Bad data in a given interval required for the
623
+ // StatusCode for the given interval for processed data request to be set to Bad.
624
+ // (Uncertain is treated as defined above.) Refer to 5.4.3 for details on using this Variable when assigning
625
+ // StatusCodes. For details on which Aggregates use the PercentDataBad Variable, see
626
+ // the definition of each Aggregate. The default value is 100.
627
+ historicalDataConfiguration.aggregateConfiguration.percentDataBad.setValueFromSource({
628
+ dataType: "Byte",
629
+ value: 100
630
+ });
631
+ // The PercentDataGood Variable indicates the minimum percentage of Good data in a given
632
+ // interval required for the StatusCode for the given interval for the processed data requests to be
633
+ // set to Good. Refer to 5.4.3 for details on using this Variable when assigning StatusCodes. For
634
+ // details on which Aggregates use the PercentDataGood Variable, see the definition of each
635
+ // Aggregate. The default value is 100.
636
+ historicalDataConfiguration.aggregateConfiguration.percentDataGood.setValueFromSource({
637
+ dataType: "Byte",
638
+ value: 100
639
+ });
640
+ //
641
+ // The PercentDataGood and PercentDataBad shall follow the following relationship
642
+ // PercentDataGood ≥ (100 – PercentDataBad). If they are equal the result of the
643
+ // PercentDataGood calculation is used. If the values entered for PercentDataGood and
644
+ //
645
+ // PercentDataBad do not result in a valid calculation (e.g. Bad = 80; Good = 0) the result will
646
+ // have a StatusCode of Bad_AggregateInvalidInputs The StatusCode
647
+ //
648
+ // Bad_AggregateInvalidInputs will be returned if the value of PercentDataGood or
649
+ // PercentDataBad exceed 100.
650
+ node.$historicalDataConfiguration = historicalDataConfiguration;
651
+ const dataValue = node.readValue();
652
+ if (dataValue.statusCode !== node_opcua_status_code_1.StatusCodes.BadWaitingForInitialData &&
653
+ dataValue.statusCode !== node_opcua_status_code_1.StatusCodes.UncertainInitialValue) {
654
+ on_value_change.call(node, dataValue);
655
+ }
656
+ node.on("value_changed", on_value_change);
657
+ // update the index of historizing nodes in the addressSpace
658
+ node.addressSpace.historizingNodes = node.addressSpace.historizingNodes || {};
659
+ node.addressSpace.historizingNodes[node.nodeId.toString()] = node;
660
+ }
661
+ exports.AddressSpace_installHistoricalDataNode = AddressSpace_installHistoricalDataNode;
662
+ //# sourceMappingURL=address_space_historical_data_node.js.map