node-opcua-address-space 2.78.0 → 2.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/source/namespace_data_access.d.ts +2 -2
  2. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +1 -1
  3. package/dist/src/base_node_impl.d.ts +1 -0
  4. package/dist/src/base_node_impl.js +30 -3
  5. package/dist/src/base_node_impl.js.map +1 -1
  6. package/dist/src/historical_access/address_space_historical_data_node.d.ts +1 -1
  7. package/dist/src/historical_access/address_space_historical_data_node.js +46 -24
  8. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -1
  9. package/dist/src/nodeset_tools/nodeset_to_xml.js +45 -9
  10. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
  11. package/dist/src/ua_method_impl.d.ts +2 -1
  12. package/dist/src/ua_method_impl.js +9 -1
  13. package/dist/src/ua_method_impl.js.map +1 -1
  14. package/dist/src/ua_variable_impl.d.ts +5 -0
  15. package/dist/src/ua_variable_impl.js +32 -2
  16. package/dist/src/ua_variable_impl.js.map +1 -1
  17. package/package.json +26 -26
  18. package/source/namespace_data_access.ts +2 -2
  19. package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +1 -1
  20. package/src/base_node_impl.ts +34 -3
  21. package/src/historical_access/address_space_historical_data_node.ts +19 -4
  22. package/src/nodeset_tools/nodeset_to_xml.ts +57 -13
  23. package/src/ua_method_impl.ts +9 -3
  24. package/src/ua_variable_impl.ts +36 -4
  25. package/test_helpers/test_fixtures/mini.Node.Set2.xml +178 -0
  26. package/dist/source/helpers/check_event_clause.d.ts +0 -17
  27. package/dist/source/helpers/check_event_clause.js +0 -53
  28. package/dist/source/helpers/check_event_clause.js.map +0 -1
  29. package/dist/src/alarms_and_conditions/check_where_clause.d.ts +0 -4
  30. package/dist/src/alarms_and_conditions/check_where_clause.js +0 -110
  31. package/dist/src/alarms_and_conditions/check_where_clause.js.map +0 -1
  32. package/dist/src/alarms_and_conditions/condition_info.d.ts +0 -27
  33. package/dist/src/alarms_and_conditions/condition_info.js +0 -55
  34. package/dist/src/alarms_and_conditions/condition_info.js.map +0 -1
  35. package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +0 -233
  36. package/dist/src/alarms_and_conditions/condition_snapshot.js +0 -667
  37. package/dist/src/alarms_and_conditions/condition_snapshot.js.map +0 -1
  38. package/dist/src/alarms_and_conditions/extract_event_fields.d.ts +0 -10
  39. package/dist/src/alarms_and_conditions/extract_event_fields.js +0 -90
  40. package/dist/src/alarms_and_conditions/extract_event_fields.js.map +0 -1
  41. package/dist/src/data_access/ua_multistate_value_discrete.d.ts +0 -51
  42. package/dist/src/data_access/ua_multistate_value_discrete.js +0 -250
  43. package/dist/src/data_access/ua_multistate_value_discrete.js.map +0 -1
  44. package/dist/src/data_access/ua_two_state_discrete.d.ts +0 -25
  45. package/dist/src/data_access/ua_two_state_discrete.js +0 -154
  46. package/dist/src/data_access/ua_two_state_discrete.js.map +0 -1
  47. package/dist/src/nodeset_tools/typedictionary_to_xml.d.ts +0 -2
  48. package/dist/src/nodeset_tools/typedictionary_to_xml.js +0 -155
  49. package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +0 -1
@@ -4,7 +4,7 @@
4
4
  */
5
5
  // produce nodeset xml files
6
6
  import { assert } from "node-opcua-assert";
