node-opcua-client-dynamic-extension-object 2.51.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.
Files changed (49) hide show
  1. package/LICENSE +20 -0
  2. package/dist/convert_data_type_definition_to_structuretype_schema.d.ts +12 -0
  3. package/dist/convert_data_type_definition_to_structuretype_schema.js +284 -0
  4. package/dist/convert_data_type_definition_to_structuretype_schema.js.map +1 -0
  5. package/dist/extra_data_type_manager.d.ts +16 -0
  6. package/dist/extra_data_type_manager.js +76 -0
  7. package/dist/extra_data_type_manager.js.map +1 -0
  8. package/dist/get_extension_object_constructor.d.ts +7 -0
  9. package/dist/get_extension_object_constructor.js +38 -0
  10. package/dist/get_extension_object_constructor.js.map +1 -0
  11. package/dist/get_extra_data_type_manager.d.ts +3 -0
  12. package/dist/get_extra_data_type_manager.js +52 -0
  13. package/dist/get_extra_data_type_manager.js.map +1 -0
  14. package/dist/index.d.ts +11 -0
  15. package/dist/index.js +24 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/populate_data_type_manager.d.ts +3 -0
  18. package/dist/populate_data_type_manager.js +26 -0
  19. package/dist/populate_data_type_manager.js.map +1 -0
  20. package/dist/private/convert_data_type_definition_to_structuretype_schema.d.ts +12 -0
  21. package/dist/private/convert_data_type_definition_to_structuretype_schema.js +284 -0
  22. package/dist/private/convert_data_type_definition_to_structuretype_schema.js.map +1 -0
  23. package/dist/private/find_encodings.d.ts +4 -0
  24. package/dist/private/find_encodings.js +56 -0
  25. package/dist/private/find_encodings.js.map +1 -0
  26. package/dist/private/populate_data_type_manager_103.d.ts +9 -0
  27. package/dist/private/populate_data_type_manager_103.js +599 -0
  28. package/dist/private/populate_data_type_manager_103.js.map +1 -0
  29. package/dist/private/populate_data_type_manager_104.d.ts +9 -0
  30. package/dist/private/populate_data_type_manager_104.js +146 -0
  31. package/dist/private/populate_data_type_manager_104.js.map +1 -0
  32. package/dist/promote_opaque_structure.d.ts +6 -0
  33. package/dist/promote_opaque_structure.js +42 -0
  34. package/dist/promote_opaque_structure.js.map +1 -0
  35. package/dist/resolve_dynamic_extension_object.d.ts +4 -0
  36. package/dist/resolve_dynamic_extension_object.js +106 -0
  37. package/dist/resolve_dynamic_extension_object.js.map +1 -0
  38. package/package.json +47 -0
  39. package/source/convert_data_type_definition_to_structuretype_schema.ts +326 -0
  40. package/source/extra_data_type_manager.ts +89 -0
  41. package/source/get_extension_object_constructor.ts +28 -0
  42. package/source/get_extra_data_type_manager.ts +43 -0
  43. package/source/index.ts +11 -0
  44. package/source/populate_data_type_manager.ts +14 -0
  45. package/source/private/find_encodings.ts +44 -0
  46. package/source/private/populate_data_type_manager_103.ts +715 -0
  47. package/source/private/populate_data_type_manager_104.ts +153 -0
  48. package/source/promote_opaque_structure.ts +42 -0
  49. package/source/resolve_dynamic_extension_object.ts +104 -0
