node-opcua-address-space 2.77.0 → 2.79.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/alarms_and_conditions/ua_limit_alarm_impl.d.ts +1 -1
- package/dist/src/base_node_impl.d.ts +1 -0
- package/dist/src/base_node_impl.js +30 -3
- package/dist/src/base_node_impl.js.map +1 -1
- package/dist/src/base_node_private.js +5 -0
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/historical_access/address_space_historical_data_node.js +14 -3
- package/dist/src/historical_access/address_space_historical_data_node.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/{typedictionary_to_xml.d.ts → dump_to_bsd.d.ts} +1 -1
- package/dist/src/nodeset_tools/{typedictionary_to_xml.js → dump_to_bsd.js} +14 -5
- 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 +220 -89
- 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_method_impl.d.ts +2 -1
- package/dist/src/ua_method_impl.js +9 -1
- package/dist/src/ua_method_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.d.ts +5 -0
- package/dist/src/ua_variable_impl.js +36 -2
- 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 +26 -26
- 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/alarms_and_conditions/ua_limit_alarm_impl.ts +1 -1
- package/src/base_node_impl.ts +34 -3
- package/src/base_node_private.ts +6 -0
- package/src/historical_access/address_space_historical_data_node.ts +18 -3
- 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 +278 -77
- package/src/tool_isSupertypeOf.ts +14 -2
- package/src/ua_data_type_impl.ts +11 -7
- package/src/ua_method_impl.ts +9 -3
- package/src/ua_object_impl.ts +12 -2
- package/src/ua_variable_impl.ts +42 -4
- 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 +207 -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/dist/source/helpers/check_event_clause.d.ts +0 -17
- package/dist/source/helpers/check_event_clause.js +0 -53
- package/dist/source/helpers/check_event_clause.js.map +0 -1
- package/dist/src/alarms_and_conditions/check_where_clause.d.ts +0 -4
- package/dist/src/alarms_and_conditions/check_where_clause.js +0 -110
- package/dist/src/alarms_and_conditions/check_where_clause.js.map +0 -1
- package/dist/src/alarms_and_conditions/condition_info.d.ts +0 -27
- package/dist/src/alarms_and_conditions/condition_info.js +0 -55
- package/dist/src/alarms_and_conditions/condition_info.js.map +0 -1
- package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +0 -233
- package/dist/src/alarms_and_conditions/condition_snapshot.js +0 -667
- package/dist/src/alarms_and_conditions/condition_snapshot.js.map +0 -1
- package/dist/src/alarms_and_conditions/extract_event_fields.d.ts +0 -10
- package/dist/src/alarms_and_conditions/extract_event_fields.js +0 -90
- package/dist/src/alarms_and_conditions/extract_event_fields.js.map +0 -1
- package/dist/src/data_access/ua_multistate_value_discrete.d.ts +0 -51
- package/dist/src/data_access/ua_multistate_value_discrete.js +0 -250
- package/dist/src/data_access/ua_multistate_value_discrete.js.map +0 -1
- package/dist/src/data_access/ua_two_state_discrete.d.ts +0 -25
- package/dist/src/data_access/ua_two_state_discrete.js +0 -154
- package/dist/src/data_access/ua_two_state_discrete.js.map +0 -1
- package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +0 -1
package/src/nodeid_manager.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable max-depth */
|
|
2
|
+
/* eslint-disable max-statements */
|
|
1
3
|
import { assert } from "node-opcua-assert";
|
|
2
4
|
import { NodeClass, QualifiedName } from "node-opcua-data-model";
|
|
3
5
|
import { makeNodeId, NodeId, NodeIdLike, NodeIdType, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
@@ -50,6 +52,7 @@ export interface ConstructNodeIdOptions {
|
|
|
50
52
|
browseName: QualifiedName;
|
|
51
53
|
nodeClass: NodeClass;
|
|
52
54
|
references?: UAReference[];
|
|
55
|
+
registerSymbolicNames?: boolean;
|
|
53
56
|
}
|
|
54
57
|
export type NodeEntry = [string, number, NodeClass];
|
|
55
58
|
export type NodeEntry1 = [string, number, string /*"Object" | "Variable" etc...*/];
|
|
@@ -116,7 +119,6 @@ export class NodeIdManager {
|
|
|
116
119
|
|
|
117
120
|
public constructNodeId(options: ConstructNodeIdOptions): NodeId {
|
|
118
121
|
function prepareName(browseName: QualifiedName): string {
|
|
119
|
-
assert(browseName instanceof QualifiedName);
|
|
120
122
|
const m = browseName.name!.toString().replace(/[ ]/g, "").replace(/(<|>)/g, "");
|
|
121
123
|
return m;
|
|
122
124
|
}
|
|
@@ -124,10 +126,7 @@ export class NodeIdManager {
|
|
|
124
126
|
const nodeClass = options.nodeClass;
|
|
125
127
|
|
|
126
128
|
if (!nodeId) {
|
|
127
|
-
// console.log("xx constructNodeId", options.browseName.toString());
|
|
128
|
-
|
|
129
129
|
const parentInfo = this.findParentNodeId(options);
|
|
130
|
-
|
|
131
130
|
if (parentInfo) {
|
|
132
131
|
const [parentNodeId, linkName] = parentInfo;
|
|
133
132
|
const name = prepareName(options.browseName);
|
|
@@ -148,6 +147,16 @@ export class NodeIdManager {
|
|
|
148
147
|
} else {
|
|
149
148
|
return this._getOrCreateFromName(newName, nodeClass);
|
|
150
149
|
}
|
|
150
|
+
} else {
|
|
151
|
+
if (options.registerSymbolicNames) {
|
|
152
|
+
const newName = name;
|
|
153
|
+
const nodeIdValueInCache = this._cache[newName];
|
|
154
|
+
if (nodeIdValueInCache) {
|
|
155
|
+
return new NodeId(NodeIdType.NUMERIC, nodeIdValueInCache, this.namespaceIndex);
|
|
156
|
+
} else {
|
|
157
|
+
return this._getOrCreateFromName(newName, nodeClass);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
// }} has parent ...
|
|
@@ -228,4 +237,4 @@ export class NodeIdManager {
|
|
|
228
237
|
return nodeIdResult;
|
|
229
238
|
}
|
|
230
239
|
}
|
|
231
|
-
}
|
|
240
|
+
}
|
|
@@ -33,7 +33,7 @@ function buildXmlName(addressSpace: AddressSpacePrivate, map: { [key: number]: s
|
|
|
33
33
|
throw new Error("Cannot find Node for" + nodeId?.toString());
|
|
34
34
|
}
|
|
35
35
|
const typeName = node.browseName.name!;
|
|
36
|
-
const prefix = node.nodeId.namespace === 0 ? (node.nodeId.value
|
|
36
|
+
const prefix = node.nodeId.namespace === 0 ? (node.nodeId.value<= 15 ? "opc" : "ua") : map[node.nodeId.namespace];
|
|
37
37
|
return prefix + ":" + (typeName === "Structure" && prefix === "ua" ? "ExtensionObject" : typeName);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ function dumpDataTypeStructure(
|
|
|
43
43
|
addressSpace: IAddressSpace,
|
|
44
44
|
map: { [key: number]: string },
|
|
45
45
|
structureDefinition: StructureDefinition,
|
|
46
|
-
structureDefinitionBase: StructureDefinition | undefined| null,
|
|
46
|
+
structureDefinitionBase: StructureDefinition | undefined | null,
|
|
47
47
|
name: string,
|
|
48
48
|
doc?: string
|
|
49
49
|
): void {
|
|
@@ -59,11 +59,11 @@ function dumpDataTypeStructure(
|
|
|
59
59
|
|
|
60
60
|
const fields = structureDefinition.fields || [];
|
|
61
61
|
// get base class
|
|
62
|
-
const nbFieldsInBase = structureDefinitionBase? structureDefinitionBase.fields?.length || 0 : 0;
|
|
62
|
+
const nbFieldsInBase = structureDefinitionBase ? structureDefinitionBase.fields?.length || 0 : 0;
|
|
63
63
|
|
|
64
64
|
let optionalsCount = 0;
|
|
65
|
-
for (let index = nbFieldsInBase; index < fields.length; index
|
|
66
|
-
const f=
|
|
65
|
+
for (let index = nbFieldsInBase; index < fields.length; index++) {
|
|
66
|
+
const f = fields[index];
|
|
67
67
|
if (f.isOptional) {
|
|
68
68
|
xw.startElement("opc:Field");
|
|
69
69
|
xw.writeAttribute("Name", f.name + "Specified");
|
|
@@ -96,9 +96,9 @@ function dumpDataTypeStructure(
|
|
|
96
96
|
xw.endElement();
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
for (let index = nbFieldsInBase; index < fields.length; index
|
|
100
|
-
const f=
|
|
101
|
-
|
|
99
|
+
for (let index = nbFieldsInBase; index < fields.length; index++) {
|
|
100
|
+
const f = fields[index];
|
|
101
|
+
|
|
102
102
|
const isArray = f.valueRank > 0 && f.arrayDimensions?.length;
|
|
103
103
|
|
|
104
104
|
if (isArray) {
|
|
@@ -145,27 +145,29 @@ function dumpDataTypeToBSD(xw: XmlWriter, dataType: UADataType, map: { [key: num
|
|
|
145
145
|
function shortcut(namespace: INamespace) {
|
|
146
146
|
return "n" + namespace.index;
|
|
147
147
|
}
|
|
148
|
-
export function dumpToBSD(namespace: NamespacePrivate):
|
|
148
|
+
export function dumpToBSD(namespace: NamespacePrivate): string {
|
|
149
149
|
const dependency: INamespace[] = constructNamespaceDependency(namespace);
|
|
150
150
|
|
|
151
151
|
const addressSpace = namespace.addressSpace;
|
|
152
152
|
|
|
153
|
-
const xw = new XMLWriter(true);
|
|
153
|
+
const xw: XmlWriter = new XMLWriter(true);
|
|
154
154
|
|
|
155
|
-
xw.startDocument({ encoding: "utf-8", version: "1.0" });
|
|
155
|
+
//xx xw.startDocument():// { encoding: "utf-8", version: "1.0" });
|
|
156
156
|
|
|
157
157
|
xw.startElement("opc:TypeDictionary");
|
|
158
158
|
|
|
159
159
|
xw.writeAttribute("xmlns:opc", "http://opcfoundation.org/BinarySchema/");
|
|
160
160
|
xw.writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
|
161
161
|
xw.writeAttribute("xmlns:ua", "http://opcfoundation.org/UA/");
|
|
162
|
+
xw.writeAttribute("xmlns:tns", namespace.namespaceUri);
|
|
162
163
|
|
|
163
164
|
const map: { [key: number]: string } = {};
|
|
165
|
+
|
|
166
|
+
map[namespace.index] = "tns";
|
|
164
167
|
|
|
165
168
|
for (const dependantNamespace of dependency) {
|
|
166
169
|
const namespaceIndex = dependantNamespace.index;
|
|
167
|
-
if (namespaceIndex === 0) {
|
|
168
|
-
//|| namespaceIndex === namespace.index) {
|
|
170
|
+
if (namespaceIndex === 0 || namespaceIndex === namespace.index) {
|
|
169
171
|
continue;
|
|
170
172
|
}
|
|
171
173
|
const ns = shortcut(dependantNamespace);
|
|
@@ -176,11 +178,19 @@ export function dumpToBSD(namespace: NamespacePrivate): void {
|
|
|
176
178
|
xw.writeAttribute("DefaultByteOrder", "LittleEndian");
|
|
177
179
|
xw.writeAttribute("TargetNamespace", namespace.namespaceUri);
|
|
178
180
|
|
|
181
|
+
// <opc:Import Namespace="http://opcfoundation.org/UA/"/>
|
|
182
|
+
for (const dependantNamespace of dependency) {
|
|
183
|
+
if (dependantNamespace.index === namespace.index) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
xw.startElement("opc:Import").writeAttribute("Namespace", dependantNamespace.namespaceUri).endElement();
|
|
187
|
+
}
|
|
188
|
+
//
|
|
179
189
|
for (const dataType of namespace._dataTypeIterator()) {
|
|
180
190
|
dumpDataTypeToBSD(xw, dataType, map);
|
|
181
191
|
}
|
|
182
192
|
xw.endElement();
|
|
183
|
-
xw.endDocument();
|
|
193
|
+
// xw.endDocument();
|
|
184
194
|
|
|
185
195
|
return xw.toString();
|
|
186
196
|
}
|