node-opcua-address-space 2.136.0 → 2.138.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/dist/source/helpers/adjust_browse_direction.js +1 -2
- package/dist/source/helpers/adjust_browse_direction.js.map +1 -1
- package/dist/source/helpers/argument_list.js +6 -7
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/call_helpers.js +1 -2
- package/dist/source/helpers/call_helpers.js.map +1 -1
- package/dist/source/helpers/coerce_enum_value.js +1 -2
- package/dist/source/helpers/coerce_enum_value.js.map +1 -1
- package/dist/source/helpers/dump_tools.js +5 -6
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/helpers/ensure_secure_access.js +1 -2
- package/dist/source/helpers/ensure_secure_access.js.map +1 -1
- package/dist/source/helpers/make_optionals_map.d.ts +1 -3
- package/dist/source/helpers/make_optionals_map.js +7 -4
- package/dist/source/helpers/make_optionals_map.js.map +1 -1
- package/dist/source/helpers/multiform_func.js +2 -3
- package/dist/source/helpers/multiform_func.js.map +1 -1
- package/dist/source/helpers/resolve_opaque_on_address_space.js +1 -2
- package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -1
- package/dist/source/index.d.ts +2 -0
- package/dist/source/index.js +2 -0
- package/dist/source/index.js.map +1 -1
- package/dist/source/interfaces/alarms_and_conditions/condition_snapshot.d.ts +0 -3
- package/dist/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.d.ts +0 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +0 -2
- package/dist/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.js.map +1 -1
- package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +1 -1
- package/dist/source/interfaces/state_machine/ua_shelved_state_machine_ex.d.ts +1 -2
- package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +1 -0
- package/dist/source/loader/decode_xml_extension_object.d.ts +1 -1
- package/dist/source/loader/decode_xml_extension_object.js +4 -5
- package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js +32 -4
- package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.js +3 -4
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +145 -737
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_semver_compatible.js +1 -2
- package/dist/source/loader/make_semver_compatible.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.d.ts +1 -6
- package/dist/source/loader/make_xml_extension_object_parser.js +52 -73
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/source/loader/namespace_post_step.d.ts +4 -6
- package/dist/source/loader/namespace_post_step.js +5 -5
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/source/loader/parsers/extension_object_parser.d.ts +51 -0
- package/dist/source/loader/parsers/extension_object_parser.js +269 -0
- package/dist/source/loader/parsers/extension_object_parser.js.map +1 -0
- package/dist/source/loader/parsers/localized_text_parser.d.ts +25 -0
- package/dist/source/loader/parsers/localized_text_parser.js +30 -0
- package/dist/source/loader/parsers/localized_text_parser.js.map +1 -0
- package/dist/source/loader/parsers/nodeid_parser.d.ts +11 -0
- package/dist/source/loader/parsers/nodeid_parser.js +20 -0
- package/dist/source/loader/parsers/nodeid_parser.js.map +1 -0
- package/dist/source/loader/parsers/qualified_name_parser.d.ts +26 -0
- package/dist/source/loader/parsers/qualified_name_parser.js +35 -0
- package/dist/source/loader/parsers/qualified_name_parser.js.map +1 -0
- package/dist/source/loader/parsers/variant_parser.d.ts +29 -0
- package/dist/source/loader/parsers/variant_parser.js +328 -0
- package/dist/source/loader/parsers/variant_parser.js.map +1 -0
- package/dist/source/loader/register_node_promoter.js +2 -3
- package/dist/source/loader/register_node_promoter.js.map +1 -1
- package/dist/source/pseudo_session.d.ts +0 -2
- package/dist/source/pseudo_session.js +3 -3
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/source/session_context.d.ts +1 -1
- package/dist/source/session_context.js +3 -3
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/set_namespace_meta_data.js +1 -2
- package/dist/source/set_namespace_meta_data.js.map +1 -1
- package/dist/source/ua_addin.d.ts +11 -0
- package/dist/source/ua_addin.js +42 -0
- package/dist/source/ua_addin.js.map +1 -0
- package/dist/source/ua_interface.d.ts +3 -0
- package/dist/source/ua_interface.js +45 -0
- package/dist/source/ua_interface.js.map +1 -0
- package/dist/source/xml_writer.d.ts +3 -5
- package/dist/src/_instantiate_helpers.d.ts +1 -1
- package/dist/src/_instantiate_helpers.js +7 -8
- package/dist/src/_instantiate_helpers.js.map +1 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.d.ts +3 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.js +6 -5
- package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
- package/dist/src/address_space.d.ts +1 -5
- package/dist/src/address_space.js +1 -1
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_change_event_tools.js +3 -4
- package/dist/src/address_space_change_event_tools.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition.d.ts +4 -7
- package/dist/src/alarms_and_conditions/condition.js +1 -25
- package/dist/src/alarms_and_conditions/condition.js.map +1 -1
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.d.ts +2 -20
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +211 -234
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +4 -5
- package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +0 -2
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +1 -2
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +0 -2
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +3 -3
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +0 -2
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +10 -12
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +1 -1
- package/dist/src/apply_condition_refresh.d.ts +1 -3
- package/dist/src/apply_condition_refresh.js +4 -5
- package/dist/src/apply_condition_refresh.js.map +1 -1
- package/dist/src/base_node_impl.d.ts +0 -1
- package/dist/src/base_node_impl.js +11 -11
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.d.ts +4 -7
- package/dist/src/base_node_private.js +23 -25
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/check_value_rank_compatibility.js +1 -2
- package/dist/src/check_value_rank_compatibility.js.map +1 -1
- package/dist/src/data_access/add_dataItem_stuff.js +1 -2
- package/dist/src/data_access/add_dataItem_stuff.js.map +1 -1
- package/dist/src/data_access/adjust_datavalue_status_code.js +1 -2
- package/dist/src/data_access/adjust_datavalue_status_code.js.map +1 -1
- package/dist/src/data_access/ua_multistate_discrete_impl.js +3 -3
- package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -1
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js +5 -5
- package/dist/src/data_access/ua_multistate_value_discrete_impl.js.map +1 -1
- package/dist/src/data_access/ua_two_state_discrete_impl.js +3 -3
- package/dist/src/data_access/ua_two_state_discrete_impl.js.map +1 -1
- package/dist/src/extension_object_array_node.js +4 -5
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/get_basic_datatype.js +2 -3
- package/dist/src/get_basic_datatype.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +5 -5
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/index_current.d.ts +3 -1
- package/dist/src/index_current.js +3 -1
- package/dist/src/index_current.js.map +1 -1
- package/dist/src/namespace_impl.d.ts +1 -9
- package/dist/src/namespace_impl.js +19 -12
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/namespace_private.js +1 -2
- package/dist/src/namespace_private.js.map +1 -1
- package/dist/src/nodeid_manager.js +35 -10
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/adjust_namespace_array.js +1 -2
- package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +2 -2
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +12 -12
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.js +5 -6
- package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +53 -46
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/private_namespace.js +4 -5
- package/dist/src/private_namespace.js.map +1 -1
- package/dist/src/reference_impl.js +4 -4
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/role_permissions.js +1 -2
- package/dist/src/role_permissions.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +6 -6
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +0 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js +2 -2
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +4 -4
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/tool_isSubtypeOf.d.ts +1 -1
- package/dist/src/tool_isSubtypeOf.js +18 -16
- package/dist/src/tool_isSubtypeOf.js.map +1 -1
- package/dist/src/ua_addin.d.ts +11 -0
- package/dist/src/ua_addin.js +43 -0
- package/dist/src/ua_addin.js.map +1 -0
- package/dist/src/ua_data_type_impl.js +7 -6
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +1 -0
- package/dist/src/ua_object_type_impl.js +4 -1
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.js +3 -3
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.js +6 -3
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +15 -15
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.d.ts +2 -0
- package/dist/src/ua_variable_type_impl.js +8 -4
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/validate_data_type_correctness.js +1 -2
- package/dist/src/validate_data_type_correctness.js.map +1 -1
- package/dist/tsconfig_common.tsbuildinfo +1 -1
- package/distHelpers/add_event_generator_object.js +1 -2
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/distHelpers/alarms_and_conditions_demo.js +1 -2
- package/distHelpers/alarms_and_conditions_demo.js.map +1 -1
- package/distHelpers/assertHasMatchingReference.js +1 -2
- package/distHelpers/assertHasMatchingReference.js.map +1 -1
- package/distHelpers/boiler_system.js +2 -3
- package/distHelpers/boiler_system.js.map +1 -1
- package/distHelpers/create_minimalist_address_space_nodeset.js +1 -2
- package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
- package/distHelpers/date_utils.js +1 -2
- package/distHelpers/date_utils.js.map +1 -1
- package/distHelpers/get_address_space_fixture.js +1 -2
- package/distHelpers/get_address_space_fixture.js.map +1 -1
- package/distHelpers/get_mini_address_space.js +2 -2
- package/distHelpers/get_mini_address_space.js.map +1 -1
- package/distNodeJS/generate_address_space.js +2 -3
- package/distNodeJS/generate_address_space.js.map +1 -1
- package/package.json +24 -24
- package/source/helpers/make_optionals_map.ts +9 -6
- package/source/index.ts +3 -0
- package/source/interfaces/alarms_and_conditions/instantiate_exclusive_deviation_alarm_options.ts +3 -1
- package/source/interfaces/alarms_and_conditions/instantiate_exclusive_limit_alarm_options.ts +3 -1
- package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_deviation_alarm_options.ts +3 -1
- package/source/interfaces/alarms_and_conditions/instantiate_non_exclusive_limit_alarm_options.ts +3 -1
- package/source/interfaces/alarms_and_conditions/ua_discrete_alarm_ex.ts +3 -1
- package/source/interfaces/alarms_and_conditions/ua_exclusive_deviation_alarm_ex.ts +18 -16
- package/source/interfaces/alarms_and_conditions/ua_exclusive_limit_alarm_ex.ts +5 -3
- package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +4 -2
- package/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.ts +4 -2
- package/source/interfaces/state_machine/ua_program_state_machine_type.ts +3 -1
- package/source/interfaces/state_machine/ua_shelved_state_machine_ex.ts +1 -1
- package/source/interfaces/state_machine/ua_state_machine_type.ts +14 -7
- package/source/loader/decode_xml_extension_object.ts +4 -3
- package/source/loader/ensure_datatype_extracted.ts +38 -2
- package/source/loader/generateAddressSpaceRaw.ts +4 -4
- package/source/loader/load_nodeset2.ts +212 -901
- package/source/loader/make_xml_extension_object_parser.ts +87 -123
- package/source/loader/namespace_post_step.ts +6 -5
- package/source/loader/parsers/extension_object_parser.ts +364 -0
- package/source/loader/parsers/localized_text_parser.ts +34 -0
- package/source/loader/parsers/nodeid_parser.ts +17 -0
- package/source/loader/parsers/qualified_name_parser.ts +43 -0
- package/source/loader/parsers/variant_parser.ts +427 -0
- package/source/loader/register_node_promoter.ts +2 -5
- package/source/session_context.ts +1 -1
- package/source/ua_addin.ts +53 -0
- package/source/ua_interface.ts +49 -0
- package/source/xml_writer.ts +4 -5
- package/src/_instantiate_helpers.ts +9 -3
- package/src/_mandatory_child_or_requested_optional_filter.ts +9 -7
- package/src/address_space.ts +1 -1
- package/src/alarms_and_conditions/condition.ts +0 -32
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +176 -189
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +1 -3
- package/src/alarms_and_conditions/ua_base_event_impl.ts +6 -2
- package/src/alarms_and_conditions/ua_condition_impl.ts +11 -13
- package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +3 -1
- package/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.ts +3 -1
- package/src/apply_condition_refresh.ts +4 -4
- package/src/base_node_impl.ts +13 -13
- package/src/base_node_private.ts +6 -11
- package/src/data_access/ua_multistate_value_discrete_impl.ts +1 -1
- package/src/historical_access/address_space_historical_data_node.ts +3 -3
- package/src/index_current.ts +4 -1
- package/src/namespace_impl.ts +21 -10
- package/src/nodeid_manager.ts +46 -17
- package/src/nodeset_tools/construct_namespace_dependency.ts +9 -8
- package/src/nodeset_tools/dump_to_bsd.ts +7 -7
- package/src/nodeset_tools/nodeset_to_xml.ts +70 -44
- package/src/private_namespace.ts +2 -1
- package/src/tool_isSubtypeOf.ts +20 -16
- package/src/ua_data_type_impl.ts +5 -4
- package/src/ua_object_type_impl.ts +7 -2
- package/src/ua_reference_type_impl.ts +6 -6
- package/src/ua_variable_impl.ts +4 -0
- package/src/ua_variable_impl_ext_obj.ts +2 -1
- package/src/ua_variable_type_impl.ts +11 -1
|
@@ -13,21 +13,17 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
13
13
|
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
14
14
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
15
15
|
const node_opcua_basic_types_2 = require("node-opcua-basic-types");
|
|
16
|
-
const node_opcua_data_access_1 = require("node-opcua-data-access");
|
|
17
16
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
18
17
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
19
|
-
const node_opcua_extension_object_1 = require("node-opcua-extension-object");
|
|
20
18
|
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
21
19
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
22
|
-
const node_opcua_service_call_1 = require("node-opcua-service-call");
|
|
23
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
24
20
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
25
21
|
const node_opcua_xml2json_1 = require("node-opcua-xml2json");
|
|
26
22
|
const semver_1 = __importDefault(require("semver"));
|
|
27
23
|
const namespace_post_step_1 = require("./namespace_post_step");
|
|
28
24
|
const ensure_datatype_extracted_1 = require("./ensure_datatype_extracted");
|
|
29
|
-
const decode_xml_extension_object_1 = require("./decode_xml_extension_object");
|
|
30
25
|
const make_semver_compatible_1 = require("./make_semver_compatible");
|
|
26
|
+
const variant_parser_1 = require("./parsers/variant_parser");
|
|
31
27
|
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
32
28
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
33
29
|
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
@@ -111,7 +107,7 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
111
107
|
const postTasks0_DecodePojoString = [];
|
|
112
108
|
const postTasks1_InitializeVariable = [];
|
|
113
109
|
const postTasks2_AssignedExtensionObjectToDataValue = [];
|
|
114
|
-
let
|
|
110
|
+
let aliasMap = new Map();
|
|
115
111
|
/**
|
|
116
112
|
* @param aliasName
|
|
117
113
|
*/
|
|
@@ -119,29 +115,28 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
119
115
|
(0, node_opcua_assert_1.assert)(typeof nodeIdInXmlContext === "string");
|
|
120
116
|
const nodeId = _translateNodeId(nodeIdInXmlContext);
|
|
121
117
|
(0, node_opcua_assert_1.assert)(nodeId instanceof node_opcua_nodeid_1.NodeId);
|
|
122
|
-
|
|
118
|
+
aliasMap.set(aliasName, nodeId);
|
|
123
119
|
addressSpace1.getNamespace(nodeId.namespace).addAlias(aliasName, nodeId);
|
|
124
120
|
}
|
|
125
|
-
let
|
|
121
|
+
let namespaceUriTranslationMap = new Map();
|
|
126
122
|
let namespaceCounter = 0;
|
|
127
|
-
let
|
|
123
|
+
let foundNamespaceMap = new Map();
|
|
128
124
|
let models = [];
|
|
129
125
|
let performedCalled = false;
|
|
130
126
|
function _reset_namespace_translation() {
|
|
131
127
|
debugLog("_reset_namespace_translation");
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
namespaceUriTranslationMap.clear();
|
|
129
|
+
foundNamespaceMap.clear();
|
|
134
130
|
namespaceCounter = 0;
|
|
135
|
-
|
|
131
|
+
aliasMap.clear();
|
|
136
132
|
models = [];
|
|
137
133
|
performedCalled = false;
|
|
138
134
|
}
|
|
139
135
|
function _translateNamespaceIndex(innerIndex) {
|
|
140
|
-
const namespaceIndex =
|
|
136
|
+
const namespaceIndex = namespaceUriTranslationMap.get(innerIndex);
|
|
141
137
|
// istanbul ignore next
|
|
142
138
|
if (namespaceIndex === undefined) {
|
|
143
|
-
errorLog("
|
|
144
|
-
errorLog("Error; namespace_uri_translation", namespace_uri_translation);
|
|
139
|
+
errorLog("Error; namespace_uri_translation", namespaceUriTranslationMap.entries());
|
|
145
140
|
throw new Error("_translateNamespaceIndex() ! Cannot find namespace definition for index " + innerIndex);
|
|
146
141
|
}
|
|
147
142
|
return namespaceIndex;
|
|
@@ -163,7 +158,7 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
163
158
|
return namespace.internalCreateNode(params);
|
|
164
159
|
}
|
|
165
160
|
function _register_namespace_uri_in_translation_table(namespaceUri) {
|
|
166
|
-
if (
|
|
161
|
+
if (foundNamespaceMap.has(namespaceUri)) {
|
|
167
162
|
return;
|
|
168
163
|
}
|
|
169
164
|
const namespace = addressSpace1.getNamespace(namespaceUri);
|
|
@@ -173,10 +168,10 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
173
168
|
namespaceUri +
|
|
174
169
|
"\nplease make sure to initialize your address space with the corresponding nodeset files");
|
|
175
170
|
}
|
|
176
|
-
|
|
171
|
+
foundNamespaceMap.set(namespaceUri, namespace);
|
|
177
172
|
const index_in_xml = namespaceCounter;
|
|
178
173
|
namespaceCounter++;
|
|
179
|
-
|
|
174
|
+
namespaceUriTranslationMap.set(index_in_xml, namespace.index);
|
|
180
175
|
doDebug &&
|
|
181
176
|
debugLog(" _register_namespace_uri = ", namespaceUri, "index in Xml=", index_in_xml, " index in addressSpace", namespace.index);
|
|
182
177
|
}
|
|
@@ -224,8 +219,10 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
224
219
|
}
|
|
225
220
|
const reg = /ns=([0-9]+);(.*)/;
|
|
226
221
|
function _translateNodeId(nodeId) {
|
|
227
|
-
if (
|
|
228
|
-
|
|
222
|
+
if (aliasMap.has(nodeId)) {
|
|
223
|
+
// note alias are already translated to the right namespaces
|
|
224
|
+
const aliasedNodeId = aliasMap.get(nodeId);
|
|
225
|
+
return aliasedNodeId;
|
|
229
226
|
}
|
|
230
227
|
const m = nodeId.match(reg);
|
|
231
228
|
if (m) {
|
|
@@ -284,16 +281,18 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
284
281
|
}
|
|
285
282
|
}
|
|
286
283
|
};
|
|
284
|
+
// #region UAObject
|
|
287
285
|
const state_UAObject = {
|
|
288
286
|
init(name, attrs) {
|
|
289
287
|
_perform();
|
|
290
|
-
this.obj = {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
288
|
+
this.obj = {
|
|
289
|
+
nodeClass: node_opcua_data_model_1.NodeClass.Object,
|
|
290
|
+
isAbstract: (0, node_opcua_basic_types_1.coerceBoolean)(attrs.IsAbstract),
|
|
291
|
+
nodeId: convertToNodeId(attrs.NodeId) || null,
|
|
292
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
293
|
+
eventNotifier: (0, node_opcua_basic_types_1.coerceByte)(attrs.EventNotifier) || 0,
|
|
294
|
+
symbolicName: attrs.SymbolicName || null
|
|
295
|
+
};
|
|
297
296
|
this.isDraft = attrs.ReleaseStatus === "Draft";
|
|
298
297
|
this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
|
|
299
298
|
},
|
|
@@ -317,15 +316,18 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
317
316
|
References: references_parser
|
|
318
317
|
}
|
|
319
318
|
};
|
|
319
|
+
// #endregion
|
|
320
|
+
// #region UAObjectType
|
|
320
321
|
const state_UAObjectType = {
|
|
321
322
|
init(name, attrs) {
|
|
322
323
|
_perform();
|
|
323
|
-
this.obj = {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
324
|
+
this.obj = {
|
|
325
|
+
nodeClass: node_opcua_data_model_1.NodeClass.ObjectType,
|
|
326
|
+
isAbstract: (0, node_opcua_basic_types_1.coerceBoolean)(attrs.IsAbstract),
|
|
327
|
+
nodeId: convertToNodeId(attrs.NodeId) || null,
|
|
328
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
329
|
+
eventNotifier: (0, node_opcua_basic_types_1.coerceByte)(attrs.EventNotifier) || 0
|
|
330
|
+
};
|
|
329
331
|
},
|
|
330
332
|
finish() {
|
|
331
333
|
_internal_createNode(this.obj);
|
|
@@ -344,14 +346,17 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
344
346
|
References: references_parser
|
|
345
347
|
}
|
|
346
348
|
};
|
|
349
|
+
// #endregion
|
|
350
|
+
// #region UAReferenceType
|
|
347
351
|
const state_UAReferenceType = {
|
|
348
352
|
init(name, attrs) {
|
|
349
353
|
_perform();
|
|
350
|
-
this.obj = {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
354
|
+
this.obj = {
|
|
355
|
+
nodeClass: node_opcua_data_model_1.NodeClass.ReferenceType,
|
|
356
|
+
isAbstract: (0, node_opcua_basic_types_1.coerceBoolean)(attrs.IsAbstract),
|
|
357
|
+
nodeId: convertToNodeId(attrs.NodeId) || null,
|
|
358
|
+
browseName: convertQualifiedName(attrs.BrowseName)
|
|
359
|
+
};
|
|
355
360
|
},
|
|
356
361
|
finish() {
|
|
357
362
|
_internal_addReferenceType(this.obj);
|
|
@@ -375,18 +380,21 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
375
380
|
References: references_parser
|
|
376
381
|
}
|
|
377
382
|
};
|
|
383
|
+
// #endregion
|
|
384
|
+
// #region UADataType
|
|
378
385
|
const pendingSimpleTypeToRegister = [];
|
|
379
386
|
const state_UADataType = {
|
|
380
387
|
init(name, attrs) {
|
|
381
388
|
_perform();
|
|
382
|
-
this.obj = {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
this.obj = {
|
|
390
|
+
nodeClass: node_opcua_data_model_1.NodeClass.DataType,
|
|
391
|
+
isAbstract: (0, node_opcua_basic_types_1.coerceBoolean)(attrs.IsAbstract) || false,
|
|
392
|
+
nodeId: convertToNodeId(attrs.NodeId) || null,
|
|
393
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
394
|
+
displayName: "",
|
|
395
|
+
description: "",
|
|
396
|
+
symbolicName: attrs.SymbolicName
|
|
397
|
+
};
|
|
390
398
|
this.isDraft = attrs.ReleaseStatus === "Draft";
|
|
391
399
|
this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
|
|
392
400
|
this.definitionFields = [];
|
|
@@ -438,685 +446,64 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
438
446
|
Definition: node_opcua_xml2json_1._definitionParser
|
|
439
447
|
}
|
|
440
448
|
};
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
parser: {
|
|
447
|
-
Locale: {
|
|
448
|
-
finish() {
|
|
449
|
-
this.parent.localizedText.locale = this.text.trim();
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
Text: {
|
|
453
|
-
finish() {
|
|
454
|
-
this.parent.localizedText.text = this.text.trim();
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
const qualifiedName_parser = {
|
|
461
|
-
QualifiedName: {
|
|
462
|
-
init() {
|
|
463
|
-
this.qualifiedName = {
|
|
464
|
-
namespaceIndex: 0,
|
|
465
|
-
name: null
|
|
466
|
-
};
|
|
467
|
-
},
|
|
468
|
-
parser: {
|
|
469
|
-
Name: {
|
|
470
|
-
finish() {
|
|
471
|
-
this.parent.qualifiedName.name = this.text.trim();
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
NamespaceIndex: {
|
|
475
|
-
finish() {
|
|
476
|
-
const ns = parseInt(this.text, 10);
|
|
477
|
-
const t = _translateNodeId((0, node_opcua_nodeid_1.resolveNodeId)(`ns=${ns};i=1`).toString());
|
|
478
|
-
this.parent.qualifiedName.namespaceIndex = t.namespace;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
const nodeId_parser = {
|
|
485
|
-
NodeId: {
|
|
486
|
-
init() {
|
|
487
|
-
this.nodeId = "";
|
|
488
|
-
},
|
|
489
|
-
parser: {
|
|
490
|
-
Identifier: {
|
|
491
|
-
finish() {
|
|
492
|
-
this.parent.nodeId = _translateNodeId((0, node_opcua_nodeid_1.resolveNodeId)(this.text.trim()).toString());
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
const enumValueType_parser = {
|
|
499
|
-
EnumValueType: {
|
|
500
|
-
init() {
|
|
501
|
-
this.enumValueType = new node_opcua_types_1.EnumValueType({
|
|
502
|
-
description: undefined,
|
|
503
|
-
displayName: undefined,
|
|
504
|
-
value: (0, node_opcua_basic_types_2.coerceInt64)(-1)
|
|
505
|
-
});
|
|
506
|
-
},
|
|
507
|
-
parser: {
|
|
508
|
-
Value: {
|
|
509
|
-
// note: Value may be missing, in this case value shall be set to -1(64)
|
|
510
|
-
finish() {
|
|
511
|
-
// Low part
|
|
512
|
-
this.parent.enumValueType.value = (0, node_opcua_basic_types_2.coerceInt64)(parseInt(this.text, 10));
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
DisplayName: {
|
|
516
|
-
...localizedText_parser.LocalizedText,
|
|
517
|
-
finish() {
|
|
518
|
-
this.parent.enumValueType.displayName = { ...this.localizedText };
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
Description: {
|
|
522
|
-
...localizedText_parser.LocalizedText,
|
|
523
|
-
finish() {
|
|
524
|
-
this.parent.enumValueType.description = { ...this.localizedText };
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
finish() {
|
|
529
|
-
this.enumValueType = new node_opcua_types_1.EnumValueType(this.enumValueType);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
const argument_parser = {
|
|
534
|
-
Argument: {
|
|
535
|
-
init() {
|
|
536
|
-
this.argument = new node_opcua_service_call_1.Argument({});
|
|
537
|
-
},
|
|
538
|
-
parser: {
|
|
539
|
-
Name: {
|
|
540
|
-
finish() {
|
|
541
|
-
this.parent.argument.name = this.text.trim();
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
DataType: {
|
|
545
|
-
parser: {
|
|
546
|
-
Identifier: {
|
|
547
|
-
finish() {
|
|
548
|
-
this.parent.parent.argument.dataType = _translateNodeId((0, node_opcua_nodeid_1.resolveNodeId)(this.text.trim()).toString());
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
},
|
|
553
|
-
ValueRank: {
|
|
554
|
-
finish() {
|
|
555
|
-
this.parent.argument.valueRank = parseInt(this.text.trim(), 10);
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
ArrayDimensions: {
|
|
559
|
-
finish() {
|
|
560
|
-
// xx this.parent.argument.arrayDimensions =[];
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
Description: {
|
|
564
|
-
init() {
|
|
565
|
-
this._text = "";
|
|
566
|
-
this.locale = null;
|
|
567
|
-
this.text = null;
|
|
568
|
-
},
|
|
569
|
-
parser: {
|
|
570
|
-
Locale: {
|
|
571
|
-
init() {
|
|
572
|
-
this.text = "";
|
|
573
|
-
},
|
|
574
|
-
finish() {
|
|
575
|
-
this.parent.locale = this.text.trim();
|
|
576
|
-
}
|
|
577
|
-
},
|
|
578
|
-
Text: {
|
|
579
|
-
finish() {
|
|
580
|
-
this.text = this.text || "";
|
|
581
|
-
this.parent._text = this.text.trim();
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
},
|
|
585
|
-
finish() {
|
|
586
|
-
this.parent.argument.description = (0, node_opcua_data_model_1.coerceLocalizedText)(this._text);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
},
|
|
590
|
-
finish() {
|
|
591
|
-
// xx this.argument = new Argument(this.argument);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
const Range_parser = {
|
|
596
|
-
Range: {
|
|
597
|
-
init() {
|
|
598
|
-
this.range = new node_opcua_types_1.Range({});
|
|
599
|
-
},
|
|
600
|
-
parser: {
|
|
601
|
-
Low: {
|
|
602
|
-
finish() {
|
|
603
|
-
this.parent.range.low = parseFloat(this.text);
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
High: {
|
|
607
|
-
finish() {
|
|
608
|
-
this.parent.range.high = parseFloat(this.text);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
const EUInformation_parser = {
|
|
615
|
-
EUInformation: {
|
|
616
|
-
init() {
|
|
617
|
-
this.euInformation = new node_opcua_data_access_1.EUInformation({});
|
|
618
|
-
},
|
|
619
|
-
parser: {
|
|
620
|
-
NamespaceUri: {
|
|
621
|
-
finish() {
|
|
622
|
-
this.parent.euInformation.namespaceUri = this.text;
|
|
623
|
-
}
|
|
624
|
-
},
|
|
625
|
-
UnitId: {
|
|
626
|
-
finish() {
|
|
627
|
-
this.parent.euInformation.unitId = parseInt(this.text, 10);
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
DisplayName: {
|
|
631
|
-
...localizedText_parser.LocalizedText,
|
|
632
|
-
finish() {
|
|
633
|
-
this.parent.euInformation.displayName = { ...this.localizedText };
|
|
634
|
-
}
|
|
635
|
-
},
|
|
636
|
-
Description: {
|
|
637
|
-
...localizedText_parser.LocalizedText,
|
|
638
|
-
finish() {
|
|
639
|
-
this.parent.euInformation.description = { ...this.localizedText };
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
finish() {
|
|
644
|
-
this.euInformation = new node_opcua_data_access_1.EUInformation(this.euInformation);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
const _extensionObject_inner_parser = {
|
|
649
|
-
TypeId: {
|
|
650
|
-
parser: {
|
|
651
|
-
Identifier: {
|
|
652
|
-
finish() {
|
|
653
|
-
const typeDefinitionId = this.text.trim();
|
|
654
|
-
const self = this.parent.parent; // ExtensionObject
|
|
655
|
-
self.typeDefinitionId = (0, node_opcua_nodeid_1.resolveNodeId)(typeDefinitionId);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
Body2: new node_opcua_xml2json_1.FragmentClonerParser(),
|
|
661
|
-
Body: {
|
|
662
|
-
parser: {
|
|
663
|
-
Argument: argument_parser.Argument,
|
|
664
|
-
EUInformation: EUInformation_parser.EUInformation,
|
|
665
|
-
EnumValueType: enumValueType_parser.EnumValueType,
|
|
666
|
-
Range: Range_parser.Range
|
|
667
|
-
},
|
|
668
|
-
startElement(elementName, attrs) {
|
|
669
|
-
const self = this.parent; // ExtensionObject
|
|
670
|
-
self.extensionObject = null;
|
|
671
|
-
self.extensionObjectPojo = null;
|
|
672
|
-
if (!Object.prototype.hasOwnProperty.call(this.parser, elementName)) {
|
|
673
|
-
// treat it as a opaque XML bloc for the time being
|
|
674
|
-
// until we find the definition of this object, so we know how to interpret the fields
|
|
675
|
-
this._cloneFragment = new node_opcua_xml2json_1.InternalFragmentClonerReaderState();
|
|
676
|
-
this.engine._promote(this._cloneFragment, this.engine.currentLevel, elementName, attrs);
|
|
677
|
-
}
|
|
678
|
-
},
|
|
679
|
-
finish() {
|
|
680
|
-
const self = this.parent; // ExtensionObject
|
|
681
|
-
// typeDefinitionId is also the "Default XML" encoding nodeId !
|
|
682
|
-
switch (self.typeDefinitionId.toString()) {
|
|
683
|
-
case "i=7616": // EnumValueType
|
|
684
|
-
case "ns=0;i=7616": // EnumValueType
|
|
685
|
-
self.extensionObject = self.parser.Body.parser.EnumValueType.enumValueType;
|
|
686
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject !== null && typeof self.extensionObject === "object");
|
|
687
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
|
|
688
|
-
break;
|
|
689
|
-
case "i=297": // Arguments
|
|
690
|
-
case "ns=0;i=297": // Arguments
|
|
691
|
-
self.extensionObject = self.parser.Body.parser.Argument.argument;
|
|
692
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject !== null && typeof self.extensionObject === "object");
|
|
693
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
|
|
694
|
-
break;
|
|
695
|
-
case "i=888":
|
|
696
|
-
case "ns=0;i=888": // EUInformation
|
|
697
|
-
self.extensionObject = self.parser.Body.parser.EUInformation.euInformation;
|
|
698
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject !== null && typeof self.extensionObject === "object");
|
|
699
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
|
|
700
|
-
break;
|
|
701
|
-
case "i=885": // Range
|
|
702
|
-
case "ns=0;i=885":
|
|
703
|
-
self.extensionObject = self.parser.Body.parser.Range.range;
|
|
704
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject !== null && typeof self.extensionObject === "object");
|
|
705
|
-
(0, node_opcua_assert_1.assert)(self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
|
|
706
|
-
break;
|
|
707
|
-
default: {
|
|
708
|
-
// istanbul ignore next
|
|
709
|
-
if (!this._cloneFragment) {
|
|
710
|
-
// the XML file is probably not exposing standard UA extension object correctly.
|
|
711
|
-
// this has been seen in some generated xml files using the dataType nodeId instead of the default encoding
|
|
712
|
-
// nodeid
|
|
713
|
-
errorLog("[NODE-OPCUA-E12] standard OPCUA Extension object from (namespace=0) has a invalid TypeId", self.typeDefinitionId.toString());
|
|
714
|
-
break;
|
|
715
|
-
}
|
|
716
|
-
this.bodyXML = this._cloneFragment.value;
|
|
717
|
-
this._cloneFragment.value = null;
|
|
718
|
-
// the "Default Xml" encoding nodeId
|
|
719
|
-
const xmlEncodingNodeId = _translateNodeId(self.typeDefinitionId.toString());
|
|
720
|
-
if (xmlEncodingNodeId.isEmpty()) {
|
|
721
|
-
debugLog("xmlEncodingNodeId is empty for " + self.typeDefinitionId.toString());
|
|
722
|
-
break;
|
|
723
|
-
}
|
|
724
|
-
let captureXmlBody = this.bodyXML;
|
|
725
|
-
// istanbul ignore next
|
|
726
|
-
if (doDebug) {
|
|
727
|
-
debugLog("xxxx ", chalk_1.default.yellow(captureXmlBody));
|
|
728
|
-
}
|
|
729
|
-
// this is a user defined Extension Object
|
|
730
|
-
// istanbul ignore next
|
|
731
|
-
debugLog("load nodeset2: typeDefinitionId in ExtensionObject Default XML = " + xmlEncodingNodeId.toString());
|
|
732
|
-
let captured = self.postTaskData;
|
|
733
|
-
self.extensionObjectPojo = null;
|
|
734
|
-
const task = async (addressSpace2) => {
|
|
735
|
-
const extensionObject = await (0, decode_xml_extension_object_1.decodeXmlExtensionObject)(addressSpace2, xmlEncodingNodeId, captureXmlBody);
|
|
736
|
-
if (captured) {
|
|
737
|
-
captured.postponedExtensionObject = extensionObject;
|
|
738
|
-
}
|
|
739
|
-
captureXmlBody = undefined;
|
|
740
|
-
captured = undefined;
|
|
741
|
-
};
|
|
742
|
-
postTasks0_DecodePojoString.push(task);
|
|
743
|
-
(0, node_opcua_assert_1.assert)(!self.extensionObject || self.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject);
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
const extensionObject_parser = {
|
|
751
|
-
ExtensionObject: {
|
|
752
|
-
init() {
|
|
753
|
-
this.typeDefinitionId = node_opcua_nodeid_1.NodeId.nullNodeId;
|
|
754
|
-
this.extensionObject = null;
|
|
755
|
-
this.extensionObjectPojo = null;
|
|
756
|
-
this.postTaskData = { postponedExtensionObject: null };
|
|
757
|
-
},
|
|
758
|
-
parser: _extensionObject_inner_parser,
|
|
759
|
-
finish() {
|
|
760
|
-
/* empty */
|
|
761
|
-
}
|
|
449
|
+
// #endregion
|
|
450
|
+
const canIngore = ({ isDraft, isDeprecated }, node) => {
|
|
451
|
+
if (isDraft && !options.loadDraftNodes) {
|
|
452
|
+
debugLog("Ignoring Draft =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
|
|
453
|
+
return true;
|
|
762
454
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
const r = {
|
|
767
|
-
init(name, attrs) {
|
|
768
|
-
this.value = undefined;
|
|
769
|
-
},
|
|
770
|
-
finish() {
|
|
771
|
-
this.value = parseFunc.call(this, this.text);
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
_parser[dataType] = r;
|
|
775
|
-
return _parser;
|
|
776
|
-
}
|
|
777
|
-
function ListOf(dataType, parseFunc) {
|
|
778
|
-
return {
|
|
779
|
-
init() {
|
|
780
|
-
this.listData = [];
|
|
781
|
-
},
|
|
782
|
-
parser: BasicType_parser(dataType, parseFunc),
|
|
783
|
-
finish() {
|
|
784
|
-
this.parent.parent.obj.value = {
|
|
785
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
786
|
-
dataType: node_opcua_variant_1.DataType[dataType],
|
|
787
|
-
value: this.listData
|
|
788
|
-
};
|
|
789
|
-
},
|
|
790
|
-
endElement(element) {
|
|
791
|
-
this.listData.push(this.parser[dataType].value);
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function parser2(type, p) {
|
|
796
|
-
return {
|
|
797
|
-
finish() {
|
|
798
|
-
this.parent.parent.obj.value = {
|
|
799
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
800
|
-
dataType: node_opcua_variant_1.DataType[type],
|
|
801
|
-
value: p(this.text)
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
const parseUInt64 = (str) => (0, node_opcua_basic_types_2.coerceUInt64)(str);
|
|
807
|
-
const parseInt64 = (str) => (0, node_opcua_basic_types_2.coerceInt64)(str);
|
|
808
|
-
const state_Variant = {
|
|
809
|
-
init: () => {
|
|
810
|
-
/* empty */
|
|
811
|
-
},
|
|
812
|
-
parser: {
|
|
813
|
-
QualifiedName: {
|
|
814
|
-
...qualifiedName_parser.QualifiedName,
|
|
815
|
-
finish() {
|
|
816
|
-
this.parent.parent.obj.value = {
|
|
817
|
-
dataType: node_opcua_variant_1.DataType.QualifiedName,
|
|
818
|
-
value: this.qualifiedName
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
LocalizedText: {
|
|
823
|
-
...localizedText_parser.LocalizedText,
|
|
824
|
-
finish() {
|
|
825
|
-
this.parent.parent.obj.value = {
|
|
826
|
-
dataType: node_opcua_variant_1.DataType.LocalizedText,
|
|
827
|
-
value: this.localizedText
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
XmlElement: {
|
|
832
|
-
finish() {
|
|
833
|
-
this.parent.parent.obj.value = {
|
|
834
|
-
dataType: node_opcua_variant_1.DataType.XmlElement,
|
|
835
|
-
value: this.text
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
},
|
|
839
|
-
String: {
|
|
840
|
-
finish() {
|
|
841
|
-
this.parent.parent.obj.value = {
|
|
842
|
-
dataType: node_opcua_variant_1.DataType.String,
|
|
843
|
-
value: this.text
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
Guid: {
|
|
848
|
-
parser: {
|
|
849
|
-
String: {
|
|
850
|
-
finish() {
|
|
851
|
-
const guid = this.text;
|
|
852
|
-
if (!(0, node_opcua_basic_types_2.isValidGuid)(guid)) {
|
|
853
|
-
/* ?*/
|
|
854
|
-
}
|
|
855
|
-
this.parent.parent.parent.obj.value = {
|
|
856
|
-
dataType: node_opcua_variant_1.DataType.Guid,
|
|
857
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
858
|
-
value: this.text
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
},
|
|
864
|
-
NodeId: {
|
|
865
|
-
parser: {
|
|
866
|
-
Identifier: {
|
|
867
|
-
finish() {
|
|
868
|
-
const nodeId = this.text;
|
|
869
|
-
this.parent.parent.parent.obj.value = {
|
|
870
|
-
dataType: node_opcua_variant_1.DataType.NodeId,
|
|
871
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
872
|
-
value: _translateNodeId((0, node_opcua_nodeid_1.resolveNodeId)(nodeId).toString())
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
Boolean: parser2("Boolean", node_opcua_basic_types_1.coerceBoolean),
|
|
879
|
-
Byte: parser2("Byte", parseInt),
|
|
880
|
-
Int16: parser2("Int16", parseInt),
|
|
881
|
-
Int32: parser2("Int32", parseInt),
|
|
882
|
-
Int8: parser2("Int8", parseInt),
|
|
883
|
-
SByte: parser2("SByte", parseInt),
|
|
884
|
-
UInt16: parser2("UInt16", parseInt),
|
|
885
|
-
UInt32: parser2("UInt32", parseInt),
|
|
886
|
-
UInt8: parser2("UInt8", parseInt),
|
|
887
|
-
UInt64: parser2("UInt64", parseUInt64),
|
|
888
|
-
Int64: parser2("Int64", parseInt64),
|
|
889
|
-
ByteString: {
|
|
890
|
-
init() {
|
|
891
|
-
this.value = null;
|
|
892
|
-
},
|
|
893
|
-
finish() {
|
|
894
|
-
const base64text = this.text;
|
|
895
|
-
const byteString = Buffer.from(base64text, "base64");
|
|
896
|
-
this.parent.parent.obj.value = {
|
|
897
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
898
|
-
dataType: node_opcua_variant_1.DataType.ByteString,
|
|
899
|
-
value: byteString
|
|
900
|
-
};
|
|
901
|
-
}
|
|
902
|
-
},
|
|
903
|
-
Float: {
|
|
904
|
-
finish() {
|
|
905
|
-
this.parent.parent.obj.value = {
|
|
906
|
-
dataType: node_opcua_variant_1.DataType.Float,
|
|
907
|
-
value: parseFloat(this.text)
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
},
|
|
911
|
-
Double: {
|
|
912
|
-
finish() {
|
|
913
|
-
this.parent.parent.obj.value = {
|
|
914
|
-
dataType: node_opcua_variant_1.DataType.Double,
|
|
915
|
-
value: parseFloat(this.text)
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
},
|
|
919
|
-
ListOfExtensionObject: {
|
|
920
|
-
init() {
|
|
921
|
-
this.listExtensionObject = [];
|
|
922
|
-
},
|
|
923
|
-
parser: extensionObject_parser,
|
|
924
|
-
finish() {
|
|
925
|
-
installExtensionObjectListInitializationPostTask(this);
|
|
926
|
-
},
|
|
927
|
-
startElement(elementName) {
|
|
928
|
-
/* empty */
|
|
929
|
-
const extensionObjectParser = this.parser.ExtensionObject;
|
|
930
|
-
extensionObjectParser.postTaskData = { postponedExtensionObject: null };
|
|
931
|
-
},
|
|
932
|
-
endElement(elementName) {
|
|
933
|
-
const extensionObjectParser = this.parser.ExtensionObject;
|
|
934
|
-
this.listExtensionObject.push(extensionObjectParser.extensionObject);
|
|
935
|
-
if (this.parser.ExtensionObject.extensionObject === null) {
|
|
936
|
-
// extension object creation will be postponed
|
|
937
|
-
const index = this.listExtensionObject.length - 1;
|
|
938
|
-
let capturedData = extensionObjectParser.postTaskData;
|
|
939
|
-
// istanbul ignore next
|
|
940
|
-
if (!capturedData) {
|
|
941
|
-
throw new Error("Internal Error : postponedExtensionObject not resolved");
|
|
942
|
-
}
|
|
943
|
-
let listExtensionObject = this.listExtensionObject;
|
|
944
|
-
const task = async (addressSpace2) => {
|
|
945
|
-
// istanbul ignore next
|
|
946
|
-
if (!capturedData.postponedExtensionObject) {
|
|
947
|
-
throw new Error("Internal Error : postponedExtensionObject not resolved");
|
|
948
|
-
}
|
|
949
|
-
listExtensionObject[index] = capturedData.postponedExtensionObject;
|
|
950
|
-
capturedData = undefined;
|
|
951
|
-
listExtensionObject = undefined;
|
|
952
|
-
};
|
|
953
|
-
postTasks2_AssignedExtensionObjectToDataValue.push(task);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
ListOfLocalizedText: {
|
|
958
|
-
init() {
|
|
959
|
-
this.listData = [];
|
|
960
|
-
},
|
|
961
|
-
parser: localizedText_parser,
|
|
962
|
-
finish() {
|
|
963
|
-
this.parent.parent.obj.value = {
|
|
964
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
965
|
-
dataType: node_opcua_variant_1.DataType.LocalizedText,
|
|
966
|
-
value: this.listData
|
|
967
|
-
};
|
|
968
|
-
},
|
|
969
|
-
endElement() {
|
|
970
|
-
this.listData.push(this.parser.LocalizedText.localizedText);
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
ListOfQualifiedName: {
|
|
974
|
-
init() {
|
|
975
|
-
this.listData = [];
|
|
976
|
-
},
|
|
977
|
-
parser: qualifiedName_parser,
|
|
978
|
-
finish() {
|
|
979
|
-
this.parent.parent.obj.value = {
|
|
980
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
981
|
-
dataType: node_opcua_variant_1.DataType.QualifiedName,
|
|
982
|
-
value: this.listData
|
|
983
|
-
};
|
|
984
|
-
},
|
|
985
|
-
endElement() {
|
|
986
|
-
this.listData.push(this.parser.QualifiedName.qualifiedName);
|
|
987
|
-
}
|
|
988
|
-
},
|
|
989
|
-
ListOfNodeId: {
|
|
990
|
-
init() {
|
|
991
|
-
this.listData = [];
|
|
992
|
-
},
|
|
993
|
-
parser: nodeId_parser,
|
|
994
|
-
finish() {
|
|
995
|
-
this.parent.parent.obj.value = {
|
|
996
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
997
|
-
dataType: node_opcua_variant_1.DataType.NodeId,
|
|
998
|
-
value: this.listData
|
|
999
|
-
};
|
|
1000
|
-
},
|
|
1001
|
-
endElement(elementName) {
|
|
1002
|
-
this.listData.push(this.parser.NodeId.nodeId);
|
|
1003
|
-
}
|
|
1004
|
-
},
|
|
1005
|
-
ListOfBoolean: ListOf("Boolean", node_opcua_basic_types_1.coerceBoolean),
|
|
1006
|
-
ListOfByte: ListOf("Byte", parseInt),
|
|
1007
|
-
ListOfDouble: ListOf("Double", parseFloat),
|
|
1008
|
-
ListOfFloat: ListOf("Float", parseFloat),
|
|
1009
|
-
ListOfInt32: ListOf("Int32", parseInt),
|
|
1010
|
-
ListOfInt16: ListOf("Int16", parseInt),
|
|
1011
|
-
ListOfInt8: ListOf("Int8", parseInt),
|
|
1012
|
-
ListOfUInt32: ListOf("UInt32", parseInt),
|
|
1013
|
-
ListOfUInt16: ListOf("UInt16", parseInt),
|
|
1014
|
-
ListOfUInt8: ListOf("UInt8", parseInt),
|
|
1015
|
-
ListOfString: ListOf("String", (value) => value),
|
|
1016
|
-
ListOfXmlElement: ListOf("XmlElement", (value) => value),
|
|
1017
|
-
ExtensionObject: {
|
|
1018
|
-
init() {
|
|
1019
|
-
this.typeDefinitionId = node_opcua_nodeid_1.NodeId.nullNodeId;
|
|
1020
|
-
this.extensionObject = null;
|
|
1021
|
-
this.postTaskData = { postponedExtensionObject: null };
|
|
1022
|
-
},
|
|
1023
|
-
parser: _extensionObject_inner_parser,
|
|
1024
|
-
finish() {
|
|
1025
|
-
// istanbul ignore next
|
|
1026
|
-
if (this.extensionObject && !(this.extensionObject instanceof node_opcua_extension_object_1.ExtensionObject)) {
|
|
1027
|
-
throw new Error("expecting an extension object");
|
|
1028
|
-
}
|
|
1029
|
-
this.parent.parent.obj.value = {
|
|
1030
|
-
dataType: node_opcua_variant_1.DataType.ExtensionObject,
|
|
1031
|
-
value: this.extensionObject
|
|
1032
|
-
};
|
|
1033
|
-
if (!this.extensionObject) {
|
|
1034
|
-
installExtensionObjectInitializationPostTask(this);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
455
|
+
if (isDeprecated && !options.loadDeprecatedNodes) {
|
|
456
|
+
debugLog("Ignoring Deprecate =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
|
|
457
|
+
return true;
|
|
1038
458
|
}
|
|
459
|
+
return false;
|
|
1039
460
|
};
|
|
1040
|
-
function
|
|
1041
|
-
let
|
|
1042
|
-
let
|
|
1043
|
-
(0, node_opcua_assert_1.assert)(nodeId, "expecting a nodeid");
|
|
461
|
+
function fixExtensionObjectAndArray(obj, deferred) {
|
|
462
|
+
// let's create the mechanism that postpone the assignment of the extension object
|
|
463
|
+
let capturedNode = obj;
|
|
1044
464
|
const task = async (addressSpace2) => {
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
debugLog("Cannot find node with nodeId " + nodeId + ". may be the node was marked as deprecated");
|
|
1048
|
-
}
|
|
1049
|
-
else if (node.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
1050
|
-
const v = node;
|
|
1051
|
-
(0, node_opcua_assert_1.assert)(v.getBasicDataType() === node_opcua_variant_1.DataType.ExtensionObject, "expecting an extension object");
|
|
1052
|
-
v.bindExtensionObject(listExtensionObject, { createMissingProp: false });
|
|
1053
|
-
}
|
|
1054
|
-
else if (node.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
1055
|
-
// no need to bind a variable type
|
|
1056
|
-
const v = node;
|
|
1057
|
-
v /*fix me*/.value.value = listExtensionObject;
|
|
1058
|
-
}
|
|
1059
|
-
listExtensionObject.slice(0);
|
|
1060
|
-
listExtensionObject = undefined;
|
|
1061
|
-
nodeId = undefined;
|
|
1062
|
-
};
|
|
1063
|
-
postTasks2_AssignedExtensionObjectToDataValue.push(task);
|
|
1064
|
-
}
|
|
1065
|
-
function installExtensionObjectInitializationPostTask(element) {
|
|
1066
|
-
// let's create the mechanism that postpone the creation of the
|
|
1067
|
-
// extension object
|
|
1068
|
-
let data = element.postTaskData;
|
|
1069
|
-
let variant = element.parent.parent.obj.value;
|
|
1070
|
-
let nodeId = element.parent.parent.obj.nodeId;
|
|
1071
|
-
const task = async (addressSpace2) => {
|
|
1072
|
-
variant.value = data.postponedExtensionObject;
|
|
465
|
+
const extensionObjOrArray = deferred();
|
|
466
|
+
let nodeId = capturedNode.nodeId;
|
|
1073
467
|
(0, node_opcua_assert_1.assert)(nodeId, "expecting a nodeid");
|
|
1074
468
|
const node = addressSpace2.findNode(nodeId);
|
|
1075
469
|
if (node.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
1076
470
|
const v = node;
|
|
1077
471
|
(0, node_opcua_assert_1.assert)(v.getBasicDataType() === node_opcua_variant_1.DataType.ExtensionObject, "expecting an extension object");
|
|
1078
|
-
|
|
472
|
+
if (extensionObjOrArray != null) {
|
|
473
|
+
v.bindExtensionObject(extensionObjOrArray, { createMissingProp: false });
|
|
474
|
+
}
|
|
1079
475
|
}
|
|
1080
476
|
else if (node.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
1081
477
|
const v = node;
|
|
1082
|
-
v /*fix me*/.value.value =
|
|
478
|
+
v /*fix me*/.value.value = extensionObjOrArray;
|
|
1083
479
|
}
|
|
1084
|
-
data.postponedExtensionObject = null;
|
|
1085
|
-
data = undefined;
|
|
1086
|
-
variant = undefined;
|
|
1087
|
-
nodeId = undefined;
|
|
1088
480
|
};
|
|
1089
481
|
postTasks2_AssignedExtensionObjectToDataValue.push(task);
|
|
1090
482
|
}
|
|
1091
|
-
const canIngore = ({ isDraft, isDeprecated }, node) => {
|
|
1092
|
-
if (isDraft && !options.loadDraftNodes) {
|
|
1093
|
-
debugLog("Ignoring Draft =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
|
|
1094
|
-
return true;
|
|
1095
|
-
}
|
|
1096
|
-
if (isDeprecated && !options.loadDeprecatedNodes) {
|
|
1097
|
-
debugLog("Ignoring Deprecate =", node_opcua_data_model_1.NodeClass[node.nodeClass], node.browseName.toString());
|
|
1098
|
-
return true;
|
|
1099
|
-
}
|
|
1100
|
-
return false;
|
|
1101
|
-
};
|
|
1102
483
|
const state_UAVariable = {
|
|
1103
484
|
init(name, attrs) {
|
|
1104
485
|
_perform();
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
this.obj
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
486
|
+
const valueRank = attrs.ValueRank === undefined ? -1 : (0, node_opcua_basic_types_1.coerceInt32)(attrs.ValueRank);
|
|
487
|
+
const accessLevel = convertAccessLevel(attrs.AccessLevel);
|
|
488
|
+
const nodeId = convertToNodeId(attrs.NodeId);
|
|
489
|
+
this.obj = {
|
|
490
|
+
value: undefined, // { dataType: DataType.Null },
|
|
491
|
+
nodeClass: node_opcua_data_model_1.NodeClass.Variable,
|
|
492
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
493
|
+
parentNodeId: convertToNodeId(attrs.ParentNodeId),
|
|
494
|
+
dataType: convertToNodeId(attrs.DataType),
|
|
495
|
+
//description: null,
|
|
496
|
+
// displayName: coerceLocalizedText(attrs.BrowseName)!,
|
|
497
|
+
valueRank,
|
|
498
|
+
arrayDimensions: valueRank <= 0 ? null : stringToUInt32Array(attrs.ArrayDimensions),
|
|
499
|
+
minimumSamplingInterval: attrs.MinimumSamplingInterval ? parseInt(attrs.MinimumSamplingInterval, 10) : 0,
|
|
500
|
+
historizing: false,
|
|
501
|
+
nodeId,
|
|
502
|
+
accessLevel: accessLevel,
|
|
503
|
+
userAccessLevel: accessLevel // convertAccessLevel(attrs.UserAccessLevel || attrs.AccessLevel);
|
|
504
|
+
};
|
|
505
|
+
this.isDraft = attrs.ReleaseStatus === "Draft" || false;
|
|
506
|
+
this.isDeprecated = attrs.ReleaseStatus === "Deprecated" || false;
|
|
1120
507
|
},
|
|
1121
508
|
finish() {
|
|
1122
509
|
if (canIngore({ isDraft: this.isDraft, isDeprecated: this.isDeprecated }, this.obj)) {
|
|
@@ -1132,7 +519,7 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
1132
519
|
*/
|
|
1133
520
|
// eslint-disable-next-line prefer-const
|
|
1134
521
|
let capturedVariable;
|
|
1135
|
-
if (this.obj.value) {
|
|
522
|
+
if (this.obj.value && this.obj.value.dataType !== node_opcua_variant_1.DataType.Null) {
|
|
1136
523
|
let capturedValue = this.obj.value;
|
|
1137
524
|
const task = async (addressSpace2) => {
|
|
1138
525
|
if (false && doDebug) {
|
|
@@ -1146,7 +533,7 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
1146
533
|
postTasks0_InitializeVariable.push(task);
|
|
1147
534
|
}
|
|
1148
535
|
else {
|
|
1149
|
-
// do them later
|
|
536
|
+
// do them later when every thing is created
|
|
1150
537
|
postTasks1_InitializeVariable.push(task);
|
|
1151
538
|
}
|
|
1152
539
|
}
|
|
@@ -1171,38 +558,49 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
1171
558
|
};
|
|
1172
559
|
postTasks0_InitializeVariable.push(task);
|
|
1173
560
|
}
|
|
1174
|
-
this.obj.value =
|
|
561
|
+
this.obj.value = Object.create(null);
|
|
1175
562
|
capturedVariable = _internal_createNode(this.obj);
|
|
1176
563
|
},
|
|
1177
564
|
parser: {
|
|
1178
565
|
DisplayName: {
|
|
1179
566
|
finish() {
|
|
1180
|
-
this.parent.obj.displayName = this.text;
|
|
567
|
+
this.parent.obj.displayName = (0, node_opcua_data_model_1.coerceLocalizedText)(this.text);
|
|
1181
568
|
}
|
|
1182
569
|
},
|
|
1183
570
|
Description: {
|
|
1184
571
|
finish() {
|
|
1185
|
-
this.parent.obj.description = this.text;
|
|
572
|
+
this.parent.obj.description = (0, node_opcua_data_model_1.coerceLocalizedText)(this.text);
|
|
1186
573
|
}
|
|
1187
574
|
},
|
|
1188
575
|
References: references_parser,
|
|
1189
|
-
Value:
|
|
576
|
+
Value: (0, variant_parser_1.makeVariantReader)((self, data) => {
|
|
577
|
+
self.parent.obj.value = data;
|
|
578
|
+
}, (self, data, deferredTask) => {
|
|
579
|
+
self.parent.obj.value = data;
|
|
580
|
+
const capturedVariable = { nodeId: self.parent.obj.nodeId };
|
|
581
|
+
fixExtensionObjectAndArray(capturedVariable, deferredTask);
|
|
582
|
+
}, (task) => {
|
|
583
|
+
postTasks0_DecodePojoString.push(task);
|
|
584
|
+
}, _translateNodeId)
|
|
1190
585
|
}
|
|
1191
586
|
};
|
|
1192
587
|
const state_UAVariableType = {
|
|
1193
588
|
init(name, attrs) {
|
|
1194
589
|
_perform();
|
|
1195
|
-
|
|
1196
|
-
this.obj
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
590
|
+
const valueRank = (0, node_opcua_basic_types_1.coerceInt32)(attrs.ValueRank) || -1;
|
|
591
|
+
this.obj = {
|
|
592
|
+
value: undefined, // { dataType: DataType.Null },
|
|
593
|
+
isAbstract: (0, node_opcua_basic_types_1.coerceBoolean)(attrs.IsAbstract),
|
|
594
|
+
nodeClass: node_opcua_data_model_1.NodeClass.VariableType,
|
|
595
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
596
|
+
parentNodeId: convertToNodeId(attrs.ParentNodeId) || null,
|
|
597
|
+
dataType: convertToNodeId(attrs.DataType) || null,
|
|
598
|
+
valueRank,
|
|
599
|
+
arrayDimensions: valueRank <= 0 ? null : stringToUInt32Array(attrs.ArrayDimensions),
|
|
600
|
+
minimumSamplingInterval: attrs.MinimumSamplingInterval ? parseInt(attrs.MinimumSamplingInterval, 10) : 0,
|
|
601
|
+
historizing: false,
|
|
602
|
+
nodeId: convertToNodeId(attrs.NodeId) || null
|
|
603
|
+
};
|
|
1206
604
|
this.isDraft = attrs.ReleaseStatus === "Draft";
|
|
1207
605
|
this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
|
|
1208
606
|
},
|
|
@@ -1214,38 +612,47 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
1214
612
|
_internal_createNode(this.obj);
|
|
1215
613
|
} /* istanbul ignore next */
|
|
1216
614
|
catch (err) {
|
|
1217
|
-
this.obj
|
|
1218
|
-
// tslint:disable:no-console
|
|
1219
|
-
console.warn(" Cannot create object", JSON.stringify(this.obj, null, " "));
|
|
615
|
+
errorLog(" Cannot create object", JSON.stringify(this.obj, null, " "));
|
|
1220
616
|
throw err;
|
|
1221
617
|
}
|
|
1222
618
|
},
|
|
1223
619
|
parser: {
|
|
1224
620
|
DisplayName: {
|
|
1225
621
|
finish() {
|
|
1226
|
-
this.parent.obj.displayName = this.text;
|
|
622
|
+
this.parent.obj.displayName = (0, node_opcua_data_model_1.coerceLocalizedText)(this.text || "");
|
|
1227
623
|
}
|
|
1228
624
|
},
|
|
1229
625
|
Description: {
|
|
1230
626
|
finish() {
|
|
1231
|
-
this.parent.obj.description = this.text;
|
|
627
|
+
this.parent.obj.description = (0, node_opcua_data_model_1.coerceLocalizedText)(this.text || "");
|
|
1232
628
|
}
|
|
1233
629
|
},
|
|
1234
630
|
References: references_parser,
|
|
1235
|
-
Value:
|
|
631
|
+
Value: (0, variant_parser_1.makeVariantReader)((self, data) => {
|
|
632
|
+
self.parent.obj.value = data;
|
|
633
|
+
}, (self, data, deferredTask) => {
|
|
634
|
+
self.parent.obj.value = data;
|
|
635
|
+
const capturedVariable = { nodeId: self.parent.obj.nodeId };
|
|
636
|
+
fixExtensionObjectAndArray(capturedVariable, deferredTask);
|
|
637
|
+
}, (task) => {
|
|
638
|
+
postTasks0_DecodePojoString.push(task);
|
|
639
|
+
}, _translateNodeId)
|
|
1236
640
|
}
|
|
1237
641
|
};
|
|
642
|
+
// #endregion
|
|
643
|
+
// #region UAMethod
|
|
1238
644
|
const state_UAMethod = {
|
|
1239
645
|
init(name, attrs) {
|
|
1240
646
|
_perform();
|
|
1241
|
-
this.obj = {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
647
|
+
this.obj = {
|
|
648
|
+
nodeClass: node_opcua_data_model_1.NodeClass.Method,
|
|
649
|
+
// MethodDeclarationId
|
|
650
|
+
// ParentNodeId
|
|
651
|
+
browseName: convertQualifiedName(attrs.BrowseName),
|
|
652
|
+
parentNodeId: attrs.ParentNodeId || null,
|
|
653
|
+
nodeId: convertToNodeId(attrs.NodeId) || null,
|
|
654
|
+
methodDeclarationId: attrs.MethodDeclarationId ? _translateNodeId(attrs.MethodDeclarationId) : null,
|
|
655
|
+
};
|
|
1249
656
|
this.isDraft = attrs.ReleaseStatus === "Draft";
|
|
1250
657
|
this.isDeprecated = attrs.ReleaseStatus === "Deprecated";
|
|
1251
658
|
},
|
|
@@ -1301,6 +708,7 @@ function makeNodeSetParserEngine(addressSpace, options) {
|
|
|
1301
708
|
models.push(model);
|
|
1302
709
|
}
|
|
1303
710
|
});
|
|
711
|
+
// #endregion
|
|
1304
712
|
function _updateTranslationTable() {
|
|
1305
713
|
_register_namespace_uri_in_translation_table("http://opcfoundation.org/UA/");
|
|
1306
714
|
for (const namespaceUri of _namespaceUris) {
|