node-opcua-address-space 2.96.0 → 2.98.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 (433) hide show
  1. package/package.json +37 -37
  2. package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +4 -3
  3. package/source/loader/make_xml_extension_object_parser.ts +10 -9
  4. package/src/address_space.ts +6 -5
  5. package/src/alarms_and_conditions/ua_condition_impl.ts +14 -9
  6. package/src/base_node_impl.ts +6 -2
  7. package/src/base_node_private.ts +73 -28
  8. package/src/data_access/ua_two_state_discrete_impl.ts +2 -0
  9. package/src/ua_variable_impl.ts +2039 -2037
  10. package/src/ua_variable_type_impl.ts +35 -17
  11. package/dist/source/address_space_ts.d.ts +0 -118
  12. package/dist/source/address_space_ts.js +0 -18
  13. package/dist/source/address_space_ts.js.map +0 -1
  14. package/dist/source/continuation_points/continuation_point_manager.d.ts +0 -91
  15. package/dist/source/continuation_points/continuation_point_manager.js +0 -201
  16. package/dist/source/continuation_points/continuation_point_manager.js.map +0 -1
  17. package/dist/source/helpers/adjust_browse_direction.d.ts +0 -5
  18. package/dist/source/helpers/adjust_browse_direction.js +0 -12
  19. package/dist/source/helpers/adjust_browse_direction.js.map +0 -1
  20. package/dist/source/helpers/argument_list.d.ts +0 -33
  21. package/dist/source/helpers/argument_list.js +0 -255
  22. package/dist/source/helpers/argument_list.js.map +0 -1
  23. package/dist/source/helpers/call_helpers.d.ts +0 -6
  24. package/dist/source/helpers/call_helpers.js +0 -72
  25. package/dist/source/helpers/call_helpers.js.map +0 -1
  26. package/dist/source/helpers/coerce_enum_value.d.ts +0 -6
  27. package/dist/source/helpers/coerce_enum_value.js +0 -34
  28. package/dist/source/helpers/coerce_enum_value.js.map +0 -1
  29. package/dist/source/helpers/dump_tools.d.ts +0 -14
  30. package/dist/source/helpers/dump_tools.js +0 -79
  31. package/dist/source/helpers/dump_tools.js.map +0 -1
  32. package/dist/source/helpers/ensure_secure_access.d.ts +0 -9
  33. package/dist/source/helpers/ensure_secure_access.js +0 -77
  34. package/dist/source/helpers/ensure_secure_access.js.map +0 -1
  35. package/dist/source/helpers/make_optionals_map.d.ts +0 -21
  36. package/dist/source/helpers/make_optionals_map.js +0 -30
  37. package/dist/source/helpers/make_optionals_map.js.map +0 -1
  38. package/dist/source/helpers/multiform_func.d.ts +0 -11
  39. package/dist/source/helpers/multiform_func.js +0 -76
  40. package/dist/source/helpers/multiform_func.js.map +0 -1
  41. package/dist/source/helpers/resolve_opaque_on_address_space.d.ts +0 -3
  42. package/dist/source/helpers/resolve_opaque_on_address_space.js +0 -37
  43. package/dist/source/helpers/resolve_opaque_on_address_space.js.map +0 -1
  44. package/dist/source/index.d.ts +0 -61
  45. package/dist/source/index.js +0 -90
  46. package/dist/source/index.js.map +0 -1
  47. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +0 -19
  48. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js +0 -3
  49. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js.map +0 -1
  50. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +0 -193
  51. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.js +0 -3
  52. package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.js.map +0 -1
  53. package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.d.ts +0 -12
  54. package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.js +0 -3
  55. package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.js.map +0 -1
  56. package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.d.ts +0 -10
  57. package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.js +0 -3
  58. package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.js.map +0 -1
  59. package/dist/source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options.d.ts +0 -7
  60. package/dist/source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options.js +0 -3
  61. package/dist/source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options.js.map +0 -1
  62. package/dist/source/interfaces/alarms_and_conditions/instantiate_condition_options.d.ts +0 -7
  63. package/dist/source/interfaces/alarms_and_conditions/instantiate_condition_options.js +0 -3
  64. package/dist/source/interfaces/alarms_and_conditions/instantiate_condition_options.js.map +0 -1
  65. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.d.ts +0 -4
  66. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.js +0 -3
  67. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.js.map +0 -1
  68. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.d.ts +0 -4
  69. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.js +0 -3
  70. package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.js.map +0 -1
  71. package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.d.ts +0 -9
  72. package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.js +0 -3
  73. package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.js.map +0 -1
  74. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.d.ts +0 -4
  75. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.js +0 -3
  76. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.js.map +0 -1
  77. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.d.ts +0 -4
  78. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.js +0 -3
  79. package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.js.map +0 -1
  80. package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.d.ts +0 -20
  81. package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.js +0 -3
  82. package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.js.map +0 -1
  83. package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.d.ts +0 -23
  84. package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.js +0 -3
  85. package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.js.map +0 -1
  86. package/dist/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.d.ts +0 -32
  87. package/dist/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.js +0 -3
  88. package/dist/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.js.map +0 -1
  89. package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.d.ts +0 -19
  90. package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.js +0 -3
  91. package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.js.map +0 -1
  92. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +0 -42
  93. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.js +0 -3
  94. package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.js.map +0 -1
  95. package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.d.ts +0 -7
  96. package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.js +0 -26
  97. package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.js.map +0 -1
  98. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.d.ts +0 -5
  99. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.js +0 -3
  100. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.js.map +0 -1
  101. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.d.ts +0 -20
  102. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.js +0 -3
  103. package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.js.map +0 -1
  104. package/dist/source/interfaces/alarms_and_conditions/ua_limit_alarm_ex.d.ts +0 -26
  105. package/dist/source/interfaces/alarms_and_conditions/ua_limit_alarm_ex.js +0 -3
  106. package/dist/source/interfaces/alarms_and_conditions/ua_limit_alarm_ex.js.map +0 -1
  107. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.d.ts +0 -8
  108. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.js +0 -3
  109. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.js.map +0 -1
  110. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex.d.ts +0 -10
  111. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex.js +0 -3
  112. package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex.js.map +0 -1
  113. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +0 -21
  114. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js +0 -3
  115. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js.map +0 -1
  116. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +0 -24
  117. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js +0 -3
  118. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js.map +0 -1
  119. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +0 -12
  120. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js +0 -3
  121. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js.map +0 -1
  122. package/dist/source/interfaces/data_access/ua_y_array_item_ex.d.ts +0 -8
  123. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js +0 -3
  124. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js.map +0 -1
  125. package/dist/source/interfaces/extension_object_constructor.d.ts +0 -10
  126. package/dist/source/interfaces/extension_object_constructor.js +0 -3
  127. package/dist/source/interfaces/extension_object_constructor.js.map +0 -1
  128. package/dist/source/interfaces/nodeset_loader_options.d.ts +0 -4
  129. package/dist/source/interfaces/nodeset_loader_options.js +0 -3
  130. package/dist/source/interfaces/nodeset_loader_options.js.map +0 -1
  131. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +0 -12
  132. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js +0 -3
  133. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js.map +0 -1
  134. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.d.ts +0 -49
  135. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js +0 -3
  136. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js.map +0 -1
  137. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.d.ts +0 -11
  138. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js +0 -3
  139. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js.map +0 -1
  140. package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.d.ts +0 -30
  141. package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.js +0 -3
  142. package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.js.map +0 -1
  143. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +0 -234
  144. package/dist/source/interfaces/state_machine/ua_state_machine_type.js +0 -3
  145. package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +0 -1
  146. package/dist/source/interfaces/state_machine/ua_transition_ex.d.ts +0 -6
  147. package/dist/source/interfaces/state_machine/ua_transition_ex.js +0 -3
  148. package/dist/source/interfaces/state_machine/ua_transition_ex.js.map +0 -1
  149. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.d.ts +0 -8
  150. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js +0 -3
  151. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js.map +0 -1
  152. package/dist/source/loader/decode_xml_extension_object.d.ts +0 -6
  153. package/dist/source/loader/decode_xml_extension_object.js +0 -72
  154. package/dist/source/loader/decode_xml_extension_object.js.map +0 -1
  155. package/dist/source/loader/ensure_datatype_extracted.d.ts +0 -5
  156. package/dist/source/loader/ensure_datatype_extracted.js +0 -71
  157. package/dist/source/loader/ensure_datatype_extracted.js.map +0 -1
  158. package/dist/source/loader/generateAddressSpaceRaw.d.ts +0 -11
  159. package/dist/source/loader/generateAddressSpaceRaw.js +0 -46
  160. package/dist/source/loader/generateAddressSpaceRaw.js.map +0 -1
  161. package/dist/source/loader/load_nodeset2.d.ts +0 -17
  162. package/dist/source/loader/load_nodeset2.js +0 -1484
  163. package/dist/source/loader/load_nodeset2.js.map +0 -1
  164. package/dist/source/loader/make_semver_compatible.d.ts +0 -6
  165. package/dist/source/loader/make_semver_compatible.js +0 -26
  166. package/dist/source/loader/make_semver_compatible.js.map +0 -1
  167. package/dist/source/loader/make_xml_extension_object_parser.d.ts +0 -28
  168. package/dist/source/loader/make_xml_extension_object_parser.js +0 -326
  169. package/dist/source/loader/make_xml_extension_object_parser.js.map +0 -1
  170. package/dist/source/loader/namespace_post_step.d.ts +0 -10
  171. package/dist/source/loader/namespace_post_step.js +0 -62
  172. package/dist/source/loader/namespace_post_step.js.map +0 -1
  173. package/dist/source/loader/register_node_promoter.d.ts +0 -2
  174. package/dist/source/loader/register_node_promoter.js +0 -10
  175. package/dist/source/loader/register_node_promoter.js.map +0 -1
  176. package/dist/source/namespace.d.ts +0 -6
  177. package/dist/source/namespace.js +0 -3
  178. package/dist/source/namespace.js.map +0 -1
  179. package/dist/source/namespace_alarm_and_condition.d.ts +0 -32
  180. package/dist/source/namespace_alarm_and_condition.js +0 -3
  181. package/dist/source/namespace_alarm_and_condition.js.map +0 -1
  182. package/dist/source/namespace_data_access.d.ts +0 -42
  183. package/dist/source/namespace_data_access.js +0 -3
  184. package/dist/source/namespace_data_access.js.map +0 -1
  185. package/dist/source/namespace_machine_state.d.ts +0 -8
  186. package/dist/source/namespace_machine_state.js +0 -3
  187. package/dist/source/namespace_machine_state.js.map +0 -1
  188. package/dist/source/pseudo_session.d.ts +0 -72
  189. package/dist/source/pseudo_session.js +0 -255
  190. package/dist/source/pseudo_session.js.map +0 -1
  191. package/dist/source/session_context.d.ts +0 -111
  192. package/dist/source/session_context.js +0 -265
  193. package/dist/source/session_context.js.map +0 -1
  194. package/dist/source/set_namespace_meta_data.d.ts +0 -2
  195. package/dist/source/set_namespace_meta_data.js +0 -60
  196. package/dist/source/set_namespace_meta_data.js.map +0 -1
  197. package/dist/source/ua_root_folder.d.ts +0 -9
  198. package/dist/source/ua_root_folder.js +0 -3
  199. package/dist/source/ua_root_folder.js.map +0 -1
  200. package/dist/source/ua_two_state_variable_ex.d.ts +0 -23
  201. package/dist/source/ua_two_state_variable_ex.js +0 -3
  202. package/dist/source/ua_two_state_variable_ex.js.map +0 -1
  203. package/dist/source/xml_writer.d.ts +0 -18
  204. package/dist/source/xml_writer.js +0 -3
  205. package/dist/source/xml_writer.js.map +0 -1
  206. package/dist/src/address_space.d.ts +0 -387
  207. package/dist/src/address_space.js +0 -1385
  208. package/dist/src/address_space.js.map +0 -1
  209. package/dist/src/address_space_change_event_tools.d.ts +0 -6
  210. package/dist/src/address_space_change_event_tools.js +0 -153
  211. package/dist/src/address_space_change_event_tools.js.map +0 -1
  212. package/dist/src/address_space_private.d.ts +0 -43
  213. package/dist/src/address_space_private.js +0 -3
  214. package/dist/src/address_space_private.js.map +0 -1
  215. package/dist/src/alarms_and_conditions/condition.d.ts +0 -5
  216. package/dist/src/alarms_and_conditions/condition.js +0 -79
  217. package/dist/src/alarms_and_conditions/condition.js.map +0 -1
  218. package/dist/src/alarms_and_conditions/condition_info_impl.d.ts +0 -26
  219. package/dist/src/alarms_and_conditions/condition_info_impl.js +0 -55
  220. package/dist/src/alarms_and_conditions/condition_info_impl.js.map +0 -1
  221. package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +0 -222
  222. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +0 -658
  223. package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +0 -1
  224. package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +0 -9
  225. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +0 -61
  226. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +0 -1
  227. package/dist/src/alarms_and_conditions/index.d.ts +0 -16
  228. package/dist/src/alarms_and_conditions/index.js +0 -33
  229. package/dist/src/alarms_and_conditions/index.js.map +0 -1
  230. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +0 -44
  231. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +0 -245
  232. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +0 -1
  233. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +0 -93
  234. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +0 -419
  235. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +0 -1
  236. package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +0 -26
  237. package/dist/src/alarms_and_conditions/ua_base_event_impl.js +0 -39
  238. package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +0 -1
  239. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +0 -44
  240. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +0 -184
  241. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +0 -1
  242. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +0 -153
  243. package/dist/src/alarms_and_conditions/ua_condition_impl.js +0 -1029
  244. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +0 -1
  245. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.d.ts +0 -14
  246. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +0 -35
  247. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +0 -1
  248. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +0 -24
  249. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +0 -57
  250. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +0 -1
  251. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.d.ts +0 -11
  252. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js +0 -12
  253. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js.map +0 -1
  254. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +0 -23
  255. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +0 -87
  256. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +0 -1
  257. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.d.ts +0 -11
  258. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js +0 -8
  259. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +0 -1
  260. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +0 -79
  261. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +0 -251
  262. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +0 -1
  263. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +0 -24
  264. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +0 -51
  265. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +0 -1
  266. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +0 -19
  267. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +0 -163
  268. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +0 -1
  269. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +0 -46
  270. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +0 -166
  271. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +0 -1
  272. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.d.ts +0 -18
  273. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js +0 -18
  274. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js.map +0 -1
  275. package/dist/src/apply_condition_refresh.d.ts +0 -6
  276. package/dist/src/apply_condition_refresh.js +0 -28
  277. package/dist/src/apply_condition_refresh.js.map +0 -1
  278. package/dist/src/base_node_impl.d.ts +0 -283
  279. package/dist/src/base_node_impl.js +0 -1452
  280. package/dist/src/base_node_impl.js.map +0 -1
  281. package/dist/src/base_node_private.d.ts +0 -81
  282. package/dist/src/base_node_private.js +0 -804
  283. package/dist/src/base_node_private.js.map +0 -1
  284. package/dist/src/check_value_rank_compatibility.d.ts +0 -15
  285. package/dist/src/check_value_rank_compatibility.js +0 -82
  286. package/dist/src/check_value_rank_compatibility.js.map +0 -1
  287. package/dist/src/data_access/add_dataItem_stuff.d.ts +0 -11
  288. package/dist/src/data_access/add_dataItem_stuff.js +0 -62
  289. package/dist/src/data_access/add_dataItem_stuff.js.map +0 -1
  290. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.d.ts +0 -1
  291. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js +0 -35
  292. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js.map +0 -1
  293. package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +0 -32
  294. package/dist/src/data_access/ua_multistate_discrete_impl.js +0 -131
  295. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +0 -1
  296. package/dist/src/data_access/ua_multistate_value_discrete_impl.d.ts +0 -52
  297. package/dist/src/data_access/ua_multistate_value_discrete_impl.js +0 -254
  298. package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +0 -1
  299. package/dist/src/data_access/ua_two_state_discrete_impl.d.ts +0 -25
  300. package/dist/src/data_access/ua_two_state_discrete_impl.js +0 -154
  301. package/dist/src/data_access/ua_two_state_discrete_impl.js.map +0 -1
  302. package/dist/src/event_data.d.ts +0 -34
  303. package/dist/src/event_data.js +0 -65
  304. package/dist/src/event_data.js.map +0 -1
  305. package/dist/src/extension_object_array_node.d.ts +0 -23
  306. package/dist/src/extension_object_array_node.js +0 -249
  307. package/dist/src/extension_object_array_node.js.map +0 -1
  308. package/dist/src/historical_access/address_space_historical_data_node.d.ts +0 -26
  309. package/dist/src/historical_access/address_space_historical_data_node.js +0 -653
  310. package/dist/src/historical_access/address_space_historical_data_node.js.map +0 -1
  311. package/dist/src/idx_iterator.d.ts +0 -8
  312. package/dist/src/idx_iterator.js +0 -51
  313. package/dist/src/idx_iterator.js.map +0 -1
  314. package/dist/src/index_current.d.ts +0 -46
  315. package/dist/src/index_current.js +0 -78
  316. package/dist/src/index_current.js.map +0 -1
  317. package/dist/src/namespace_impl.d.ts +0 -456
  318. package/dist/src/namespace_impl.js +0 -1763
  319. package/dist/src/namespace_impl.js.map +0 -1
  320. package/dist/src/namespace_private.d.ts +0 -23
  321. package/dist/src/namespace_private.js +0 -33
  322. package/dist/src/namespace_private.js.map +0 -1
  323. package/dist/src/nodeid_manager.d.ts +0 -37
  324. package/dist/src/nodeid_manager.js +0 -184
  325. package/dist/src/nodeid_manager.js.map +0 -1
  326. package/dist/src/nodeset_tools/adjust_namespace_array.d.ts +0 -2
  327. package/dist/src/nodeset_tools/adjust_namespace_array.js +0 -14
  328. package/dist/src/nodeset_tools/adjust_namespace_array.js.map +0 -1
  329. package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +0 -18
  330. package/dist/src/nodeset_tools/construct_namespace_dependency.js +0 -141
  331. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +0 -1
  332. package/dist/src/nodeset_tools/dump_to_bsd.d.ts +0 -2
  333. package/dist/src/nodeset_tools/dump_to_bsd.js +0 -164
  334. package/dist/src/nodeset_tools/dump_to_bsd.js.map +0 -1
  335. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +0 -10
  336. package/dist/src/nodeset_tools/nodeset_to_xml.js +0 -1288
  337. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +0 -1
  338. package/dist/src/private_namespace.d.ts +0 -5
  339. package/dist/src/private_namespace.js +0 -20
  340. package/dist/src/private_namespace.js.map +0 -1
  341. package/dist/src/reference_impl.d.ts +0 -43
  342. package/dist/src/reference_impl.js +0 -140
  343. package/dist/src/reference_impl.js.map +0 -1
  344. package/dist/src/role_permissions.d.ts +0 -2
  345. package/dist/src/role_permissions.js +0 -11
  346. package/dist/src/role_permissions.js.map +0 -1
  347. package/dist/src/state_machine/finite_state_machine.d.ts +0 -81
  348. package/dist/src/state_machine/finite_state_machine.js +0 -389
  349. package/dist/src/state_machine/finite_state_machine.js.map +0 -1
  350. package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +0 -38
  351. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +0 -251
  352. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +0 -1
  353. package/dist/src/state_machine/ua_two_state_variable.d.ts +0 -61
  354. package/dist/src/state_machine/ua_two_state_variable.js +0 -332
  355. package/dist/src/state_machine/ua_two_state_variable.js.map +0 -1
  356. package/dist/src/tool_isSubtypeOf.d.ts +0 -18
  357. package/dist/src/tool_isSubtypeOf.js +0 -125
  358. package/dist/src/tool_isSubtypeOf.js.map +0 -1
  359. package/dist/src/tool_isSupertypeOf.d.ts +0 -18
  360. package/dist/src/tool_isSupertypeOf.js +0 -125
  361. package/dist/src/tool_isSupertypeOf.js.map +0 -1
  362. package/dist/src/ua_condition_type.d.ts +0 -8
  363. package/dist/src/ua_condition_type.js +0 -3
  364. package/dist/src/ua_condition_type.js.map +0 -1
  365. package/dist/src/ua_data_type_impl.d.ts +0 -89
  366. package/dist/src/ua_data_type_impl.js +0 -369
  367. package/dist/src/ua_data_type_impl.js.map +0 -1
  368. package/dist/src/ua_method_impl.d.ts +0 -42
  369. package/dist/src/ua_method_impl.js +0 -218
  370. package/dist/src/ua_method_impl.js.map +0 -1
  371. package/dist/src/ua_object_impl.d.ts +0 -35
  372. package/dist/src/ua_object_impl.js +0 -169
  373. package/dist/src/ua_object_impl.js.map +0 -1
  374. package/dist/src/ua_object_type_impl.d.ts +0 -50
  375. package/dist/src/ua_object_type_impl.js +0 -127
  376. package/dist/src/ua_object_type_impl.js.map +0 -1
  377. package/dist/src/ua_reference_type_impl.d.ts +0 -45
  378. package/dist/src/ua_reference_type_impl.js +0 -142
  379. package/dist/src/ua_reference_type_impl.js.map +0 -1
  380. package/dist/src/ua_variable_impl.d.ts +0 -380
  381. package/dist/src/ua_variable_impl.js +0 -1738
  382. package/dist/src/ua_variable_impl.js.map +0 -1
  383. package/dist/src/ua_variable_impl_ext_obj.d.ts +0 -23
  384. package/dist/src/ua_variable_impl_ext_obj.js +0 -671
  385. package/dist/src/ua_variable_impl_ext_obj.js.map +0 -1
  386. package/dist/src/ua_variable_type_impl.d.ts +0 -74
  387. package/dist/src/ua_variable_type_impl.js +0 -582
  388. package/dist/src/ua_variable_type_impl.js.map +0 -1
  389. package/dist/src/ua_view_impl.d.ts +0 -19
  390. package/dist/src/ua_view_impl.js +0 -44
  391. package/dist/src/ua_view_impl.js.map +0 -1
  392. package/distHelpers/add_event_generator_object.d.ts +0 -3
  393. package/distHelpers/add_event_generator_object.js +0 -65
  394. package/distHelpers/add_event_generator_object.js.map +0 -1
  395. package/distHelpers/alarms_and_conditions_demo.d.ts +0 -9
  396. package/distHelpers/alarms_and_conditions_demo.js +0 -116
  397. package/distHelpers/alarms_and_conditions_demo.js.map +0 -1
  398. package/distHelpers/assertHasMatchingReference.d.ts +0 -19
  399. package/distHelpers/assertHasMatchingReference.js +0 -41
  400. package/distHelpers/assertHasMatchingReference.js.map +0 -1
  401. package/distHelpers/boiler_system.d.ts +0 -113
  402. package/distHelpers/boiler_system.js +0 -396
  403. package/distHelpers/boiler_system.js.map +0 -1
  404. package/distHelpers/create_minimalist_address_space_nodeset.d.ts +0 -5
  405. package/distHelpers/create_minimalist_address_space_nodeset.js +0 -172
  406. package/distHelpers/create_minimalist_address_space_nodeset.js.map +0 -1
  407. package/distHelpers/date_utils.d.ts +0 -3
  408. package/distHelpers/date_utils.js +0 -10
  409. package/distHelpers/date_utils.js.map +0 -1
  410. package/distHelpers/dump_statemachine.d.ts +0 -0
  411. package/distHelpers/dump_statemachine.js +0 -128
  412. package/distHelpers/dump_statemachine.js.map +0 -1
  413. package/distHelpers/get_address_space_fixture.d.ts +0 -1
  414. package/distHelpers/get_address_space_fixture.js +0 -31
  415. package/distHelpers/get_address_space_fixture.js.map +0 -1
  416. package/distHelpers/get_mini_address_space.d.ts +0 -7
  417. package/distHelpers/get_mini_address_space.js +0 -37
  418. package/distHelpers/get_mini_address_space.js.map +0 -1
  419. package/distHelpers/index.d.ts +0 -12
  420. package/distHelpers/index.js +0 -29
  421. package/distHelpers/index.js.map +0 -1
  422. package/distHelpers/mock_session.d.ts +0 -10
  423. package/distHelpers/mock_session.js +0 -26
  424. package/distHelpers/mock_session.js.map +0 -1
  425. package/distNodeJS/generate_address_space.d.ts +0 -6
  426. package/distNodeJS/generate_address_space.js +0 -53
  427. package/distNodeJS/generate_address_space.js.map +0 -1
  428. package/distNodeJS/index.d.ts +0 -1
  429. package/distNodeJS/index.js +0 -18
  430. package/distNodeJS/index.js.map +0 -1
  431. package/source/helpers/dump_tools.ts +0 -92
  432. package/src/nodeset_tools/dump_to_bsd.ts +0 -196
  433. package/test_helpers/dump_statemachine.ts +0 -155
