node-opcua-client-dynamic-extension-object 2.183.0 → 2.184.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/convert_data_type_definition_to_structuretype_schema.d.ts +1 -0
- package/dist/convert_data_type_definition_to_structuretype_schema.d.ts.map +1 -0
- package/dist/convert_data_type_definition_to_structuretype_schema.js +82 -85
- package/dist/convert_data_type_definition_to_structuretype_schema.js.map +1 -1
- package/dist/convert_structuretype_schema_to_structure_definition.d.ts +1 -0
- package/dist/convert_structuretype_schema_to_structure_definition.d.ts.map +1 -0
- package/dist/convert_structuretype_schema_to_structure_definition.js +13 -16
- package/dist/convert_structuretype_schema_to_structure_definition.js.map +1 -1
- package/dist/extra_data_type_manager.d.ts +16 -0
- package/dist/extra_data_type_manager.d.ts.map +1 -0
- package/dist/extra_data_type_manager.js +56 -21
- package/dist/extra_data_type_manager.js.map +1 -1
- package/dist/get_extension_object_constructor.d.ts +1 -0
- package/dist/get_extension_object_constructor.d.ts.map +1 -0
- package/dist/get_extension_object_constructor.js +7 -10
- package/dist/get_extension_object_constructor.js.map +1 -1
- package/dist/get_extra_data_type_manager.d.ts +1 -0
- package/dist/get_extra_data_type_manager.d.ts.map +1 -0
- package/dist/get_extra_data_type_manager.js +21 -27
- package/dist/get_extra_data_type_manager.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -25
- package/dist/index.js.map +1 -1
- package/dist/populate_data_type_manager.d.ts +1 -0
- package/dist/populate_data_type_manager.d.ts.map +1 -0
- package/dist/populate_data_type_manager.js +44 -49
- package/dist/populate_data_type_manager.js.map +1 -1
- package/dist/private/find_encodings.d.ts +1 -0
- package/dist/private/find_encodings.d.ts.map +1 -0
- package/dist/private/find_encodings.js +12 -15
- package/dist/private/find_encodings.js.map +1 -1
- package/dist/private/populate_data_type_manager_103.d.ts +1 -0
- package/dist/private/populate_data_type_manager_103.d.ts.map +1 -0
- package/dist/private/populate_data_type_manager_103.js +88 -94
- package/dist/private/populate_data_type_manager_103.js.map +1 -1
- package/dist/private/populate_data_type_manager_104.d.ts +1 -0
- package/dist/private/populate_data_type_manager_104.d.ts.map +1 -0
- package/dist/private/populate_data_type_manager_104.js +35 -39
- package/dist/private/populate_data_type_manager_104.js.map +1 -1
- package/dist/promote_opaque_structure.d.ts +1 -0
- package/dist/promote_opaque_structure.d.ts.map +1 -0
- package/dist/promote_opaque_structure.js +12 -16
- package/dist/promote_opaque_structure.js.map +1 -1
- package/dist/promote_opaque_structure_in_notification_data.d.ts +1 -0
- package/dist/promote_opaque_structure_in_notification_data.d.ts.map +1 -0
- package/dist/promote_opaque_structure_in_notification_data.js +9 -12
- package/dist/promote_opaque_structure_in_notification_data.js.map +1 -1
- package/dist/resolve_dynamic_extension_object.d.ts +1 -0
- package/dist/resolve_dynamic_extension_object.d.ts.map +1 -0
- package/dist/resolve_dynamic_extension_object.js +16 -20
- package/dist/resolve_dynamic_extension_object.js.map +1 -1
- package/package.json +19 -18
- package/source/extra_data_type_manager.ts +49 -4
- package/source/get_extra_data_type_manager.ts +3 -3
- package/source/private/populate_data_type_manager_103.ts +1 -1
- package/source/private/populate_data_type_manager_104.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate_data_type_manager.js","sourceRoot":"","sources":["../source/populate_data_type_manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"populate_data_type_manager.js","sourceRoot":"","sources":["../source/populate_data_type_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,eAAe,EAA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;QAC5C,MAAM,0BAA0B,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC3D,MAAM,0BAA0B,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC3D,OAAO;IACX,CAAC;IACD,IAAI,QAAQ,KAAK,uBAAuB,CAAC,QAAQ,IAAI,QAAQ,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;QAC7F,OAAO,IAAI,QAAQ,CAAC,+DAA+D,CAAC,CAAC;QACrF,MAAM,0BAA0B,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,QAAQ,KAAK,uBAAuB,CAAC,QAAQ,IAAI,QAAQ,KAAK,uBAAuB,CAAC,IAAI,EAAE,CAAC;QAC7F,OAAO,IAAI,QAAQ,CAAC,+DAA+D,CAAC,CAAC;QACrF,MAAM,0BAA0B,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;AACL,CAAC"}
|
|
@@ -2,3 +2,4 @@ import { NodeId } from "node-opcua-nodeid";
|
|
|
2
2
|
import { type ISessionForBrowseAll } from "node-opcua-pseudo-session";
|
|
3
3
|
import type { DataTypeAndEncodingId } from "node-opcua-schemas";
|
|
4
4
|
export declare function _findEncodings(session: ISessionForBrowseAll, dataTypeNodeId: NodeId): Promise<DataTypeAndEncodingId>;
|
|
5
|
+
//# sourceMappingURL=find_encodings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find_encodings.d.ts","sourceRoot":"","sources":["../../source/private/find_encodings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAiB,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC7G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,wBAAsB,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwC1H"}
|
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
6
|
-
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
7
|
-
async function _findEncodings(session, dataTypeNodeId) {
|
|
1
|
+
import { BrowseDirection, makeNodeClassMask, makeResultMask } from "node-opcua-data-model";
|
|
2
|
+
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
3
|
+
import { browseAll } from "node-opcua-pseudo-session";
|
|
4
|
+
export async function _findEncodings(session, dataTypeNodeId) {
|
|
8
5
|
const nodeToBrowse = {
|
|
9
|
-
browseDirection:
|
|
6
|
+
browseDirection: BrowseDirection.Forward,
|
|
10
7
|
includeSubtypes: true,
|
|
11
8
|
// strictly speaking HasEncoding points to an Object of DataTypeEncodingType, but
|
|
12
9
|
// in some buggy server implementations ObjectType is used instead. (see #1232)
|
|
13
|
-
nodeClassMask:
|
|
10
|
+
nodeClassMask: makeNodeClassMask("Object | ObjectType"),
|
|
14
11
|
nodeId: dataTypeNodeId,
|
|
15
|
-
referenceTypeId:
|
|
16
|
-
resultMask:
|
|
12
|
+
referenceTypeId: resolveNodeId("HasEncoding"),
|
|
13
|
+
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
|
|
17
14
|
};
|
|
18
|
-
const result = await
|
|
15
|
+
const result = await browseAll(session, nodeToBrowse);
|
|
19
16
|
const references = result.references || [];
|
|
20
17
|
if (references.length === 0) {
|
|
21
18
|
// xx throw new Error("Cannot find encodings on type " + dataTypeNodeId.toString() + " statusCode " + result.statusCode.toString());
|
|
22
19
|
}
|
|
23
20
|
const encodings = {
|
|
24
21
|
dataTypeNodeId,
|
|
25
|
-
binaryEncodingNodeId: new
|
|
26
|
-
jsonEncodingNodeId: new
|
|
27
|
-
xmlEncodingNodeId: new
|
|
22
|
+
binaryEncodingNodeId: new NodeId(),
|
|
23
|
+
jsonEncodingNodeId: new NodeId(),
|
|
24
|
+
xmlEncodingNodeId: new NodeId()
|
|
28
25
|
};
|
|
29
26
|
for (const ref of references) {
|
|
30
27
|
switch (ref.browseName.name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_encodings.js","sourceRoot":"","sources":["../../source/private/find_encodings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find_encodings.js","sourceRoot":"","sources":["../../source/private/find_encodings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAA8B,SAAS,EAA6B,MAAM,2BAA2B,CAAC;AAG7G,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA6B,EAAE,cAAsB;IACtF,MAAM,YAAY,GAA0B;QACxC,eAAe,EAAE,eAAe,CAAC,OAAO;QACxC,eAAe,EAAE,IAAI;QACrB,iFAAiF;QACjF,gFAAgF;QAChF,aAAa,EAAE,iBAAiB,CAAC,qBAAqB,CAAC;QACvD,MAAM,EAAE,cAAc;QACtB,eAAe,EAAE,aAAa,CAAC,aAAa,CAAC;QAC7C,UAAU,EAAE,cAAc,CAAC,qEAAqE,CAAC;KACpG,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,oIAAoI;IACxI,CAAC;IACD,MAAM,SAAS,GAA0B;QACrC,cAAc;QAEd,oBAAoB,EAAE,IAAI,MAAM,EAAE;QAClC,kBAAkB,EAAE,IAAI,MAAM,EAAE;QAChC,iBAAiB,EAAE,IAAI,MAAM,EAAE;KAClC,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC3B,QAAQ,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YAC1B,KAAK,gBAAgB;gBACjB,SAAS,CAAC,oBAAoB,GAAG,GAAG,CAAC,MAAM,CAAC;gBAC5C,MAAM;YACV,KAAK,aAAa;gBACd,SAAS,CAAC,iBAAiB,GAAG,GAAG,CAAC,MAAM,CAAC;gBACzC,MAAM;YACV,KAAK,cAAc;gBACf,SAAS,CAAC,kBAAkB,GAAG,GAAG,CAAC,MAAM,CAAC;gBAC1C,MAAM;YACV;gBACI,gEAAgE;gBAChE,MAAM;QACd,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -16,3 +16,4 @@ export interface IDataTypeDescription {
|
|
|
16
16
|
* @param dataTypeManager
|
|
17
17
|
*/
|
|
18
18
|
export declare function populateDataTypeManager103(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=populate_data_type_manager_103.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"populate_data_type_manager_103.d.ts","sourceRoot":"","sources":["../../source/private/populate_data_type_manager_103.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3H,OAAO,EAAkB,MAAM,EAA6B,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAIH,KAAK,mBAAmB,EAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEH,KAAK,qBAAqB,EAG7B,MAAM,oBAAoB,CAAC;AAa5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAoD1E,MAAM,WAAW,oBAAoB;IACjC,UAAU,EAAE,aAAa,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAqiBD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC5C,OAAO,EAAE,mBAAmB,EAC5B,eAAe,EAAE,oBAAoB,GACtC,OAAO,CAAC,IAAI,CAAC,CA0Xf"}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.populateDataTypeManager103 = populateDataTypeManager103;
|
|
7
1
|
/**
|
|
8
2
|
* @module node-opcua-client-dynamic-extension-object
|
|
9
3
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const doDebug =
|
|
23
|
-
const debugLog =
|
|
24
|
-
const errorLog =
|
|
25
|
-
const warningLog =
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { assert } from "node-opcua-assert";
|
|
6
|
+
import { AttributeIds, makeNodeClassMask, makeResultMask, NodeClassMask } from "node-opcua-data-model";
|
|
7
|
+
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
8
|
+
import { DataTypeFactory, getStandardDataTypeFactory } from "node-opcua-factory";
|
|
9
|
+
import { ExpandedNodeId, NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid";
|
|
10
|
+
import { browseAll } from "node-opcua-pseudo-session";
|
|
11
|
+
import { createDynamicObjectConstructor, parseBinaryXSD } from "node-opcua-schemas";
|
|
12
|
+
import { BrowseDirection } from "node-opcua-service-browse";
|
|
13
|
+
import { makeBrowsePath } from "node-opcua-service-translate-browse-path";
|
|
14
|
+
import { StructureDefinition } from "node-opcua-types";
|
|
15
|
+
import { convertDataTypeDefinitionToStructureTypeSchema } from "../convert_data_type_definition_to_structuretype_schema.js";
|
|
16
|
+
const doDebug = checkDebugFlag("populate_data_type_manager_103");
|
|
17
|
+
const debugLog = make_debugLog("populate_data_type_manager_103");
|
|
18
|
+
const errorLog = make_errorLog("populate_data_type_manager_103");
|
|
19
|
+
const warningLog = make_warningLog("populate_data_type_manager_103");
|
|
26
20
|
// DataType
|
|
27
21
|
// | 1
|
|
28
22
|
// | n
|
|
@@ -42,58 +36,58 @@ const warningLog = (0, node_opcua_debug_1.make_warningLog)("populate_data_type_m
|
|
|
42
36
|
// keep the current method to access type definition from embedded xsd.
|
|
43
37
|
//
|
|
44
38
|
async function _readDeprecatedFlag(session, dataTypeDictionary) {
|
|
45
|
-
const browsePath =
|
|
39
|
+
const browsePath = makeBrowsePath(dataTypeDictionary, ".Deprecated");
|
|
46
40
|
const a = await session.translateBrowsePath(browsePath);
|
|
47
41
|
/* c8 ignore next */
|
|
48
42
|
if (!a.targets || a.targets.length === 0) {
|
|
49
43
|
// the server is probably version < 1.04.
|
|
50
|
-
|
|
44
|
+
/* c8 ignore next */
|
|
51
45
|
doDebug && debugLog(`Cannot find Deprecated property for dataTypeDictionary ${dataTypeDictionary.toString()}`);
|
|
52
46
|
return false;
|
|
53
47
|
}
|
|
54
48
|
const deprecatedFlagNodeId = a.targets[0].targetId;
|
|
55
|
-
const dataValue = await session.read({ nodeId: deprecatedFlagNodeId, attributeId:
|
|
49
|
+
const dataValue = await session.read({ nodeId: deprecatedFlagNodeId, attributeId: AttributeIds.Value });
|
|
56
50
|
return dataValue.value.value;
|
|
57
51
|
}
|
|
58
52
|
async function _readNamespaceUriProperty(session, dataTypeDictionary) {
|
|
59
|
-
const a = await session.translateBrowsePath(
|
|
53
|
+
const a = await session.translateBrowsePath(makeBrowsePath(dataTypeDictionary, ".NamespaceUri"));
|
|
60
54
|
/* c8 ignore next */
|
|
61
55
|
if (!a.targets || a.targets.length === 0) {
|
|
62
56
|
return "??dataTypeDictionary doesn't expose NamespaceUri property??";
|
|
63
57
|
}
|
|
64
58
|
const namespaceUriProp = a.targets[0].targetId;
|
|
65
|
-
const dataValue = await session.read({ nodeId: namespaceUriProp, attributeId:
|
|
59
|
+
const dataValue = await session.read({ nodeId: namespaceUriProp, attributeId: AttributeIds.Value });
|
|
66
60
|
return dataValue.value.value || "<not set>";
|
|
67
61
|
}
|
|
68
62
|
async function _getDataTypeDescriptions(session, dataTypeDictionaryNodeId) {
|
|
69
63
|
const nodeToBrowse2 = {
|
|
70
|
-
browseDirection:
|
|
64
|
+
browseDirection: BrowseDirection.Forward,
|
|
71
65
|
includeSubtypes: false,
|
|
72
|
-
nodeClassMask:
|
|
66
|
+
nodeClassMask: makeNodeClassMask("Variable"),
|
|
73
67
|
nodeId: dataTypeDictionaryNodeId,
|
|
74
|
-
referenceTypeId:
|
|
68
|
+
referenceTypeId: resolveNodeId("HasComponent"),
|
|
75
69
|
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
|
|
76
|
-
resultMask:
|
|
70
|
+
resultMask: makeResultMask("NodeId | BrowseName")
|
|
77
71
|
};
|
|
78
|
-
const result2 = await
|
|
72
|
+
const result2 = await browseAll(session, nodeToBrowse2);
|
|
79
73
|
result2.references = result2.references || [];
|
|
80
74
|
return result2.references.map((r) => ({ nodeId: r.nodeId, browseName: r.browseName }));
|
|
81
75
|
}
|
|
82
76
|
async function _enrichWithDescriptionOf(session, dataTypeDescriptions) {
|
|
83
77
|
const nodesToBrowse3 = dataTypeDescriptions.map((dataTypeDescription) => ({
|
|
84
|
-
browseDirection:
|
|
78
|
+
browseDirection: BrowseDirection.Inverse,
|
|
85
79
|
includeSubtypes: false,
|
|
86
|
-
nodeClassMask:
|
|
80
|
+
nodeClassMask: makeNodeClassMask("Object"),
|
|
87
81
|
nodeId: dataTypeDescription.nodeId.toString(),
|
|
88
|
-
referenceTypeId:
|
|
82
|
+
referenceTypeId: resolveNodeId("HasDescription"),
|
|
89
83
|
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
|
|
90
|
-
resultMask:
|
|
84
|
+
resultMask: makeResultMask("NodeId")
|
|
91
85
|
}));
|
|
92
86
|
/* c8 ignore next */
|
|
93
87
|
if (nodesToBrowse3.length === 0) {
|
|
94
88
|
return [];
|
|
95
89
|
}
|
|
96
|
-
const results3 = await
|
|
90
|
+
const results3 = await browseAll(session, nodesToBrowse3);
|
|
97
91
|
const binaryEncodings = [];
|
|
98
92
|
const nodesToBrowseDataType = [];
|
|
99
93
|
// parallel to nodesToBrowseDataType, so the pairing survives the skips below
|
|
@@ -114,28 +108,28 @@ async function _enrichWithDescriptionOf(session, dataTypeDescriptions) {
|
|
|
114
108
|
for (const ref of result3.references) {
|
|
115
109
|
const binaryEncodingNodeId = ref.nodeId;
|
|
116
110
|
dataTypeDescription.encodings = dataTypeDescription.encodings || {
|
|
117
|
-
binaryEncodingNodeId:
|
|
118
|
-
dataTypeNodeId:
|
|
119
|
-
jsonEncodingNodeId:
|
|
120
|
-
xmlEncodingNodeId:
|
|
111
|
+
binaryEncodingNodeId: NodeId.nullNodeId,
|
|
112
|
+
dataTypeNodeId: NodeId.nullNodeId,
|
|
113
|
+
jsonEncodingNodeId: NodeId.nullNodeId,
|
|
114
|
+
xmlEncodingNodeId: NodeId.nullNodeId
|
|
121
115
|
};
|
|
122
116
|
dataTypeDescription.encodings.binaryEncodingNodeId = binaryEncodingNodeId;
|
|
123
117
|
binaryEncodings.push(binaryEncodingNodeId);
|
|
124
118
|
browsedDescriptions.push(dataTypeDescription);
|
|
125
119
|
nodesToBrowseDataType.push({
|
|
126
|
-
browseDirection:
|
|
120
|
+
browseDirection: BrowseDirection.Inverse,
|
|
127
121
|
includeSubtypes: false,
|
|
128
|
-
nodeClassMask:
|
|
122
|
+
nodeClassMask: NodeClassMask.DataType,
|
|
129
123
|
nodeId: ref.nodeId,
|
|
130
|
-
referenceTypeId:
|
|
124
|
+
referenceTypeId: resolveNodeId("HasEncoding"),
|
|
131
125
|
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
|
|
132
|
-
resultMask:
|
|
126
|
+
resultMask: makeResultMask("NodeId | BrowseName")
|
|
133
127
|
});
|
|
134
128
|
}
|
|
135
129
|
}
|
|
136
130
|
const pairs = [];
|
|
137
131
|
if (nodesToBrowseDataType.length > 0) {
|
|
138
|
-
const results4 = await
|
|
132
|
+
const results4 = await browseAll(session, nodesToBrowseDataType);
|
|
139
133
|
for (let i = 0; i < results4.length; i++) {
|
|
140
134
|
const result4 = results4[i];
|
|
141
135
|
result4.references = result4.references || [];
|
|
@@ -156,15 +150,15 @@ async function _enrichWithDescriptionOf(session, dataTypeDescriptions) {
|
|
|
156
150
|
}
|
|
157
151
|
}
|
|
158
152
|
const otherEncodingBrowse = pairs.map(({ dataTypeNodeId }) => ({
|
|
159
|
-
browseDirection:
|
|
153
|
+
browseDirection: BrowseDirection.Forward,
|
|
160
154
|
includeSubtypes: false,
|
|
161
|
-
nodeClassMask:
|
|
155
|
+
nodeClassMask: NodeClassMask.Object,
|
|
162
156
|
nodeId: dataTypeNodeId,
|
|
163
|
-
referenceTypeId:
|
|
157
|
+
referenceTypeId: resolveNodeId("HasEncoding"),
|
|
164
158
|
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
|
|
165
|
-
resultMask:
|
|
159
|
+
resultMask: makeResultMask("NodeId | BrowseName")
|
|
166
160
|
}));
|
|
167
|
-
const results5 = await
|
|
161
|
+
const results5 = await browseAll(session, otherEncodingBrowse);
|
|
168
162
|
for (let i = 0; i < results5.length; i++) {
|
|
169
163
|
const result5 = results5[i];
|
|
170
164
|
const { dataTypeDescription } = pairs[i];
|
|
@@ -227,16 +221,16 @@ function sortStructure(dataTypeDefinitions) {
|
|
|
227
221
|
return dataTypeDefinitionsSorted;
|
|
228
222
|
}
|
|
229
223
|
const readIsAbstract = async (session, nodeId) => {
|
|
230
|
-
const dataValue = await session.read({ nodeId, attributeId:
|
|
224
|
+
const dataValue = await session.read({ nodeId, attributeId: AttributeIds.IsAbstract });
|
|
231
225
|
return dataValue.value.value;
|
|
232
226
|
};
|
|
233
227
|
async function _extractDataTypeDictionaryFromDefinition(session, dataTypeDictionaryNodeId, dataTypeManager) {
|
|
234
|
-
|
|
228
|
+
assert(dataTypeManager, "expecting a dataTypeManager");
|
|
235
229
|
const dataTypeDescriptions = await _getDataTypeDescriptions(session, dataTypeDictionaryNodeId);
|
|
236
230
|
const dataTypeAndDescriptions = await _enrichWithDescriptionOf(session, dataTypeDescriptions);
|
|
237
231
|
// now read DataTypeDefinition attributes of all the dataTypes, this will only contains concrete structure
|
|
238
232
|
const nodesToRead = dataTypeAndDescriptions.map(({ dataTypeNodeId }) => ({
|
|
239
|
-
attributeId:
|
|
233
|
+
attributeId: AttributeIds.DataTypeDefinition,
|
|
240
234
|
nodeId: dataTypeNodeId
|
|
241
235
|
}));
|
|
242
236
|
const cache = {};
|
|
@@ -245,7 +239,7 @@ async function _extractDataTypeDictionaryFromDefinition(session, dataTypeDiction
|
|
|
245
239
|
// was reported to fail on nodesets such as Euromap. It was right to fail: the two
|
|
246
240
|
// lists are not the same length, because abstract types are skipped. The read is
|
|
247
241
|
// driven by dataTypeAndDescriptions, so this is the invariant that does hold.
|
|
248
|
-
|
|
242
|
+
assert(dataValuesWithDataTypeDefinition.length === dataTypeAndDescriptions.length);
|
|
249
243
|
const dataTypeDefinitions = [];
|
|
250
244
|
let index = 0;
|
|
251
245
|
const promise = [];
|
|
@@ -253,7 +247,7 @@ async function _extractDataTypeDictionaryFromDefinition(session, dataTypeDiction
|
|
|
253
247
|
const { dataTypeNodeId, dataTypeDescription } = dataTypeAndDescriptions[index];
|
|
254
248
|
if (dataValue.statusCode.isGood()) {
|
|
255
249
|
const dataTypeDefinition = dataValue.value.value;
|
|
256
|
-
if (dataTypeDefinition && dataTypeDefinition instanceof
|
|
250
|
+
if (dataTypeDefinition && dataTypeDefinition instanceof StructureDefinition) {
|
|
257
251
|
if (!dataTypeDescription.browseName.name) {
|
|
258
252
|
throw new Error(`Unexpected: BrowseName has no name for nodeId ${dataTypeNodeId.toString()}`);
|
|
259
253
|
}
|
|
@@ -291,7 +285,7 @@ async function _extractDataTypeDictionaryFromDefinition(session, dataTypeDiction
|
|
|
291
285
|
const dataTypeFactory = dataTypeManager.getDataTypeFactoryForNamespace(dataTypeNodeId.namespace);
|
|
292
286
|
// c8 ignore next
|
|
293
287
|
if (doDebug) {
|
|
294
|
-
debugLog(
|
|
288
|
+
debugLog(chalk.yellow("--------------------------------------- "), className, dataTypeNodeId.toString());
|
|
295
289
|
}
|
|
296
290
|
if (dataTypeFactory.hasStructureByTypeName(className)) {
|
|
297
291
|
return; // this structure has already been seen
|
|
@@ -308,15 +302,15 @@ async function _extractDataTypeDictionaryFromDefinition(session, dataTypeDiction
|
|
|
308
302
|
if (!dataTypeDescription) {
|
|
309
303
|
throw new Error(`cannot find dataTypeDescription for ${dataTypeNodeId.toString()}`);
|
|
310
304
|
}
|
|
311
|
-
const schema = await
|
|
305
|
+
const schema = await convertDataTypeDefinitionToStructureTypeSchema(session, dataTypeNodeId, className, dataTypeDefinition, dataTypeDescription, // for encodings
|
|
312
306
|
dataTypeManager, isAbstract, cache);
|
|
313
307
|
// c8 ignore next
|
|
314
308
|
if (doDebug) {
|
|
315
|
-
debugLog(
|
|
309
|
+
debugLog(chalk.red("Registering "), chalk.cyan(className.padEnd(30, " ")), schema.dataTypeNodeId.toString());
|
|
316
310
|
}
|
|
317
311
|
if (!isAbstract) {
|
|
318
|
-
const Constructor =
|
|
319
|
-
|
|
312
|
+
const Constructor = createDynamicObjectConstructor(schema, dataTypeFactory);
|
|
313
|
+
assert(Constructor.schema === schema);
|
|
320
314
|
}
|
|
321
315
|
else {
|
|
322
316
|
// c8 ignore next
|
|
@@ -361,11 +355,11 @@ async function _extractDataTypeDictionary(session, d, dataTypeManager) {
|
|
|
361
355
|
if (!_isOldDataTypeDictionary(d)) {
|
|
362
356
|
if (doDebug) {
|
|
363
357
|
const [name, namespace] = await Promise.all([
|
|
364
|
-
session.read({ nodeId: dataTypeDictionaryNodeId, attributeId:
|
|
358
|
+
session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.BrowseName }),
|
|
365
359
|
_readNamespaceUriProperty(session, dataTypeDictionaryNodeId)
|
|
366
360
|
]);
|
|
367
361
|
doDebug &&
|
|
368
|
-
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !",
|
|
362
|
+
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
|
|
369
363
|
debugLog("let's use the new way (1.04) and let's explore all dataTypes exposed by this name space");
|
|
370
364
|
}
|
|
371
365
|
// dataType definition in store directly in UADataType under the definition attribute
|
|
@@ -389,19 +383,19 @@ async function _extractDataTypeDictionary(session, d, dataTypeManager) {
|
|
|
389
383
|
}
|
|
390
384
|
const idProvider = await _extractNodeIds(session, dataTypeDictionaryNodeId);
|
|
391
385
|
const dataTypeFactory1 = dataTypeManager.getDataTypeFactory(dataTypeDictionaryNodeId.namespace);
|
|
392
|
-
await
|
|
386
|
+
await parseBinaryXSD(rawSchema, idProvider, dataTypeFactory1);
|
|
393
387
|
}
|
|
394
388
|
}
|
|
395
389
|
async function _exploreDataTypeDefinition(session, dataTypeDictionaryTypeNode, dataTypeFactory, namespaces) {
|
|
396
390
|
const nodeToBrowse = {
|
|
397
|
-
browseDirection:
|
|
391
|
+
browseDirection: BrowseDirection.Forward,
|
|
398
392
|
includeSubtypes: false,
|
|
399
|
-
nodeClassMask:
|
|
393
|
+
nodeClassMask: makeNodeClassMask("Variable"),
|
|
400
394
|
nodeId: dataTypeDictionaryTypeNode,
|
|
401
|
-
referenceTypeId:
|
|
402
|
-
resultMask:
|
|
395
|
+
referenceTypeId: resolveNodeId("HasComponent"),
|
|
396
|
+
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
|
|
403
397
|
};
|
|
404
|
-
const result = await
|
|
398
|
+
const result = await browseAll(session, nodeToBrowse);
|
|
405
399
|
const references = result.references || [];
|
|
406
400
|
/* c8 ignore next */
|
|
407
401
|
if (references.length === 0) {
|
|
@@ -410,27 +404,27 @@ async function _exploreDataTypeDefinition(session, dataTypeDictionaryTypeNode, d
|
|
|
410
404
|
// request the Definition of each nodes
|
|
411
405
|
const nodesToBrowse2 = references.map((ref) => {
|
|
412
406
|
return {
|
|
413
|
-
browseDirection:
|
|
407
|
+
browseDirection: BrowseDirection.Inverse,
|
|
414
408
|
includeSubtypes: false,
|
|
415
|
-
nodeClassMask:
|
|
409
|
+
nodeClassMask: makeNodeClassMask("Object | Variable"),
|
|
416
410
|
nodeId: ref.nodeId,
|
|
417
|
-
referenceTypeId:
|
|
418
|
-
resultMask:
|
|
411
|
+
referenceTypeId: resolveNodeId("HasDescription"),
|
|
412
|
+
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
|
|
419
413
|
};
|
|
420
414
|
});
|
|
421
|
-
const results2 = await
|
|
415
|
+
const results2 = await browseAll(session, nodesToBrowse2);
|
|
422
416
|
const binaryEncodingNodeIds = results2.map((br) => {
|
|
423
417
|
const defaultBin = (br.references || []).filter((r) => r.browseName.toString() === "Default Binary");
|
|
424
418
|
/* c8 ignore next */
|
|
425
419
|
if (defaultBin.length < 1) {
|
|
426
|
-
return
|
|
420
|
+
return ExpandedNodeId;
|
|
427
421
|
}
|
|
428
|
-
return
|
|
422
|
+
return ExpandedNodeId.fromNodeId(defaultBin[0].nodeId, namespaces[defaultBin[0].nodeId.namespace]);
|
|
429
423
|
});
|
|
430
424
|
// follow now Default Binary <= [Has Encoding] = [DataType]
|
|
431
425
|
/* c8 ignore next */
|
|
432
426
|
if (doDebug) {
|
|
433
|
-
debugLog(
|
|
427
|
+
debugLog(chalk.bgWhite.red("testing new constructors"));
|
|
434
428
|
for (let i = 0; i < references.length; i++) {
|
|
435
429
|
const ref = references[i];
|
|
436
430
|
const binaryEncoding = binaryEncodingNodeIds[i];
|
|
@@ -484,13 +478,13 @@ function extraNamespaceRef(attribute) {
|
|
|
484
478
|
* @param session
|
|
485
479
|
* @param dataTypeManager
|
|
486
480
|
*/
|
|
487
|
-
async function populateDataTypeManager103(session, dataTypeManager) {
|
|
481
|
+
export async function populateDataTypeManager103(session, dataTypeManager) {
|
|
488
482
|
// c8 ignore next
|
|
489
483
|
doDebug && debugLog("in ... populateDataTypeManager");
|
|
490
484
|
// read namespace array
|
|
491
485
|
const dataValueNamespaceArray = await session.read({
|
|
492
|
-
attributeId:
|
|
493
|
-
nodeId:
|
|
486
|
+
attributeId: AttributeIds.Value,
|
|
487
|
+
nodeId: resolveNodeId("Server_NamespaceArray")
|
|
494
488
|
});
|
|
495
489
|
let namespaceArray = dataValueNamespaceArray.value.value;
|
|
496
490
|
// c8 ignore next
|
|
@@ -508,7 +502,7 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
508
502
|
dataTypeManager.setNamespaceArray(namespaceArray);
|
|
509
503
|
for (let namespaceIndex = 1; namespaceIndex < namespaceArray.length; namespaceIndex++) {
|
|
510
504
|
if (!dataTypeManager.hasDataTypeFactory(namespaceIndex)) {
|
|
511
|
-
const dataTypeFactory1 = new
|
|
505
|
+
const dataTypeFactory1 = new DataTypeFactory([getStandardDataTypeFactory()]);
|
|
512
506
|
dataTypeManager.registerDataTypeFactory(namespaceIndex, dataTypeFactory1);
|
|
513
507
|
}
|
|
514
508
|
}
|
|
@@ -517,21 +511,21 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
517
511
|
if (!dataValueNamespaceArray.value.value && dataTypeManager.namespaceArray.length === 0) {
|
|
518
512
|
dataTypeManager.setNamespaceArray([]);
|
|
519
513
|
}
|
|
520
|
-
const dataTypeDictionaryType =
|
|
514
|
+
const dataTypeDictionaryType = resolveNodeId("DataTypeDictionaryType");
|
|
521
515
|
// DataType/OPCBinary => i=93 [OPCBinarySchema_TypeSystem]
|
|
522
516
|
// "OPC Binary"[DataSystemType]
|
|
523
|
-
const opcBinaryNodeId =
|
|
517
|
+
const opcBinaryNodeId = resolveNodeId("OPCBinarySchema_TypeSystem");
|
|
524
518
|
// let find all DataType dictionary node corresponding to a given namespace
|
|
525
519
|
// (have DataTypeDictionaryType)
|
|
526
520
|
const nodeToBrowse = {
|
|
527
|
-
browseDirection:
|
|
521
|
+
browseDirection: BrowseDirection.Forward,
|
|
528
522
|
includeSubtypes: false,
|
|
529
|
-
nodeClassMask:
|
|
523
|
+
nodeClassMask: makeNodeClassMask("Variable"),
|
|
530
524
|
nodeId: opcBinaryNodeId,
|
|
531
|
-
referenceTypeId:
|
|
532
|
-
resultMask:
|
|
525
|
+
referenceTypeId: resolveNodeId("HasComponent"),
|
|
526
|
+
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
|
|
533
527
|
};
|
|
534
|
-
const result = await
|
|
528
|
+
const result = await browseAll(session, nodeToBrowse);
|
|
535
529
|
// c8 ignore next
|
|
536
530
|
if (doDebug) {
|
|
537
531
|
debugLog(result.statusCode.toString());
|
|
@@ -540,7 +534,7 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
540
534
|
// filter nodes that have the expected namespace Index
|
|
541
535
|
// ( more specifically we want to filter out DataStructure from namespace 0)
|
|
542
536
|
// we also want to keep only object of type DataTypeDictionaryType
|
|
543
|
-
const references = (result.references || []).filter((e) => e.nodeId.namespace !== 0 &&
|
|
537
|
+
const references = (result.references || []).filter((e) => e.nodeId.namespace !== 0 && sameNodeId(e.typeDefinition, dataTypeDictionaryType));
|
|
544
538
|
// c8 ignore next
|
|
545
539
|
doDebug && debugLog(`found ${references.length} dictionaries`);
|
|
546
540
|
async function putInCorrectOrder() {
|
|
@@ -551,7 +545,7 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
551
545
|
const promises = [
|
|
552
546
|
/* isDictionaryDeprecated: bool = await */ _readDeprecatedFlag(session, dataTypeDictionaryNodeId),
|
|
553
547
|
/* rawSchemaDataValue!: DataValue = await */ session.read({
|
|
554
|
-
attributeId:
|
|
548
|
+
attributeId: AttributeIds.Value,
|
|
555
549
|
nodeId: dataTypeDictionaryNodeId
|
|
556
550
|
})
|
|
557
551
|
];
|
|
@@ -642,7 +636,7 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
642
636
|
map[d.targetNamespace] = d;
|
|
643
637
|
doDebug &&
|
|
644
638
|
debugLog(" fixing based dataTypeFactory dependencies for ", d.targetNamespace, "index = ", d.dataTypeDictionaryNodeId.namespace);
|
|
645
|
-
const baseDataFactories = [
|
|
639
|
+
const baseDataFactories = [getStandardDataTypeFactory()];
|
|
646
640
|
for (const namespace of Object.values(d.dependencies)) {
|
|
647
641
|
if (namespace === d.targetNamespace) {
|
|
648
642
|
continue;
|
|
@@ -665,7 +659,7 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
665
659
|
namespaceArray = dataTypeManager.namespaceArray;
|
|
666
660
|
for (const d of dataTypeDictionaryInfo) {
|
|
667
661
|
const set = new Set();
|
|
668
|
-
set.add(
|
|
662
|
+
set.add(getStandardDataTypeFactory());
|
|
669
663
|
const visited = new Set();
|
|
670
664
|
const explore = (d) => {
|
|
671
665
|
if (visited.has(d.targetNamespace)) {
|
|
@@ -701,13 +695,13 @@ async function populateDataTypeManager103(session, dataTypeManager) {
|
|
|
701
695
|
// now investigate DataTypeDescriptionType
|
|
702
696
|
async function processReferenceOnDataTypeDictionaryType(d) {
|
|
703
697
|
// c8 ignore next
|
|
704
|
-
doDebug && debugLog(
|
|
698
|
+
doDebug && debugLog(chalk.cyan("processReferenceOnDataTypeDictionaryType on "), d.targetNamespace);
|
|
705
699
|
const ref = d.reference;
|
|
706
700
|
const dataTypeDictionaryNodeId = d.reference.nodeId;
|
|
707
701
|
await _extractDataTypeDictionary(session, d, dataTypeManager);
|
|
708
702
|
/* c8 ignore next */
|
|
709
703
|
if (doDebug) {
|
|
710
|
-
debugLog(
|
|
704
|
+
debugLog(chalk.bgWhite(" => "), ref.browseName.toString(), ref.nodeId.toString());
|
|
711
705
|
}
|
|
712
706
|
const dataTypeFactory = dataTypeManager.getDataTypeFactoryForNamespace(dataTypeDictionaryNodeId.namespace);
|
|
713
707
|
await _exploreDataTypeDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory, dataTypeManager.namespaceArray);
|