opcua-webapi-ts 1.1.16 → 1.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cjs/client/UaWebClient.js +2 -92
  2. package/dist/cjs/client/utils/UaDataTypeDictionary.js +11 -11
  3. package/dist/cjs/client/utils/UaModelling.js +129 -0
  4. package/dist/cjs/client/utils/UaNodeReader.js +66 -60
  5. package/dist/cjs/client/utils/UaObjectTypeDictionary.js +11 -11
  6. package/dist/cjs/client/utils/UaReferenceTypeDictionary.js +11 -11
  7. package/dist/cjs/common/nodes/UaDataType.js +2 -2
  8. package/dist/cjs/common/nodes/UaNode.js +27 -6
  9. package/dist/cjs/common/nodes/UaObjectType.js +7 -0
  10. package/dist/cjs/common/payload/UaDeleteNodesItem.js +1 -1
  11. package/dist/cjs/common/types/UaModellingRule.js +10 -0
  12. package/dist/cjs/common/types/index.js +1 -1
  13. package/dist/client/UaWebClient.d.ts +7 -5
  14. package/dist/client/UaWebClient.js +2 -92
  15. package/dist/client/utils/UaDataTypeDictionary.d.ts +3 -3
  16. package/dist/client/utils/UaDataTypeDictionary.js +11 -11
  17. package/dist/client/utils/UaModelling.d.ts +13 -0
  18. package/dist/client/utils/UaModelling.js +129 -0
  19. package/dist/client/utils/UaNodeReader.d.ts +17 -12
  20. package/dist/client/utils/UaNodeReader.js +66 -60
  21. package/dist/client/utils/UaObjectTypeDictionary.d.ts +3 -3
  22. package/dist/client/utils/UaObjectTypeDictionary.js +11 -11
  23. package/dist/client/utils/UaReferenceTypeDictionary.d.ts +3 -3
  24. package/dist/client/utils/UaReferenceTypeDictionary.js +11 -11
  25. package/dist/common/nodes/UaAttributes.d.ts +0 -4
  26. package/dist/common/nodes/UaDataType.d.ts +1 -1
  27. package/dist/common/nodes/UaDataType.js +2 -2
  28. package/dist/common/nodes/UaNode.d.ts +10 -6
  29. package/dist/common/nodes/UaNode.js +27 -6
  30. package/dist/common/nodes/UaObjectType.d.ts +3 -0
  31. package/dist/common/nodes/UaObjectType.js +7 -0
  32. package/dist/common/payload/UaDeleteNodesItem.d.ts +1 -1
  33. package/dist/common/payload/UaDeleteNodesItem.js +1 -1
  34. package/dist/common/types/UaModellingRule.d.ts +6 -0
  35. package/dist/common/types/UaModellingRule.js +10 -0
  36. package/dist/common/types/index.d.ts +1 -1
  37. package/dist/common/types/index.js +1 -1
  38. package/package.json +1 -1
@@ -9,16 +9,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.UaTypeReader = exports.UaObjectReader = exports.UaNodeReader = exports.UaLinkBrowser = exports.UaChildBrowser = exports.UaNodeReferenceBrowser = void 0;
12
+ exports.UaTypeReader = exports.UaObjectReader = exports.UaNodeReader = exports.UaSubtypeBrowser = exports.UaLinkBrowser = exports.UaChildBrowser = exports.UaNodeReferenceBrowser = void 0;
13
13
  const opcua_webapi_1 = require("opcua-webapi");
14
14
  const common_1 = require("../../common");
