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
|
@@ -16,8 +16,6 @@ import { _install_TwoStateVariable_machinery } from "../state_machine/ua_two_sta
|
|
|
16
16
|
import { UAAcknowledgeableConditionEx } from "../../source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex";
|
|
17
17
|
import { ConditionSnapshot } from "../../source/interfaces/alarms_and_conditions/condition_snapshot";
|
|
18
18
|
import { InstantiateAlarmConditionOptions } from "../../source/interfaces/alarms_and_conditions/instantiate_alarm_condition_options";
|
|
19
|
-
|
|
20
|
-
import { _setAckedState } from "./condition";
|
|
21
19
|
import { ConditionSnapshotImpl } from "./condition_snapshot_impl";
|
|
22
20
|
import { UAConditionImpl } from "./ua_condition_impl";
|
|
23
21
|
|
|
@@ -175,7 +173,7 @@ export class UAAcknowledgeableConditionImpl extends UAConditionImpl implements U
|
|
|
175
173
|
): StatusCode {
|
|
176
174
|
assert(typeof message === "string");
|
|
177
175
|
|
|
178
|
-
const statusCode =
|
|
176
|
+
const statusCode = (branch as ConditionSnapshotImpl)._setAckedState(true, conditionEventId, comment);
|
|
179
177
|
if (statusCode.isNotGood()) {
|
|
180
178
|
return statusCode;
|
|
181
179
|
}
|
|
@@ -10,8 +10,12 @@ import { UABaseEvent_Base, UABaseEvent } from "node-opcua-nodeset-ua";
|
|
|
10
10
|
import { UAObjectImpl } from "../ua_object_impl";
|
|
11
11
|
import { UABaseEventHelper } from "../../source/interfaces/alarms_and_conditions/ua_condition_ex";
|
|
12
12
|
|
|
13
|
-
export interface UABaseEventEx extends UABaseEvent_Base, UABaseEventHelper {
|
|
14
|
-
|
|
13
|
+
export interface UABaseEventEx extends UABaseEvent_Base, UABaseEventHelper {
|
|
14
|
+
/** empty interface */
|
|
15
|
+
}
|
|
16
|
+
export declare interface UABaseEventImpl extends UABaseEventEx {
|
|
17
|
+
/** empty interface */
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* @internal
|
|
@@ -192,13 +192,13 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
192
192
|
}
|
|
193
193
|
private _branch0: ConditionSnapshot = null as any;
|
|
194
194
|
private _previousRetainFlag = false;
|
|
195
|
-
private _branches:
|
|
195
|
+
private _branches: Map<string,ConditionSnapshot> = new Map()
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
198
|
* @private
|
|
199
199
|
*/
|
|
200
200
|
public initialize(): void {
|
|
201
|
-
this._branches =
|
|
201
|
+
this._branches = new Map();
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
@@ -220,13 +220,11 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
public getBranchCount(): number {
|
|
223
|
-
return
|
|
223
|
+
return this._branches.size;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
public getBranches(): ConditionSnapshot[] {
|
|
227
|
-
return
|
|
228
|
-
return this._branches[x];
|
|
229
|
-
});
|
|
227
|
+
return [... this._branches.values()];
|
|
230
228
|
}
|
|
231
229
|
|
|
232
230
|
public getBranchIds(): NodeId[] {
|
|
@@ -238,7 +236,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
238
236
|
public createBranch(): ConditionSnapshot {
|
|
239
237
|
const branchId = _create_new_branch_id();
|
|
240
238
|
const snapshot = new ConditionSnapshotImpl(this, branchId);
|
|
241
|
-
this._branches
|
|
239
|
+
this._branches.set(branchId.toString(),snapshot);
|
|
242
240
|
return snapshot;
|
|
243
241
|
}
|
|
244
242
|
|
|
@@ -247,8 +245,8 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
247
245
|
public deleteBranch(branch: ConditionSnapshot): void {
|
|
248
246
|
const key = branch.getBranchId().toString();
|
|
249
247
|
assert(!sameNodeId(branch.getBranchId(), NodeId.nullNodeId), "cannot delete branch zero");
|
|
250
|
-
assert(
|
|
251
|
-
|
|
248
|
+
assert(this._branches.has(key));
|
|
249
|
+
this._branches.delete(key);
|
|
252
250
|
this.emit("branch_deleted", key);
|
|
253
251
|
}
|
|
254
252
|
|
|
@@ -453,7 +451,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
453
451
|
throw new Error("UACondition#raiseNewCondition Condition is not enabled");
|
|
454
452
|
}
|
|
455
453
|
|
|
456
|
-
conditionInfo = conditionInfo || {};
|
|
454
|
+
conditionInfo = conditionInfo || { severity: UAConditionImpl.defaultSeverity };
|
|
457
455
|
|
|
458
456
|
conditionInfo.severity = Object.prototype.hasOwnProperty.call(conditionInfo, "severity")
|
|
459
457
|
? conditionInfo.severity
|
|
@@ -612,7 +610,7 @@ export class UAConditionImpl extends UABaseEventImpl implements UAConditionEx {
|
|
|
612
610
|
if (sameBuffer(this.eventId!.readValue().value.value, eventId)) {
|
|
613
611
|
return this.currentBranch();
|
|
614
612
|
}
|
|
615
|
-
const e =
|
|
613
|
+
const e = [...this._branches.values()].filter((branch: ConditionSnapshot) => sameBuffer(branch.getEventId(), eventId));
|
|
616
614
|
if (e.length === 1) {
|
|
617
615
|
return e[0];
|
|
618
616
|
}
|
|
@@ -730,7 +728,7 @@ function UACondition_instantiate(
|
|
|
730
728
|
value: conditionType.nodeId
|
|
731
729
|
});
|
|
732
730
|
|
|
733
|
-
data = data ||
|
|
731
|
+
data = data || Object.create(null);
|
|
734
732
|
// install initial branch ID (null NodeId);
|
|
735
733
|
conditionNode.branchId.setValueFromSource({
|
|
736
734
|
dataType: DataType.NodeId,
|
|
@@ -771,7 +769,7 @@ function UACondition_instantiate(
|
|
|
771
769
|
conditionNode.enabledState.setValue(true);
|
|
772
770
|
|
|
773
771
|
// set properties to in initial values
|
|
774
|
-
Object.entries(data).forEach(([key, value]) => {
|
|
772
|
+
Object.entries(data!).forEach(([key, value]) => {
|
|
775
773
|
const varNode = _getCompositeKey(conditionNode, key);
|
|
776
774
|
assert(varNode.nodeClass === NodeClass.Variable);
|
|
777
775
|
|
|
@@ -14,7 +14,9 @@ import { UALimitAlarmImpl } from "./ua_limit_alarm_impl";
|
|
|
14
14
|
|
|
15
15
|
const validState = ["HighHigh", "High", "Low", "LowLow", null];
|
|
16
16
|
|
|
17
|
-
export declare interface UAExclusiveLimitAlarmImpl extends UAExclusiveLimitAlarmEx {
|
|
17
|
+
export declare interface UAExclusiveLimitAlarmImpl extends UAExclusiveLimitAlarmEx {
|
|
18
|
+
/** empty interface */
|
|
19
|
+
}
|
|
18
20
|
|
|
19
21
|
export class UAExclusiveLimitAlarmImpl extends UALimitAlarmImpl implements UAExclusiveLimitAlarmEx {
|
|
20
22
|
/***
|
|
@@ -22,4 +22,6 @@ export interface UAExclusiveRateOfChangeAlarmEx
|
|
|
22
22
|
UAExclusiveLimitAlarmEx {
|
|
23
23
|
on(eventName: string, eventHandler: any): this;
|
|
24
24
|
}
|
|
25
|
-
export class UAExclusiveRateOfChangeAlarmImpl extends UAExclusiveLimitAlarmImpl implements UAExclusiveRateOfChangeAlarmEx {
|
|
25
|
+
export class UAExclusiveRateOfChangeAlarmImpl extends UAExclusiveLimitAlarmImpl implements UAExclusiveRateOfChangeAlarmEx {
|
|
26
|
+
/** empty interface */
|
|
27
|
+
}
|
|
@@ -3,10 +3,10 @@ import { UAConditionImpl } from "./alarms_and_conditions/ua_condition_impl";
|
|
|
3
3
|
import { BaseNodeImpl } from "./base_node_impl";
|
|
4
4
|
import { UAObjectImpl } from "./ua_object_impl";
|
|
5
5
|
|
|
6
|
-
export type ConditionRefreshCache =
|
|
6
|
+
export type ConditionRefreshCache = Map<string,UAObject>;
|
|
7
7
|
export function apply_condition_refresh(this: BaseNodeImpl, cache?: ConditionRefreshCache): void {
|
|
8
8
|
// visit all notifiers recursively
|
|
9
|
-
cache = cache ||
|
|
9
|
+
cache = cache || new Map();
|
|
10
10
|
const notifiers = this.getNotifiers();
|
|
11
11
|
const eventSources = this.getEventSources();
|
|
12
12
|
|
|
@@ -20,8 +20,8 @@ export function apply_condition_refresh(this: BaseNodeImpl, cache?: ConditionRef
|
|
|
20
20
|
|
|
21
21
|
for (const notifier of arr) {
|
|
22
22
|
const key = notifier.nodeId.toString();
|
|
23
|
-
if (!cache
|
|
24
|
-
cache
|
|
23
|
+
if (!cache.has(key)) {
|
|
24
|
+
cache.set(key,notifier);
|
|
25
25
|
if (notifier._conditionRefresh) {
|
|
26
26
|
notifier._conditionRefresh(cache);
|
|
27
27
|
}
|
package/src/base_node_impl.ts
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
AccessRestrictionsFlag
|
|
39
39
|
} from "node-opcua-data-model";
|
|
40
40
|
import { DataValue } from "node-opcua-data-value";
|
|
41
|
-
import { dumpIf, make_debugLog,
|
|
41
|
+
import { dumpIf, make_debugLog, make_warningLog, make_errorLog } from "node-opcua-debug";
|
|
42
42
|
import { coerceNodeId, makeNodeId, NodeId, NodeIdLike, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
43
43
|
import { NumericRange } from "node-opcua-numeric-range";
|
|
44
44
|
import { ReferenceDescription } from "node-opcua-service-browse";
|
|
@@ -88,7 +88,7 @@ const errorLog = make_errorLog(__filename);
|
|
|
88
88
|
const debugLog = make_debugLog(__filename);
|
|
89
89
|
|
|
90
90
|
const HasEventSourceReferenceType = resolveNodeId("HasEventSource");
|
|
91
|
-
const HasNotifierReferenceType = resolveNodeId("HasNotifier");
|
|
91
|
+
const HasNotifierReferenceType = resolveNodeId("HasNotifier");
|
|
92
92
|
|
|
93
93
|
function defaultBrowseFilterFunc(context?: ISessionContext): boolean {
|
|
94
94
|
return true;
|
|
@@ -432,17 +432,17 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
432
432
|
// throw new Error("expecting valid reference name " + strReference);
|
|
433
433
|
return [];
|
|
434
434
|
}
|
|
435
|
-
_cache._ref = _cache._ref ||
|
|
435
|
+
_cache._ref = _cache._ref || new Map();
|
|
436
436
|
const hash = "_ref_" + referenceTypeNode.nodeId.toString() + isForward.toString();
|
|
437
|
-
if (_cache._ref
|
|
438
|
-
return _cache._ref
|
|
437
|
+
if (_cache._ref.has(hash)) {
|
|
438
|
+
return _cache._ref.get(hash)!;
|
|
439
439
|
}
|
|
440
440
|
// istanbul ignore next
|
|
441
441
|
if (doDebug && !this.addressSpace.findReferenceType(referenceTypeNode.nodeId)) {
|
|
442
442
|
throw new Error("expecting valid reference name " + referenceType);
|
|
443
443
|
}
|
|
444
444
|
const result = this.findReferences_no_cache(referenceTypeNode, isForward);
|
|
445
|
-
_cache._ref
|
|
445
|
+
_cache._ref.set(hash, result);
|
|
446
446
|
return result;
|
|
447
447
|
}
|
|
448
448
|
|
|
@@ -1103,15 +1103,15 @@ export class BaseNodeImpl extends EventEmitter implements BaseNode {
|
|
|
1103
1103
|
const addressSpace = this.addressSpace;
|
|
1104
1104
|
|
|
1105
1105
|
if (!_cache._childByNameMap) {
|
|
1106
|
-
_cache._childByNameMap =
|
|
1106
|
+
_cache._childByNameMap = new Map();
|
|
1107
1107
|
|
|
1108
1108
|
const childReferenceTypes = this.findReferencesEx("HasChild");
|
|
1109
1109
|
for (const r of childReferenceTypes) {
|
|
1110
1110
|
const child = resolveReferenceNode(addressSpace, r);
|
|
1111
|
-
_cache._childByNameMap
|
|
1111
|
+
_cache._childByNameMap.set(child.browseName.name!.toString(),child);
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
|
-
const ret = _cache._childByNameMap
|
|
1114
|
+
const ret = _cache._childByNameMap.get(browseName.toString()) || null;
|
|
1115
1115
|
return ret;
|
|
1116
1116
|
}
|
|
1117
1117
|
|
|
@@ -1509,11 +1509,11 @@ function _asObject<T extends BaseNode>(references: UAReference[], addressSpace:
|
|
|
1509
1509
|
function toObject(reference: UAReference): T {
|
|
1510
1510
|
const obj = resolveReferenceNode(addressSpace, reference);
|
|
1511
1511
|
// istanbul ignore next
|
|
1512
|
-
if (doDebug&& !obj) {
|
|
1512
|
+
if (doDebug && !obj) {
|
|
1513
1513
|
debugLog(
|
|
1514
1514
|
chalk.red(" Warning : object with nodeId ") +
|
|
1515
|
-
|
|
1516
|
-
|
|
1515
|
+
chalk.cyan(reference.nodeId.toString()) +
|
|
1516
|
+
chalk.red(" cannot be found in the address space !")
|
|
1517
1517
|
);
|
|
1518
1518
|
}
|
|
1519
1519
|
return obj as any as T;
|
|
@@ -1790,7 +1790,7 @@ function install_components_as_object_properties(parentObj: BaseNode) {
|
|
|
1790
1790
|
doDebug && debugLog("Installing property " + name, " on ", parentObj.browseName.toString());
|
|
1791
1791
|
|
|
1792
1792
|
const hasProperty = Object.prototype.hasOwnProperty.call(parentObj, name);
|
|
1793
|
-
if (hasProperty && (
|
|
1793
|
+
if (hasProperty && (parentObj as any)[name] !== null && (parentObj as any)[name] !== undefined) {
|
|
1794
1794
|
continue;
|
|
1795
1795
|
}
|
|
1796
1796
|
|
package/src/base_node_private.ts
CHANGED
|
@@ -57,7 +57,7 @@ const warningLog = make_warningLog(__filename);
|
|
|
57
57
|
|
|
58
58
|
interface BaseNodeCacheInner {
|
|
59
59
|
typeDefinition?: NodeId;
|
|
60
|
-
_childByNameMap?:
|
|
60
|
+
_childByNameMap?: Map<string, BaseNode>;
|
|
61
61
|
typeDefinitionObj?: UAVariableType | UAObjectType | null;
|
|
62
62
|
_aggregates?: BaseNode[];
|
|
63
63
|
_components?: BaseNode[];
|
|
@@ -65,10 +65,9 @@ interface BaseNodeCacheInner {
|
|
|
65
65
|
_notifiers?: BaseNode[];
|
|
66
66
|
_eventSources?: BaseNode[];
|
|
67
67
|
_methods?: UAMethod[];
|
|
68
|
-
_ref?:
|
|
69
|
-
_encoding?:
|
|
70
|
-
|
|
71
|
-
_subtype_idx?: Record<string, UAReferenceType> | null;
|
|
68
|
+
_ref?: Map<string, UAReference[]>;
|
|
69
|
+
_encoding?: Map<string, UAObject | null>;
|
|
70
|
+
_subtype_idx?: Map<string, UAReferenceType> | null;
|
|
72
71
|
_subtype_idxVersion?: number;
|
|
73
72
|
_allSubTypes?: UAReferenceType[] | null;
|
|
74
73
|
_allSubTypesVersion?: number;
|
|
@@ -84,8 +83,6 @@ interface BaseNodeCache {
|
|
|
84
83
|
_parent?: BaseNode | null;
|
|
85
84
|
_back_referenceIdx: { [key: string]: UAReference };
|
|
86
85
|
_referenceIdx: { [key: string]: UAReference };
|
|
87
|
-
_subtype_idxVersion: number;
|
|
88
|
-
_subtype_idx: any;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
export function BaseNode_initPrivate(self: BaseNode): BaseNodeCache {
|
|
@@ -100,8 +97,6 @@ export function BaseNode_initPrivate(self: BaseNode): BaseNodeCache {
|
|
|
100
97
|
_description: undefined,
|
|
101
98
|
_displayName: [],
|
|
102
99
|
_parent: undefined,
|
|
103
|
-
_subtype_idx: {},
|
|
104
|
-
_subtype_idxVersion: 0
|
|
105
100
|
};
|
|
106
101
|
g_weakMap.set(self, _private);
|
|
107
102
|
return _private;
|
|
@@ -1087,7 +1082,7 @@ export function _handle_HierarchicalReference(node: BaseNode, reference: UARefer
|
|
|
1087
1082
|
if (referenceType.isSubtypeOf(HierarchicalReferencesType!)) {
|
|
1088
1083
|
assert(reference.isForward);
|
|
1089
1084
|
const targetNode = ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
1090
|
-
_cache._childByNameMap
|
|
1085
|
+
_cache._childByNameMap.set(targetNode.browseName!.name!.toString(), targetNode);
|
|
1091
1086
|
}
|
|
1092
1087
|
}
|
|
1093
1088
|
}
|
|
@@ -1104,7 +1099,7 @@ function _remove_HierarchicalReference(node: BaseNode, reference: UAReference) {
|
|
|
1104
1099
|
if (referenceType.isSubtypeOf(HierarchicalReferencesType!)) {
|
|
1105
1100
|
assert(reference.isForward);
|
|
1106
1101
|
const targetNode = ReferenceImpl.resolveReferenceNode(addressSpace, reference);
|
|
1107
|
-
|
|
1102
|
+
_cache._childByNameMap.delete(targetNode.browseName!.name!.toString());
|
|
1108
1103
|
}
|
|
1109
1104
|
}
|
|
1110
1105
|
}
|
|
@@ -148,7 +148,7 @@ export class UAMultiStateValueDiscreteImpl<T, DT extends DataType>
|
|
|
148
148
|
public _enumValueIndex(): Record<Int32, DTEnumValue> {
|
|
149
149
|
// construct an index to quickly find a EnumValue from a value
|
|
150
150
|
const enumValues: DTEnumValue[] = this.enumValues.readValue().value.value;
|
|
151
|
-
const enumValueIndex: Record<Int32, DTEnumValue> =
|
|
151
|
+
const enumValueIndex: Record<Int32, DTEnumValue> = Object.create(null);
|
|
152
152
|
if (!enumValues || !enumValues.forEach) {
|
|
153
153
|
return enumValueIndex;
|
|
154
154
|
}
|
|
@@ -696,7 +696,7 @@ export function AddressSpace_installHistoricalDataNode(
|
|
|
696
696
|
};
|
|
697
697
|
|
|
698
698
|
assert(node.nodeClass === NodeClass.Variable);
|
|
699
|
-
options = options ||
|
|
699
|
+
options = options || Object.create(null);
|
|
700
700
|
|
|
701
701
|
const addressSpace = node.addressSpace;
|
|
702
702
|
|
|
@@ -820,6 +820,6 @@ export function AddressSpace_installHistoricalDataNode(
|
|
|
820
820
|
node.on("value_changed", on_value_change);
|
|
821
821
|
|
|
822
822
|
// update the index of historizing nodes in the addressSpace
|
|
823
|
-
node.addressSpace.historizingNodes = node.addressSpace.historizingNodes ||
|
|
824
|
-
node.addressSpace.historizingNodes
|
|
823
|
+
node.addressSpace.historizingNodes = node.addressSpace.historizingNodes || new Set();
|
|
824
|
+
node.addressSpace.historizingNodes.add(node);
|
|
825
825
|
}
|
package/src/index_current.ts
CHANGED
|
@@ -13,7 +13,6 @@ export * from "../source/helpers/ensure_secure_access";
|
|
|
13
13
|
export * from "../source/helpers/resolve_opaque_on_address_space";
|
|
14
14
|
export * from "../source/interfaces/alarms_and_conditions/condition_info_i";
|
|
15
15
|
export * from "../src/nodeset_tools/construct_namespace_dependency";
|
|
16
|
-
export * from "../src/validate_data_type_correctness";
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
export * from "../source/set_namespace_meta_data";
|
|
@@ -57,3 +56,7 @@ export * from "./alarms_and_conditions";
|
|
|
57
56
|
export * from "./event_data";
|
|
58
57
|
|
|
59
58
|
export * from "node-opcua-nodeset-ua";
|
|
59
|
+
|
|
60
|
+
export * from "../src/validate_data_type_correctness";
|
|
61
|
+
export * from "../source/ua_addin";
|
|
62
|
+
export * from "../source/ua_interface";
|
package/src/namespace_impl.ts
CHANGED
|
@@ -799,16 +799,8 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
799
799
|
}
|
|
800
800
|
|
|
801
801
|
// ---------------------------------------------------------------------------------------------------
|
|
802
|
-
/**
|
|
803
|
-
|
|
804
|
-
* @param options
|
|
805
|
-
* @param options.browseName {String}
|
|
806
|
-
* @param options.definition {String}
|
|
807
|
-
* @param [options.valuePrecision {Double |null} =null]
|
|
808
|
-
* @param options.dataType {NodeId} // todo :check
|
|
809
|
-
* @param options.value
|
|
810
|
-
* @param options.componentOf
|
|
811
|
-
* @return {UAVariable}
|
|
802
|
+
/**
|
|
803
|
+
*
|
|
812
804
|
*/
|
|
813
805
|
public addDataItem<T, DT extends DataType>(options: AddDataItemOptions): UADataItem<T, DT> {
|
|
814
806
|
const addressSpace = this.addressSpace;
|
|
@@ -2134,12 +2126,28 @@ function _handle_event_hierarchy_parent(
|
|
|
2134
2126
|
}
|
|
2135
2127
|
|
|
2136
2128
|
export function _handle_hierarchy_parent(addressSpace: AddressSpacePrivate, references: AddReferenceOpts[], options: any): void {
|
|
2129
|
+
options.addInOf = _coerce_parent(addressSpace, options.addInOf, addressSpace._coerceNode);
|
|
2137
2130
|
options.componentOf = _coerce_parent(addressSpace, options.componentOf, addressSpace._coerceNode);
|
|
2138
2131
|
options.propertyOf = _coerce_parent(addressSpace, options.propertyOf, addressSpace._coerceNode);
|
|
2139
2132
|
options.organizedBy = _coerce_parent(addressSpace, options.organizedBy, addressSpace._coerceFolder);
|
|
2140
2133
|
options.encodingOf = _coerce_parent(addressSpace, options.encodingOf, addressSpace._coerceNode);
|
|
2141
2134
|
|
|
2135
|
+
if (options.addInOf) {
|
|
2136
|
+
assert(!options.componentOf);
|
|
2137
|
+
assert(!options.propertyOf);
|
|
2138
|
+
assert(!options.organizedBy);
|
|
2139
|
+
assert(options.addInOf.nodeClass === NodeClass.Object || options.addInOf.nodeClass === NodeClass.ObjectType,
|
|
2140
|
+
"addInOf must be of nodeClass Object or ObjectType"
|
|
2141
|
+
);
|
|
2142
|
+
references.push({
|
|
2143
|
+
isForward: false,
|
|
2144
|
+
nodeId: options.addInOf.nodeId,
|
|
2145
|
+
referenceType: "HasAddIn"
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2142
2149
|
if (options.componentOf) {
|
|
2150
|
+
assert(!options.addInOf);
|
|
2143
2151
|
assert(!options.propertyOf);
|
|
2144
2152
|
assert(!options.organizedBy);
|
|
2145
2153
|
assert(addressSpace.rootFolder.objects, "addressSpace must have a rootFolder.objects folder");
|
|
@@ -2155,6 +2163,7 @@ export function _handle_hierarchy_parent(addressSpace: AddressSpacePrivate, refe
|
|
|
2155
2163
|
}
|
|
2156
2164
|
|
|
2157
2165
|
if (options.propertyOf) {
|
|
2166
|
+
assert(!options.addInOf);
|
|
2158
2167
|
assert(!options.componentOf);
|
|
2159
2168
|
assert(!options.organizedBy);
|
|
2160
2169
|
assert(
|
|
@@ -2169,6 +2178,7 @@ export function _handle_hierarchy_parent(addressSpace: AddressSpacePrivate, refe
|
|
|
2169
2178
|
}
|
|
2170
2179
|
|
|
2171
2180
|
if (options.organizedBy) {
|
|
2181
|
+
assert(!options.addInOf);
|
|
2172
2182
|
assert(!options.propertyOf);
|
|
2173
2183
|
assert(!options.componentOf);
|
|
2174
2184
|
references.push({
|
|
@@ -2177,6 +2187,7 @@ export function _handle_hierarchy_parent(addressSpace: AddressSpacePrivate, refe
|
|
|
2177
2187
|
referenceType: "Organizes"
|
|
2178
2188
|
});
|
|
2179
2189
|
}
|
|
2190
|
+
|
|
2180
2191
|
if (options.encodingOf) {
|
|
2181
2192
|
// parent must be a DataType
|
|
2182
2193
|
assert(options.encodingOf.nodeClass === NodeClass.DataType, "encodingOf must be toward a DataType");
|
package/src/nodeid_manager.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { makeNodeId, NodeId, NodeIdLike, NodeIdType, resolveNodeId, sameNodeId }
|
|
|
6
6
|
import { make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
7
7
|
import { BaseNode, UAReference, UAReferenceType } from "node-opcua-address-space-base";
|
|
8
8
|
import { getReferenceType } from "./base_node_impl";
|
|
9
|
+
import { resolveReferenceNode, resolveReferenceType } from "./reference_impl";
|
|
9
10
|
|
|
10
11
|
const debugLog = make_debugLog(__filename);
|
|
11
12
|
const warningLog = make_warningLog(__filename);
|
|
@@ -22,21 +23,49 @@ const regExp2 = /^ns=[0-9]+;(s|i|b|g)=/;
|
|
|
22
23
|
const hasPropertyRefId = resolveNodeId("HasProperty");
|
|
23
24
|
const hasComponentRefId = resolveNodeId("HasComponent");
|
|
24
25
|
const hasOrderedComponentRefId = resolveNodeId("HasOrderedComponent");
|
|
26
|
+
const hasAddIn = resolveNodeId("HasAddIn");
|
|
25
27
|
const hasEncoding = resolveNodeId("HasEncoding");
|
|
26
28
|
|
|
27
29
|
type Suffix = string;
|
|
28
30
|
|
|
29
|
-
function _identifyParentInReference(references: UAReference[]): [NodeId, Suffix] | null {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
// function _identifyParentInReference(references: UAReference[]): [NodeId, Suffix] | null {
|
|
32
|
+
// const candidates = references.filter((r: UAReference) => {
|
|
33
|
+
// return (
|
|
34
|
+
// !r.isForward &&
|
|
35
|
+
// (sameNodeId(r.referenceType, hasComponentRefId) ||
|
|
36
|
+
// sameNodeId(r.referenceType, hasOrderedComponentRefId) ||
|
|
37
|
+
// sameNodeId(r.referenceType, hasPropertyRefId) ||
|
|
38
|
+
// sameNodeId(r.referenceType, hasEncoding) ||
|
|
39
|
+
// sameNodeId(r.referenceType, hasAddIn))
|
|
40
|
+
// );
|
|
41
|
+
// });
|
|
42
|
+
// assert(candidates.length <= 1);
|
|
43
|
+
// if (candidates.length === 0) {
|
|
44
|
+
// return null;
|
|
45
|
+
// }
|
|
46
|
+
// const ref = candidates[0];
|
|
47
|
+
// if (sameNodeId(ref.referenceType, hasEncoding)) {
|
|
48
|
+
// return [ref.nodeId, "_Encoding"];
|
|
49
|
+
// }
|
|
50
|
+
// return [ref.nodeId, ""];
|
|
51
|
+
// }
|
|
52
|
+
|
|
53
|
+
function checkAggregate(addressSpace: AddressSpacePartial, reference: UAReference, refType: UAReferenceType): boolean {
|
|
54
|
+
const r = resolveReferenceType(addressSpace, reference);
|
|
55
|
+
if (!r) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return r.isSubtypeOf(refType)
|
|
59
|
+
}
|
|
60
|
+
function _filterAggregates(addressSpace: AddressSpacePartial, references: UAReference[]): [NodeId, Suffix] | null {
|
|
61
|
+
|
|
62
|
+
const aggregates = addressSpace.findNode(resolveNodeId("Aggregates")) as UAReferenceType;
|
|
63
|
+
|
|
64
|
+
const candidates = references.filter((r: UAReference) =>
|
|
65
|
+
!r.isForward && checkAggregate(addressSpace, r, aggregates)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
assert(candidates.length <= 1, "a node shall not have more than one parent (link to a parent with a reference derived from 'Aggregates')");
|
|
40
69
|
if (candidates.length === 0) {
|
|
41
70
|
return null;
|
|
42
71
|
}
|
|
@@ -60,7 +89,7 @@ function _findParentNodeId(addressSpace: AddressSpacePartial, options: Construct
|
|
|
60
89
|
(ref as any).referenceType = (ref as any)._referenceType.nodeId;
|
|
61
90
|
}
|
|
62
91
|
// find HasComponent, or has Property reverse
|
|
63
|
-
return
|
|
92
|
+
return _filterAggregates(addressSpace, options.references);
|
|
64
93
|
}
|
|
65
94
|
|
|
66
95
|
function prepareName(browseName: QualifiedName): string {
|
|
@@ -83,7 +112,7 @@ export type NodeEntry = [string, number, NodeClass];
|
|
|
83
112
|
export type NodeEntry1 = [string, number, string /*"Object" | "Variable" etc...*/];
|
|
84
113
|
|
|
85
114
|
export class NodeIdManager {
|
|
86
|
-
private _cacheSymbolicName: { [key: string]: [number,NodeClass] } = {};
|
|
115
|
+
private _cacheSymbolicName: { [key: string]: [number, NodeClass] } = {};
|
|
87
116
|
private _cacheSymbolicNameRev: Set<number> = new Set<number>();
|
|
88
117
|
|
|
89
118
|
private _internal_id_counter: number;
|
|
@@ -174,11 +203,11 @@ export class NodeIdManager {
|
|
|
174
203
|
}
|
|
175
204
|
return this._constructNodeId(options);
|
|
176
205
|
}
|
|
177
|
-
|
|
206
|
+
|
|
178
207
|
private _constructNodeId(options: ConstructNodeIdOptions): NodeId {
|
|
179
208
|
|
|
180
209
|
let nodeId = options.nodeId;
|
|
181
|
-
|
|
210
|
+
|
|
182
211
|
if (!nodeId) {
|
|
183
212
|
const parentInfo = this.findParentNodeId(options);
|
|
184
213
|
if (parentInfo) {
|
|
@@ -190,7 +219,7 @@ export class NodeIdManager {
|
|
|
190
219
|
const childName = parentNodeId.value + NamespaceOptions.nodeIdNameSeparator + name;
|
|
191
220
|
nodeId = new NodeId(NodeId.NodeIdType.STRING, childName, parentNodeId.namespace);
|
|
192
221
|
return nodeId;
|
|
193
|
-
}
|
|
222
|
+
}
|
|
194
223
|
}
|
|
195
224
|
} else if (typeof nodeId === "string") {
|
|
196
225
|
if (this.namespaceIndex !== 0) {
|
|
@@ -218,7 +247,7 @@ export class NodeIdManager {
|
|
|
218
247
|
}
|
|
219
248
|
|
|
220
249
|
private _isInCache(nodeId: NodeId): boolean {
|
|
221
|
-
if(
|
|
250
|
+
if (nodeId.namespace !== this.namespaceIndex || nodeId.identifierType !== NodeIdType.NUMERIC) return false;
|
|
222
251
|
return this._cacheSymbolicNameRev.has(nodeId.value as number) ? true : false;
|
|
223
252
|
}
|
|
224
253
|
}
|
|
@@ -9,7 +9,7 @@ import { make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
|
9
9
|
import { NamespacePrivate } from "../namespace_private";
|
|
10
10
|
import { BaseNodeImpl, getReferenceType } from "../base_node_impl";
|
|
11
11
|
import { UAVariableImpl } from "../ua_variable_impl";
|
|
12
|
-
import {
|
|
12
|
+
import { TranslationTable } from "../../source/xml_writer";
|
|
13
13
|
|
|
14
14
|
const warningLog = make_warningLog(__filename);
|
|
15
15
|
const debugLog = make_debugLog(__filename);
|
|
@@ -201,7 +201,7 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
|
|
|
201
201
|
const thisPriority = priorityList[namespace.index];
|
|
202
202
|
|
|
203
203
|
const requiredNamespaceIndexes = _recomputeRequiredModelsFromTypes2(namespace, cache).requiredNamespaceIndexes;
|
|
204
|
-
const requiredModelsSet: Set<number> = new Set<number>([...
|
|
204
|
+
const requiredModelsSet: Set<number> = new Set<number>([...requiredNamespaceIndexes]);
|
|
205
205
|
|
|
206
206
|
const consider = (requiredModel: number) => {
|
|
207
207
|
if (requiredModel !== namespace.index && !requiredModelsSet.has(requiredModel)) {
|
|
@@ -323,26 +323,27 @@ export function constructNamespaceDependency(namespace: INamespace, priorityTabl
|
|
|
323
323
|
/**
|
|
324
324
|
* @private
|
|
325
325
|
*/
|
|
326
|
-
export function _constructNamespaceTranslationTable(dependency: INamespace[], exportedNamespace: INamespace):
|
|
326
|
+
export function _constructNamespaceTranslationTable(dependency: INamespace[], exportedNamespace: INamespace): TranslationTable {
|
|
327
|
+
const translationTable: TranslationTable = new Map();
|
|
327
328
|
if (!dependency || dependency.length === 0) {
|
|
328
|
-
|
|
329
|
+
translationTable.set(0, 0);
|
|
330
|
+
return translationTable;
|
|
329
331
|
// throw new Error("Cannot constructNamespaceTranslationTable on empty dependency");
|
|
330
332
|
}
|
|
331
|
-
const translationTable: ITranslationTable = {};
|
|
332
333
|
assert(dependency[0].namespaceUri === "http://opcfoundation.org/UA/");
|
|
333
334
|
|
|
334
335
|
let counter = 0;
|
|
335
|
-
translationTable
|
|
336
|
+
translationTable.set(dependency[0].index, counter++);
|
|
336
337
|
//
|
|
337
338
|
if (exportedNamespace) {
|
|
338
|
-
translationTable
|
|
339
|
+
translationTable.set(exportedNamespace.index, counter++);
|
|
339
340
|
}
|
|
340
341
|
for (let i = 1; i < dependency.length; i++) {
|
|
341
342
|
const dep = dependency[i];
|
|
342
343
|
if (exportedNamespace && exportedNamespace === dep) {
|
|
343
344
|
continue;
|
|
344
345
|
}
|
|
345
|
-
translationTable
|
|
346
|
+
translationTable.set(dep.index, counter++);
|
|
346
347
|
}
|
|
347
348
|
return translationTable;
|
|
348
349
|
}
|
|
@@ -23,7 +23,7 @@ function dumpEnumeratedType(xw: XmlWriter, e: EnumDefinition, name: string): voi
|
|
|
23
23
|
}
|
|
24
24
|
xw.endElement();
|
|
25
25
|
}
|
|
26
|
-
function buildXmlName(addressSpace: AddressSpacePrivate, map:
|
|
26
|
+
function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number,string>, nodeId: NodeId): string {
|
|
27
27
|
if (NodeId.sameNodeId(nodeId, NodeId.nullNodeId)) {
|
|
28
28
|
return "ua:ExtensionObject";
|
|
29
29
|
}
|
|
@@ -35,7 +35,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: { [key: number]: s
|
|
|
35
35
|
const typeName = node.browseName.name!;
|
|
36
36
|
|
|
37
37
|
const n = node.nodeId as INodeId;
|
|
38
|
-
const prefix = (n.identifierType === NodeIdType.NUMERIC && n.namespace === 0) ? (n.value <= 15 ? "opc" : "ua") : map
|
|
38
|
+
const prefix = (n.identifierType === NodeIdType.NUMERIC && n.namespace === 0) ? (n.value <= 15 ? "opc" : "ua") : map.get(node.nodeId.namespace);
|
|
39
39
|
return prefix + ":" + (typeName === "Structure" && prefix === "ua" ? "ExtensionObject" : typeName);
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: { [key: number]: s
|
|
|
43
43
|
function dumpDataTypeStructure(
|
|
44
44
|
xw: XmlWriter,
|
|
45
45
|
addressSpace: IAddressSpace,
|
|
46
|
-
map:
|
|
46
|
+
map: Map<number,string>,
|
|
47
47
|
structureDefinition: StructureDefinition,
|
|
48
48
|
structureDefinitionBase: StructureDefinition | undefined | null,
|
|
49
49
|
name: string,
|
|
@@ -129,7 +129,7 @@ function dumpDataTypeStructure(
|
|
|
129
129
|
xw.endElement();
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
function dumpDataTypeToBSD(xw: XmlWriter, dataType: UADataType, map:
|
|
132
|
+
function dumpDataTypeToBSD(xw: XmlWriter, dataType: UADataType, map: Map<number,string>) {
|
|
133
133
|
const addressSpace = dataType.addressSpace;
|
|
134
134
|
|
|
135
135
|
const name: string = dataType.browseName.name!;
|
|
@@ -163,9 +163,9 @@ export function dumpToBSD(namespace: NamespacePrivate): string {
|
|
|
163
163
|
xw.writeAttribute("xmlns:ua", "http://opcfoundation.org/UA/");
|
|
164
164
|
xw.writeAttribute("xmlns:tns", namespace.namespaceUri);
|
|
165
165
|
|
|
166
|
-
const map:
|
|
166
|
+
const map: Map<number,string> = new Map();
|
|
167
167
|
|
|
168
|
-
map
|
|
168
|
+
map.set(namespace.index,"tns");
|
|
169
169
|
|
|
170
170
|
for (const dependantNamespace of dependency) {
|
|
171
171
|
const namespaceIndex = dependantNamespace.index;
|
|
@@ -173,7 +173,7 @@ export function dumpToBSD(namespace: NamespacePrivate): string {
|
|
|
173
173
|
continue;
|
|
174
174
|
}
|
|
175
175
|
const ns = shortcut(dependantNamespace);
|
|
176
|
-
map
|
|
176
|
+
map.set(namespaceIndex,ns);
|
|
177
177
|
xw.writeAttribute(`xmlns:${ns}`, dependantNamespace.namespaceUri);
|
|
178
178
|
}
|
|
179
179
|
|