node-opcua-client-dynamic-extension-object 2.97.0 → 2.98.1

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.
Files changed (28) hide show
  1. package/dist/convert_data_type_definition_to_structuretype_schema.d.ts +14 -14
  2. package/dist/convert_data_type_definition_to_structuretype_schema.js +410 -410
  3. package/dist/convert_structuretype_schema_to_structure_definition.d.ts +3 -3
  4. package/dist/convert_structuretype_schema_to_structure_definition.js +53 -53
  5. package/dist/extra_data_type_manager.d.ts +16 -16
  6. package/dist/extra_data_type_manager.js +78 -78
  7. package/dist/get_extension_object_constructor.d.ts +7 -7
  8. package/dist/get_extension_object_constructor.js +37 -37
  9. package/dist/get_extra_data_type_manager.d.ts +3 -3
  10. package/dist/get_extra_data_type_manager.js +51 -51
  11. package/dist/index.d.ts +13 -13
  12. package/dist/index.js +29 -29
  13. package/dist/populate_data_type_manager.d.ts +3 -3
  14. package/dist/populate_data_type_manager.js +88 -88
  15. package/dist/private/find_encodings.d.ts +4 -4
  16. package/dist/private/find_encodings.js +55 -55
  17. package/dist/private/populate_data_type_manager_103.d.ts +9 -9
  18. package/dist/private/populate_data_type_manager_103.js +639 -639
  19. package/dist/private/populate_data_type_manager_104.d.ts +9 -9
  20. package/dist/private/populate_data_type_manager_104.js +217 -217
  21. package/dist/promote_opaque_structure.d.ts +7 -7
  22. package/dist/promote_opaque_structure.js +46 -46
  23. package/dist/promote_opaque_structure_in_notification_data.d.ts +3 -3
  24. package/dist/promote_opaque_structure_in_notification_data.js +51 -51
  25. package/dist/resolve_dynamic_extension_object.d.ts +6 -6
  26. package/dist/resolve_dynamic_extension_object.js +177 -177
  27. package/package.json +22 -18
  28. package/test/test_convertStructureTypeSchemaToStructureDefinition.ts +0 -117