@@ -1,1452 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReferenceType = exports.BaseNodeImpl = exports.makeAttributeEventName = void 0;
4
- /**
5
- * @module node-opcua-address-space
6
- */
7
- const events_1 = require("events");
8
- const chalk = require("chalk");
9
- const lodash_1 = require("lodash");
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_data_value_1 = require("node-opcua-data-value");
13
- const node_opcua_debug_1 = require("node-opcua-debug");
14
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
- const node_opcua_status_code_1 = require("node-opcua-status-code");
16
- const node_opcua_types_1 = require("node-opcua-types");
17
- const node_opcua_utils_1 = require("node-opcua-utils");
18
- const node_opcua_variant_1 = require("node-opcua-variant");
19
- const node_opcua_constants_1 = require("node-opcua-constants");
20
- const dump_tools_1 = require("../source/helpers/dump_tools");
21
- const session_context_1 = require("../source/session_context");
22
- const cetools = require("./address_space_change_event_tools");
23
- const base_node_private_1 = require("./base_node_private");
24
- const reference_impl_1 = require("./reference_impl");
25
- const role_permissions_1 = require("./role_permissions");
26
- // tslint:disable:no-var-requires
27
- // tslint:disable:no-bitwise
28
- // tslint:disable:no-console
29
- const doDebug = false;
30
- const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
31
- const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
32
- function defaultBrowseFilterFunc(context) {
33
- return true;
34
- }
35
- function _get_QualifiedBrowseName(browseName) {
36
- return (0, node_opcua_data_model_1.coerceQualifiedName)(browseName);
37
- }
38
- function _is_valid_BrowseDirection(browseDirection) {
39
- return (browseDirection === node_opcua_data_model_1.BrowseDirection.Forward ||
40
- browseDirection === node_opcua_data_model_1.BrowseDirection.Inverse ||
41
- browseDirection === node_opcua_data_model_1.BrowseDirection.Both);
42
- }
43
- function makeAttributeEventName(attributeId) {
44
- const attributeName = node_opcua_data_model_1.attributeNameById[attributeId];
45
- return attributeName + "_changed";
46
- }
47
- exports.makeAttributeEventName = makeAttributeEventName;
48
- /**
49
- * Base class for all Node classes
50
- *
51
- * BaseNode is the base class for all the OPCUA objects in the address space
52
- * It provides attributes and a set of references to other nodes.
53
- * see:
54
- * {{#crossLink "UAObject"}}{{/crossLink}},
55
- * {{#crossLink "UAVariable"}}{{/crossLink}},
56
- * {{#crossLink "Reference"}}{{/crossLink}},
57
- * {{#crossLink "UAMethod"}}{{/crossLink}},
58
- * {{#crossLink "UAView"}}{{/crossLink}},
59
- * {{#crossLink "UAObjectType"}}{{/crossLink}},
60
- * {{#crossLink "UADataType"}}{{/crossLink}},
61
- * {{#crossLink "UAVariableType"}}{{/crossLink}},
62
- *
63
- *
64
- */
65
- class BaseNodeImpl extends events_1.EventEmitter {
66
- /**
67
- * @internal
68
- * @param options
69
- */
70
- constructor(options) {
71
- super();
72
- this.nodeClass = node_opcua_data_model_1.NodeClass.Unspecified;
73
- (0, node_opcua_assert_1.assert)(this.nodeClass === node_opcua_data_model_1.NodeClass.Unspecified, "must not be specify a nodeClass");
74
- (0, node_opcua_assert_1.assert)(options.addressSpace); // expecting an address space
75
- (0, node_opcua_assert_1.assert)(options.browseName instanceof node_opcua_data_model_1.QualifiedName, "Expecting a valid QualifiedName");
76
- (0, node_opcua_assert_1.assert)(options.nodeId instanceof node_opcua_nodeid_1.NodeId, "Expecting a valid NodeId");
77
- options.references = options.references || [];
78
- const _private = (0, base_node_private_1.BaseNode_initPrivate)(this);
79
- _private.__address_space = options.addressSpace;
80
- this.nodeId = (0, node_opcua_nodeid_1.resolveNodeId)(options.nodeId);
81
- // QualifiedName
82
- /**
83
- * the node browseName
84
- * @property browseName
85
- * @type QualifiedName
86
- * @static
87
- */
88
- this.browseName = _get_QualifiedBrowseName(options.browseName);
89
- // re-use browseName as displayName if displayName is missing
90
- options.displayName = options.displayName || this.browseName.name.toString();
91
- if (options.description === undefined) {
92
- options.description = null;
93
- }
94
- this._setDisplayName(options.displayName);
95
- this._setDescription(options.description);
96
- // user defined filter function for browsing
97
- const _browseFilter = options.browseFilter || defaultBrowseFilterFunc;
98
- (0, node_opcua_assert_1.assert)(typeof _browseFilter === "function");
99
- _private._browseFilter = _browseFilter;
100
- // normalize reference type
101
- // this will convert any referenceType expressed with its inverseName into
102
- // its normal name and fix the isForward flag accordingly.
103
- // ( e.g "ComponentOf" isForward:true => "HasComponent", isForward:false)
104
- for (const reference of options.references) {
105
- this.__addReference(reference);
106
- }
107
- this._accessRestrictions = options.accessRestrictions;
108
- this._rolePermissions = (0, role_permissions_1.coerceRolePermissions)(options.rolePermissions);
109
- }
110
- static makeAttributeEventName(attributeId) {
111
- return makeAttributeEventName(attributeId);
112
- }
113
- get addressSpace() {
114
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
115
- // istanbul ignore next
116
- if (!_private) {
117
- throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
118
- }
119
- return _private.__address_space;
120
- }
121
- get addressSpacePrivate() {
122
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
123
- // istanbul ignore next
124
- if (!_private) {
125
- throw new Error("Internal error , cannot extract private data from " + this.browseName.toString());
126
- }
127
- return _private.__address_space;
128
- }
129
- get displayName() {
130
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
131
- return _private._displayName;
132
- }
133
- setDisplayName(value) {
134
- this._setDisplayName(value);
135
- /**
136
- * fires when the displayName is changed.
137
- * @event DisplayName_changed
138
- * @param dataValue {DataValue}
139
- */
140
- this._notifyAttributeChange(node_opcua_data_model_1.AttributeIds.DisplayName);
141
- }
142
- get description() {
143
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
144
- return _private._description;
145
- }
146
- setDescription(value) {
147
- this._setDescription(value);
148
- /**
149
- * fires when the description attribute is changed.
150
- * @event Description_changed
151
- * @param dataValue {DataValue}
152
- */
153
- this._notifyAttributeChange(node_opcua_data_model_1.AttributeIds.Description);
154
- }
155
- /**
156
- * returns the nodeId of this node's Type Definition
157
- */
158
- get typeDefinition() {
159
- const _cache = (0, base_node_private_1.BaseNode_getCache)(this);
160
- if (!_cache.typeDefinition) {
161
- const has_type_definition_ref = this.findReference("HasTypeDefinition", true);
162
- let nodeId = has_type_definition_ref ? has_type_definition_ref.nodeId : null;
163
- if (!nodeId) {
164
- switch (this.nodeClass) {
165
- case node_opcua_data_model_1.NodeClass.Object:
166
- nodeId = (0, node_opcua_nodeid_1.coerceNodeId)(node_opcua_constants_1.ObjectTypeIds.BaseObjectType);
167
- break;
168
- case node_opcua_data_model_1.NodeClass.Variable:
169
- nodeId = (0, node_opcua_nodeid_1.coerceNodeId)(node_opcua_constants_1.VariableTypeIds.BaseVariableType);
170
- break;
171
- default:
172
- }
173
- }
174
- _cache.typeDefinition = nodeId;
175
- }
176
- return _cache.typeDefinition;
177
- }
178
- /**
179
- * returns the nodeId of this node's Type Definition
180
- */
181
- get typeDefinitionObj() {
182
- const _cache = (0, base_node_private_1.BaseNode_getCache)(this);
183
- if (undefined === _cache.typeDefinitionObj) {
184
- const nodeId = this.typeDefinition;
185
- _cache.typeDefinitionObj = nodeId ? this.addressSpace.findNode(nodeId) : null;
186
- }
187
- if (!_cache.typeDefinitionObj) {
188
- warningLog(this.nodeClass, "cannot find typeDefinitionObj ", this.browseName.toString(), this.nodeId.toString(), node_opcua_data_model_1.NodeClass[this.nodeClass]);
189
- }
190
- return _cache.typeDefinitionObj;
191
- }
192
- get parentNodeId() {
193
- const parent = this.parent;
194
- return parent ? parent.nodeId : undefined;
195
- }
196
- /**
197
- * namespace index
198
- */
199
- get namespaceIndex() {
200
- return this.nodeId.namespace;
201
- }
202
- /**
203
- * namespace uri
204
- */
205
- get namespaceUri() {
206
- return this.addressSpace.getNamespaceUri(this.namespaceIndex);
207
- }
208
- /**
209
- * the parent node
210
- */
211
- get parent() {
212
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
213
- if (_private._parent === undefined) {
214
- // never been set before
215
- _private._parent = _setup_parent_item.call(this, _private._referenceIdx);
216
- }
217
- return _private._parent || null;
218
- }
219
- /**
220
- * @property modellingRule
221
- * @type {String|undefined}
222
- */
223
- get modellingRule() {
224
- const r = this.findReferencesAsObject("HasModellingRule");
225
- if (!r || r.length === 0) {
226
- return null; /// "? modellingRule missing ?"; // consider "Mandatory"
227
- }
228
- const r0 = r[0];
229
- return r0.browseName.toString();
230
- }
231
- getDisplayName(locale) {
232
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
233
- return _private._displayName[0].text;
234
- }
235
- get namespace() {
236
- return this.addressSpacePrivate.getNamespace(this.nodeId.namespace);
237
- }
238
- // ---------------------------------------------------------------------------------------------------
239
- // Finders
240
- // ---------------------------------------------------------------------------------------------------
241
- findReferencesEx(referenceType, browseDirection) {
242
- browseDirection = browseDirection !== undefined ? browseDirection : node_opcua_data_model_1.BrowseDirection.Forward;
243
- (0, node_opcua_assert_1.assert)(_is_valid_BrowseDirection(browseDirection));
244
- (0, node_opcua_assert_1.assert)(browseDirection !== node_opcua_data_model_1.BrowseDirection.Both);
245
- const referenceTypeNode = this._coerceReferenceType(referenceType);
246
- if (!referenceTypeNode) {
247
- // note: when loading nodeset2.xml files, reference type may not exit yet
248
- // throw new Error("expecting valid reference name " + strReference);
249
- return [];
250
- }
251
- const isForward = browseDirection === node_opcua_data_model_1.BrowseDirection.Forward;
252
- const results = [];
253
- const process = (referenceIdx) => {
254
- const references = Object.values(referenceIdx);
255
- for (const ref of references) {
256
- if (ref.isForward === isForward && referenceTypeNode && referenceTypeNode.checkHasSubtype(ref.referenceType)) {
257
- results.push(ref);
258
- }
259
- }
260
- };
261
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
262
- process(_private._referenceIdx);
263
- process(_private._back_referenceIdx);
264
- return results;
265
- }
266
- findReferences_no_cache(referenceTypeNode, isForward = true) {
267
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
268
- const result = [];
269
- for (const ref of Object.values(_private._referenceIdx)) {
270
- if (ref.isForward === isForward) {
271
- if ((0, node_opcua_nodeid_1.sameNodeId)(ref.referenceType, referenceTypeNode.nodeId)) {
272
- result.push(ref);
273
- }
274
- }
275
- }
276
- for (const ref of Object.values(_private._back_referenceIdx)) {
277
- if (ref.isForward === isForward) {
278
- if ((0, node_opcua_nodeid_1.sameNodeId)(ref.referenceType, referenceTypeNode.nodeId)) {
279
- result.push(ref);
280
- }
281
- }
282
- }
283
- return result;
284
- }
285
- findReferences(referenceType, isForward = true) {
286
- const _cache = (0, base_node_private_1.BaseNode_getCache)(this);
287
- const referenceTypeNode = this._coerceReferenceType(referenceType);
288
- if (!referenceTypeNode) {
289
- // note: when loading nodeset2.xml files, reference type may not exit yet
290
- // throw new Error("expecting valid reference name " + strReference);
291
- return [];
292
- }
293
- _cache._ref = _cache._ref || {};
294
- const hash = "_ref_" + referenceTypeNode.nodeId.toString() + isForward.toString();
295
- if (_cache._ref[hash]) {
296
- return _cache._ref[hash];
297
- }
298
- // istanbul ignore next
299
- if (doDebug && !this.addressSpace.findReferenceType(referenceTypeNode.nodeId)) {
300
- throw new Error("expecting valid reference name " + referenceType);
301
- }
302
- const result = this.findReferences_no_cache(referenceTypeNode, isForward);
303
- _cache._ref[hash] = result;
304
- return result;
305
- }
306
- findReference(strReference, isForward) {
307
- const refs = this.findReferences(strReference, isForward);
308
- if (refs.length !== 1 && refs.length !== 0) {
309
- throw new Error("findReference: expecting only one or zero element here");
310
- }
311
- return refs[0] || null;
312
- }
313
- findReferencesExAsObject(referenceType, browseDirection) {
314
- const references = this.findReferencesEx(referenceType, browseDirection);
315
- return _asObject(references, this.addressSpace);
316
- }
317
- findReferencesAsObject(referenceType, isForward) {
318
- const references = this.findReferences(referenceType, isForward);
319
- return _asObject(references, this.addressSpace);
320
- }
321
- /**
322
- * return an array with the Aggregates of this object.
323
- */
324
- getAggregates() {
325
- // const _cache = BaseNode_getCache(this);
326
- // if (!_cache._aggregates) {
327
- // _cache._aggregates = this.findReferencesExAsObject("Aggregates", BrowseDirection.Forward);
328
- // }
329
- // return _cache._aggregates;
330
- return this.findReferencesExAsObject("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
331
- }
332
- /**
333
- * return an array with the components of this object.
334
- */
335
- getComponents() {
336
- // const _cache = BaseNode_getCache(this);
337
- // if (!_cache._components) {
338
- // _cache._components = this.findReferencesExAsObject("HasComponent", BrowseDirection.Forward);
339
- // }
340
- // return _cache._components;
341
- return this.findReferencesExAsObject("HasComponent", node_opcua_data_model_1.BrowseDirection.Forward);
342
- }
343
- /**
344
- * return a array with the properties of this object.
345
- */
346
- getProperties() {
347
- // const _cache = BaseNode_getCache(this);
348
- // if (!_cache._properties) {
349
- // _cache._properties = this.findReferencesExAsObject("HasProperty", BrowseDirection.Forward);
350
- // }
351
- // return _cache._properties;
352
- return this.findReferencesExAsObject("HasProperty", node_opcua_data_model_1.BrowseDirection.Forward);
353
- }
354
- /**
355
- * return a array with the notifiers of this object.
356
- */
357
- getNotifiers() {
358
- // const _cache = BaseNode_getCache(this);
359
- // if (!_cache._notifiers) {
360
- // _cache._notifiers = this.findReferencesAsObject("HasNotifier", true);
361
- // }
362
- // return _cache._notifiers;
363
- return this.findReferencesAsObject("HasNotifier", true);
364
- }
365
- /**
366
- * return a array with the event source of this object.
367
- */
368
- getEventSources() {
369
- // const _cache = BaseNode_getCache(this);
370
- // if (!_cache._eventSources) {
371
- // _cache._eventSources = this.findReferencesAsObject("HasEventSource", true);
372
- // }
373
- // return _cache._eventSources;
374
- return this.findReferencesAsObject("HasEventSource", true);
375
- }
376
- /**
377
- * return a array of the objects for which this node is an EventSource
378
- */
379
- getEventSourceOfs() {
380
- // const _cache = BaseNode_getCache(this);
381
- // if (!_cache._eventSources) {
382
- // _cache._eventSources = this.findReferencesAsObject("HasEventSource", false);
383
- // }
384
- // return _cache._eventSources;
385
- return this.findReferencesAsObject("HasEventSource", false);
386
- }
387
- getComponentByName(browseName, namespaceIndex) {
388
- const components = this.getComponents();
389
- const select = _filter_by_browse_name(components, browseName, namespaceIndex);
390
- (0, node_opcua_assert_1.assert)(select.length <= 1, "BaseNode#getComponentByName found duplicated reference");
391
- if (select.length === 1) {
392
- const component = select[0];
393
- if (component.nodeClass === node_opcua_data_model_1.NodeClass.Method) {
394
- warningLog("please use getMethodByName to retrieve a method");
395
- return null;
396
- }
397
- (0, node_opcua_assert_1.assert)(component.nodeClass === node_opcua_data_model_1.NodeClass.Variable || component.nodeClass === node_opcua_data_model_1.NodeClass.Object);
398
- return component;
399
- }
400
- else {
401
- return null;
402
- }
403
- }
404
- getPropertyByName(browseName, namespaceIndex) {
405
- const properties = this.getProperties();
406
- const select = _filter_by_browse_name(properties, browseName, namespaceIndex);
407
- (0, node_opcua_assert_1.assert)(select.length <= 1, "BaseNode#getPropertyByName found duplicated reference");
408
- if (select.length === 1 && select[0].nodeClass !== node_opcua_data_model_1.NodeClass.Variable) {
409
- throw new Error("Expecting a property to be of nodeClass==NodeClass.Variable");
410
- }
411
- return select.length === 1 ? select[0] : null;
412
- }
413
- getFolderElementByName(browseName, namespaceIndex) {
414
- const elements = this.getFolderElements();
415
- const select = _filter_by_browse_name(elements, browseName, namespaceIndex);
416
- return select.length === 1 ? select[0] : null;
417
- }
418
- /**
419
- * returns the list of nodes that this folder object organizes
420
- */
421
- getFolderElements() {
422
- return this.findReferencesExAsObject("Organizes", node_opcua_data_model_1.BrowseDirection.Forward);
423
- }
424
- /**
425
- * returns the list of methods that this object provides
426
- * @method getMethods
427
- * @return an array with Method objects.
428
- *
429
- *
430
- * Note: internally, methods are special types of components
431
- */
432
- getMethods() {
433
- // const _cache = BaseNode_getCache(this);
434
- // if (!_cache._methods) {
435
- // const components = this.getComponents();
436
- // _cache._methods = components.filter((obj) => obj.nodeClass === NodeClass.Method) as UAMethod[];
437
- // }
438
- // return _cache._methods;
439
- const components = this.getComponents();
440
- return components.filter((obj) => obj.nodeClass === node_opcua_data_model_1.NodeClass.Method);
441
- }
442
- /**
443
- * returns the method exposed by this object and with the given nodeId
444
- */
445
- getMethodById(nodeId) {
446
- const methods = this.getMethods();
447
- const found = methods.find((m) => m.nodeId.toString() === nodeId.toString());
448
- return found || null;
449
- }
450
- getMethodByName(methodName, namespaceIndex) {
451
- const methods = this.getMethods();
452
- const select = _filter_by_browse_name(methods, methodName, namespaceIndex);
453
- (0, node_opcua_assert_1.assert)(select.length <= 1, "BaseNode#getMethodByName found duplicated reference");
454
- return select.length === 1 ? select[0] : null;
455
- }
456
- getWriteMask() {
457
- return 0;
458
- }
459
- getUserWriteMask() {
460
- return 0;
461
- }
462
- readAttribute(context, attributeId, indexRange, dataEncoding) {
463
- indexRange;
464
- dataEncoding;
465
- (0, node_opcua_assert_1.assert)(!context || context instanceof session_context_1.SessionContext);
466
- const options = {};
467
- options.statusCode = node_opcua_status_code_1.StatusCodes.Good;
468
- switch (attributeId) {
469
- case node_opcua_data_model_1.AttributeIds.NodeId: // NodeId
470
- options.value = { dataType: node_opcua_variant_1.DataType.NodeId, value: this.nodeId };
471
- break;
472
- case node_opcua_data_model_1.AttributeIds.NodeClass: // NodeClass
473
- (0, node_opcua_assert_1.assert)(isFinite(this.nodeClass));
474
- options.value = { dataType: node_opcua_variant_1.DataType.Int32, value: this.nodeClass };
475
- break;
476
- case node_opcua_data_model_1.AttributeIds.BrowseName: // QualifiedName
477
- (0, node_opcua_assert_1.assert)(this.browseName instanceof node_opcua_data_model_1.QualifiedName);
478
- options.value = { dataType: node_opcua_variant_1.DataType.QualifiedName, value: this.browseName };
479
- break;
480
- case node_opcua_data_model_1.AttributeIds.DisplayName: // LocalizedText
481
- options.value = { dataType: node_opcua_variant_1.DataType.LocalizedText, value: this.displayName[0] };
482
- break;
483
- case node_opcua_data_model_1.AttributeIds.Description: // LocalizedText
484
- options.value = { dataType: node_opcua_variant_1.DataType.LocalizedText, value: this.description };
485
- break;
486
- case node_opcua_data_model_1.AttributeIds.WriteMask:
487
- options.value = { dataType: node_opcua_variant_1.DataType.UInt32, value: this.getWriteMask() };
488
- break;
489
- case node_opcua_data_model_1.AttributeIds.UserWriteMask:
490
- options.value = { dataType: node_opcua_variant_1.DataType.UInt32, value: this.getUserWriteMask() };
491
- break;
492
- case node_opcua_data_model_1.AttributeIds.AccessRestrictions:
493
- return this._readAccessRestrictions(context);
494
- case node_opcua_data_model_1.AttributeIds.RolePermissions:
495
- return this._readRolePermissions(context);
496
- case node_opcua_data_model_1.AttributeIds.UserRolePermissions:
497
- return this._readUserRolePermissions(context);
498
- default:
499
- options.value = null;
500
- options.statusCode = node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid;
501
- break;
502
- }
503
- // xx options.serverTimestamp = new Date();
504
- return new node_opcua_data_value_1.DataValue(options);
505
- }
506
- writeAttribute(context, writeValue, callback) {
507
- context = context || session_context_1.SessionContext.defaultContext;
508
- (0, node_opcua_assert_1.assert)(context instanceof session_context_1.SessionContext);
509
- (0, node_opcua_assert_1.assert)(typeof callback === "function");
510
- if (writeValue.attributeId === undefined ||
511
- writeValue.attributeId <= 0 ||
512
- writeValue.attributeId > node_opcua_data_model_1.AttributeIds.AccessLevelEx) {
513
- return callback(null, node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid);
514
- }
515
- if (!this.canUserWriteAttribute(context, writeValue.attributeId)) {
516
- return callback(null, node_opcua_status_code_1.StatusCodes.BadUserAccessDenied);
517
- }
518
- // by default Node is read-only,
519
- // this method needs to be overridden to change the behavior
520
- callback(null, node_opcua_status_code_1.StatusCodes.BadNotWritable);
521
- }
522
- fullName() {
523
- if (this.parentNodeId) {
524
- const parent = this.addressSpace.findNode(this.parentNodeId);
525
- // istanbul ignore else
526
- if (parent) {
527
- return parent.fullName() + "." + this.browseName.toString() + "";
528
- }
529
- else {
530
- return "NOT YET REGISTERED" + this.parentNodeId.toString() + "." + this.browseName.toString() + "";
531
- }
532
- }
533
- return this.browseName.toString();
534
- }
535
- ownReferences() {
536
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
537
- return Object.values(_private._referenceIdx);
538
- }
539
- /**
540
- * @method browseNodeByTargetName
541
- *
542
- * @param relativePathElement
543
- * @param isLast
544
- * @return {NodeId[]}
545
- */
546
- browseNodeByTargetName(relativePathElement, isLast) {
547
- relativePathElement.targetName = relativePathElement.targetName || new node_opcua_data_model_1.QualifiedName({});
548
- // part 4.0 v1.03 $7.26 RelativePath
549
- // The BrowseName of the target node.
550
- // The final element may have an empty targetName. In this situation all targets of the references identified by
551
- // the referenceTypeId are the targets of the RelativePath.
552
- // The targetName shall be specified for all other elements.
553
- // The current path cannot be followed any further if no targets with the specified BrowseName exist.
554
- (0, node_opcua_assert_1.assert)(relativePathElement.targetName instanceof node_opcua_data_model_1.QualifiedName);
555
- (0, node_opcua_assert_1.assert)(relativePathElement.targetName.namespaceIndex >= 0);
556
- (0, node_opcua_assert_1.assert)(relativePathElement.targetName.name.length > 0);
557
- // The type of reference to follow from the current node.
558
- // The current path cannot be followed any further if the referenceTypeId is not available on the Node instance.
559
- // If not specified then all References are included and the parameter includeSubtypes is ignored.
560
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(relativePathElement, "referenceTypeId"));
561
- // Indicates whether the inverse Reference should be followed.
562
- // The inverse reference is followed if this value is TRUE.
563
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(relativePathElement, "isInverse"));
564
- // Indicates whether subtypes of the ReferenceType should be followed.
565
- // Subtypes are included if this value is TRUE.
566
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(relativePathElement, "includeSubtypes"));
567
- const references = this.allReferences();
568
- const _check_reference = (reference) => {
569
- if (relativePathElement.referenceTypeId.isEmpty()) {
570
- return true;
571
- }
572
- (0, node_opcua_assert_1.assert)(relativePathElement.referenceTypeId instanceof node_opcua_nodeid_1.NodeId);
573
- if ((relativePathElement.isInverse && reference.isForward) ||
574
- (!relativePathElement.isInverse && !reference.isForward)) {
575
- return false;
576
- }
577
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(reference, "isForward"));
578
- const referenceType = resolveReferenceType(this.addressSpace, reference);
579
- const referenceTypeId = referenceType.nodeId;
580
- if ((0, node_opcua_nodeid_1.sameNodeId)(relativePathElement.referenceTypeId, referenceTypeId)) {
581
- return true;
582
- }
583
- if (relativePathElement.includeSubtypes) {
584
- const baseType = this.addressSpace.findReferenceType(relativePathElement.referenceTypeId);
585
- if (baseType && referenceType.isSubtypeOf(baseType)) {
586
- return true;
587
- }
588
- }
589
- return false;
590
- };
591
- const nodeIdsMap = {};
592
- let nodeIds = [];
593
- for (const reference of references) {
594
- if (!_check_reference(reference)) {
595
- continue;
596
- }
597
- const obj = resolveReferenceNode(this.addressSpace, reference);
598
- // istanbul ignore next
599
- if (!obj) {
600
- throw new Error(" cannot find node with id " + reference.nodeId.toString());
601
- }
602
- if ((0, lodash_1.isEqual)(obj.browseName, relativePathElement.targetName)) {
603
- // compare QualifiedName
604
- const key = obj.nodeId.toString();
605
- if (!Object.prototype.hasOwnProperty.call(nodeIdsMap, key)) {
606
- nodeIds.push(obj.nodeId);
607
- nodeIdsMap[key] = obj;
608
- }
609
- }
610
- }
611
- if (nodeIds.length === 0 && (this.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType || this.nodeClass === node_opcua_data_model_1.NodeClass.VariableType)) {
612
- const nodeType = this;
613
- if (nodeType.subtypeOf) {
614
- // browsing also InstanceDeclarations included in base type
615
- const baseType = this.addressSpace.findNode(nodeType.subtypeOf);
616
- const n = baseType.browseNodeByTargetName(relativePathElement, isLast);
617
- nodeIds = [].concat(nodeIds, n);
618
- }
619
- }
620
- return nodeIds;
621
- }
622
- /**
623
- * browse the node to extract information requested in browseDescription
624
- * and returns an array with reference descriptions
625
- *
626
- *
627
- *
628
- */
629
- browseNode(browseDescription, context) {
630
- (0, node_opcua_assert_1.assert)(isFinite(browseDescription.nodeClassMask));
631
- const do_debug = false;
632
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
633
- const addressSpace = this.addressSpace;
634
- const referenceTypeId = normalize_referenceTypeId(addressSpace, browseDescription.referenceTypeId);
635
- (0, node_opcua_assert_1.assert)(referenceTypeId instanceof node_opcua_nodeid_1.NodeId);
636
- const browseDirection = browseDescription.browseDirection !== undefined ? browseDescription.browseDirection : node_opcua_data_model_1.BrowseDirection.Both;
637
- // get all possible references
638
- let references = this.allReferences();
639
- /* istanbul ignore next */
640
- if (do_debug) {
641
- console.log("all references :", this.nodeId.toString(), this.browseName.toString());
642
- (0, dump_tools_1.dumpReferences)(addressSpace, Object.values(_private._referenceIdx));
643
- }
644
- // filter out references not matching referenceType
645
- references = _filter_by_referenceType.call(this, browseDescription, references, referenceTypeId);
646
- references = _filter_by_direction(references, browseDirection);
647
- references = _filter_by_nodeClass.call(this, references, browseDescription.nodeClassMask);
648
- references = _filter_by_userFilter.call(this, references, context);
649
- if (context) {
650
- references = _filter_by_context(this, references, context);
651
- }
652
- const referenceDescriptions = (0, base_node_private_1._constructReferenceDescription)(addressSpace, references, browseDescription.resultMask);
653
- /* istanbul ignore next */
654
- if (do_debug) {
655
- (0, dump_tools_1.dumpReferenceDescriptions)(this.addressSpace, referenceDescriptions);
656
- }
657
- return referenceDescriptions;
658
- }
659
- allReferences() {
660
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
661
- return Object.values(_private._referenceIdx).concat(Object.values(_private._back_referenceIdx));
662
- }
663
- /**
664
- * @method addReference
665
- * @param reference
666
- * @param reference.referenceType {String}
667
- * @param [reference.isForward = true] {Boolean}
668
- * @param reference.nodeId {Node|NodeId|String}
669
- *
670
- * @example
671
- *
672
- * view.addReference({ referenceType: "Organizes", nodeId: myDevice });
673
- *
674
- * or
675
- *
676
- * myDevice1.addReference({ referenceType: "OrganizedBy", nodeId: view });
677
- */
678
- addReference(reference) {
679
- const referenceNode = this.__addReference(reference);
680
- const addressSpace = this.addressSpace;
681
- if (!resolveReferenceType(addressSpace, referenceNode)) {
682
- throw new Error("BaseNode#addReference : invalid reference " + reference.toString());
683
- }
684
- this._clear_caches();
685
- _propagate_ref.call(this, addressSpace, referenceNode);
686
- this.install_extra_properties();
687
- cetools._handle_add_reference_change_event(this, referenceNode.nodeId);
688
- }
689
- removeReference(referenceOpts) {
690
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
691
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(referenceOpts, "referenceType"));
692
- // xx isForward is optional : assert(Object.prototype.hasOwnProperty.call(reference,"isForward"));
693
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(referenceOpts, "nodeId"));
694
- const addressSpace = this.addressSpace;
695
- // istanbul ignore next
696
- if (!addressSpace) {
697
- console.log(" Where is addressSpace ?");
698
- }
699
- const reference = addressSpace.normalizeReferenceTypes([referenceOpts])[0];
700
- const h = reference.hash;
701
- const relatedNode = addressSpace.findNode(reference.nodeId);
702
- const invReference = new reference_impl_1.ReferenceImpl({
703
- isForward: !reference.isForward,
704
- nodeId: this.nodeId,
705
- referenceType: reference.referenceType
706
- });
707
- if (_private._referenceIdx[h]) {
708
- delete _private._referenceIdx[h];
709
- base_node_private_1.BaseNode_remove_backward_reference.call(relatedNode, invReference);
710
- }
711
- else if (_private._back_referenceIdx[h]) {
712
- relatedNode.removeReference(invReference);
713
- }
714
- else {
715
- // throw new Error("Cannot find reference " + reference);
716
- }
717
- (0, base_node_private_1._handle_HierarchicalReference)(this, reference);
718
- this.uninstall_extra_properties(reference);
719
- this._clear_caches();
720
- }
721
- /**
722
- *
723
- */
724
- resolveNodeId(nodeId) {
725
- return this.addressSpace.resolveNodeId(nodeId);
726
- }
727
- install_extra_properties() {
728
- const addressSpace = this.addressSpace;
729
- if (addressSpace.isFrugal) {
730
- // skipping
731
- return;
732
- }
733
- install_components_as_object_properties(this);
734
- function install_extra_properties_on_parent(ref) {
735
- const node = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, ref);
736
- install_components_as_object_properties(node);
737
- }
738
- // make sure parent have extra properties updated
739
- const parentComponents = this.findReferencesEx("HasComponent", node_opcua_data_model_1.BrowseDirection.Inverse);
740
- const parentSubfolders = this.findReferencesEx("Organizes", node_opcua_data_model_1.BrowseDirection.Inverse);
741
- const parentProperties = this.findReferencesEx("HasProperty", node_opcua_data_model_1.BrowseDirection.Inverse);
742
- for (const p of parentComponents) {
743
- install_extra_properties_on_parent(p);
744
- }
745
- for (const p of parentSubfolders) {
746
- install_extra_properties_on_parent(p);
747
- }
748
- for (const p of parentProperties) {
749
- install_extra_properties_on_parent(p);
750
- }
751
- }
752
- uninstall_extra_properties(reference) {
753
- const addressSpace = this.addressSpace;
754
- if (addressSpace.isFrugal) {
755
- // skipping
756
- return;
757
- }
758
- const childNode = resolveReferenceNode(addressSpace, reference);
759
- const name = (0, node_opcua_utils_1.lowerFirstLetter)(childNode.browseName.name.toString());
760
- if (Object.prototype.hasOwnProperty.call(reservedNames, name)) {
761
- // istanbul ignore next
762
- if (doDebug) {
763
- // tslint:disable-next-line:no-console
764
- console.log(chalk.bgWhite.red("Ignoring reserved keyword " + name));
765
- }
766
- return;
767
- }
768
- /* istanbul ignore next */
769
- if (!Object.prototype.hasOwnProperty.call(this, name)) {
770
- return;
771
- }
772
- Object.defineProperty(this, name, {
773
- value: undefined
774
- });
775
- }
776
- toString() {
777
- const options = new base_node_private_1.ToStringBuilder();
778
- base_node_private_1.BaseNode_toString.call(this, options);
779
- return options.toString();
780
- }
781
- /**
782
- * @property isFalseSubStateOf
783
- * @type {BaseNode|null}
784
- */
785
- get isFalseSubStateOf() {
786
- const r = this.findReferencesAsObject("HasFalseSubState", false);
787
- if (!r || r.length === 0) {
788
- return null;
789
- }
790
- (0, node_opcua_assert_1.assert)(r.length === 1);
791
- return r[0];
792
- }
793
- /**
794
- * @property isTrueSubStateOf
795
- * @type {BaseNode|null}
796
- */
797
- get isTrueSubStateOf() {
798
- const r = this.findReferencesAsObject("HasTrueSubState", false);
799
- if (!r || r.length === 0) {
800
- return null;
801
- }
802
- (0, node_opcua_assert_1.assert)(r.length === 1);
803
- return r[0];
804
- }
805
- /**
806
- * @method getFalseSubStates
807
- * @return {UAStateVariable[]} return an array with the SubStates of this object.
808
- */
809
- getFalseSubStates() {
810
- return this.findReferencesAsObject("HasFalseSubState");
811
- }
812
- /**
813
- * @method getTrueSubStates
814
- * @return {UAStateVariable[]} return an array with the SubStates of this object.
815
- */
816
- getTrueSubStates() {
817
- return this.findReferencesAsObject("HasTrueSubState");
818
- }
819
- findHierarchicalReferences() {
820
- return this.findReferencesEx("HierarchicalReferences", node_opcua_data_model_1.BrowseDirection.Forward);
821
- }
822
- getChildByName(browseName, namespaceIndex) {
823
- // Attention: getChild doesn't care about namespace on browseName
824
- // !!!!
825
- if (browseName instanceof node_opcua_data_model_1.QualifiedName) {
826
- browseName = browseName.name.toString();
827
- }
828
- (0, node_opcua_assert_1.assert)(typeof browseName === "string");
829
- const _cache = (0, base_node_private_1.BaseNode_getCache)(this);
830
- const addressSpace = this.addressSpace;
831
- if (!_cache._childByNameMap) {
832
- _cache._childByNameMap = {};
833
- const childReferenceTypes = this.findReferencesEx("HasChild");
834
- for (const r of childReferenceTypes) {
835
- const child = resolveReferenceNode(addressSpace, r);
836
- _cache._childByNameMap[child.browseName.name.toString()] = child;
837
- }
838
- }
839
- const ret = _cache._childByNameMap[browseName.toString()] || null;
840
- return ret;
841
- }
842
- get toStateNode() {
843
- const nodes = this.findReferencesAsObject("ToState", true);
844
- (0, node_opcua_assert_1.assert)(nodes.length <= 1);
845
- return nodes.length === 1 ? nodes[0] : null;
846
- }
847
- get fromStateNode() {
848
- const nodes = this.findReferencesAsObject("FromState", true);
849
- (0, node_opcua_assert_1.assert)(nodes.length <= 1);
850
- return nodes.length === 1 ? nodes[0] : null;
851
- }
852
- /**
853
- * this methods propagates the forward references to the pointed node
854
- * by inserting backward references to the counter part node
855
- */
856
- propagate_back_references() {
857
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
858
- if (this.addressSpace.suspendBackReference) {
859
- // this indicates that the base node is constructed from an xml definition
860
- // propagate_back_references will be called later once the file has been completely processed.
861
- return;
862
- }
863
- const addressSpace = this.addressSpace;
864
- for (const reference of Object.values(_private._referenceIdx)) {
865
- _propagate_ref.call(this, addressSpace, reference);
866
- }
867
- }
868
- /**
869
- * the dispose method should be called when the node is no longer used, to release
870
- * back pointer to the address space and clear caches.
871
- *
872
- * @method dispose
873
- *
874
- */
875
- dispose() {
876
- this.emit("dispose");
877
- this.removeAllListeners();
878
- this._clear_caches();
879
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
880
- Object.values(_private._back_referenceIdx).forEach((ref) => ref.dispose());
881
- Object.values(_private._referenceIdx).forEach((ref) => ref.dispose());
882
- (0, base_node_private_1.BaseNode_removePrivate)(this);
883
- }
884
- // istanbul ignore next
885
- dumpXML(xmlWriter) {
886
- console.error(" This ", node_opcua_data_model_1.NodeClass[this.nodeClass]);
887
- (0, node_opcua_assert_1.assert)(false, "BaseNode#dumpXML NOT IMPLEMENTED !");
888
- (0, node_opcua_assert_1.assert)(xmlWriter);
889
- }
890
- /**
891
- * Undo the effect of propagate_back_references
892
- */
893
- unpropagate_back_references() {
894
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
895
- const addressSpace = this.addressSpace;
896
- for (const reference of Object.values(_private._referenceIdx)) {
897
- // filter out non Hierarchical References
898
- const referenceType = resolveReferenceType(addressSpace, reference);
899
- // istanbul ignore next
900
- if (!referenceType) {
901
- console.error(chalk.red(" ERROR"), " cannot find reference ", reference.referenceType, reference.toString());
902
- }
903
- const related_node = resolveReferenceNode(addressSpace, reference);
904
- if (related_node) {
905
- (0, node_opcua_assert_1.assert)(reference.nodeId.toString() !== this.nodeId.toString());
906
- base_node_private_1.BaseNode_remove_backward_reference.call(related_node, new reference_impl_1.ReferenceImpl({
907
- isForward: !reference.isForward,
908
- nodeId: this.nodeId,
909
- referenceType: reference.referenceType
910
- }));
911
- } // else addressSpace may be incomplete
912
- }
913
- }
914
- installPostInstallFunc(f) {
915
- if (!f) {
916
- // nothing to do
917
- return;
918
- }
919
- function chain(f1, f2) {
920
- return function chaiFunc(...args) {
921
- if (f1) {
922
- f1.apply(this, args);
923
- }
924
- if (f2) {
925
- f2.apply(this, args);
926
- }
927
- };
928
- }
929
- this._postInstantiateFunc = chain.call(this, this._postInstantiateFunc, f);
930
- }
931
- _on_child_added() {
932
- this._clear_caches();
933
- }
934
- _on_child_removed(obj) {
935
- // obj; // unused;
936
- this._clear_caches();
937
- }
938
- /**
939
- * @private
940
- * @param reference
941
- */
942
- _add_backward_reference(reference) {
943
- base_node_private_1.BaseNode_add_backward_reference.call(this, reference);
944
- }
945
- _coerceReferenceType(referenceType) {
946
- let result;
947
- if (typeof referenceType === "string") {
948
- result = this.addressSpace.findReferenceType(referenceType);
949
- /* istanbul ignore next */
950
- if (!result) {
951
- errorLog("referenceType ", referenceType, " cannot be found");
952
- throw new Error("Cannot coerce reference with name " + referenceType);
953
- }
954
- }
955
- else if (referenceType instanceof node_opcua_nodeid_1.NodeId) {
956
- result = this.addressSpace.findNode(referenceType);
957
- if (!result) {
958
- return null;
959
- }
960
- }
961
- else {
962
- result = referenceType;
963
- }
964
- (0, node_opcua_assert_1.assert)(result, "reference must exists");
965
- (0, node_opcua_assert_1.assert)(result.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType);
966
- return result;
967
- }
968
- __addReference(referenceOpts) {
969
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
970
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(referenceOpts, "referenceType"));
971
- // xx isForward is optional : assert(Object.prototype.hasOwnProperty.call(reference,"isForward"));
972
- (0, node_opcua_assert_1.assert)(Object.prototype.hasOwnProperty.call(referenceOpts, "nodeId"));
973
- const addressSpace = this.addressSpace;
974
- const reference = addressSpace.normalizeReferenceTypes([referenceOpts])[0];
975
- (0, node_opcua_assert_1.assert)(reference instanceof reference_impl_1.ReferenceImpl);
976
- const h = reference.hash;
977
- (0, node_opcua_assert_1.assert)(!_private._back_referenceIdx[h], "reference exists already in _back_references");
978
- (0, node_opcua_assert_1.assert)(!_private._referenceIdx[h], "reference exists already in _references");
979
- _private._referenceIdx[h] = reference;
980
- (0, base_node_private_1._handle_HierarchicalReference)(this, reference);
981
- return reference;
982
- }
983
- _setDisplayName(displayName) {
984
- const displayNames = Array.isArray(displayName) ? displayName : [displayName];
985
- const _displayNames = displayNames.map(node_opcua_data_model_1.coerceLocalizedText);
986
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
987
- _private._displayName = _displayNames;
988
- }
989
- _setDescription(description) {
990
- const __description = (0, node_opcua_data_model_1.coerceLocalizedText)(description);
991
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
992
- _private._description = __description;
993
- }
994
- _notifyAttributeChange(attributeId) {
995
- const event_name = BaseNodeImpl.makeAttributeEventName(attributeId);
996
- this.emit(event_name, this.readAttribute(session_context_1.SessionContext.defaultContext, attributeId));
997
- }
998
- _clear_caches() {
999
- (0, base_node_private_1.BaseNode_clearCache)(this);
1000
- }
1001
- canUserWriteAttribute(context, attributeId) {
1002
- // the Client is allowed to write to Attributes other than the Value,
1003
- // Historizing or RolePermissions Attribute
1004
- if (!context)
1005
- return true;
1006
- if (attributeId === node_opcua_data_model_1.AttributeIds.Historizing) {
1007
- return context.checkPermission(this, node_opcua_types_1.PermissionType.WriteHistorizing);
1008
- }
1009
- if (attributeId === node_opcua_data_model_1.AttributeIds.RolePermissions) {
1010
- return context.checkPermission(this, node_opcua_types_1.PermissionType.WriteRolePermissions);
1011
- }
1012
- if (attributeId === node_opcua_data_model_1.AttributeIds.Value) {
1013
- return context.checkPermission(this, node_opcua_types_1.PermissionType.Write);
1014
- }
1015
- return context.checkPermission(this, node_opcua_types_1.PermissionType.WriteAttribute);
1016
- }
1017
- _readAccessRestrictions(context) {
1018
- // https://reference.opcfoundation.org/v104/Core/docs/Part3/8.56/
1019
- if (this.accessRestrictions === undefined) {
1020
- return new node_opcua_data_value_1.DataValue({ statusCode: node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid });
1021
- }
1022
- return new node_opcua_data_value_1.DataValue({
1023
- statusCode: node_opcua_status_code_1.StatusCodes.Good,
1024
- value: {
1025
- dataType: node_opcua_variant_1.DataType.UInt16,
1026
- value: this.accessRestrictions
1027
- }
1028
- });
1029
- }
1030
- _readRolePermissions(context) {
1031
- // https://reference.opcfoundation.org/v104/Core/docs/Part3/4.8.3/
1032
- // to do check that current user can read permission
1033
- if (context && !context.checkPermission(this, node_opcua_types_1.PermissionType.ReadRolePermissions)) {
1034
- return new node_opcua_data_value_1.DataValue({
1035
- statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient
1036
- });
1037
- }
1038
- if (this.rolePermissions === undefined) {
1039
- // to do : If not specified, the value of DefaultUserRolePermissions Property from
1040
- // the Namespace Metadata Object associated with the Node is used instead.
1041
- return new node_opcua_data_value_1.DataValue({
1042
- statusCode: node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid
1043
- });
1044
- }
1045
- const rolePermissions = this.rolePermissions.map(({ roleId, permissions }) => {
1046
- return new node_opcua_types_1.RolePermissionType({
1047
- roleId: toRoleNodeId(roleId),
1048
- permissions
1049
- });
1050
- });
1051
- return new node_opcua_data_value_1.DataValue({
1052
- statusCode: node_opcua_status_code_1.StatusCodes.Good,
1053
- value: {
1054
- dataType: node_opcua_variant_1.DataType.ExtensionObject,
1055
- arrayType: node_opcua_variant_1.VariantArrayType.Array,
1056
- value: rolePermissions
1057
- }
1058
- });
1059
- }
1060
- _readUserRolePermissions(context) {
1061
- const allUserCanSeeTheirOwnRolePermissions = true;
1062
- if (!allUserCanSeeTheirOwnRolePermissions) {
1063
- // to do check that current user can read permission
1064
- if (context && !context.checkPermission(this, node_opcua_types_1.PermissionType.ReadRolePermissions)) {
1065
- return new node_opcua_data_value_1.DataValue({
1066
- statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient
1067
- });
1068
- }
1069
- }
1070
- if (this.rolePermissions === undefined) {
1071
- // to do : If not specified, the value of DefaultUserRolePermissions Property from
1072
- // the Namespace Metadata Object associated with the Node is used instead.
1073
- return new node_opcua_data_value_1.DataValue({
1074
- statusCode: node_opcua_status_code_1.StatusCodes.BadAttributeIdInvalid
1075
- });
1076
- }
1077
- const context1 = context === null ? session_context_1.SessionContext.defaultContext : context;
1078
- // for the time being get user Permission
1079
- const rolePermissions = this.rolePermissions
1080
- .map(({ roleId, permissions }) => {
1081
- return new node_opcua_types_1.RolePermissionType({
1082
- roleId: toRoleNodeId(roleId),
1083
- permissions
1084
- });
1085
- })
1086
- .filter(({ roleId }) => context1.currentUserHasRole(roleId));
1087
- return new node_opcua_data_value_1.DataValue({
1088
- statusCode: node_opcua_status_code_1.StatusCodes.Good,
1089
- value: {
1090
- dataType: node_opcua_variant_1.DataType.ExtensionObject,
1091
- arrayType: node_opcua_variant_1.VariantArrayType.Array,
1092
- value: rolePermissions
1093
- }
1094
- });
1095
- }
1096
- /**
1097
- *
1098
- * @param rolePermissions
1099
- */
1100
- setRolePermissions(rolePermissions) {
1101
- this._rolePermissions = (0, role_permissions_1.coerceRolePermissions)(rolePermissions);
1102
- }
1103
- getRolePermissions(inherited) {
1104
- if (this.rolePermissions === undefined && inherited) {
1105
- return this.namespace.getDefaultRolePermissions();
1106
- }
1107
- return this._rolePermissions || null;
1108
- }
1109
- get rolePermissions() {
1110
- return this._rolePermissions || undefined;
1111
- }
1112
- setAccessRestrictions(accessRestrictions) {
1113
- this._accessRestrictions = accessRestrictions;
1114
- }
1115
- get accessRestrictions() {
1116
- return this._accessRestrictions;
1117
- }
1118
- getAccessRestrictions(inherited) {
1119
- if (this._accessRestrictions === undefined && inherited) {
1120
- return this.namespace.getDefaultAccessRestrictions();
1121
- }
1122
- return this._accessRestrictions || node_opcua_data_model_1.AccessRestrictionsFlag.None;
1123
- }
1124
- }
1125
- exports.BaseNodeImpl = BaseNodeImpl;
1126
- function toRoleNodeId(s) {
1127
- if (typeof s === "string") {
1128
- return (0, node_opcua_nodeid_1.resolveNodeId)(session_context_1.WellKnownRolesNodeId[s]);
1129
- }
1130
- return (0, node_opcua_nodeid_1.coerceNodeId)(s);
1131
- }
1132
- let displayWarning = true;
1133
- function toString_ReferenceDescription(ref, options) {
1134
- const addressSpace = options.addressSpace;
1135
- // xx assert(ref instanceof ReferenceDescription);
1136
- const refNode = addressSpace.findNode(ref.referenceType);
1137
- if (!refNode) {
1138
- return "Unknown Ref : " + ref;
1139
- }
1140
- const r = new reference_impl_1.ReferenceImpl({
1141
- isForward: ref.isForward,
1142
- nodeId: ref.nodeId,
1143
- referenceType: refNode.browseName.toString()
1144
- });
1145
- const str = r.toString(options);
1146
- r.dispose();
1147
- return str;
1148
- }
1149
- function _setup_parent_item(references) {
1150
- references = Object.values(references);
1151
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(this);
1152
- (0, node_opcua_assert_1.assert)(!_private._parent, "_setup_parent_item has been already called");
1153
- const addressSpace = this.addressSpace;
1154
- if (references.length > 0) {
1155
- references = this.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Inverse);
1156
- if (references.length >= 1) {
1157
- // istanbul ignore next
1158
- if (references.length > 1) {
1159
- if (displayWarning) {
1160
- const options = { addressSpace };
1161
- // tslint:disable-next-line:no-console
1162
- console.warn(" More than one Aggregates reference have been found for parent of object");
1163
- // tslint:disable-next-line:no-console
1164
- console.warn(" object node id:", this.nodeId.toString(), chalk.cyan(this.browseName.toString()));
1165
- // tslint:disable-next-line:no-console
1166
- console.warn(" browseResults:");
1167
- // tslint:disable-next-line:no-console
1168
- console.warn(references.map((f) => toString_ReferenceDescription(f, options)).join("\n"));
1169
- // tslint:disable-next-line:no-console
1170
- console.warn(" first one will be used as parent");
1171
- // xx assert(browseResults.length === 1);
1172
- displayWarning = false;
1173
- }
1174
- }
1175
- return reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, references[0]);
1176
- }
1177
- }
1178
- return null;
1179
- }
1180
- function _asObject(references, addressSpace) {
1181
- function toObject(reference) {
1182
- const obj = resolveReferenceNode(addressSpace, reference);
1183
- // istanbul ignore next
1184
- if (false && !obj) {
1185
- // tslint:disable-next-line:no-console
1186
- console.log(chalk.red(" Warning : object with nodeId ") +
1187
- chalk.cyan(reference.nodeId.toString()) +
1188
- chalk.red(" cannot be found in the address space !"));
1189
- }
1190
- return obj;
1191
- }
1192
- function remove_null(o) {
1193
- return !!o;
1194
- }
1195
- return references.map(toObject).filter(remove_null);
1196
- }
1197
- function _filter_by_browse_name(components, browseName, namespaceIndex) {
1198
- let select = [];
1199
- if ((namespaceIndex === null || namespaceIndex === undefined) && typeof browseName === "string") {
1200
- select = components.filter((c) => c.browseName.name.toString() === browseName);
1201
- if (select && select.length > 1) {
1202
- warningLog("Multiple children exist with name ", browseName, " please specify a namespace index");
1203
- }
1204
- }
1205
- else {
1206
- const _browseName = (0, node_opcua_data_model_1.coerceQualifiedName)(typeof browseName === "string" ? { name: browseName, namespaceIndex } : browseName);
1207
- select = components.filter((c) => c.browseName.name === _browseName.name && c.browseName.namespaceIndex === _browseName.namespaceIndex);
1208
- }
1209
- return select;
1210
- }
1211
- let displayWarningReferencePointingToItSelf = true;
1212
- function _is_massively_used_reference(referenceType) {
1213
- const name = referenceType.browseName.toString();
1214
- return name === "HasTypeDefinition" || name === "HasModellingRule";
1215
- }
1216
- function _propagate_ref(addressSpace, reference) {
1217
- // filter out non Hierarchical References
1218
- const referenceType = reference_impl_1.ReferenceImpl.resolveReferenceType(addressSpace, reference);
1219
- // istanbul ignore next
1220
- if (!referenceType) {
1221
- // tslint:disable-next-line:no-console
1222
- console.error(chalk.red(" ERROR"), " cannot find reference ", reference.referenceType, reference.toString());
1223
- }
1224
- // ------------------------------- Filter out back reference when reference type
1225
- // is HasTypeDefinition, HasModellingRule, etc ...
1226
- //
1227
- // var referenceNode = Reference.resolveReferenceNode(addressSpace,reference);
1228
- // ignore propagation on back reference to UAVariableType or UAObject Type reference
1229
- // because there are too many !
1230
- if (!referenceType || _is_massively_used_reference(referenceType)) {
1231
- return;
1232
- }
1233
- // ------------------------------- EXPERIMENT
1234
- // xx if (!referenceType.isSubtypeOf(hierarchicalReferencesId)) { return; }
1235
- const related_node = resolveReferenceNode(addressSpace, reference);
1236
- if (related_node) {
1237
- // verify that reference doesn't point to object it this (see mantis 3099)
1238
- if ((0, node_opcua_nodeid_1.sameNodeId)(reference.nodeId, this.nodeId)) {
1239
- // istanbul ignore next
1240
- if (displayWarningReferencePointingToItSelf) {
1241
- // this could happen with method
1242
- console.warn(" Warning: a Reference is pointing to this ", this.nodeId.toString(), this.browseName.toString());
1243
- displayWarningReferencePointingToItSelf = false;
1244
- }
1245
- }
1246
- // xx ignore this assert(reference.nodeId.toString() !== this.nodeId.toString());
1247
- // function w(s,l) { return (s+" ").substring(0,l);}
1248
- // if (reference.isForward) {
1249
- // console.log(" CHILD => ",w(related_node.browseName + " " + related_node.nodeId.toString(),30),
1250
- // " PARENT ",w(this.browseName + " " + this.nodeId.toString(),30) , reference.toString());
1251
- // } else {
1252
- // console.log(" CHILD => ",w(this.browseName + " " + this.nodeId.toString(),30),
1253
- // " PARENT ",w(related_node.browseName + " " + related_node.nodeId.toString(),30) , reference.toString());
1254
- //
1255
- // }
1256
- related_node._add_backward_reference(new reference_impl_1.ReferenceImpl({
1257
- _referenceType: getReferenceType(reference),
1258
- isForward: !reference.isForward,
1259
- node: this,
1260
- nodeId: this.nodeId,
1261
- referenceType: reference.referenceType
1262
- }));
1263
- } // else addressSpace may be incomplete and under construction (while loading a nodeset.xml file for instance)
1264
- }
1265
- function nodeid_is_nothing(nodeid) {
1266
- return nodeid.value === 0 && nodeid.namespace === 0;
1267
- }
1268
- /**
1269
- * @method normalize_referenceTypeId
1270
- * @param addressSpace {IAddressSpace}
1271
- * @param referenceTypeId {String|NodeId|null} : the referenceType either as a string or a nodeId
1272
- * @return {NodeId}
1273
- */
1274
- function normalize_referenceTypeId(addressSpace, referenceTypeId) {
1275
- if (!referenceTypeId) {
1276
- return (0, node_opcua_nodeid_1.makeNodeId)(0);
1277
- }
1278
- if (typeof referenceTypeId === "string") {
1279
- const ref = addressSpace.findReferenceType(referenceTypeId);
1280
- if (ref) {
1281
- return ref.nodeId;
1282
- }
1283
- }
1284
- let nodeId;
1285
- try {
1286
- nodeId = addressSpace.resolveNodeId(referenceTypeId);
1287
- }
1288
- catch (err) {
1289
- console.log("cannot normalize_referenceTypeId", referenceTypeId);
1290
- throw err;
1291
- }
1292
- (0, node_opcua_assert_1.assert)(nodeId);
1293
- return nodeId;
1294
- }
1295
- const resolveReferenceNode = reference_impl_1.ReferenceImpl.resolveReferenceNode;
1296
- const resolveReferenceType = reference_impl_1.ReferenceImpl.resolveReferenceType;
1297
- function _filter_by_referenceType(browseDescription, references, referenceTypeId) {
1298
- // make sure we have a valid referenceTypeId if not null
1299
- if (!nodeid_is_nothing(referenceTypeId)) {
1300
- (0, node_opcua_assert_1.assert)(referenceTypeId instanceof node_opcua_nodeid_1.NodeId);
1301
- const referenceType = this.addressSpace.findNode(referenceTypeId);
1302
- (0, node_opcua_debug_1.dumpIf)(!referenceType, referenceTypeId);
1303
- // istanbul ignore next
1304
- if (!referenceType || referenceType.nodeClass !== node_opcua_data_model_1.NodeClass.ReferenceType) {
1305
- throw new Error("Cannot find reference type");
1306
- }
1307
- if (!browseDescription.includeSubtypes && referenceType.isAbstract) {
1308
- warningLog("filter by reference will skip all reference as referenceType is abstract and includeSubtypes is false");
1309
- }
1310
- references = references.filter((reference) => {
1311
- const ref = resolveReferenceType(this.addressSpace, reference);
1312
- // istanbul ignore next
1313
- if (!ref) {
1314
- throw new Error("Cannot find reference type " + reference.toString());
1315
- }
1316
- // unknown type ... this may happen when the address space is not fully build
1317
- (0, node_opcua_assert_1.assert)(ref.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType);
1318
- const isSameType = (0, node_opcua_nodeid_1.sameNodeId)(ref.nodeId, referenceType.nodeId);
1319
- if (isSameType) {
1320
- return true;
1321
- }
1322
- if (browseDescription.includeSubtypes) {
1323
- return ref.isSubtypeOf(referenceType);
1324
- }
1325
- else {
1326
- return false;
1327
- }
1328
- });
1329
- }
1330
- return references;
1331
- }
1332
- function forwardOnly(reference) {
1333
- return reference.isForward;
1334
- }
1335
- function reverseOnly(reference) {
1336
- return !reference.isForward;
1337
- }
1338
- function _filter_by_direction(references, browseDirection) {
1339
- if (browseDirection === node_opcua_data_model_1.BrowseDirection.Both) {
1340
- return references;
1341
- }
1342
- if (browseDirection === node_opcua_data_model_1.BrowseDirection.Forward) {
1343
- return references.filter(forwardOnly);
1344
- }
1345
- else {
1346
- return references.filter(reverseOnly);
1347
- }
1348
- }
1349
- /*
1350
- function _filter_by_context(node: BaseNode, references: Reference[], context: SessionContext): Reference[] {
1351
- if (!context.isBrowseAccessRestricted(node)) {
1352
- return references;
1353
- }
1354
- // browse access is restricted for forward
1355
- return [];
1356
- }
1357
- */
1358
- function _filter_by_context(node, references, context) {
1359
- const addressSpace = node.addressSpace;
1360
- return references.filter((reference) => !context.isBrowseAccessRestricted(resolveReferenceNode(addressSpace, reference)));
1361
- }
1362
- function _filter_by_nodeClass(references, nodeClassMask) {
1363
- (0, node_opcua_assert_1.assert)(isFinite(nodeClassMask));
1364
- if (nodeClassMask === 0) {
1365
- return references;
1366
- }
1367
- const addressSpace = this.addressSpace;
1368
- return references.filter((reference) => {
1369
- const obj = resolveReferenceNode(addressSpace, reference);
1370
- if (!obj) {
1371
- return false;
1372
- }
1373
- const nodeClassName = node_opcua_data_model_1.NodeClass[obj.nodeClass];
1374
- const value = (0, node_opcua_data_model_1.makeNodeClassMask)(nodeClassName);
1375
- return (value & nodeClassMask) === value;
1376
- });
1377
- }
1378
- function _filter_by_userFilter(references, context) {
1379
- const addressSpace = this.addressSpace;
1380
- return references.filter((reference) => {
1381
- const obj = resolveReferenceNode(addressSpace, reference);
1382
- // istanbul ignore next
1383
- if (!obj) {
1384
- return false;
1385
- }
1386
- const _private = (0, base_node_private_1.BaseNode_getPrivate)(obj);
1387
- // istanbul ignore next
1388
- if (!_private._browseFilter) {
1389
- throw Error("Internal error : cannot find browseFilter");
1390
- }
1391
- const filter1 = _private._browseFilter.call(obj, context);
1392
- return filter1;
1393
- });
1394
- }
1395
- const reservedNames = {
1396
- __description: 0,
1397
- __displayName: 0,
1398
- browseName: 0,
1399
- description: 0,
1400
- displayName: 0,
1401
- nodeClass: 0,
1402
- nodeId: 0,
1403
- typeDefinition: 0
1404
- };
1405
- /*
1406
- * install hierarchical references as javascript properties
1407
- * Components/Properties/Organizes
1408
- */
1409
- function install_components_as_object_properties(parentObj) {
1410
- if (!parentObj) {
1411
- return;
1412
- }
1413
- const addressSpace = parentObj.addressSpace;
1414
- const hierarchicalRefs = parentObj.findHierarchicalReferences();
1415
- const children = hierarchicalRefs.map((r) => reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, r));
1416
- for (const child of children) {
1417
- if (!child) {
1418
- continue;
1419
- }
1420
- // assumption: we ignore namespace here .
1421
- const name = (0, node_opcua_utils_1.lowerFirstLetter)(child.browseName.name.toString());
1422
- if (Object.prototype.hasOwnProperty.call(reservedNames, name)) {
1423
- // ignore reserved names
1424
- if (doDebug) {
1425
- console.log(chalk.bgWhite.red("Ignoring reserved keyword " + name));
1426
- }
1427
- continue;
1428
- }
1429
- // ignore reserved names
1430
- if (doDebug) {
1431
- console.log("Installing property " + name, " on ", parentObj.browseName.toString());
1432
- }
1433
- /* istanbul ignore next */
1434
- if (Object.prototype.hasOwnProperty.call(parentObj, name)) {
1435
- continue;
1436
- }
1437
- Object.defineProperty(parentObj, name, {
1438
- configurable: true,
1439
- enumerable: true,
1440
- // xx writable: false,
1441
- get() {
1442
- return child;
1443
- }
1444
- // value: child
1445
- });
1446
- }
1447
- }
1448
- function getReferenceType(reference) {
1449
- return reference._referenceType;
1450
- }
1451
- exports.getReferenceType = getReferenceType;
1452
- //# sourceMappingURL=base_node_impl.js.map