@@ -0,0 +1,599 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.populateDataTypeManager103 = void 0;
13
+ // tslint:disable: no-console
14
+ /**
15
+ * @module node-opcua-client-dynamic-extension-object
16
+ */
17
+ const chalk = require("chalk");
18
+ const PrettyError = require("pretty-error");
19
+ const pe = new PrettyError();
20
+ const node_opcua_assert_1 = require("node-opcua-assert");
21
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
22
+ const node_opcua_debug_1 = require("node-opcua-debug");
23
+ const node_opcua_factory_1 = require("node-opcua-factory");
24
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
25
+ const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
26
+ const node_opcua_schemas_1 = require("node-opcua-schemas");
27
+ const node_opcua_service_browse_1 = require("node-opcua-service-browse");
28
+ const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
29
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
30
+ const node_opcua_types_1 = require("node-opcua-types");
31
+ const convert_data_type_definition_to_structuretype_schema_1 = require("../convert_data_type_definition_to_structuretype_schema");
32
+ const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
33
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
34
+ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
35
+ // DataType
36
+ // | 1
37
+ // | n
38
+ // +- HasEncoding-> "Default Binary" (O)[DataTypeEncodingType]
39
+ // |
40
+ // +-- HasDescription -> "MyItemType" (V)[DataTypeDescriptionType]
41
+ // |
42
+ // +- ComponentOf -> Schema(V) []
43
+ // |
44
+ // +- ComponentOf -> OPC Binary(V)[DataTypeSystemType]
45
+ //
46
+ // Note that in 1.04 compliant server, DataType definition might be available
47
+ // in a DataTypeDefinition attributes of the DataType object
48
+ // However this is a brand new aspect of the specification and is not widely implemented
49
+ // it is also optional
50
+ // It will takes time for old opcua server to be refurbished and we may have to
51
+ // keep the current method to access type definition from embedded xsd.
52
+ //
53
+ function _readDeprecatedFlag(session, dataTypeDictionary) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const browsePath = (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(dataTypeDictionary, ".Deprecated");
56
+ const a = yield session.translateBrowsePath(browsePath);
57
+ /* istanbul ignore next */
58
+ if (!a.targets || a.targets.length === 0) {
59
+ // the server is probably version < 1.04.
60
+ debugLog("Cannot find Deprecated property for dataTypeDictionary " + dataTypeDictionary.toString());
61
+ return false;
62
+ }
63
+ const deprecatedFlagNodeId = a.targets[0].targetId;
64
+ const dataValue = yield session.read({ nodeId: deprecatedFlagNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value });
65
+ return dataValue.value.value;
66
+ });
67
+ }
68
+ function _readNamespaceUriProperty(session, dataTypeDictionary) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const a = yield session.translateBrowsePath((0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(dataTypeDictionary, ".NamespaceUri"));
71
+ /* istanbul ignore next */
72
+ if (!a.targets || a.targets.length === 0) {
73
+ return "??dataTypeDictionary doesn't expose NamespaceUri property??";
74
+ }
75
+ const namespaceUriProp = a.targets[0].targetId;
76
+ const dataValue = yield session.read({ nodeId: namespaceUriProp, attributeId: node_opcua_data_model_1.AttributeIds.Value });
77
+ return dataValue.value.value || "<not set>";
78
+ });
79
+ }
80
+ function _getDataTypeDescriptions(session, dataTypeDictionaryNodeId) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ const nodeToBrowse2 = {
83
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Forward,
84
+ includeSubtypes: false,
85
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Variable"),
86
+ nodeId: dataTypeDictionaryNodeId,
87
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasComponent"),
88
+ // resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
89
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("NodeId | BrowseName")
90
+ };
91
+ const result2 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodeToBrowse2);
92
+ result2.references = result2.references || [];
93
+ return result2.references.map((r) => ({ nodeId: r.nodeId, browseName: r.browseName }));
94
+ });
95
+ }
96
+ function _enrichWithDescriptionOf(session, dataTypeDescriptions) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const nodesToBrowse3 = [];
99
+ for (const ref of dataTypeDescriptions) {
100
+ ref.browseName.toString();
101
+ nodesToBrowse3.push({
102
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Inverse,
103
+ includeSubtypes: false,
104
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Object"),
105
+ nodeId: ref.nodeId.toString(),
106
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasDescription"),
107
+ // resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
108
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("NodeId")
109
+ });
110
+ }
111
+ /* istanbul ignore next */
112
+ if (nodesToBrowse3.length === 0) {
113
+ return [];
114
+ }
115
+ const results3 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodesToBrowse3);
116
+ const binaryEncodings = [];
117
+ const nodesToBrowseDataType = [];
118
+ let i = 0;
119
+ for (const result3 of results3) {
120
+ const dataTypeDescription = dataTypeDescriptions[i++];
121
+ result3.references = result3.references || [];
122
+ (0, node_opcua_assert_1.assert)(result3.references.length === 1);
123
+ for (const ref of result3.references) {
124
+ const binaryEncodingNodeId = ref.nodeId;
125
+ dataTypeDescription.encodings = dataTypeDescription.encodings || {
126
+ binaryEncodingNodeId: node_opcua_nodeid_1.NodeId.nullNodeId,
127
+ dataTypeNodeId: node_opcua_nodeid_1.NodeId.nullNodeId,
128
+ jsonEncodingNodeId: node_opcua_nodeid_1.NodeId.nullNodeId,
129
+ xmlEncodingNodeId: node_opcua_nodeid_1.NodeId.nullNodeId
130
+ };
131
+ dataTypeDescription.encodings.binaryEncodingNodeId = binaryEncodingNodeId;
132
+ binaryEncodings.push(binaryEncodingNodeId);
133
+ nodesToBrowseDataType.push({
134
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Inverse,
135
+ includeSubtypes: false,
136
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("DataType"),
137
+ nodeId: ref.nodeId.toString(),
138
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasEncoding"),
139
+ // resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
140
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("NodeId | BrowseName")
141
+ });
142
+ }
143
+ }
144
+ const dataTypeNodeIds = [];
145
+ if (nodesToBrowseDataType.length > 0) {
146
+ const results4 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodesToBrowseDataType);
147
+ i = 0;
148
+ for (const result4 of results4) {
149
+ result4.references = result4.references || [];
150
+ /* istanbul ignore next */
151
+ if (result4.references.length !== 1) {
152
+ console.log("What's going on ?", result4.toString());
153
+ }
154
+ for (const ref of result4.references) {
155
+ const dataTypeNodeId = ref.nodeId;
156
+ dataTypeNodeIds.push(dataTypeNodeId);
157
+ const dataTypeDescription = dataTypeDescriptions[i++];
158
+ dataTypeDescription.encodings.dataTypeNodeId = dataTypeNodeId;
159
+ }
160
+ }
161
+ }
162
+ return dataTypeNodeIds;
163
+ });
164
+ }
165
+ function sortStructure(dataTypeDefinitions) {
166
+ const dataTypeDefinitionsSorted = [];
167
+ const _visited = {};
168
+ const _map = {};
169
+ for (const d of dataTypeDefinitions) {
170
+ _map[d.dataTypeNodeId.toString()] = d;
171
+ }
172
+ function _visit(d) {
173
+ const hash = d.dataTypeNodeId.toString();
174
+ if (_visited[hash]) {
175
+ return;
176
+ }
177
+ const bbb = _map[d.dataTypeDefinition.baseDataType.toString()];
178
+ if (bbb) {
179
+ _visit(bbb);
180
+ }
181
+ for (const f of d.dataTypeDefinition.fields || []) {
182
+ const ddd = _map[f.dataType.toString()];
183
+ if (!ddd) {
184
+ continue;
185
+ }
186
+ _visit(ddd);
187
+ }
188
+ _visited[hash] = d;
189
+ dataTypeDefinitionsSorted.push(d);
190
+ }
191
+ for (const d of dataTypeDefinitions) {
192
+ _visit(d);
193
+ }
194
+ return dataTypeDefinitionsSorted;
195
+ }
196
+ function _extractDataTypeDictionaryFromDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory) {
197
+ return __awaiter(this, void 0, void 0, function* () {
198
+ (0, node_opcua_assert_1.assert)(dataTypeFactory, "expecting a dataTypeFactory");
199
+ const dataTypeDescriptions = yield _getDataTypeDescriptions(session, dataTypeDictionaryNodeId);
200
+ const dataTypeNodeIds = yield _enrichWithDescriptionOf(session, dataTypeDescriptions);
201
+ // now read DataTypeDefinition attributes of all the dataTypeNodeIds, this will only contains concrete structure
202
+ const nodesToRead = dataTypeNodeIds.map((nodeId) => ({
203
+ attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition,
204
+ nodeId
205
+ }));
206
+ const cache = {};
207
+ const dataValuesWithDataTypeDefinition = nodesToRead.length > 0 ? yield session.read(nodesToRead) : [];
208
+ // in some circumstances like Euromap, this assert fails:
209
+ // assert(dataValuesWithDataTypeDefinition.length === dataTypeDescriptions.length);
210
+ const dataTypeDefinitions = [];
211
+ let index = 0;
212
+ for (const dataValue of dataValuesWithDataTypeDefinition) {
213
+ const dataTypeNodeId = dataTypeNodeIds[index];
214
+ const dataTypeDescription = dataTypeDescriptions[index];
215
+ /* istanbul ignore else */
216
+ if (dataValue.statusCode === node_opcua_status_code_1.StatusCodes.Good) {
217
+ const dataTypeDefinition = dataValue.value.value;
218
+ if (dataTypeDefinition && dataTypeDefinition instanceof node_opcua_types_1.StructureDefinition) {
219
+ const className = dataTypeDescription.browseName.name;
220
+ dataTypeDefinitions.push({ className, dataTypeNodeId, dataTypeDefinition });
221
+ }
222
+ }
223
+ else {
224
+ debugLog("dataTypeNodeId ", dataTypeNodeId.toString(), " has no DataTypeDescription attribute", dataValue.statusCode.toString());
225
+ }
226
+ index++;
227
+ }
228
+ // to do put in logical order
229
+ const dataTypeDefinitionsSorted = sortStructure(dataTypeDefinitions);
230
+ if (doDebug) {
231
+ debugLog("order ", dataTypeDefinitionsSorted.map((a) => a.className + " " + a.dataTypeNodeId).join(" -> "));
232
+ }
233
+ for (const { className, dataTypeNodeId, dataTypeDefinition } of dataTypeDefinitionsSorted) {
234
+ // istanbul ignore next
235
+ if (doDebug) {
236
+ debugLog(chalk.yellow("--------------------------------------- "), className, dataTypeNodeId.toString());
237
+ }
238
+ if (dataTypeFactory.hasStructuredType(className)) {
239
+ continue; // this structure has already been seen
240
+ }
241
+ // now fill typeDictionary
242
+ try {
243
+ const schema = yield (0, convert_data_type_definition_to_structuretype_schema_1.convertDataTypeDefinitionToStructureTypeSchema)(session, dataTypeNodeId, className, dataTypeDefinition, dataTypeFactory, cache);
244
+ // istanbul ignore next
245
+ if (doDebug) {
246
+ debugLog(chalk.red("Registering "), chalk.cyan(className.padEnd(30, " ")), schema.dataTypeNodeId.toString());
247
+ }
248
+ const Constructor = (0, node_opcua_schemas_1.createDynamicObjectConstructor)(schema, dataTypeFactory);
249
+ (0, node_opcua_assert_1.assert)(Constructor.schema === schema);
250
+ }
251
+ catch (err) {
252
+ console.log("Constructor verification err: ", err.message);
253
+ console.log("For this reason class " + className + " has not been registered");
254
+ console.log(err);
255
+ }
256
+ }
257
+ });
258
+ }
259
+ function _extractNodeIds(session, dataTypeDictionaryNodeId) {
260
+ return __awaiter(this, void 0, void 0, function* () {
261
+ const map = {};
262
+ const dataTypeDescriptions = yield _getDataTypeDescriptions(session, dataTypeDictionaryNodeId);
263
+ /* const dataTypeNodeIds = */
264
+ yield _enrichWithDescriptionOf(session, dataTypeDescriptions);
265
+ for (const dataTypeDescription of dataTypeDescriptions) {
266
+ map[dataTypeDescription.browseName.name.toString()] = dataTypeDescription.encodings;
267
+ }
268
+ return {
269
+ getDataTypeAndEncodingId(key) {
270
+ return map[key] || null;
271
+ }
272
+ };
273
+ });
274
+ }
275
+ function _extractDataTypeDictionary(session, d, dataTypeManager) {
276
+ return __awaiter(this, void 0, void 0, function* () {
277
+ const dataTypeDictionaryNodeId = d.reference.nodeId;
278
+ const isDictionaryDeprecated = d.isDictionaryDeprecated; // await _readDeprecatedFlag(session, dataTypeDictionaryNodeId);
279
+ const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value });
280
+ const name = yield session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName });
281
+ const namespace = yield _readNamespaceUriProperty(session, dataTypeDictionaryNodeId);
282
+ if (isDictionaryDeprecated || rawSchema.length === 0) {
283
+ debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
284
+ debugLog("let's use the new way (1.04) and let's crawl all dataTypes exposed by this name space");
285
+ // dataType definition in store directly in UADataType under the $definition property
286
+ const dataTypeFactory2 = dataTypeManager.getDataTypeFactory(dataTypeDictionaryNodeId.namespace);
287
+ if (!dataTypeFactory2) {
288
+ throw new Error("cannot find dataTypeFactory for namespace " + dataTypeDictionaryNodeId.namespace);
289
+ }
290
+ yield _extractDataTypeDictionaryFromDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory2);
291
+ return;
292
+ }
293
+ else {
294
+ debugLog(" ----- Using old method for extracting schema => with BSD files");
295
+ // old method ( until 1.03 )
296
+ // one need to read the schema file store in the dataTypeDictionary node and parse it !
297
+ /* istanbul ignore next */
298
+ if (doDebug) {
299
+ debugLog("---------------------------------------------");
300
+ debugLog(rawSchema.toString());
301
+ debugLog("---------------------------------------------");
302
+ }
303
+ const idProvider = yield _extractNodeIds(session, dataTypeDictionaryNodeId);
304
+ const dataTypeFactory1 = dataTypeManager.getDataTypeFactory(dataTypeDictionaryNodeId.namespace);
305
+ yield (0, node_opcua_schemas_1.parseBinaryXSDAsync)(rawSchema, idProvider, dataTypeFactory1);
306
+ }
307
+ });
308
+ }
309
+ function _exploreDataTypeDefinition(session, dataTypeDictionaryTypeNode, dataTypeFactory, namespaces) {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ const nodeToBrowse = {
312
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Forward,
313
+ includeSubtypes: false,
314
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Variable"),
315
+ nodeId: dataTypeDictionaryTypeNode,
316
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasComponent"),
317
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
318
+ };
319
+ const result = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodeToBrowse);
320
+ const references = result.references || [];
321
+ /* istanbul ignore next */
322
+ if (references.length === 0) {
323
+ return;
324
+ }
325
+ // request the Definition of each nodes
326
+ const nodesToBrowse2 = references.map((ref) => {
327
+ return {
328
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Inverse,
329
+ includeSubtypes: false,
330
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Object | Variable"),
331
+ nodeId: ref.nodeId,
332
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasDescription"),
333
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
334
+ };
335
+ });
336
+ const results2 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodesToBrowse2);
337
+ const binaryEncodingNodeIds = results2.map((br) => {
338
+ const defaultBin = br.references.filter((r) => r.browseName.toString() === "Default Binary");
339
+ /* istanbul ignore next */
340
+ if (defaultBin.length < 1) {
341
+ return node_opcua_nodeid_1.ExpandedNodeId;
342
+ }
343
+ return node_opcua_nodeid_1.ExpandedNodeId.fromNodeId(defaultBin[0].nodeId, namespaces[defaultBin[0].nodeId.namespace]);
344
+ });
345
+ // follow now Default Binary <= [Has Encoding] = [DataType]
346
+ /* istanbul ignore next */
347
+ if (doDebug) {
348
+ console.log(chalk.bgWhite.red("testing new constructors"));
349
+ for (let i = 0; i < references.length; i++) {
350
+ const ref = references[i];
351
+ const binaryEncoding = binaryEncodingNodeIds[i];
352
+ const name = ref.browseName.name.toString();
353
+ if (doDebug) {
354
+ debugLog(" type ", name.padEnd(30, " "), binaryEncoding.toString());
355
+ }
356
+ // let's verify that constructor is operational
357
+ try {
358
+ const constructor = dataTypeFactory.getStructureTypeConstructor(name);
359
+ // xx const constructor = getOrCreateConstructor(name, dataTypeFactory, defaultBinary);
360
+ const testObject = new constructor();
361
+ debugLog(testObject.toString());
362
+ }
363
+ catch (err) {
364
+ debugLog(" Error cannot construct Extension Object " + name);
365
+ debugLog(" " + err.message);
366
+ }
367
+ }
368
+ }
369
+ });
370
+ }
371
+ const regexTargetNamespaceAttribute = /TargetNamespace="([^\"]+)"|TargetNamespace='([^\"]+)'/;
372
+ function extractTargetNamespaceAttribute(xmlElement) {
373
+ // warning TargetNamespace could have ' or " , Wago PLC for instance uses simple quotes
374
+ const c2 = xmlElement.match(regexTargetNamespaceAttribute);
375
+ if (c2) {
376
+ return c2[1] || c2[2];
377
+ }
378
+ return "";
379
+ }
380
+ const regexNamespaceRef = /xmlns:(.*)=(("([^"]+)")|('([^']+)'))/;
381
+ function extraNamespaceRef(attribute) {
382
+ const c = attribute.match(regexNamespaceRef);
383
+ if (c) {
384
+ const xmlns = c[1];
385
+ const namespace = c[3] || c[4];
386
+ return { xmlns, namespace };
387
+ }
388
+ return null;
389
+ }
390
+ /**
391
+ * Extract all custom dataType
392
+ * @param session
393
+ * @param dataTypeManager
394
+ * @async
395
+ */
396
+ function populateDataTypeManager103(session, dataTypeManager) {
397
+ var _a;
398
+ return __awaiter(this, void 0, void 0, function* () {
399
+ debugLog("in ... populateDataTypeManager");
400
+ // read namespace array
401
+ const dataValueNamespaceArray = yield session.read({
402
+ attributeId: node_opcua_data_model_1.AttributeIds.Value,
403
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server_NamespaceArray")
404
+ });
405
+ const namespaceArray = dataValueNamespaceArray.value.value;
406
+ // istanbul ignore next
407
+ if (!namespaceArray) {
408
+ debugLog("session: cannot read Server_NamespaceArray");
409
+ // throw new Error("Cannot get Server_NamespaceArray as a array of string");
410
+ return;
411
+ }
412
+ // istanbul ignore next
413
+ if (doDebug) {
414
+ debugLog("namespaceArray ", namespaceArray.map((a, index) => " " + index.toString().padEnd(3) + ":" + a).join(" "));
415
+ }
416
+ if (dataValueNamespaceArray.statusCode === node_opcua_status_code_1.StatusCodes.Good && namespaceArray && namespaceArray.length > 0) {
417
+ dataTypeManager.setNamespaceArray(namespaceArray);
418
+ for (let namespaceIndex = 1; namespaceIndex < namespaceArray.length; namespaceIndex++) {
419
+ if (!dataTypeManager.hasDataTypeFactory(namespaceIndex)) {
420
+ const dataTypeFactory1 = new node_opcua_factory_1.DataTypeFactory([(0, node_opcua_factory_1.getStandardDataTypeFactory)()]);
421
+ dataTypeManager.registerDataTypeFactory(namespaceIndex, dataTypeFactory1);
422
+ }
423
+ }
424
+ }
425
+ /// to do :: may be not useful
426
+ if (!dataValueNamespaceArray.value.value && dataTypeManager.namespaceArray.length === 0) {
427
+ dataTypeManager.setNamespaceArray([]);
428
+ }
429
+ const dataTypeDictionaryType = (0, node_opcua_nodeid_1.resolveNodeId)("DataTypeDictionaryType");
430
+ // DataType/OPCBinary => i=93 [OPCBinarySchema_TypeSystem]
431
+ // "OPC Binary"[DataSystemType]
432
+ const opcBinaryNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("OPCBinarySchema_TypeSystem");
433
+ // let find all DataType dictionary node corresponding to a given namespace
434
+ // (have DataTypeDictionaryType)
435
+ const nodeToBrowse = {
436
+ browseDirection: node_opcua_service_browse_1.BrowseDirection.Forward,
437
+ includeSubtypes: false,
438
+ nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("Variable"),
439
+ nodeId: opcBinaryNodeId,
440
+ referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasComponent"),
441
+ resultMask: (0, node_opcua_data_model_1.makeResultMask)("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
442
+ };
443
+ const result = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodeToBrowse);
444
+ if (doDebug) {
445
+ debugLog(result.statusCode.toString());
446
+ debugLog((_a = result.references) === null || _a === void 0 ? void 0 : _a.map((r) => { var _a; return (_a = r.browseName) === null || _a === void 0 ? void 0 : _a.toString(); }).join(" "));
447
+ }
448
+ // filter nodes that have the expected namespace Index
449
+ // ( more specifically we want to filter out DataStructure from namespace 0)
450
+ // we also want to keep only object of type DataTypeDictionaryType
451
+ const references = result.references.filter((e) => e.nodeId.namespace !== 0 && (0, node_opcua_nodeid_1.sameNodeId)(e.typeDefinition, dataTypeDictionaryType));
452
+ debugLog(`found ${references.length} dictionary`);
453
+ function putInCorrectOrder() {
454
+ return __awaiter(this, void 0, void 0, function* () {
455
+ const infos = [];
456
+ const innerMap = {};
457
+ for (const reference of references) {
458
+ const dataTypeDictionaryNodeId = reference.nodeId;
459
+ const isDictionaryDeprecated = yield _readDeprecatedFlag(session, dataTypeDictionaryNodeId);
460
+ const rawSchemaDataValue = yield session.read({
461
+ attributeId: node_opcua_data_model_1.AttributeIds.Value,
462
+ nodeId: dataTypeDictionaryNodeId
463
+ });
464
+ const rawSchema = rawSchemaDataValue.value.value ? rawSchemaDataValue.value.value.toString() : "";
465
+ const info = {
466
+ dataTypeDictionaryNodeId,
467
+ dependencies: {},
468
+ isDictionaryDeprecated,
469
+ rawSchema,
470
+ reference,
471
+ targetNamespace: ""
472
+ };
473
+ infos.push(info);
474
+ if (!isDictionaryDeprecated && rawSchema.length > 0) {
475
+ if (doDebug) {
476
+ console.log("schema", rawSchema);
477
+ }
478
+ const matches = rawSchema.match(/<opc:TypeDictionary([^\>]+)>/);
479
+ if (matches) {
480
+ // extract xml:NS="namespace" from attribute list
481
+ // for instance:
482
+ // <opc:TypeDictionary
483
+ // xmlns:opc="http://opcfoundation.org/BinarySchema/"
484
+ // xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
485
+ // xmlns:ua="http://opcfoundation.org/UA/"
486
+ // xmlns:tns="urn:SomeName:Ua:Types:GlobalTypes"
487
+ // DefaultByteOrder="LittleEndian"
488
+ // TargetNamespace="urn:SomeName:Ua:Types:GlobalTypes">
489
+ const typeDictionaryElementAttributes = matches[1];
490
+ info.targetNamespace = extractTargetNamespaceAttribute(typeDictionaryElementAttributes);
491
+ const nsKeyNamespace = {};
492
+ for (const attribute of typeDictionaryElementAttributes.split(" ")) {
493
+ const r = extraNamespaceRef(attribute);
494
+ if (r) {
495
+ const { xmlns, namespace } = r;
496
+ nsKeyNamespace[xmlns] = namespace;
497
+ debugLog("xxxx ns= ", xmlns, "=>", namespace);
498
+ }
499
+ }
500
+ info.dependencies = nsKeyNamespace;
501
+ debugLog("xxx targetNamespace = ", info.targetNamespace);
502
+ innerMap[info.targetNamespace] = info;
503
+ }
504
+ }
505
+ else {
506
+ // may be 1.04 => the rawSchema is no more needed in new version
507
+ info.targetNamespace = namespaceArray[dataTypeDictionaryNodeId.namespace];
508
+ debugLog("xxx targetNamespace = ", info.targetNamespace);
509
+ innerMap[info.targetNamespace] = info;
510
+ }
511
+ // assert(info.targetNamespace.length !== 0);
512
+ }
513
+ // ----------------------------------
514
+ const orderedList = [];
515
+ const visited = {};
516
+ function explore(d) {
517
+ if (visited[d.targetNamespace]) {
518
+ return;
519
+ }
520
+ visited[d.targetNamespace] = 1;
521
+ for (const [xmlns, namespace] of Object.entries(d.dependencies)) {
522
+ if (!innerMap[namespace] || namespace === d.targetNamespace) {
523
+ continue;
524
+ }
525
+ explore(innerMap[namespace]);
526
+ }
527
+ orderedList.push(d);
528
+ }
529
+ for (const d of infos) {
530
+ explore(d);
531
+ }
532
+ debugLog(" Ordered List = ", orderedList.map((a) => a.targetNamespace).join(" "));
533
+ return orderedList;
534
+ });
535
+ }
536
+ const dataTypeDictionaryInfo = yield putInCorrectOrder();
537
+ // setup dependencies
538
+ const map = {};
539
+ for (const d of dataTypeDictionaryInfo) {
540
+ map[d.targetNamespace] = d;
541
+ debugLog(" fixing based dataTypeFactory dependencies for ", d.targetNamespace, "index = ", d.dataTypeDictionaryNodeId.namespace);
542
+ const baseDataFactories = [(0, node_opcua_factory_1.getStandardDataTypeFactory)()];
543
+ for (const namespace of Object.values(d.dependencies)) {
544
+ if (namespace === d.targetNamespace) {
545
+ continue;
546
+ }
547
+ const baseDataFactory = map[namespace];
548
+ if (!baseDataFactory) {
549
+ // xx console.log("xxxxx baseDataFactory = ", namespace);
550
+ continue;
551
+ }
552
+ const namespaceIndex = baseDataFactory.dataTypeDictionaryNodeId.namespace;
553
+ if (dataTypeManager.hasDataTypeFactory(namespaceIndex)) {
554
+ const dep = dataTypeManager.getDataTypeFactory(namespaceIndex);
555
+ baseDataFactories.push(dep);
556
+ debugLog(" considering , ", baseDataFactory.targetNamespace, "index = ", baseDataFactory.dataTypeDictionaryNodeId.namespace);
557
+ }
558
+ }
559
+ const dataTypeFactory = dataTypeManager.getDataTypeFactory(d.dataTypeDictionaryNodeId.namespace);
560
+ if (dataTypeFactory) {
561
+ dataTypeFactory.repairBaseDataFactories(baseDataFactories);
562
+ }
563
+ }
564
+ // --------------------
565
+ // now investigate DataTypeDescriptionType
566
+ function processReferenceOnDataTypeDictionaryType(d) {
567
+ return __awaiter(this, void 0, void 0, function* () {
568
+ debugLog(chalk.cyan("processReferenceOnDataTypeDictionaryType on "), d.targetNamespace);
569
+ const ref = d.reference;
570
+ const dataTypeDictionaryNodeId = d.reference.nodeId;
571
+ yield _extractDataTypeDictionary(session, d, dataTypeManager);
572
+ /* istanbul ignore next */
573
+ if (doDebug) {
574
+ debugLog(chalk.bgWhite(" => "), ref.browseName.toString(), ref.nodeId.toString());
575
+ }
576
+ const dataTypeFactory = dataTypeManager.getDataTypeFactoryForNamespace(dataTypeDictionaryNodeId.namespace);
577
+ yield _exploreDataTypeDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory, dataTypeManager.namespaceArray);
578
+ });
579
+ }
580
+ // https://medium.com/swlh/dealing-with-multiple-promises-in-javascript-41d6c21f20ff
581
+ for (const d of dataTypeDictionaryInfo) {
582
+ try {
583
+ yield processReferenceOnDataTypeDictionaryType(d).catch((e) => {
584
+ console.log(e);
585
+ debugLog("processReferenceOnDataTypeDictionaryType has failed ");
586
+ debugLog("Error", e.message);
587
+ debugLog(e);
588
+ return e;
589
+ });
590
+ }
591
+ catch (err) {
592
+ debugLog(chalk.red("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "), err);
593
+ }
594
+ }
595
+ debugLog("out ... populateDataTypeManager");
596
+ });
597
+ }
598
+ exports.populateDataTypeManager103 = populateDataTypeManager103;
599
+ //# sourceMappingURL=populate_data_type_manager_103.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"populate_data_type_manager_103.js","sourceRoot":"","sources":["../../source/private/populate_data_type_manager_103.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA6B;AAC7B;;GAEG;AACH,+BAA+B;AAC/B,4CAA4C;AAC5C,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAC;AAE7B,yDAA2C;AAC3C,iEAAuG;AACvG,uDAAgF;AAChF,2DAA4G;AAC5G,yDAAsF;AACtF,yEAA4F;AAC5F,2DAK4B;AAC5B,yEAA0H;AAC1H,uGAA0E;AAC1E,mEAAqD;AACrD,uDAA2E;AAG3E,kIAGiE;AAEjE,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAE3C,WAAW;AACX,SAAS;AACT,SAAS;AACT,iEAAiE;AACjE,8BAA8B;AAC9B,4FAA4F;AAC5F,uDAAuD;AACvD,oFAAoF;AACpF,4EAA4E;AAC5E,8HAA8H;AAC9H,EAAE;AACF,6EAA6E;AAC7E,sEAAsE;AACtE,kGAAkG;AAClG,gCAAgC;AAChC,yFAAyF;AACzF,iFAAiF;AACjF,EAAE;AAEF,SAAe,mBAAmB,CAAC,OAAsB,EAAE,kBAA0B;;QACjF,MAAM,UAAU,GAAG,IAAA,yDAAc,EAAC,kBAAkB,EAAE,aAAa,CAAC,CA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G,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;gBAEpD,MAAM,0BAA0B,CAAC,OAAO,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;gBAC9D,0BAA0B;gBAC1B,IAAI,OAAO,EAAE;oBACT,QAAQ,CACJ,KAAK,CAAC,OAAO,CAAC,8CAA8C,CAAC,EAC7D,GAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,EACzB,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CACxB,CAAC;iBACL;gBACD,MAAM,eAAe,GAAG,eAAe,CAAC,8BAA8B,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;gBAC3G,MAAM,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;YACzH,CAAC;SAAA;QAED,oFAAoF;QACpF,KAAK,MAAM,CAAC,IAAI,sBAAsB,EAAE;YACpC,IAAI;gBACA,MAAM,wCAAwC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;oBAC1D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACf,QAAQ,CAAC,sDAAsD,CAAC,CAAC;oBACjE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;oBAC7B,QAAQ,CAAC,CAAC,CAAC,CAAC;oBACZ,OAAO,CAAC,CAAC;gBACb,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC,EAAE,GAAG,CAAC,CAAC;aAChE;SACJ;QACD,QAAQ,CAAC,iCAAiC,CAAC,CAAC;;CAC/C;AA9OD,gEA8OC"}
@@ -0,0 +1,9 @@
1
+ import { DataTypeFactory } from "node-opcua-factory";
2
+ import { NodeId } from "node-opcua-nodeid";
3
+ import { IBasicSession } from "node-opcua-pseudo-session";
4
+ import { ExtraDataTypeManager } from "../extra_data_type_manager";
5
+ import { CacheForFieldResolution } from "../convert_data_type_definition_to_structuretype_schema";
6
+ export declare function readDataTypeDefinitionAndBuildType(session: IBasicSession, dataTypeNodeId: NodeId, name: string, dataTypeFactory: DataTypeFactory, cache: {
7
+ [key: string]: CacheForFieldResolution;
8
+ }): Promise<void>;
9
+ export declare function populateDataTypeManager104(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>;