node-opcua-address-space 2.90.0 → 2.91.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/argument_list.js +3 -3
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +13 -1
- package/dist/source/loader/load_nodeset2.js +5 -5
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/src/address_space.js +8 -8
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_condition_impl.js +2 -2
- package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +1 -1
- package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -1
- package/dist/src/base_node_impl.js +3 -3
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +4 -4
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/check_value_rank_compatibility.d.ts +15 -0
- package/dist/src/check_value_rank_compatibility.js +82 -0
- package/dist/src/check_value_rank_compatibility.js.map +1 -0
- package/dist/src/extension_object_array_node.js +3 -3
- package/dist/src/extension_object_array_node.js.map +1 -1
- package/dist/src/index_current.d.ts +1 -1
- package/dist/src/index_current.js +2 -1
- package/dist/src/index_current.js.map +1 -1
- package/dist/src/namespace_impl.js +0 -2
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +9 -9
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/state_machine/finite_state_machine.d.ts +16 -2
- package/dist/src/state_machine/finite_state_machine.js +83 -44
- package/dist/src/state_machine/finite_state_machine.js.map +1 -1
- package/dist/src/tool_isSubtypeOf.d.ts +18 -0
- package/dist/src/tool_isSubtypeOf.js +125 -0
- package/dist/src/tool_isSubtypeOf.js.map +1 -0
- package/dist/src/tool_isSupertypeOf.d.ts +4 -4
- package/dist/src/ua_data_type_impl.d.ts +6 -4
- package/dist/src/ua_data_type_impl.js +13 -11
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +4 -2
- package/dist/src/ua_object_type_impl.js +7 -5
- package/dist/src/ua_object_type_impl.js.map +1 -1
- package/dist/src/ua_reference_type_impl.d.ts +5 -3
- package/dist/src/ua_reference_type_impl.js +8 -6
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +19 -7
- package/dist/src/ua_variable_impl.js +38 -23
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +22 -13
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.d.ts +15 -3
- package/dist/src/ua_variable_type_impl.js +17 -6
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/distHelpers/boiler_system.js +5 -5
- package/distHelpers/boiler_system.js.map +1 -1
- package/package.json +34 -34
- package/source/helpers/argument_list.ts +3 -3
- package/source/interfaces/state_machine/ua_state_machine_type.ts +19 -1
- package/source/loader/load_nodeset2.ts +11 -10
- package/src/address_space.ts +8 -8
- package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +1 -1
- package/src/alarms_and_conditions/ua_condition_impl.ts +2 -2
- package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +1 -1
- package/src/base_node_impl.ts +3 -3
- package/src/base_node_private.ts +3 -3
- package/src/check_value_rank_compatibility.ts +79 -0
- package/src/extension_object_array_node.ts +3 -3
- package/src/index_current.ts +1 -1
- package/src/namespace_impl.ts +0 -4
- package/src/nodeset_tools/nodeset_to_xml.ts +9 -9
- package/src/state_machine/finite_state_machine.ts +105 -60
- package/src/{tool_isSupertypeOf.ts → tool_isSubtypeOf.ts} +9 -9
- package/src/ua_data_type_impl.ts +21 -19
- package/src/ua_object_type_impl.ts +9 -3
- package/src/ua_reference_type_impl.ts +7 -4
- package/src/ua_variable_impl.ts +2033 -2006
- package/src/ua_variable_impl_ext_obj.ts +28 -15
- package/src/ua_variable_type_impl.ts +31 -5
- package/test_helpers/boiler_system.ts +5 -5
- package/test_helpers/test_fixtures/eurange_issue.xml +3 -2
|
@@ -255,7 +255,7 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
|
|
|
255
255
|
if (field.dataType) {
|
|
256
256
|
const dataTypeNode = addressSpace.findDataType(field.dataType);
|
|
257
257
|
// istanbul ignore next
|
|
258
|
-
if (dataTypeNode && dataTypeNode.
|
|
258
|
+
if (dataTypeNode && dataTypeNode.isSubtypeOf(structure)) {
|
|
259
259
|
// sub structure .. let make an handler too
|
|
260
260
|
const camelCaseName = lowerFirstLetter(field.name!);
|
|
261
261
|
|
|
@@ -265,7 +265,7 @@ function installExt(uaVariable: UAVariableImpl, ext: ExtensionObject) {
|
|
|
265
265
|
return uaVariable.getComponentByName(field.name!) as UAVariable | null;
|
|
266
266
|
}));
|
|
267
267
|
} else {
|
|
268
|
-
warningLog("extension object is null");
|
|
268
|
+
doDebug && warningLog("extension object is null");
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
}
|
|
@@ -389,7 +389,7 @@ function isVariableContainingExtensionObject(uaVariable: UAVariableImpl): boolea
|
|
|
389
389
|
assert(structure.browseName.toString() === "Structure", "expecting DataType Structure to be in IAddressSpace");
|
|
390
390
|
|
|
391
391
|
const dt = uaVariable.getDataTypeNode() as UADataTypeImpl;
|
|
392
|
-
if (!dt.
|
|
392
|
+
if (!dt.isSubtypeOf(structure)) {
|
|
393
393
|
return false;
|
|
394
394
|
}
|
|
395
395
|
return true;
|
|
@@ -412,14 +412,7 @@ function _innerBindExtensionObjectScalar(uaVariable: UAVariableImpl,
|
|
|
412
412
|
};
|
|
413
413
|
|
|
414
414
|
installDataValueGetter(uaVariable, get);
|
|
415
|
-
|
|
416
|
-
uaVariable._inner_replace_dataValue = (dataValue: DataValue, indexRange?: NumericRange | null) => {
|
|
417
|
-
/** */
|
|
418
|
-
const ext = dataValue.value.value;
|
|
419
|
-
const sourceTime = coerceClock(dataValue.sourceTimestamp, dataValue.sourcePicoseconds);
|
|
420
|
-
const cache = new Set<UAVariableImpl>();
|
|
421
|
-
set(ext, sourceTime, cache);
|
|
422
|
-
}
|
|
415
|
+
uaVariable.$set_ExtensionObject = set;
|
|
423
416
|
|
|
424
417
|
_installFields2(uaVariable, {
|
|
425
418
|
get: (fieldName: string) => {
|
|
@@ -437,6 +430,7 @@ function _innerBindExtensionObjectScalar(uaVariable: UAVariableImpl,
|
|
|
437
430
|
}
|
|
438
431
|
|
|
439
432
|
|
|
433
|
+
// eslint-disable-next-line complexity
|
|
440
434
|
export function _bindExtensionObject(
|
|
441
435
|
uaVariable: UAVariableImpl,
|
|
442
436
|
optionalExtensionObject?: ExtensionObject,
|
|
@@ -444,10 +438,16 @@ export function _bindExtensionObject(
|
|
|
444
438
|
): ExtensionObject | null {
|
|
445
439
|
options = options || { createMissingProp: false };
|
|
446
440
|
|
|
441
|
+
// istanbul ignore next
|
|
447
442
|
if (!isVariableContainingExtensionObject(uaVariable)) {
|
|
448
443
|
return null;
|
|
449
444
|
}
|
|
450
445
|
|
|
446
|
+
// istanbul ignore next
|
|
447
|
+
if (optionalExtensionObject && uaVariable.valueRank === 0) {
|
|
448
|
+
warningLog(uaVariable.browseName.toString() + ": valueRank was zero but needed to be adjusted to -1 (Scalar) in bindExtensionObject");
|
|
449
|
+
uaVariable.valueRank = -1;
|
|
450
|
+
}
|
|
451
451
|
const addressSpace = uaVariable.addressSpace;
|
|
452
452
|
let extensionObject_;
|
|
453
453
|
|
|
@@ -469,7 +469,7 @@ export function _bindExtensionObject(
|
|
|
469
469
|
const dataTypeNode = addressSpace.findNode(parentDataType) as UADataType;
|
|
470
470
|
const structure = addressSpace.findDataType("Structure")!;
|
|
471
471
|
// istanbul ignore next
|
|
472
|
-
if (dataTypeNode && dataTypeNode.
|
|
472
|
+
if (dataTypeNode && dataTypeNode.isSubtypeOf(structure)) {
|
|
473
473
|
// warningLog(
|
|
474
474
|
// "Ignoring bindExtensionObject on sub extension object",
|
|
475
475
|
// "child=",
|
|
@@ -568,12 +568,16 @@ const composeBrowseNameAndNodeId = (uaVariable: UAVariable, indexes: number[]) =
|
|
|
568
568
|
}
|
|
569
569
|
|
|
570
570
|
|
|
571
|
-
// eslint-disable-next-line max-statements
|
|
571
|
+
// eslint-disable-next-line max-statements, complexity
|
|
572
572
|
export function _bindExtensionObjectArrayOrMatrix(
|
|
573
573
|
uaVariable: UAVariableImpl,
|
|
574
574
|
optionalExtensionObjectArray?: ExtensionObject[],
|
|
575
575
|
options?: BindExtensionObjectOptions
|
|
576
576
|
): ExtensionObject[] {
|
|
577
|
+
|
|
578
|
+
options = options || { createMissingProp: false};
|
|
579
|
+
options.createMissingProp = options.createMissingProp || false;
|
|
580
|
+
|
|
577
581
|
// istanbul ignore next
|
|
578
582
|
if (uaVariable.valueRank < 1) {
|
|
579
583
|
throw new Error("Variable must be a MultiDimensional array");
|
|
@@ -583,6 +587,12 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
583
587
|
if (!isVariableContainingExtensionObject(uaVariable)) {
|
|
584
588
|
return [];
|
|
585
589
|
}
|
|
590
|
+
|
|
591
|
+
if (!optionalExtensionObjectArray && uaVariable.$dataValue.value.value) {
|
|
592
|
+
assert(Array.isArray(uaVariable.$dataValue.value.value));
|
|
593
|
+
optionalExtensionObjectArray = uaVariable.$dataValue.value.value;
|
|
594
|
+
}
|
|
595
|
+
|
|
586
596
|
if ((arrayDimensions.length === 0 || arrayDimensions.length === 1 && arrayDimensions[0] === 0) && optionalExtensionObjectArray) {
|
|
587
597
|
arrayDimensions[0] = optionalExtensionObjectArray.length;
|
|
588
598
|
}
|
|
@@ -636,10 +646,13 @@ export function _bindExtensionObjectArrayOrMatrix(
|
|
|
636
646
|
|
|
637
647
|
const { browseName, nodeId } = composeBrowseNameAndNodeId(uaVariable, index);
|
|
638
648
|
|
|
639
|
-
|
|
640
|
-
|
|
641
649
|
let uaElement = uaVariable.getComponentByName(browseName) as UAVariableImpl | null;
|
|
642
650
|
if (!uaElement) {
|
|
651
|
+
|
|
652
|
+
if (!options.createMissingProp) {
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
|
|
643
656
|
uaElement = namespace.addVariable({
|
|
644
657
|
browseName,
|
|
645
658
|
nodeId,
|
|
@@ -37,9 +37,10 @@ import { makeOptionalsMap, OptionalMap } from "../source/helpers/make_optionals_
|
|
|
37
37
|
import { AddressSpacePrivate } from "./address_space_private";
|
|
38
38
|
import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
|
|
39
39
|
import { _clone_children_references, ToStringBuilder, UAVariableType_toString } from "./base_node_private";
|
|
40
|
-
import * as tools from "./
|
|
41
|
-
import { get_subtypeOfObj } from "./
|
|
42
|
-
import { get_subtypeOf } from "./
|
|
40
|
+
import * as tools from "./tool_isSubtypeOf";
|
|
41
|
+
import { get_subtypeOfObj } from "./tool_isSubtypeOf";
|
|
42
|
+
import { get_subtypeOf } from "./tool_isSubtypeOf";
|
|
43
|
+
import { checkValueRankCompatibility } from "./check_value_rank_compatibility";
|
|
43
44
|
|
|
44
45
|
const debugLog = make_debugLog(__filename);
|
|
45
46
|
const doDebug = checkDebugFlag(__filename);
|
|
@@ -50,6 +51,7 @@ const errorLog = make_errorLog(__filename);
|
|
|
50
51
|
let doTrace = checkDebugFlag("INSTANTIATE");
|
|
51
52
|
const traceLog = errorLog;
|
|
52
53
|
|
|
54
|
+
|
|
53
55
|
interface InstantiateS {
|
|
54
56
|
propertyOf?: any;
|
|
55
57
|
componentOf?: any;
|
|
@@ -83,7 +85,17 @@ export function topMostParentIsObjectTypeOrVariableType(addressSpace: AddressSpa
|
|
|
83
85
|
return false;
|
|
84
86
|
}
|
|
85
87
|
export interface UAVariableTypeOptions extends InternalBaseNodeOptions {
|
|
86
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* This attribute indicates whether the Value attribute of the Variableis an array and how many dimensions the array has.
|
|
90
|
+
* It may have the following values:
|
|
91
|
+
* * n > 1: the Value is an array with the specified number of dimensions.
|
|
92
|
+
* * OneDimension (1): The value is an array with one dimension.
|
|
93
|
+
* * OneOrMoreDimensions (0): The value is an array with one or more dimensions.
|
|
94
|
+
* * Scalar (−1): The value is not an array.
|
|
95
|
+
* * Any (−2): The value can be a scalar or an array with any number of dimensions.
|
|
96
|
+
* * ScalarOrOneDimension (−3): The value can be a scalar or a one dimensional array.
|
|
97
|
+
* * All DataTypes are considered to be scalar, even if they have array-like semantics like ByteString and String.
|
|
98
|
+
*/
|
|
87
99
|
valueRank?: number;
|
|
88
100
|
arrayDimensions?: number[] | null;
|
|
89
101
|
historizing?: boolean;
|
|
@@ -91,6 +103,10 @@ export interface UAVariableTypeOptions extends InternalBaseNodeOptions {
|
|
|
91
103
|
value?: any;
|
|
92
104
|
dataType: NodeIdLike;
|
|
93
105
|
}
|
|
106
|
+
|
|
107
|
+
function deprecate<T>(func: T):T {
|
|
108
|
+
return func;
|
|
109
|
+
}
|
|
94
110
|
export class UAVariableTypeImpl extends BaseNodeImpl implements UAVariableType {
|
|
95
111
|
public readonly nodeClass = NodeClass.VariableType;
|
|
96
112
|
|
|
@@ -102,7 +118,10 @@ export class UAVariableTypeImpl extends BaseNodeImpl implements UAVariableType {
|
|
|
102
118
|
return get_subtypeOfObj.call(this) as UAVariableType;
|
|
103
119
|
}
|
|
104
120
|
|
|
105
|
-
public
|
|
121
|
+
public isSubtypeOf = tools.construct_isSubtypeOf<UAVariableType>(UAVariableTypeImpl);
|
|
122
|
+
|
|
123
|
+
/** @deprecated - use isSubtypeOf instead */
|
|
124
|
+
public isSupertypeOf = deprecate(tools.construct_isSubtypeOf<UAVariableType>(UAVariableTypeImpl));
|
|
106
125
|
|
|
107
126
|
public readonly isAbstract: boolean;
|
|
108
127
|
public dataType: NodeId;
|
|
@@ -227,6 +246,13 @@ export class UAVariableTypeImpl extends BaseNodeImpl implements UAVariableType {
|
|
|
227
246
|
assert(dataType instanceof NodeId);
|
|
228
247
|
|
|
229
248
|
const valueRank = options.valueRank !== undefined ? options.valueRank : this.valueRank;
|
|
249
|
+
|
|
250
|
+
const { result, errorMessage } = checkValueRankCompatibility(valueRank, this.valueRank);
|
|
251
|
+
if (!result) {
|
|
252
|
+
errorLog(errorMessage);
|
|
253
|
+
throw new Error(errorMessage);
|
|
254
|
+
}
|
|
255
|
+
|
|
230
256
|
const arrayDimensions = options.arrayDimensions !== undefined ? options.arrayDimensions : this.arrayDimensions;
|
|
231
257
|
|
|
232
258
|
// istanbul ignore next
|
|
@@ -248,11 +248,11 @@ export function createBoilerType(namespace: Namespace): BoilerType {
|
|
|
248
248
|
}) as SignalToReference;
|
|
249
249
|
|
|
250
250
|
const addressSpace = namespace.addressSpace;
|
|
251
|
-
flowTo.
|
|
252
|
-
flowTo.
|
|
253
|
-
hotFlowTo.
|
|
254
|
-
hotFlowTo.
|
|
255
|
-
hotFlowTo.
|
|
251
|
+
flowTo.isSubtypeOf(addressSpace.findReferenceType("References")!);
|
|
252
|
+
flowTo.isSubtypeOf(addressSpace.findReferenceType("NonHierarchicalReferences")!);
|
|
253
|
+
hotFlowTo.isSubtypeOf(addressSpace.findReferenceType("References")!);
|
|
254
|
+
hotFlowTo.isSubtypeOf(addressSpace.findReferenceType("NonHierarchicalReferences")!);
|
|
255
|
+
hotFlowTo.isSubtypeOf(addressSpace.findReferenceType("FlowTo", namespace.index)!);
|
|
256
256
|
|
|
257
257
|
const NonHierarchicalReferences = addressSpace.findReferenceType("NonHierarchicalReferences");
|
|
258
258
|
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
<Alias Alias="HasProperty">i=46</Alias>
|
|
19
19
|
<Alias Alias="HasSubtype">i=45</Alias>
|
|
20
20
|
<Alias Alias="HasTypeDefinition">i=40</Alias>
|
|
21
|
+
<Alias Alias="PropertyType">i=68</Alias>
|
|
21
22
|
<Alias Alias="Int32">i=6</Alias>
|
|
22
23
|
<Alias Alias="Range">i=884</Alias>
|
|
23
24
|
<Alias Alias="String">i=12</Alias>
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
|
|
34
35
|
<UAVariable NodeId="ns=1;i=1301" BrowseName="Range" AccessLevel="3" DataType="Range">
|
|
35
36
|
<References>
|
|
36
|
-
<Reference ReferenceType="HasTypeDefinition">i=1317</Reference>
|
|
37
|
+
<Reference ReferenceType="HasTypeDefinition">ns=1;i=1317</Reference>
|
|
37
38
|
<Reference ReferenceType="HasModellingRule">i=78</Reference>
|
|
38
39
|
</References>
|
|
39
40
|
<Value>
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
<UAVariableType NodeId="ns=1;i=1317" BrowseName="MyVariableType" AccessLevel="3" DataType="Range">
|
|
55
56
|
<DisplayName>EURange</DisplayName>
|
|
56
57
|
<References>
|
|
57
|
-
<Reference ReferenceType="HasSubtype" IsForward="false">
|
|
58
|
+
<Reference ReferenceType="HasSubtype" IsForward="false">PropertyType</Reference>
|
|
58
59
|
</References>
|
|
59
60
|
<Value>
|
|
60
61
|
<ExtensionObject>
|