7
- import { ObjectIds } from "node-opcua-constants";
7
+ import { ObjectIds, VariableIds } from "node-opcua-constants";
8
8
  import { make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
9
9
  import { ExtensionObject } from "node-opcua-extension-object";
10
10
  import {
@@ -16,7 +16,7 @@ import {
16
16
  makeAccessLevelFlag,
17
17
  QualifiedName
18
18
  } from "node-opcua-data-model";
19
- import { NodeId, NodeIdType, resolveNodeId } from "node-opcua-nodeid";
19
+ import { ExpandedNodeId, NodeId, NodeIdType, resolveNodeId } from "node-opcua-nodeid";
20
20
  import * as utils from "node-opcua-utils";
21
21
  import { Variant, VariantArrayType, DataType } from "node-opcua-variant";
22
22
  import {
@@ -99,10 +99,8 @@ function b(xw: XmlWriter, browseName: QualifiedName): string {
99
99
  }
100
100
 
101
101
  function _dumpReverseReferences(xw: XmlWriter, node: BaseNode) {
102
-
103
102
  const addressSpace = node.addressSpace;
104
103
  const hasSubtypeReferenceType = addressSpace.findReferenceType("HasSubtype")!;
105
-
106
104
  }
107
105
  function _dumpReferences(xw: XmlWriter, node: BaseNode) {
108
106
  xw.startElement("References");
@@ -217,15 +215,29 @@ function _dumpXmlElement(xw: XmlWriter, v: string) {
217
215
  </uax:ExtensionObject>
218
216
  */
219
217
  type XmlNamespaceUri = string;
218
+ type NamespaceUri = string;
220
219
  type XmlNs = string;
221
220
  interface XmlWriterEx extends XmlWriter {
222
221
  map: Record<XmlNamespaceUri, XmlNs>;
223
222
  stackMap: Record<XmlNamespaceUri, XmlNs>[];
223
+ namespaceArray: NamespaceUri[];
224
224
  }
225
- function initXmlWriterEx(xw: XmlWriter, map: Record<XmlNamespaceUri, XmlNs>): void {
225
+ function initXmlWriterEx(xw: XmlWriter, map: Record<XmlNamespaceUri, XmlNs>, namespaceArray: NamespaceUri[]): void {
226
226
  const xwe = xw as XmlWriterEx;
227
227
  xwe.map = map;
228
228
  xwe.stackMap = [];
229
+ xwe.namespaceArray = namespaceArray;
230
+ }
231
+ function findXsdNamespaceUri(xw: XmlWriter, nodeId: NodeId): string {
232
+ const xwe = xw as XmlWriterEx;
233
+ if (!xwe.namespaceArray) {
234
+ return "";
235
+ }
236
+ const namespace = xwe.namespaceArray[nodeId.namespace];
237
+ if (namespace === "http://opcfoundation.org/UA/") {
238
+ return "http://opcfoundation.org/UA/2008/02/Types.xsd";
239
+ }
240
+ return namespace.replace(/\/$/, "") + "/Types.xsd";
229
241
  }
230
242
 
231
243
  function getPrefix(xw: XmlWriter, namespace: XmlNamespaceUri): XmlNs {
@@ -290,6 +302,9 @@ function _dumpVariantInnerExtensionObject(
290
302
  definition: StructureDefinition,
291
303
  value: ExtensionObject
292
304
  ) {
305
+ const namespaceUri = findXsdNamespaceUri(xw, definition.defaultEncodingId);
306
+ const ns = getPrefix(xw, namespaceUri);
307
+
293
308
  for (const field of definition.fields || []) {
294
309
  const dataTypeNodeId = field.dataType;
295
310
 
@@ -305,8 +320,11 @@ function _dumpVariantInnerExtensionObject(
305
320
  // to do ?? shall we do a extension Object here ?
306
321
  continue; // ns=0;i=0 is reserved
307
322
  }
323
+
308
324
  const { name, definition } = definitionMap.findDefinition(dataTypeNodeId);
309
- xw.startElement(fieldName);
325
+
326
+ startElementEx(xw, ns, fieldName, namespaceUri);
327
+ // xw.startElement(fieldName);
310
328
 
311
329
  let fun: (value: any) => void = (value: any) => {
312
330
  /** */
@@ -339,6 +357,7 @@ function _dumpVariantInnerExtensionObject(
339
357
  console.log(field);
340
358
  // throw err;
341
359
  }
360
+ restoreDefaultNamespace(xw);
342
361
  xw.endElement();
343
362
  }
344
363
  }
@@ -443,10 +462,13 @@ function _dumpVariantExtensionObjectValue_Body(
443
462
  value: any
444
463
  ) {
445
464
  if (value) {
446
- xw.startElement(name);
465
+ const namespaceUri = findXsdNamespaceUri(xw, definition.defaultEncodingId);
466
+ const ns = getPrefix(xw, namespaceUri);
467
+ startElementEx(xw, ns, `${name}`, namespaceUri);
447
468
  if (value) {
448
469
  _dumpVariantInnerExtensionObject(xw, definitionMap, definition, value);
449
470
  }
471
+ restoreDefaultNamespace(xw);
450
472
  xw.endElement();
451
473
  }
452
474
  }
@@ -877,7 +899,7 @@ function _dumpUADataTypeDefinition(xw: XmlWriter, uaDataType: UADataType) {
877
899
 
878
900
  const dataValue = uaDataType.readAttribute(SessionContext.defaultContext, AttributeIds.DataTypeDefinition);
879
901
 
880
- if (dataValue.statusCode === StatusCodes.Good) {
902
+ if (true || dataValue.statusCode === StatusCodes.Good) {
881
903
  const definition = uaDataType.getStructureDefinition();
882
904
  const baseDefinition = uaDataTypeBase ? uaDataTypeBase.getStructureDefinition() : null;
883
905
  xw.startElement("Definition");
@@ -1332,11 +1354,20 @@ UADataTypeImpl.prototype.dumpXML = function (xw: XmlWriter) {
1332
1354
  dumpUADataType(xw, this);
1333
1355
  };
1334
1356
 
1357
+ function makeTypeXsd(namespaceUri: string): string {
1358
+ return namespaceUri.replace(/\/$/, "") + "/Type.xsd";
1359
+ }
1360
+
1335
1361
  // eslint-disable-next-line max-statements
1336
1362
  NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
1337
1363
  const dependency = constructNamespaceDependency(this);
1338
1364
  const translationTable = constructNamespaceTranslationTable(dependency);
1339
1365
 
1366
+ const namespaceArrayNode = this.addressSpace.findNode(VariableIds.Server_NamespaceArray);
1367
+ const namespaceArray: string[] = namespaceArrayNode
1368
+ ? namespaceArrayNode.readAttribute(null, AttributeIds.Value).value.value
1369
+ : [];
1370
+
1340
1371
  const xw = new XMLWriter(true);
1341
1372
  xw.translationTable = translationTable;
1342
1373
 
@@ -1346,17 +1377,30 @@ NamespaceImpl.prototype.toNodeset2XML = function (this: NamespaceImpl) {
1346
1377
  xw.writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
1347
1378
  xw.writeAttribute("xmlns:uax", "http://opcfoundation.org/UA/2008/02/Types.xsd");
1348
1379
  xw.writeAttribute("xmlns", "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd");
1380
+
1381
+ const namespacesMap: Record<string, string> = {
1382
+ "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd": "",
1383
+ "http://opcfoundation.org/UA/2008/02/Types.xsd": "uax",
1384
+ "http://www.w3.org/2001/XMLSchema-instance": "xsi"
1385
+ };
1386
+
1387
+ for (const namespace of dependency) {
1388
+ if (namespace.index === 0) {
1389
+ continue;
1390
+ }
1391
+ const translatedIndex = translationTable[namespace.index];
1392
+
1393
+ const smallName = `ns${translatedIndex}`;
1394
+ xw.writeAttribute(`xmlns:${smallName}`, makeTypeXsd(namespace.namespaceUri));
1395
+ namespacesMap[namespace.namespaceUri] = smallName;
1396
+ }
1349
1397
  // xx xw.writeAttribute("Version", "1.02");
1350
1398
  // xx xw.writeAttribute("LastModified", (new Date()).toISOString());
1351
1399
 
1352
1400
  // ------------- INamespace Uris
1353
1401
  xw.startElement("NamespaceUris");
1354
1402
 
1355
- initXmlWriterEx(xw, {
1356
- "http://opcfoundation.org/UA/2011/03/UANodeSet.xsd": "",
1357
- "http://opcfoundation.org/UA/2008/02/Types.xsd": "uax",
1358
- "http://www.w3.org/2001/XMLSchema-instance": "xsi"
1359
- });
1403
+ initXmlWriterEx(xw, namespacesMap, namespaceArray);
1360
1404
 
1361
1405
  // xx const namespaceArray = namespace.addressSpace.getNamespaceArray();
1362
1406
  for (const depend of dependency) {
@@ -31,7 +31,7 @@ import {
31
31
  defaultCloneFilter,
32
32
  defaultCloneExtraInfo
33
33
  } from "node-opcua-address-space-base";
34
- import { SessionContext } from "../source";
34
+ import { SessionContext } from "../source/session_context";
35
35
  import { _clone } from "./base_node_private";
36
36
  import { _handle_hierarchy_parent } from "./namespace_impl";
37
37
  import { BaseNodeImpl } from "./base_node_impl";
@@ -85,7 +85,13 @@ export class UAMethodImpl extends BaseNodeImpl implements UAMethod {
85
85
  }
86
86
  return true;
87
87
  }
88
-
88
+ public getUserExecutableFlag(context: ISessionContext | null): boolean {
89
+ if (context && !context.checkPermission(this, PermissionType.Call)) {
90
+ return false;
91
+ }
92
+ if (!this.getExecutableFlag(context)) return false;
93
+ return true;
94
+ }
89
95
  /**
90
96
  *
91
97
  * @returns true if the method is bound
@@ -107,7 +113,7 @@ export class UAMethodImpl extends BaseNodeImpl implements UAMethod {
107
113
  options.statusCode = StatusCodes.Good;
108
114
  break;
109
115
  case AttributeIds.UserExecutable:
110
- options.value = { dataType: DataType.Boolean, value: this.getExecutableFlag(context) };
116
+ options.value = { dataType: DataType.Boolean, value: this.getUserExecutableFlag(context) };
111
117
  options.statusCode = StatusCodes.Good;
112
118
  break;
113
119
  default:
@@ -389,6 +389,25 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
389
389
  return this.checkPermissionAndAccessLevelPrivate(context, PermissionType.Write, AccessLevelFlag.CurrentWrite);
390
390
  }
391
391
 
392
+ public canUserReadHistory(context: ISessionContext): boolean {
393
+ return this.checkPermissionAndAccessLevelPrivate(context, PermissionType.ReadHistory, AccessLevelFlag.HistoryRead);
394
+ }
395
+ public canUserWriteHistorizingAttribute(context: ISessionContext): boolean {
396
+ if (context && !context.checkPermission(this, PermissionType.WriteHistorizing)) {
397
+ return false;
398
+ }
399
+ return true;
400
+ }
401
+ public canUserInsertHistory(context: ISessionContext): boolean {
402
+ return this.checkPermissionAndAccessLevelPrivate(context, PermissionType.InsertHistory, AccessLevelFlag.HistoryWrite);
403
+ }
404
+ public canUserModifyHistory(context: ISessionContext): boolean {
405
+ return this.checkPermissionAndAccessLevelPrivate(context, PermissionType.ModifyHistory, AccessLevelFlag.HistoryWrite);
406
+ }
407
+ public canUserDeleteHistory(context: ISessionContext): boolean {
408
+ return this.checkPermissionAndAccessLevelPrivate(context, PermissionType.DeleteHistory, AccessLevelFlag.HistoryWrite);
409
+ }
410
+
392
411
  /**
393
412
  *
394
413
  *
@@ -949,6 +968,10 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
949
968
  if (!callback) {
950
969
  throw new Error("Internal error");
951
970
  }
971
+
972
+ if (!this.canUserWriteAttribute(context, writeValueOptions.attributeId!)) {
973
+ return callback(null, StatusCodes.BadUserAccessDenied);
974
+ }
952
975
  const writeValue: WriteValue =
953
976
  writeValueOptions instanceof WriteValue ? (writeValueOptions as WriteValue) : new WriteValue(writeValueOptions);
954
977
 
@@ -972,18 +995,20 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
972
995
  break;
973
996
  case AttributeIds.Historizing:
974
997
  if (writeValue.value!.value.dataType !== DataType.Boolean) {
975
- return callback(null, StatusCodes.BadNotSupported);
998
+ return callback(null, StatusCodes.BadTypeMismatch);
999
+ }
1000
+ if (!this.canUserWriteHistorizingAttribute(context)) {
1001
+ return callback(null, StatusCodes.BadUserAccessDenied);
976
1002
  }
977
1003
  // if the variable has no historizing in place reject
978
- if (!(this as any)["hA Configuration"]) {
1004
+ if (!this.getChildByName("HA Configuration")) {
979
1005
  return callback(null, StatusCodes.BadNotSupported);
980
1006
  }
981
1007
  // check if user is allowed to do that !
982
1008
  // TODO
983
-
984
1009
  this.historizing = !!writeValue.value!.value.value; // yes ! indeed !
985
-
986
1010
  return callback(null, StatusCodes.Good);
1011
+
987
1012
  default:
988
1013
  super.writeAttribute(context, writeValue, callback);
989
1014
  break;
@@ -1496,6 +1521,7 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1496
1521
  if (typeof this._historyRead !== "function") {
1497
1522
  return callback!(null, new HistoryReadResult({ statusCode: StatusCodes.BadNotReadable }));
1498
1523
  }
1524
+
1499
1525
  this._historyRead(context, historyReadDetails, indexRange, dataEncoding, continuationData, callback!);
1500
1526
  }
1501
1527
 
@@ -1534,6 +1560,12 @@ export class UAVariableImpl extends BaseNodeImpl implements UAVariable {
1534
1560
  continuationData: ContinuationData,
1535
1561
  callback: CallbackT<HistoryReadResult>
1536
1562
  ): void {
1563
+ if (!this.canUserReadHistory(context)) {
1564
+ const result = new HistoryReadResult({
1565
+ statusCode: StatusCodes.BadUserAccessDenied
1566
+ });
1567
+ callback(null, result);
1568
+ }
1537
1569
  const result = new HistoryReadResult({
1538
1570
  statusCode: StatusCodes.BadHistoryOperationUnsupported
1539
1571
  });
@@ -4555,4 +4555,182 @@
4555
4555
  <Field Name="Opaque" Value="3" />
4556
4556
  </Definition>
4557
4557
  </UADataType>
4558
+
4559
+ <UAObjectType NodeId="i=11187" BrowseName="AggregateConfigurationType">
4560
+ <DisplayName>AggregateConfigurationType</DisplayName>
4561
+ <References>
4562
+ <Reference ReferenceType="HasProperty">i=11188</Reference>
4563
+ <Reference ReferenceType="HasProperty">i=11189</Reference>
4564
+ <Reference ReferenceType="HasProperty">i=11190</Reference>
4565
+ <Reference ReferenceType="HasProperty">i=11191</Reference>
4566
+ <Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
4567
+ </References>
4568
+ </UAObjectType>
4569
+ <UAVariable NodeId="i=11188" BrowseName="TreatUncertainAsBad" ParentNodeId="i=11187" DataType="Boolean">
4570
+ <DisplayName>TreatUncertainAsBad</DisplayName>
4571
+ <References>
4572
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4573
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4574
+ <Reference ReferenceType="HasProperty" IsForward="false">i=11187</Reference>
4575
+ </References>
4576
+ </UAVariable>
4577
+ <UAVariable NodeId="i=11189" BrowseName="PercentDataBad" ParentNodeId="i=11187" DataType="Byte">
4578
+ <DisplayName>PercentDataBad</DisplayName>
4579
+ <References>
4580
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4581
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4582
+ <Reference ReferenceType="HasProperty" IsForward="false">i=11187</Reference>
4583
+ </References>
4584
+ </UAVariable>
4585
+ <UAVariable NodeId="i=11190" BrowseName="PercentDataGood" ParentNodeId="i=11187" DataType="Byte">
4586
+ <DisplayName>PercentDataGood</DisplayName>
4587
+ <References>
4588
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4589
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4590
+ <Reference ReferenceType="HasProperty" IsForward="false">i=11187</Reference>
4591
+ </References>
4592
+ </UAVariable>
4593
+ <UAVariable NodeId="i=11191" BrowseName="UseSlopedExtrapolation" ParentNodeId="i=11187" DataType="Boolean">
4594
+ <DisplayName>UseSlopedExtrapolation</DisplayName>
4595
+ <References>
4596
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4597
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4598
+ <Reference ReferenceType="HasProperty" IsForward="false">i=11187</Reference>
4599
+ </References>
4600
+ </UAVariable>
4601
+
4602
+ <UAObjectType NodeId="i=2318" BrowseName="HistoricalDataConfigurationType">
4603
+ <DisplayName>HistoricalDataConfigurationType</DisplayName>
4604
+ <References>
4605
+ <Reference ReferenceType="HasComponent">i=3059</Reference>
4606
+ <Reference ReferenceType="HasComponent">i=11876</Reference>
4607
+ <Reference ReferenceType="HasProperty">i=2323</Reference>
4608
+ <Reference ReferenceType="HasProperty">i=2324</Reference>
4609
+ <Reference ReferenceType="HasProperty">i=2325</Reference>
4610
+ <Reference ReferenceType="HasProperty">i=2326</Reference>
4611
+ <Reference ReferenceType="HasProperty">i=2327</Reference>
4612
+ <Reference ReferenceType="HasProperty">i=2328</Reference>
4613
+ <Reference ReferenceType="HasProperty">i=11499</Reference>
4614
+ <Reference ReferenceType="HasProperty">i=11500</Reference>
4615
+ <Reference ReferenceType="HasSubtype" IsForward="false">i=58</Reference>
4616
+ </References>
4617
+ </UAObjectType>
4618
+ <UAVariable NodeId="i=2323" BrowseName="Stepped" ParentNodeId="i=2318" DataType="Boolean">
4619
+ <DisplayName>Stepped</DisplayName>
4620
+ <References>
4621
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4622
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4623
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4624
+ </References>
4625
+ </UAVariable>
4626
+ <UAVariable NodeId="i=2324" BrowseName="Definition" ParentNodeId="i=2318" DataType="String">
4627
+ <DisplayName>Definition</DisplayName>
4628
+ <References>
4629
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4630
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4631
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4632
+ </References>
4633
+ </UAVariable>
4634
+ <UAVariable NodeId="i=2325" BrowseName="MaxTimeInterval" ParentNodeId="i=2318" DataType="i=290">
4635
+ <DisplayName>MaxTimeInterval</DisplayName>
4636
+ <References>
4637
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4638
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4639
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4640
+ </References>
4641
+ </UAVariable>
4642
+ <UAVariable NodeId="i=2326" BrowseName="MinTimeInterval" ParentNodeId="i=2318" DataType="i=290">
4643
+ <DisplayName>MinTimeInterval</DisplayName>
4644
+ <References>
4645
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4646
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4647
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4648
+ </References>
4649
+ </UAVariable>
4650
+ <UAVariable NodeId="i=2327" BrowseName="ExceptionDeviation" ParentNodeId="i=2318" DataType="Double">
4651
+ <DisplayName>ExceptionDeviation</DisplayName>
4652
+ <References>
4653
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4654
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4655
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4656
+ </References>
4657
+ </UAVariable>
4658
+ <UAVariable NodeId="i=2328" BrowseName="ExceptionDeviationFormat" ParentNodeId="i=2318" DataType="i=890">
4659
+ <DisplayName>ExceptionDeviationFormat</DisplayName>
4660
+ <References>
4661
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4662
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4663
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4664
+ </References>
4665
+ </UAVariable>
4666
+ <UAVariable NodeId="i=11499" BrowseName="StartOfArchive" ParentNodeId="i=2318" DataType="i=294">
4667
+ <DisplayName>StartOfArchive</DisplayName>
4668
+ <References>
4669
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4670
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4671
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4672
+ </References>
4673
+ </UAVariable>
4674
+ <UAVariable NodeId="i=11500" BrowseName="StartOfOnlineArchive" ParentNodeId="i=2318" DataType="i=294">
4675
+ <DisplayName>StartOfOnlineArchive</DisplayName>
4676
+ <References>
4677
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4678
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4679
+ <Reference ReferenceType="HasProperty" IsForward="false">i=2318</Reference>
4680
+ </References>
4681
+ </UAVariable>
4682
+
4683
+ <UAObject NodeId="i=3059" BrowseName="AggregateConfiguration" ParentNodeId="i=2318">
4684
+ <DisplayName>AggregateConfiguration</DisplayName>
4685
+ <References>
4686
+ <Reference ReferenceType="HasProperty">i=11168</Reference>
4687
+ <Reference ReferenceType="HasProperty">i=11169</Reference>
4688
+ <Reference ReferenceType="HasProperty">i=11170</Reference>
4689
+ <Reference ReferenceType="HasProperty">i=11171</Reference>
4690
+ <Reference ReferenceType="HasTypeDefinition">i=11187</Reference>
4691
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4692
+ <Reference ReferenceType="HasComponent" IsForward="false">i=2318</Reference>
4693
+ </References>
4694
+ </UAObject>
4695
+ <UAVariable NodeId="i=11168" BrowseName="TreatUncertainAsBad" ParentNodeId="i=3059" DataType="Boolean">
4696
+ <DisplayName>TreatUncertainAsBad</DisplayName>
4697
+ <References>
4698
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4699
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4700
+ <Reference ReferenceType="HasProperty" IsForward="false">i=3059</Reference>
4701
+ </References>
4702
+ </UAVariable>
4703
+ <UAVariable NodeId="i=11169" BrowseName="PercentDataBad" ParentNodeId="i=3059" DataType="Byte">
4704
+ <DisplayName>PercentDataBad</DisplayName>
4705
+ <References>
4706
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4707
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4708
+ <Reference ReferenceType="HasProperty" IsForward="false">i=3059</Reference>
4709
+ </References>
4710
+ </UAVariable>
4711
+ <UAVariable NodeId="i=11170" BrowseName="PercentDataGood" ParentNodeId="i=3059" DataType="Byte">
4712
+ <DisplayName>PercentDataGood</DisplayName>
4713
+ <References>
4714
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4715
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4716
+ <Reference ReferenceType="HasProperty" IsForward="false">i=3059</Reference>
4717
+ </References>
4718
+ </UAVariable>
4719
+ <UAVariable NodeId="i=11171" BrowseName="UseSlopedExtrapolation" ParentNodeId="i=3059" DataType="Boolean">
4720
+ <DisplayName>UseSlopedExtrapolation</DisplayName>
4721
+ <References>
4722
+ <Reference ReferenceType="HasTypeDefinition">i=68</Reference>
4723
+ <Reference ReferenceType="HasModellingRule">i=78</Reference>
4724
+ <Reference ReferenceType="HasProperty" IsForward="false">i=3059</Reference>
4725
+ </References>
4726
+ </UAVariable>
4727
+ <UAObject NodeId="i=11876" BrowseName="AggregateFunctions" ParentNodeId="i=2318">
4728
+ <DisplayName>AggregateFunctions</DisplayName>
4729
+ <References>
4730
+ <Reference ReferenceType="HasTypeDefinition">i=61</Reference>
4731
+ <Reference ReferenceType="HasModellingRule">i=80</Reference>
4732
+ <Reference ReferenceType="HasComponent" IsForward="false">i=2318</Reference>
4733
+ </References>
4734
+ </UAObject>
4735
+
4558
4736
  </UANodeSet>
@@ -1,17 +0,0 @@
1
- import { SimpleAttributeOperand } from "node-opcua-service-filter";
2
- import { StatusCode } from "node-opcua-status-code";
3
- import { BaseNode, UAObjectType } from "node-opcua-address-space-base";
4
- /**
5
- * @method checkSelectClause
6
- * @param parentNode
7
- * @param selectClause
8
- * @return {Array<StatusCode>}
9
- */
10
- export declare function checkSelectClause(parentNode: BaseNode, selectClause: SimpleAttributeOperand): StatusCode;
11
- /**
12
- * @method checkSelectClauses
13
- * @param eventTypeNode
14
- * @param selectClauses
15
- * @return an array of StatusCode
16
- */
17
- export declare function checkSelectClauses(eventTypeNode: UAObjectType, selectClauses: SimpleAttributeOperand[]): StatusCode[];
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkSelectClauses = exports.checkSelectClause = void 0;
4
- /**
5
- * @module node-opcua-address-space
6
- */
7
- // tslint:disable:no-console
8
- const node_opcua_data_model_1 = require("node-opcua-data-model");
9
- const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
10
- const node_opcua_status_code_1 = require("node-opcua-status-code");
11
- /**
12
- * @method checkSelectClause
13
- * @param parentNode
14
- * @param selectClause
15
- * @return {Array<StatusCode>}
16
- */
17
- function checkSelectClause(parentNode, selectClause) {
18
- //
19
- const addressSpace = parentNode.addressSpace;
20
- // istanbul ignore next
21
- if (selectClause.typeDefinitionId.isEmpty()) {
22
- return node_opcua_status_code_1.StatusCodes.Good;
23
- }
24
- const eventTypeNode = addressSpace.findEventType(selectClause.typeDefinitionId);
25
- if (!eventTypeNode || !(eventTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType)) {
26
- // xx console.log("eventTypeNode = ",selectClause.typeDefinitionId.toString());
27
- // xx console.log("eventTypeNode = ",eventTypeNode);
28
- // istanbul ignore next
29
- if (eventTypeNode) {
30
- console.log(eventTypeNode.toString());
31
- }
32
- }
33
- // istanbul ignore next
34
- if (eventTypeNode.nodeClass !== node_opcua_data_model_1.NodeClass.ObjectType) {
35
- throw new Error("Expecting a ObjectType");
36
- }
37
- // navigate to the innerNode specified by the browsePath [ QualifiedName]
38
- const browsePath = (0, node_opcua_service_translate_browse_path_1.constructBrowsePathFromQualifiedName)(eventTypeNode, selectClause.browsePath);
39
- const browsePathResult = addressSpace.browsePath(browsePath);
40
- return browsePathResult.statusCode;
41
- }
42
- exports.checkSelectClause = checkSelectClause;
43
- /**
44
- * @method checkSelectClauses
45
- * @param eventTypeNode
46
- * @param selectClauses
47
- * @return an array of StatusCode
48
- */
49
- function checkSelectClauses(eventTypeNode, selectClauses) {
50
- return selectClauses.map(checkSelectClause.bind(null, eventTypeNode));
51
- }
52
- exports.checkSelectClauses = checkSelectClauses;
53
- //# sourceMappingURL=check_event_clause.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check_event_clause.js","sourceRoot":"","sources":["../../../source/helpers/check_event_clause.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,4BAA4B;AAC5B,iEAAkD;AAElD,uGAAgG;AAChG,mEAAiE;AAGjE;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,UAAoB,EAAE,YAAoC;IACxF,EAAE;IACF,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC;IAE7C,uBAAuB;IACvB,IAAI,YAAY,CAAC,gBAAgB,CAAC,OAAO,EAAE,EAAE;QACzC,OAAO,oCAAW,CAAC,IAAI,CAAC;KAC3B;IACD,MAAM,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,gBAAgB,CAAE,CAAC;IAEjF,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC,aAAa,CAAC,SAAS,KAAK,iCAAS,CAAC,UAAU,CAAC,EAAE;QACvE,+EAA+E;QAC/E,oDAAoD;QACpD,uBAAuB;QACvB,IAAI,aAAa,EAAE;YACf,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;SACzC;KACJ;IAED,uBAAuB;IACvB,IAAI,aAAa,CAAC,SAAS,KAAK,iCAAS,CAAC,UAAU,EAAE;QAClD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC7C;IAED,yEAAyE;IACzE,MAAM,UAAU,GAAG,IAAA,+EAAoC,EAAC,aAAa,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IAChG,MAAM,gBAAgB,GAAG,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7D,OAAO,gBAAgB,CAAC,UAAU,CAAC;AACvC,CAAC;AA5BD,8CA4BC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,aAA2B,EAAE,aAAuC;IACnG,OAAO,aAAa,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,gDAEC"}
@@ -1,4 +0,0 @@
1
- import { ContentFilter } from "node-opcua-types";
2
- import { IAddressSpace, IEventData, ISessionContext } from "node-opcua-address-space-base";
3
- export declare function __checkWhereClause(addressSpace: IAddressSpace, sessionContext: ISessionContext, whereClause: ContentFilter, index: number, eventData: IEventData): boolean;
4
- export declare function checkWhereClause(addressSpace: IAddressSpace, sessionContext: ISessionContext, whereClause: ContentFilter, eventData: IEventData): boolean;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkWhereClause = exports.__checkWhereClause = void 0;
4
- const node_opcua_types_1 = require("node-opcua-types");
5
- const node_opcua_variant_1 = require("node-opcua-variant");
6
- const node_opcua_data_model_1 = require("node-opcua-data-model");
7
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
8
- const session_context_1 = require("../../source/session_context");
9
- const extract_event_fields_1 = require("./extract_event_fields");
10
- function checkNot(addressSpace, sessionContext, whereClause, eventData, filteredOperands) {
11
- if (filteredOperands[0] instanceof node_opcua_types_1.ElementOperand) {
12
- const index = filteredOperands[0].index;
13
- return !__checkWhereClause(addressSpace, sessionContext, whereClause, index, eventData);
14
- }
15
- return false;
16
- }
17
- function checkOfType(addressSpace, ofType, eventData) {
18
- var _a;
19
- // istanbul ignore next
20
- if (!ofType) {
21
- throw new Error("invalid operand");
22
- }
23
- // istanbul ignore next
24
- if (ofType.value.dataType !== node_opcua_variant_1.DataType.NodeId) {
25
- throw new Error("invalid operand type (expecting Nodeid");
26
- }
27
- const ofTypeNode = addressSpace.findNode(ofType.value.value);
28
- // istanbul ignore next
29
- if (!ofTypeNode) {
30
- return false; // the ofType node is not known, we don't know what to do
31
- }
32
- // istanbul ignore next
33
- if (ofTypeNode.nodeClass !== node_opcua_data_model_1.NodeClass.ObjectType) {
34
- throw new Error("operand should be a ObjectType " + ofTypeNode.nodeId.toString());
35
- }
36
- const node = eventData.$eventDataSource;
37
- if (!node) {
38
- throw new Error("cannot find node " + ((_a = eventData.$eventDataSource) === null || _a === void 0 ? void 0 : _a.toString()));
39
- }
40
- if (node.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType) {
41
- return node.isSupertypeOf(ofTypeNode);
42
- }
43
- if (node.nodeClass === node_opcua_data_model_1.NodeClass.Object && node.typeDefinitionObj) {
44
- return node.typeDefinitionObj.isSupertypeOf(ofTypeNode);
45
- }
46
- return true;
47
- }
48
- function _extractValue(operand, eventData) {
49
- // eventData.readValue;
50
- const v = (0, extract_event_fields_1.extractEventFields)(session_context_1.SessionContext.defaultContext, [operand], eventData)[0];
51
- return v.value;
52
- }
53
- function checkInList(addressSpace, filterOperands, eventData) {
54
- const operand0 = filterOperands[0];
55
- if (!(operand0 instanceof node_opcua_types_1.SimpleAttributeOperand)) {
56
- // unsupported case
57
- return false;
58
- }
59
- const nodeId = _extractValue(operand0, eventData);
60
- if (!nodeId) {
61
- return false;
62
- }
63
- function _is(nodeId1, operandX) {
64
- const operandNode = addressSpace.findNode(operandX.value.value);
65
- if (!operandNode) {
66
- return false;
67
- }
68
- return (0, node_opcua_nodeid_1.sameNodeId)(nodeId1, operandNode.nodeId);
69
- }
70
- for (let i = 1; i < filterOperands.length; i++) {
71
- const filterOperand = filterOperands[i];
72
- if (filterOperand instanceof node_opcua_types_1.LiteralOperand && _is(nodeId, filterOperand)) {
73
- return true;
74
- }
75
- }
76
- return false;
77
- }
78
- function __checkWhereClause(addressSpace, sessionContext, whereClause, index, eventData) {
79
- if (!whereClause.elements || whereClause.elements.length === 0) {
80
- return true;
81
- }
82
- const element = whereClause.elements[index];
83
- if (!element) {
84
- return true;
85
- }
86
- switch (element.filterOperator) {
87
- case node_opcua_types_1.FilterOperator.Not:
88
- return checkNot(addressSpace, sessionContext, whereClause, eventData, element.filterOperands);
89
- case node_opcua_types_1.FilterOperator.OfType:
90
- return checkOfType(addressSpace, element.filterOperands[0], eventData);
91
- case node_opcua_types_1.FilterOperator.InList:
92
- return checkInList(addressSpace, element.filterOperands, eventData);
93
- default:
94
- // from Spec OPC Unified Architecture, Part 4 133 Release 1.04
95
- // Any basic FilterOperator in Table 119 may be used in the whereClause, however, only the
96
- // OfType_14 FilterOperator from Table 120 is permitted.
97
- // tslint:disable-next-line: no-console
98
- console.log("whereClause = ", whereClause.toString());
99
- throw new Error("Only OfType operator are allowed in checkWhereClause");
100
- }
101
- }
102
- exports.__checkWhereClause = __checkWhereClause;
103
- function checkWhereClause(addressSpace, sessionContext, whereClause, eventData) {
104
- if (!whereClause.elements || whereClause.elements.length === 0) {
105
- return true;
106
- }
107
- return __checkWhereClause(addressSpace, sessionContext, whereClause, 0, eventData);
108
- }
109
- exports.checkWhereClause = checkWhereClause;
110
- //# sourceMappingURL=check_where_clause.js.map