15
15
  class UaNodeReferenceBrowser {
16
- constructor(nodeIds, referenceType, nodeClassToReturn, returnDescription, maxNodesPerBrowse, maxReferencesPerNode) {
16
+ constructor(client, nodeIds, referenceType, nodeClassToReturn, returnDescription, maxNodesPerBrowse, maxReferencesPerNode) {
17
+ this._client = client;
17
18
  this._nodesToBrowse = [];
18
19
  this._referenceType = referenceType;
19
20
  this._nodeClassToReturn = nodeClassToReturn;
20
21
  this._continuationPointToBrowse = [];
21
- this._returnDescription = returnDescription;
22
+ this._returnDescription = returnDescription !== null && returnDescription !== void 0 ? returnDescription : false;
22
23
  this._maxNodesPerBrowse = (null == maxNodesPerBrowse || maxNodesPerBrowse <= 0) ? 50 : maxNodesPerBrowse;
23
24
  this._maxReferencesPerNode = (null == maxReferencesPerNode || maxReferencesPerNode < 0) ? 50 : maxReferencesPerNode;
24
25
  this._readResults = new Map();
@@ -32,21 +33,21 @@ class UaNodeReferenceBrowser {
32
33
  }
33
34
  }
34
35
  }
35
- browse(client) {
36
+ browse() {
36
37
  return __awaiter(this, void 0, void 0, function* () {
37
38
  if (this.isFinish())
38
39
  return;
39
- yield this.browseOnce(client);
40
- yield this.browse(client);
40
+ yield this.browseOnce();
41
+ yield this.browse();
41
42
  });
42
43
  }
43
- browseOnce(client) {
44
+ browseOnce() {
44
45
  return __awaiter(this, void 0, void 0, function* () {
45
- if (this._nodesToBrowse.length != 0) {
46
- yield this._browseNodes(client);
46
+ if (this._continuationPointToBrowse.length != 0) {
47
+ yield this._browseContinuationPoints();
47
48
  }
48
- else if (this._continuationPointToBrowse.length != 0) {
49
- yield this._browseContinuationPoints(client);
49
+ else if (this._nodesToBrowse.length != 0) {
50
+ yield this._browseNodes();
50
51
  }
51
52
  });
52
53
  }
@@ -64,18 +65,16 @@ class UaNodeReferenceBrowser {
64
65
  isFinish() {
65
66
  return (this._nodesToBrowse.length == 0) && (this._continuationPointToBrowse.length == 0);
66
67
  }
67
- _browseNodes(client) {
68
+ _browseNodes() {
68
69
  return __awaiter(this, void 0, void 0, function* () {
69
70
  var _a;
70
- if (this._nodesToBrowse.length == 0)
71
- return;
72
71
  let nodesToBrowse = this._nodesToBrowse.splice(0, this._maxNodesPerBrowse);
73
72
  let browseDescriptions = [];
74
73
  for (let item of nodesToBrowse) {
75
74
  let browseDescription = new common_1.UaBrowseDescription(item, opcua_webapi_1.BrowseDirection.Forward, this._referenceType, true, this._nodeClassToReturn, 63);
76
75
  browseDescriptions.push(browseDescription);
77
76
  }
78
- let results = yield client.browse(browseDescriptions, this._maxReferencesPerNode);
77
+ let results = yield this._client.browse(browseDescriptions, this._maxReferencesPerNode);
79
78
  for (let i = 0; i < nodesToBrowse.length; ++i) {
80
79
  let currentNodeId = nodesToBrowse[i];
81
80
  let currentResult = results[i];
@@ -103,11 +102,11 @@ class UaNodeReferenceBrowser {
103
102
  });
104
103
  }
105
104
  if (this._returnDescription)
106
- yield this._readDescriptions(client, newReferences);
105
+ yield this._readDescriptions(newReferences);
107
106
  }
108
107
  });
109
108
  }
110
- _browseContinuationPoints(client) {
109
+ _browseContinuationPoints() {
111
110
  return __awaiter(this, void 0, void 0, function* () {
112
111
  var _a;
113
112
  let cpsToBrowse = this._continuationPointToBrowse.splice(0, this._maxNodesPerBrowse);
@@ -115,7 +114,7 @@ class UaNodeReferenceBrowser {
115
114
  for (let item of cpsToBrowse) {
116
115
  continuationPoints.push(item.continuationPoint);
117
116
  }
118
- let results = yield client.browseNext(continuationPoints, false);
117
+ let results = yield this._client.browseNext(continuationPoints, false);
119
118
  for (let i = 0; i < cpsToBrowse.length; ++i) {
120
119
  let currentNodeId = cpsToBrowse[i].nodeId;
121
120
  let currentResult = results[i];
@@ -143,11 +142,11 @@ class UaNodeReferenceBrowser {
143
142
  });
144
143
  }
145
144
  if (this._returnDescription)
146
- yield this._readDescriptions(client, newReferences);
145
+ yield this._readDescriptions(newReferences);
147
146
  }
148
147
  });
149
148
  }
150
- _readDescriptions(client, references) {
149
+ _readDescriptions(references) {
151
150
  return __awaiter(this, void 0, void 0, function* () {
152
151
  if (references.length === 0)
153
152
  return;
@@ -155,7 +154,7 @@ class UaNodeReferenceBrowser {
155
154
  for (let item of references) {
156
155
  nodesToRead.push(new common_1.UaReadValueId(item.nodeId, opcua_webapi_1.Attributes.Description));
157
156
  }
158
- let dataValues = yield client.read(nodesToRead);
157
+ let dataValues = yield this._client.read(nodesToRead);
159
158
  for (let i = 0; i < references.length; ++i) {
160
159
  if (dataValues[i].statusCode.isGood()) {
161
160
  let description = dataValues[i].value.toLocalizedText();
@@ -168,19 +167,26 @@ class UaNodeReferenceBrowser {
168
167
  }
169
168
  exports.UaNodeReferenceBrowser = UaNodeReferenceBrowser;
170
169
  class UaChildBrowser extends UaNodeReferenceBrowser {
171
- constructor(nodeIds, returnDescription) {
172
- super(nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), opcua_webapi_1.NodeClass.Object | opcua_webapi_1.NodeClass.ObjectType | opcua_webapi_1.NodeClass.VariableType | opcua_webapi_1.NodeClass.DataType | opcua_webapi_1.NodeClass.ReferenceType, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, 20);
170
+ constructor(client, nodeIds, returnDescription) {
171
+ super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), opcua_webapi_1.NodeClass.Object, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, 20);
173
172
  }
174
173
  }
175
174
  exports.UaChildBrowser = UaChildBrowser;
176
175
  class UaLinkBrowser extends UaNodeReferenceBrowser {
177
- constructor(nodeIds, returnDescription) {
178
- super(nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.NonHierarchicalReferences), opcua_webapi_1.NodeClass.Object, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, 20);
176
+ constructor(client, nodeIds, returnDescription) {
177
+ super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.NonHierarchicalReferences), opcua_webapi_1.NodeClass.Object, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, 20);
179
178
  }
180
179
  }
181
180
  exports.UaLinkBrowser = UaLinkBrowser;
181
+ class UaSubtypeBrowser extends UaNodeReferenceBrowser {
182
+ constructor(client, nodeIds, returnDescription) {
183
+ super(client, nodeIds, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), opcua_webapi_1.NodeClass.ObjectType | opcua_webapi_1.NodeClass.VariableType | opcua_webapi_1.NodeClass.DataType | opcua_webapi_1.NodeClass.ReferenceType, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, 20);
184
+ }
185
+ }
186
+ exports.UaSubtypeBrowser = UaSubtypeBrowser;
182
187
  class UaNodeReader {
183
- constructor(returnDescription, returnVariable, returnMethod, returnAttributes, returnValue) {
188
+ constructor(client, returnDescription, returnVariable, returnMethod, returnAttributes, returnValue) {
189
+ this._client = client;
184
190
  this._returnDescription = (returnDescription) ? returnDescription : false;
185
191
  this._returnAttributes = (returnAttributes) ? returnAttributes : false;
186
192
  this._returnValue = (returnValue) ? returnValue : false;
@@ -203,7 +209,7 @@ class UaNodeReader {
203
209
  UaNodeReader.s_variablesNameToRead.add("EnumValues");
204
210
  }
205
211
  }
206
- read(nodeIds, client) {
212
+ read(nodeIds) {
207
213
  return __awaiter(this, void 0, void 0, function* () {
208
214
  if (nodeIds.length == 0)
209
215
  return [];
@@ -215,11 +221,11 @@ class UaNodeReader {
215
221
  nodeIdsToRead.push(item);
216
222
  nodeIdsSet.add(item.toString());
217
223
  }
218
- let rootReferences = yield this._readRootNodes(nodeIdsToRead, client);
219
- return yield this.readByReferences(rootReferences, client);
224
+ let rootReferences = yield this._readRootNodes(nodeIdsToRead);
225
+ return yield this.readByReferences(rootReferences);
220
226
  });
221
227
  }
222
- readByReferences(references, client) {
228
+ readByReferences(references) {
223
229
  return __awaiter(this, void 0, void 0, function* () {
224
230
  if (references.length == 0)
225
231
  return [];
@@ -233,8 +239,8 @@ class UaNodeReader {
233
239
  nodeIdsToBrowse.push(item.nodeId);
234
240
  nodeIdsSet.add(item.nodeId.toString());
235
241
  }
236
- let nodeReferenceBrowser = new UaNodeReferenceBrowser(nodeIdsToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), this._nodeClassToReturn, false);
237
- yield nodeReferenceBrowser.browse(client);
242
+ let nodeReferenceBrowser = new UaNodeReferenceBrowser(this._client, nodeIdsToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), this._nodeClassToReturn, false);
243
+ yield nodeReferenceBrowser.browse();
238
244
  let childReferences = nodeReferenceBrowser.results();
239
245
  let childNodesToBrowse = [];
240
246
  for (let item of childReferences) {
@@ -250,8 +256,8 @@ class UaNodeReader {
250
256
  }
251
257
  let variableReferences = [];
252
258
  if (childNodesToBrowse.length != 0) {
253
- let childReferenceBrowser = new UaNodeReferenceBrowser(childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), opcua_webapi_1.NodeClass.Variable, false);
254
- yield childReferenceBrowser.browse(client);
259
+ let childReferenceBrowser = new UaNodeReferenceBrowser(this._client, childNodesToBrowse, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HierarchicalReferences), opcua_webapi_1.NodeClass.Variable, false);
260
+ yield childReferenceBrowser.browse();
255
261
  variableReferences = childReferenceBrowser.results();
256
262
  }
257
263
  let allReferences = [];
@@ -270,7 +276,7 @@ class UaNodeReader {
270
276
  ;
271
277
  }
272
278
  let nodesMap = new Map();
273
- yield this._readNodes(allReferences, nodesMap, client);
279
+ yield this._readNodes(allReferences, nodesMap);
274
280
  for (let item of variableReferences) {
275
281
  this._buildNodeTree(item, nodesMap);
276
282
  }
@@ -286,7 +292,7 @@ class UaNodeReader {
286
292
  return rootNodes;
287
293
  });
288
294
  }
289
- _readRootNodes(nodeIds, client) {
295
+ _readRootNodes(nodeIds) {
290
296
  return __awaiter(this, void 0, void 0, function* () {
291
297
  let nodesToRead = [];
292
298
  for (let item of nodeIds) {
@@ -294,7 +300,7 @@ class UaNodeReader {
294
300
  nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.BrowseName));
295
301
  nodesToRead.push(new common_1.UaReadValueId(item, opcua_webapi_1.Attributes.DisplayName));
296
302
  }
297
- let dataValues = yield client.read(nodesToRead);
303
+ let dataValues = yield this._client.read(nodesToRead);
298
304
  let references = [];
299
305
  let typeDefinitionsToRead = [];
300
306
  for (let i = 0; i < nodeIds.length; ++i) {
@@ -327,7 +333,7 @@ class UaNodeReader {
327
333
  let browseDescription = new common_1.UaBrowseDescription(item.nodeId, opcua_webapi_1.BrowseDirection.Forward, common_1.UaNodeId.from(common_1.ReferenceTypeIds.HasTypeDefinition), false, opcua_webapi_1.NodeClass.ObjectType, 0);
328
334
  browseDescriptions.push(browseDescription);
329
335
  }
330
- let results = yield client.browse(browseDescriptions);
336
+ let results = yield this._client.browse(browseDescriptions);
331
337
  for (let i = 0; i < browseDescriptions.length; ++i) {
332
338
  if (results[i].statusCode.isNotGood())
333
339
  throw new common_1.UaError(results[i].statusCode);
@@ -339,7 +345,7 @@ class UaNodeReader {
339
345
  return references;
340
346
  });
341
347
  }
342
- _readNodes(references, nodes, client) {
348
+ _readNodes(references, nodes) {
343
349
  return __awaiter(this, void 0, void 0, function* () {
344
350
  if (references.length == 0)
345
351
  return;
@@ -348,14 +354,14 @@ class UaNodeReader {
348
354
  refrencesToRead.push(references.splice(0, 100));
349
355
  }
350
356
  for (let item of refrencesToRead) {
351
- yield this._readTypes(item, nodes, client);
352
- yield this._readObjects(item, nodes, client);
353
- yield this._readVariables(item, nodes, client);
354
- yield this._readMethods(item, nodes, client);
357
+ yield this._readTypes(item, nodes);
358
+ yield this._readObjects(item, nodes);
359
+ yield this._readVariables(item, nodes);
360
+ yield this._readMethods(item, nodes);
355
361
  }
356
362
  });
357
363
  }
358
- _readTypes(references, nodes, client) {
364
+ _readTypes(references, nodes) {
359
365
  return __awaiter(this, void 0, void 0, function* () {
360
366
  let typesToRead = [];
361
367
  let needReadAttributes = this._returnAttributes || this._returnDescription;
@@ -380,7 +386,7 @@ class UaNodeReader {
380
386
  nodesToRead.push(new common_1.UaReadValueId(item.nodeId, opcua_webapi_1.Attributes.ValueRank));
381
387
  }
382
388
  }
383
- dataValues = yield client.read(nodesToRead);
389
+ dataValues = yield this._client.read(nodesToRead);
384
390
  }
385
391
  for (let i = 0; i < typesToRead.length; ++i) {
386
392
  let isAbstract = false;
@@ -435,7 +441,7 @@ class UaNodeReader {
435
441
  }
436
442
  });
437
443
  }
438
- _readObjects(references, nodes, client) {
444
+ _readObjects(references, nodes) {
439
445
  return __awaiter(this, void 0, void 0, function* () {
440
446
  let objectsToRead = [];
441
447
  for (let item of references) {
@@ -456,7 +462,7 @@ class UaNodeReader {
456
462
  }
457
463
  let dataValues = [];
458
464
  if (nodesToRead.length != 0) {
459
- dataValues = yield client.read(nodesToRead);
465
+ dataValues = yield this._client.read(nodesToRead);
460
466
  }
461
467
  for (let i = 0; i < objectsToRead.length; ++i) {
462
468
  let dataIndex = (this._returnAttributes && this._returnDescription) ? i * 2 : i;
@@ -483,7 +489,7 @@ class UaNodeReader {
483
489
  }
484
490
  });
485
491
  }
486
- _readVariables(references, nodes, client) {
492
+ _readVariables(references, nodes) {
487
493
  return __awaiter(this, void 0, void 0, function* () {
488
494
  let variablesToRead = [];
489
495
  let nodeIds = [];
@@ -497,7 +503,7 @@ class UaNodeReader {
497
503
  return;
498
504
  let results = [];
499
505
  if (this._returnAttributes) {
500
- results = yield client.readVariableAttributes(nodeIds);
506
+ results = yield this._client.readVariableAttributes(nodeIds);
501
507
  }
502
508
  let variablesToReadValue = [];
503
509
  for (let i = 0; i < variablesToRead.length; ++i) {
@@ -518,7 +524,7 @@ class UaNodeReader {
518
524
  for (let item of variablesToReadValue) {
519
525
  valuesToRead.push(item.nodeId);
520
526
  }
521
- let values = yield client.readValues(valuesToRead);
527
+ let values = yield this._client.readValues(valuesToRead);
522
528
  for (let i = 0; i < valuesToRead.length; ++i) {
523
529
  let variableNode = nodes.get(valuesToRead[i].toString());
524
530
  variableNode.dataValue = values[i];
@@ -526,7 +532,7 @@ class UaNodeReader {
526
532
  }
527
533
  });
528
534
  }
529
- _readMethods(references, nodes, client) {
535
+ _readMethods(references, nodes) {
530
536
  return __awaiter(this, void 0, void 0, function* () {
531
537
  let methodsToRead = [];
532
538
  for (let item of references) {
@@ -544,7 +550,7 @@ class UaNodeReader {
544
550
  }
545
551
  let dataValues = [];
546
552
  if (nodesToRead.length != 0) {
547
- dataValues = yield client.read(nodesToRead);
553
+ dataValues = yield this._client.read(nodesToRead);
548
554
  }
549
555
  for (let i = 0; i < methodsToRead.length; ++i) {
550
556
  let methodNode = new common_1.UaMethod(methodsToRead[i].nodeId, methodsToRead[i].browseName, methodsToRead[i].displayName);
@@ -613,15 +619,15 @@ exports.UaNodeReader = UaNodeReader;
613
619
  UaNodeReader.s_variableTypeWithoutMember = null;
614
620
  UaNodeReader.s_variablesNameToRead = null;
615
621
  class UaObjectReader extends UaNodeReader {
616
- constructor(returnDescription, returnValue) {
617
- super(returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, true, true, true, returnValue !== null && returnValue !== void 0 ? returnValue : false);
622
+ constructor(client, returnDescription, returnValue) {
623
+ super(client, returnDescription !== null && returnDescription !== void 0 ? returnDescription : false, true, true, true, returnValue !== null && returnValue !== void 0 ? returnValue : false);
618
624
  }
619
- read(nodeIds, client) {
625
+ read(nodeIds) {
620
626
  const _super = Object.create(null, {
621
627
  read: { get: () => super.read }
622
628
  });
623
629
  return __awaiter(this, void 0, void 0, function* () {
624
- let nodes = yield _super.read.call(this, nodeIds, client);
630
+ let nodes = yield _super.read.call(this, nodeIds);
625
631
  let objectNodes = [];
626
632
  for (let item of nodes) {
627
633
  if (item.nodeClass == opcua_webapi_1.NodeClass.Object) {
@@ -634,15 +640,15 @@ class UaObjectReader extends UaNodeReader {
634
640
  }
635
641
  exports.UaObjectReader = UaObjectReader;
636
642
  class UaTypeReader extends UaNodeReader {
637
- constructor() {
638
- super(true, true, true, true, false);
643
+ constructor(client) {
644
+ super(client, true, true, true, true, false);
639
645
  }
640
- read(nodeIds, client) {
646
+ read(nodeIds) {
641
647
  const _super = Object.create(null, {
642
648
  read: { get: () => super.read }
643
649
  });
644
650
  return __awaiter(this, void 0, void 0, function* () {
645
- let nodes = yield _super.read.call(this, nodeIds, client);
651
+ let nodes = yield _super.read.call(this, nodeIds);
646
652
  let typeNodes = [];
647
653
  for (let item of nodes) {
648
654
  if (item.nodeClass == opcua_webapi_1.NodeClass.ObjectType ||
@@ -14,16 +14,16 @@ const opcua_webapi_1 = require("opcua-webapi");
14
14
  const common_1 = require("../../common");
15
15
  const UaNodeReader_1 = require("./UaNodeReader");
16
16
  class UaObjectTypeDictionary {
17
- constructor(simpleMode) {
17
+ constructor(client) {
18
+ this._client = client;
18
19
  this._objectTypes = new Map;
19
- this._returnAllAttributes = (null == simpleMode) ? false : !simpleMode;
20
20
  let baseObjectTypeId = common_1.UaNodeId.from(common_1.ObjectTypeIds.BaseObjectType);
21
21
  this._objectTypes.set(baseObjectTypeId.toString(), new common_1.UaObjectType(baseObjectTypeId, "BaseObjectType", new common_1.UaLocalizedText("BaseObjectType"), false));
22
22
  }
23
- read(client) {
23
+ read() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- let browser = new UaNodeReader_1.UaChildBrowser([common_1.UaNodeId.from(common_1.ObjectTypeIds.BaseObjectType)]);
26
- yield this._read(browser, client);
25
+ let browser = new UaNodeReader_1.UaSubtypeBrowser(this._client, [common_1.UaNodeId.from(common_1.ObjectTypeIds.BaseObjectType)]);
26
+ yield this._read(browser);
27
27
  });
28
28
  }
29
29
  getObjectType(nodeId) {
@@ -33,10 +33,10 @@ class UaObjectTypeDictionary {
33
33
  getObjectTypes() {
34
34
  return [...this._objectTypes.values()];
35
35
  }
36
- _read(browser, client) {
36
+ _read(browser) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  // Browse child type
39
- yield browser.browse(client);
39
+ yield browser.browse();
40
40
  let results = browser.results();
41
41
  let referencesToRead = [];
42
42
  for (let item of results) {
@@ -47,8 +47,8 @@ class UaObjectTypeDictionary {
47
47
  return;
48
48
  // Read child type
49
49
  let nodeIdsToBrowse = [];
50
- let nodeReader = new UaNodeReader_1.UaNodeReader(this._returnAllAttributes, false, false, this._returnAllAttributes);
51
- let nodes = yield nodeReader.readByReferences(referencesToRead, client);
50
+ let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, false, false);
51
+ let nodes = yield nodeReader.readByReferences(referencesToRead);
52
52
  for (let node of nodes) {
53
53
  if (opcua_webapi_1.NodeClass.ObjectType != node.nodeClass)
54
54
  continue;
@@ -68,8 +68,8 @@ class UaObjectTypeDictionary {
68
68
  return;
69
69
  yield this.__delay(20);
70
70
  // Continue to browse and read child type
71
- let childBrowser = new UaNodeReader_1.UaChildBrowser(nodeIdsToBrowse);
72
- yield this._read(childBrowser, client);
71
+ let childBrowser = new UaNodeReader_1.UaSubtypeBrowser(this._client, nodeIdsToBrowse);
72
+ yield this._read(childBrowser);
73
73
  });
74
74
  }
75
75
  __delay(ms) {
@@ -14,16 +14,16 @@ const opcua_webapi_1 = require("opcua-webapi");
14
14
  const common_1 = require("../../common");
15
15
  const UaNodeReader_1 = require("./UaNodeReader");
16
16
  class UaReferenceTypeDictionary {
17
- constructor(simpleMode) {
17
+ constructor(client) {
18
+ this._client = client;
18
19
  this._referenceTypes = new Map;
19
- this._returnAllAttributes = (null == simpleMode) ? false : !simpleMode;
20
20
  let referencesId = common_1.UaNodeId.from(common_1.ReferenceTypeIds.References);
21
21
  this._referenceTypes.set(referencesId.toString(), new common_1.UaReferenceType(referencesId, "References", new common_1.UaLocalizedText("References"), true, common_1.UaLocalizedText.nullText, true));
22
22
  }
23
- read(client) {
23
+ read() {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- let browser = new UaNodeReader_1.UaChildBrowser([common_1.UaNodeId.from(common_1.ReferenceTypeIds.References)]);
26
- yield this._read(browser, client);
25
+ let browser = new UaNodeReader_1.UaChildBrowser(this._client, [common_1.UaNodeId.from(common_1.ReferenceTypeIds.References)]);
26
+ yield this._read(browser);
27
27
  });
28
28
  }
29
29
  getReferenceType(nodeId) {
@@ -33,10 +33,10 @@ class UaReferenceTypeDictionary {
33
33
  getReferenceTypes() {
34
34
  return [...this._referenceTypes.values()];
35
35
  }
36
- _read(browser, client) {
36
+ _read(browser) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  // Browse child type
39
- yield browser.browse(client);
39
+ yield browser.browse();
40
40
  let results = browser.results();
41
41
  let referencesToRead = [];
42
42
  for (let item of results) {
@@ -47,8 +47,8 @@ class UaReferenceTypeDictionary {
47
47
  return;
48
48
  // Read child type
49
49
  let nodeIdsToBrowse = [];
50
- let nodeReader = new UaNodeReader_1.UaNodeReader(this._returnAllAttributes, false, false, this._returnAllAttributes);
51
- let nodes = yield nodeReader.readByReferences(referencesToRead, client);
50
+ let nodeReader = new UaNodeReader_1.UaNodeReader(this._client, false, false, false, false, false);
51
+ let nodes = yield nodeReader.readByReferences(referencesToRead);
52
52
  for (let node of nodes) {
53
53
  if (opcua_webapi_1.NodeClass.ReferenceType != node.nodeClass)
54
54
  continue;
@@ -68,8 +68,8 @@ class UaReferenceTypeDictionary {
68
68
  return;
69
69
  yield this.__delay(20);
70
70
  // Continue to browse and read child type
71
- let childBrowser = new UaNodeReader_1.UaChildBrowser(nodeIdsToBrowse);
72
- yield this._read(childBrowser, client);
71
+ let childBrowser = new UaNodeReader_1.UaChildBrowser(this._client, nodeIdsToBrowse);
72
+ yield this._read(childBrowser);
73
73
  });
74
74
  }
75
75
  __delay(ms) {
@@ -6,8 +6,8 @@ const types_1 = require("../types");
6
6
  const _1 = require(".");
7
7
  const structure_1 = require("../structure");
8
8
  class UaDataType extends _1.UaDefintionNode {
9
- constructor(nodeId, browseName, displayName, isAbstract, writeMask) {
10
- super(nodeId, browseName, displayName, isAbstract, writeMask);
9
+ constructor(nodeId, browseName, displayName, isAbstract) {
10
+ super(nodeId, browseName, displayName, isAbstract);
11
11
  this._valueType = 0;
12
12
  this._enumValues = null;
13
13
  }
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UaInstanceNode = exports.UaDefintionNode = exports.UaNode = void 0;
4
+ const types_1 = require("../types");
5
+ const _1 = require(".");
4
6
  class UaNode {
5
- constructor(nodeId, browseName, displayName, writeMask) {
7
+ constructor(nodeId, browseName, displayName) {
6
8
  this._nodeId = nodeId;
7
9
  this._browseName = browseName;
8
10
  this._displayName = displayName;
9
11
  this._description = null;
10
- this._writeMask = (writeMask) ? writeMask : 0;
12
+ this._writeMask = null;
11
13
  this._parent = null;
12
14
  this._children = [];
13
15
  this._refToParent = null;
@@ -24,6 +26,9 @@ class UaNode {
24
26
  get writeMask() {
25
27
  return this._writeMask;
26
28
  }
29
+ set writeMask(writeMask) {
30
+ this._writeMask = writeMask;
31
+ }
27
32
  get description() {
28
33
  return this._description;
29
34
  }
@@ -39,8 +44,8 @@ class UaNode {
39
44
  }
40
45
  exports.UaNode = UaNode;
41
46
  class UaDefintionNode extends UaNode {
42
- constructor(nodeId, browseName, displayName, isAbstract, writeMask) {
43
- super(nodeId, browseName, displayName, writeMask);
47
+ constructor(nodeId, browseName, displayName, isAbstract) {
48
+ super(nodeId, browseName, displayName);
44
49
  this._isAbstract = isAbstract;
45
50
  }
46
51
  get isAbstract() {
@@ -80,8 +85,9 @@ class UaDefintionNode extends UaNode {
80
85
  }
81
86
  exports.UaDefintionNode = UaDefintionNode;
82
87
  class UaInstanceNode extends UaNode {
83
- constructor(nodeId, browseName, displayName, writeMask) {
84
- super(nodeId, browseName, displayName, writeMask);
88
+ constructor(nodeId, browseName, displayName) {
89
+ super(nodeId, browseName, displayName);
90
+ this._modellingRule = types_1.UaModellingRule.None;
85
91
  }
86
92
  getMembers(nodeClass) {
87
93
  let ret = [];
@@ -92,5 +98,20 @@ class UaInstanceNode extends UaNode {
92
98
  }
93
99
  return ret;
94
100
  }
101
+ get modellingRule() {
102
+ return this._modellingRule;
103
+ }
104
+ setModellingRule(modellingRuleId) {
105
+ if (modellingRuleId.equal(types_1.UaNodeId.from(_1.ObjectIds.ModellingRule_Mandatory)))
106
+ this._modellingRule = types_1.UaModellingRule.Mandatory;
107
+ else if (modellingRuleId.equal(types_1.UaNodeId.from(_1.ObjectIds.ModellingRule_Optional)))
108
+ this._modellingRule = types_1.UaModellingRule.Optional;
109
+ else if (modellingRuleId.equal(types_1.UaNodeId.from(_1.ObjectIds.ModellingRule_OptionalPlaceholder)))
110
+ this._modellingRule = types_1.UaModellingRule.PlaceHolder;
111
+ else if (modellingRuleId.equal(types_1.UaNodeId.from(_1.ObjectIds.ModellingRule_MandatoryPlaceholder)))
112
+ this._modellingRule = types_1.UaModellingRule.PlaceHolder;
113
+ else
114
+ this._modellingRule = types_1.UaModellingRule.None;
115
+ }
95
116
  }
96
117
  exports.UaInstanceNode = UaInstanceNode;
@@ -6,6 +6,7 @@ const _1 = require(".");
6
6
  class UaObjectType extends _1.UaDefintionNode {
7
7
  constructor(nodeId, browseName, displayName, isAbstract) {
8
8
  super(nodeId, browseName, displayName, isAbstract);
9
+ this._isObjectMemberRead = false;
9
10
  }
10
11
  get nodeClass() {
11
12
  return opcua_webapi_1.NodeClass.ObjectType;
@@ -40,6 +41,12 @@ class UaObjectType extends _1.UaDefintionNode {
40
41
  }
41
42
  return ret;
42
43
  }
44
+ get isObjectMemberRead() {
45
+ return this._isObjectMemberRead;
46
+ }
47
+ set isObjectMemberRead(value) {
48
+ this._isObjectMemberRead = value;
49
+ }
43
50
  toJson() {
44
51
  let children = [];
45
52
  for (let item of this._children) {
@@ -21,7 +21,7 @@ class UaDeleteNodesItem {
21
21
  };
22
22
  return item;
23
23
  }
24
- fromStruct(item) {
24
+ static fromStruct(item) {
25
25
  let nodeId = (0, types_1.parseUaNodeIdOrNull)(item.NodeId);
26
26
  if (!nodeId)
27
27
  return null;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaModellingRule = void 0;
4
+ var UaModellingRule;
5
+ (function (UaModellingRule) {
6
+ UaModellingRule[UaModellingRule["None"] = 0] = "None";
7
+ UaModellingRule[UaModellingRule["Mandatory"] = 1] = "Mandatory";
8
+ UaModellingRule[UaModellingRule["Optional"] = 2] = "Optional";
9
+ UaModellingRule[UaModellingRule["PlaceHolder"] = 3] = "PlaceHolder";
10
+ })(UaModellingRule || (exports.UaModellingRule = UaModellingRule = {}));
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./UaTypes"), exports);
18
17
  __exportStar(require("./UaDataValue"), exports);
19
18
  __exportStar(require("./UaError"), exports);
20
19
  __exportStar(require("./UaExpandedNodeId"), exports);
@@ -34,4 +33,5 @@ __exportStar(require("./UaBrowseMask"), exports);
34
33
  __exportStar(require("./UaValueRank"), exports);
35
34
  __exportStar(require("./UaWriteMask"), exports);
36
35
  __exportStar(require("./UaReference"), exports);
36
+ __exportStar(require("./UaModellingRule"), exports);
37
37
  __exportStar(require("./UaEventNotifier"), exports);
@@ -1,7 +1,13 @@
1
1
  import { ViewDescription, RequestHeader, ApplicationDescription, BrowseDirection, EndpointDescription } from "opcua-webapi";
2
- import { UaBrowseResult, OpcUaNodeAttributes, OpcUaVariableAttributes, UaNodeId, UaDataValue, UaVariant, UaStatusCode, UaExtensionObject, UaHistoryDataResult, UaQuery, UaMethodArguments, UaApplicationDescriptor, UaBrowseDescription, UaReadValueId, UaWriteValue, UaHistoryReadValueId, UaHistoryReadResult, UaLocalizedText, UaAddNodesItem, UaAddNodesResult, OpcUaObjectAttributes, UaDeleteNodesItem, UaAddReferencesItem, UaDeleteReferencesItem } from "../common";
2
+ import { UaBrowseResult, OpcUaNodeAttributes, OpcUaVariableAttributes, UaNodeId, UaDataValue, UaVariant, UaStatusCode, UaExtensionObject, UaHistoryDataResult, UaQuery, UaBrowseDescription, UaReadValueId, UaWriteValue, UaHistoryReadValueId, UaHistoryReadResult, UaLocalizedText, UaAddNodesItem, UaAddNodesResult, UaDeleteNodesItem, UaAddReferencesItem, UaDeleteReferencesItem } from "../common";
3
3
  import { UaClientConfiguration, UaClientParameters, UaWebClientApi } from "..";
4
4
  import { UaHistoryEventResult, UaCallMethodRequest, UaCallMethodResult } from "../common";
5
+ export type UaApplicationDescriptor = {
6
+ urls: Array<string>;
7
+ applicationUri: string;
8
+ applicationName: UaLocalizedText;
9
+ productUri: string;
10
+ };
5
11
  export declare class UaWebClient {
6
12
  private api;
7
13
  private clientConfig;
@@ -16,16 +22,12 @@ export declare class UaWebClient {
16
22
  writeValue(nodeId: UaNodeId, value: UaVariant): Promise<void>;
17
23
  readNodeAttributes(nodeId: UaNodeId, returnDescription?: boolean): Promise<OpcUaNodeAttributes>;
18
24
  readVariableAttributes(nodeIds: Array<UaNodeId>): Promise<Array<OpcUaVariableAttributes>>;
19
- readMethodArguments(nodeId: UaNodeId): Promise<UaMethodArguments>;
20
- readObjectAttributes(nodeId: UaNodeId): Promise<OpcUaObjectAttributes>;
21
25
  methodCall(objectId: UaNodeId, methodId: UaNodeId, inputArguments: Array<UaVariant>): Promise<Array<UaVariant>>;
22
26
  getGeneratedEventType(typeId: UaNodeId): Promise<Array<UaNodeId>>;
23
27
  historyReadRawData(nodeId: UaNodeId, startTime: Date, endTime: Date, numValuesPerNode?: number | null, continuationPoint?: string | null, returnBounds?: boolean | null, isReadModified?: boolean | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
24
28
  historyReadAtTime(nodeId: UaNodeId, requiredTimes: Array<Date>, useSimpleBounds?: boolean | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
25
29
  historyReadProcessed(nodeId: UaNodeId, startTime: Date, endTime: Date, processingInterval: number, aggregateType?: UaNodeId | null, continuationPoint?: string | null, timestampsToReturn?: number | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryDataResult>;
26
30
  historyReadEvent(nodeId: UaNodeId, startTime: Date, endTime: Date, select: Array<string>, where?: UaQuery | null, numValuesPerNode?: number | null, continuationPoint?: string | null, releaseContinuationPoints?: boolean | null): Promise<UaHistoryEventResult>;
27
- addObject(parentNodeId: UaNodeId, typeDefinitionNodeId: UaNodeId, displayName: UaLocalizedText, browseName?: string, referenceTypeId?: UaNodeId): Promise<UaNodeId>;
28
- deleteNode(nodeId: UaNodeId): Promise<void>;
29
31
  browse(nodesToBrowse: Array<UaBrowseDescription>, maxReferencesPerNode?: number, view?: ViewDescription, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
30
32
  browseNext(continuationPoints: Array<string>, releaseContinuationPoints: boolean, additionalParameters?: UaClientParameters): Promise<Array<UaBrowseResult>>;
31
33
  read(nodesToRead: Array<UaReadValueId>, timestampsToReturn?: number, maxAge?: number, additionalParameters?: UaClientParameters): Promise<Array<UaDataValue>>;