node-opcua-client-dynamic-extension-object 2.70.3 → 2.71.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/client_dynamic_extension_object.d.ts +22 -0
- package/dist/client_dynamic_extension_object.js +1012 -0
- package/dist/client_dynamic_extension_object.js.map +1 -0
- package/dist/convert_data_type_definition_to_structuretype_schema.d.ts +12 -12
- package/dist/convert_data_type_definition_to_structuretype_schema.js +343 -331
- package/dist/convert_data_type_definition_to_structuretype_schema.js.map +1 -1
- package/dist/extra_data_type_manager.d.ts +16 -16
- package/dist/extra_data_type_manager.js +75 -75
- package/dist/get_extension_object_constructor.d.ts +7 -7
- package/dist/get_extension_object_constructor.js +37 -37
- package/dist/get_extra_data_type_manager.d.ts +3 -3
- package/dist/get_extra_data_type_manager.js +51 -51
- package/dist/index.d.ts +12 -12
- package/dist/index.js +28 -28
- package/dist/populate_data_type_manager.d.ts +3 -3
- package/dist/populate_data_type_manager.js +25 -25
- package/dist/private/find_encodings.d.ts +4 -4
- package/dist/private/find_encodings.js +55 -55
- package/dist/private/populate_data_type_manager_103.d.ts +9 -9
- package/dist/private/populate_data_type_manager_103.js +601 -601
- package/dist/private/populate_data_type_manager_104.d.ts +9 -9
- package/dist/private/populate_data_type_manager_104.js +182 -182
- package/dist/private/populate_data_type_manager_104.js.map +1 -1
- package/dist/promote_opaque_structure.d.ts +6 -6
- package/dist/promote_opaque_structure.js +41 -41
- package/dist/promote_opaque_structure_in_notification_data.d.ts +3 -3
- package/dist/promote_opaque_structure_in_notification_data.js +51 -51
- package/dist/resolve_dynamic_extension_object.d.ts +4 -4
- package/dist/resolve_dynamic_extension_object.js +105 -105
- package/dist/resolve_dynamic_extension_object.js.map +1 -1
- package/package.json +16 -16
- package/source/convert_data_type_definition_to_structuretype_schema.ts +43 -30
- package/source/private/populate_data_type_manager_104.ts +1 -0
- package/source/resolve_dynamic_extension_object.ts +13 -10
|
@@ -1,9 +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>;
|
|
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>;
|
|
@@ -1,183 +1,183 @@
|
|
|
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.populateDataTypeManager104 = exports.readDataTypeDefinitionAndBuildType = void 0;
|
|
13
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
14
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
15
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
16
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
17
|
-
const node_opcua_schemas_1 = require("node-opcua-schemas");
|
|
18
|
-
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
19
|
-
const convert_data_type_definition_to_structuretype_schema_1 = require("../convert_data_type_definition_to_structuretype_schema");
|
|
20
|
-
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
21
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
22
|
-
function readDataTypeDefinitionAndBuildType(session, dataTypeNodeId, name, dataTypeFactory, cache) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
const dataTypeDefinitionDataValue = yield session.read({
|
|
26
|
-
attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition,
|
|
27
|
-
nodeId: dataTypeNodeId
|
|
28
|
-
});
|
|
29
|
-
/* istanbul ignore next */
|
|
30
|
-
if (dataTypeDefinitionDataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
31
|
-
throw new Error(" Cannot find dataType Definition ! with nodeId =" + dataTypeNodeId.toString());
|
|
32
|
-
}
|
|
33
|
-
const dataTypeDefinition = dataTypeDefinitionDataValue.value.value;
|
|
34
|
-
const schema = yield (0, convert_data_type_definition_to_structuretype_schema_1.convertDataTypeDefinitionToStructureTypeSchema)(session, dataTypeNodeId, name, dataTypeDefinition, dataTypeFactory, cache);
|
|
35
|
-
(0, node_opcua_schemas_1.createDynamicObjectConstructor)(schema, dataTypeFactory);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
errorLog("Error", err);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
exports.readDataTypeDefinitionAndBuildType = readDataTypeDefinitionAndBuildType;
|
|
43
|
-
class TaskMan {
|
|
44
|
-
constructor() {
|
|
45
|
-
this.taskList = [];
|
|
46
|
-
this._runningTask = false;
|
|
47
|
-
this._resolve = undefined;
|
|
48
|
-
}
|
|
49
|
-
flushTaskList() {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const firstTask = this.taskList.shift();
|
|
52
|
-
this._runningTask = true;
|
|
53
|
-
yield firstTask();
|
|
54
|
-
this._runningTask = false;
|
|
55
|
-
if (this.taskList.length > 0) {
|
|
56
|
-
setImmediate(() => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
yield this.flushTaskList();
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
if (this._resolve) {
|
|
62
|
-
const tmpResolve = this._resolve;
|
|
63
|
-
this._resolve = undefined;
|
|
64
|
-
tmpResolve();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* a little async task queue that gets executed sequentially
|
|
72
|
-
* outside the main loop
|
|
73
|
-
*/
|
|
74
|
-
registerTask(taskFunc) {
|
|
75
|
-
this.taskList.push(taskFunc);
|
|
76
|
-
if (this.taskList.length === 1 && !this._runningTask) {
|
|
77
|
-
this.flushTaskList();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
waitForCompletion() {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
if (this._resolve !== undefined) {
|
|
83
|
-
throw new Error("already waiting");
|
|
84
|
-
}
|
|
85
|
-
yield new Promise((resolve) => {
|
|
86
|
-
this._resolve = resolve;
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function applyOnReferenceRecursively(session, nodeId, browseDescriptionTemplate, action) {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const taskMan = new TaskMan();
|
|
94
|
-
let pendingNodesToBrowse = [];
|
|
95
|
-
let pendingContinuationPoints = [];
|
|
96
|
-
function processBrowseResult(browseResults) {
|
|
97
|
-
for (const result of browseResults) {
|
|
98
|
-
if (result.statusCode === node_opcua_status_code_1.StatusCodes.Good) {
|
|
99
|
-
if (result.continuationPoint) {
|
|
100
|
-
pendingContinuationPoints.push(result.continuationPoint);
|
|
101
|
-
taskMan.registerTask(flushBrowse);
|
|
102
|
-
}
|
|
103
|
-
for (const r of result.references || []) {
|
|
104
|
-
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
yield action(r);
|
|
106
|
-
}));
|
|
107
|
-
// also explore sub types
|
|
108
|
-
browseSubDataTypeRecursively(r.nodeId);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function flushBrowse() {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
if (pendingContinuationPoints.length) {
|
|
116
|
-
const continuationPoints = pendingContinuationPoints;
|
|
117
|
-
pendingContinuationPoints = [];
|
|
118
|
-
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
const browseResults = yield session.browseNext(continuationPoints, false);
|
|
120
|
-
processBrowseResult(browseResults);
|
|
121
|
-
}));
|
|
122
|
-
}
|
|
123
|
-
else if (pendingNodesToBrowse.length) {
|
|
124
|
-
const nodesToBrowse = pendingNodesToBrowse;
|
|
125
|
-
pendingNodesToBrowse = [];
|
|
126
|
-
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
const browseResults = yield session.browse(nodesToBrowse);
|
|
128
|
-
processBrowseResult(browseResults);
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function browseSubDataTypeRecursively(nodeId) {
|
|
134
|
-
const nodeToBrowse = Object.assign(Object.assign({}, browseDescriptionTemplate), { nodeId });
|
|
135
|
-
pendingNodesToBrowse.push(nodeToBrowse);
|
|
136
|
-
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
flushBrowse();
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
browseSubDataTypeRecursively(nodeId);
|
|
141
|
-
yield taskMan.waitForCompletion();
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function populateDataTypeManager104(session, dataTypeManager) {
|
|
145
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
const cache = {};
|
|
147
|
-
function withDataType(r) {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const dataTypeNodeId = r.nodeId;
|
|
150
|
-
try {
|
|
151
|
-
const dataTypeFactory = dataTypeManager.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
152
|
-
if (dataTypeNodeId.namespace === 0) {
|
|
153
|
-
// already known I guess
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
// if not found already
|
|
157
|
-
if (dataTypeFactory.getConstructorForDataType(dataTypeNodeId)) {
|
|
158
|
-
// already known !
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
// extract it formally
|
|
162
|
-
debugLog(" DataType => ", r.browseName.toString(), dataTypeNodeId.toString());
|
|
163
|
-
yield readDataTypeDefinitionAndBuildType(session, dataTypeNodeId, r.browseName.name, dataTypeFactory, cache);
|
|
164
|
-
(0, node_opcua_assert_1.assert)(dataTypeFactory.getConstructorForDataType(dataTypeNodeId));
|
|
165
|
-
}
|
|
166
|
-
catch (err) {
|
|
167
|
-
errorLog("err=", err);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
const nodeToBrowse = {
|
|
172
|
-
nodeId: node_opcua_nodeid_1.NodeId.nullNodeId,
|
|
173
|
-
includeSubtypes: true,
|
|
174
|
-
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
175
|
-
nodeClassMask: 0xff,
|
|
176
|
-
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
177
|
-
resultMask: 0xff
|
|
178
|
-
};
|
|
179
|
-
yield applyOnReferenceRecursively(session, (0, node_opcua_nodeid_1.resolveNodeId)("Structure"), nodeToBrowse, withDataType);
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
exports.populateDataTypeManager104 = populateDataTypeManager104;
|
|
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.populateDataTypeManager104 = exports.readDataTypeDefinitionAndBuildType = void 0;
|
|
13
|
+
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
14
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
15
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
16
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
17
|
+
const node_opcua_schemas_1 = require("node-opcua-schemas");
|
|
18
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
19
|
+
const convert_data_type_definition_to_structuretype_schema_1 = require("../convert_data_type_definition_to_structuretype_schema");
|
|
20
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
21
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
22
|
+
function readDataTypeDefinitionAndBuildType(session, dataTypeNodeId, name, dataTypeFactory, cache) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
try {
|
|
25
|
+
const dataTypeDefinitionDataValue = yield session.read({
|
|
26
|
+
attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition,
|
|
27
|
+
nodeId: dataTypeNodeId
|
|
28
|
+
});
|
|
29
|
+
/* istanbul ignore next */
|
|
30
|
+
if (dataTypeDefinitionDataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
31
|
+
throw new Error(" Cannot find dataType Definition ! with nodeId =" + dataTypeNodeId.toString());
|
|
32
|
+
}
|
|
33
|
+
const dataTypeDefinition = dataTypeDefinitionDataValue.value.value;
|
|
34
|
+
const schema = yield (0, convert_data_type_definition_to_structuretype_schema_1.convertDataTypeDefinitionToStructureTypeSchema)(session, dataTypeNodeId, name, dataTypeDefinition, dataTypeFactory, cache);
|
|
35
|
+
(0, node_opcua_schemas_1.createDynamicObjectConstructor)(schema, dataTypeFactory);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
errorLog("Error", err);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
exports.readDataTypeDefinitionAndBuildType = readDataTypeDefinitionAndBuildType;
|
|
43
|
+
class TaskMan {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.taskList = [];
|
|
46
|
+
this._runningTask = false;
|
|
47
|
+
this._resolve = undefined;
|
|
48
|
+
}
|
|
49
|
+
flushTaskList() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const firstTask = this.taskList.shift();
|
|
52
|
+
this._runningTask = true;
|
|
53
|
+
yield firstTask();
|
|
54
|
+
this._runningTask = false;
|
|
55
|
+
if (this.taskList.length > 0) {
|
|
56
|
+
setImmediate(() => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
yield this.flushTaskList();
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (this._resolve) {
|
|
62
|
+
const tmpResolve = this._resolve;
|
|
63
|
+
this._resolve = undefined;
|
|
64
|
+
tmpResolve();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* a little async task queue that gets executed sequentially
|
|
72
|
+
* outside the main loop
|
|
73
|
+
*/
|
|
74
|
+
registerTask(taskFunc) {
|
|
75
|
+
this.taskList.push(taskFunc);
|
|
76
|
+
if (this.taskList.length === 1 && !this._runningTask) {
|
|
77
|
+
this.flushTaskList();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
waitForCompletion() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
if (this._resolve !== undefined) {
|
|
83
|
+
throw new Error("already waiting");
|
|
84
|
+
}
|
|
85
|
+
yield new Promise((resolve) => {
|
|
86
|
+
this._resolve = resolve;
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function applyOnReferenceRecursively(session, nodeId, browseDescriptionTemplate, action) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const taskMan = new TaskMan();
|
|
94
|
+
let pendingNodesToBrowse = [];
|
|
95
|
+
let pendingContinuationPoints = [];
|
|
96
|
+
function processBrowseResult(browseResults) {
|
|
97
|
+
for (const result of browseResults) {
|
|
98
|
+
if (result.statusCode === node_opcua_status_code_1.StatusCodes.Good) {
|
|
99
|
+
if (result.continuationPoint) {
|
|
100
|
+
pendingContinuationPoints.push(result.continuationPoint);
|
|
101
|
+
taskMan.registerTask(flushBrowse);
|
|
102
|
+
}
|
|
103
|
+
for (const r of result.references || []) {
|
|
104
|
+
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
yield action(r);
|
|
106
|
+
}));
|
|
107
|
+
// also explore sub types
|
|
108
|
+
browseSubDataTypeRecursively(r.nodeId);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function flushBrowse() {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
if (pendingContinuationPoints.length) {
|
|
116
|
+
const continuationPoints = pendingContinuationPoints;
|
|
117
|
+
pendingContinuationPoints = [];
|
|
118
|
+
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const browseResults = yield session.browseNext(continuationPoints, false);
|
|
120
|
+
processBrowseResult(browseResults);
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
else if (pendingNodesToBrowse.length) {
|
|
124
|
+
const nodesToBrowse = pendingNodesToBrowse;
|
|
125
|
+
pendingNodesToBrowse = [];
|
|
126
|
+
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const browseResults = yield session.browse(nodesToBrowse);
|
|
128
|
+
processBrowseResult(browseResults);
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function browseSubDataTypeRecursively(nodeId) {
|
|
134
|
+
const nodeToBrowse = Object.assign(Object.assign({}, browseDescriptionTemplate), { nodeId });
|
|
135
|
+
pendingNodesToBrowse.push(nodeToBrowse);
|
|
136
|
+
taskMan.registerTask(() => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
flushBrowse();
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
browseSubDataTypeRecursively(nodeId);
|
|
141
|
+
yield taskMan.waitForCompletion();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function populateDataTypeManager104(session, dataTypeManager) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const cache = {};
|
|
147
|
+
function withDataType(r) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const dataTypeNodeId = r.nodeId;
|
|
150
|
+
try {
|
|
151
|
+
const dataTypeFactory = dataTypeManager.getDataTypeFactory(dataTypeNodeId.namespace);
|
|
152
|
+
if (dataTypeNodeId.namespace === 0) {
|
|
153
|
+
// already known I guess
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// if not found already
|
|
157
|
+
if (dataTypeFactory.getConstructorForDataType(dataTypeNodeId)) {
|
|
158
|
+
// already known !
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// extract it formally
|
|
162
|
+
debugLog(" DataType => ", r.browseName.toString(), dataTypeNodeId.toString());
|
|
163
|
+
yield readDataTypeDefinitionAndBuildType(session, dataTypeNodeId, r.browseName.name, dataTypeFactory, cache);
|
|
164
|
+
(0, node_opcua_assert_1.assert)(dataTypeFactory.getConstructorForDataType(dataTypeNodeId));
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
errorLog("err=", err);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const nodeToBrowse = {
|
|
172
|
+
nodeId: node_opcua_nodeid_1.NodeId.nullNodeId,
|
|
173
|
+
includeSubtypes: true,
|
|
174
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
175
|
+
nodeClassMask: 0xff,
|
|
176
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
177
|
+
resultMask: 0xff
|
|
178
|
+
};
|
|
179
|
+
yield applyOnReferenceRecursively(session, (0, node_opcua_nodeid_1.resolveNodeId)("Structure"), nodeToBrowse, withDataType);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
exports.populateDataTypeManager104 = populateDataTypeManager104;
|
|
183
183
|
//# sourceMappingURL=populate_data_type_manager_104.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate_data_type_manager_104.js","sourceRoot":"","sources":["../../source/private/populate_data_type_manager_104.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,iEAAsE;AACtE,uDAAgE;AAEhE,yDAAsE;AAEtE,2DAAoE;AACpE,mEAAqD;AAKrD,kIAGiE;AACjE,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAE3C,SAAsB,kCAAkC,CACpD,OAAsB,EACtB,cAAsB,EACtB,IAAY,EACZ,eAAgC,EAChC,KAAiD;;QAEjD,IAAI;YACA,MAAM,2BAA2B,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;gBACnD,WAAW,EAAE,oCAAY,CAAC,kBAAkB;gBAC5C,MAAM,EAAE,cAAc;aACzB,CAAC,CAAC;YACH,0BAA0B;YAC1B,IAAI,2BAA2B,CAAC,UAAU,KAAK,oCAAW,CAAC,IAAI,EAAE;gBAC7D,MAAM,IAAI,KAAK,CAAC,kDAAkD,GAAG,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;aACnG;YACD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC,KAAK,CAAC,KAAK,CAAC;YAEnE,MAAM,MAAM,GAAG,MAAM,IAAA,qGAA8C,EAC/D,OAAO,EACP,cAAc,EACd,IAAI,EACJ,kBAAkB,EAClB,eAAe,EACf,KAAK,CACR,CAAC;YAEF,IAAA,mDAA8B,EAAC,MAAM,EAAE,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"populate_data_type_manager_104.js","sourceRoot":"","sources":["../../source/private/populate_data_type_manager_104.ts"],"names":[],"mappings":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AC;SAAA;QAED,MAAM,YAAY,GAA6B;YAC3C,MAAM,EAAE,0BAAM,CAAC,UAAU;YACzB,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,uCAAe,CAAC,OAAO;YACxC,aAAa,EAAE,IAAI;YACnB,eAAe,EAAE,IAAA,iCAAa,EAAC,YAAY,CAAC;YAC5C,UAAU,EAAE,IAAI;SACnB,CAAC;QACF,MAAM,2BAA2B,CAAC,OAAO,EAAE,IAAA,iCAAa,EAAC,WAAW,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACvG,CAAC;CAAA;AAlCD,gEAkCC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
-
import { Variant } from "node-opcua-variant";
|
|
3
|
-
export interface PseudoDataValue {
|
|
4
|
-
value: Variant;
|
|
5
|
-
}
|
|
6
|
-
export declare function promoteOpaqueStructure(session: IBasicSession, dataValues: PseudoDataValue[]): Promise<void>;
|
|
1
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
2
|
+
import { Variant } from "node-opcua-variant";
|
|
3
|
+
export interface PseudoDataValue {
|
|
4
|
+
value: Variant;
|
|
5
|
+
}
|
|
6
|
+
export declare function promoteOpaqueStructure(session: IBasicSession, dataValues: PseudoDataValue[]): Promise<void>;
|
|
@@ -1,42 +1,42 @@
|
|
|
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.promoteOpaqueStructure = void 0;
|
|
13
|
-
const node_opcua_extension_object_1 = require("node-opcua-extension-object");
|
|
14
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
15
|
-
//
|
|
16
|
-
const get_extra_data_type_manager_1 = require("./get_extra_data_type_manager");
|
|
17
|
-
const resolve_dynamic_extension_object_1 = require("./resolve_dynamic_extension_object");
|
|
18
|
-
;
|
|
19
|
-
function promoteOpaqueStructure(session, dataValues) {
|
|
20
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
// count number of Opaque Structures
|
|
22
|
-
const dataValuesToFix = dataValues.filter((dataValue) => dataValue.value && dataValue.value.dataType === node_opcua_variant_1.DataType.ExtensionObject &&
|
|
23
|
-
((dataValue.value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar
|
|
24
|
-
&& dataValue.value.value instanceof node_opcua_extension_object_1.OpaqueStructure)
|
|
25
|
-
||
|
|
26
|
-
(dataValue.value.arrayType !== node_opcua_variant_1.VariantArrayType.Scalar
|
|
27
|
-
&& dataValue.value.value && dataValue.value.value.length >= 0
|
|
28
|
-
&& dataValue.value.value[0] instanceof node_opcua_extension_object_1.OpaqueStructure)));
|
|
29
|
-
if (dataValuesToFix.length === 0) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
// construct dataTypeManager if not already present
|
|
33
|
-
const extraDataTypeManager = yield (0, get_extra_data_type_manager_1.getExtraDataTypeManager)(session);
|
|
34
|
-
const promises = dataValuesToFix.map((dataValue) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
return yield (0, resolve_dynamic_extension_object_1.resolveDynamicExtensionObject)(session, dataValue.value, extraDataTypeManager);
|
|
36
|
-
}));
|
|
37
|
-
// https://medium.com/swlh/dealing-with-multiple-promises-in-javascript-41d6c21f20ff
|
|
38
|
-
yield Promise.all(promises.map(p => p.catch(e => e)));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
exports.promoteOpaqueStructure = promoteOpaqueStructure;
|
|
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.promoteOpaqueStructure = void 0;
|
|
13
|
+
const node_opcua_extension_object_1 = require("node-opcua-extension-object");
|
|
14
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
15
|
+
//
|
|
16
|
+
const get_extra_data_type_manager_1 = require("./get_extra_data_type_manager");
|
|
17
|
+
const resolve_dynamic_extension_object_1 = require("./resolve_dynamic_extension_object");
|
|
18
|
+
;
|
|
19
|
+
function promoteOpaqueStructure(session, dataValues) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
// count number of Opaque Structures
|
|
22
|
+
const dataValuesToFix = dataValues.filter((dataValue) => dataValue.value && dataValue.value.dataType === node_opcua_variant_1.DataType.ExtensionObject &&
|
|
23
|
+
((dataValue.value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar
|
|
24
|
+
&& dataValue.value.value instanceof node_opcua_extension_object_1.OpaqueStructure)
|
|
25
|
+
||
|
|
26
|
+
(dataValue.value.arrayType !== node_opcua_variant_1.VariantArrayType.Scalar
|
|
27
|
+
&& dataValue.value.value && dataValue.value.value.length >= 0
|
|
28
|
+
&& dataValue.value.value[0] instanceof node_opcua_extension_object_1.OpaqueStructure)));
|
|
29
|
+
if (dataValuesToFix.length === 0) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// construct dataTypeManager if not already present
|
|
33
|
+
const extraDataTypeManager = yield (0, get_extra_data_type_manager_1.getExtraDataTypeManager)(session);
|
|
34
|
+
const promises = dataValuesToFix.map((dataValue) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield (0, resolve_dynamic_extension_object_1.resolveDynamicExtensionObject)(session, dataValue.value, extraDataTypeManager);
|
|
36
|
+
}));
|
|
37
|
+
// https://medium.com/swlh/dealing-with-multiple-promises-in-javascript-41d6c21f20ff
|
|
38
|
+
yield Promise.all(promises.map(p => p.catch(e => e)));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.promoteOpaqueStructure = promoteOpaqueStructure;
|
|
42
42
|
//# sourceMappingURL=promote_opaque_structure.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NotificationData } from "node-opcua-types";
|
|
2
|
-
import { IBasicSession } from "node-opcua-pseudo-session/source/basic_session_interface";
|
|
3
|
-
export declare function promoteOpaqueStructureInNotificationData(session: IBasicSession, notificationData: NotificationData[]): Promise<void>;
|
|
1
|
+
import { NotificationData } from "node-opcua-types";
|
|
2
|
+
import { IBasicSession } from "node-opcua-pseudo-session/source/basic_session_interface";
|
|
3
|
+
export declare function promoteOpaqueStructureInNotificationData(session: IBasicSession, notificationData: NotificationData[]): Promise<void>;
|
|
@@ -1,52 +1,52 @@
|
|
|
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.promoteOpaqueStructureInNotificationData = void 0;
|
|
13
|
-
const node_opcua_types_1 = require("node-opcua-types");
|
|
14
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
15
|
-
const promote_opaque_structure_1 = require("./promote_opaque_structure");
|
|
16
|
-
function promoteOpaqueStructureInNotificationData(session, notificationData) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const dataValuesToPromote = [];
|
|
19
|
-
for (const notification of notificationData) {
|
|
20
|
-
if (!notification) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (notification instanceof node_opcua_types_1.DataChangeNotification) {
|
|
24
|
-
if (notification.monitoredItems) {
|
|
25
|
-
for (const monitoredItem of notification.monitoredItems) {
|
|
26
|
-
if (monitoredItem.value.value && monitoredItem.value.value.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
|
|
27
|
-
dataValuesToPromote.push(monitoredItem.value);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else if (notification instanceof node_opcua_types_1.EventNotificationList) {
|
|
33
|
-
if (notification.events) {
|
|
34
|
-
for (const events of notification.events) {
|
|
35
|
-
if (events.eventFields) {
|
|
36
|
-
// eslint-disable-next-line max-depth
|
|
37
|
-
for (const eventField of events.eventFields) {
|
|
38
|
-
// eslint-disable-next-line max-depth
|
|
39
|
-
if (eventField.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
|
|
40
|
-
dataValuesToPromote.push({ value: eventField });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
yield (0, promote_opaque_structure_1.promoteOpaqueStructure)(session, dataValuesToPromote);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.promoteOpaqueStructureInNotificationData = promoteOpaqueStructureInNotificationData;
|
|
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.promoteOpaqueStructureInNotificationData = void 0;
|
|
13
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
14
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
15
|
+
const promote_opaque_structure_1 = require("./promote_opaque_structure");
|
|
16
|
+
function promoteOpaqueStructureInNotificationData(session, notificationData) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const dataValuesToPromote = [];
|
|
19
|
+
for (const notification of notificationData) {
|
|
20
|
+
if (!notification) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (notification instanceof node_opcua_types_1.DataChangeNotification) {
|
|
24
|
+
if (notification.monitoredItems) {
|
|
25
|
+
for (const monitoredItem of notification.monitoredItems) {
|
|
26
|
+
if (monitoredItem.value.value && monitoredItem.value.value.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
|
|
27
|
+
dataValuesToPromote.push(monitoredItem.value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (notification instanceof node_opcua_types_1.EventNotificationList) {
|
|
33
|
+
if (notification.events) {
|
|
34
|
+
for (const events of notification.events) {
|
|
35
|
+
if (events.eventFields) {
|
|
36
|
+
// eslint-disable-next-line max-depth
|
|
37
|
+
for (const eventField of events.eventFields) {
|
|
38
|
+
// eslint-disable-next-line max-depth
|
|
39
|
+
if (eventField.dataType === node_opcua_variant_1.DataType.ExtensionObject) {
|
|
40
|
+
dataValuesToPromote.push({ value: eventField });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
yield (0, promote_opaque_structure_1.promoteOpaqueStructure)(session, dataValuesToPromote);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.promoteOpaqueStructureInNotificationData = promoteOpaqueStructureInNotificationData;
|
|
52
52
|
//# sourceMappingURL=promote_opaque_structure_in_notification_data.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Variant } from "node-opcua-variant";
|
|
2
|
-
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
3
|
-
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
4
|
-
export declare function resolveDynamicExtensionObject(session: IBasicSession, variant: Variant, dataTypeManager: ExtraDataTypeManager): Promise<void>;
|
|
1
|
+
import { Variant } from "node-opcua-variant";
|
|
2
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
3
|
+
import { ExtraDataTypeManager } from "./extra_data_type_manager";
|
|
4
|
+
export declare function resolveDynamicExtensionObject(session: IBasicSession, variant: Variant, dataTypeManager: ExtraDataTypeManager): Promise<void>;
|