node-opcua-address-space 2.181.1 → 2.182.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/api/helpers/ensure_secure_access.ts +53 -2
- package/api/index.ts +30 -1
- package/api/loader/generateAddressSpaceRaw.ts +44 -139
- package/api/loader/load_nodeset2.ts +5 -0
- package/api/loader/narrow_instance_datatypes.ts +264 -0
- package/api/loader/nodeset_builtin_formats.ts +143 -0
- package/api/loader/nodeset_format.ts +153 -0
- package/api/loader/nodeset_image.ts +37 -4
- package/api/loader/nodeset_image_codec.ts +153 -34
- package/api/loader/nodeset_record.ts +26 -2
- package/api/loader/nodeset_record_applier.ts +54 -3
- package/api/loader/nodeset_records_to_xml.ts +620 -0
- package/api/loader/nodeset_source.ts +185 -26
- package/api/loader/nodeset_to_image.ts +16 -5
- package/api/loader/nodeset_xml_header.ts +119 -0
- package/api/loader/nodeset_xml_primitives.ts +209 -0
- package/api/loader/nodeset_xml_producer.ts +61 -2
- package/api/loader/parsers/variant_parser.ts +9 -0
- package/bin/nodeset_equivalence.js +750 -0
- package/bin/nodeset_tool_common.js +72 -0
- package/bin/opcua-nodeset-image.js +93 -103
- package/bin/opcua-nodeset-live.js +139 -0
- package/dist/api/helpers/ensure_secure_access.d.ts +20 -0
- package/dist/api/helpers/ensure_secure_access.js +39 -0
- package/dist/api/helpers/ensure_secure_access.js.map +1 -1
- package/dist/api/index.d.ts +7 -2
- package/dist/api/index.js +21 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/loader/generateAddressSpaceRaw.d.ts +1 -7
- package/dist/api/loader/generateAddressSpaceRaw.js +32 -125
- package/dist/api/loader/generateAddressSpaceRaw.js.map +1 -1
- package/dist/api/loader/load_nodeset2.js +4 -0
- package/dist/api/loader/load_nodeset2.js.map +1 -1
- package/dist/api/loader/narrow_instance_datatypes.d.ts +30 -0
- package/dist/api/loader/narrow_instance_datatypes.js +217 -0
- package/dist/api/loader/narrow_instance_datatypes.js.map +1 -0
- package/dist/api/loader/nodeset_builtin_formats.d.ts +27 -0
- package/dist/api/loader/nodeset_builtin_formats.js +133 -0
- package/dist/api/loader/nodeset_builtin_formats.js.map +1 -0
- package/dist/api/loader/nodeset_format.d.ts +123 -0
- package/dist/api/loader/nodeset_format.js +63 -0
- package/dist/api/loader/nodeset_format.js.map +1 -0
- package/dist/api/loader/nodeset_image.d.ts +17 -1
- package/dist/api/loader/nodeset_image.js +32 -4
- package/dist/api/loader/nodeset_image.js.map +1 -1
- package/dist/api/loader/nodeset_image_codec.d.ts +4 -0
- package/dist/api/loader/nodeset_image_codec.js +142 -53
- package/dist/api/loader/nodeset_image_codec.js.map +1 -1
- package/dist/api/loader/nodeset_record.d.ts +26 -2
- package/dist/api/loader/nodeset_record.js +11 -2
- package/dist/api/loader/nodeset_record.js.map +1 -1
- package/dist/api/loader/nodeset_record_applier.js +52 -3
- package/dist/api/loader/nodeset_record_applier.js.map +1 -1
- package/dist/api/loader/nodeset_records_to_xml.d.ts +16 -0
- package/dist/api/loader/nodeset_records_to_xml.js +536 -0
- package/dist/api/loader/nodeset_records_to_xml.js.map +1 -0
- package/dist/api/loader/nodeset_source.d.ts +68 -7
- package/dist/api/loader/nodeset_source.js +157 -20
- package/dist/api/loader/nodeset_source.js.map +1 -1
- package/dist/api/loader/nodeset_to_image.d.ts +4 -4
- package/dist/api/loader/nodeset_to_image.js +14 -4
- package/dist/api/loader/nodeset_to_image.js.map +1 -1
- package/dist/api/loader/nodeset_xml_header.d.ts +22 -0
- package/dist/api/loader/nodeset_xml_header.js +113 -0
- package/dist/api/loader/nodeset_xml_header.js.map +1 -0
- package/dist/api/loader/nodeset_xml_primitives.d.ts +37 -0
- package/dist/api/loader/nodeset_xml_primitives.js +196 -0
- package/dist/api/loader/nodeset_xml_primitives.js.map +1 -0
- package/dist/api/loader/nodeset_xml_producer.js +56 -1
- package/dist/api/loader/nodeset_xml_producer.js.map +1 -1
- package/dist/api/loader/parsers/variant_parser.js +7 -0
- package/dist/api/loader/parsers/variant_parser.js.map +1 -1
- package/dist/impl/_instantiate_helpers.js +1 -0
- package/dist/impl/_instantiate_helpers.js.map +1 -1
- package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js +4 -0
- package/dist/impl/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -1
- package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +14 -0
- package/dist/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -1
- package/dist/impl/base_node_impl.d.ts +9 -0
- package/dist/impl/base_node_impl.js +11 -0
- package/dist/impl/base_node_impl.js.map +1 -1
- package/dist/impl/base_node_private.js +67 -97
- package/dist/impl/base_node_private.js.map +1 -1
- package/dist/impl/nodeset_tools/construct_namespace_dependency.js +5 -1
- package/dist/impl/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/impl/nodeset_tools/nodeset_to_records.js +61 -15
- package/dist/impl/nodeset_tools/nodeset_to_records.js.map +1 -1
- package/dist/impl/nodeset_tools/nodeset_to_xml.d.ts +1 -8
- package/dist/impl/nodeset_tools/nodeset_to_xml.js +174 -190
- package/dist/impl/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/impl/ua_data_type_impl.d.ts +21 -0
- package/dist/impl/ua_data_type_impl.js +27 -2
- package/dist/impl/ua_data_type_impl.js.map +1 -1
- package/dist/impl/ua_object_type_impl.d.ts +9 -0
- package/dist/impl/ua_object_type_impl.js +12 -1
- package/dist/impl/ua_object_type_impl.js.map +1 -1
- package/dist/impl/ua_variable_impl.js +27 -10
- package/dist/impl/ua_variable_impl.js.map +1 -1
- package/dist/impl/ua_variable_impl_ext_obj.js +19 -2
- package/dist/impl/ua_variable_impl_ext_obj.js.map +1 -1
- package/dist/impl/ua_variable_type_impl.d.ts +8 -1
- package/dist/impl/ua_variable_type_impl.js +39 -2
- package/dist/impl/ua_variable_type_impl.js.map +1 -1
- package/dist/tsconfig_base.tsbuildinfo +1 -1
- package/distNodeJS/generate_address_space.js +4 -0
- package/distNodeJS/generate_address_space.js.map +1 -1
- package/impl/_instantiate_helpers.ts +3 -0
- package/impl/alarms_and_conditions/ua_alarm_condition_impl.ts +10 -0
- package/impl/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +17 -0
- package/impl/base_node_impl.ts +15 -0
- package/impl/base_node_private.ts +97 -146
- package/impl/nodeset_tools/construct_namespace_dependency.ts +5 -1
- package/impl/nodeset_tools/nodeset_to_records.ts +66 -16
- package/impl/nodeset_tools/nodeset_to_xml.ts +127 -160
- package/impl/ua_data_type_impl.ts +40 -2
- package/impl/ua_object_type_impl.ts +16 -3
- package/impl/ua_variable_impl.ts +27 -10
- package/impl/ua_variable_impl_ext_obj.ts +20 -2
- package/impl/ua_variable_type_impl.ts +48 -2
- package/package.json +29 -27
- package/source_nodejs/generate_address_space.ts +7 -1
|
@@ -11,8 +11,16 @@ import { coerceBoolean, coerceByte, coerceInt32 } from "node-opcua-basic-types";
|
|
|
11
11
|
import { DataTypeIds } from "node-opcua-constants";
|
|
12
12
|
import { NodeClass, type QualifiedName, stringToQualifiedName } from "node-opcua-data-model";
|
|
13
13
|
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
14
|
-
import { _definitionParser, ReaderState, type ReaderStateParserLike, Xml2Json, type XmlAttributes } from "node-opcua-xml2json";
|
|
15
14
|
import {
|
|
15
|
+
_definitionParser,
|
|
16
|
+
InternalFragmentClonerReaderState,
|
|
17
|
+
ReaderState,
|
|
18
|
+
type ReaderStateParserLike,
|
|
19
|
+
Xml2Json,
|
|
20
|
+
type XmlAttributes
|
|
21
|
+
} from "node-opcua-xml2json";
|
|
22
|
+
import {
|
|
23
|
+
type NodesetDataTypeDefinitionRecord,
|
|
16
24
|
type NodesetDefinitionField,
|
|
17
25
|
type NodesetHeaderRecord,
|
|
18
26
|
type NodesetModelRecord,
|
|
@@ -46,6 +54,7 @@ interface NodeState {
|
|
|
46
54
|
export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
47
55
|
let pending: NodesetRecord[] = [];
|
|
48
56
|
let namespaceUris: string[] = [];
|
|
57
|
+
let extensions: string[] = [];
|
|
49
58
|
const models: NodesetModelRecord[] = [];
|
|
50
59
|
const aliases: Record<string, NodeId> = Object.create(null);
|
|
51
60
|
let headerEmitted = false;
|
|
@@ -75,6 +84,7 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
75
84
|
}
|
|
76
85
|
headerEmitted = true;
|
|
77
86
|
const header: NodesetHeaderRecord = { kind: "header", namespaceUris, models: models.slice(), aliases: { ...aliases } };
|
|
87
|
+
if (extensions.length > 0) header.extensions = extensions.slice();
|
|
78
88
|
pending.push(header);
|
|
79
89
|
}
|
|
80
90
|
|
|
@@ -147,9 +157,28 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
147
157
|
(this.parent as NodeState).obj.description = this.text;
|
|
148
158
|
}
|
|
149
159
|
};
|
|
160
|
+
// a node may declare several <Category> elements and at most one <Documentation>. Neither is
|
|
161
|
+
// part of the information model and neither reaches the address space, but both are content a
|
|
162
|
+
// working group wrote into the document, and a form that drops them is not the same document
|
|
163
|
+
const category_parser = {
|
|
164
|
+
finish(this: State) {
|
|
165
|
+
const obj = (this.parent as NodeState).obj;
|
|
166
|
+
if (!obj.category) {
|
|
167
|
+
obj.category = [];
|
|
168
|
+
}
|
|
169
|
+
obj.category.push(this.text);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const documentation_parser = {
|
|
173
|
+
finish(this: State) {
|
|
174
|
+
(this.parent as NodeState).obj.documentation = this.text;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
150
177
|
const common_parser = {
|
|
151
178
|
DisplayName: displayName_parser,
|
|
152
179
|
Description: description_parser,
|
|
180
|
+
Category: category_parser,
|
|
181
|
+
Documentation: documentation_parser,
|
|
153
182
|
References: references_parser,
|
|
154
183
|
RolePermissions: role_permissions_parser
|
|
155
184
|
};
|
|
@@ -203,6 +232,8 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
203
232
|
if (attrs.SymbolicName !== undefined) this.obj.symbolicName = attrs.SymbolicName;
|
|
204
233
|
this.definitionFields = [];
|
|
205
234
|
this.definitionName = undefined;
|
|
235
|
+
this.definitionIsUnion = undefined;
|
|
236
|
+
this.definitionIsOptionSet = undefined;
|
|
206
237
|
},
|
|
207
238
|
finish(this: State) {
|
|
208
239
|
const fields = this.definitionFields as Array<Record<string, unknown>>;
|
|
@@ -216,7 +247,11 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
216
247
|
if (field.allowSubTypes) field.allowSubTypes = coerceBoolean(field.allowSubTypes as string | boolean);
|
|
217
248
|
return field as unknown as NodesetDefinitionField;
|
|
218
249
|
});
|
|
219
|
-
|
|
250
|
+
const definition: NodesetDataTypeDefinitionRecord = { name: this.definitionName, fields: converted };
|
|
251
|
+
// the <Definition> flags, which the definition parser leaves on this state
|
|
252
|
+
if (this.definitionIsUnion) definition.isUnion = true;
|
|
253
|
+
if (this.definitionIsOptionSet) definition.isOptionSet = true;
|
|
254
|
+
(this.obj as NodesetNodeRecord).definition = definition;
|
|
220
255
|
}
|
|
221
256
|
pending.push(this.obj);
|
|
222
257
|
},
|
|
@@ -269,6 +304,8 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
269
304
|
...emit,
|
|
270
305
|
parser: {
|
|
271
306
|
DisplayName: displayName_parser,
|
|
307
|
+
Category: category_parser,
|
|
308
|
+
Documentation: documentation_parser,
|
|
272
309
|
References: references_parser,
|
|
273
310
|
RolePermissions: role_permissions_parser
|
|
274
311
|
}
|
|
@@ -312,9 +349,31 @@ export function makeXmlNodesetRecordReader(): XmlNodesetRecordReader {
|
|
|
312
349
|
}
|
|
313
350
|
});
|
|
314
351
|
|
|
352
|
+
const state_Extensions = {
|
|
353
|
+
init() {
|
|
354
|
+
extensions = [];
|
|
355
|
+
},
|
|
356
|
+
parser: {
|
|
357
|
+
Extension: {
|
|
358
|
+
startElement(this: State, elementName: string, attrs: XmlAttributes, qualifiedName?: string) {
|
|
359
|
+
// whatever a tool put in here is foreign XML: clone the element verbatim, under
|
|
360
|
+
// the name the document gave it, prefix included
|
|
361
|
+
this._cloneFragment = new InternalFragmentClonerReaderState();
|
|
362
|
+
this.engine?._promote(this._cloneFragment, this.engine?.currentLevel, qualifiedName ?? elementName, attrs);
|
|
363
|
+
},
|
|
364
|
+
finish(this: State) {
|
|
365
|
+
const xml = this._cloneFragment?.value;
|
|
366
|
+
if (xml) extensions.push(xml);
|
|
367
|
+
if (this._cloneFragment) this._cloneFragment.value = null;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
315
373
|
const state_0: ReaderStateParserLike = {
|
|
316
374
|
parser: {
|
|
317
375
|
Aliases: { parser: { Alias: state_Alias } },
|
|
376
|
+
Extensions: state_Extensions,
|
|
318
377
|
NamespaceUris: {
|
|
319
378
|
init() {
|
|
320
379
|
namespaceUris = [];
|
|
@@ -83,6 +83,8 @@ function parser2(_setValue: (data: VariantOptions) => void, type: string, p: (te
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
const parseUInt64 = (str: string): UInt64 => coerceUInt64(str);
|
|
86
|
+
/** an invalid date is left as one rather than as null: the document said something, and said it badly */
|
|
87
|
+
const parseDateTime = (str: string): Date => new Date(str);
|
|
86
88
|
const parseInt64 = (str: string): Int64 => coerceInt64(str);
|
|
87
89
|
|
|
88
90
|
/** an element of an ExtensionObject array as the reader leaves it: decoded, or waiting as its XML */
|
|
@@ -211,6 +213,11 @@ export function makeVariantReader<T extends ReaderStateParserLike>(
|
|
|
211
213
|
UInt64: parser2(setValue2, "UInt64", parseUInt64),
|
|
212
214
|
Int64: parser2(setValue2, "Int64", parseInt64),
|
|
213
215
|
|
|
216
|
+
// a NodeSet2 <Value> may hold a DateTime, and until this was here the reader silently
|
|
217
|
+
// gave back no value at all for one -- the variable then looked to every consumer like
|
|
218
|
+
// a variable the document had never valued
|
|
219
|
+
DateTime: parser2(setValue2, "DateTime", parseDateTime),
|
|
220
|
+
|
|
214
221
|
ByteString: {
|
|
215
222
|
init(this: { value: Buffer | null; text: string }) {
|
|
216
223
|
this.value = null;
|
|
@@ -354,6 +361,8 @@ export function makeVariantReader<T extends ReaderStateParserLike>(
|
|
|
354
361
|
|
|
355
362
|
ListOfUInt8: ListOf<number>(setValue2, "UInt8", parseInt),
|
|
356
363
|
|
|
364
|
+
ListOfDateTime: ListOf<Date>(setValue2, "DateTime", parseDateTime),
|
|
365
|
+
|
|
357
366
|
ListOfString: ListOf<string>(setValue2, "String", (value: string) => value),
|
|
358
367
|
|
|
359
368
|
ListOfXmlElement: ListOf<string>(setValue2, "XmlElement", (value: string) => value)
|