node-opcua-address-space 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.yml +12 -0
- package/LICENSE +20 -0
- package/dist/source/address_space_ts.d.ts +122 -0
- package/dist/source/address_space_ts.js +18 -0
- package/dist/source/address_space_ts.js.map +1 -0
- package/dist/source/continuation_points/continuation_point_manager.d.ts +21 -0
- package/dist/source/continuation_points/continuation_point_manager.js +100 -0
- package/dist/source/continuation_points/continuation_point_manager.js.map +1 -0
- package/dist/source/helpers/adjust_browse_direction.d.ts +5 -0
- package/dist/source/helpers/adjust_browse_direction.js +12 -0
- package/dist/source/helpers/adjust_browse_direction.js.map +1 -0
- package/dist/source/helpers/argument_list.d.ts +30 -0
- package/dist/source/helpers/argument_list.js +237 -0
- package/dist/source/helpers/argument_list.js.map +1 -0
- package/dist/source/helpers/call_helpers.d.ts +6 -0
- package/dist/source/helpers/call_helpers.js +71 -0
- package/dist/source/helpers/call_helpers.js.map +1 -0
- package/dist/source/helpers/check_event_clause.d.ts +17 -0
- package/dist/source/helpers/check_event_clause.js +53 -0
- package/dist/source/helpers/check_event_clause.js.map +1 -0
- package/dist/source/helpers/coerce_enum_value.d.ts +6 -0
- package/dist/source/helpers/coerce_enum_value.js +34 -0
- package/dist/source/helpers/coerce_enum_value.js.map +1 -0
- package/dist/source/helpers/dump_tools.d.ts +14 -0
- package/dist/source/helpers/dump_tools.js +79 -0
- package/dist/source/helpers/dump_tools.js.map +1 -0
- package/dist/source/helpers/ensure_secure_access.d.ts +9 -0
- package/dist/source/helpers/ensure_secure_access.js +90 -0
- package/dist/source/helpers/ensure_secure_access.js.map +1 -0
- package/dist/source/helpers/make_optionals_map.d.ts +21 -0
- package/dist/source/helpers/make_optionals_map.js +30 -0
- package/dist/source/helpers/make_optionals_map.js.map +1 -0
- package/dist/source/helpers/resolve_opaque_on_address_space.d.ts +3 -0
- package/dist/source/helpers/resolve_opaque_on_address_space.js +37 -0
- package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -0
- package/dist/source/index.d.ts +39 -0
- package/dist/source/index.js +62 -0
- package/dist/source/index.js.map +1 -0
- package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +12 -0
- package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js +3 -0
- package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js.map +1 -0
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.d.ts +1 -0
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js +3 -0
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_discrete_item.d.ts +4 -0
- package/dist/source/interfaces/data_access/ua_discrete_item.js +3 -0
- package/dist/source/interfaces/data_access/ua_discrete_item.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete.d.ts +25 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete.js +3 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +21 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js +3 -0
- package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.d.ts +27 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js +3 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +24 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js +3 -0
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete.d.ts +17 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete.js +3 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +12 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js +3 -0
- package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_y_array_item.d.ts +4 -0
- package/dist/source/interfaces/data_access/ua_y_array_item.js +3 -0
- package/dist/source/interfaces/data_access/ua_y_array_item.js.map +1 -0
- package/dist/source/interfaces/data_access/ua_y_array_item_ex.d.ts +8 -0
- package/dist/source/interfaces/data_access/ua_y_array_item_ex.js +3 -0
- package/dist/source/interfaces/data_access/ua_y_array_item_ex.js.map +1 -0
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.d.ts +11 -0
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js +3 -0
- package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js.map +1 -0
- package/dist/source/interfaces/state_machine/finite_state_machine.d.ts +69 -0
- package/dist/source/interfaces/state_machine/finite_state_machine.js +3 -0
- package/dist/source/interfaces/state_machine/finite_state_machine.js.map +1 -0
- package/dist/source/interfaces/state_machine/program_finite_state_machine.d.ts +74 -0
- package/dist/source/interfaces/state_machine/program_finite_state_machine.js +3 -0
- package/dist/source/interfaces/state_machine/program_finite_state_machine.js.map +1 -0
- package/dist/source/interfaces/state_machine/state_machine.d.ts +342 -0
- package/dist/source/interfaces/state_machine/state_machine.js +3 -0
- package/dist/source/interfaces/state_machine/state_machine.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +12 -0
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js +3 -0
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.d.ts +49 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js +3 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.d.ts +18 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.js +3 -0
- package/dist/source/interfaces/state_machine/ua_finite_state_variable.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_program_state_machine_type.d.ts +11 -0
- package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js +3 -0
- package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +222 -0
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js +3 -0
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_state_variable.d.ts +29 -0
- package/dist/source/interfaces/state_machine/ua_state_variable.js +3 -0
- package/dist/source/interfaces/state_machine/ua_state_variable.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_transition_ex.d.ts +6 -0
- package/dist/source/interfaces/state_machine/ua_transition_ex.js +3 -0
- package/dist/source/interfaces/state_machine/ua_transition_ex.js.map +1 -0
- package/dist/source/interfaces/state_machine/ua_two_state_variable.d.ts +26 -0
- package/dist/source/interfaces/state_machine/ua_two_state_variable.js +3 -0
- package/dist/source/interfaces/state_machine/ua_two_state_variable.js.map +1 -0
- package/dist/source/interfaces/subscription_diagnostics_variable.d.ts +41 -0
- package/dist/source/interfaces/subscription_diagnostics_variable.js +3 -0
- package/dist/source/interfaces/subscription_diagnostics_variable.js.map +1 -0
- package/dist/source/interfaces/ua_authorisation_service.d.ts +1 -0
- package/dist/source/interfaces/ua_authorisation_service.js +3 -0
- package/dist/source/interfaces/ua_authorisation_service.js.map +1 -0
- package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.d.ts +8 -0
- package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js +3 -0
- package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js.map +1 -0
- package/dist/source/loader/generateAddressSpaceRaw.d.ts +10 -0
- package/dist/source/loader/generateAddressSpaceRaw.js +59 -0
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -0
- package/dist/source/loader/load_nodeset2.d.ts +13 -0
- package/dist/source/loader/load_nodeset2.js +1392 -0
- package/dist/source/loader/load_nodeset2.js.map +1 -0
- package/dist/source/loader/namespace_post_step.d.ts +6 -0
- package/dist/source/loader/namespace_post_step.js +48 -0
- package/dist/source/loader/namespace_post_step.js.map +1 -0
- package/dist/source/loader/register_node_promoter.d.ts +3 -0
- package/dist/source/loader/register_node_promoter.js +10 -0
- package/dist/source/loader/register_node_promoter.js.map +1 -0
- package/dist/source/namespace.d.ts +6 -0
- package/dist/source/namespace.js +3 -0
- package/dist/source/namespace.js.map +1 -0
- package/dist/source/namespace_alarm_and_condition.d.ts +24 -0
- package/dist/source/namespace_alarm_and_condition.js +3 -0
- package/dist/source/namespace_alarm_and_condition.js.map +1 -0
- package/dist/source/namespace_data_access.d.ts +42 -0
- package/dist/source/namespace_data_access.js +3 -0
- package/dist/source/namespace_data_access.js.map +1 -0
- package/dist/source/namespace_machine_state.d.ts +7 -0
- package/dist/source/namespace_machine_state.js +3 -0
- package/dist/source/namespace_machine_state.js.map +1 -0
- package/dist/source/pseudo_session.d.ts +55 -0
- package/dist/source/pseudo_session.js +205 -0
- package/dist/source/pseudo_session.js.map +1 -0
- package/dist/source/session_context.d.ts +111 -0
- package/dist/source/session_context.js +266 -0
- package/dist/source/session_context.js.map +1 -0
- package/dist/source/set_namespace_meta_data.d.ts +2 -0
- package/dist/source/set_namespace_meta_data.js +60 -0
- package/dist/source/set_namespace_meta_data.js.map +1 -0
- package/dist/source/ua_namespace_meta_data_type.d.ts +71 -0
- package/dist/source/ua_namespace_meta_data_type.js +3 -0
- package/dist/source/ua_namespace_meta_data_type.js.map +1 -0
- package/dist/source/ua_root_folder.d.ts +9 -0
- package/dist/source/ua_root_folder.js +3 -0
- package/dist/source/ua_root_folder.js.map +1 -0
- package/dist/source/ua_two_state_variable_ex.d.ts +23 -0
- package/dist/source/ua_two_state_variable_ex.js +3 -0
- package/dist/source/ua_two_state_variable_ex.js.map +1 -0
- package/dist/source/xml_writer.d.ts +9 -0
- package/dist/source/xml_writer.js +3 -0
- package/dist/source/xml_writer.js.map +1 -0
- package/dist/src/address_space.d.ts +393 -0
- package/dist/src/address_space.js +1375 -0
- package/dist/src/address_space.js.map +1 -0
- package/dist/src/address_space_change_event_tools.d.ts +6 -0
- package/dist/src/address_space_change_event_tools.js +150 -0
- package/dist/src/address_space_change_event_tools.js.map +1 -0
- package/dist/src/address_space_private.d.ts +44 -0
- package/dist/src/address_space_private.js +3 -0
- package/dist/src/address_space_private.js.map +1 -0
- package/dist/src/alarms_and_conditions/base_event_type.d.ts +26 -0
- package/dist/src/alarms_and_conditions/base_event_type.js +41 -0
- package/dist/src/alarms_and_conditions/base_event_type.js.map +1 -0
- package/dist/src/alarms_and_conditions/check_where_clause.d.ts +4 -0
- package/dist/src/alarms_and_conditions/check_where_clause.js +110 -0
- package/dist/src/alarms_and_conditions/check_where_clause.js.map +1 -0
- package/dist/src/alarms_and_conditions/condition.d.ts +5 -0
- package/dist/src/alarms_and_conditions/condition.js +81 -0
- package/dist/src/alarms_and_conditions/condition.js.map +1 -0
- package/dist/src/alarms_and_conditions/condition_info.d.ts +27 -0
- package/dist/src/alarms_and_conditions/condition_info.js +55 -0
- package/dist/src/alarms_and_conditions/condition_info.js.map +1 -0
- package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +232 -0
- package/dist/src/alarms_and_conditions/condition_snapshot.js +667 -0
- package/dist/src/alarms_and_conditions/condition_snapshot.js.map +1 -0
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +21 -0
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +47 -0
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -0
- package/dist/src/alarms_and_conditions/extract_event_fields.d.ts +10 -0
- package/dist/src/alarms_and_conditions/extract_event_fields.js +90 -0
- package/dist/src/alarms_and_conditions/extract_event_fields.js.map +1 -0
- package/dist/src/alarms_and_conditions/index.d.ts +18 -0
- package/dist/src/alarms_and_conditions/index.js +31 -0
- package/dist/src/alarms_and_conditions/index.js.map +1 -0
- package/dist/src/alarms_and_conditions/shelving_state_machine.d.ts +22 -0
- package/dist/src/alarms_and_conditions/shelving_state_machine.js +241 -0
- package/dist/src/alarms_and_conditions/shelving_state_machine.js.map +1 -0
- package/dist/src/alarms_and_conditions/trip_alarm.d.ts +16 -0
- package/dist/src/alarms_and_conditions/trip_alarm.js +21 -0
- package/dist/src/alarms_and_conditions/trip_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.d.ts +54 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js +255 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +62 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +244 -0
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.d.ts +138 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js +460 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +118 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +417 -0
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +29 -0
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js +39 -0
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.d.ts +35 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js +32 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +21 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +26 -0
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_condition_base.d.ts +191 -0
- package/dist/src/alarms_and_conditions/ua_condition_base.js +1029 -0
- package/dist/src/alarms_and_conditions/ua_condition_base.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +182 -0
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +1021 -0
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.d.ts +11 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.js +58 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.d.ts +17 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +58 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.d.ts +24 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js +59 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +27 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +57 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.d.ts +14 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js +17 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.d.ts +9 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js +12 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.d.ts +22 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js +87 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +38 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +87 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.d.ts +6 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js +11 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.d.ts +10 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js +8 -0
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm.d.ts +76 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm.js +237 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +98 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +233 -0
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.d.ts +27 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js +62 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +28 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +51 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.d.ts +49 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js +176 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +25 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +163 -0
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.d.ts +47 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js +151 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +39 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +136 -0
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.d.ts +16 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js +18 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js.map +1 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.d.ts +16 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js +18 -0
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js.map +1 -0
- package/dist/src/apply_condition_refresh.d.ts +6 -0
- package/dist/src/apply_condition_refresh.js +28 -0
- package/dist/src/apply_condition_refresh.js.map +1 -0
- package/dist/src/base_node.d.ts +279 -0
- package/dist/src/base_node.js +1364 -0
- package/dist/src/base_node.js.map +1 -0
- package/dist/src/base_node_impl.d.ts +281 -0
- package/dist/src/base_node_impl.js +1394 -0
- package/dist/src/base_node_impl.js.map +1 -0
- package/dist/src/base_node_private.d.ts +61 -0
- package/dist/src/base_node_private.js +521 -0
- package/dist/src/base_node_private.js.map +1 -0
- package/dist/src/data_access/add_dataItem_stuff.d.ts +11 -0
- package/dist/src/data_access/add_dataItem_stuff.js +62 -0
- package/dist/src/data_access/add_dataItem_stuff.js.map +1 -0
- package/dist/src/data_access/check_variant_compatibility_ua_analog_item.d.ts +1 -0
- package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js +35 -0
- package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js.map +1 -0
- package/dist/src/data_access/ua_analog_item.d.ts +13 -0
- package/dist/src/data_access/ua_analog_item.js +37 -0
- package/dist/src/data_access/ua_analog_item.js.map +1 -0
- package/dist/src/data_access/ua_data_item.d.ts +16 -0
- package/dist/src/data_access/ua_data_item.js +66 -0
- package/dist/src/data_access/ua_data_item.js.map +1 -0
- package/dist/src/data_access/ua_multistate_discrete.d.ts +23 -0
- package/dist/src/data_access/ua_multistate_discrete.js +131 -0
- package/dist/src/data_access/ua_multistate_discrete.js.map +1 -0
- package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +32 -0
- package/dist/src/data_access/ua_multistate_discrete_impl.js +131 -0
- package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -0
- package/dist/src/data_access/ua_multistate_value_discrete.d.ts +51 -0
- package/dist/src/data_access/ua_multistate_value_discrete.js +249 -0
- package/dist/src/data_access/ua_multistate_value_discrete.js.map +1 -0
- package/dist/src/data_access/ua_two_state_discrete.d.ts +25 -0
- package/dist/src/data_access/ua_two_state_discrete.js +154 -0
- package/dist/src/data_access/ua_two_state_discrete.js.map +1 -0
- package/dist/src/event_data.d.ts +29 -0
- package/dist/src/event_data.js +96 -0
- package/dist/src/event_data.js.map +1 -0
- package/dist/src/extension_object_array_node.d.ts +61 -0
- package/dist/src/extension_object_array_node.js +266 -0
- package/dist/src/extension_object_array_node.js.map +1 -0
- package/dist/src/historical_access/address_space_historical_data_node.d.ts +26 -0
- package/dist/src/historical_access/address_space_historical_data_node.js +662 -0
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -0
- package/dist/src/index_current.d.ts +42 -0
- package/dist/src/index_current.js +71 -0
- package/dist/src/index_current.js.map +1 -0
- package/dist/src/namespace.d.ts +475 -0
- package/dist/src/namespace.js +1775 -0
- package/dist/src/namespace.js.map +1 -0
- package/dist/src/namespace_impl.d.ts +463 -0
- package/dist/src/namespace_impl.js +1763 -0
- package/dist/src/namespace_impl.js.map +1 -0
- package/dist/src/namespace_private.d.ts +21 -0
- package/dist/src/namespace_private.js +29 -0
- package/dist/src/namespace_private.js.map +1 -0
- package/dist/src/nodeid_manager.d.ts +36 -0
- package/dist/src/nodeid_manager.js +196 -0
- package/dist/src/nodeid_manager.js.map +1 -0
- package/dist/src/nodeset_tools/adjust_namespace_array.d.ts +2 -0
- package/dist/src/nodeset_tools/adjust_namespace_array.js +14 -0
- package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -0
- package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +2 -0
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +39 -0
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +2 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.js +1155 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -0
- package/dist/src/nodeset_tools/typedictionary_to_xml.d.ts +2 -0
- package/dist/src/nodeset_tools/typedictionary_to_xml.js +147 -0
- package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +1 -0
- package/dist/src/reference.d.ts +43 -0
- package/dist/src/reference.js +138 -0
- package/dist/src/reference.js.map +1 -0
- package/dist/src/reference_impl.d.ts +43 -0
- package/dist/src/reference_impl.js +138 -0
- package/dist/src/reference_impl.js.map +1 -0
- package/dist/src/role_permissions.d.ts +2 -0
- package/dist/src/role_permissions.js +11 -0
- package/dist/src/role_permissions.js.map +1 -0
- package/dist/src/session_context.d.ts +4 -0
- package/dist/src/session_context.js +9 -0
- package/dist/src/session_context.js.map +1 -0
- package/dist/src/state_machine/finite_state_machine.d.ts +67 -0
- package/dist/src/state_machine/finite_state_machine.js +354 -0
- package/dist/src/state_machine/finite_state_machine.js.map +1 -0
- package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +34 -0
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +244 -0
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -0
- package/dist/src/state_machine/ua_two_state_variable.d.ts +61 -0
- package/dist/src/state_machine/ua_two_state_variable.js +332 -0
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -0
- package/dist/src/tool_isSupertypeOf.d.ts +17 -0
- package/dist/src/tool_isSupertypeOf.js +103 -0
- package/dist/src/tool_isSupertypeOf.js.map +1 -0
- package/dist/src/ua_condition_type.d.ts +8 -0
- package/dist/src/ua_condition_type.js +3 -0
- package/dist/src/ua_condition_type.js.map +1 -0
- package/dist/src/ua_data_type.d.ts +83 -0
- package/dist/src/ua_data_type.js +289 -0
- package/dist/src/ua_data_type.js.map +1 -0
- package/dist/src/ua_data_type_impl.d.ts +83 -0
- package/dist/src/ua_data_type_impl.js +291 -0
- package/dist/src/ua_data_type_impl.js.map +1 -0
- package/dist/src/ua_method.d.ts +42 -0
- package/dist/src/ua_method.js +204 -0
- package/dist/src/ua_method.js.map +1 -0
- package/dist/src/ua_method_impl.d.ts +40 -0
- package/dist/src/ua_method_impl.js +203 -0
- package/dist/src/ua_method_impl.js.map +1 -0
- package/dist/src/ua_object.d.ts +29 -0
- package/dist/src/ua_object.js +153 -0
- package/dist/src/ua_object.js.map +1 -0
- package/dist/src/ua_object_impl.d.ts +29 -0
- package/dist/src/ua_object_impl.js +156 -0
- package/dist/src/ua_object_impl.js.map +1 -0
- package/dist/src/ua_object_type.d.ts +49 -0
- package/dist/src/ua_object_type.js +124 -0
- package/dist/src/ua_object_type.js.map +1 -0
- package/dist/src/ua_object_type_impl.d.ts +48 -0
- package/dist/src/ua_object_type_impl.js +124 -0
- package/dist/src/ua_object_type_impl.js.map +1 -0
- package/dist/src/ua_reference_type.d.ts +42 -0
- package/dist/src/ua_reference_type.js +138 -0
- package/dist/src/ua_reference_type.js.map +1 -0
- package/dist/src/ua_reference_type_impl.d.ts +43 -0
- package/dist/src/ua_reference_type_impl.js +138 -0
- package/dist/src/ua_reference_type_impl.js.map +1 -0
- package/dist/src/ua_variable.d.ts +346 -0
- package/dist/src/ua_variable.js +1721 -0
- package/dist/src/ua_variable.js.map +1 -0
- package/dist/src/ua_variable_impl.d.ts +353 -0
- package/dist/src/ua_variable_impl.js +1719 -0
- package/dist/src/ua_variable_impl.js.map +1 -0
- package/dist/src/ua_variable_type.d.ts +54 -0
- package/dist/src/ua_variable_type.js +555 -0
- package/dist/src/ua_variable_type.js.map +1 -0
- package/dist/src/ua_variable_type_impl.d.ts +63 -0
- package/dist/src/ua_variable_type_impl.js +556 -0
- package/dist/src/ua_variable_type_impl.js.map +1 -0
- package/dist/src/ua_view.d.ts +16 -0
- package/dist/src/ua_view.js +42 -0
- package/dist/src/ua_view.js.map +1 -0
- package/dist/src/ua_view_impl.d.ts +15 -0
- package/dist/src/ua_view_impl.js +37 -0
- package/dist/src/ua_view_impl.js.map +1 -0
- package/distHelpers/add_event_generator_object.d.ts +3 -0
- package/distHelpers/add_event_generator_object.js +66 -0
- package/distHelpers/add_event_generator_object.js.map +1 -0
- package/distHelpers/alarms_and_conditions_demo.d.ts +10 -0
- package/distHelpers/alarms_and_conditions_demo.js +115 -0
- package/distHelpers/alarms_and_conditions_demo.js.map +1 -0
- package/distHelpers/assertHasMatchingReference.d.ts +19 -0
- package/distHelpers/assertHasMatchingReference.js +41 -0
- package/distHelpers/assertHasMatchingReference.js.map +1 -0
- package/distHelpers/boiler_system.d.ts +113 -0
- package/distHelpers/boiler_system.js +397 -0
- package/distHelpers/boiler_system.js.map +1 -0
- package/distHelpers/create_minimalist_address_space_nodeset.d.ts +5 -0
- package/distHelpers/create_minimalist_address_space_nodeset.js +171 -0
- package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -0
- package/distHelpers/dump_statemachine.d.ts +6 -0
- package/distHelpers/dump_statemachine.js +116 -0
- package/distHelpers/dump_statemachine.js.map +1 -0
- package/distHelpers/get_address_space_fixture.d.ts +1 -0
- package/distHelpers/get_address_space_fixture.js +31 -0
- package/distHelpers/get_address_space_fixture.js.map +1 -0
- package/distHelpers/get_mini_address_space.d.ts +7 -0
- package/distHelpers/get_mini_address_space.js +37 -0
- package/distHelpers/get_mini_address_space.js.map +1 -0
- package/distHelpers/index.d.ts +11 -0
- package/distHelpers/index.js +24 -0
- package/distHelpers/index.js.map +1 -0
- package/distNodeJS/generate_address_space.d.ts +4 -0
- package/distNodeJS/generate_address_space.js +31 -0
- package/distNodeJS/generate_address_space.js.map +1 -0
- package/distNodeJS/index.d.ts +1 -0
- package/distNodeJS/index.js +14 -0
- package/distNodeJS/index.js.map +1 -0
- package/generate.js +1 -0
- package/nodeJS.d.ts +1 -0
- package/nodeJS.js +1 -0
- package/package.json +87 -0
- package/source/address_space_ts.ts +217 -0
- package/source/continuation_points/continuation_point_manager.ts +121 -0
- package/source/helpers/adjust_browse_direction.ts +15 -0
- package/source/helpers/argument_list.ts +286 -0
- package/source/helpers/call_helpers.ts +112 -0
- package/source/helpers/check_event_clause.ts +62 -0
- package/source/helpers/coerce_enum_value.ts +33 -0
- package/source/helpers/dump_tools.ts +92 -0
- package/source/helpers/ensure_secure_access.ts +88 -0
- package/source/helpers/make_optionals_map.ts +49 -0
- package/source/helpers/resolve_opaque_on_address_space.ts +23 -0
- package/source/index.ts +49 -0
- package/source/interfaces/alarms_and_conditions/condition_info_i.ts +13 -0
- package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +26 -0
- package/source/interfaces/data_access/ua_multistate_value_discrete_ex.ts +34 -0
- package/source/interfaces/data_access/ua_two_state_discrete_ex.ts +14 -0
- package/source/interfaces/data_access/ua_y_array_item_ex.ts +10 -0
- package/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.ts +14 -0
- package/source/interfaces/state_machine/ua_finite_state_machine_type.ts +50 -0
- package/source/interfaces/state_machine/ua_program_state_machine_type.ts +13 -0
- package/source/interfaces/state_machine/ua_state_machine_type.ts +261 -0
- package/source/interfaces/state_machine/ua_transition_ex.ts +7 -0
- package/source/interfaces/ua_subscription_diagnostics_variable_ex.ts +8 -0
- package/source/loader/generateAddressSpaceRaw.ts +79 -0
- package/source/loader/load_nodeset2.ts +1600 -0
- package/source/loader/namespace_post_step.ts +36 -0
- package/source/loader/register_node_promoter.ts +8 -0
- package/source/namespace.ts +9 -0
- package/source/namespace_alarm_and_condition.ts +47 -0
- package/source/namespace_data_access.ts +60 -0
- package/source/namespace_machine_state.ts +13 -0
- package/source/pseudo_session.ts +288 -0
- package/source/session_context.ts +345 -0
- package/source/set_namespace_meta_data.ts +68 -0
- package/source/ua_root_folder.ts +10 -0
- package/source/ua_two_state_variable_ex.ts +35 -0
- package/source/xml_writer.ts +15 -0
- package/source_nodejs/generate_address_space.ts +36 -0
- package/source_nodejs/index.ts +1 -0
- package/src/address_space.ts +1575 -0
- package/src/address_space_change_event_tools.ts +177 -0
- package/src/address_space_private.ts +98 -0
- package/src/alarms_and_conditions/check_where_clause.ts +148 -0
- package/src/alarms_and_conditions/condition.ts +89 -0
- package/src/alarms_and_conditions/condition_info.ts +66 -0
- package/src/alarms_and_conditions/condition_snapshot.ts +766 -0
- package/src/alarms_and_conditions/deviation_alarm_helper.ts +66 -0
- package/src/alarms_and_conditions/extract_event_fields.ts +104 -0
- package/src/alarms_and_conditions/index.ts +18 -0
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +339 -0
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +513 -0
- package/src/alarms_and_conditions/ua_base_event_impl.ts +55 -0
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +50 -0
- package/src/alarms_and_conditions/ua_condition_impl.ts +1298 -0
- package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +81 -0
- package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +110 -0
- package/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.ts +19 -0
- package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +130 -0
- package/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.ts +24 -0
- package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +305 -0
- package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +108 -0
- package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +224 -0
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +186 -0
- package/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.ts +27 -0
- package/src/apply_condition_refresh.ts +30 -0
- package/src/base_node_impl.ts +1749 -0
- package/src/base_node_private.ts +690 -0
- package/src/data_access/add_dataItem_stuff.ts +75 -0
- package/src/data_access/check_variant_compatibility_ua_analog_item.ts +41 -0
- package/src/data_access/ua_multistate_discrete_impl.ts +168 -0
- package/src/data_access/ua_multistate_value_discrete.ts +299 -0
- package/src/data_access/ua_two_state_discrete.ts +185 -0
- package/src/event_data.ts +117 -0
- package/src/extension_object_array_node.ts +325 -0
- package/src/historical_access/address_space_historical_data_node.ts +828 -0
- package/src/index_current.ts +52 -0
- package/src/namespace_impl.ts +2181 -0
- package/src/namespace_private.ts +60 -0
- package/src/nodeid_manager.ts +228 -0
- package/src/nodeset_tools/adjust_namespace_array.ts +11 -0
- package/src/nodeset_tools/construct_namespace_dependency.ts +40 -0
- package/src/nodeset_tools/nodeset_to_xml.ts +1317 -0
- package/src/nodeset_tools/typedictionary_to_xml.ts +175 -0
- package/src/reference_impl.ts +169 -0
- package/src/role_permissions.ts +6 -0
- package/src/state_machine/finite_state_machine.ts +428 -0
- package/src/state_machine/ua_shelving_state_machine_ex.ts +314 -0
- package/src/state_machine/ua_two_state_variable.ts +421 -0
- package/src/tool_isSupertypeOf.ts +129 -0
- package/src/ua_condition_type.ts +10 -0
- package/src/ua_data_type_impl.ts +356 -0
- package/src/ua_method_impl.ts +278 -0
- package/src/ua_object_impl.ts +203 -0
- package/src/ua_object_type_impl.ts +158 -0
- package/src/ua_reference_type_impl.ts +174 -0
- package/src/ua_variable_impl.ts +2277 -0
- package/src/ua_variable_type_impl.ts +741 -0
- package/src/ua_view_impl.ts +54 -0
- package/testHelpers.d.ts +1 -0
- package/testHelpers.js +1 -0
- package/test_helpers/add_event_generator_object.ts +71 -0
- package/test_helpers/alarms_and_conditions_demo.ts +147 -0
- package/test_helpers/assertHasMatchingReference.ts +43 -0
- package/test_helpers/boiler_system.ts +618 -0
- package/test_helpers/create_minimalist_address_space_nodeset.ts +208 -0
- package/test_helpers/dump_statemachine.ts +155 -0
- package/test_helpers/get_address_space_fixture.ts +30 -0
- package/test_helpers/get_mini_address_space.ts +42 -0
- package/test_helpers/index.ts +11 -0
- package/test_helpers/test_fixtures/dataType_in_separateNamespace.xml +150 -0
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_basic.xml +57 -0
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_mix.xml +136 -0
- package/test_helpers/test_fixtures/dataType_withEnumeration.xml +82 -0
- package/test_helpers/test_fixtures/dataType_with_isOptionSet.xml +194 -0
- package/test_helpers/test_fixtures/dataType_with_structures.xml +605 -0
- package/test_helpers/test_fixtures/dataType_with_union.xml +1 -0
- package/test_helpers/test_fixtures/datatype_as_per_1.04.xml +91 -0
- package/test_helpers/test_fixtures/fixture_empty_nodeset2.xml +106 -0
- package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +1303 -0
- package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +362 -0
- package/test_helpers/test_fixtures/issue_846.xml +3172 -0
- package/test_helpers/test_fixtures/issue_899_variable_with_nodeid_value.xml +33 -0
- package/test_helpers/test_fixtures/mini.Node.Set2.xml +4508 -0
- package/test_helpers/test_fixtures/mini.nodeset.withVariousVariables.xml +194 -0
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models.xml +8 -0
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models_more_complex.xml +16 -0
- package/test_helpers/test_fixtures/nodeset_with_analog_items.xml +45 -0
|
@@ -0,0 +1,1155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dumpXml = void 0;
|
|
4
|
+
/* eslint-disable max-statements */
|
|
5
|
+
/* eslint-disable complexity */
|
|
6
|
+
/**
|
|
7
|
+
* @module node-opcua-address-space
|
|
8
|
+
*/
|
|
9
|
+
// produce nodeset xml files
|
|
10
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
11
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
12
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
13
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
14
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
15
|
+
const utils = require("node-opcua-utils");
|
|
16
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
17
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
18
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
19
|
+
const reference_impl_1 = require("../reference_impl");
|
|
20
|
+
const base_node_impl_1 = require("../base_node_impl");
|
|
21
|
+
const ua_reference_type_impl_1 = require("../ua_reference_type_impl");
|
|
22
|
+
const ua_object_type_impl_1 = require("../ua_object_type_impl");
|
|
23
|
+
const ua_variable_impl_1 = require("../ua_variable_impl");
|
|
24
|
+
const ua_object_impl_1 = require("../ua_object_impl");
|
|
25
|
+
const namespace_impl_1 = require("../namespace_impl");
|
|
26
|
+
const ua_method_impl_1 = require("../ua_method_impl");
|
|
27
|
+
const ua_data_type_impl_1 = require("../ua_data_type_impl");
|
|
28
|
+
const ua_variable_type_impl_1 = require("../ua_variable_type_impl");
|
|
29
|
+
const construct_namespace_dependency_1 = require("./construct_namespace_dependency");
|
|
30
|
+
// tslint:disable:no-var-requires
|
|
31
|
+
const XMLWriter = require("xml-writer");
|
|
32
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
33
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
34
|
+
function _hash(node) {
|
|
35
|
+
return node.nodeId.toString();
|
|
36
|
+
}
|
|
37
|
+
function _dumpDisplayName(xw, node) {
|
|
38
|
+
if (node.displayName && node.displayName[0]) {
|
|
39
|
+
xw.startElement("DisplayName").text(node.displayName[0].text).endElement();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function _dumpDescription(xw, node) {
|
|
43
|
+
if (node.description) {
|
|
44
|
+
let desc = node.description.text;
|
|
45
|
+
desc = desc || "";
|
|
46
|
+
xw.startElement("Description").text(desc).endElement();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function translateNodeId(xw, nodeId) {
|
|
50
|
+
(0, node_opcua_assert_1.assert)(nodeId instanceof node_opcua_nodeid_1.NodeId);
|
|
51
|
+
const nn = xw.translationTable[nodeId.namespace];
|
|
52
|
+
const translatedNode = new node_opcua_nodeid_1.NodeId(nodeId.identifierType, nodeId.value, nn);
|
|
53
|
+
return translatedNode;
|
|
54
|
+
}
|
|
55
|
+
function n(xw, nodeId) {
|
|
56
|
+
return translateNodeId(xw, nodeId).toString().replace("ns=0;", "");
|
|
57
|
+
}
|
|
58
|
+
function translateBrowseName(xw, browseName) {
|
|
59
|
+
(0, node_opcua_assert_1.assert)(browseName instanceof node_opcua_data_model_1.QualifiedName);
|
|
60
|
+
const nn = xw.translationTable[browseName.namespaceIndex];
|
|
61
|
+
const translatedBrowseName = new node_opcua_data_model_1.QualifiedName({ namespaceIndex: nn, name: browseName.name });
|
|
62
|
+
return translatedBrowseName;
|
|
63
|
+
}
|
|
64
|
+
function b(xw, browseName) {
|
|
65
|
+
return translateBrowseName(xw, browseName).toString().replace("ns=0;", "");
|
|
66
|
+
}
|
|
67
|
+
function _dumpReferences(xw, node) {
|
|
68
|
+
xw.startElement("References");
|
|
69
|
+
const addressSpace = node.addressSpace;
|
|
70
|
+
const aggregateReferenceType = addressSpace.findReferenceType("Aggregates");
|
|
71
|
+
const hasChildReferenceType = addressSpace.findReferenceType("HasChild");
|
|
72
|
+
const hasSubtypeReferenceType = addressSpace.findReferenceType("HasSubtype");
|
|
73
|
+
const hasTypeDefinitionReferenceType = addressSpace.findReferenceType("HasTypeDefinition");
|
|
74
|
+
const nonHierarchicalReferencesType = addressSpace.findReferenceType("NonHierarchicalReferences");
|
|
75
|
+
const organizesReferencesType = addressSpace.findReferenceType("Organizes");
|
|
76
|
+
const connectsToReferenceType = addressSpace.findReferenceType("ConnectsTo");
|
|
77
|
+
const hasEventSourceReferenceType = addressSpace.findReferenceType("HasEventSource");
|
|
78
|
+
function referenceToKeep(reference) {
|
|
79
|
+
const referenceType = reference._referenceType;
|
|
80
|
+
// get the direct backward reference to a external namespace
|
|
81
|
+
if (referenceType.isSupertypeOf(aggregateReferenceType) && !reference.isForward) {
|
|
82
|
+
if (reference.nodeId.namespace !== node.nodeId.namespace) {
|
|
83
|
+
// todo: may be check that reference.nodeId.namespace is one of the namespace
|
|
84
|
+
// on which our namespace is build and not a derived one !
|
|
85
|
+
// xx console.log("xxxxxxxxxxxxxx Keeping => ", referenceType.toString(), reference.node?.nodeId.toString());
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// only keep
|
|
90
|
+
if (referenceType.isSupertypeOf(aggregateReferenceType) && reference.isForward) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
else if (referenceType.isSupertypeOf(hasSubtypeReferenceType) && !reference.isForward) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
else if (referenceType.isSupertypeOf(hasTypeDefinitionReferenceType) && reference.isForward) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
else if (referenceType.isSupertypeOf(nonHierarchicalReferencesType) && reference.isForward) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
else if (referenceType.isSupertypeOf(organizesReferencesType) && !reference.isForward) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
else if (connectsToReferenceType && referenceType.isSupertypeOf(connectsToReferenceType) && reference.isForward) {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
else if (referenceType.isSupertypeOf(hasEventSourceReferenceType) && reference.isForward) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const references = node.allReferences().filter(referenceToKeep);
|
|
114
|
+
for (const reference of references) {
|
|
115
|
+
if ((0, base_node_impl_1.getReferenceType)(reference).browseName.toString() === "HasSubtype" && reference.isForward) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// only output inverse Reference
|
|
119
|
+
xw.startElement("Reference");
|
|
120
|
+
xw.writeAttribute("ReferenceType", b(xw, (0, base_node_impl_1.getReferenceType)(reference).browseName));
|
|
121
|
+
if (!reference.isForward) {
|
|
122
|
+
xw.writeAttribute("IsForward", reference.isForward ? "true" : "false");
|
|
123
|
+
}
|
|
124
|
+
xw.text(n(xw, reference.nodeId));
|
|
125
|
+
xw.endElement();
|
|
126
|
+
}
|
|
127
|
+
xw.endElement();
|
|
128
|
+
}
|
|
129
|
+
function _dumpLocalizedText(xw, v) {
|
|
130
|
+
xw.startElement("Locale");
|
|
131
|
+
if (v.locale) {
|
|
132
|
+
xw.text(v.locale);
|
|
133
|
+
}
|
|
134
|
+
xw.endElement();
|
|
135
|
+
xw.startElement("Text");
|
|
136
|
+
if (v.text) {
|
|
137
|
+
xw.text(v.text);
|
|
138
|
+
}
|
|
139
|
+
xw.endElement();
|
|
140
|
+
}
|
|
141
|
+
function _dumpQualifiedName(xw, v) {
|
|
142
|
+
const t = translateBrowseName(xw, v);
|
|
143
|
+
if (t.name) {
|
|
144
|
+
xw.startElement("Name");
|
|
145
|
+
xw.text(t.name);
|
|
146
|
+
xw.endElement();
|
|
147
|
+
}
|
|
148
|
+
if (t.namespaceIndex) {
|
|
149
|
+
xw.startElement("NamespaceIndex");
|
|
150
|
+
xw.text(t.namespaceIndex.toString());
|
|
151
|
+
xw.endElement();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function _dumpXmlElement(xw, v) {
|
|
155
|
+
xw.text(v);
|
|
156
|
+
}
|
|
157
|
+
/*
|
|
158
|
+
<uax:ExtensionObject>
|
|
159
|
+
<uax:TypeId>
|
|
160
|
+
<uax:Identifier>i=339</uax:Identifier>
|
|
161
|
+
</uax:TypeId>
|
|
162
|
+
<uax:Body>
|
|
163
|
+
<BuildInfo xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd">
|
|
164
|
+
<ProductUri></ProductUri>
|
|
165
|
+
<ManufacturerName></ManufacturerName>
|
|
166
|
+
<ProductName></ProductName>
|
|
167
|
+
<SoftwareVersion></SoftwareVersion>
|
|
168
|
+
<BuildNumber></BuildNumber>
|
|
169
|
+
<BuildDate>1900-01-01T00:00:00Z</BuildDate>
|
|
170
|
+
</BuildInfo>
|
|
171
|
+
</uax:Body>
|
|
172
|
+
</uax:ExtensionObject>
|
|
173
|
+
*/
|
|
174
|
+
function _dumpExtensionObject(xw, v) {
|
|
175
|
+
if (!v) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
xw.startElement("TypeId");
|
|
179
|
+
_dumpNodeId(xw, v.schema.encodingDefaultXml);
|
|
180
|
+
xw.endElement();
|
|
181
|
+
xw.startElement("Body");
|
|
182
|
+
xw.endElement();
|
|
183
|
+
}
|
|
184
|
+
function _dumpNodeId(xw, v) {
|
|
185
|
+
xw.startElement("Identifier");
|
|
186
|
+
xw.text(v.toString());
|
|
187
|
+
xw.endElement();
|
|
188
|
+
}
|
|
189
|
+
// tslint:disable:no-console
|
|
190
|
+
function _dumpVariantValue(xw, dataType, value) {
|
|
191
|
+
if (value === undefined || value === null) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
switch (dataType) {
|
|
195
|
+
case node_opcua_variant_1.DataType.Null:
|
|
196
|
+
break;
|
|
197
|
+
case node_opcua_variant_1.DataType.LocalizedText:
|
|
198
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
199
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
200
|
+
_dumpLocalizedText(xw, value);
|
|
201
|
+
xw.endElement();
|
|
202
|
+
break;
|
|
203
|
+
case node_opcua_variant_1.DataType.NodeId:
|
|
204
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
205
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
206
|
+
_dumpNodeId(xw, value);
|
|
207
|
+
xw.endElement();
|
|
208
|
+
break;
|
|
209
|
+
case node_opcua_variant_1.DataType.DateTime:
|
|
210
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
211
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
212
|
+
xw.text(value.toISOString());
|
|
213
|
+
xw.endElement();
|
|
214
|
+
break;
|
|
215
|
+
case node_opcua_variant_1.DataType.Int64:
|
|
216
|
+
case node_opcua_variant_1.DataType.UInt64:
|
|
217
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
218
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
219
|
+
xw.text(value[1].toString());
|
|
220
|
+
xw.endElement();
|
|
221
|
+
break;
|
|
222
|
+
case node_opcua_variant_1.DataType.Boolean:
|
|
223
|
+
case node_opcua_variant_1.DataType.SByte:
|
|
224
|
+
case node_opcua_variant_1.DataType.Byte:
|
|
225
|
+
case node_opcua_variant_1.DataType.Float:
|
|
226
|
+
case node_opcua_variant_1.DataType.Double:
|
|
227
|
+
case node_opcua_variant_1.DataType.Int16:
|
|
228
|
+
case node_opcua_variant_1.DataType.Int32:
|
|
229
|
+
case node_opcua_variant_1.DataType.UInt16:
|
|
230
|
+
case node_opcua_variant_1.DataType.UInt32:
|
|
231
|
+
case node_opcua_variant_1.DataType.String:
|
|
232
|
+
if (value !== undefined && value !== null) {
|
|
233
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
234
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
235
|
+
xw.text(value.toString());
|
|
236
|
+
xw.endElement();
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case node_opcua_variant_1.DataType.ByteString:
|
|
240
|
+
if (value !== undefined && value !== null) {
|
|
241
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
242
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
243
|
+
const base64 = value.toString("base64");
|
|
244
|
+
xw.text(base64.match(/.{0,80}/g).join("\n"));
|
|
245
|
+
xw.endElement();
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case node_opcua_variant_1.DataType.Guid:
|
|
249
|
+
/*
|
|
250
|
+
<uax:Guid>
|
|
251
|
+
<uax:String>947c29a7-490d-4dc9-adda-1109e3e8fcb7</uax:String>
|
|
252
|
+
</uax:Guid>
|
|
253
|
+
*/
|
|
254
|
+
if (value !== undefined && value !== null) {
|
|
255
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
256
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
257
|
+
xw.startElement("String");
|
|
258
|
+
xw.text(value.toString());
|
|
259
|
+
xw.endElement();
|
|
260
|
+
xw.endElement();
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
case node_opcua_variant_1.DataType.ExtensionObject:
|
|
264
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
265
|
+
_dumpExtensionObject(xw, value);
|
|
266
|
+
xw.endElement();
|
|
267
|
+
break;
|
|
268
|
+
case node_opcua_variant_1.DataType.QualifiedName:
|
|
269
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
270
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
271
|
+
_dumpQualifiedName(xw, value);
|
|
272
|
+
xw.endElement();
|
|
273
|
+
break;
|
|
274
|
+
case node_opcua_variant_1.DataType.XmlElement:
|
|
275
|
+
xw.startElement(node_opcua_variant_1.DataType[dataType]);
|
|
276
|
+
// xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
277
|
+
_dumpXmlElement(xw, value);
|
|
278
|
+
xw.endElement();
|
|
279
|
+
break;
|
|
280
|
+
case node_opcua_variant_1.DataType.StatusCode:
|
|
281
|
+
default:
|
|
282
|
+
errorLog("_dumpVariantValue!! incomplete dataType=" + dataType + " - v=" + node_opcua_variant_1.DataType[dataType] + " value = " + value);
|
|
283
|
+
/*
|
|
284
|
+
throw new Error(
|
|
285
|
+
"_dumpVariantValue!! incomplete dataType=" + dataType + " - v=" + DataType[dataType] + " value = " + value
|
|
286
|
+
);
|
|
287
|
+
*/
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// tslint:disable:no-console
|
|
291
|
+
function _dumpVariantInnerValue(xw, dataType, value) {
|
|
292
|
+
switch (dataType) {
|
|
293
|
+
case null:
|
|
294
|
+
case node_opcua_variant_1.DataType.Null:
|
|
295
|
+
break;
|
|
296
|
+
case node_opcua_variant_1.DataType.LocalizedText:
|
|
297
|
+
_dumpLocalizedText(xw, value);
|
|
298
|
+
break;
|
|
299
|
+
case node_opcua_variant_1.DataType.QualifiedName:
|
|
300
|
+
_dumpQualifiedName(xw, value);
|
|
301
|
+
break;
|
|
302
|
+
case node_opcua_variant_1.DataType.NodeId:
|
|
303
|
+
_dumpNodeId(xw, value);
|
|
304
|
+
break;
|
|
305
|
+
case node_opcua_variant_1.DataType.DateTime:
|
|
306
|
+
xw.text(value.toISOString());
|
|
307
|
+
break;
|
|
308
|
+
case node_opcua_variant_1.DataType.Int64:
|
|
309
|
+
case node_opcua_variant_1.DataType.UInt64:
|
|
310
|
+
xw.text(value[1].toString());
|
|
311
|
+
break;
|
|
312
|
+
case node_opcua_variant_1.DataType.Boolean:
|
|
313
|
+
case node_opcua_variant_1.DataType.Byte:
|
|
314
|
+
case node_opcua_variant_1.DataType.Float:
|
|
315
|
+
case node_opcua_variant_1.DataType.Double:
|
|
316
|
+
case node_opcua_variant_1.DataType.Int16:
|
|
317
|
+
case node_opcua_variant_1.DataType.Int32:
|
|
318
|
+
case node_opcua_variant_1.DataType.UInt16:
|
|
319
|
+
case node_opcua_variant_1.DataType.UInt32:
|
|
320
|
+
case node_opcua_variant_1.DataType.String:
|
|
321
|
+
xw.text(value.toString());
|
|
322
|
+
break;
|
|
323
|
+
case node_opcua_variant_1.DataType.ByteString:
|
|
324
|
+
case node_opcua_variant_1.DataType.StatusCode:
|
|
325
|
+
default:
|
|
326
|
+
errorLog("_dumpVariantInnerValue incomplete " + value + " " + "DataType=" + dataType + "=" + node_opcua_variant_1.DataType[dataType]);
|
|
327
|
+
// throw new Error("_dumpVariantInnerValue incomplete " + value + " " + "DataType=" + dataType + "=" + DataType[dataType]);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
*
|
|
332
|
+
* @param field
|
|
333
|
+
*/
|
|
334
|
+
function findBaseDataType(field) {
|
|
335
|
+
if (field.fieldType === "UAString") {
|
|
336
|
+
return node_opcua_variant_1.DataType.String;
|
|
337
|
+
}
|
|
338
|
+
const result = node_opcua_variant_1.DataType[field.fieldType];
|
|
339
|
+
if (!result) {
|
|
340
|
+
throw new Error("cannot find baseDataType of " + field.name + "= " + field.fieldType);
|
|
341
|
+
}
|
|
342
|
+
return result;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
*
|
|
346
|
+
* @param xw
|
|
347
|
+
* @param schema
|
|
348
|
+
* @param value
|
|
349
|
+
* @private
|
|
350
|
+
*/
|
|
351
|
+
function _dumpVariantExtensionObjectValue_Body(xw, schema, value) {
|
|
352
|
+
if (value) {
|
|
353
|
+
xw.startElement(schema.name);
|
|
354
|
+
if (value) {
|
|
355
|
+
for (const field of schema.fields) {
|
|
356
|
+
const v = value[field.name];
|
|
357
|
+
if (v !== null && v !== undefined) {
|
|
358
|
+
xw.startElement(utils.capitalizeFirstLetter(field.name));
|
|
359
|
+
try {
|
|
360
|
+
const baseType = findBaseDataType(field);
|
|
361
|
+
_dumpVariantInnerValue(xw, baseType, v);
|
|
362
|
+
}
|
|
363
|
+
catch (err) {
|
|
364
|
+
// eslint-disable-next-line max-depth
|
|
365
|
+
if (err instanceof Error) {
|
|
366
|
+
console.log("Error in _dumpVariantExtensionObjectValue_Body !!!", err.message);
|
|
367
|
+
}
|
|
368
|
+
console.log(schema.name);
|
|
369
|
+
console.log(field);
|
|
370
|
+
// throw err;
|
|
371
|
+
}
|
|
372
|
+
xw.endElement();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
xw.endElement();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/* encode object as XML */
|
|
380
|
+
function _dumpVariantExtensionObjectValue(xw, schema, value) {
|
|
381
|
+
xw.startElement("ExtensionObject");
|
|
382
|
+
{
|
|
383
|
+
xw.startElement("TypeId");
|
|
384
|
+
{
|
|
385
|
+
// find HasEncoding node
|
|
386
|
+
const encodingDefaultXml = (0, node_opcua_factory_1.getStructureTypeConstructor)(schema.name).encodingDefaultXml;
|
|
387
|
+
if (!encodingDefaultXml) {
|
|
388
|
+
console.log("?????");
|
|
389
|
+
}
|
|
390
|
+
// xx var encodingDefaultXml = schema.encodingDefaultXml;
|
|
391
|
+
xw.startElement("Identifier");
|
|
392
|
+
xw.text(encodingDefaultXml.toString());
|
|
393
|
+
xw.endElement();
|
|
394
|
+
}
|
|
395
|
+
xw.endElement();
|
|
396
|
+
xw.startElement("Body");
|
|
397
|
+
_dumpVariantExtensionObjectValue_Body(xw, schema, value);
|
|
398
|
+
xw.endElement();
|
|
399
|
+
}
|
|
400
|
+
xw.endElement();
|
|
401
|
+
}
|
|
402
|
+
function _isDefaultValue(value) {
|
|
403
|
+
// detect default value
|
|
404
|
+
if (value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar) {
|
|
405
|
+
switch (value.dataType) {
|
|
406
|
+
case node_opcua_variant_1.DataType.ExtensionObject:
|
|
407
|
+
if (!value.value) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
case node_opcua_variant_1.DataType.DateTime:
|
|
412
|
+
if (!value.value || value.value.getTime() === node_opcua_basic_types_1.minOPCUADate) {
|
|
413
|
+
return true;
|
|
414
|
+
}
|
|
415
|
+
break;
|
|
416
|
+
case node_opcua_variant_1.DataType.ByteString:
|
|
417
|
+
if (!value.value || value.value.length === 0) {
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
break;
|
|
421
|
+
case node_opcua_variant_1.DataType.Boolean:
|
|
422
|
+
if (!value.value) {
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
break;
|
|
426
|
+
case node_opcua_variant_1.DataType.SByte:
|
|
427
|
+
case node_opcua_variant_1.DataType.Byte:
|
|
428
|
+
case node_opcua_variant_1.DataType.UInt16:
|
|
429
|
+
case node_opcua_variant_1.DataType.UInt32:
|
|
430
|
+
case node_opcua_variant_1.DataType.Int16:
|
|
431
|
+
case node_opcua_variant_1.DataType.Int32:
|
|
432
|
+
case node_opcua_variant_1.DataType.Double:
|
|
433
|
+
case node_opcua_variant_1.DataType.Float:
|
|
434
|
+
if (value.value === 0 || value.value === null) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
case node_opcua_variant_1.DataType.String:
|
|
439
|
+
if (value.value === null || value.value === "") {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
break;
|
|
443
|
+
case node_opcua_variant_1.DataType.Int64:
|
|
444
|
+
case node_opcua_variant_1.DataType.UInt64:
|
|
445
|
+
if (0 === coerceInt64ToInt32(value.value)) {
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
break;
|
|
449
|
+
case node_opcua_variant_1.DataType.LocalizedText:
|
|
450
|
+
if (!value.value) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
{
|
|
454
|
+
const l = value.value;
|
|
455
|
+
if (!l.locale && !l.text) {
|
|
456
|
+
return true;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
if (!value.value || value.value.length === 0) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function _dumpValue(xw, node, value) {
|
|
471
|
+
const addressSpace = node.addressSpace;
|
|
472
|
+
// istanbul ignore next
|
|
473
|
+
if (value === null || value === undefined) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
(0, node_opcua_assert_1.assert)(value instanceof node_opcua_variant_1.Variant);
|
|
477
|
+
const dataTypeNode = addressSpace.findNode(node.dataType);
|
|
478
|
+
if (!dataTypeNode) {
|
|
479
|
+
console.log("Cannot find dataType:", node.dataType);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const dataTypeName = dataTypeNode.browseName.name.toString();
|
|
483
|
+
const baseDataTypeName = node_opcua_variant_1.DataType[value.dataType];
|
|
484
|
+
if (baseDataTypeName === "Null") {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
(0, node_opcua_assert_1.assert)(typeof baseDataTypeName === "string");
|
|
488
|
+
// determine if dataTypeName is a ExtensionObject
|
|
489
|
+
const isExtensionObject = value.dataType === node_opcua_variant_1.DataType.ExtensionObject;
|
|
490
|
+
if (_isDefaultValue(value)) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
xw.startElement("Value");
|
|
494
|
+
if (isExtensionObject) {
|
|
495
|
+
if ((0, node_opcua_factory_1.hasStructuredType)(dataTypeName)) {
|
|
496
|
+
const schema = (0, node_opcua_factory_1.getStructuredTypeSchema)(dataTypeName);
|
|
497
|
+
const encodeXml = _dumpVariantExtensionObjectValue.bind(null, xw, schema);
|
|
498
|
+
if (value.arrayType === node_opcua_variant_1.VariantArrayType.Array) {
|
|
499
|
+
xw.startElement("ListOf" + baseDataTypeName);
|
|
500
|
+
value.value.forEach(encodeXml);
|
|
501
|
+
xw.endElement();
|
|
502
|
+
}
|
|
503
|
+
else if (value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar) {
|
|
504
|
+
encodeXml(value.value);
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
errorLog(node.toString());
|
|
508
|
+
errorLog("_dumpValue : unsupported case , Matrix of ExtensionObjects");
|
|
509
|
+
// throw new Error("Unsupported case");
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
const encodeXml = _dumpVariantValue.bind(null, xw, value.dataType);
|
|
515
|
+
if (value.arrayType === node_opcua_variant_1.VariantArrayType.Matrix) {
|
|
516
|
+
console.log("Warning _dumpValue : Matrix not supported yet");
|
|
517
|
+
xw.startElement("ListOf" + dataTypeName);
|
|
518
|
+
xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
519
|
+
value.value.forEach(encodeXml);
|
|
520
|
+
xw.endElement();
|
|
521
|
+
}
|
|
522
|
+
else if (value.arrayType === node_opcua_variant_1.VariantArrayType.Array) {
|
|
523
|
+
xw.startElement("ListOf" + dataTypeName);
|
|
524
|
+
xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
525
|
+
value.value.forEach(encodeXml);
|
|
526
|
+
xw.endElement();
|
|
527
|
+
}
|
|
528
|
+
else if (value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar) {
|
|
529
|
+
encodeXml(value.value);
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
errorLog(node.toString());
|
|
533
|
+
errorLog("_dumpValue : unsupported case , Matrix");
|
|
534
|
+
// xx throw new Error("Unsupported case");
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
xw.endElement();
|
|
538
|
+
}
|
|
539
|
+
function _dumpArrayDimensionsAttribute(xw, node) {
|
|
540
|
+
if (node.arrayDimensions) {
|
|
541
|
+
if (node.arrayDimensions.length === 1 && node.arrayDimensions[0] === 0) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
xw.writeAttribute("ArrayDimensions", node.arrayDimensions.join(","));
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function visitUANode(node, options, forward) {
|
|
548
|
+
(0, node_opcua_assert_1.assert)(typeof forward === "boolean");
|
|
549
|
+
const addressSpace = node.addressSpace;
|
|
550
|
+
options.elements = options.elements || [];
|
|
551
|
+
options.index_el = options.index_el || {};
|
|
552
|
+
// visit references
|
|
553
|
+
function process_reference(reference) {
|
|
554
|
+
// only backward or forward references
|
|
555
|
+
if (reference.isForward !== forward) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
if (reference.nodeId.namespace === 0) {
|
|
559
|
+
return; // skip OPCUA namespace
|
|
560
|
+
}
|
|
561
|
+
const k = _hash(reference);
|
|
562
|
+
if (!options.index_el[k]) {
|
|
563
|
+
options.index_el[k] = 1;
|
|
564
|
+
const o = addressSpace.findNode(k);
|
|
565
|
+
if (o) {
|
|
566
|
+
visitUANode(o, options, forward);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
node.ownReferences().forEach(process_reference);
|
|
571
|
+
options.elements.push(node);
|
|
572
|
+
return node;
|
|
573
|
+
}
|
|
574
|
+
function dumpNodeInXml(xw, node) {
|
|
575
|
+
return node.dumpXML(xw);
|
|
576
|
+
}
|
|
577
|
+
function dumpReferencedNodes(xw, node, forward) {
|
|
578
|
+
const addressSpace = node.addressSpace;
|
|
579
|
+
if (!forward) {
|
|
580
|
+
{
|
|
581
|
+
const r = node.findReferencesEx("HasTypeDefinition");
|
|
582
|
+
if (r && r.length) {
|
|
583
|
+
(0, node_opcua_assert_1.assert)(r.length === 1);
|
|
584
|
+
const typeDefinitionObj = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, r[0]);
|
|
585
|
+
if (!typeDefinitionObj) {
|
|
586
|
+
console.log(node.toString());
|
|
587
|
+
console.log("Warning : " + node.browseName.toString() + " unknown typeDefinition, ", r[0].toString());
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
(0, node_opcua_assert_1.assert)(typeDefinitionObj instanceof base_node_impl_1.BaseNodeImpl);
|
|
591
|
+
if (typeDefinitionObj.nodeId.namespace === node.nodeId.namespace) {
|
|
592
|
+
// only output node if it is on the same namespace
|
|
593
|
+
if (!xw.visitedNode[_hash(typeDefinitionObj)]) {
|
|
594
|
+
dumpNodeInXml(xw, typeDefinitionObj);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
//
|
|
601
|
+
{
|
|
602
|
+
const r = node.findReferencesEx("HasSubtype", node_opcua_data_model_1.BrowseDirection.Inverse);
|
|
603
|
+
if (r && r.length) {
|
|
604
|
+
const subTypeOf = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, r[0]);
|
|
605
|
+
(0, node_opcua_assert_1.assert)(r.length === 1);
|
|
606
|
+
if (subTypeOf.nodeId.namespace === node.nodeId.namespace) {
|
|
607
|
+
// only output node if it is on the same namespace
|
|
608
|
+
if (!xw.visitedNode[_hash(subTypeOf)]) {
|
|
609
|
+
dumpNodeInXml(xw, subTypeOf);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
const r = node.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
617
|
+
for (const reference of r) {
|
|
618
|
+
const nodeChild = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
619
|
+
(0, node_opcua_assert_1.assert)(nodeChild instanceof base_node_impl_1.BaseNodeImpl);
|
|
620
|
+
if (nodeChild.nodeId.namespace === node.nodeId.namespace) {
|
|
621
|
+
if (!xw.visitedNode[_hash(nodeChild)]) {
|
|
622
|
+
console.log(node.nodeId.toString(), " dumping child ", nodeChild.browseName.toString(), nodeChild.nodeId.toString());
|
|
623
|
+
dumpNodeInXml(xw, nodeChild);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const currentReadFlag = (0, node_opcua_data_model_1.makeAccessLevelFlag)("CurrentRead");
|
|
630
|
+
function dumpCommonAttributes(xw, node) {
|
|
631
|
+
xw.writeAttribute("NodeId", n(xw, node.nodeId));
|
|
632
|
+
xw.writeAttribute("BrowseName", b(xw, node.browseName));
|
|
633
|
+
if (Object.prototype.hasOwnProperty.call(node, "symbolicName")) {
|
|
634
|
+
xw.writeAttribute("SymbolicName", node.symbolicName);
|
|
635
|
+
}
|
|
636
|
+
if (Object.prototype.hasOwnProperty.call(node, "isAbstract")) {
|
|
637
|
+
if (node.isAbstract) {
|
|
638
|
+
xw.writeAttribute("IsAbstract", node.isAbstract ? "true" : "false");
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (Object.prototype.hasOwnProperty.call(node, "accessLevel")) {
|
|
642
|
+
// CurrentRead is by default
|
|
643
|
+
if (node.accessLevel !== currentReadFlag) {
|
|
644
|
+
xw.writeAttribute("AccessLevel", node.accessLevel.toString());
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function dumpCommonElements(xw, node) {
|
|
649
|
+
_dumpDisplayName(xw, node);
|
|
650
|
+
_dumpDescription(xw, node);
|
|
651
|
+
_dumpReferences(xw, node);
|
|
652
|
+
}
|
|
653
|
+
function coerceInt64ToInt32(int64) {
|
|
654
|
+
if (typeof int64 === "number") {
|
|
655
|
+
return int64;
|
|
656
|
+
}
|
|
657
|
+
if (int64[0] === 4294967295 && int64[1] === 4294967295) {
|
|
658
|
+
return 0xffffffff;
|
|
659
|
+
}
|
|
660
|
+
if (int64[0] !== 0) {
|
|
661
|
+
debugLog("coerceInt64ToInt32 , loosing high word in conversion");
|
|
662
|
+
}
|
|
663
|
+
return int64[1];
|
|
664
|
+
}
|
|
665
|
+
function _dumpEnumDefinition(xw, enumDefinition) {
|
|
666
|
+
enumDefinition.fields = enumDefinition.fields || [];
|
|
667
|
+
for (const defItem of enumDefinition.fields) {
|
|
668
|
+
xw.startElement("Field");
|
|
669
|
+
xw.writeAttribute("Name", defItem.name);
|
|
670
|
+
if (!utils.isNullOrUndefined(defItem.value)) {
|
|
671
|
+
xw.writeAttribute("Value", coerceInt64ToInt32(defItem.value));
|
|
672
|
+
}
|
|
673
|
+
if (defItem.description && defItem.description.text) {
|
|
674
|
+
xw.startElement("Description");
|
|
675
|
+
xw.text(defItem.description.text.toString());
|
|
676
|
+
xw.endElement();
|
|
677
|
+
}
|
|
678
|
+
xw.endElement();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function _dumpStructureDefinition(xw, structureDefinition) {
|
|
682
|
+
/*
|
|
683
|
+
* note: baseDataType and defaultEncodingId are implicit and not stored in the XML file ??
|
|
684
|
+
*
|
|
685
|
+
*/
|
|
686
|
+
const baseDataType = structureDefinition.baseDataType;
|
|
687
|
+
const defaultEncodingId = structureDefinition.defaultEncodingId;
|
|
688
|
+
structureDefinition.fields = structureDefinition.fields || [];
|
|
689
|
+
for (const defItem /*: StructureField*/ of structureDefinition.fields) {
|
|
690
|
+
xw.startElement("Field");
|
|
691
|
+
xw.writeAttribute("Name", defItem.name);
|
|
692
|
+
if (defItem.arrayDimensions) {
|
|
693
|
+
xw.writeAttribute("ArrayDimensions", defItem.arrayDimensions.map((x) => x.toString()).join(","));
|
|
694
|
+
}
|
|
695
|
+
if (defItem.valueRank !== undefined && defItem.valueRank !== -1) {
|
|
696
|
+
xw.writeAttribute("ValueRank", defItem.valueRank);
|
|
697
|
+
}
|
|
698
|
+
if (defItem.isOptional /* && defItem.isOptional !== false */) {
|
|
699
|
+
xw.writeAttribute("IsOptional", defItem.isOptional.toString());
|
|
700
|
+
}
|
|
701
|
+
if (defItem.maxStringLength !== undefined && defItem.maxStringLength !== 0) {
|
|
702
|
+
xw.writeAttribute("MaxStringLength", defItem.maxStringLength);
|
|
703
|
+
}
|
|
704
|
+
// todo : SymbolicName ( see AutoId )
|
|
705
|
+
if (defItem.dataType) {
|
|
706
|
+
// todo : namespace translation !
|
|
707
|
+
xw.writeAttribute("DataType", n(xw, defItem.dataType));
|
|
708
|
+
}
|
|
709
|
+
if (defItem.description && defItem.description.text) {
|
|
710
|
+
xw.startElement("Description");
|
|
711
|
+
xw.text(defItem.description.text.toString());
|
|
712
|
+
xw.endElement();
|
|
713
|
+
}
|
|
714
|
+
xw.endElement();
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function _dumpUADataTypeDefinition(xw, node) {
|
|
718
|
+
// to do remove DataType from base class
|
|
719
|
+
const definition = node.getDefinition();
|
|
720
|
+
if (!definition) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (definition instanceof node_opcua_types_1.EnumDefinition) {
|
|
724
|
+
xw.startElement("Definition");
|
|
725
|
+
xw.writeAttribute("Name", node.browseName.name);
|
|
726
|
+
_dumpEnumDefinition(xw, definition);
|
|
727
|
+
xw.endElement();
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
if (definition instanceof node_opcua_types_1.StructureDefinition) {
|
|
731
|
+
xw.startElement("Definition");
|
|
732
|
+
xw.writeAttribute("Name", node.browseName.name);
|
|
733
|
+
if (definition.structureType === node_opcua_types_1.StructureType.Union) {
|
|
734
|
+
xw.writeAttribute("IsUnion", "true");
|
|
735
|
+
}
|
|
736
|
+
_dumpStructureDefinition(xw, definition);
|
|
737
|
+
xw.endElement();
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
// throw new Error("_dumpUADataTypeDefinition: Should not get here !");
|
|
741
|
+
}
|
|
742
|
+
function dumpUADataType(xw, node) {
|
|
743
|
+
_markAsVisited(xw, node);
|
|
744
|
+
xw.startElement("UADataType");
|
|
745
|
+
xw.writeAttribute("NodeId", n(xw, node.nodeId));
|
|
746
|
+
xw.writeAttribute("BrowseName", b(xw, node.browseName));
|
|
747
|
+
if (node.symbolicName !== node.browseName.name) {
|
|
748
|
+
xw.writeAttribute("SymbolicName", node.symbolicName);
|
|
749
|
+
}
|
|
750
|
+
if (node.isAbstract) {
|
|
751
|
+
xw.writeAttribute("IsAbstract", node.isAbstract ? "true" : "false");
|
|
752
|
+
}
|
|
753
|
+
_dumpDisplayName(xw, node);
|
|
754
|
+
_dumpReferences(xw, node);
|
|
755
|
+
_dumpUADataTypeDefinition(xw, node);
|
|
756
|
+
xw.endElement();
|
|
757
|
+
dumpAggregates(xw, node);
|
|
758
|
+
}
|
|
759
|
+
function _markAsVisited(xw, node) {
|
|
760
|
+
xw.visitedNode = xw.visitedNode || {};
|
|
761
|
+
(0, node_opcua_assert_1.assert)(!xw.visitedNode[_hash(node)]);
|
|
762
|
+
xw.visitedNode[_hash(node)] = 1;
|
|
763
|
+
}
|
|
764
|
+
function dumpUAVariable(xw, node) {
|
|
765
|
+
_markAsVisited(xw, node);
|
|
766
|
+
dumpReferencedNodes(xw, node, false);
|
|
767
|
+
const addressSpace = node.addressSpace;
|
|
768
|
+
xw.startElement("UAVariable");
|
|
769
|
+
{
|
|
770
|
+
// attributes
|
|
771
|
+
dumpCommonAttributes(xw, node);
|
|
772
|
+
if (node.valueRank !== -1) {
|
|
773
|
+
// -1 = Scalar
|
|
774
|
+
xw.writeAttribute("ValueRank", node.valueRank);
|
|
775
|
+
}
|
|
776
|
+
_dumpArrayDimensionsAttribute(xw, node);
|
|
777
|
+
const dataTypeNode = addressSpace.findNode(node.dataType);
|
|
778
|
+
if (dataTypeNode) {
|
|
779
|
+
// verify that data Type is in alias
|
|
780
|
+
// xx const dataTypeName = dataTypeNode.browseName.toString();
|
|
781
|
+
const dataTypeName = b(xw, resolveDataTypeName(addressSpace, dataTypeNode.nodeId));
|
|
782
|
+
xw.writeAttribute("DataType", dataTypeName);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
{
|
|
786
|
+
// sub elements
|
|
787
|
+
dumpCommonElements(xw, node);
|
|
788
|
+
_dumpValue(xw, node, node.readValue().value);
|
|
789
|
+
}
|
|
790
|
+
xw.endElement();
|
|
791
|
+
dumpAggregates(xw, node);
|
|
792
|
+
}
|
|
793
|
+
function dumpUAVariableType(xw, node) {
|
|
794
|
+
xw.visitedNode = xw.visitedNode || {};
|
|
795
|
+
(0, node_opcua_assert_1.assert)(!xw.visitedNode[_hash(node)]);
|
|
796
|
+
xw.visitedNode[_hash(node)] = 1;
|
|
797
|
+
dumpReferencedNodes(xw, node, false);
|
|
798
|
+
const addressSpace = node.addressSpace;
|
|
799
|
+
xw.startElement("UAVariableType");
|
|
800
|
+
{
|
|
801
|
+
// attributes
|
|
802
|
+
dumpCommonAttributes(xw, node);
|
|
803
|
+
if (node.valueRank !== -1) {
|
|
804
|
+
xw.writeAttribute("ValueRank", node.valueRank);
|
|
805
|
+
}
|
|
806
|
+
const dataTypeNode = addressSpace.findNode(node.dataType);
|
|
807
|
+
if (!dataTypeNode) {
|
|
808
|
+
// throw new Error(" cannot find datatype " + node.dataType);
|
|
809
|
+
console.log(" cannot find datatype " +
|
|
810
|
+
node.dataType +
|
|
811
|
+
" for node " +
|
|
812
|
+
node.browseName.toString() +
|
|
813
|
+
" id =" +
|
|
814
|
+
node.nodeId.toString());
|
|
815
|
+
}
|
|
816
|
+
else {
|
|
817
|
+
const dataTypeName = b(xw, resolveDataTypeName(addressSpace, dataTypeNode.nodeId));
|
|
818
|
+
xw.writeAttribute("DataType", dataTypeName);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
{
|
|
822
|
+
_dumpArrayDimensionsAttribute(xw, node);
|
|
823
|
+
// sub elements
|
|
824
|
+
dumpCommonElements(xw, node);
|
|
825
|
+
_dumpValue(xw, node, node.value);
|
|
826
|
+
}
|
|
827
|
+
xw.endElement();
|
|
828
|
+
dumpAggregates(xw, node);
|
|
829
|
+
}
|
|
830
|
+
function dumpUAObject(xw, node) {
|
|
831
|
+
xw.writeComment("Object - " + b(xw, node.browseName) + " {{{{ ");
|
|
832
|
+
xw.visitedNode = xw.visitedNode || {};
|
|
833
|
+
(0, node_opcua_assert_1.assert)(!xw.visitedNode[_hash(node)]);
|
|
834
|
+
xw.visitedNode[_hash(node)] = 1;
|
|
835
|
+
// dump SubTypeOf and HasTypeDefinition
|
|
836
|
+
dumpReferencedNodes(xw, node, false);
|
|
837
|
+
xw.startElement("UAObject");
|
|
838
|
+
dumpCommonAttributes(xw, node);
|
|
839
|
+
dumpCommonElements(xw, node);
|
|
840
|
+
xw.endElement();
|
|
841
|
+
// dump aggregates nodes ( Properties / components )
|
|
842
|
+
dumpAggregates(xw, node);
|
|
843
|
+
dumpElementInFolder(xw, node);
|
|
844
|
+
xw.writeComment("Object - " + b(xw, node.browseName) + " }}}} ");
|
|
845
|
+
}
|
|
846
|
+
function dumpElementInFolder(xw, node) {
|
|
847
|
+
const aggregates = node
|
|
848
|
+
.getFolderElements()
|
|
849
|
+
.sort((x, y) => (x.browseName.name.toString() > y.browseName.name.toString() ? 1 : -1));
|
|
850
|
+
for (const aggregate of aggregates) {
|
|
851
|
+
// do not export node that do not belong to our namespace
|
|
852
|
+
if (node.nodeId.namespace !== aggregate.nodeId.namespace) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
if (!xw.visitedNode[_hash(aggregate)]) {
|
|
856
|
+
aggregate.dumpXML(xw);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
function dumpAggregates(xw, node) {
|
|
861
|
+
// Xx xw.writeComment("Aggregates {{ ");
|
|
862
|
+
const aggregates = node
|
|
863
|
+
.getAggregates()
|
|
864
|
+
.sort((x, y) => (x.browseName.name.toString() > y.browseName.name.toString() ? 1 : -1));
|
|
865
|
+
for (const aggregate of aggregates) {
|
|
866
|
+
// do not export node that do not belong to our namespace
|
|
867
|
+
if (node.nodeId.namespace !== aggregate.nodeId.namespace) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
if (!xw.visitedNode[_hash(aggregate)]) {
|
|
871
|
+
aggregate.dumpXML(xw);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
// Xx xw.writeComment("Aggregates }} ");
|
|
875
|
+
}
|
|
876
|
+
function dumpUAObjectType(xw, node) {
|
|
877
|
+
(0, node_opcua_assert_1.assert)(node instanceof ua_object_type_impl_1.UAObjectTypeImpl);
|
|
878
|
+
xw.writeComment("ObjectType - " + b(xw, node.browseName) + " {{{{ ");
|
|
879
|
+
_markAsVisited(xw, node);
|
|
880
|
+
// dump SubtypeOf and HasTypeDefinition
|
|
881
|
+
dumpReferencedNodes(xw, node, false);
|
|
882
|
+
xw.startElement("UAObjectType");
|
|
883
|
+
dumpCommonAttributes(xw, node);
|
|
884
|
+
dumpCommonElements(xw, node);
|
|
885
|
+
xw.endElement();
|
|
886
|
+
dumpAggregates(xw, node);
|
|
887
|
+
xw.writeComment("ObjectType - " + b(xw, node.browseName) + " }}}}");
|
|
888
|
+
}
|
|
889
|
+
function dumpUAMethod(xw, node) {
|
|
890
|
+
_markAsVisited(xw, node);
|
|
891
|
+
dumpReferencedNodes(xw, node, false);
|
|
892
|
+
xw.startElement("UAMethod");
|
|
893
|
+
dumpCommonAttributes(xw, node);
|
|
894
|
+
if (node.methodDeclarationId) {
|
|
895
|
+
xw.writeAttribute("MethodDeclarationId", n(xw, node.methodDeclarationId));
|
|
896
|
+
}
|
|
897
|
+
dumpCommonElements(xw, node);
|
|
898
|
+
xw.endElement();
|
|
899
|
+
dumpAggregates(xw, node);
|
|
900
|
+
}
|
|
901
|
+
function resolveDataTypeName(addressSpace, dataType) {
|
|
902
|
+
let dataTypeNode = null;
|
|
903
|
+
// istanbul ignore next
|
|
904
|
+
if (typeof dataType === "string") {
|
|
905
|
+
dataTypeNode = addressSpace.findDataType(dataType);
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
(0, node_opcua_assert_1.assert)(dataType instanceof node_opcua_nodeid_1.NodeId);
|
|
909
|
+
const o = addressSpace.findNode(dataType.toString());
|
|
910
|
+
dataTypeNode = o ? o : null;
|
|
911
|
+
}
|
|
912
|
+
if (!dataTypeNode) {
|
|
913
|
+
throw new Error("Cannot find dataTypeName " + dataType);
|
|
914
|
+
}
|
|
915
|
+
return dataTypeNode.browseName;
|
|
916
|
+
}
|
|
917
|
+
function buildUpAliases(node, xw, options) {
|
|
918
|
+
const addressSpace = node.addressSpace;
|
|
919
|
+
options.aliases = options.aliases || {};
|
|
920
|
+
options.aliases_visited = options.aliases_visited || {};
|
|
921
|
+
const k = _hash(node);
|
|
922
|
+
// istanbul ignore next
|
|
923
|
+
if (options.aliases_visited[k]) {
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
options.aliases_visited[k] = 1;
|
|
927
|
+
// put datatype into aliases list
|
|
928
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.Variable || node.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
929
|
+
const nodeV = node;
|
|
930
|
+
if (nodeV.dataType && nodeV.dataType.namespace === 0 && nodeV.dataType.value !== 0) {
|
|
931
|
+
// name
|
|
932
|
+
const dataTypeName = b(xw, resolveDataTypeName(addressSpace, nodeV.dataType));
|
|
933
|
+
if (dataTypeName) {
|
|
934
|
+
if (!options.aliases[dataTypeName]) {
|
|
935
|
+
options.aliases[dataTypeName] = n(xw, nodeV.dataType);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (nodeV.dataType && nodeV.dataType.namespace !== 0 && nodeV.dataType.value !== 0) {
|
|
940
|
+
// name
|
|
941
|
+
const dataTypeName = b(xw, resolveDataTypeName(addressSpace, nodeV.dataType));
|
|
942
|
+
if (dataTypeName) {
|
|
943
|
+
if (!options.aliases[dataTypeName]) {
|
|
944
|
+
options.aliases[dataTypeName] = n(xw, nodeV.dataType);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
function collectReferenceNameInAlias(reference) {
|
|
950
|
+
// reference.referenceType
|
|
951
|
+
const key = b(xw, (0, base_node_impl_1.getReferenceType)(reference).browseName);
|
|
952
|
+
if (!options.aliases.key) {
|
|
953
|
+
if (reference.referenceType.namespace === 0) {
|
|
954
|
+
options.aliases[key] = reference.referenceType.toString().replace("ns=0;", "");
|
|
955
|
+
}
|
|
956
|
+
else {
|
|
957
|
+
options.aliases[key] = n(xw, reference.referenceType);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
node.allReferences().forEach(collectReferenceNameInAlias);
|
|
962
|
+
}
|
|
963
|
+
function writeAliases(xw, aliases) {
|
|
964
|
+
xw.startElement("Aliases");
|
|
965
|
+
if (aliases) {
|
|
966
|
+
const keys = Object.keys(aliases).sort();
|
|
967
|
+
for (const key of keys) {
|
|
968
|
+
xw.startElement("Alias");
|
|
969
|
+
xw.writeAttribute("Alias", key);
|
|
970
|
+
xw.text(aliases[key].toString().replace(/ns=0;/, ""));
|
|
971
|
+
xw.endElement();
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
xw.endElement();
|
|
975
|
+
}
|
|
976
|
+
function constructNamespaceTranslationTable(dependency) {
|
|
977
|
+
const translationTable = {};
|
|
978
|
+
for (let i = 0; i < dependency.length; i++) {
|
|
979
|
+
translationTable[dependency[i].index] = i;
|
|
980
|
+
}
|
|
981
|
+
return translationTable;
|
|
982
|
+
}
|
|
983
|
+
function dumpReferenceType(xw, referenceType) {
|
|
984
|
+
_markAsVisited(xw, referenceType);
|
|
985
|
+
xw.startElement("UAReferenceType");
|
|
986
|
+
dumpCommonAttributes(xw, referenceType);
|
|
987
|
+
dumpCommonElements(xw, referenceType);
|
|
988
|
+
if (referenceType.inverseName /* LocalizedText*/) {
|
|
989
|
+
xw.startElement("InverseName");
|
|
990
|
+
xw.text(referenceType.inverseName.text || "");
|
|
991
|
+
xw.endElement();
|
|
992
|
+
}
|
|
993
|
+
xw.endElement();
|
|
994
|
+
}
|
|
995
|
+
function sortByBrowseName(x, y) {
|
|
996
|
+
const x_str = x.browseName.toString();
|
|
997
|
+
const y_str = y.browseName.toString();
|
|
998
|
+
if (x_str > y_str) {
|
|
999
|
+
return -1;
|
|
1000
|
+
}
|
|
1001
|
+
else if (x_str < y_str) {
|
|
1002
|
+
return 1;
|
|
1003
|
+
}
|
|
1004
|
+
return 0;
|
|
1005
|
+
}
|
|
1006
|
+
function dumpXml(node, options) {
|
|
1007
|
+
const namespace = node.namespace;
|
|
1008
|
+
// make a first visit so that we determine which node to output and in which order
|
|
1009
|
+
const nodesToVisit = {};
|
|
1010
|
+
const dependency = (0, construct_namespace_dependency_1.constructNamespaceDependency)(namespace);
|
|
1011
|
+
const translationTable = constructNamespaceTranslationTable(dependency);
|
|
1012
|
+
const xw = new XMLWriter(true);
|
|
1013
|
+
xw.translationTable = translationTable;
|
|
1014
|
+
visitUANode(node, nodesToVisit, false);
|
|
1015
|
+
xw.startDocument({ encoding: "utf-8" });
|
|
1016
|
+
xw.startElement("UANodeSet");
|
|
1017
|
+
xw.writeAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema-instance");
|
|
1018
|
+
xw.writeAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
|
|
1019
|
+
xw.writeAttribute("Version", "1.02");
|
|
1020
|
+
xw.writeAttribute("LastModified", new Date().toISOString());
|
|
1021
|
+
xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd");
|
|
1022
|
+
buildUpAliases(node, xw, nodesToVisit);
|
|
1023
|
+
writeAliases(xw, nodesToVisit.aliases);
|
|
1024
|
+
for (const el of nodesToVisit.elements) {
|
|
1025
|
+
el.dumpXML(xw);
|
|
1026
|
+
}
|
|
1027
|
+
xw.endElement();
|
|
1028
|
+
xw.endDocument();
|
|
1029
|
+
return xw.toString();
|
|
1030
|
+
}
|
|
1031
|
+
exports.dumpXml = dumpXml;
|
|
1032
|
+
ua_method_impl_1.UAMethodImpl.prototype.dumpXML = function (xw) {
|
|
1033
|
+
dumpUAMethod(xw, this);
|
|
1034
|
+
};
|
|
1035
|
+
ua_object_impl_1.UAObjectImpl.prototype.dumpXML = function (xw) {
|
|
1036
|
+
dumpUAObject(xw, this);
|
|
1037
|
+
};
|
|
1038
|
+
ua_variable_impl_1.UAVariableImpl.prototype.dumpXML = function (xw) {
|
|
1039
|
+
dumpUAVariable(xw, this);
|
|
1040
|
+
};
|
|
1041
|
+
ua_variable_type_impl_1.UAVariableTypeImpl.prototype.dumpXML = function (xw) {
|
|
1042
|
+
dumpUAVariableType(xw, this);
|
|
1043
|
+
};
|
|
1044
|
+
ua_reference_type_impl_1.UAReferenceTypeImpl.prototype.dumpXML = function (xw) {
|
|
1045
|
+
dumpReferenceType(xw, this);
|
|
1046
|
+
};
|
|
1047
|
+
ua_object_type_impl_1.UAObjectTypeImpl.prototype.dumpXML = function (xw) {
|
|
1048
|
+
dumpUAObjectType(xw, this);
|
|
1049
|
+
};
|
|
1050
|
+
ua_data_type_impl_1.UADataTypeImpl.prototype.dumpXML = function (xw) {
|
|
1051
|
+
dumpUADataType(xw, this);
|
|
1052
|
+
};
|
|
1053
|
+
namespace_impl_1.UANamespace.prototype.toNodeset2XML = function () {
|
|
1054
|
+
const dependency = (0, construct_namespace_dependency_1.constructNamespaceDependency)(this);
|
|
1055
|
+
const translationTable = constructNamespaceTranslationTable(dependency);
|
|
1056
|
+
const xw = new XMLWriter(true);
|
|
1057
|
+
xw.translationTable = translationTable;
|
|
1058
|
+
xw.startDocument({ encoding: "utf-8", version: "1.0" });
|
|
1059
|
+
xw.startElement("UANodeSet");
|
|
1060
|
+
xw.writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
|
1061
|
+
xw.writeAttribute("xmlns:uax", "http://opcfoundation.org/UA/2008/02/Types.xsd");
|
|
1062
|
+
xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd");
|
|
1063
|
+
// xx xw.writeAttribute("Version", "1.02");
|
|
1064
|
+
// xx xw.writeAttribute("LastModified", (new Date()).toISOString());
|
|
1065
|
+
// ------------- INamespace Uris
|
|
1066
|
+
xw.startElement("NamespaceUris");
|
|
1067
|
+
// xx const namespaceArray = namespace.addressSpace.getNamespaceArray();
|
|
1068
|
+
for (const depend of dependency) {
|
|
1069
|
+
if (depend.index === 0) {
|
|
1070
|
+
continue; // ignore namespace 0
|
|
1071
|
+
}
|
|
1072
|
+
xw.startElement("Uri");
|
|
1073
|
+
xw.text(depend.namespaceUri);
|
|
1074
|
+
xw.endElement();
|
|
1075
|
+
}
|
|
1076
|
+
xw.endElement();
|
|
1077
|
+
// ------------- INamespace Uris
|
|
1078
|
+
xw.startElement("Models");
|
|
1079
|
+
xw.endElement();
|
|
1080
|
+
const s = {};
|
|
1081
|
+
for (const node of this.nodeIterator()) {
|
|
1082
|
+
buildUpAliases(node, xw, s);
|
|
1083
|
+
}
|
|
1084
|
+
writeAliases(xw, s.aliases);
|
|
1085
|
+
xw.visitedNode = {};
|
|
1086
|
+
// -------------- writeReferences
|
|
1087
|
+
xw.writeComment("ReferenceTypes");
|
|
1088
|
+
const referenceTypes = [...this._referenceTypeIterator()].sort(sortByBrowseName);
|
|
1089
|
+
for (const referenceType of referenceTypes) {
|
|
1090
|
+
dumpReferenceType(xw, referenceType);
|
|
1091
|
+
}
|
|
1092
|
+
// -------------- Dictionaries
|
|
1093
|
+
const addressSpace = this.addressSpace;
|
|
1094
|
+
const opcBinaryTypeSystem = addressSpace.findNode("OPCBinarySchema_TypeSystem");
|
|
1095
|
+
if (opcBinaryTypeSystem) {
|
|
1096
|
+
// let find all DataType dictionary node corresponding to a given namespace
|
|
1097
|
+
// (have DataTypeDictionaryType)
|
|
1098
|
+
const nodeToBrowse = new node_opcua_types_1.BrowseDescription({
|
|
1099
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
1100
|
+
includeSubtypes: false,
|
|
1101
|
+
nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Variable"),
|
|
1102
|
+
nodeId: opcBinaryTypeSystem.nodeId,
|
|
1103
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasComponent"),
|
|
1104
|
+
resultMask: (0, node_opcua_data_model_1.makeResultMask)("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
|
|
1105
|
+
});
|
|
1106
|
+
const result = opcBinaryTypeSystem.browseNode(nodeToBrowse).filter((r) => r.nodeId.namespace === this.index);
|
|
1107
|
+
(0, node_opcua_assert_1.assert)(result.length <= 1);
|
|
1108
|
+
if (result.length === 1) {
|
|
1109
|
+
xw.writeComment("DataSystem");
|
|
1110
|
+
const dataSystemType = addressSpace.findNode(result[0].nodeId);
|
|
1111
|
+
dumpNodeInXml(xw, dataSystemType);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
// -------------- DataTypes
|
|
1115
|
+
const dataTypes = [...this._dataTypeIterator()].sort(sortByBrowseName);
|
|
1116
|
+
if (dataTypes.length) {
|
|
1117
|
+
xw.writeComment("DataTypes");
|
|
1118
|
+
// xx xw.writeComment(" "+ objectTypes.map(x=>x.browseName.name.toString()).join(" "));
|
|
1119
|
+
for (const dataType of dataTypes) {
|
|
1120
|
+
if (!xw.visitedNode[_hash(dataType)]) {
|
|
1121
|
+
dumpNodeInXml(xw, dataType);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
// -------------- ObjectTypes
|
|
1126
|
+
xw.writeComment("ObjectTypes");
|
|
1127
|
+
const objectTypes = [...this._objectTypeIterator()].sort(sortByBrowseName);
|
|
1128
|
+
// xx xw.writeComment(" "+ objectTypes.map(x=>x.browseName.name.toString()).join(" "));
|
|
1129
|
+
for (const objectType of objectTypes) {
|
|
1130
|
+
if (!xw.visitedNode[_hash(objectType)]) {
|
|
1131
|
+
dumpNodeInXml(xw, objectType);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
// -------------- VariableTypes
|
|
1135
|
+
xw.writeComment("VariableTypes");
|
|
1136
|
+
const variableTypes = [...this._variableTypeIterator()].sort(sortByBrowseName);
|
|
1137
|
+
// xx xw.writeComment("ObjectTypes "+ variableTypes.map(x=>x.browseName.name.toString()).join(" "));
|
|
1138
|
+
for (const variableType of variableTypes) {
|
|
1139
|
+
if (!xw.visitedNode[_hash(variableType)]) {
|
|
1140
|
+
dumpNodeInXml(xw, variableType);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
// -------------- Any thing else
|
|
1144
|
+
xw.writeComment("Other Nodes");
|
|
1145
|
+
const nodes = [...this.nodeIterator()].sort(sortByBrowseName);
|
|
1146
|
+
for (const node of nodes) {
|
|
1147
|
+
if (!xw.visitedNode[_hash(node)]) {
|
|
1148
|
+
dumpNodeInXml(xw, node);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
xw.endElement();
|
|
1152
|
+
xw.endDocument();
|
|
1153
|
+
return xw.toString();
|
|
1154
|
+
};
|
|
1155
|
+
//# sourceMappingURL=nodeset_to_xml.js.map
|