node-opcua-address-space 2.90.1 → 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/address_space_ts.d.ts +3 -3
- package/dist/source/address_space_ts.js +3 -3
- package/dist/source/address_space_ts.js.map +1 -1
- package/dist/source/helpers/argument_list.js +3 -3
- package/dist/source/helpers/argument_list.js.map +1 -1
- package/dist/source/helpers/call_helpers.d.ts +1 -1
- package/dist/source/helpers/multiform_func.d.ts +8 -8
- package/dist/source/interfaces/alarms_and_conditions/ua_condition_ex.d.ts +1 -1
- package/dist/source/interfaces/extension_object_constructor.d.ts +1 -1
- package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +15 -3
- package/dist/source/loader/generateAddressSpaceRaw.d.ts +2 -2
- package/dist/source/loader/make_xml_extension_object_parser.d.ts +1 -1
- package/dist/source/loader/namespace_post_step.d.ts +1 -1
- package/dist/source/session_context.d.ts +1 -1
- package/dist/src/address_space.js +19 -19
- 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/apply_condition_refresh.d.ts +1 -1
- package/dist/src/base_node_impl.js +47 -47
- 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/event_data.d.ts +2 -2
- 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/nodeid_manager.d.ts +3 -3
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +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/reference_impl.js +6 -6
- package/dist/src/reference_impl.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/ua_data_type_impl.d.ts +6 -4
- package/dist/src/ua_data_type_impl.js +24 -22
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_method_impl.js +6 -6
- package/dist/src/ua_method_impl.js.map +1 -1
- package/dist/src/ua_object_impl.js +7 -7
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_object_type_impl.d.ts +4 -2
- package/dist/src/ua_object_type_impl.js +12 -10
- 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 +12 -10
- package/dist/src/ua_reference_type_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.d.ts +7 -7
- package/dist/src/ua_variable_impl.js +30 -30
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +3 -3
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/src/ua_variable_type_impl.d.ts +4 -2
- package/dist/src/ua_variable_type_impl.js +15 -10
- package/dist/src/ua_variable_type_impl.js.map +1 -1
- package/dist/src/ua_view_impl.js +3 -3
- package/dist/src/ua_view_impl.js.map +1 -1
- package/distHelpers/boiler_system.js +5 -5
- package/distHelpers/boiler_system.js.map +1 -1
- package/package.json +5 -5
- package/source/helpers/argument_list.ts +3 -3
- package/source/interfaces/state_machine/ua_state_machine_type.ts +19 -1
- 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/extension_object_array_node.ts +3 -3
- package/src/index_current.ts +1 -1
- 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 -2033
- package/src/ua_variable_impl_ext_obj.ts +3 -3
- package/src/ua_variable_type_impl.ts +11 -4
- package/test_helpers/boiler_system.ts +5 -5
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import { assert } from "node-opcua-assert";
|
|
6
6
|
import { NodeId, NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
7
7
|
import { sameNodeId } from "node-opcua-nodeid";
|
|
8
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
8
9
|
import { BaseNode, UADataType, UAObjectType, UAReference, UAReferenceType, UAVariableType } from "node-opcua-address-space-base";
|
|
9
10
|
|
|
10
11
|
import { BaseNode_getCache } from "./base_node_private";
|
|
11
12
|
import { ReferenceImpl } from "./reference_impl";
|
|
12
13
|
import { BaseNodeImpl } from "./base_node_impl";
|
|
13
|
-
import { NodeClass } from "node-opcua-data-model";
|
|
14
14
|
|
|
15
15
|
const HasSubTypeNodeId = resolveNodeId("HasSubtype");
|
|
16
16
|
|
|
@@ -20,13 +20,13 @@ function _filterSubType(reference: UAReference) {
|
|
|
20
20
|
|
|
21
21
|
export type BaseNodeConstructor<T extends BaseNode> = new () => T;
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function _slow_isSubtypeOf<T extends UAType>(this: T, Class: typeof BaseNodeImpl, baseType: T | NodeIdLike): boolean {
|
|
24
24
|
if (!(baseType instanceof Class)) {
|
|
25
25
|
const node = this.addressSpace.findNode(baseType as NodeIdLike);
|
|
26
26
|
if (!node || !(node instanceof Class)) {
|
|
27
27
|
throw new Error("Invalid argument");
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return _slow_isSubtypeOf.call(this, Class, node as unknown as T);
|
|
30
30
|
}
|
|
31
31
|
assert(this instanceof Class);
|
|
32
32
|
assert(baseType instanceof Class, " Object must have same type");
|
|
@@ -50,7 +50,7 @@ function _slow_isSupertypeOf<T extends UAType>(this: T, Class: typeof BaseNodeIm
|
|
|
50
50
|
if (sameNodeId(subTypeNode.nodeId, baseType.nodeId)) {
|
|
51
51
|
return true;
|
|
52
52
|
} else {
|
|
53
|
-
if (
|
|
53
|
+
if (_slow_isSubtypeOf.call(subTypeNode, Class, baseType)) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -96,11 +96,11 @@ function hashBaseNode(e: BaseNode): string {
|
|
|
96
96
|
return e.nodeId.value.toString();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
export type
|
|
99
|
+
export type IsSubtypeOfFunc<T extends UAType> = (this: T, baseType: T) => boolean;
|
|
100
100
|
|
|
101
101
|
export type UAType = UAReferenceType | UADataType | UAObjectType | UAVariableType;
|
|
102
102
|
|
|
103
|
-
export function
|
|
103
|
+
export function construct_isSubtypeOf<T extends UAType>(Class: typeof BaseNodeImpl): IsSubtypeOfFunc<T> {
|
|
104
104
|
return wrap_memoize(function (this: T, baseType: T | NodeIdLike): boolean {
|
|
105
105
|
if (!(baseType instanceof Class)) {
|
|
106
106
|
throw new Error(
|
|
@@ -115,13 +115,13 @@ export function construct_isSupertypeOf<T extends UAType>(Class: typeof BaseNode
|
|
|
115
115
|
if (!(this instanceof Class)) {
|
|
116
116
|
throw new Error("expecting this to be " + Class.name + " but got " + baseType.constructor.name);
|
|
117
117
|
}
|
|
118
|
-
return
|
|
118
|
+
return _slow_isSubtypeOf.call(this, Class, baseType as T);
|
|
119
119
|
}, hashBaseNode);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export function
|
|
122
|
+
export function construct_slow_isSubtypeOf<T extends UAType>(Class: typeof BaseNodeImpl) {
|
|
123
123
|
return function (this: T, baseType: T | NodeIdLike): boolean {
|
|
124
|
-
return
|
|
124
|
+
return _slow_isSubtypeOf.call(this, Class, baseType);
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
|
package/src/ua_data_type_impl.ts
CHANGED
|
@@ -26,9 +26,9 @@ import { SessionContext } from "../source/session_context";
|
|
|
26
26
|
import { ExtensionObjectConstructorFuncWithSchema } from "../source/interfaces/extension_object_constructor";
|
|
27
27
|
import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
|
|
28
28
|
import { BaseNode_References_toString, BaseNode_toString, ToStringBuilder, ToStringOption } from "./base_node_private";
|
|
29
|
-
import * as tools from "./
|
|
30
|
-
import { get_subtypeOf } from "./
|
|
31
|
-
import { get_subtypeOfObj } from "./
|
|
29
|
+
import * as tools from "./tool_isSubtypeOf";
|
|
30
|
+
import { get_subtypeOf } from "./tool_isSubtypeOf";
|
|
31
|
+
import { get_subtypeOfObj } from "./tool_isSubtypeOf";
|
|
32
32
|
import { BaseNode_getCache } from "./base_node_private";
|
|
33
33
|
|
|
34
34
|
export interface UADataTypeImpl {
|
|
@@ -62,8 +62,8 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
62
62
|
*
|
|
63
63
|
* var dataTypeDouble = addressSpace.findDataType("Double");
|
|
64
64
|
* var dataTypeNumber = addressSpace.findDataType("Number");
|
|
65
|
-
* assert(dataTypeDouble.
|
|
66
|
-
* assert(!dataTypeNumber.
|
|
65
|
+
* assert(dataTypeDouble.isSubtypeOf(dataTypeNumber));
|
|
66
|
+
* assert(!dataTypeNumber.isSubtypeOf(dataTypeDouble));
|
|
67
67
|
*
|
|
68
68
|
*/
|
|
69
69
|
public get subtypeOf(): NodeId | null {
|
|
@@ -74,7 +74,9 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
74
74
|
return get_subtypeOfObj.call(this) as any as UADataType;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
/** @deprecated */
|
|
78
|
+
public isSupertypeOf = tools.construct_isSubtypeOf<UADataType>(UADataTypeImpl);
|
|
79
|
+
public isSubtypeOf = tools.construct_isSubtypeOf<UADataType>(UADataTypeImpl);
|
|
78
80
|
|
|
79
81
|
public readonly isAbstract: boolean;
|
|
80
82
|
|
|
@@ -277,9 +279,9 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
277
279
|
|
|
278
280
|
// we have a data type from a companion specification
|
|
279
281
|
// let's see if this data type need to be registered
|
|
280
|
-
const isEnumeration = enumeration && this.
|
|
281
|
-
const isStructure = structure && this.
|
|
282
|
-
const isUnion = !!(structure && union && this.
|
|
282
|
+
const isEnumeration = enumeration && this.isSubtypeOf(enumeration);
|
|
283
|
+
const isStructure = structure && this.isSubtypeOf(structure);
|
|
284
|
+
const isUnion = !!(structure && union && this.isSubtypeOf(union));
|
|
283
285
|
|
|
284
286
|
const isRootDataType = (n: UADataType) => n.nodeId.namespace === 0 && n.nodeId.value === DataTypeIds.BaseDataType;
|
|
285
287
|
// https://reference.opcfoundation.org/v104/Core/docs/Part3/8.49/#Table34
|
|
@@ -367,24 +369,24 @@ export function DataType_toString(this: UADataTypeImpl, options: ToStringOption)
|
|
|
367
369
|
|
|
368
370
|
options.add(
|
|
369
371
|
options.padding +
|
|
370
|
-
|
|
371
|
-
|
|
372
|
+
chalk.yellow(" binaryEncodingNodeId: ") +
|
|
373
|
+
(this.binaryEncodingNodeId ? this.binaryEncodingNodeId.toString() : "<none>")
|
|
372
374
|
);
|
|
373
375
|
options.add(
|
|
374
376
|
options.padding +
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
chalk.yellow(" xmlEncodingNodeId : ") +
|
|
378
|
+
(this.xmlEncodingNodeId ? this.xmlEncodingNodeId.toString() : "<none>")
|
|
377
379
|
);
|
|
378
380
|
options.add(
|
|
379
381
|
options.padding +
|
|
380
|
-
|
|
381
|
-
|
|
382
|
+
chalk.yellow(" jsonEncodingNodeId : ") +
|
|
383
|
+
(this.jsonEncodingNodeId ? this.jsonEncodingNodeId.toString() : "<none>")
|
|
382
384
|
);
|
|
383
385
|
if (this.subtypeOfObj) {
|
|
384
386
|
options.add(
|
|
385
387
|
options.padding +
|
|
386
|
-
|
|
387
|
-
|
|
388
|
+
chalk.yellow(" subtypeOfObj : ") +
|
|
389
|
+
(this.subtypeOfObj ? this.subtypeOfObj.browseName.toString() : "")
|
|
388
390
|
);
|
|
389
391
|
}
|
|
390
392
|
// references
|
|
@@ -418,8 +420,8 @@ function makeStructureDefinition(
|
|
|
418
420
|
const structureType = isUnion
|
|
419
421
|
? StructureType.Union
|
|
420
422
|
: hasOptionalFields
|
|
421
|
-
|
|
422
|
-
|
|
423
|
+
? StructureType.StructureWithOptionalFields
|
|
424
|
+
: StructureType.Structure;
|
|
423
425
|
|
|
424
426
|
const sd = new StructureDefinition({
|
|
425
427
|
baseDataType,
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
import { SessionContext } from "../source/session_context";
|
|
22
22
|
import { BaseNodeImpl } from "./base_node_impl";
|
|
23
23
|
import { ToStringBuilder, UAObjectType_toString } from "./base_node_private";
|
|
24
|
-
import { get_subtypeOf, get_subtypeOfObj } from "./
|
|
25
|
-
import * as tools from "./
|
|
24
|
+
import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSubtypeOf";
|
|
25
|
+
import * as tools from "./tool_isSubtypeOf";
|
|
26
26
|
import {
|
|
27
27
|
assertUnusedChildBrowseName,
|
|
28
28
|
initialize_properties_and_components,
|
|
@@ -42,10 +42,16 @@ export class UAObjectTypeImpl extends BaseNodeImpl implements UAObjectType {
|
|
|
42
42
|
public get subtypeOf(): NodeId | null {
|
|
43
43
|
return get_subtypeOf.call(this);
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
|
|
45
47
|
public get subtypeOfObj(): UAObjectType | null {
|
|
46
48
|
return get_subtypeOfObj.call(this) as any as UAObjectType;
|
|
47
49
|
}
|
|
48
|
-
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
public isSubtypeOf = tools.construct_isSubtypeOf<UAObjectType>(UAObjectTypeImpl);
|
|
53
|
+
/** @deprecated - use isSubtypeOf instead */
|
|
54
|
+
public isSupertypeOf = tools.construct_isSubtypeOf<UAObjectType>(UAObjectTypeImpl);
|
|
49
55
|
|
|
50
56
|
constructor(options: any) {
|
|
51
57
|
super(options);
|
|
@@ -14,8 +14,8 @@ import { DataType } from "node-opcua-variant";
|
|
|
14
14
|
|
|
15
15
|
import { SessionContext, UAReferenceType as UAReferenceTypePublic } from "../source";
|
|
16
16
|
import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
|
|
17
|
-
import * as tools from "./
|
|
18
|
-
import { get_subtypeOf, get_subtypeOfObj } from "./
|
|
17
|
+
import * as tools from "./tool_isSubtypeOf";
|
|
18
|
+
import { get_subtypeOf, get_subtypeOfObj } from "./tool_isSubtypeOf";
|
|
19
19
|
import { ReferenceImpl } from "./reference_impl";
|
|
20
20
|
import { BaseNode_getCache } from "./base_node_private";
|
|
21
21
|
|
|
@@ -98,12 +98,15 @@ export class UAReferenceTypeImpl extends BaseNodeImpl implements UAReferenceType
|
|
|
98
98
|
/**
|
|
99
99
|
* returns true if self is a super type of baseType
|
|
100
100
|
*/
|
|
101
|
-
public
|
|
101
|
+
public isSubtypeOf = tools.construct_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
|
|
102
|
+
|
|
103
|
+
/** @deprecated - use `isSubtypeOf` instead*/
|
|
104
|
+
public isSupertypeOf = tools.construct_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
|
|
102
105
|
|
|
103
106
|
/**
|
|
104
107
|
* @private
|
|
105
108
|
*/
|
|
106
|
-
public
|
|
109
|
+
public _slow_isSubtypeOf = tools.construct_slow_isSubtypeOf<UAReferenceType>(UAReferenceTypeImpl);
|
|
107
110
|
|
|
108
111
|
constructor(options: UAReferenceTypeOptions) {
|
|
109
112
|
super(options);
|