node-opcua-address-space 2.97.0 → 2.98.1
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/dist/source/address_space_ts.d.ts +118 -118
- package/dist/source/address_space_ts.js +17 -17
- package/dist/source/continuation_points/continuation_point_manager.d.ts +91 -91
- package/dist/source/continuation_points/continuation_point_manager.js +200 -200
- package/dist/source/helpers/adjust_browse_direction.d.ts +5 -5
- package/dist/source/helpers/adjust_browse_direction.js +11 -11
- package/dist/source/helpers/argument_list.d.ts +33 -33
- package/dist/source/helpers/argument_list.js +254 -254
- package/dist/source/helpers/call_helpers.d.ts +6 -6
- package/dist/source/helpers/call_helpers.js +71 -71
- package/dist/source/helpers/coerce_enum_value.d.ts +6 -6
- package/dist/source/helpers/coerce_enum_value.js +33 -33
- package/dist/source/helpers/dump_tools.d.ts +14 -14
- package/dist/source/helpers/dump_tools.js +78 -78
- package/dist/source/helpers/ensure_secure_access.d.ts +9 -9
- package/dist/source/helpers/ensure_secure_access.js +76 -76
- package/dist/source/helpers/make_optionals_map.d.ts +21 -21
- package/dist/source/helpers/make_optionals_map.js +29 -29
- package/dist/source/helpers/multiform_func.d.ts +11 -11
- package/dist/source/helpers/multiform_func.js +75 -75
- package/dist/source/helpers/resolve_opaque_on_address_space.d.ts +3 -3
- package/dist/source/helpers/resolve_opaque_on_address_space.js +36 -36
- package/dist/source/index.d.ts +61 -61
- package/dist/source/index.js +89 -89
- package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +19 -19
- package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +193 -193
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.d.ts +12 -12
- package/dist/source/interfaces/alarms_and_conditions/deviation_stuff.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.d.ts +10 -10
- package/dist/source/interfaces/alarms_and_conditions/install_setpoint_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options.d.ts +7 -7
- package/dist/source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_condition_options.d.ts +7 -7
- package/dist/source/interfaces/alarms_and_conditions/instantiate_condition_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.d.ts +4 -4
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.d.ts +4 -4
- package/dist/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.d.ts +9 -9
- package/dist/source/interfaces/alarms_and_conditions/instantiate_limit_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.d.ts +4 -4
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.d.ts +4 -4
- package/dist/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.d.ts +20 -20
- package/dist/source/interfaces/alarms_and_conditions/instantiate_off_normal_alarm_options.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.d.ts +23 -23
- package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.d.ts +32 -32
- package/dist/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.d.ts +19 -19
- package/dist/source/interfaces/alarms_and_conditions/ua_certificate_expiration_alarm_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +45 -42
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.d.ts +7 -7
- package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.js +25 -25
- package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.d.ts +5 -5
- package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.d.ts +20 -20
- package/dist/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_limit_alarm_ex.d.ts +26 -26
- package/dist/source/interfaces/alarms_and_conditions/ua_limit_alarm_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.d.ts +8 -8
- package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_deviation_alarm_ex.js +2 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex.d.ts +10 -10
- package/dist/source/interfaces/alarms_and_conditions/ua_non_exclusive_limit_alarm_ex.js +2 -2
- package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +21 -21
- package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js +2 -2
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +24 -24
- package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js +2 -2
- package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +12 -12
- package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js +2 -2
- package/dist/source/interfaces/data_access/ua_y_array_item_ex.d.ts +8 -8
- package/dist/source/interfaces/data_access/ua_y_array_item_ex.js +2 -2
- package/dist/source/interfaces/extension_object_constructor.d.ts +10 -10
- package/dist/source/interfaces/extension_object_constructor.js +2 -2
- package/dist/source/interfaces/nodeset_loader_options.d.ts +4 -4
- package/dist/source/interfaces/nodeset_loader_options.js +2 -2
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +12 -12
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js +2 -2
- package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.d.ts +49 -49
- package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js +2 -2
- package/dist/source/interfaces/state_machine/ua_program_state_machine_type.d.ts +11 -11
- package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js +2 -2
- package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.d.ts +30 -30
- package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.js +2 -2
- package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +234 -234
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js +2 -2
- package/dist/source/interfaces/state_machine/ua_transition_ex.d.ts +6 -6
- package/dist/source/interfaces/state_machine/ua_transition_ex.js +2 -2
- package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.d.ts +8 -8
- package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js +2 -2
- package/dist/source/loader/decode_xml_extension_object.d.ts +6 -6
- package/dist/source/loader/decode_xml_extension_object.js +71 -71
- package/dist/source/loader/ensure_datatype_extracted.d.ts +5 -5
- package/dist/source/loader/ensure_datatype_extracted.js +70 -70
- package/dist/source/loader/generateAddressSpaceRaw.d.ts +11 -11
- package/dist/source/loader/generateAddressSpaceRaw.js +45 -45
- package/dist/source/loader/load_nodeset2.d.ts +17 -17
- package/dist/source/loader/load_nodeset2.js +1483 -1483
- package/dist/source/loader/make_semver_compatible.d.ts +6 -6
- package/dist/source/loader/make_semver_compatible.js +25 -25
- package/dist/source/loader/make_xml_extension_object_parser.d.ts +28 -28
- package/dist/source/loader/make_xml_extension_object_parser.js +326 -326
- package/dist/source/loader/namespace_post_step.d.ts +10 -10
- package/dist/source/loader/namespace_post_step.js +61 -61
- package/dist/source/loader/register_node_promoter.d.ts +2 -2
- package/dist/source/loader/register_node_promoter.js +9 -9
- package/dist/source/namespace.d.ts +6 -6
- package/dist/source/namespace.js +2 -2
- package/dist/source/namespace_alarm_and_condition.d.ts +32 -32
- package/dist/source/namespace_alarm_and_condition.js +2 -2
- package/dist/source/namespace_data_access.d.ts +42 -42
- package/dist/source/namespace_data_access.js +2 -2
- package/dist/source/namespace_machine_state.d.ts +8 -8
- package/dist/source/namespace_machine_state.js +2 -2
- package/dist/source/pseudo_session.d.ts +72 -72
- package/dist/source/pseudo_session.js +254 -254
- package/dist/source/session_context.d.ts +111 -111
- package/dist/source/session_context.js +264 -264
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/set_namespace_meta_data.d.ts +2 -2
- package/dist/source/set_namespace_meta_data.js +59 -59
- package/dist/source/ua_root_folder.d.ts +9 -9
- package/dist/source/ua_root_folder.js +2 -2
- package/dist/source/ua_two_state_variable_ex.d.ts +23 -23
- package/dist/source/ua_two_state_variable_ex.js +2 -2
- package/dist/source/xml_writer.d.ts +18 -18
- package/dist/source/xml_writer.js +2 -2
- package/dist/src/address_space.d.ts +387 -387
- package/dist/src/address_space.js +1385 -1385
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_change_event_tools.d.ts +6 -6
- package/dist/src/address_space_change_event_tools.js +152 -152
- package/dist/src/address_space_private.d.ts +43 -43
- package/dist/src/address_space_private.js +2 -2
- package/dist/src/alarms_and_conditions/condition.d.ts +5 -5
- package/dist/src/alarms_and_conditions/condition.js +78 -78
- package/dist/src/alarms_and_conditions/condition_info_impl.d.ts +26 -26
- package/dist/src/alarms_and_conditions/condition_info_impl.js +54 -54
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +222 -222
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +657 -657
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +9 -9
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +60 -60
- package/dist/src/alarms_and_conditions/index.d.ts +16 -16
- package/dist/src/alarms_and_conditions/index.js +32 -32
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +44 -44
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +244 -244
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +93 -93
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +418 -418
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +26 -26
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js +38 -38
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +44 -44
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +183 -183
- package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +155 -153
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +1028 -1028
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.d.ts +14 -14
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +34 -34
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +24 -24
- package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +56 -56
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.d.ts +11 -11
- package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js +11 -11
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +23 -23
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +86 -86
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.d.ts +11 -11
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js +7 -7
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +79 -79
- package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +250 -250
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +24 -24
- package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +50 -50
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +19 -19
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +162 -162
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +46 -46
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +165 -165
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.d.ts +18 -18
- package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js +17 -17
- package/dist/src/apply_condition_refresh.d.ts +6 -6
- package/dist/src/apply_condition_refresh.js +27 -27
- package/dist/src/base_node_impl.d.ts +284 -284
- package/dist/src/base_node_impl.js +1454 -1454
- package/dist/src/base_node_private.d.ts +81 -81
- package/dist/src/base_node_private.js +832 -803
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/check_value_rank_compatibility.d.ts +15 -15
- package/dist/src/check_value_rank_compatibility.js +81 -81
- package/dist/src/data_access/add_dataItem_stuff.d.ts +11 -11
- package/dist/src/data_access/add_dataItem_stuff.js +61 -61
- package/dist/src/data_access/check_variant_compatibility_ua_analog_item.d.ts +1 -1
- package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js +34 -34
- package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +32 -32
- package/dist/src/data_access/ua_multistate_discrete_impl.js +130 -130
- package/dist/src/data_access/ua_multistate_value_discrete_impl.d.ts +52 -52
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js +253 -253
- package/dist/src/data_access/ua_two_state_discrete_impl.d.ts +25 -25
- package/dist/src/data_access/ua_two_state_discrete_impl.js +155 -155
- package/dist/src/event_data.d.ts +34 -34
- package/dist/src/event_data.js +64 -64
- package/dist/src/extension_object_array_node.d.ts +23 -23
- package/dist/src/extension_object_array_node.js +248 -248
- package/dist/src/historical_access/address_space_historical_data_node.d.ts +26 -26
- package/dist/src/historical_access/address_space_historical_data_node.js +652 -652
- package/dist/src/idx_iterator.d.ts +8 -8
- package/dist/src/idx_iterator.js +50 -50
- package/dist/src/index_current.d.ts +46 -46
- package/dist/src/index_current.js +77 -77
- package/dist/src/namespace_impl.d.ts +456 -456
- package/dist/src/namespace_impl.js +1762 -1762
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/namespace_private.d.ts +23 -23
- package/dist/src/namespace_private.js +32 -32
- package/dist/src/nodeid_manager.d.ts +37 -37
- package/dist/src/nodeid_manager.js +183 -183
- package/dist/src/nodeset_tools/adjust_namespace_array.d.ts +2 -2
- package/dist/src/nodeset_tools/adjust_namespace_array.js +13 -13
- package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +18 -18
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +140 -140
- package/dist/src/nodeset_tools/dump_to_bsd.d.ts +2 -2
- package/dist/src/nodeset_tools/dump_to_bsd.js +164 -164
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +10 -10
- package/dist/src/nodeset_tools/nodeset_to_xml.js +1287 -1287
- package/dist/src/private_namespace.d.ts +5 -5
- package/dist/src/private_namespace.js +19 -19
- package/dist/src/reference_impl.d.ts +43 -43
- package/dist/src/reference_impl.js +139 -139
- package/dist/src/role_permissions.d.ts +2 -2
- package/dist/src/role_permissions.js +10 -10
- package/dist/src/state_machine/finite_state_machine.d.ts +81 -81
- package/dist/src/state_machine/finite_state_machine.js +388 -388
- package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +38 -38
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +250 -250
- package/dist/src/state_machine/ua_two_state_variable.d.ts +61 -61
- package/dist/src/state_machine/ua_two_state_variable.js +331 -331
- package/dist/src/tool_isSubtypeOf.d.ts +18 -18
- package/dist/src/tool_isSubtypeOf.js +124 -124
- package/dist/src/ua_condition_type.d.ts +8 -8
- package/dist/src/ua_condition_type.js +2 -2
- package/dist/src/ua_data_type_impl.d.ts +89 -89
- package/dist/src/ua_data_type_impl.js +368 -368
- package/dist/src/ua_method_impl.d.ts +42 -42
- package/dist/src/ua_method_impl.js +217 -217
- package/dist/src/ua_object_impl.d.ts +35 -35
- package/dist/src/ua_object_impl.js +168 -168
- package/dist/src/ua_object_type_impl.d.ts +50 -50
- package/dist/src/ua_object_type_impl.js +126 -126
- package/dist/src/ua_reference_type_impl.d.ts +45 -45
- package/dist/src/ua_reference_type_impl.js +141 -141
- package/dist/src/ua_variable_impl.d.ts +380 -380
- package/dist/src/ua_variable_impl.js +1738 -1738
- package/dist/src/ua_variable_impl_ext_obj.d.ts +23 -23
- package/dist/src/ua_variable_impl_ext_obj.js +670 -670
- package/dist/src/ua_variable_type_impl.d.ts +74 -74
- package/dist/src/ua_variable_type_impl.js +597 -581
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/ua_view_impl.d.ts +19 -19
- package/dist/src/ua_view_impl.js +43 -43
- package/dist/tsconfig_common.tsbuildinfo +1 -0
- package/distHelpers/add_event_generator_object.d.ts +3 -3
- package/distHelpers/add_event_generator_object.js +64 -64
- package/distHelpers/alarms_and_conditions_demo.d.ts +9 -9
- package/distHelpers/alarms_and_conditions_demo.js +115 -115
- package/distHelpers/assertHasMatchingReference.d.ts +19 -19
- package/distHelpers/assertHasMatchingReference.js +40 -40
- package/distHelpers/boiler_system.d.ts +113 -113
- package/distHelpers/boiler_system.js +395 -395
- package/distHelpers/create_minimalist_address_space_nodeset.d.ts +5 -5
- package/distHelpers/create_minimalist_address_space_nodeset.js +171 -171
- package/distHelpers/date_utils.d.ts +3 -3
- package/distHelpers/date_utils.js +9 -9
- package/distHelpers/dump_statemachine.js +127 -127
- package/distHelpers/get_address_space_fixture.d.ts +1 -1
- package/distHelpers/get_address_space_fixture.js +30 -30
- package/distHelpers/get_mini_address_space.d.ts +7 -7
- package/distHelpers/get_mini_address_space.js +36 -36
- package/distHelpers/index.d.ts +12 -12
- package/distHelpers/index.js +28 -28
- package/distHelpers/mock_session.d.ts +10 -10
- package/distHelpers/mock_session.js +25 -25
- package/distNodeJS/generate_address_space.d.ts +6 -6
- package/distNodeJS/generate_address_space.js +52 -52
- package/distNodeJS/index.d.ts +1 -1
- package/distNodeJS/index.js +17 -17
- package/package.json +51 -40
- package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +4 -3
- package/src/alarms_and_conditions/ua_condition_impl.ts +14 -9
- package/src/base_node_private.ts +73 -28
- package/src/ua_variable_type_impl.ts +35 -17
- package/.mocharc.yml +0 -12
- package/dist/src/tool_isSupertypeOf.d.ts +0 -18
- package/dist/src/tool_isSupertypeOf.js +0 -125
- package/dist/src/tool_isSupertypeOf.js.map +0 -1
- package/generate.js +0 -1
- package/source_nodejs/generate_address_space.ts +0 -60
- package/source_nodejs/index.ts +0 -1
- package/test_helpers/add_event_generator_object.ts +0 -71
- package/test_helpers/alarms_and_conditions_demo.ts +0 -151
- package/test_helpers/assertHasMatchingReference.ts +0 -43
- package/test_helpers/boiler_system.ts +0 -610
- package/test_helpers/create_minimalist_address_space_nodeset.ts +0 -208
- package/test_helpers/date_utils.ts +0 -5
- package/test_helpers/dump_statemachine.ts +0 -155
- package/test_helpers/get_address_space_fixture.ts +0 -30
- package/test_helpers/get_mini_address_space.ts +0 -42
- package/test_helpers/index.ts +0 -12
- package/test_helpers/mock_session.ts +0 -34
- package/test_helpers/test_fixtures/dataType_in_separateNamespace.xml +0 -150
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_basic.xml +0 -57
- package/test_helpers/test_fixtures/dataType_in_separateNamespace_mix.xml +0 -136
- package/test_helpers/test_fixtures/dataType_issue.xml +0 -80
- package/test_helpers/test_fixtures/dataType_withEnumeration.xml +0 -82
- package/test_helpers/test_fixtures/dataType_with_isOptionSet.xml +0 -194
- package/test_helpers/test_fixtures/dataType_with_qualifiedname.xml +0 -71
- package/test_helpers/test_fixtures/dataType_with_recursive_structure.xml +0 -155
- package/test_helpers/test_fixtures/dataType_with_structures.xml +0 -605
- package/test_helpers/test_fixtures/dataType_with_union.xml +0 -90
- package/test_helpers/test_fixtures/datatype_as_per_1.04.xml +0 -118
- package/test_helpers/test_fixtures/datatype_with_allow_subtype.xml +0 -104
- package/test_helpers/test_fixtures/eurange_issue.xml +0 -74
- package/test_helpers/test_fixtures/example_issue1096.xml +0 -267
- package/test_helpers/test_fixtures/fixture_empty_nodeset2.xml +0 -106
- package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +0 -1305
- package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +0 -370
- package/test_helpers/test_fixtures/issue_1132_variable_with_nodeid_value.xml +0 -68
- package/test_helpers/test_fixtures/issue_846.xml +0 -3172
- package/test_helpers/test_fixtures/issue_899_variable_with_nodeid_value.xml +0 -33
- package/test_helpers/test_fixtures/mini.Node.Set2.xml +0 -4736
- package/test_helpers/test_fixtures/mini.nodeset.withVariousVariables.xml +0 -196
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models.xml +0 -8
- package/test_helpers/test_fixtures/minimalist_nodeset_with_models_more_complex.xml +0 -20
- package/test_helpers/test_fixtures/nodeset_no_aliases.xml +0 -30
- package/test_helpers/test_fixtures/nodeset_no_aliases_with_aliases.xml +0 -31
- package/test_helpers/test_fixtures/nodeset_with_analog_items.xml +0 -45
- package/test_helpers/test_fixtures/nodeset_with_guid.xml +0 -1442
- package/test_helpers/test_fixtures/nodeset_with_int64_values.xml +0 -31
- package/test_helpers/test_fixtures/nodeset_with_special_char.xml +0 -34
- package/test_helpers/test_fixtures/nodeset_with_utf8_special_characters.xml +0 -20
- package/test_helpers/test_fixtures/variable_with_value.xml +0 -143
- package/test_helpers/test_fixtures/variabletype_with_value.xml +0 -324
|
@@ -1,804 +1,833 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseNode_add_backward_reference = exports.BaseNode_remove_backward_reference = exports._constructReferenceDescription = exports._handle_HierarchicalReference = exports._clone = exports._clone_non_hierarchical_references = exports.
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-address-space.Private
|
|
6
|
-
*/
|
|
7
|
-
// tslint:disable:no-bitwise
|
|
8
|
-
const chalk = require("chalk");
|
|
9
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
10
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
11
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
12
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
13
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
14
|
-
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
15
|
-
const namespace_private_1 = require("./namespace_private");
|
|
16
|
-
const reference_impl_1 = require("./reference_impl");
|
|
17
|
-
const base_node_impl_1 = require("./base_node_impl");
|
|
18
|
-
const tool_isSubtypeOf_1 = require("./tool_isSubtypeOf");
|
|
19
|
-
// eslint-disable-next-line prefer-const
|
|
20
|
-
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
21
|
-
const doTrace = (0, node_opcua_debug_1.checkDebugFlag)("INSTANTIATE");
|
|
22
|
-
const traceLog = errorLog;
|
|
23
|
-
const g_weakMap = new WeakMap();
|
|
24
|
-
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
25
|
-
function BaseNode_initPrivate(self) {
|
|
26
|
-
const _private = {
|
|
27
|
-
__address_space: null,
|
|
28
|
-
_referenceIdx: {},
|
|
29
|
-
_back_referenceIdx: {},
|
|
30
|
-
_browseFilter: undefined,
|
|
31
|
-
_cache: {},
|
|
32
|
-
_description: undefined,
|
|
33
|
-
_displayName: [],
|
|
34
|
-
_parent: undefined,
|
|
35
|
-
_subtype_idx: {},
|
|
36
|
-
_subtype_idxVersion: 0
|
|
37
|
-
};
|
|
38
|
-
g_weakMap.set(self, _private);
|
|
39
|
-
return _private;
|
|
40
|
-
}
|
|
41
|
-
exports.BaseNode_initPrivate = BaseNode_initPrivate;
|
|
42
|
-
function BaseNode_removePrivate(self) {
|
|
43
|
-
// there is no need to delete object from weak map
|
|
44
|
-
// the GC will take care of this in due course
|
|
45
|
-
// g_weakMap.delete(self);
|
|
46
|
-
const _private = BaseNode_getPrivate(self);
|
|
47
|
-
_private._cache = {};
|
|
48
|
-
_private.__address_space = null;
|
|
49
|
-
_private._back_referenceIdx = {};
|
|
50
|
-
_private._referenceIdx = {};
|
|
51
|
-
_private._description = undefined;
|
|
52
|
-
_private._displayName = [];
|
|
53
|
-
}
|
|
54
|
-
exports.BaseNode_removePrivate = BaseNode_removePrivate;
|
|
55
|
-
function BaseNode_getPrivate(self) {
|
|
56
|
-
return g_weakMap.get(self);
|
|
57
|
-
}
|
|
58
|
-
exports.BaseNode_getPrivate = BaseNode_getPrivate;
|
|
59
|
-
function BaseNode_getCache(node) {
|
|
60
|
-
return BaseNode_getPrivate(node)._cache;
|
|
61
|
-
}
|
|
62
|
-
exports.BaseNode_getCache = BaseNode_getCache;
|
|
63
|
-
function BaseNode_clearCache(node) {
|
|
64
|
-
const _private = BaseNode_getPrivate(node);
|
|
65
|
-
if (_private && _private._cache) {
|
|
66
|
-
_private._cache = {};
|
|
67
|
-
}
|
|
68
|
-
(0, tool_isSubtypeOf_1.wipeMemorizedStuff)(node);
|
|
69
|
-
}
|
|
70
|
-
exports.BaseNode_clearCache = BaseNode_clearCache;
|
|
71
|
-
const hasTypeDefinition_ReferenceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("HasTypeDefinition");
|
|
72
|
-
class ToStringBuilder {
|
|
73
|
-
constructor() {
|
|
74
|
-
this.level = 0;
|
|
75
|
-
this.cycleDetector = {};
|
|
76
|
-
this.padding = "";
|
|
77
|
-
this.str = [];
|
|
78
|
-
//
|
|
79
|
-
this.str = [];
|
|
80
|
-
}
|
|
81
|
-
add(line) {
|
|
82
|
-
this.str.push(line);
|
|
83
|
-
}
|
|
84
|
-
toString() {
|
|
85
|
-
return this.str.join("\n");
|
|
86
|
-
}
|
|
87
|
-
indent(str, padding) {
|
|
88
|
-
padding = padding || " ";
|
|
89
|
-
return str
|
|
90
|
-
.split("\n")
|
|
91
|
-
.map((r) => {
|
|
92
|
-
return padding + r;
|
|
93
|
-
})
|
|
94
|
-
.join("\n");
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.ToStringBuilder = ToStringBuilder;
|
|
98
|
-
function set_as_processed(options, nodeId) {
|
|
99
|
-
options.cycleDetector[nodeId.toString()] = nodeId;
|
|
100
|
-
}
|
|
101
|
-
function is_already_processed(options, nodeId) {
|
|
102
|
-
return !!options.cycleDetector[nodeId.toString()];
|
|
103
|
-
}
|
|
104
|
-
function BaseNode_toString(options) {
|
|
105
|
-
options.level = options.level || 1;
|
|
106
|
-
set_as_processed(options, this.nodeId);
|
|
107
|
-
options.add("");
|
|
108
|
-
options.add(options.padding + chalk.yellow(" nodeId : ") + this.nodeId.toString());
|
|
109
|
-
options.add(options.padding + chalk.yellow(" nodeClass : ") + node_opcua_data_model_1.NodeClass[this.nodeClass] + " (" + this.nodeClass + ")");
|
|
110
|
-
options.add(options.padding + chalk.yellow(" browseName : ") + this.browseName.toString());
|
|
111
|
-
options.add(options.padding +
|
|
112
|
-
chalk.yellow(" displayName : ") +
|
|
113
|
-
this.displayName.map((f) => f.locale + " " + f.text).join(" | "));
|
|
114
|
-
options.add(options.padding + chalk.yellow(" description : ") + (this.description ? this.description.toString() : ""));
|
|
115
|
-
}
|
|
116
|
-
exports.BaseNode_toString = BaseNode_toString;
|
|
117
|
-
function BaseNode_References_toString(options) {
|
|
118
|
-
const _private = BaseNode_getPrivate(this);
|
|
119
|
-
const displayOptions = {
|
|
120
|
-
addressSpace: this.addressSpace
|
|
121
|
-
};
|
|
122
|
-
const addressSpace = this.addressSpace;
|
|
123
|
-
options.add(options.padding +
|
|
124
|
-
chalk.yellow(" references : ") +
|
|
125
|
-
" length =" +
|
|
126
|
-
Object.keys(_private._referenceIdx).length);
|
|
127
|
-
function dump_reference(follow, reference) {
|
|
128
|
-
if (!reference) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const o = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
132
|
-
if (!o) {
|
|
133
|
-
warningLog("cannot find referece", reference.toString());
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const name = o.browseName.toString();
|
|
137
|
-
const modellingRule = o.modellingRule || " ";
|
|
138
|
-
const extra = modellingRule[0] +
|
|
139
|
-
(() => {
|
|
140
|
-
switch (o.nodeClass) {
|
|
141
|
-
case node_opcua_data_model_1.NodeClass.Object:
|
|
142
|
-
return "[O] ";
|
|
143
|
-
case node_opcua_data_model_1.NodeClass.Variable:
|
|
144
|
-
return "[V] " + o.dataType.toString(displayOptions).padEnd(10);
|
|
145
|
-
case node_opcua_data_model_1.NodeClass.Method:
|
|
146
|
-
return "[M] ";
|
|
147
|
-
case node_opcua_data_model_1.NodeClass.DataType:
|
|
148
|
-
return "[DT]";
|
|
149
|
-
case node_opcua_data_model_1.NodeClass.ReferenceType:
|
|
150
|
-
return "[RT]";
|
|
151
|
-
case node_opcua_data_model_1.NodeClass.ObjectType:
|
|
152
|
-
return "[OT]";
|
|
153
|
-
case node_opcua_data_model_1.NodeClass.VariableType:
|
|
154
|
-
return "[VT]";
|
|
155
|
-
case node_opcua_data_model_1.NodeClass.View:
|
|
156
|
-
return "[V] ";
|
|
157
|
-
}
|
|
158
|
-
return "";
|
|
159
|
-
})();
|
|
160
|
-
options.add(options.padding +
|
|
161
|
-
chalk.yellow(" +-> ") +
|
|
162
|
-
reference.toString(displayOptions) +
|
|
163
|
-
" " +
|
|
164
|
-
chalk.cyan(name.padEnd(25, " ")) +
|
|
165
|
-
" " +
|
|
166
|
-
chalk.magentaBright(extra));
|
|
167
|
-
// ignore HasTypeDefinition as it has been already handled
|
|
168
|
-
if ((0, node_opcua_nodeid_1.sameNodeId)(reference.referenceType, hasTypeDefinition_ReferenceTypeNodeId) && reference.nodeId.namespace === 0) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (o) {
|
|
172
|
-
if (!is_already_processed(options, o.nodeId)) {
|
|
173
|
-
set_as_processed(options, o.nodeId);
|
|
174
|
-
if (options.level > 1 && follow) {
|
|
175
|
-
const rr = o.toString({
|
|
176
|
-
cycleDetector: options.cycleDetector,
|
|
177
|
-
level: options.level - 1,
|
|
178
|
-
padding: options.padding + " "
|
|
179
|
-
});
|
|
180
|
-
options.add(rr);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// direct reference
|
|
186
|
-
Object.values(_private._referenceIdx).forEach(dump_reference.bind(null, true));
|
|
187
|
-
const br = Object.values(_private._back_referenceIdx).map((x) => x);
|
|
188
|
-
options.add(options.padding +
|
|
189
|
-
chalk.yellow(" back_references : ") +
|
|
190
|
-
chalk.cyan(" length =") +
|
|
191
|
-
br.length +
|
|
192
|
-
chalk.grey(" ( references held by other nodes involving this node)"));
|
|
193
|
-
// backward reference
|
|
194
|
-
br.forEach(dump_reference.bind(null, false));
|
|
195
|
-
}
|
|
196
|
-
exports.BaseNode_References_toString = BaseNode_References_toString;
|
|
197
|
-
function _UAType_toString(options) {
|
|
198
|
-
if (this.subtypeOfObj) {
|
|
199
|
-
options.add(options.padding +
|
|
200
|
-
chalk.yellow(" subtypeOf : ") +
|
|
201
|
-
this.subtypeOfObj.browseName.toString() +
|
|
202
|
-
" (" +
|
|
203
|
-
this.subtypeOfObj.nodeId.toString() +
|
|
204
|
-
")");
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function _UAInstance_toString(options) {
|
|
208
|
-
if (this.typeDefinitionObj) {
|
|
209
|
-
options.add(options.padding +
|
|
210
|
-
chalk.yellow(" typeDefinition : ") +
|
|
211
|
-
this.typeDefinitionObj.browseName.toString() +
|
|
212
|
-
" (" +
|
|
213
|
-
this.typeDefinitionObj.nodeId.toString() +
|
|
214
|
-
")");
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
function UAVariableType_toString(options) {
|
|
218
|
-
BaseNode_toString.call(this, options);
|
|
219
|
-
_UAType_toString.call(this, options);
|
|
220
|
-
VariableOrVariableType_toString.call(this, options);
|
|
221
|
-
BaseNode_References_toString.call(this, options);
|
|
222
|
-
}
|
|
223
|
-
exports.UAVariableType_toString = UAVariableType_toString;
|
|
224
|
-
function UAVariable_toString(options) {
|
|
225
|
-
BaseNode_toString.call(this, options);
|
|
226
|
-
_UAInstance_toString.call(this, options);
|
|
227
|
-
VariableOrVariableType_toString.call(this, options);
|
|
228
|
-
AccessLevelFlags_toString.call(this, options);
|
|
229
|
-
BaseNode_References_toString.call(this, options);
|
|
230
|
-
}
|
|
231
|
-
exports.UAVariable_toString = UAVariable_toString;
|
|
232
|
-
function UAObject_toString(options) {
|
|
233
|
-
BaseNode_toString.call(this, options);
|
|
234
|
-
_UAInstance_toString.call(this, options);
|
|
235
|
-
BaseNode_References_toString.call(this, options);
|
|
236
|
-
}
|
|
237
|
-
exports.UAObject_toString = UAObject_toString;
|
|
238
|
-
function UAObjectType_toString(options) {
|
|
239
|
-
BaseNode_toString.call(this, options);
|
|
240
|
-
_UAType_toString.call(this, options);
|
|
241
|
-
BaseNode_References_toString.call(this, options);
|
|
242
|
-
}
|
|
243
|
-
exports.UAObjectType_toString = UAObjectType_toString;
|
|
244
|
-
function valueRankToString(valueRank) {
|
|
245
|
-
switch (valueRank) {
|
|
246
|
-
case 1:
|
|
247
|
-
return "OneDimension (1)";
|
|
248
|
-
case 0:
|
|
249
|
-
return "OneOrMoreDimensions (0)"; // The value is an array with one or more dimensions
|
|
250
|
-
case -1:
|
|
251
|
-
return "Scalar (-1)";
|
|
252
|
-
case -2:
|
|
253
|
-
return "Any (-2)"; // The value can be a scalar or an array with any number of dimensions
|
|
254
|
-
case -3:
|
|
255
|
-
return "ScalarOrOneDimension (2)"; // The value can be a scalar or a one dimensional array.
|
|
256
|
-
default:
|
|
257
|
-
if (valueRank > 0) {
|
|
258
|
-
return "" + valueRank + "-Dimensions";
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
return "Invalid (" + valueRank + ")";
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
exports.valueRankToString = valueRankToString;
|
|
266
|
-
function accessLevelFlagToString(flag) {
|
|
267
|
-
const str = [];
|
|
268
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.CurrentRead) {
|
|
269
|
-
str.push("CurrentRead");
|
|
270
|
-
}
|
|
271
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.CurrentWrite) {
|
|
272
|
-
str.push("CurrentWrite");
|
|
273
|
-
}
|
|
274
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.HistoryRead) {
|
|
275
|
-
str.push("HistoryRead");
|
|
276
|
-
}
|
|
277
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.HistoryWrite) {
|
|
278
|
-
str.push("HistoryWrite");
|
|
279
|
-
}
|
|
280
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.SemanticChange) {
|
|
281
|
-
str.push("SemanticChange");
|
|
282
|
-
}
|
|
283
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.StatusWrite) {
|
|
284
|
-
str.push("StatusWrite");
|
|
285
|
-
}
|
|
286
|
-
if (flag & node_opcua_data_model_1.AccessLevelFlag.TimestampWrite) {
|
|
287
|
-
str.push("TimestampWrite");
|
|
288
|
-
}
|
|
289
|
-
return str.join(" | ");
|
|
290
|
-
}
|
|
291
|
-
function AccessLevelFlags_toString(options) {
|
|
292
|
-
(0, node_opcua_assert_1.assert)(options);
|
|
293
|
-
options.add(options.padding + chalk.yellow(" accessLevel : ") + " " + accessLevelFlagToString(this.accessLevel));
|
|
294
|
-
if (this.userAccessLevel !== undefined) {
|
|
295
|
-
options.add(options.padding + chalk.yellow(" userAccessLevel : ") + " " + accessLevelFlagToString(this.userAccessLevel));
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function VariableOrVariableType_toString(options) {
|
|
299
|
-
(0, node_opcua_assert_1.assert)(options);
|
|
300
|
-
if (this.dataType) {
|
|
301
|
-
const addressSpace = this.addressSpace;
|
|
302
|
-
const d = addressSpace.findNode(this.dataType);
|
|
303
|
-
const n = d ? "(" + d.browseName.toString() + ")" : " (???)";
|
|
304
|
-
options.add(options.padding + chalk.yellow(" dataType : ") + this.dataType + " " + n);
|
|
305
|
-
}
|
|
306
|
-
if (this.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
307
|
-
const _dataValue = this.$dataValue;
|
|
308
|
-
if (_dataValue) {
|
|
309
|
-
options.add(options.padding +
|
|
310
|
-
chalk.yellow(" value : ") +
|
|
311
|
-
"\n" +
|
|
312
|
-
options.indent(_dataValue.toString(), options.padding + " | "));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (Object.prototype.hasOwnProperty.call(this, "valueRank")) {
|
|
316
|
-
if (this.valueRank !== undefined) {
|
|
317
|
-
options.add(options.padding + chalk.yellow(" valueRank : ") + " " + valueRankToString(this.valueRank));
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
options.add(options.padding + chalk.yellow(" valueRank : ") + " undefined");
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (this.minimumSamplingInterval !== undefined) {
|
|
324
|
-
options.add(options.padding +
|
|
325
|
-
chalk.yellow(" minimumSamplingInterval : ") +
|
|
326
|
-
" " +
|
|
327
|
-
this.minimumSamplingInterval.toString() +
|
|
328
|
-
" ms");
|
|
329
|
-
}
|
|
330
|
-
if (this.arrayDimensions) {
|
|
331
|
-
options.add(options.padding +
|
|
332
|
-
chalk.yellow(" arrayDimension : ") +
|
|
333
|
-
" [" +
|
|
334
|
-
this.arrayDimensions.join(",").toString() +
|
|
335
|
-
" ]");
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
exports.VariableOrVariableType_toString = VariableOrVariableType_toString;
|
|
339
|
-
const defaultExtraInfo = {
|
|
340
|
-
level: 0,
|
|
341
|
-
pad() {
|
|
342
|
-
return "";
|
|
343
|
-
},
|
|
344
|
-
registerClonedObject(node, node1) {
|
|
345
|
-
/** */
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
/**
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* MyDeriveType ------------------- -> MyBaseType --------------> TopologyElementType
|
|
352
|
-
* | | |
|
|
353
|
-
* +- ParamaterSet +-> ParameterSet +-> ParamaterSet
|
|
354
|
-
* | |
|
|
355
|
-
* +- Foo1 |
|
|
356
|
-
* +- Bar
|
|
357
|
-
*
|
|
358
|
-
* Instance
|
|
359
|
-
*
|
|
360
|
-
* @param newParent
|
|
361
|
-
* @param node
|
|
362
|
-
* @param copyAlsoModellingRules
|
|
363
|
-
* @param optionalFilter
|
|
364
|
-
* @param extraInfo
|
|
365
|
-
* @param browseNameMap
|
|
366
|
-
* @returns
|
|
367
|
-
*/
|
|
368
|
-
function _clone_children_on_template(nodeToClone, newParent, node, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
369
|
-
/**
|
|
370
|
-
* the type definition node of the node to clone
|
|
371
|
-
*/
|
|
372
|
-
const nodeToCloneTypeDefinition = nodeToClone.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType || nodeToClone.nodeClass === node_opcua_data_model_1.NodeClass.VariableType
|
|
373
|
-
? nodeToClone.subtypeOfObj
|
|
374
|
-
: null;
|
|
375
|
-
if (!nodeToCloneTypeDefinition)
|
|
376
|
-
return;
|
|
377
|
-
doTrace &&
|
|
378
|
-
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- now cloning children on template ", node.browseName.toString(), node.nodeId.toString(), nodeToCloneTypeDefinition.browseName.toString()));
|
|
379
|
-
const namespace = newParent.namespace;
|
|
380
|
-
/**
|
|
381
|
-
* the child node of the new parent that match the node to clone or enrich
|
|
382
|
-
*/
|
|
383
|
-
const newParentChild = newParent.getChildByName(node.browseName);
|
|
384
|
-
if (!newParentChild) {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
// we have found a matching child on the new parent.
|
|
388
|
-
// the mission is to enrich this child node with
|
|
389
|
-
//
|
|
390
|
-
let typeDefinitionNode = nodeToCloneTypeDefinition;
|
|
391
|
-
while (typeDefinitionNode) {
|
|
392
|
-
doTrace &&
|
|
393
|
-
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- now cloning children on ", newParentChild.browseName.toString(), newParentChild.nodeId.toString(), " (child of ", node.browseName.toString(), node.nodeId.toString(), ") from ", typeDefinitionNode.browseName.toString()));
|
|
394
|
-
const typeDefinitionChild = typeDefinitionNode.getChildByName(node.browseName);
|
|
395
|
-
if (typeDefinitionChild) {
|
|
396
|
-
const references = typeDefinitionChild.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
397
|
-
for (const ref of references) {
|
|
398
|
-
const grandChild = ref.node;
|
|
399
|
-
if (grandChild.modellingRule === "MandatoryPlaceholder" || grandChild.modellingRule === "OptionalPlaceholder")
|
|
400
|
-
continue;
|
|
401
|
-
// if not already node present in new Parent => just ignore
|
|
402
|
-
const hasAlready = newParentChild.getChildByName(grandChild.browseName) !== null;
|
|
403
|
-
if (!hasAlready) {
|
|
404
|
-
if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
|
|
405
|
-
doTrace &&
|
|
406
|
-
traceLog(extraInfo.pad(), "skipping optional ", node.browseName.toString(), "that doesn't appear in the filter");
|
|
407
|
-
continue; // skip this node
|
|
408
|
-
}
|
|
409
|
-
const options = {
|
|
410
|
-
namespace,
|
|
411
|
-
references: [
|
|
412
|
-
new reference_impl_1.ReferenceImpl({
|
|
413
|
-
referenceType: ref.referenceType,
|
|
414
|
-
isForward: false,
|
|
415
|
-
nodeId: newParentChild.nodeId
|
|
416
|
-
})
|
|
417
|
-
],
|
|
418
|
-
copyAlsoModellingRules
|
|
419
|
-
};
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
(0, node_opcua_assert_1.assert)(
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
if (
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseNode_add_backward_reference = exports.BaseNode_remove_backward_reference = exports._constructReferenceDescription = exports._handle_HierarchicalReference = exports._clone = exports._clone_non_hierarchical_references = exports._clone_hierarchical_references = exports.VariableOrVariableType_toString = exports.valueRankToString = exports.UAObjectType_toString = exports.UAObject_toString = exports.UAVariable_toString = exports.UAVariableType_toString = exports.BaseNode_References_toString = exports.BaseNode_toString = exports.ToStringBuilder = exports.BaseNode_clearCache = exports.BaseNode_getCache = exports.BaseNode_getPrivate = exports.BaseNode_removePrivate = exports.BaseNode_initPrivate = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-address-space.Private
|
|
6
|
+
*/
|
|
7
|
+
// tslint:disable:no-bitwise
|
|
8
|
+
const chalk = require("chalk");
|
|
9
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
10
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
11
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
12
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
13
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
14
|
+
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
15
|
+
const namespace_private_1 = require("./namespace_private");
|
|
16
|
+
const reference_impl_1 = require("./reference_impl");
|
|
17
|
+
const base_node_impl_1 = require("./base_node_impl");
|
|
18
|
+
const tool_isSubtypeOf_1 = require("./tool_isSubtypeOf");
|
|
19
|
+
// eslint-disable-next-line prefer-const
|
|
20
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
21
|
+
const doTrace = (0, node_opcua_debug_1.checkDebugFlag)("INSTANTIATE");
|
|
22
|
+
const traceLog = errorLog;
|
|
23
|
+
const g_weakMap = new WeakMap();
|
|
24
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
25
|
+
function BaseNode_initPrivate(self) {
|
|
26
|
+
const _private = {
|
|
27
|
+
__address_space: null,
|
|
28
|
+
_referenceIdx: {},
|
|
29
|
+
_back_referenceIdx: {},
|
|
30
|
+
_browseFilter: undefined,
|
|
31
|
+
_cache: {},
|
|
32
|
+
_description: undefined,
|
|
33
|
+
_displayName: [],
|
|
34
|
+
_parent: undefined,
|
|
35
|
+
_subtype_idx: {},
|
|
36
|
+
_subtype_idxVersion: 0
|
|
37
|
+
};
|
|
38
|
+
g_weakMap.set(self, _private);
|
|
39
|
+
return _private;
|
|
40
|
+
}
|
|
41
|
+
exports.BaseNode_initPrivate = BaseNode_initPrivate;
|
|
42
|
+
function BaseNode_removePrivate(self) {
|
|
43
|
+
// there is no need to delete object from weak map
|
|
44
|
+
// the GC will take care of this in due course
|
|
45
|
+
// g_weakMap.delete(self);
|
|
46
|
+
const _private = BaseNode_getPrivate(self);
|
|
47
|
+
_private._cache = {};
|
|
48
|
+
_private.__address_space = null;
|
|
49
|
+
_private._back_referenceIdx = {};
|
|
50
|
+
_private._referenceIdx = {};
|
|
51
|
+
_private._description = undefined;
|
|
52
|
+
_private._displayName = [];
|
|
53
|
+
}
|
|
54
|
+
exports.BaseNode_removePrivate = BaseNode_removePrivate;
|
|
55
|
+
function BaseNode_getPrivate(self) {
|
|
56
|
+
return g_weakMap.get(self);
|
|
57
|
+
}
|
|
58
|
+
exports.BaseNode_getPrivate = BaseNode_getPrivate;
|
|
59
|
+
function BaseNode_getCache(node) {
|
|
60
|
+
return BaseNode_getPrivate(node)._cache;
|
|
61
|
+
}
|
|
62
|
+
exports.BaseNode_getCache = BaseNode_getCache;
|
|
63
|
+
function BaseNode_clearCache(node) {
|
|
64
|
+
const _private = BaseNode_getPrivate(node);
|
|
65
|
+
if (_private && _private._cache) {
|
|
66
|
+
_private._cache = {};
|
|
67
|
+
}
|
|
68
|
+
(0, tool_isSubtypeOf_1.wipeMemorizedStuff)(node);
|
|
69
|
+
}
|
|
70
|
+
exports.BaseNode_clearCache = BaseNode_clearCache;
|
|
71
|
+
const hasTypeDefinition_ReferenceTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("HasTypeDefinition");
|
|
72
|
+
class ToStringBuilder {
|
|
73
|
+
constructor() {
|
|
74
|
+
this.level = 0;
|
|
75
|
+
this.cycleDetector = {};
|
|
76
|
+
this.padding = "";
|
|
77
|
+
this.str = [];
|
|
78
|
+
//
|
|
79
|
+
this.str = [];
|
|
80
|
+
}
|
|
81
|
+
add(line) {
|
|
82
|
+
this.str.push(line);
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
return this.str.join("\n");
|
|
86
|
+
}
|
|
87
|
+
indent(str, padding) {
|
|
88
|
+
padding = padding || " ";
|
|
89
|
+
return str
|
|
90
|
+
.split("\n")
|
|
91
|
+
.map((r) => {
|
|
92
|
+
return padding + r;
|
|
93
|
+
})
|
|
94
|
+
.join("\n");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.ToStringBuilder = ToStringBuilder;
|
|
98
|
+
function set_as_processed(options, nodeId) {
|
|
99
|
+
options.cycleDetector[nodeId.toString()] = nodeId;
|
|
100
|
+
}
|
|
101
|
+
function is_already_processed(options, nodeId) {
|
|
102
|
+
return !!options.cycleDetector[nodeId.toString()];
|
|
103
|
+
}
|
|
104
|
+
function BaseNode_toString(options) {
|
|
105
|
+
options.level = options.level || 1;
|
|
106
|
+
set_as_processed(options, this.nodeId);
|
|
107
|
+
options.add("");
|
|
108
|
+
options.add(options.padding + chalk.yellow(" nodeId : ") + this.nodeId.toString());
|
|
109
|
+
options.add(options.padding + chalk.yellow(" nodeClass : ") + node_opcua_data_model_1.NodeClass[this.nodeClass] + " (" + this.nodeClass + ")");
|
|
110
|
+
options.add(options.padding + chalk.yellow(" browseName : ") + this.browseName.toString());
|
|
111
|
+
options.add(options.padding +
|
|
112
|
+
chalk.yellow(" displayName : ") +
|
|
113
|
+
this.displayName.map((f) => f.locale + " " + f.text).join(" | "));
|
|
114
|
+
options.add(options.padding + chalk.yellow(" description : ") + (this.description ? this.description.toString() : ""));
|
|
115
|
+
}
|
|
116
|
+
exports.BaseNode_toString = BaseNode_toString;
|
|
117
|
+
function BaseNode_References_toString(options) {
|
|
118
|
+
const _private = BaseNode_getPrivate(this);
|
|
119
|
+
const displayOptions = {
|
|
120
|
+
addressSpace: this.addressSpace
|
|
121
|
+
};
|
|
122
|
+
const addressSpace = this.addressSpace;
|
|
123
|
+
options.add(options.padding +
|
|
124
|
+
chalk.yellow(" references : ") +
|
|
125
|
+
" length =" +
|
|
126
|
+
Object.keys(_private._referenceIdx).length);
|
|
127
|
+
function dump_reference(follow, reference) {
|
|
128
|
+
if (!reference) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const o = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
132
|
+
if (!o) {
|
|
133
|
+
warningLog("cannot find referece", reference.toString());
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const name = o.browseName.toString();
|
|
137
|
+
const modellingRule = o.modellingRule || " ";
|
|
138
|
+
const extra = modellingRule[0] +
|
|
139
|
+
(() => {
|
|
140
|
+
switch (o.nodeClass) {
|
|
141
|
+
case node_opcua_data_model_1.NodeClass.Object:
|
|
142
|
+
return "[O] ";
|
|
143
|
+
case node_opcua_data_model_1.NodeClass.Variable:
|
|
144
|
+
return "[V] " + o.dataType.toString(displayOptions).padEnd(10);
|
|
145
|
+
case node_opcua_data_model_1.NodeClass.Method:
|
|
146
|
+
return "[M] ";
|
|
147
|
+
case node_opcua_data_model_1.NodeClass.DataType:
|
|
148
|
+
return "[DT]";
|
|
149
|
+
case node_opcua_data_model_1.NodeClass.ReferenceType:
|
|
150
|
+
return "[RT]";
|
|
151
|
+
case node_opcua_data_model_1.NodeClass.ObjectType:
|
|
152
|
+
return "[OT]";
|
|
153
|
+
case node_opcua_data_model_1.NodeClass.VariableType:
|
|
154
|
+
return "[VT]";
|
|
155
|
+
case node_opcua_data_model_1.NodeClass.View:
|
|
156
|
+
return "[V] ";
|
|
157
|
+
}
|
|
158
|
+
return "";
|
|
159
|
+
})();
|
|
160
|
+
options.add(options.padding +
|
|
161
|
+
chalk.yellow(" +-> ") +
|
|
162
|
+
reference.toString(displayOptions) +
|
|
163
|
+
" " +
|
|
164
|
+
chalk.cyan(name.padEnd(25, " ")) +
|
|
165
|
+
" " +
|
|
166
|
+
chalk.magentaBright(extra));
|
|
167
|
+
// ignore HasTypeDefinition as it has been already handled
|
|
168
|
+
if ((0, node_opcua_nodeid_1.sameNodeId)(reference.referenceType, hasTypeDefinition_ReferenceTypeNodeId) && reference.nodeId.namespace === 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (o) {
|
|
172
|
+
if (!is_already_processed(options, o.nodeId)) {
|
|
173
|
+
set_as_processed(options, o.nodeId);
|
|
174
|
+
if (options.level > 1 && follow) {
|
|
175
|
+
const rr = o.toString({
|
|
176
|
+
cycleDetector: options.cycleDetector,
|
|
177
|
+
level: options.level - 1,
|
|
178
|
+
padding: options.padding + " "
|
|
179
|
+
});
|
|
180
|
+
options.add(rr);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// direct reference
|
|
186
|
+
Object.values(_private._referenceIdx).forEach(dump_reference.bind(null, true));
|
|
187
|
+
const br = Object.values(_private._back_referenceIdx).map((x) => x);
|
|
188
|
+
options.add(options.padding +
|
|
189
|
+
chalk.yellow(" back_references : ") +
|
|
190
|
+
chalk.cyan(" length =") +
|
|
191
|
+
br.length +
|
|
192
|
+
chalk.grey(" ( references held by other nodes involving this node)"));
|
|
193
|
+
// backward reference
|
|
194
|
+
br.forEach(dump_reference.bind(null, false));
|
|
195
|
+
}
|
|
196
|
+
exports.BaseNode_References_toString = BaseNode_References_toString;
|
|
197
|
+
function _UAType_toString(options) {
|
|
198
|
+
if (this.subtypeOfObj) {
|
|
199
|
+
options.add(options.padding +
|
|
200
|
+
chalk.yellow(" subtypeOf : ") +
|
|
201
|
+
this.subtypeOfObj.browseName.toString() +
|
|
202
|
+
" (" +
|
|
203
|
+
this.subtypeOfObj.nodeId.toString() +
|
|
204
|
+
")");
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function _UAInstance_toString(options) {
|
|
208
|
+
if (this.typeDefinitionObj) {
|
|
209
|
+
options.add(options.padding +
|
|
210
|
+
chalk.yellow(" typeDefinition : ") +
|
|
211
|
+
this.typeDefinitionObj.browseName.toString() +
|
|
212
|
+
" (" +
|
|
213
|
+
this.typeDefinitionObj.nodeId.toString() +
|
|
214
|
+
")");
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function UAVariableType_toString(options) {
|
|
218
|
+
BaseNode_toString.call(this, options);
|
|
219
|
+
_UAType_toString.call(this, options);
|
|
220
|
+
VariableOrVariableType_toString.call(this, options);
|
|
221
|
+
BaseNode_References_toString.call(this, options);
|
|
222
|
+
}
|
|
223
|
+
exports.UAVariableType_toString = UAVariableType_toString;
|
|
224
|
+
function UAVariable_toString(options) {
|
|
225
|
+
BaseNode_toString.call(this, options);
|
|
226
|
+
_UAInstance_toString.call(this, options);
|
|
227
|
+
VariableOrVariableType_toString.call(this, options);
|
|
228
|
+
AccessLevelFlags_toString.call(this, options);
|
|
229
|
+
BaseNode_References_toString.call(this, options);
|
|
230
|
+
}
|
|
231
|
+
exports.UAVariable_toString = UAVariable_toString;
|
|
232
|
+
function UAObject_toString(options) {
|
|
233
|
+
BaseNode_toString.call(this, options);
|
|
234
|
+
_UAInstance_toString.call(this, options);
|
|
235
|
+
BaseNode_References_toString.call(this, options);
|
|
236
|
+
}
|
|
237
|
+
exports.UAObject_toString = UAObject_toString;
|
|
238
|
+
function UAObjectType_toString(options) {
|
|
239
|
+
BaseNode_toString.call(this, options);
|
|
240
|
+
_UAType_toString.call(this, options);
|
|
241
|
+
BaseNode_References_toString.call(this, options);
|
|
242
|
+
}
|
|
243
|
+
exports.UAObjectType_toString = UAObjectType_toString;
|
|
244
|
+
function valueRankToString(valueRank) {
|
|
245
|
+
switch (valueRank) {
|
|
246
|
+
case 1:
|
|
247
|
+
return "OneDimension (1)";
|
|
248
|
+
case 0:
|
|
249
|
+
return "OneOrMoreDimensions (0)"; // The value is an array with one or more dimensions
|
|
250
|
+
case -1:
|
|
251
|
+
return "Scalar (-1)";
|
|
252
|
+
case -2:
|
|
253
|
+
return "Any (-2)"; // The value can be a scalar or an array with any number of dimensions
|
|
254
|
+
case -3:
|
|
255
|
+
return "ScalarOrOneDimension (2)"; // The value can be a scalar or a one dimensional array.
|
|
256
|
+
default:
|
|
257
|
+
if (valueRank > 0) {
|
|
258
|
+
return "" + valueRank + "-Dimensions";
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
return "Invalid (" + valueRank + ")";
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.valueRankToString = valueRankToString;
|
|
266
|
+
function accessLevelFlagToString(flag) {
|
|
267
|
+
const str = [];
|
|
268
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.CurrentRead) {
|
|
269
|
+
str.push("CurrentRead");
|
|
270
|
+
}
|
|
271
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.CurrentWrite) {
|
|
272
|
+
str.push("CurrentWrite");
|
|
273
|
+
}
|
|
274
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.HistoryRead) {
|
|
275
|
+
str.push("HistoryRead");
|
|
276
|
+
}
|
|
277
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.HistoryWrite) {
|
|
278
|
+
str.push("HistoryWrite");
|
|
279
|
+
}
|
|
280
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.SemanticChange) {
|
|
281
|
+
str.push("SemanticChange");
|
|
282
|
+
}
|
|
283
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.StatusWrite) {
|
|
284
|
+
str.push("StatusWrite");
|
|
285
|
+
}
|
|
286
|
+
if (flag & node_opcua_data_model_1.AccessLevelFlag.TimestampWrite) {
|
|
287
|
+
str.push("TimestampWrite");
|
|
288
|
+
}
|
|
289
|
+
return str.join(" | ");
|
|
290
|
+
}
|
|
291
|
+
function AccessLevelFlags_toString(options) {
|
|
292
|
+
(0, node_opcua_assert_1.assert)(options);
|
|
293
|
+
options.add(options.padding + chalk.yellow(" accessLevel : ") + " " + accessLevelFlagToString(this.accessLevel));
|
|
294
|
+
if (this.userAccessLevel !== undefined) {
|
|
295
|
+
options.add(options.padding + chalk.yellow(" userAccessLevel : ") + " " + accessLevelFlagToString(this.userAccessLevel));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function VariableOrVariableType_toString(options) {
|
|
299
|
+
(0, node_opcua_assert_1.assert)(options);
|
|
300
|
+
if (this.dataType) {
|
|
301
|
+
const addressSpace = this.addressSpace;
|
|
302
|
+
const d = addressSpace.findNode(this.dataType);
|
|
303
|
+
const n = d ? "(" + d.browseName.toString() + ")" : " (???)";
|
|
304
|
+
options.add(options.padding + chalk.yellow(" dataType : ") + this.dataType + " " + n);
|
|
305
|
+
}
|
|
306
|
+
if (this.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
307
|
+
const _dataValue = this.$dataValue;
|
|
308
|
+
if (_dataValue) {
|
|
309
|
+
options.add(options.padding +
|
|
310
|
+
chalk.yellow(" value : ") +
|
|
311
|
+
"\n" +
|
|
312
|
+
options.indent(_dataValue.toString(), options.padding + " | "));
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (Object.prototype.hasOwnProperty.call(this, "valueRank")) {
|
|
316
|
+
if (this.valueRank !== undefined) {
|
|
317
|
+
options.add(options.padding + chalk.yellow(" valueRank : ") + " " + valueRankToString(this.valueRank));
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
options.add(options.padding + chalk.yellow(" valueRank : ") + " undefined");
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (this.minimumSamplingInterval !== undefined) {
|
|
324
|
+
options.add(options.padding +
|
|
325
|
+
chalk.yellow(" minimumSamplingInterval : ") +
|
|
326
|
+
" " +
|
|
327
|
+
this.minimumSamplingInterval.toString() +
|
|
328
|
+
" ms");
|
|
329
|
+
}
|
|
330
|
+
if (this.arrayDimensions) {
|
|
331
|
+
options.add(options.padding +
|
|
332
|
+
chalk.yellow(" arrayDimension : ") +
|
|
333
|
+
" [" +
|
|
334
|
+
this.arrayDimensions.join(",").toString() +
|
|
335
|
+
" ]");
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
exports.VariableOrVariableType_toString = VariableOrVariableType_toString;
|
|
339
|
+
const defaultExtraInfo = {
|
|
340
|
+
level: 0,
|
|
341
|
+
pad() {
|
|
342
|
+
return "";
|
|
343
|
+
},
|
|
344
|
+
registerClonedObject(node, node1) {
|
|
345
|
+
/** */
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
*
|
|
350
|
+
*
|
|
351
|
+
* MyDeriveType ------------------- -> MyBaseType --------------> TopologyElementType
|
|
352
|
+
* | | |
|
|
353
|
+
* +- ParamaterSet +-> ParameterSet +-> ParamaterSet
|
|
354
|
+
* | |
|
|
355
|
+
* +- Foo1 |
|
|
356
|
+
* +- Bar
|
|
357
|
+
*
|
|
358
|
+
* Instance
|
|
359
|
+
*
|
|
360
|
+
* @param newParent
|
|
361
|
+
* @param node
|
|
362
|
+
* @param copyAlsoModellingRules
|
|
363
|
+
* @param optionalFilter
|
|
364
|
+
* @param extraInfo
|
|
365
|
+
* @param browseNameMap
|
|
366
|
+
* @returns
|
|
367
|
+
*/
|
|
368
|
+
function _clone_children_on_template(nodeToClone, newParent, node, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
369
|
+
/**
|
|
370
|
+
* the type definition node of the node to clone
|
|
371
|
+
*/
|
|
372
|
+
const nodeToCloneTypeDefinition = nodeToClone.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType || nodeToClone.nodeClass === node_opcua_data_model_1.NodeClass.VariableType
|
|
373
|
+
? nodeToClone.subtypeOfObj
|
|
374
|
+
: null;
|
|
375
|
+
if (!nodeToCloneTypeDefinition)
|
|
376
|
+
return;
|
|
377
|
+
doTrace &&
|
|
378
|
+
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- now cloning children on template ", node.browseName.toString(), node.nodeId.toString(), nodeToCloneTypeDefinition.browseName.toString()));
|
|
379
|
+
const namespace = newParent.namespace;
|
|
380
|
+
/**
|
|
381
|
+
* the child node of the new parent that match the node to clone or enrich
|
|
382
|
+
*/
|
|
383
|
+
const newParentChild = newParent.getChildByName(node.browseName);
|
|
384
|
+
if (!newParentChild) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
// we have found a matching child on the new parent.
|
|
388
|
+
// the mission is to enrich this child node with components and properties that
|
|
389
|
+
// exist also in the template
|
|
390
|
+
let typeDefinitionNode = nodeToCloneTypeDefinition;
|
|
391
|
+
while (typeDefinitionNode) {
|
|
392
|
+
doTrace &&
|
|
393
|
+
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- now cloning children on ", newParentChild.browseName.toString(), newParentChild.nodeId.toString(), " (child of ", node.browseName.toString(), node.nodeId.toString(), ") from ", typeDefinitionNode.browseName.toString()));
|
|
394
|
+
const typeDefinitionChild = typeDefinitionNode.getChildByName(node.browseName);
|
|
395
|
+
if (typeDefinitionChild) {
|
|
396
|
+
const references = typeDefinitionChild.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
397
|
+
for (const ref of references) {
|
|
398
|
+
const grandChild = ref.node;
|
|
399
|
+
if (grandChild.modellingRule === "MandatoryPlaceholder" || grandChild.modellingRule === "OptionalPlaceholder")
|
|
400
|
+
continue;
|
|
401
|
+
// if not already node present in new Parent => just ignore
|
|
402
|
+
const hasAlready = newParentChild.getChildByName(grandChild.browseName) !== null;
|
|
403
|
+
if (!hasAlready) {
|
|
404
|
+
if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
|
|
405
|
+
doTrace &&
|
|
406
|
+
traceLog(extraInfo.pad(), "skipping optional ", node.browseName.toString(), "that doesn't appear in the filter");
|
|
407
|
+
continue; // skip this node
|
|
408
|
+
}
|
|
409
|
+
const options = {
|
|
410
|
+
namespace,
|
|
411
|
+
references: [
|
|
412
|
+
new reference_impl_1.ReferenceImpl({
|
|
413
|
+
referenceType: ref.referenceType,
|
|
414
|
+
isForward: false,
|
|
415
|
+
nodeId: newParentChild.nodeId
|
|
416
|
+
})
|
|
417
|
+
],
|
|
418
|
+
copyAlsoModellingRules
|
|
419
|
+
};
|
|
420
|
+
const alreadyCloned = extraInfo.getCloned(grandChild);
|
|
421
|
+
if (alreadyCloned) {
|
|
422
|
+
alreadyCloned.addReference({
|
|
423
|
+
referenceType: ref.referenceType,
|
|
424
|
+
isForward: false,
|
|
425
|
+
nodeId: newParentChild.nodeId
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
const a = grandChild.clone(options, optionalFilter, extraInfo);
|
|
430
|
+
extraInfo.registerClonedObject(a, grandChild);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* clone properties and methods
|
|
440
|
+
* @private
|
|
441
|
+
*/
|
|
442
|
+
function _clone_collection_new(nodeToClone, newParent, collectionRef, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
443
|
+
var _a;
|
|
444
|
+
const namespace = newParent.namespace;
|
|
445
|
+
extraInfo = extraInfo || defaultExtraInfo;
|
|
446
|
+
const addressSpace = newParent.addressSpace;
|
|
447
|
+
(0, node_opcua_assert_1.assert)(!optionalFilter || (typeof optionalFilter.shouldKeep === "function" && typeof optionalFilter.filterFor === "function"));
|
|
448
|
+
for (const reference of collectionRef) {
|
|
449
|
+
const node = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
450
|
+
// ensure node is of the correct type,
|
|
451
|
+
// it may happen that the xml nodeset2 file was malformed
|
|
452
|
+
// istanbul ignore next
|
|
453
|
+
if (typeof node.clone !== "function") {
|
|
454
|
+
// tslint:disable-next-line:no-console
|
|
455
|
+
warningLog(chalk.red("Warning : cannot clone node ") +
|
|
456
|
+
node.browseName.toString() +
|
|
457
|
+
" of class " +
|
|
458
|
+
node_opcua_data_model_1.NodeClass[node.nodeClass].toString() +
|
|
459
|
+
" while cloning " +
|
|
460
|
+
newParent.browseName.toString());
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
if (optionalFilter && node && !optionalFilter.shouldKeep(node)) {
|
|
464
|
+
doTrace &&
|
|
465
|
+
traceLog(extraInfo.pad(), "skipping optional ", node.browseName.toString(), "that doesn't appear in the filter");
|
|
466
|
+
continue; // skip this node
|
|
467
|
+
}
|
|
468
|
+
const key = node.browseName.toString();
|
|
469
|
+
if (browseNameMap === null || browseNameMap === void 0 ? void 0 : browseNameMap.has(key)) {
|
|
470
|
+
_clone_children_on_template(nodeToClone, newParent, node, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
471
|
+
continue; // skipping node with same browseName
|
|
472
|
+
}
|
|
473
|
+
browseNameMap === null || browseNameMap === void 0 ? void 0 : browseNameMap.add(key);
|
|
474
|
+
// assert(reference.isForward);
|
|
475
|
+
// assert(reference.referenceType instanceof NodeId, "" + reference.referenceType.toString());
|
|
476
|
+
const options = {
|
|
477
|
+
namespace,
|
|
478
|
+
references: [new reference_impl_1.ReferenceImpl({ referenceType: reference.referenceType, isForward: false, nodeId: newParent.nodeId })],
|
|
479
|
+
copyAlsoModellingRules
|
|
480
|
+
};
|
|
481
|
+
doTrace &&
|
|
482
|
+
traceLog(extraInfo.pad(), "cloning => ", reference.referenceType.toString({ addressSpace }), "=>", node.browseName.toString(), chalk.magentaBright((_a = node.typeDefinitionObj) === null || _a === void 0 ? void 0 : _a.browseName.toString()));
|
|
483
|
+
extraInfo.level += 4;
|
|
484
|
+
const alreadyCloned = extraInfo.getCloned(node);
|
|
485
|
+
if (alreadyCloned) {
|
|
486
|
+
alreadyCloned.addReference({
|
|
487
|
+
referenceType: reference.referenceType,
|
|
488
|
+
isForward: false,
|
|
489
|
+
nodeId: newParent.nodeId
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
const clone = node.clone(options, optionalFilter, extraInfo);
|
|
494
|
+
extraInfo.level -= 4;
|
|
495
|
+
doTrace && traceLog(extraInfo.pad(), "cloning => ", node.browseName.toString(), "nodeId", clone.nodeId.toString());
|
|
496
|
+
extraInfo.level++;
|
|
497
|
+
_clone_children_on_template(nodeToClone, newParent, node, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
498
|
+
extraInfo.level--;
|
|
499
|
+
// also clone or instantiate interface members that may be required in the optionals
|
|
500
|
+
extraInfo.level++;
|
|
501
|
+
_cloneInterface(nodeToClone, newParent, node, optionalFilter, extraInfo, browseNameMap);
|
|
502
|
+
extraInfo.level--;
|
|
503
|
+
extraInfo.registerClonedObject(node, clone);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function _extractInterfaces2(typeDefinitionNode, extraInfo) {
|
|
508
|
+
if (!typeDefinitionNode ||
|
|
509
|
+
(typeDefinitionNode.nodeId.namespace === 0 &&
|
|
510
|
+
(typeDefinitionNode.nodeId.value === node_opcua_constants_1.ObjectTypeIds.BaseObjectType ||
|
|
511
|
+
typeDefinitionNode.nodeId.value === node_opcua_constants_1.VariableTypeIds.BaseVariableType))) {
|
|
512
|
+
return [];
|
|
513
|
+
}
|
|
514
|
+
const addressSpace = typeDefinitionNode.addressSpace;
|
|
515
|
+
const hasInterfaceReference = addressSpace.findReferenceType("HasInterface");
|
|
516
|
+
if (!hasInterfaceReference) {
|
|
517
|
+
// this version of the standard UA namespace doesn't support Interface yet
|
|
518
|
+
return [];
|
|
519
|
+
}
|
|
520
|
+
// example:
|
|
521
|
+
// FolderType
|
|
522
|
+
// FunctionalGroupType
|
|
523
|
+
// MachineryItemIdentificationType : IMachineryItemVendorNameplateType
|
|
524
|
+
// MachineIdentificationType : IMachineTagNameplateType, IMachineVendorNamePlateType
|
|
525
|
+
// MachineToolIdentificationType
|
|
526
|
+
//
|
|
527
|
+
//
|
|
528
|
+
// IMachineTagNameplateType -subtypeOf-> ITagNameplateType
|
|
529
|
+
// IMachineVendorNamePlateType -subtypeOf-> IMachineryItemVendorNamePlateType
|
|
530
|
+
// IMachineryItemVendorNamePlateType -subtypeOf-> IVendorNameplateType
|
|
531
|
+
const interfacesRef = typeDefinitionNode.findReferencesEx("HasInterface", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
532
|
+
const interfaces = interfacesRef.map((r) => addressSpace.findNode(r.nodeId));
|
|
533
|
+
const baseInterfaces = [];
|
|
534
|
+
for (const iface of interfaces) {
|
|
535
|
+
doTrace &&
|
|
536
|
+
traceLog(extraInfo.pad(), typeDefinitionNode.browseName.toString(), " - has interface -> ", iface.browseName.toString());
|
|
537
|
+
baseInterfaces.push(iface);
|
|
538
|
+
if (iface.subtypeOfObj) {
|
|
539
|
+
extraInfo.level++;
|
|
540
|
+
baseInterfaces.push(..._extractInterfaces2(iface.subtypeOfObj, extraInfo));
|
|
541
|
+
extraInfo.level--;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
interfaces.push(...baseInterfaces);
|
|
545
|
+
if (typeDefinitionNode.subtypeOfObj) {
|
|
546
|
+
doTrace &&
|
|
547
|
+
traceLog(extraInfo.pad(), typeDefinitionNode.browseName.toString(), " - subtypef -> ", typeDefinitionNode.subtypeOfObj.browseName.toString());
|
|
548
|
+
extraInfo.level++;
|
|
549
|
+
interfaces.push(..._extractInterfaces2(typeDefinitionNode.subtypeOfObj, extraInfo));
|
|
550
|
+
extraInfo.level--;
|
|
551
|
+
}
|
|
552
|
+
const dedupedInterfaces = [...new Set(interfaces)];
|
|
553
|
+
doTrace &&
|
|
554
|
+
dedupedInterfaces.length &&
|
|
555
|
+
traceLog(extraInfo.pad(), chalk.yellow("Interface for ", typeDefinitionNode.browseName.toString()), "=", dedupedInterfaces.map((x) => x.browseName.toString()).join(" "));
|
|
556
|
+
return dedupedInterfaces;
|
|
557
|
+
}
|
|
558
|
+
/*
|
|
559
|
+
|
|
560
|
+
// also find all related interfaces
|
|
561
|
+
if (false && typeDefinitionNode) {
|
|
562
|
+
dotrace && tracelog("typeDefinitionNode = ", typeDefinitionNode.browseName.toString());
|
|
563
|
+
const interfaces = _extractInterfaces(typeDefinitionNode);
|
|
564
|
+
for (const interfaceNode of interfaces) {
|
|
565
|
+
dotrace && tracelog(" adding member of interface ", interfaceNode.browseName.toString());
|
|
566
|
+
const fromInterface = interfaceNode.findReferencesEx("Aggregates", BrowseDirection.Forward);
|
|
567
|
+
dotrace && tracelog(
|
|
568
|
+
" B ",
|
|
569
|
+
fromInterface.map((r) => r.toString({ addressSpace }) + " " + r.node!.browseName.toString()).join("\n")
|
|
570
|
+
);
|
|
571
|
+
add(fromInterface);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
*/
|
|
575
|
+
function _crap_extractInterfaces(typeDefinitionNode, extraInfo) {
|
|
576
|
+
if (typeDefinitionNode.nodeId.namespace === 0 &&
|
|
577
|
+
(typeDefinitionNode.nodeId.value === node_opcua_constants_1.ObjectTypeIds.BaseObjectType ||
|
|
578
|
+
typeDefinitionNode.nodeId.value === node_opcua_constants_1.VariableTypeIds.BaseVariableType)) {
|
|
579
|
+
return [];
|
|
580
|
+
}
|
|
581
|
+
const addressSpace = typeDefinitionNode.addressSpace;
|
|
582
|
+
// example:
|
|
583
|
+
// FolderType
|
|
584
|
+
// (di):FunctionalGroupType
|
|
585
|
+
// MachineryItemIdentificationType : IMachineryItemVendorNameplateType
|
|
586
|
+
// MachineIdentificationType : IMachineTagNameplateType, IMachineVendorNamePlateType
|
|
587
|
+
// MachineToolIdentificationType
|
|
588
|
+
//
|
|
589
|
+
//
|
|
590
|
+
// IMachineTagNameplateType -subtypeOf-> ITagNameplateType
|
|
591
|
+
// IMachineVendorNamePlateType -subtypeOf-> IMachineryItemVendorNamePlateType
|
|
592
|
+
// IMachineryItemVendorNamePlateType -subtypeOf-> IVendorNameplateType
|
|
593
|
+
const interfacesRef = typeDefinitionNode.findReferencesEx("HasInterface", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
594
|
+
const interfaces = interfacesRef.map((r) => r.node);
|
|
595
|
+
for (const iface of interfaces) {
|
|
596
|
+
doTrace && traceLog(extraInfo.pad(), " interface ", iface.browseName.toString());
|
|
597
|
+
}
|
|
598
|
+
return interfaces;
|
|
599
|
+
}
|
|
600
|
+
function _cloneInterface(nodeToClone, newParent, node, optionalFilter, extraInfo, browseNameMap) {
|
|
601
|
+
doTrace &&
|
|
602
|
+
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- now cloning interfaces of ", node.browseName.toString(), node.nodeId.toString()));
|
|
603
|
+
extraInfo = extraInfo || defaultExtraInfo;
|
|
604
|
+
const addressSpace = node.addressSpace;
|
|
605
|
+
if (node.nodeClass !== node_opcua_data_model_1.NodeClass.Object && node.nodeClass !== node_opcua_data_model_1.NodeClass.Variable) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const typeDefinitionNode = node.typeDefinitionObj;
|
|
609
|
+
if (!typeDefinitionNode) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const interfaces = _extractInterfaces2(typeDefinitionNode, extraInfo);
|
|
613
|
+
if (interfaces.length === 0) {
|
|
614
|
+
doTrace &&
|
|
615
|
+
false &&
|
|
616
|
+
traceLog(extraInfo.pad(), chalk.yellow("No interface for ", node.browseName.toString(), node.nodeId.toString()));
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
doTrace && traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.green("-------------------- interfaces are ", interfaces.length));
|
|
620
|
+
const localFilter = optionalFilter.filterFor(node);
|
|
621
|
+
for (const iface of interfaces) {
|
|
622
|
+
const aggregates = iface.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
623
|
+
doTrace &&
|
|
624
|
+
traceLog(extraInfo.pad(), chalk.magentaBright(" interface ", iface.browseName.toString()), "\n" + (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad()), aggregates.map((r) => r.toString({ addressSpace })).join("\n" + (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad())));
|
|
625
|
+
_clone_collection_new(nodeToClone, node, aggregates, false, localFilter, extraInfo, browseNameMap);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function __clone_organizes_references(node, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
629
|
+
// find all references that derives from the Organizes
|
|
630
|
+
const organizedRef = node.findReferencesEx("Organizes", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
631
|
+
_clone_collection_new(node, newParent, organizedRef, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
632
|
+
}
|
|
633
|
+
function __clone_children_references(node, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
634
|
+
// find all references that derives from the Aggregates
|
|
635
|
+
const aggregatesRef = node.findReferencesEx("Aggregates", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
636
|
+
_clone_collection_new(node, newParent, aggregatesRef, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
637
|
+
}
|
|
638
|
+
function _clone_hierarchical_references(node, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
639
|
+
__clone_children_references(node, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
640
|
+
__clone_organizes_references(node, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
641
|
+
}
|
|
642
|
+
exports._clone_hierarchical_references = _clone_hierarchical_references;
|
|
643
|
+
function _clone_non_hierarchical_references(nodeToClone, newParent, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap) {
|
|
644
|
+
// clone only some non hierarchical_references that we do want to clone
|
|
645
|
+
// such as:
|
|
646
|
+
// HasSubStateMachine
|
|
647
|
+
// (may be other as well later ... to do )
|
|
648
|
+
(0, node_opcua_assert_1.assert)(newParent instanceof base_node_impl_1.BaseNodeImpl);
|
|
649
|
+
// find all reference that derives from the HasSubStateMachine
|
|
650
|
+
const references = nodeToClone.findReferencesEx("HasSubStateMachine", node_opcua_data_model_1.BrowseDirection.Forward);
|
|
651
|
+
_clone_collection_new(nodeToClone, newParent, references, copyAlsoModellingRules, optionalFilter, extraInfo, browseNameMap);
|
|
652
|
+
}
|
|
653
|
+
exports._clone_non_hierarchical_references = _clone_non_hierarchical_references;
|
|
654
|
+
/**
|
|
655
|
+
* @method _clone
|
|
656
|
+
* @private
|
|
657
|
+
*/
|
|
658
|
+
function _clone(Constructor, options, optionalFilter, extraInfo) {
|
|
659
|
+
(0, node_opcua_assert_1.assert)(typeof Constructor === "function");
|
|
660
|
+
(0, node_opcua_assert_1.assert)(options !== null && typeof options === "object");
|
|
661
|
+
(0, node_opcua_assert_1.assert)(!extraInfo || (extraInfo !== null && typeof extraInfo === "object" && typeof extraInfo.registerClonedObject === "function"));
|
|
662
|
+
(0, node_opcua_assert_1.assert)(!this.subtypeOf, "We do not do cloning of Type yet");
|
|
663
|
+
(0, node_opcua_assert_1.assert)(!extraInfo.getCloned(this), "object has already been cloned");
|
|
664
|
+
const namespace = options.namespace;
|
|
665
|
+
const constructorOptions = Object.assign(Object.assign({}, options), { addressSpace: namespace.addressSpace, browseName: this.browseName, description: this.description, displayName: this.displayName, nodeClass: this.nodeClass });
|
|
666
|
+
constructorOptions.references = options.references || [];
|
|
667
|
+
if (this.nodeClass === node_opcua_data_model_1.NodeClass.Variable || this.nodeClass === node_opcua_data_model_1.NodeClass.Object) {
|
|
668
|
+
const voThis = this;
|
|
669
|
+
if (voThis.typeDefinition) {
|
|
670
|
+
constructorOptions.references.push(new reference_impl_1.ReferenceImpl({
|
|
671
|
+
isForward: true,
|
|
672
|
+
nodeId: voThis.typeDefinition,
|
|
673
|
+
referenceType: (0, node_opcua_nodeid_1.resolveNodeId)("HasTypeDefinition")
|
|
674
|
+
}));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (!constructorOptions.modellingRule) {
|
|
678
|
+
if (this.modellingRule && options.copyAlsoModellingRules) {
|
|
679
|
+
const modellingRuleNode = this.findReferencesAsObject("HasModellingRule", true)[0];
|
|
680
|
+
(0, node_opcua_assert_1.assert)(modellingRuleNode);
|
|
681
|
+
constructorOptions.references.push(new reference_impl_1.ReferenceImpl({
|
|
682
|
+
isForward: true,
|
|
683
|
+
nodeId: modellingRuleNode.nodeId,
|
|
684
|
+
referenceType: (0, node_opcua_nodeid_1.resolveNodeId)("HasModellingRule")
|
|
685
|
+
}));
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
(0, namespace_private_1.UANamespace_process_modelling_rule)(constructorOptions.references, constructorOptions.modellingRule);
|
|
690
|
+
}
|
|
691
|
+
constructorOptions.nodeId = namespace.constructNodeId(constructorOptions);
|
|
692
|
+
(0, node_opcua_assert_1.assert)(constructorOptions.nodeId instanceof node_opcua_nodeid_1.NodeId);
|
|
693
|
+
const cloneObj = new Constructor(constructorOptions);
|
|
694
|
+
this.addressSpace._register(cloneObj);
|
|
695
|
+
if (!options.ignoreChildren) {
|
|
696
|
+
// clone children and the rest ....
|
|
697
|
+
options.copyAlsoModellingRules = options.copyAlsoModellingRules || false;
|
|
698
|
+
const newFilter = optionalFilter.filterFor(cloneObj);
|
|
699
|
+
const browseNameMap = new Set();
|
|
700
|
+
_clone_hierarchical_references(this, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
701
|
+
if (this.nodeClass === node_opcua_data_model_1.NodeClass.Object || this.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
702
|
+
let typeDefinitionNode = this.typeDefinitionObj;
|
|
703
|
+
while (typeDefinitionNode) {
|
|
704
|
+
doTrace &&
|
|
705
|
+
traceLog(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.pad(), chalk.blueBright("---------------------- Exploring ", typeDefinitionNode.browseName.toString()));
|
|
706
|
+
_clone_hierarchical_references(typeDefinitionNode, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
707
|
+
typeDefinitionNode = typeDefinitionNode.subtypeOfObj;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
_clone_non_hierarchical_references(this, cloneObj, options.copyAlsoModellingRules, newFilter, extraInfo, browseNameMap);
|
|
711
|
+
}
|
|
712
|
+
cloneObj.propagate_back_references();
|
|
713
|
+
cloneObj.install_extra_properties();
|
|
714
|
+
return cloneObj;
|
|
715
|
+
}
|
|
716
|
+
exports._clone = _clone;
|
|
717
|
+
function _handle_HierarchicalReference(node, reference) {
|
|
718
|
+
const _cache = BaseNode_getCache(node);
|
|
719
|
+
if (!reference.isForward)
|
|
720
|
+
return;
|
|
721
|
+
if (_cache._childByNameMap) {
|
|
722
|
+
const addressSpace = node.addressSpace;
|
|
723
|
+
const referenceType = reference_impl_1.ReferenceImpl.resolveReferenceType(addressSpace, reference);
|
|
724
|
+
if (referenceType) {
|
|
725
|
+
const HierarchicalReferencesType = addressSpace.findReferenceType("HierarchicalReferences");
|
|
726
|
+
if (referenceType.isSubtypeOf(HierarchicalReferencesType)) {
|
|
727
|
+
(0, node_opcua_assert_1.assert)(reference.isForward);
|
|
728
|
+
const targetNode = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
729
|
+
_cache._childByNameMap[targetNode.browseName.name.toString()] = targetNode;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
exports._handle_HierarchicalReference = _handle_HierarchicalReference;
|
|
735
|
+
function _remove_HierarchicalReference(node, reference) {
|
|
736
|
+
const _cache = BaseNode_getCache(node);
|
|
737
|
+
if (_cache._childByNameMap) {
|
|
738
|
+
const addressSpace = node.addressSpace;
|
|
739
|
+
const referenceType = reference_impl_1.ReferenceImpl.resolveReferenceType(addressSpace, reference);
|
|
740
|
+
if (referenceType) {
|
|
741
|
+
const HierarchicalReferencesType = addressSpace.findReferenceType("HierarchicalReferences");
|
|
742
|
+
if (referenceType.isSubtypeOf(HierarchicalReferencesType)) {
|
|
743
|
+
(0, node_opcua_assert_1.assert)(reference.isForward);
|
|
744
|
+
const targetNode = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
745
|
+
// Xx dotrace && tracelog(" adding object to map");
|
|
746
|
+
delete _cache._childByNameMap[targetNode.browseName.name.toString()];
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function _makeReferenceDescription(addressSpace, reference, resultMask) {
|
|
752
|
+
const isForward = reference.isForward;
|
|
753
|
+
const referenceTypeId = reference_impl_1.ReferenceImpl.resolveReferenceType(addressSpace, reference).nodeId;
|
|
754
|
+
(0, node_opcua_assert_1.assert)(referenceTypeId instanceof node_opcua_nodeid_1.NodeId);
|
|
755
|
+
const obj = reference_impl_1.ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
756
|
+
let data = {};
|
|
757
|
+
if (!obj) {
|
|
758
|
+
// cannot find reference node
|
|
759
|
+
data = {
|
|
760
|
+
isForward,
|
|
761
|
+
nodeId: reference.nodeId,
|
|
762
|
+
referenceTypeId: resultMask & node_opcua_data_model_1.ResultMask.ReferenceType ? referenceTypeId : null,
|
|
763
|
+
typeDefinition: null
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
else {
|
|
767
|
+
(0, node_opcua_assert_1.assert)(reference.nodeId, " obj.nodeId");
|
|
768
|
+
data = {
|
|
769
|
+
browseName: resultMask & node_opcua_data_model_1.ResultMask.BrowseName ? (0, node_opcua_data_model_1.coerceQualifiedName)(obj.browseName) : null,
|
|
770
|
+
displayName: resultMask & node_opcua_data_model_1.ResultMask.DisplayName ? (0, node_opcua_data_model_1.coerceLocalizedText)(obj.displayName[0]) : null,
|
|
771
|
+
isForward: resultMask & node_opcua_data_model_1.ResultMask.IsForward ? isForward : false,
|
|
772
|
+
nodeClass: resultMask & node_opcua_data_model_1.ResultMask.NodeClass ? obj.nodeClass : node_opcua_data_model_1.NodeClass.Unspecified,
|
|
773
|
+
nodeId: obj.nodeId,
|
|
774
|
+
referenceTypeId: resultMask & node_opcua_data_model_1.ResultMask.ReferenceType ? referenceTypeId : null,
|
|
775
|
+
typeDefinition: resultMask & node_opcua_data_model_1.ResultMask.TypeDefinition ? obj.typeDefinition : null
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
if (data.typeDefinition === null) {
|
|
779
|
+
data.typeDefinition = new node_opcua_nodeid_1.NodeId();
|
|
780
|
+
}
|
|
781
|
+
const referenceDescription = new node_opcua_types_1.ReferenceDescription(data);
|
|
782
|
+
return referenceDescription;
|
|
783
|
+
}
|
|
784
|
+
function _constructReferenceDescription(addressSpace, references, resultMask) {
|
|
785
|
+
(0, node_opcua_assert_1.assert)(Array.isArray(references));
|
|
786
|
+
return references.map((reference) => _makeReferenceDescription(addressSpace, reference, resultMask));
|
|
787
|
+
}
|
|
788
|
+
exports._constructReferenceDescription = _constructReferenceDescription;
|
|
789
|
+
function BaseNode_remove_backward_reference(reference) {
|
|
790
|
+
const _private = BaseNode_getPrivate(this);
|
|
791
|
+
_remove_HierarchicalReference(this, reference);
|
|
792
|
+
const h = reference.hash;
|
|
793
|
+
if (_private._back_referenceIdx && _private._back_referenceIdx[h]) {
|
|
794
|
+
// note : h may not exist in _back_referenceIdx since we are not indexing
|
|
795
|
+
// _back_referenceIdx to UAObjectType and UAVariableType for performance reasons
|
|
796
|
+
_private._back_referenceIdx[h].dispose();
|
|
797
|
+
delete _private._back_referenceIdx[h];
|
|
798
|
+
}
|
|
799
|
+
reference.dispose();
|
|
800
|
+
}
|
|
801
|
+
exports.BaseNode_remove_backward_reference = BaseNode_remove_backward_reference;
|
|
802
|
+
function BaseNode_add_backward_reference(reference) {
|
|
803
|
+
const _private = BaseNode_getPrivate(this);
|
|
804
|
+
const h = reference.hash;
|
|
805
|
+
(0, node_opcua_assert_1.assert)(typeof h === "string");
|
|
806
|
+
// istanbul ignore next
|
|
807
|
+
if (_private._referenceIdx[h]) {
|
|
808
|
+
// the reference exists already in the forward references
|
|
809
|
+
// this append for instance when the XML NotSetFile has redundant <UAReference>
|
|
810
|
+
// in this case there is nothing to do
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
// istanbul ignore next
|
|
814
|
+
if (_private._back_referenceIdx[h]) {
|
|
815
|
+
const opts = { addressSpace: this.addressSpace };
|
|
816
|
+
warningLog(" Warning !", this.browseName.toString());
|
|
817
|
+
warningLog(" ", reference.toString(opts));
|
|
818
|
+
warningLog(" already found in ===>");
|
|
819
|
+
warningLog(Object.values(_private._back_referenceIdx).map((c) => c.toString(opts)).join("\n"));
|
|
820
|
+
// tslint:disable-next-line:no-console
|
|
821
|
+
warningLog("===>");
|
|
822
|
+
throw new Error("reference exists already in _back_references");
|
|
823
|
+
}
|
|
824
|
+
if (!(0, base_node_impl_1.getReferenceType)(reference)) {
|
|
825
|
+
const stop_here = 1;
|
|
826
|
+
}
|
|
827
|
+
// assert(reference._referenceType instanceof ReferenceType);
|
|
828
|
+
_private._back_referenceIdx[h] = reference;
|
|
829
|
+
_handle_HierarchicalReference(this, reference);
|
|
830
|
+
this._clear_caches();
|
|
831
|
+
}
|
|
832
|
+
exports.BaseNode_add_backward_reference = BaseNode_add_backward_reference;
|
|
804
833
|
//# sourceMappingURL=base_node_private.js.map
|