node-opcua-address-space 2.178.0 → 2.179.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/address_space_ts.d.ts +16 -6
- package/dist/source/address_space_ts.js +1 -1
- package/dist/source/address_space_ts.js.map +1 -1
- package/dist/source/helpers/argument_list.js +2 -2
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/call_helpers.js +3 -0
- package/dist/source/helpers/call_helpers.js.map +1 -1
- package/dist/source/helpers/dump_tools.js +6 -2
- package/dist/source/helpers/dump_tools.js.map +1 -1
- package/dist/source/helpers/make_optionals_map.d.ts +3 -1
- package/dist/source/helpers/make_optionals_map.js.map +1 -1
- package/dist/source/interfaces/extension_object_constructor.d.ts +1 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js +0 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -1
- package/dist/source/loader/decode_xml_extension_object.js.map +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.js +2 -1
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +12 -8
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/loader/make_xml_extension_object_parser.js +26 -7
- package/dist/source/loader/make_xml_extension_object_parser.js.map +1 -1
- package/dist/source/loader/namespace_post_step.js.map +1 -1
- package/dist/source/loader/parsers/extension_object_parser.d.ts +6 -4
- package/dist/source/loader/parsers/extension_object_parser.js +12 -6
- package/dist/source/loader/parsers/extension_object_parser.js.map +1 -1
- package/dist/source/loader/parsers/localized_text_parser.d.ts +1 -1
- package/dist/source/loader/parsers/nodeid_parser.d.ts +10 -2
- package/dist/source/loader/parsers/nodeid_parser.js.map +1 -1
- package/dist/source/loader/parsers/qualified_name_parser.d.ts +1 -2
- package/dist/source/loader/parsers/variant_parser.d.ts +8 -2
- package/dist/source/loader/parsers/variant_parser.js +11 -8
- package/dist/source/loader/parsers/variant_parser.js.map +1 -1
- package/dist/source/pseudo_session.js +70 -24
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/source/session_context.js.map +1 -1
- package/dist/source/xml_writer.d.ts +1 -1
- package/dist/src/_instantiate_helpers.js +0 -3
- package/dist/src/_instantiate_helpers.js.map +1 -1
- package/dist/src/_mandatory_child_or_requested_optional_filter.d.ts +3 -2
- package/dist/src/_mandatory_child_or_requested_optional_filter.js +0 -2
- package/dist/src/_mandatory_child_or_requested_optional_filter.js.map +1 -1
- package/dist/src/address_space.d.ts +7 -2
- package/dist/src/address_space.js +36 -28
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/address_space_private.d.ts +1 -0
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js +6 -9
- package/dist/src/alarms_and_conditions/condition_snapshot_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +6 -6
- package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +8 -4
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +6 -5
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +3 -0
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +0 -1
- package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +17 -8
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +0 -6
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/extension_object_array_node.d.ts +9 -1
- package/dist/src/extension_object_array_node.js +20 -3
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/get_basic_datatype.js +3 -1
- package/dist/src/get_basic_datatype.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +2 -4
- package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
- package/dist/src/namespace_impl.js +6 -5
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeid_manager.js +4 -5
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +10 -11
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.js +2 -4
- 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 +71 -43
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/private_namespace.js.map +1 -1
- package/dist/src/reference_impl.d.ts +2 -2
- package/dist/src/reference_impl.js +5 -4
- package/dist/src/reference_impl.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.js +1 -1
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -1
- package/dist/src/state_machine/ua_two_state_variable.js +9 -7
- package/dist/src/state_machine/ua_two_state_variable.js.map +1 -1
- package/dist/src/tool_isSubtypeOf.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +4 -4
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +21 -11
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +5 -2
- package/dist/src/ua_object_type_impl.js +4 -3
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.js +1 -2
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +9 -11
- package/dist/src/ua_variable_impl.js +103 -65
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.d.ts +6 -6
- package/dist/src/ua_variable_impl_ext_obj.js +33 -22
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.js +6 -2
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/tsconfig_base.tsbuildinfo +1 -1
- package/distHelpers/add_event_generator_object.js +3 -0
- package/distHelpers/add_event_generator_object.js.map +1 -1
- package/distHelpers/boiler_system.js +27 -6
- package/distHelpers/boiler_system.js.map +1 -1
- package/distHelpers/create_minimalist_address_space_nodeset.js +3 -3
- package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -1
- package/distHelpers/date_utils.js.map +1 -1
- package/distHelpers/dump_statemachine.js +1 -1
- package/distHelpers/dump_statemachine.js.map +1 -1
- package/distHelpers/get_address_space_fixture.js +0 -1
- package/distHelpers/get_address_space_fixture.js.map +1 -1
- package/package.json +41 -41
- package/source/address_space_ts.ts +19 -9
- package/source/helpers/argument_list.ts +2 -2
- package/source/helpers/call_helpers.ts +4 -1
- package/source/helpers/dump_tools.ts +7 -3
- package/source/helpers/make_optionals_map.ts +4 -2
- package/source/interfaces/alarms_and_conditions/ua_acknowledgeable_condition_ex.ts +4 -3
- package/source/interfaces/alarms_and_conditions/ua_alarm_condition_ex.ts +10 -11
- package/source/interfaces/alarms_and_conditions/ua_condition_ex.ts +6 -7
- package/source/interfaces/extension_object_constructor.ts +1 -1
- package/source/interfaces/state_machine/ua_program_state_machine_type.ts +0 -1
- package/source/interfaces/state_machine/ua_state_machine_type.ts +0 -1
- package/source/loader/decode_xml_extension_object.ts +3 -3
- package/source/loader/ensure_datatype_extracted.ts +6 -2
- package/source/loader/generateAddressSpaceRaw.ts +5 -4
- package/source/loader/load_nodeset2.ts +12 -8
- package/source/loader/make_xml_extension_object_parser.ts +78 -45
- package/source/loader/namespace_post_step.ts +1 -1
- package/source/loader/parsers/extension_object_parser.ts +36 -27
- package/source/loader/parsers/localized_text_parser.ts +1 -1
- package/source/loader/parsers/nodeid_parser.ts +10 -2
- package/source/loader/parsers/qualified_name_parser.ts +1 -1
- package/source/loader/parsers/variant_parser.ts +53 -40
- package/source/pseudo_session.ts +81 -28
- package/source/session_context.ts +1 -0
- package/source/xml_writer.ts +1 -1
- package/src/_instantiate_helpers.ts +0 -3
- package/src/_mandatory_child_or_requested_optional_filter.ts +3 -4
- package/src/address_space.ts +58 -42
- package/src/address_space_private.ts +2 -0
- package/src/alarms_and_conditions/condition_snapshot_impl.ts +6 -10
- package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +5 -7
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +20 -13
- package/src/alarms_and_conditions/ua_base_event_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_condition_impl.ts +12 -10
- package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +8 -5
- package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +0 -1
- package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +0 -1
- package/src/apply_condition_refresh.ts +1 -1
- package/src/base_node_impl.ts +30 -35
- package/src/base_node_private.ts +0 -6
- package/src/extension_object_array_node.ts +44 -15
- package/src/get_basic_datatype.ts +4 -1
- package/src/historical_access/address_space_historical_data_node.ts +2 -5
- package/src/namespace_impl.ts +24 -17
- package/src/nodeid_manager.ts +8 -11
- package/src/nodeset_tools/construct_namespace_dependency.ts +18 -15
- package/src/nodeset_tools/dump_to_bsd.ts +6 -8
- package/src/nodeset_tools/nodeset_to_xml.ts +105 -75
- package/src/private_namespace.ts +7 -2
- package/src/reference_impl.ts +11 -10
- package/src/state_machine/finite_state_machine.ts +12 -10
- package/src/state_machine/ua_shelving_state_machine_ex.ts +4 -4
- package/src/state_machine/ua_two_state_variable.ts +12 -9
- package/src/tool_isSubtypeOf.ts +2 -9
- package/src/ua_data_type_impl.ts +4 -4
- package/src/ua_method_impl.ts +24 -14
- package/src/ua_object_type_impl.ts +12 -6
- package/src/ua_reference_type_impl.ts +2 -3
- package/src/ua_variable_impl.ts +142 -96
- package/src/ua_variable_impl_ext_obj.ts +110 -82
- package/src/ua_variable_type_impl.ts +17 -5
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-address-space
|
|
3
3
|
*/
|
|
4
|
-
// tslint:disable:no-console
|
|
5
4
|
|
|
6
5
|
import chalk from "chalk";
|
|
7
6
|
import type {
|
|
@@ -35,7 +34,6 @@ import { UAVariableImpl } from "../ua_variable_impl";
|
|
|
35
34
|
|
|
36
35
|
const warningLog = make_warningLog(__filename);
|
|
37
36
|
|
|
38
|
-
// tslint:disable:no-var-requires
|
|
39
37
|
interface DequeueItem<T> {
|
|
40
38
|
data: T | null;
|
|
41
39
|
next: DequeueItem<T>;
|
|
@@ -716,7 +714,7 @@ export function AddressSpace_installHistoricalDataNode(
|
|
|
716
714
|
};
|
|
717
715
|
|
|
718
716
|
assert(node.nodeClass === NodeClass.Variable);
|
|
719
|
-
|
|
717
|
+
const historianOptions: IVariableHistorianOptions = options || Object.create(null);
|
|
720
718
|
|
|
721
719
|
const addressSpace = node.addressSpace;
|
|
722
720
|
|
|
@@ -729,7 +727,7 @@ export function AddressSpace_installHistoricalDataNode(
|
|
|
729
727
|
node._historyReadRaw = _historyReadRaw;
|
|
730
728
|
node._historyReadRawAsync = _historyReadRawAsync;
|
|
731
729
|
|
|
732
|
-
node.varHistorian =
|
|
730
|
+
node.varHistorian = historianOptions.historian || AddressSpace.historizerFactory.create(node, historianOptions);
|
|
733
731
|
|
|
734
732
|
const historicalDataConfigurationType = addressSpace.findObjectType("HistoricalDataConfigurationType");
|
|
735
733
|
if (!historicalDataConfigurationType) {
|
|
@@ -737,7 +735,6 @@ export function AddressSpace_installHistoricalDataNode(
|
|
|
737
735
|
}
|
|
738
736
|
node.historizing = true;
|
|
739
737
|
|
|
740
|
-
// tslint:disable:no-bitwise
|
|
741
738
|
node.accessLevel = node.accessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
|
|
742
739
|
if (node.userAccessLevel !== undefined) {
|
|
743
740
|
node.userAccessLevel = node.userAccessLevel | AccessLevelFlag.CurrentRead | AccessLevelFlag.HistoryRead;
|
package/src/namespace_impl.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-address-space
|
|
3
3
|
*/
|
|
4
|
-
// tslint:disable:no-console
|
|
5
4
|
import chalk from "chalk";
|
|
6
5
|
import type {
|
|
7
6
|
AddBaseNodeOptions,
|
|
@@ -16,7 +15,7 @@ import type {
|
|
|
16
15
|
AddViewOptions,
|
|
17
16
|
AddYArrayItemOptions,
|
|
18
17
|
BaseNode,
|
|
19
|
-
|
|
18
|
+
BaseNodeEvents,
|
|
20
19
|
CreateDataTypeOptions,
|
|
21
20
|
CreateNodeOptions,
|
|
22
21
|
EnumerationItem,
|
|
@@ -102,7 +101,6 @@ import {
|
|
|
102
101
|
UAConditionImplBase,
|
|
103
102
|
UADiscreteAlarmImplBase
|
|
104
103
|
} from "./alarms_and_conditions";
|
|
105
|
-
import { UADiscreteAlarmImpl } from "./alarms_and_conditions/ua_discrete_alarm_impl";
|
|
106
104
|
import { UAExclusiveDeviationAlarmImplBase } from "./alarms_and_conditions/ua_exclusive_deviation_alarm_impl";
|
|
107
105
|
import { UAExclusiveLimitAlarmImplBase } from "./alarms_and_conditions/ua_exclusive_limit_alarm_impl";
|
|
108
106
|
import { UALimitAlarmImplBase } from "./alarms_and_conditions/ua_limit_alarm_impl";
|
|
@@ -1019,7 +1017,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1019
1017
|
|
|
1020
1018
|
instrumentRange.on("value_changed", handler);
|
|
1021
1019
|
}
|
|
1022
|
-
(variable as
|
|
1020
|
+
(variable as unknown as { acceptValueOutOfRange?: boolean }).acceptValueOutOfRange = options.acceptValueOutOfRange;
|
|
1023
1021
|
|
|
1024
1022
|
if (Object.hasOwn(options, "engineeringUnits")) {
|
|
1025
1023
|
const engineeringUnits = new EUInformation(options.engineeringUnits);
|
|
@@ -1209,7 +1207,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1209
1207
|
})
|
|
1210
1208
|
);
|
|
1211
1209
|
|
|
1212
|
-
return variable as
|
|
1210
|
+
return variable as unknown as UAYArrayItemEx<DT>;
|
|
1213
1211
|
}
|
|
1214
1212
|
|
|
1215
1213
|
// - Methods ----------------------------------------------------------------------------------------------------
|
|
@@ -1424,7 +1422,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1424
1422
|
// or OptionSet DataType. It is derived from the DataType EnumValueType. If used for an
|
|
1425
1423
|
// OptionSet, the corresponding Value in the base type contains the number of the bit associated
|
|
1426
1424
|
// with the field. The EnumField is formally defined in Table 37.
|
|
1427
|
-
(enumType as
|
|
1425
|
+
(enumType as unknown as { $fullDefinition?: EnumDefinition }).$fullDefinition = new EnumDefinition({
|
|
1428
1426
|
fields: enumeration.map(
|
|
1429
1427
|
(x: string, index: number) =>
|
|
1430
1428
|
new EnumField({
|
|
@@ -1463,7 +1461,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1463
1461
|
});
|
|
1464
1462
|
assert(enumValues.browseName.toString() === "EnumValues");
|
|
1465
1463
|
|
|
1466
|
-
(enumType as
|
|
1464
|
+
(enumType as unknown as { $fullDefinition?: EnumDefinition }).$fullDefinition = new EnumDefinition({
|
|
1467
1465
|
fields: enumeration.map(
|
|
1468
1466
|
(x: EnumerationItem, _index: number) =>
|
|
1469
1467
|
new EnumField({
|
|
@@ -1804,7 +1802,6 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1804
1802
|
case NodeClass.View:
|
|
1805
1803
|
break;
|
|
1806
1804
|
default:
|
|
1807
|
-
// tslint:disable-next-line:no-console
|
|
1808
1805
|
errorLog("Invalid class Name", node.nodeClass);
|
|
1809
1806
|
throw new Error("Invalid class name specified");
|
|
1810
1807
|
}
|
|
@@ -1885,8 +1882,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1885
1882
|
|
|
1886
1883
|
options.addressSpace = this.addressSpace as AddressSpacePrivate;
|
|
1887
1884
|
|
|
1888
|
-
|
|
1889
|
-
const node = new Constructor(options as any);
|
|
1885
|
+
const node = new Constructor(options);
|
|
1890
1886
|
this._register(node);
|
|
1891
1887
|
|
|
1892
1888
|
// object shall now be registered
|
|
@@ -1918,7 +1914,6 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1918
1914
|
case NodeClass.View:
|
|
1919
1915
|
break;
|
|
1920
1916
|
default:
|
|
1921
|
-
// tslint:disable:no-console
|
|
1922
1917
|
warningLog("Invalid class Name", node.nodeClass);
|
|
1923
1918
|
throw new Error("Invalid class name specified");
|
|
1924
1919
|
}
|
|
@@ -1948,15 +1943,23 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
1948
1943
|
}
|
|
1949
1944
|
const references: UAReference[] = [];
|
|
1950
1945
|
|
|
1951
|
-
function process_subtypeOf_options(this: NamespaceImpl, options2:
|
|
1946
|
+
function process_subtypeOf_options(this: NamespaceImpl, options2: CreateNodeOptions, references1: AddReferenceOpts[]) {
|
|
1952
1947
|
// check common misspelling mistake
|
|
1953
|
-
assert(
|
|
1948
|
+
assert(
|
|
1949
|
+
!(options2 as unknown as Record<string, unknown>).subTypeOf,
|
|
1950
|
+
"misspell error : it should be 'subtypeOf' instead"
|
|
1951
|
+
);
|
|
1954
1952
|
if (Object.hasOwn(options2, "hasTypeDefinition")) {
|
|
1955
1953
|
throw new Error("hasTypeDefinition option is invalid. Do you mean typeDefinition instead ?");
|
|
1956
1954
|
}
|
|
1957
1955
|
assert(!options2.typeDefinition, " do you mean subtypeOf ?");
|
|
1958
1956
|
|
|
1959
|
-
|
|
1957
|
+
// subtypeOf is optional: _coerceType defaults to topMostBaseType when it's falsy.
|
|
1958
|
+
const subtypeOfNodeId = addressSpace._coerceType(
|
|
1959
|
+
options2.subtypeOf as unknown as string | NodeId | BaseNode,
|
|
1960
|
+
topMostBaseType,
|
|
1961
|
+
nodeClass
|
|
1962
|
+
);
|
|
1960
1963
|
|
|
1961
1964
|
assert(subtypeOfNodeId);
|
|
1962
1965
|
references1.push({
|
|
@@ -2142,7 +2145,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
2142
2145
|
/**
|
|
2143
2146
|
* @private
|
|
2144
2147
|
*/
|
|
2145
|
-
private _addMethod(options:
|
|
2148
|
+
private _addMethod(options: AddMethodOptions & { eventNotifier?: number }): UAMethod {
|
|
2146
2149
|
const addressSpace = this.addressSpace;
|
|
2147
2150
|
|
|
2148
2151
|
assert(isNonEmptyQualifiedName(options.browseName));
|
|
@@ -2158,7 +2161,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
2158
2161
|
browseName: options.browseName,
|
|
2159
2162
|
description: options.description || "",
|
|
2160
2163
|
displayName: options.displayName,
|
|
2161
|
-
eventNotifier: +options.eventNotifier,
|
|
2164
|
+
eventNotifier: +(options.eventNotifier || 0),
|
|
2162
2165
|
isAbstract: false,
|
|
2163
2166
|
nodeClass: NodeClass.Method,
|
|
2164
2167
|
nodeId: options.nodeId,
|
|
@@ -2173,7 +2176,11 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
2173
2176
|
}
|
|
2174
2177
|
}
|
|
2175
2178
|
|
|
2176
|
-
|
|
2179
|
+
// each concrete constructor below takes a different, incompatible options type (UADataTypeOptions,
|
|
2180
|
+
// UAVariableOptions, ...) — the map is only ever indexed by nodeClass and invoked with the matching
|
|
2181
|
+
// options shape by the caller, so a wider `new (options: any) => ...` signature is required here.
|
|
2182
|
+
// biome-ignore lint/suspicious/noExplicitAny: see comment above
|
|
2183
|
+
const _constructors_map: Record<keyof Omit<typeof NodeClass, "Unspecified">, new (options: any) => BaseNodeImpl<BaseNodeEvents>> = {
|
|
2177
2184
|
DataType: UADataTypeImpl,
|
|
2178
2185
|
Method: UAMethodImpl,
|
|
2179
2186
|
Object: UAObjectImpl,
|
package/src/nodeid_manager.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/* eslint-disable max-depth */
|
|
2
|
-
/* eslint-disable max-statements */
|
|
3
|
-
|
|
4
1
|
import type { BaseNode, UAReference, UAReferenceType } from "node-opcua-address-space-base";
|
|
5
2
|
import { assert } from "node-opcua-assert";
|
|
6
3
|
import { NodeClass, type QualifiedName, type QualifiedNameOptions } from "node-opcua-data-model";
|
|
7
4
|
import { make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
8
5
|
import { makeNodeId, NodeId, type NodeIdLike, NodeIdType, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
9
|
-
import { BaseNodeImpl
|
|
10
|
-
import { resolveReferenceType } from "./reference_impl";
|
|
6
|
+
import { BaseNodeImpl } from "./base_node_impl";
|
|
7
|
+
import { type ReferenceImpl, resolveReferenceType } from "./reference_impl";
|
|
11
8
|
|
|
12
9
|
const _debugLog = make_debugLog(__filename);
|
|
13
10
|
const _warningLog = make_warningLog(__filename);
|
|
@@ -16,7 +13,7 @@ export const NamespaceOptions = {
|
|
|
16
13
|
nodeIdNameSeparator: "-"
|
|
17
14
|
};
|
|
18
15
|
function _isValidNodeClass(nodeClass: NodeClass) {
|
|
19
|
-
return typeof
|
|
16
|
+
return typeof NodeClass[nodeClass] === "string";
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
const regExp1 = /^(s|i|b|g)=/;
|
|
@@ -59,12 +56,13 @@ function _findParentNodeId(addressSpace: AddressSpacePartial, options: Construct
|
|
|
59
56
|
return null;
|
|
60
57
|
}
|
|
61
58
|
for (const ref of options.references) {
|
|
62
|
-
|
|
59
|
+
const _ref = ref as ReferenceImpl;
|
|
60
|
+
_ref._referenceType = addressSpace.findReferenceType(ref.referenceType) ?? undefined;
|
|
63
61
|
/* c8 ignore next */
|
|
64
|
-
if (!
|
|
62
|
+
if (!_ref._referenceType) {
|
|
65
63
|
throw new Error(`Cannot find referenceType ${JSON.stringify(ref)}`);
|
|
66
64
|
}
|
|
67
|
-
|
|
65
|
+
_ref.referenceType = _ref._referenceType.nodeId;
|
|
68
66
|
}
|
|
69
67
|
// find HasComponent, or has Property reverse
|
|
70
68
|
return _filterAggregates(addressSpace, options.references);
|
|
@@ -105,7 +103,7 @@ export class NodeIdManager {
|
|
|
105
103
|
|
|
106
104
|
public setSymbols(symbols: NodeEntry1[]): void {
|
|
107
105
|
function convertNodeClass(nodeClass: string): NodeClass {
|
|
108
|
-
return (NodeClass as
|
|
106
|
+
return (NodeClass as unknown as Record<string, NodeClass>)[nodeClass];
|
|
109
107
|
}
|
|
110
108
|
const symbols2 = symbols.map((e: [string, number, string]) => [e[0] as string, e[1] as number, convertNodeClass(e[2])]) as [
|
|
111
109
|
string,
|
|
@@ -243,7 +241,6 @@ export class NodeIdManager {
|
|
|
243
241
|
}
|
|
244
242
|
|
|
245
243
|
private _constructNodeId(options: ConstructNodeIdOptions): NodeId {
|
|
246
|
-
|
|
247
244
|
const resolveNodeIdEx = (nodeId: BaseNode | NodeIdLike) =>
|
|
248
245
|
nodeId && typeof nodeId === "object" && nodeId instanceof BaseNodeImpl
|
|
249
246
|
? nodeId.nodeId
|
|
@@ -18,7 +18,6 @@ interface RequiredModel {
|
|
|
18
18
|
requiredNamespaceIndexes: number[];
|
|
19
19
|
nbTypes: number;
|
|
20
20
|
}
|
|
21
|
-
// eslint-disable-next-line max-statements, complexity
|
|
22
21
|
export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?: Map<number, RequiredModel>): RequiredModel {
|
|
23
22
|
if (namespace.index === 0) {
|
|
24
23
|
return { requiredNamespaceIndexes: [], nbTypes: 1 };
|
|
@@ -103,12 +102,12 @@ export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?:
|
|
|
103
102
|
if (!uaVariable.$dataValue) return;
|
|
104
103
|
const variant = uaVariable.$dataValue.value;
|
|
105
104
|
if (!variant) return;
|
|
106
|
-
const value:
|
|
105
|
+
const value: unknown = variant.value;
|
|
107
106
|
if (!value) return;
|
|
108
107
|
if (Array.isArray(value)) {
|
|
109
|
-
value.forEach(exploreExtensionObject);
|
|
108
|
+
(value as ExtensionObject[]).forEach(exploreExtensionObject);
|
|
110
109
|
} else {
|
|
111
|
-
exploreExtensionObject(value);
|
|
110
|
+
exploreExtensionObject(value as ExtensionObject);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
for (const node of namespace_.nodeIterator()) {
|
|
@@ -132,7 +131,7 @@ export function _recomputeRequiredModelsFromTypes(namespace: INamespace, cache?:
|
|
|
132
131
|
} else if (isInstance !== -1) {
|
|
133
132
|
if (node.nodeClass === NodeClass.Variable || node.nodeClass === NodeClass.VariableType) {
|
|
134
133
|
const dataTypeNodeId = (node as UAVariable | UAVariableType).dataType;
|
|
135
|
-
const dataTypeNode = addressSpace.findDataType(dataTypeNodeId)
|
|
134
|
+
const dataTypeNode = addressSpace.findDataType(dataTypeNodeId);
|
|
136
135
|
if (dataTypeNode) {
|
|
137
136
|
consider(dataTypeNode.nodeId.namespace);
|
|
138
137
|
} else {
|
|
@@ -236,9 +235,11 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
|
|
|
236
235
|
// always include the target namespace as a dependency
|
|
237
236
|
// regardless of priority, since the current node owns
|
|
238
237
|
// this relationship.
|
|
239
|
-
if (
|
|
240
|
-
&&
|
|
241
|
-
|
|
238
|
+
if (
|
|
239
|
+
reference.isForward &&
|
|
240
|
+
nonHierarchicalReferencesType &&
|
|
241
|
+
referenceType.isSubtypeOf(nonHierarchicalReferencesType)
|
|
242
|
+
) {
|
|
242
243
|
consider(namespaceIndexOfTargetNode);
|
|
243
244
|
}
|
|
244
245
|
// For inverse HierarchicalReferences (e.g. Organizes),
|
|
@@ -246,9 +247,11 @@ export function _getCompleteRequiredModelsFromValuesAndReferences(
|
|
|
246
247
|
// regardless of priority, since the reference is
|
|
247
248
|
// stored on this node (organizedBy pattern).
|
|
248
249
|
const hierarchicalReferencesType = addressSpace.findReferenceType("HierarchicalReferences");
|
|
249
|
-
if (
|
|
250
|
-
&&
|
|
251
|
-
|
|
250
|
+
if (
|
|
251
|
+
!reference.isForward &&
|
|
252
|
+
hierarchicalReferencesType &&
|
|
253
|
+
referenceType.isSubtypeOf(hierarchicalReferencesType)
|
|
254
|
+
) {
|
|
252
255
|
consider(namespaceIndexOfTargetNode);
|
|
253
256
|
}
|
|
254
257
|
}
|
|
@@ -313,14 +316,14 @@ export function constructNamespacePriorityTable(addressSpace: IAddressSpace): {
|
|
|
313
316
|
};
|
|
314
317
|
|
|
315
318
|
for (let i = 0; i < namespaces.length; i++) {
|
|
316
|
-
const
|
|
317
|
-
if (nbTypes) {
|
|
319
|
+
const entry = map.get(i);
|
|
320
|
+
if (entry?.nbTypes) {
|
|
318
321
|
h(namespaces[i]);
|
|
319
322
|
}
|
|
320
323
|
}
|
|
321
324
|
for (let i = 0; i < namespaces.length; i++) {
|
|
322
|
-
const
|
|
323
|
-
if (!nbTypes) {
|
|
325
|
+
const entry = map.get(i);
|
|
326
|
+
if (!entry?.nbTypes) {
|
|
324
327
|
h(namespaces[i]);
|
|
325
328
|
}
|
|
326
329
|
}
|
|
@@ -7,7 +7,6 @@ import type { AddressSpacePrivate } from "../address_space_private";
|
|
|
7
7
|
import type { NamespacePrivate } from "../namespace_private";
|
|
8
8
|
import { constructNamespaceDependency } from "./construct_namespace_dependency";
|
|
9
9
|
|
|
10
|
-
// tslint:disable-next-line: no-var-requires
|
|
11
10
|
const XMLWriter = require("xml-writer");
|
|
12
11
|
|
|
13
12
|
function dumpEnumeratedType(xw: XmlWriter, e: EnumDefinition, name: string): void {
|
|
@@ -16,7 +15,7 @@ function dumpEnumeratedType(xw: XmlWriter, e: EnumDefinition, name: string): voi
|
|
|
16
15
|
xw.writeAttribute("LengthInBits", "32");
|
|
17
16
|
for (const f of e.fields || []) {
|
|
18
17
|
xw.startElement("opc:EnumeratedValue");
|
|
19
|
-
xw.writeAttribute("Name", f.name|| "");
|
|
18
|
+
xw.writeAttribute("Name", f.name || "");
|
|
20
19
|
assert(f.value[0] === 0, "unsupported 64 bit value !");
|
|
21
20
|
xw.writeAttribute("Value", f.value[1].toString());
|
|
22
21
|
xw.endElement();
|
|
@@ -32,7 +31,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number, string
|
|
|
32
31
|
if (!node) {
|
|
33
32
|
throw new Error(`Cannot find Node for${nodeId?.toString()}`);
|
|
34
33
|
}
|
|
35
|
-
const typeName = node.browseName.name
|
|
34
|
+
const typeName = node.browseName.name || "";
|
|
36
35
|
|
|
37
36
|
const n = node.nodeId as INodeId;
|
|
38
37
|
const prefix =
|
|
@@ -44,7 +43,6 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: Map<number, string
|
|
|
44
43
|
return `${prefix}:${typeName === "Structure" && prefix === "ua" ? "ExtensionObject" : typeName}`;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
// eslint-disable-next-line max-statements
|
|
48
46
|
function dumpDataTypeStructure(
|
|
49
47
|
xw: XmlWriter,
|
|
50
48
|
addressSpace: IAddressSpace,
|
|
@@ -110,7 +108,7 @@ function dumpDataTypeStructure(
|
|
|
110
108
|
|
|
111
109
|
if (isArray) {
|
|
112
110
|
xw.startElement("opc:Field");
|
|
113
|
-
xw.writeAttribute("Name", `NoOf${f.name
|
|
111
|
+
xw.writeAttribute("Name", `NoOf${f.name || ""}`);
|
|
114
112
|
xw.writeAttribute("TypeName", "opc:Int32");
|
|
115
113
|
if (f.isOptional) {
|
|
116
114
|
xw.writeAttribute("SwitchField", `${f.name}Specified`);
|
|
@@ -119,15 +117,15 @@ function dumpDataTypeStructure(
|
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
xw.startElement("opc:Field");
|
|
122
|
-
xw.writeAttribute("Name", f.name|| "");
|
|
120
|
+
xw.writeAttribute("Name", f.name || "");
|
|
123
121
|
|
|
124
122
|
const typeName = buildXmlName(addressSpace as AddressSpacePrivate, map, f.dataType);
|
|
125
123
|
xw.writeAttribute("TypeName", typeName);
|
|
126
124
|
if (isArray) {
|
|
127
|
-
xw.writeAttribute("LengthField", `NoOf${f.name|| ""}`);
|
|
125
|
+
xw.writeAttribute("LengthField", `NoOf${f.name || ""}`);
|
|
128
126
|
}
|
|
129
127
|
if (f.isOptional) {
|
|
130
|
-
xw.writeAttribute("SwitchField", `${f.name|| ""}Specified`);
|
|
128
|
+
xw.writeAttribute("SwitchField", `${f.name || ""}Specified`);
|
|
131
129
|
}
|
|
132
130
|
xw.endElement();
|
|
133
131
|
}
|