node-opcua-convert-nodeset-to-javascript 2.113.0 → 2.114.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/_dataType.js +113 -126
- package/dist/_dataType.js.map +1 -1
- package/dist/convert_namespace_to_typescript.js +147 -168
- package/dist/convert_namespace_to_typescript.js.map +1 -1
- package/dist/convert_to_typescript.js +418 -448
- package/dist/convert_to_typescript.js.map +1 -1
- package/dist/main.js +13 -21
- package/dist/main.js.map +1 -1
- package/dist/private/cache.js +30 -46
- package/dist/private/cache.js.map +1 -1
- package/dist/private/get_corresponding_data_type.js +79 -92
- package/dist/private/get_corresponding_data_type.js.map +1 -1
- package/dist/private/utils.js +179 -228
- package/dist/private/utils.js.map +1 -1
- package/dist/update_parent_tsconfig.js +39 -50
- package/dist/update_parent_tsconfig.js.map +1 -1
- package/dist/walk_through.js +46 -67
- package/dist/walk_through.js.map +1 -1
- package/package.json +17 -17
package/dist/private/utils.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getValueRank = exports.getChildrenOrFolderElements = exports._convertNodeIdToDataTypeAsync = exports.getTypeDefinition = exports.getTypeDefOrBaseType = exports.getSubtypeNodeId = exports.getSubtypeNodeIdIfAny = exports.extractBasicDataType = exports.isEnumeration = exports.isExtensionObject = exports.getModellingRule = exports.getFolderElements = exports.getChildren = exports.getNodeClass = exports.getDescription = exports.getIsAbstract = exports.getDataTypeNodeId = exports.getBrowseName = exports.getDefinition = void 0;
|
|
13
4
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
@@ -17,270 +8,230 @@ const node_opcua_types_1 = require("node-opcua-types");
|
|
|
17
8
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
18
9
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
19
10
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
20
|
-
function getDefinition(session, nodeId) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return dataValue.value.value || null;
|
|
24
|
-
});
|
|
11
|
+
async function getDefinition(session, nodeId) {
|
|
12
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition });
|
|
13
|
+
return dataValue.value.value || null;
|
|
25
14
|
}
|
|
26
15
|
exports.getDefinition = getDefinition;
|
|
27
|
-
function getBrowseName(session, nodeId) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return dataValue.value.value;
|
|
31
|
-
});
|
|
16
|
+
async function getBrowseName(session, nodeId) {
|
|
17
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName });
|
|
18
|
+
return dataValue.value.value;
|
|
32
19
|
}
|
|
33
20
|
exports.getBrowseName = getBrowseName;
|
|
34
|
-
function getDataTypeNodeId(session, nodeId) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return dataValue.value.value || null;
|
|
38
|
-
});
|
|
21
|
+
async function getDataTypeNodeId(session, nodeId) {
|
|
22
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.DataType });
|
|
23
|
+
return dataValue.value.value || null;
|
|
39
24
|
}
|
|
40
25
|
exports.getDataTypeNodeId = getDataTypeNodeId;
|
|
41
|
-
function getIsAbstract(session, nodeId) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return dataValue.value.value;
|
|
45
|
-
});
|
|
26
|
+
async function getIsAbstract(session, nodeId) {
|
|
27
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.IsAbstract });
|
|
28
|
+
return dataValue.value.value;
|
|
46
29
|
}
|
|
47
30
|
exports.getIsAbstract = getIsAbstract;
|
|
48
|
-
function getDescription(session, nodeId) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return dataValue.value.value;
|
|
52
|
-
});
|
|
31
|
+
async function getDescription(session, nodeId) {
|
|
32
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.Description });
|
|
33
|
+
return dataValue.value.value;
|
|
53
34
|
}
|
|
54
35
|
exports.getDescription = getDescription;
|
|
55
|
-
function getNodeClass(session, nodeId) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return dataValue.value.value;
|
|
59
|
-
});
|
|
36
|
+
async function getNodeClass(session, nodeId) {
|
|
37
|
+
const dataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.NodeClass });
|
|
38
|
+
return dataValue.value.value;
|
|
60
39
|
}
|
|
61
40
|
exports.getNodeClass = getNodeClass;
|
|
62
|
-
function getChildren(session, nodeId) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resultMask: 0xffff
|
|
71
|
-
});
|
|
72
|
-
return browseResult.references || [];
|
|
41
|
+
async function getChildren(session, nodeId) {
|
|
42
|
+
const browseResult = await session.browse({
|
|
43
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
44
|
+
includeSubtypes: true,
|
|
45
|
+
nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
|
|
46
|
+
nodeId,
|
|
47
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasChild"),
|
|
48
|
+
resultMask: 0xffff
|
|
73
49
|
});
|
|
50
|
+
return browseResult.references || [];
|
|
74
51
|
}
|
|
75
52
|
exports.getChildren = getChildren;
|
|
76
|
-
function getFolderElements(session, nodeId) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
resultMask: 0xffff
|
|
85
|
-
});
|
|
86
|
-
return browseResult.references || [];
|
|
53
|
+
async function getFolderElements(session, nodeId) {
|
|
54
|
+
const browseResult = await session.browse({
|
|
55
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
56
|
+
includeSubtypes: true,
|
|
57
|
+
nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
|
|
58
|
+
nodeId,
|
|
59
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("Organizes"),
|
|
60
|
+
resultMask: 0xffff
|
|
87
61
|
});
|
|
62
|
+
return browseResult.references || [];
|
|
88
63
|
}
|
|
89
64
|
exports.getFolderElements = getFolderElements;
|
|
90
|
-
function getModellingRule(session, nodeId) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return browseResult.references[0].browseName.name;
|
|
104
|
-
});
|
|
65
|
+
async function getModellingRule(session, nodeId) {
|
|
66
|
+
const browseResult = await session.browse({
|
|
67
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
68
|
+
includeSubtypes: true,
|
|
69
|
+
nodeClassMask: node_opcua_data_model_1.NodeClassMask.Method | node_opcua_data_model_1.NodeClassMask.Object | node_opcua_data_model_1.NodeClass.Variable,
|
|
70
|
+
nodeId,
|
|
71
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasModellingRule"),
|
|
72
|
+
resultMask: 0xffff
|
|
73
|
+
});
|
|
74
|
+
if (!browseResult.references || browseResult.references.length === 0) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return browseResult.references[0].browseName.name;
|
|
105
78
|
}
|
|
106
79
|
exports.getModellingRule = getModellingRule;
|
|
107
|
-
function isExtensionObject(session, nodeId) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return yield isExtensionObject(session, r.nodeId);
|
|
118
|
-
});
|
|
80
|
+
async function isExtensionObject(session, nodeId) {
|
|
81
|
+
const n = nodeId;
|
|
82
|
+
if (n.namespace === 0 && n.identifierType === node_opcua_nodeid_1.NodeIdType.NUMERIC && n.value === node_opcua_constants_1.DataTypeIds.Structure) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (n.namespace === 0 && n.identifierType === node_opcua_nodeid_1.NodeIdType.NUMERIC && n.value <= node_opcua_constants_1.DataTypeIds.DiagnosticInfo) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const r = await getSubtypeNodeIdIfAny(session, nodeId);
|
|
89
|
+
return await isExtensionObject(session, r.nodeId);
|
|
119
90
|
}
|
|
120
91
|
exports.isExtensionObject = isExtensionObject;
|
|
121
|
-
function isEnumeration(session, nodeId) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return yield isEnumeration(session, r.nodeId);
|
|
132
|
-
});
|
|
92
|
+
async function isEnumeration(session, nodeId) {
|
|
93
|
+
const n = nodeId;
|
|
94
|
+
if (n.namespace === 0 && n.identifierType === node_opcua_nodeid_1.NodeIdType.NUMERIC && n.value === node_opcua_constants_1.DataTypeIds.Enumeration) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
if (n.namespace === 0 && n.identifierType === node_opcua_nodeid_1.NodeIdType.NUMERIC && n.value <= node_opcua_constants_1.DataTypeIds.DiagnosticInfo) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const r = await getSubtypeNodeIdIfAny(session, nodeId);
|
|
101
|
+
return await isEnumeration(session, r.nodeId);
|
|
133
102
|
}
|
|
134
103
|
exports.isEnumeration = isEnumeration;
|
|
135
|
-
function extractBasicDataType(session, dataTypeNodeId) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return yield extractBasicDataType(session, r.nodeId);
|
|
143
|
-
});
|
|
104
|
+
async function extractBasicDataType(session, dataTypeNodeId) {
|
|
105
|
+
const n = dataTypeNodeId;
|
|
106
|
+
if (n.namespace === 0 && n.identifierType === node_opcua_nodeid_1.NodeIdType.NUMERIC && n.value <= node_opcua_constants_1.DataTypeIds.DiagnosticInfo) {
|
|
107
|
+
return dataTypeNodeId.value;
|
|
108
|
+
}
|
|
109
|
+
const r = await getSubtypeNodeIdIfAny(session, dataTypeNodeId);
|
|
110
|
+
return await extractBasicDataType(session, r.nodeId);
|
|
144
111
|
}
|
|
145
112
|
exports.extractBasicDataType = extractBasicDataType;
|
|
146
|
-
function getSubtypeNodeIdIfAny(session, nodeId) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return browseResult.references[0];
|
|
163
|
-
});
|
|
113
|
+
async function getSubtypeNodeIdIfAny(session, nodeId) {
|
|
114
|
+
if (nodeId.isEmpty()) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const browseResult = await session.browse({
|
|
118
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
|
|
119
|
+
includeSubtypes: true,
|
|
120
|
+
nodeClassMask: 0,
|
|
121
|
+
nodeId,
|
|
122
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
123
|
+
resultMask: 0xffff
|
|
124
|
+
});
|
|
125
|
+
if (!browseResult.references || browseResult.references.length === 0) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return browseResult.references[0];
|
|
164
129
|
}
|
|
165
130
|
exports.getSubtypeNodeIdIfAny = getSubtypeNodeIdIfAny;
|
|
166
|
-
function getSubtypeNodeId(session, nodeId) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return r;
|
|
173
|
-
});
|
|
131
|
+
async function getSubtypeNodeId(session, nodeId) {
|
|
132
|
+
const r = await getSubtypeNodeIdIfAny(session, nodeId);
|
|
133
|
+
if (!r) {
|
|
134
|
+
throw new Error("No Subtype");
|
|
135
|
+
}
|
|
136
|
+
return r;
|
|
174
137
|
}
|
|
175
138
|
exports.getSubtypeNodeId = getSubtypeNodeId;
|
|
176
|
-
function getTypeDefOrBaseType(session, nodeId) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
139
|
+
async function getTypeDefOrBaseType(session, nodeId) {
|
|
140
|
+
let browseResult = await session.browse({
|
|
141
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
142
|
+
includeSubtypes: true,
|
|
143
|
+
nodeClassMask: 0,
|
|
144
|
+
nodeId,
|
|
145
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasTypeDefinition"),
|
|
146
|
+
resultMask: 0xffff
|
|
147
|
+
});
|
|
148
|
+
if (!browseResult.references || browseResult.references.length === 0) {
|
|
149
|
+
browseResult = await session.browse({
|
|
150
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
|
|
180
151
|
includeSubtypes: true,
|
|
181
152
|
nodeClassMask: 0,
|
|
182
153
|
nodeId,
|
|
183
|
-
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("
|
|
154
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
184
155
|
resultMask: 0xffff
|
|
185
156
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
nodeId,
|
|
192
|
-
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
193
|
-
resultMask: 0xffff
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
if (!browseResult.references || browseResult.references.length === 0) {
|
|
197
|
-
return new node_opcua_types_1.ReferenceDescription({});
|
|
198
|
-
}
|
|
199
|
-
return browseResult.references[0];
|
|
200
|
-
});
|
|
157
|
+
}
|
|
158
|
+
if (!browseResult.references || browseResult.references.length === 0) {
|
|
159
|
+
return new node_opcua_types_1.ReferenceDescription({});
|
|
160
|
+
}
|
|
161
|
+
return browseResult.references[0];
|
|
201
162
|
}
|
|
202
163
|
exports.getTypeDefOrBaseType = getTypeDefOrBaseType;
|
|
203
|
-
function getTypeDefinition(session, nodeId) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return browseResult.references[0];
|
|
218
|
-
});
|
|
164
|
+
async function getTypeDefinition(session, nodeId) {
|
|
165
|
+
const browseResult = await session.browse({
|
|
166
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
|
|
167
|
+
includeSubtypes: true,
|
|
168
|
+
nodeClassMask: 0,
|
|
169
|
+
nodeId,
|
|
170
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasTypeDefinition"),
|
|
171
|
+
resultMask: 0xffff
|
|
172
|
+
});
|
|
173
|
+
if (!browseResult.references || browseResult.references.length === 0) {
|
|
174
|
+
debugLog("no subtype", nodeId.toString());
|
|
175
|
+
throw new Error("No subtype");
|
|
176
|
+
}
|
|
177
|
+
return browseResult.references[0];
|
|
219
178
|
}
|
|
220
179
|
exports.getTypeDefinition = getTypeDefinition;
|
|
221
|
-
function readBrowseName(session, nodeId) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return dataTypeName;
|
|
234
|
-
});
|
|
180
|
+
async function readBrowseName(session, nodeId) {
|
|
181
|
+
const nodeToRead = {
|
|
182
|
+
attributeId: node_opcua_data_model_1.AttributeIds.BrowseName,
|
|
183
|
+
nodeId
|
|
184
|
+
};
|
|
185
|
+
const dataValue = await session.read(nodeToRead);
|
|
186
|
+
// istanbul ignore next
|
|
187
|
+
if (dataValue.statusCode.isNotGood()) {
|
|
188
|
+
return new node_opcua_data_model_1.QualifiedName({ name: "", namespaceIndex: 0 });
|
|
189
|
+
}
|
|
190
|
+
const dataTypeName = dataValue.value.value;
|
|
191
|
+
return dataTypeName;
|
|
235
192
|
}
|
|
236
193
|
// see also client-proxy
|
|
237
|
-
function _convertNodeIdToDataTypeAsync(session, dataTypeId) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return info;
|
|
268
|
-
});
|
|
194
|
+
async function _convertNodeIdToDataTypeAsync(session, dataTypeId) {
|
|
195
|
+
const dataTypeName = await readBrowseName(session, dataTypeId);
|
|
196
|
+
let dataType;
|
|
197
|
+
if (dataTypeId.namespace === 0 && dataTypeId.value === node_opcua_constants_1.DataTypeIds.Enumeration) {
|
|
198
|
+
return { dataType: node_opcua_variant_1.DataType.Int32, enumerationId: dataTypeId };
|
|
199
|
+
}
|
|
200
|
+
if (dataTypeId.namespace === 0 && node_opcua_variant_1.DataType[dataTypeId.value]) {
|
|
201
|
+
dataType = dataTypeId.value;
|
|
202
|
+
return { dataType };
|
|
203
|
+
}
|
|
204
|
+
/// example => Duration (i=290) => Double (i=11)
|
|
205
|
+
// read subTypeOf
|
|
206
|
+
const nodeToBrowse = {
|
|
207
|
+
browseDirection: node_opcua_data_model_1.BrowseDirection.Inverse,
|
|
208
|
+
nodeId: dataTypeId,
|
|
209
|
+
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasSubtype"),
|
|
210
|
+
resultMask: 0xff
|
|
211
|
+
};
|
|
212
|
+
// tslint:disable:no-shadowed-variable
|
|
213
|
+
const browseResult = await session.browse(nodeToBrowse);
|
|
214
|
+
const references = browseResult.references;
|
|
215
|
+
if (!references || references.length !== 1) {
|
|
216
|
+
throw new Error("cannot find SuperType of " + dataTypeName.toString());
|
|
217
|
+
}
|
|
218
|
+
const nodeId = references[0].nodeId;
|
|
219
|
+
const info = await _convertNodeIdToDataTypeAsync(session, nodeId);
|
|
220
|
+
if (info.enumerationId) {
|
|
221
|
+
return { ...info, enumerationId: dataTypeId, enumerationType: dataTypeName.name };
|
|
222
|
+
}
|
|
223
|
+
return info;
|
|
269
224
|
}
|
|
270
225
|
exports._convertNodeIdToDataTypeAsync = _convertNodeIdToDataTypeAsync;
|
|
271
|
-
function getChildrenOrFolderElements(session, nodeId) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return [].concat(c1, c2);
|
|
276
|
-
});
|
|
226
|
+
async function getChildrenOrFolderElements(session, nodeId) {
|
|
227
|
+
const c1 = await getChildren(session, nodeId);
|
|
228
|
+
const c2 = await getFolderElements(session, nodeId);
|
|
229
|
+
return [].concat(c1, c2);
|
|
277
230
|
}
|
|
278
231
|
exports.getChildrenOrFolderElements = getChildrenOrFolderElements;
|
|
279
|
-
function getValueRank(session, nodeId) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
return valueRankDataValue.value.value;
|
|
283
|
-
});
|
|
232
|
+
async function getValueRank(session, nodeId) {
|
|
233
|
+
const valueRankDataValue = await session.read({ nodeId, attributeId: node_opcua_data_model_1.AttributeIds.ValueRank });
|
|
234
|
+
return valueRankDataValue.value.value;
|
|
284
235
|
}
|
|
285
236
|
exports.getValueRank = getValueRank;
|
|
286
237
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/private/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/private/utils.ts"],"names":[],"mappings":";;;AAAA,iEAA8H;AAC9H,yDAA+E;AAC/E,+DAAmD;AAEnD,uDAA0F;AAE1F,2DAA8C;AAC9C,uDAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAEpC,KAAK,UAAU,aAAa,CAAC,OAAsB,EAAE,MAAc;IACtE,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,oCAAY,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC/F,OAAQ,SAAS,CAAC,KAAK,CAAC,KAA4B,IAAI,IAAI,C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;IAC9C,MAAM,EAAE,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpD,OAAgC,EAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AAJD,kEAIC;AACM,KAAK,UAAU,YAAY,CAAC,OAAsB,EAAE,MAAc;IACrE,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,oCAAY,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/F,OAAO,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;AAC1C,CAAC;AAHD,oCAGC"}
|
|
@@ -24,15 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
__setModuleDefault(result, mod);
|
|
25
25
|
return result;
|
|
26
26
|
};
|
|
27
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
28
|
exports.updateParentTSConfig = void 0;
|
|
38
29
|
const fs_1 = require("fs");
|
|
@@ -42,50 +33,48 @@ const path = __importStar(require("path"));
|
|
|
42
33
|
//import { fileURLToPath } from 'url';
|
|
43
34
|
//const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
44
35
|
const node_opcua_nodesets_1 = require("node-opcua-nodesets");
|
|
45
|
-
function updateParentTSConfig() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
unlistedReferences.push({ path: meta.packageName });
|
|
65
|
-
}
|
|
36
|
+
async function updateParentTSConfig() {
|
|
37
|
+
const packagesFolder = path.join(__dirname, '..', '..');
|
|
38
|
+
const parentTSConfigFile = path.join(packagesFolder, 'tsconfig.json');
|
|
39
|
+
const parentTSConfig = JSON.parse(
|
|
40
|
+
// Strip out comments to avoid JSON parsing error
|
|
41
|
+
// TODO: Preserve comments automatically
|
|
42
|
+
(await readFile(parentTSConfigFile, 'utf8'))
|
|
43
|
+
.replace(/\/\*.+?\*\//g, '')
|
|
44
|
+
.replace(/\/\/.+?$/g, ''));
|
|
45
|
+
const unlistedReferences = [];
|
|
46
|
+
for (const meta of node_opcua_nodesets_1.allNodesetMeta) {
|
|
47
|
+
const nodesetPackageFolder = path.join(packagesFolder, meta.packageName);
|
|
48
|
+
if (!(0, fs_1.existsSync)(nodesetPackageFolder)) {
|
|
49
|
+
console.log(`Ignoring ${meta.packageName} since package folder does not exist (${nodesetPackageFolder})`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!parentTSConfig.references.some((ref) => ref.path === meta.packageName)) {
|
|
53
|
+
console.log(`Found nodeset package that was not listed in tsconfig.json: ${meta.packageName}`);
|
|
54
|
+
unlistedReferences.push({ path: meta.packageName });
|
|
66
55
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (a.path > b.path) {
|
|
72
|
-
return 1;
|
|
73
|
-
}
|
|
74
|
-
return 0;
|
|
56
|
+
}
|
|
57
|
+
function compareByPath(a, b) {
|
|
58
|
+
if (a.path < b.path) {
|
|
59
|
+
return -1;
|
|
75
60
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
parentTSConfig.references.sort(compareByPath);
|
|
79
|
-
// Maintain the compact style `{ "path": "node-opcua-X" }` in references section
|
|
80
|
-
// Also add the comment about Istanbul back
|
|
81
|
-
const newJSON = JSON.stringify(parentTSConfig, null, " ")
|
|
82
|
-
.replace('"removeComments": false', '"removeComments": false /* to prevent Istanbul ignore statements in comments from disappearing */')
|
|
83
|
-
.replace(/{\s*"path":\s*"([^"]+)"\s*}/g, '{ "path": "$1" }')
|
|
84
|
-
+ '\n';
|
|
85
|
-
//console.log('Writing updated tsconfig.json file:', newJSON);
|
|
86
|
-
yield writeFile(parentTSConfigFile, newJSON, 'utf8');
|
|
61
|
+
if (a.path > b.path) {
|
|
62
|
+
return 1;
|
|
87
63
|
}
|
|
88
|
-
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
if (unlistedReferences.length > 0) {
|
|
67
|
+
parentTSConfig.references.push(...unlistedReferences);
|
|
68
|
+
parentTSConfig.references.sort(compareByPath);
|
|
69
|
+
// Maintain the compact style `{ "path": "node-opcua-X" }` in references section
|
|
70
|
+
// Also add the comment about Istanbul back
|
|
71
|
+
const newJSON = JSON.stringify(parentTSConfig, null, " ")
|
|
72
|
+
.replace('"removeComments": false', '"removeComments": false /* to prevent Istanbul ignore statements in comments from disappearing */')
|
|
73
|
+
.replace(/{\s*"path":\s*"([^"]+)"\s*}/g, '{ "path": "$1" }')
|
|
74
|
+
+ '\n';
|
|
75
|
+
//console.log('Writing updated tsconfig.json file:', newJSON);
|
|
76
|
+
await writeFile(parentTSConfigFile, newJSON, 'utf8');
|
|
77
|
+
}
|
|
89
78
|
}
|
|
90
79
|
exports.updateParentTSConfig = updateParentTSConfig;
|
|
91
80
|
//# sourceMappingURL=update_parent_tsconfig.js.map
|