@@ -1,117 +0,0 @@
1
- import "should";
2
- import * as should from "should";
3
- import { DataTypeFactory } from "node-opcua-factory";
4
- import { resolveNodeId } from "node-opcua-nodeid";
5
- import { parseBinaryXSDAsync } from "node-opcua-schemas";
6
- import { MockProvider } from "node-opcua-schemas/test/mock_id_provider";
7
- import { StructureType } from "node-opcua-types";
8
- import { DataType } from "node-opcua-variant";
9
- import { convertStructureTypeSchemaToStructureDefinition } from "..";
10
-
11
- const idProvider = new MockProvider();
12
-
13
- describe("test convertStructureTypeSchemaToStructureDefinition", function () {
14
- it("should 1", async () => {
15
- /**
16
- *
17
- */
18
- const schema1 = `
19
- <?xml version="1.0" encoding="utf-8"?>
20
- <opc:TypeDictionary xmlns:opc="http://opcfoundation.org/BinarySchema/" TargetNamespace="urn:eclipse:milo:opcua:server:demo" DefaultByteOrder="LittleEndian">
21
- <opc:Import Namespace="http://opcfoundation.org/BinarySchema/"/>
22
- <opc:EnumeratedType LengthInBits="32" Name="CustomEnumType">
23
- <opc:EnumeratedValue Name="Field0" Value="0"/>
24
- <opc:EnumeratedValue Name="Field1" Value="1"/>
25
- <opc:EnumeratedValue Name="Field2" Value="2"/>
26
- </opc:EnumeratedType>
27
- <opc:StructuredType Name="CustomUnionType">
28
- <opc:Field Name="SwitchField" TypeName="opc:UInt32"/>
29
- <opc:Field Name="foo" TypeName="opc:UInt32" SwitchField="SwitchField" SwitchValue="1"/>
30
- <opc:Field Name="bar" TypeName="opc:String" SwitchField="SwitchField" SwitchValue="2"/>
31
- </opc:StructuredType>
32
- <opc:StructuredType Name="CustomStructType">
33
- <opc:Field Name="foo" TypeName="opc:String"/>
34
- <opc:Field Name="bar" TypeName="opc:UInt32"/>
35
- <opc:Field Name="baz" TypeName="opc:Boolean"/>
36
- <opc:Field Name="fiz" TypeName="CustomEnumType"/>
37
- <opc:Field Name="poc" TypeName="CustomUnionType"/>
38
- </opc:StructuredType>
39
- <opc:StructuredType BaseType="ua:ExtensionObject" Name="StructWithOnlyOptionals">
40
- <opc:Field TypeName="opc:Bit" Name="OptionalInt32Specified"/>
41
- <opc:Field TypeName="opc:Bit" Name="OptionalStringArraySpecified"/>
42
- <opc:Field Length="30" TypeName="opc:Bit" Name="Reserved1"/>
43
- <opc:Field SwitchField="OptionalInt32Specified" TypeName="opc:Int32" Name="OptionalInt32"/>
44
- <opc:Field SwitchField="OptionalStringArraySpecified" TypeName="opc:Int32" Name="NoOfOptionalStringArray"/>
45
- <opc:Field SwitchField="OptionalStringArraySpecified" LengthField="NoOfOptionalStringArray" TypeName="opc:CharArray" Name="OptionalStringArray"/>
46
- </opc:StructuredType>
47
- <opc:StructuredType BaseType="ua:ExtensionObject" Name="StructureWithOptionalFields">
48
- <opc:Field TypeName="opc:Bit" Name="OptionalInt32Specified"/>
49
- <opc:Field TypeName="opc:Bit" Name="OptionalStringArraySpecified"/>
50
- <opc:Field Length="30" TypeName="opc:Bit" Name="Reserved1"/>
51
- <opc:Field TypeName="opc:Int32" Name="MandatoryInt32"/>
52
- <opc:Field SwitchField="OptionalInt32Specified" TypeName="opc:Int32" Name="OptionalInt32"/>
53
- <opc:Field TypeName="opc:Int32" Name="NoOfMandatoryStringArray"/>
54
- <opc:Field LengthField="NoOfMandatoryStringArray" TypeName="opc:CharArray" Name="MandatoryStringArray"/>
55
- <opc:Field SwitchField="OptionalStringArraySpecified" TypeName="opc:Int32" Name="NoOfOptionalStringArray"/>
56
- <opc:Field LengthField="NoOfOptionalStringArray" SwitchField="OptionalStringArraySpecified" TypeName="opc:CharArray" Name="OptionalStringArray"/>
57
- </opc:StructuredType>
58
-
59
- </opc:TypeDictionary>
60
- `;
61
-
62
- const dataTypeFactory = new DataTypeFactory([]);
63
- await parseBinaryXSDAsync(schema1, idProvider, dataTypeFactory);
64
-
65
- for (const f of dataTypeFactory.getStructureIterator()) {
66
- const ss = convertStructureTypeSchemaToStructureDefinition(f.schema);
67
- }
68
-
69
-
70
- // --------------------------------------------------------------------------
71
- const a = dataTypeFactory.getStructureInfoByTypeName("CustomUnionType");
72
- const customUnionType = convertStructureTypeSchemaToStructureDefinition(a.schema);
73
- console.log(customUnionType.toString());
74
-
75
- customUnionType.structureType.should.eql(StructureType.Union);
76
- customUnionType.baseDataType.toString().should.eql("ns=0;i=0");
77
-
78
- customUnionType.fields!.length.should.eql(2);
79
-
80
- customUnionType.fields![0].name!.should.eql("foo");
81
- customUnionType.fields![0].dataType.toString().should.eql(resolveNodeId(DataType.UInt32).toString());
82
- customUnionType.fields![0].valueRank.should.eql(-1);
83
- customUnionType.fields![0].arrayDimensions!.should.eql([]);
84
- customUnionType.fields![1].isOptional.should.eql(false);
85
- should(customUnionType.fields![0].description.text).eql(null);
86
-
87
- customUnionType.fields![1].name!.should.eql("bar");
88
- customUnionType.fields![1].dataType.toString().should.eql(resolveNodeId(DataType.String).toString());
89
- customUnionType.fields![1].valueRank.should.eql(-1);
90
- customUnionType.fields![1].arrayDimensions!.should.eql([]);
91
- customUnionType.fields![1].isOptional.should.eql(false);
92
- should(customUnionType.fields![1].description.text).eql(null);
93
-
94
-
95
- // ----------------------------------------------------------------------- CustomStructType
96
- const b = dataTypeFactory.getStructureInfoByTypeName("CustomStructType");
97
- const customStructType = convertStructureTypeSchemaToStructureDefinition(b.schema);
98
- console.log(customStructType.toString());
99
-
100
- customStructType.structureType.should.eql(StructureType.Structure);
101
- customStructType.baseDataType.toString().should.eql("ns=0;i=0");
102
-
103
- customStructType.fields!.length.should.eql(5);
104
-
105
- customStructType.fields![0].name!.should.eql("foo");
106
- customStructType.fields![0].dataType.toString().should.eql(resolveNodeId("String").toString());
107
- customStructType.fields![1].name!.should.eql("bar");
108
- customStructType.fields![1].dataType.toString().should.eql(resolveNodeId("UInt32").toString());
109
- customStructType.fields![2].name!.should.eql("baz");
110
- customStructType.fields![2].dataType.toString().should.eql(resolveNodeId("Boolean").toString());
111
- customStructType.fields![3].name!.should.eql("fiz");
112
- customStructType.fields![3].dataType.toString().should.eql("ns=0;i=0".toString());
113
- customStructType.fields![4].name!.should.eql("poc");
114
- customStructType.fields![4].dataType.toString().should.eql("ns=1;i=1".toString());
115
-
116
- });
117
- });