node-opcua-address-space 2.76.2 → 2.78.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/continuation_points/continuation_point_manager.d.ts +59 -0
- package/dist/source/continuation_points/continuation_point_manager.js +6 -6
- package/dist/source/continuation_points/continuation_point_manager.js.map +1 -1
- package/dist/source/index.d.ts +1 -0
- package/dist/source/index.js +1 -0
- package/dist/source/index.js.map +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js +25 -0
- package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
- package/dist/source/loader/generateAddressSpaceRaw.d.ts +2 -1
- package/dist/source/loader/generateAddressSpaceRaw.js +2 -2
- package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/source/loader/load_nodeset2.d.ts +7 -3
- package/dist/source/loader/load_nodeset2.js +66 -31
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/xml_writer.d.ts +5 -0
- package/dist/src/base_node_private.js +5 -0
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/index_current.d.ts +2 -1
- package/dist/src/index_current.js +3 -2
- package/dist/src/index_current.js.map +1 -1
- package/dist/src/namespace_impl.d.ts +2 -0
- package/dist/src/namespace_impl.js +11 -1
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/namespace_private.d.ts +1 -0
- package/dist/src/namespace_private.js.map +1 -1
- package/dist/src/nodeid_manager.d.ts +1 -0
- package/dist/src/nodeid_manager.js +14 -2
- package/dist/src/nodeid_manager.js.map +1 -1
- package/dist/src/nodeset_tools/dump_to_bsd.d.ts +2 -0
- package/dist/src/nodeset_tools/dump_to_bsd.js +164 -0
- package/dist/src/nodeset_tools/dump_to_bsd.js.map +1 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +9 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +182 -87
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/tool_isSupertypeOf.js +12 -2
- package/dist/src/tool_isSupertypeOf.js.map +1 -1
- package/dist/src/ua_data_type_impl.js +10 -5
- package/dist/src/ua_data_type_impl.js.map +1 -1
- package/dist/src/ua_object_impl.js +8 -1
- package/dist/src/ua_object_impl.js.map +1 -1
- package/dist/src/ua_variable_impl.js +5 -1
- package/dist/src/ua_variable_impl.js.map +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js +1 -1
- package/dist/src/ua_variable_impl_ext_obj.js.map +1 -1
- package/distHelpers/get_mini_address_space.js +1 -1
- package/distHelpers/get_mini_address_space.js.map +1 -1
- package/distNodeJS/generate_address_space.d.ts +3 -1
- package/distNodeJS/generate_address_space.js +13 -2
- package/distNodeJS/generate_address_space.js.map +1 -1
- package/package.json +38 -38
- package/source/continuation_points/continuation_point_manager.ts +13 -12
- package/source/index.ts +1 -0
- package/source/loader/ensure_datatype_extracted.ts +38 -3
- package/source/loader/generateAddressSpaceRaw.ts +4 -3
- package/source/loader/load_nodeset2.ts +86 -33
- package/source/xml_writer.ts +3 -0
- package/source_nodejs/generate_address_space.ts +27 -5
- package/src/base_node_private.ts +6 -0
- package/src/index_current.ts +3 -1
- package/src/namespace_impl.ts +24 -1
- package/src/namespace_private.ts +2 -0
- package/src/nodeid_manager.ts +14 -5
- package/src/nodeset_tools/{typedictionary_to_xml.ts → dump_to_bsd.ts} +24 -14
- package/src/nodeset_tools/nodeset_to_xml.ts +231 -74
- package/src/tool_isSupertypeOf.ts +14 -2
- package/src/ua_data_type_impl.ts +11 -7
- package/src/ua_object_impl.ts +12 -2
- package/src/ua_variable_impl.ts +9 -2
- package/src/ua_variable_impl_ext_obj.ts +1 -1
- package/test_helpers/get_mini_address_space.ts +1 -1
- package/test_helpers/test_fixtures/mini.Node.Set2.xml +29 -0
- package/test_helpers/test_fixtures/nodeset_no_aliases.xml +30 -0
- package/test_helpers/test_fixtures/nodeset_no_aliases_with_aliases.xml +31 -0
package/src/ua_data_type_impl.ts
CHANGED
|
@@ -16,12 +16,11 @@ import {
|
|
|
16
16
|
EnumDefinition,
|
|
17
17
|
EnumFieldOptions,
|
|
18
18
|
StructureDefinition,
|
|
19
|
-
StructureField,
|
|
20
19
|
StructureFieldOptions,
|
|
21
20
|
StructureType
|
|
22
21
|
} from "node-opcua-types";
|
|
23
22
|
import { DataType } from "node-opcua-variant";
|
|
24
|
-
import { UAObject, ISessionContext, UADataType, UAVariable, BaseNode
|
|
23
|
+
import { UAObject, ISessionContext, UADataType, UAVariable, BaseNode } from "node-opcua-address-space-base";
|
|
25
24
|
import { DataTypeIds } from "node-opcua-constants";
|
|
26
25
|
import { IStructuredTypeSchema } from "node-opcua-factory";
|
|
27
26
|
|
|
@@ -124,11 +123,15 @@ export class UADataTypeImpl extends BaseNodeImpl implements UADataType {
|
|
|
124
123
|
break;
|
|
125
124
|
case AttributeIds.DataTypeDefinition:
|
|
126
125
|
{
|
|
127
|
-
|
|
128
|
-
if (_definition !== null) {
|
|
129
|
-
options.value = { dataType: DataType.ExtensionObject, value: _definition };
|
|
130
|
-
} else {
|
|
126
|
+
if (this.namespace.$emulateVersion103) {
|
|
131
127
|
options.statusCode = StatusCodes.BadAttributeIdInvalid;
|
|
128
|
+
} else {
|
|
129
|
+
const _definition = this._getDefinition()?.clone();
|
|
130
|
+
if (_definition !== null) {
|
|
131
|
+
options.value = { dataType: DataType.ExtensionObject, value: _definition };
|
|
132
|
+
} else {
|
|
133
|
+
options.statusCode = StatusCodes.BadAttributeIdInvalid;
|
|
134
|
+
}
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
break;
|
|
@@ -414,6 +417,7 @@ function makeEnumDefinition(definitionFields: EnumFieldOptions[]) {
|
|
|
414
417
|
}))
|
|
415
418
|
});
|
|
416
419
|
}
|
|
420
|
+
|
|
417
421
|
function makeStructureDefinition(
|
|
418
422
|
name: string,
|
|
419
423
|
baseDataType: NodeId,
|
|
@@ -464,4 +468,4 @@ function lockReadOnlyWithWriteDetection<T>(obj: T): T {
|
|
|
464
468
|
}
|
|
465
469
|
return obj;
|
|
466
470
|
}
|
|
467
|
-
*/
|
|
471
|
+
*/
|
package/src/ua_object_impl.ts
CHANGED
|
@@ -30,11 +30,14 @@ import {
|
|
|
30
30
|
defaultCloneExtraInfo,
|
|
31
31
|
EventNotifierFlags
|
|
32
32
|
} from "node-opcua-address-space-base";
|
|
33
|
+
import { make_errorLog } from "node-opcua-debug";
|
|
33
34
|
|
|
34
35
|
import { BaseNodeImpl, InternalBaseNodeOptions } from "./base_node_impl";
|
|
35
36
|
import { _clone, ToStringBuilder, UAObject_toString } from "./base_node_private";
|
|
36
37
|
import { apply_condition_refresh, ConditionRefreshCache } from "./apply_condition_refresh";
|
|
37
38
|
|
|
39
|
+
const errorLog = make_errorLog(__filename);
|
|
40
|
+
|
|
38
41
|
export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
39
42
|
private _eventNotifier: EventNotifierFlags;
|
|
40
43
|
public readonly nodeClass = NodeClass.Object;
|
|
@@ -44,6 +47,14 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
|
44
47
|
public readonly symbolicName: string | null;
|
|
45
48
|
|
|
46
49
|
get typeDefinitionObj(): UAObjectType {
|
|
50
|
+
// istanbul ignore next
|
|
51
|
+
if (super.typeDefinitionObj.nodeClass !== NodeClass.ObjectType) {
|
|
52
|
+
const msg = `Invalid type definition node class , expecting a ObjectType got ${
|
|
53
|
+
NodeClass[super.typeDefinitionObj.nodeClass]
|
|
54
|
+
}\n${this.browseName.toString()} ${this.nodeId.toString()}`;
|
|
55
|
+
errorLog(msg);
|
|
56
|
+
throw new Error(msg);
|
|
57
|
+
}
|
|
47
58
|
return super.typeDefinitionObj as UAObjectType;
|
|
48
59
|
}
|
|
49
60
|
|
|
@@ -79,7 +90,6 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
public clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAObject {
|
|
82
|
-
options = options || {};
|
|
83
93
|
options = {
|
|
84
94
|
...options,
|
|
85
95
|
eventNotifier: this.eventNotifier,
|
|
@@ -156,7 +166,7 @@ export class UAObjectImpl extends BaseNodeImpl implements UAObject {
|
|
|
156
166
|
// coerce EventType
|
|
157
167
|
eventTypeNode = addressSpace.findEventType(eventType as UAEventType) as UAEventType;
|
|
158
168
|
const baseEventType = addressSpace.findEventType("BaseEventType")!;
|
|
159
|
-
|
|
169
|
+
|
|
160
170
|
data.$eventDataSource = eventTypeNode;
|
|
161
171
|
data.sourceNode = data.sourceNode || { dataType: DataType.NodeId, value: this.nodeId };
|
|
162
172
|
|
package/src/ua_variable_impl.ts
CHANGED
|
@@ -17,7 +17,8 @@ import {
|
|
|
17
17
|
GetFunc,
|
|
18
18
|
SetFunc,
|
|
19
19
|
VariableDataValueGetterSync,
|
|
20
|
-
VariableDataValueSetterWithCallback
|
|
20
|
+
VariableDataValueSetterWithCallback
|
|
21
|
+
} from "node-opcua-address-space-base";
|
|
21
22
|
import { assert } from "node-opcua-assert";
|
|
22
23
|
import {
|
|
23
24
|
isValidDataEncoding,
|
|
@@ -309,6 +310,12 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
309
310
|
public __waiting_callbacks?: any[];
|
|
310
311
|
|
|
311
312
|
get typeDefinitionObj(): UAVariableType {
|
|
313
|
+
// istanbul ignore next
|
|
314
|
+
if (super.typeDefinitionObj && super.typeDefinitionObj.nodeClass !== NodeClass.VariableType) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
"Invalid type definition node class , expecting a VariableType got " + NodeClass[super.typeDefinitionObj.nodeClass]
|
|
317
|
+
);
|
|
318
|
+
}
|
|
312
319
|
return super.typeDefinitionObj as UAVariableType;
|
|
313
320
|
}
|
|
314
321
|
get typeDefinition(): NodeId {
|
|
@@ -1325,7 +1332,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
|
|
|
1325
1332
|
// let's coerce this scalar into an 1-element array if it is a valid extension object
|
|
1326
1333
|
if (checkExtensionObjectIsCorrectScalar.call(this, extObj)) {
|
|
1327
1334
|
warningLog(
|
|
1328
|
-
`checkExtensionObjectIsCorrect : expecting a array but got a scalar (value rank of ${this.browseName.toString()} is 1)
|
|
1335
|
+
`warning: checkExtensionObjectIsCorrect : expecting a array but got a scalar (value rank of '${this.browseName.toString()}' is 1)\nautomatic conversion from scalar to array with 1 element is taking place.`
|
|
1329
1336
|
);
|
|
1330
1337
|
extObj = [extObj];
|
|
1331
1338
|
} else {
|
|
@@ -279,7 +279,7 @@ export function _installExtensionObjectBindingOnProperties(
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
const camelCaseName = lowerFirstLetter(field.name!);
|
|
282
|
-
assert(Object.prototype.hasOwnProperty.call(variableNode.$extensionObject, camelCaseName));
|
|
282
|
+
// assert(Object.prototype.hasOwnProperty.call(variableNode.$extensionObject, camelCaseName));
|
|
283
283
|
|
|
284
284
|
if (variableNode.$extensionObject[camelCaseName] !== undefined && basicDataType === DataType.ExtensionObject) {
|
|
285
285
|
propertyNode.bindExtensionObject(variableNode.$extensionObject[camelCaseName], { ...options, force: true });
|
|
@@ -29,7 +29,7 @@ export function getMiniAddressSpace(...args: any[]): any {
|
|
|
29
29
|
const serverNamespace = addressSpace.registerNamespace("http://MYNAMESPACE");
|
|
30
30
|
assert(serverNamespace.index === 1);
|
|
31
31
|
|
|
32
|
-
generateAddressSpace(addressSpace, get_mini_nodeset_filename(), (err?: Error) => {
|
|
32
|
+
generateAddressSpace(addressSpace, get_mini_nodeset_filename(), {}, (err?: Error) => {
|
|
33
33
|
// istanbul ignore next
|
|
34
34
|
if (err) {
|
|
35
35
|
// tslint:disable:no-console
|
|
@@ -426,6 +426,35 @@
|
|
|
426
426
|
</References>
|
|
427
427
|
<InverseName>MayBeEffectedBy</InverseName>
|
|
428
428
|
</UAReferenceType>
|
|
429
|
+
|
|
430
|
+
<UADataType NodeId="i=95" BrowseName="AccessRestrictionType">
|
|
431
|
+
<DisplayName>AccessRestrictionType</DisplayName>
|
|
432
|
+
<References>
|
|
433
|
+
<Reference ReferenceType="HasProperty">i=15035</Reference>
|
|
434
|
+
<Reference ReferenceType="HasSubtype" IsForward="false">i=5</Reference>
|
|
435
|
+
</References>
|
|
436
|
+
<Definition Name="AccessRestrictionType" IsOptionSet="true">
|
|
437
|
+
<Field Name="SigningRequired" Value="0" />
|
|
438
|
+
<Field Name="EncryptionRequired" Value="1" />
|
|
439
|
+
<Field Name="SessionRequired" Value="2" />
|
|
440
|
+
<Field Name="ApplyRestrictionsToBrowse" Value="3" />
|
|
441
|
+
</Definition>
|
|
442
|
+
</UADataType>
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
<UADataType NodeId="i=96" BrowseName="RolePermissionType">
|
|
446
|
+
<DisplayName>RolePermissionType</DisplayName>
|
|
447
|
+
<Documentation>https://reference.opcfoundation.org/v104/Core/docs/Part3/5.2.9</Documentation>
|
|
448
|
+
<References>
|
|
449
|
+
<Reference ReferenceType="HasSubtype" IsForward="false">i=22</Reference>
|
|
450
|
+
</References>
|
|
451
|
+
<Definition Name="RolePermissionType">
|
|
452
|
+
<Field Name="RoleId" DataType="i=17" />
|
|
453
|
+
<Field Name="Permissions" DataType="i=94" />
|
|
454
|
+
</Definition>
|
|
455
|
+
</UADataType>
|
|
456
|
+
|
|
457
|
+
|
|
429
458
|
<UAReferenceType NodeId="i=117" BrowseName="HasSubStateMachine">
|
|
430
459
|
<DisplayName>HasSubStateMachine</DisplayName>
|
|
431
460
|
<Description>The type for a reference to a substate for a state.</Description>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
+
<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
3
|
+
xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd">
|
|
4
|
+
<NamespaceUris>
|
|
5
|
+
<Uri>http://A</Uri>
|
|
6
|
+
</NamespaceUris>
|
|
7
|
+
<Models>
|
|
8
|
+
<Model ModelUri="http://A" PublicationDate="2021-01-01T00:00:00Z" Version="1.00">
|
|
9
|
+
<RequiredModel ModelUri="http://opcfoundation.org/UA/" Version="1.03" PublicationDate="2013-12-02T00:00:00Z" />
|
|
10
|
+
</Model>
|
|
11
|
+
</Models>
|
|
12
|
+
<UAVariable DataType="UInt64" ParentNodeId="ns=0;i=2253" NodeId="ns=1;i=1000" BrowseName="1:VariableWithUInt64" AccessLevel="3">
|
|
13
|
+
<DisplayName>NominalParts</DisplayName>
|
|
14
|
+
<References>
|
|
15
|
+
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
|
|
16
|
+
</References>
|
|
17
|
+
<Value>
|
|
18
|
+
<uax:UInt64>1234567890</uax:UInt64>
|
|
19
|
+
</Value>
|
|
20
|
+
</UAVariable>
|
|
21
|
+
<UAVariable DataType="Int64" ParentNodeId="ns=0;i=2253" NodeId="ns=1;i=1001" BrowseName="1:VariableWithInt64" AccessLevel="3">
|
|
22
|
+
<DisplayName>NominalParts</DisplayName>
|
|
23
|
+
<References>
|
|
24
|
+
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
|
|
25
|
+
</References>
|
|
26
|
+
<Value>
|
|
27
|
+
<uax:Int64>-1234567890</uax:Int64>
|
|
28
|
+
</Value>
|
|
29
|
+
</UAVariable>
|
|
30
|
+
</UANodeSet>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
|
2
|
+
<UANodeSet xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
3
|
+
xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd">
|
|
4
|
+
<NamespaceUris>
|
|
5
|
+
<Uri>http://A</Uri>
|
|
6
|
+
</NamespaceUris>
|
|
7
|
+
<Models>
|
|
8
|
+
<Model ModelUri="http://A" PublicationDate="2021-01-01T00:00:00Z" Version="1.00">
|
|
9
|
+
<RequiredModel ModelUri="http://opcfoundation.org/UA/" Version="1.03" PublicationDate="2013-12-02T00:00:00Z" />
|
|
10
|
+
</Model>
|
|
11
|
+
</Models>
|
|
12
|
+
<Aliases></Aliases>
|
|
13
|
+
<UAVariable DataType="UInt64" ParentNodeId="ns=0;i=2253" NodeId="ns=1;i=1000" BrowseName="1:VariableWithUInt64" AccessLevel="3">
|
|
14
|
+
<DisplayName>NominalParts</DisplayName>
|
|
15
|
+
<References>
|
|
16
|
+
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
|
|
17
|
+
</References>
|
|
18
|
+
<Value>
|
|
19
|
+
<uax:UInt64>1234567890</uax:UInt64>
|
|
20
|
+
</Value>
|
|
21
|
+
</UAVariable>
|
|
22
|
+
<UAVariable DataType="Int64" ParentNodeId="ns=0;i=2253" NodeId="ns=1;i=1001" BrowseName="1:VariableWithInt64" AccessLevel="3">
|
|
23
|
+
<DisplayName>NominalParts</DisplayName>
|
|
24
|
+
<References>
|
|
25
|
+
<Reference ReferenceType="HasTypeDefinition">i=68</Reference>
|
|
26
|
+
</References>
|
|
27
|
+
<Value>
|
|
28
|
+
<uax:Int64>-1234567890</uax:Int64>
|
|
29
|
+
</Value>
|
|
30
|
+
</UAVariable>
|
|
31
|
+
</UANodeSet>
|