node-opcua-service-filter 2.74.0 → 2.75.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/check_event_clause.d.ts +17 -0
- package/dist/check_event_clause.js +52 -0
- package/dist/check_event_clause.js.map +1 -0
- package/dist/check_where_clause.d.ts +3 -0
- package/dist/check_where_clause.js +250 -0
- package/dist/check_where_clause.js.map +1 -0
- package/dist/extract_event_field.d.ts +9 -0
- package/dist/extract_event_field.js +53 -0
- package/dist/extract_event_field.js.map +1 -0
- package/dist/filter_context.d.ts +11 -0
- package/dist/filter_context.js +3 -0
- package/dist/filter_context.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/make_content_filter.d.ts +22 -0
- package/dist/make_content_filter.js +121 -0
- package/dist/make_content_filter.js.map +1 -0
- package/dist/on_address_space/extract_event_fields.d.ts +10 -0
- package/dist/on_address_space/extract_event_fields.js +18 -0
- package/dist/on_address_space/extract_event_fields.js.map +1 -0
- package/dist/on_address_space/filter_context_on_address_space.d.ts +19 -0
- package/dist/on_address_space/filter_context_on_address_space.js +109 -0
- package/dist/on_address_space/filter_context_on_address_space.js.map +1 -0
- package/dist/on_address_space/index.d.ts +2 -0
- package/dist/on_address_space/index.js +19 -0
- package/dist/on_address_space/index.js.map +1 -0
- package/dist/resolve_operand.d.ts +4 -0
- package/dist/resolve_operand.js +45 -0
- package/dist/resolve_operand.js.map +1 -0
- package/dist/tools_event_filter.d.ts +4 -16
- package/dist/tools_event_filter.js +53 -121
- package/dist/tools_event_filter.js.map +1 -1
- package/package.json +13 -9
- package/source/check_event_clause.ts +54 -0
- package/source/check_where_clause.ts +287 -0
- package/source/extract_event_field.ts +55 -0
- package/source/filter_context.ts +15 -0
- package/source/index.ts +8 -0
- package/source/make_content_filter.ts +132 -0
- package/source/on_address_space/extract_event_fields.ts +24 -0
- package/source/on_address_space/filter_context_on_address_space.ts +134 -0
- package/source/on_address_space/index.ts +3 -0
- package/source/resolve_operand.ts +45 -0
- package/source/tools_event_filter.ts +61 -129
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractEventFields = void 0;
|
|
4
|
+
//
|
|
5
|
+
const extract_event_field_1 = require("../extract_event_field");
|
|
6
|
+
const filter_context_on_address_space_1 = require("./filter_context_on_address_space");
|
|
7
|
+
/**
|
|
8
|
+
* @method extractEventFields
|
|
9
|
+
* extract a array of eventFields from a event node, matching the selectClauses
|
|
10
|
+
* @param selectClauses
|
|
11
|
+
* @param eventData : a pseudo Node that provides a browse Method and a readValue(nodeId)
|
|
12
|
+
*/
|
|
13
|
+
function extractEventFields(sessionContext, selectClauses, eventData) {
|
|
14
|
+
const context = new filter_context_on_address_space_1.FilterContextOnAddressSpace(sessionContext, eventData);
|
|
15
|
+
return (0, extract_event_field_1.extractEventFieldsBase)(context, selectClauses);
|
|
16
|
+
}
|
|
17
|
+
exports.extractEventFields = extractEventFields;
|
|
18
|
+
//# sourceMappingURL=extract_event_fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract_event_fields.js","sourceRoot":"","sources":["../../source/on_address_space/extract_event_fields.ts"],"names":[],"mappings":";;;AAKA,EAAE;AACF,gEAAgE;AAChE,uFAAgF;AAGhF;;;;;GAKG;AACH,SAAgB,kBAAkB,CAC9B,cAA+B,EAC/B,aAAuC,EACvC,SAAqB;IAErB,MAAM,OAAO,GAAG,IAAI,6DAA2B,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC3E,OAAO,IAAA,4CAAsB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,gDAOC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseNode, IEventData, ISessionContext } from "node-opcua-address-space-base";
|
|
2
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
3
|
+
import { NodeId, NodeIdLike } from "node-opcua-nodeid";
|
|
4
|
+
import { BrowsePath } from "node-opcua-types";
|
|
5
|
+
import { Variant } from "node-opcua-variant";
|
|
6
|
+
import { FilterContext } from "../filter_context";
|
|
7
|
+
export declare class FilterContextOnAddressSpace implements FilterContext {
|
|
8
|
+
private sessionContext;
|
|
9
|
+
private eventData;
|
|
10
|
+
eventSource: NodeId;
|
|
11
|
+
constructor(sessionContext: ISessionContext, eventData: IEventData);
|
|
12
|
+
getNodeClass(nodeId: NodeId): NodeClass;
|
|
13
|
+
isSubtypeOf(nodeId: NodeId, baseType: NodeId): boolean;
|
|
14
|
+
getTypeDefinition(nodeId: NodeId): NodeId | null;
|
|
15
|
+
readNodeValue(nodeId: NodeIdLike): Variant;
|
|
16
|
+
private getAddressSpace;
|
|
17
|
+
browsePath(browsePath: BrowsePath): NodeId | null;
|
|
18
|
+
setEventSource(eventSource: BaseNode | null): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterContextOnAddressSpace = void 0;
|
|
4
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
5
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
6
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
7
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
8
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
9
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)("Filter");
|
|
10
|
+
class FilterContextOnAddressSpace {
|
|
11
|
+
constructor(sessionContext, eventData) {
|
|
12
|
+
var _a;
|
|
13
|
+
this.sessionContext = sessionContext;
|
|
14
|
+
this.eventData = eventData;
|
|
15
|
+
this.eventSource = ((_a = this.eventData.$eventDataSource) === null || _a === void 0 ? void 0 : _a.nodeId) || node_opcua_nodeid_1.NodeId.nullNodeId;
|
|
16
|
+
}
|
|
17
|
+
getNodeClass(nodeId) {
|
|
18
|
+
const addressSpace = this.getAddressSpace();
|
|
19
|
+
const node = addressSpace.findNode(nodeId);
|
|
20
|
+
return node ? node.nodeClass : node_opcua_data_model_1.NodeClass.Unspecified;
|
|
21
|
+
}
|
|
22
|
+
isSubtypeOf(nodeId, baseType) {
|
|
23
|
+
const addressSpace = this.getAddressSpace();
|
|
24
|
+
const node = addressSpace.findNode(nodeId);
|
|
25
|
+
const baseTypeNode = addressSpace.findNode(baseType);
|
|
26
|
+
if (!node || !baseTypeNode) {
|
|
27
|
+
warningLog("invalid node - must be specifed ");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType && baseTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType) {
|
|
31
|
+
return node.isSupertypeOf(baseTypeNode);
|
|
32
|
+
}
|
|
33
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.VariableType && baseTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.VariableType) {
|
|
34
|
+
return node.isSupertypeOf(baseTypeNode);
|
|
35
|
+
}
|
|
36
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType && baseTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.ReferenceType) {
|
|
37
|
+
return node.isSupertypeOf(baseTypeNode);
|
|
38
|
+
}
|
|
39
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.DataType && baseTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.DataType) {
|
|
40
|
+
return node.isSupertypeOf(baseTypeNode);
|
|
41
|
+
}
|
|
42
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.Object && baseTypeNode.nodeClass === node_opcua_data_model_1.NodeClass.ObjectType) {
|
|
43
|
+
const obj = node;
|
|
44
|
+
return obj.typeDefinitionObj.isSupertypeOf(baseTypeNode);
|
|
45
|
+
}
|
|
46
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.Variable && baseTypeNode.nodeClass !== node_opcua_data_model_1.NodeClass.VariableType) {
|
|
47
|
+
const obj = node;
|
|
48
|
+
return obj.typeDefinitionObj.isSupertypeOf(baseTypeNode);
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
getTypeDefinition(nodeId) {
|
|
53
|
+
const addressSpace = this.getAddressSpace();
|
|
54
|
+
const node = addressSpace.findNode(nodeId);
|
|
55
|
+
if (!node)
|
|
56
|
+
return null;
|
|
57
|
+
if (node.nodeClass === node_opcua_data_model_1.NodeClass.Object || node.nodeClass === node_opcua_data_model_1.NodeClass.Variable) {
|
|
58
|
+
return node.typeDefinition;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
readNodeValue(nodeId) {
|
|
63
|
+
nodeId = (0, node_opcua_nodeid_1.coerceNodeId)(nodeId);
|
|
64
|
+
// use cache/snapshot if available
|
|
65
|
+
const value = this.eventData._readValue(nodeId);
|
|
66
|
+
if (value) {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
const addressSpace = this.getAddressSpace();
|
|
70
|
+
const node = addressSpace.findNode(nodeId);
|
|
71
|
+
if (!node || node.nodeClass !== node_opcua_data_model_1.NodeClass.Variable) {
|
|
72
|
+
return new node_opcua_variant_1.Variant();
|
|
73
|
+
}
|
|
74
|
+
return prepare(node.readValue(this.sessionContext));
|
|
75
|
+
}
|
|
76
|
+
getAddressSpace() {
|
|
77
|
+
return this.eventData.$eventDataSource.addressSpace;
|
|
78
|
+
}
|
|
79
|
+
browsePath(browsePath) {
|
|
80
|
+
// delegate to eventData if appropriate
|
|
81
|
+
if ((0, node_opcua_nodeid_1.sameNodeId)(browsePath.startingNode, this.eventSource)) {
|
|
82
|
+
const browseResult = this.eventData._browse(browsePath);
|
|
83
|
+
if (browseResult &&
|
|
84
|
+
browseResult.statusCode === node_opcua_status_code_1.StatusCodes.Good &&
|
|
85
|
+
browseResult.targets &&
|
|
86
|
+
browseResult.targets.length === 1) {
|
|
87
|
+
return browseResult.targets[0].targetId;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// fallback to addressSpace otherwise
|
|
91
|
+
const addressSpace = this.getAddressSpace();
|
|
92
|
+
const browseResult = addressSpace.browsePath(browsePath);
|
|
93
|
+
if (browseResult.statusCode !== node_opcua_status_code_1.StatusCodes.Good || !browseResult.targets || browseResult.targets.length !== 1) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return browseResult.targets[0].targetId;
|
|
97
|
+
}
|
|
98
|
+
setEventSource(eventSource) {
|
|
99
|
+
this.eventSource = eventSource ? eventSource.nodeId : node_opcua_nodeid_1.NodeId.nullNodeId;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.FilterContextOnAddressSpace = FilterContextOnAddressSpace;
|
|
103
|
+
function prepare(dataValue) {
|
|
104
|
+
if (dataValue.statusCode === node_opcua_status_code_1.StatusCodes.Good) {
|
|
105
|
+
return dataValue.value;
|
|
106
|
+
}
|
|
107
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.StatusCode, value: dataValue.statusCode });
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=filter_context_on_address_space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter_context_on_address_space.js","sourceRoot":"","sources":["../../source/on_address_space/filter_context_on_address_space.ts"],"names":[],"mappings":";;;AAYA,iEAAgE;AAChE,uDAAmD;AACnD,yDAAiF;AACjF,mEAAqD;AAErD,2DAAuD;AAKvD,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,QAAQ,CAAC,CAAC;AAE7C,MAAa,2BAA2B;IAGpC,YAAoB,cAA+B,EAAU,SAAqB;;QAA9D,mBAAc,GAAd,cAAc,CAAiB;QAAU,cAAS,GAAT,SAAS,CAAY;QAC9E,IAAI,CAAC,WAAW,GAAG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AAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,CAAC;IAED,cAAc,CAAC,WAA4B;QACvC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,0BAAM,CAAC,UAAU,CAAC;IAC5E,CAAC;CACJ;AAtGD,kEAsGC;AAED,SAAS,OAAO,CAAC,SAAoB;IACjC,IAAI,SAAS,CAAC,UAAU,KAAK,oCAAW,CAAC,IAAI,EAAE;QAC3C,OAAO,SAAS,CAAC,KAAK,CAAC;KAC1B;IACD,OAAO,IAAI,4BAAO,CAAC,EAAE,QAAQ,EAAE,6BAAQ,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./filter_context_on_address_space"), exports);
|
|
18
|
+
__exportStar(require("./extract_event_fields"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/on_address_space/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,oEAAkD;AAClD,yDAAuC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SimpleAttributeOperand, AttributeOperand } from "node-opcua-types";
|
|
2
|
+
import { Variant } from "node-opcua-variant";
|
|
3
|
+
import { FilterContext } from "./filter_context";
|
|
4
|
+
export declare function resolveOperand(context: FilterContext, operand: SimpleAttributeOperand | AttributeOperand): Variant;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveOperand = void 0;
|
|
4
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
5
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
6
|
+
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
7
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
8
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
9
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
10
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)("FILTER");
|
|
11
|
+
// export function readOperand(context: FilterContext, operand: SimpleAttributeOperand): Variant {
|
|
12
|
+
// // navigate to the innerNode specified by the browsePath [ QualifiedName]
|
|
13
|
+
// const browsePath = constructBrowsePathFromQualifiedName({ nodeId: context.eventSource }, operand.browsePath);
|
|
14
|
+
// const targetNode = context.browsePath(browsePath);
|
|
15
|
+
// if (!targetNode) {
|
|
16
|
+
// return new Variant({ dataType: DataType.Null });
|
|
17
|
+
// }
|
|
18
|
+
// return context.readNodeValue(targetNode);
|
|
19
|
+
// }
|
|
20
|
+
function resolveOperand(context, operand) {
|
|
21
|
+
if (operand instanceof node_opcua_types_1.SimpleAttributeOperand) {
|
|
22
|
+
const browsePath = (0, node_opcua_service_translate_browse_path_1.constructBrowsePathFromQualifiedName)({ nodeId: context.eventSource }, operand.browsePath);
|
|
23
|
+
const target = context.browsePath(browsePath);
|
|
24
|
+
if (!target) {
|
|
25
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Null });
|
|
26
|
+
// return new Variant({ dataType: DataType.StatusCode, value: StatusCodes.BadNodeIdUnknown });
|
|
27
|
+
}
|
|
28
|
+
const nodeClass = context.getNodeClass(target);
|
|
29
|
+
if (nodeClass !== node_opcua_data_model_1.NodeClass.Variable) {
|
|
30
|
+
warningLog("resolveOperand: cannot find variable here but got nodeClass", node_opcua_data_model_1.NodeClass[nodeClass], browsePath.toString());
|
|
31
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.StatusCode, value: node_opcua_status_code_1.StatusCodes.BadNodeClassInvalid });
|
|
32
|
+
}
|
|
33
|
+
const value = context.readNodeValue(target);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (!(operand instanceof node_opcua_types_1.AttributeOperand)) {
|
|
38
|
+
throw new Error("expecting an AttributeOperand");
|
|
39
|
+
}
|
|
40
|
+
warningLog("AttributeOperand is not yet implemented");
|
|
41
|
+
return new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.Null });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.resolveOperand = resolveOperand;
|
|
45
|
+
//# sourceMappingURL=resolve_operand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve_operand.js","sourceRoot":"","sources":["../source/resolve_operand.ts"],"names":[],"mappings":";;;AAAA,iEAAkD;AAClD,uDAAmD;AAEnD,uGAAgH;AAChH,mEAAqD;AACrD,uDAAgG;AAChG,2DAAuD;AAGvD,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,QAAQ,CAAC,CAAC;AAE7C,kGAAkG;AAClG,gFAAgF;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wCAuBC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
5
|
-
import { EventFilter, SimpleAttributeOperand } from "./imports";
|
|
1
|
+
import { ContentFilterElement, ContentFilterOptions, EventFilter, SimpleAttributeOperand } from "./imports";
|
|
2
|
+
export declare function constructSelectClause(arrayOfNames: string | string[]): SimpleAttributeOperand[];
|
|
6
3
|
/**
|
|
7
4
|
* helper to construct event filters:
|
|
8
5
|
* construct a simple event filter
|
|
9
6
|
*
|
|
7
|
+
* "ConditionId" in the arrayOfNames has a special meaning
|
|
10
8
|
*
|
|
11
9
|
* @example
|
|
12
10
|
*
|
|
@@ -19,14 +17,4 @@ import { EventFilter, SimpleAttributeOperand } from "./imports";
|
|
|
19
17
|
* constructEventFilter(["SourceName" ,"EnabledState.EffectiveDisplayName" ]);
|
|
20
18
|
*
|
|
21
19
|
*/
|
|
22
|
-
export declare function constructEventFilter(arrayOfNames: string[] | string,
|
|
23
|
-
/**
|
|
24
|
-
* @class SimpleAttributeOperand
|
|
25
|
-
* @method toShortString
|
|
26
|
-
* @return {String}
|
|
27
|
-
*
|
|
28
|
-
* @example:
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
export declare function simpleAttributeOperandToShortString(self: SimpleAttributeOperand, addressSpace: any): string;
|
|
20
|
+
export declare function constructEventFilter(arrayOfNames: string[] | string, whereClause?: ContentFilterOptions | ContentFilterElement): EventFilter;
|
|
@@ -1,158 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructEventFilter = exports.constructSelectClause = void 0;
|
|
2
4
|
/**
|
|
3
5
|
* @module node-opcua-service-filter
|
|
4
6
|
*/
|
|
5
|
-
// tslint:disable:object-literal-shorthand
|
|
6
|
-
// tslint:disable:only-arrow-functions
|
|
7
|
-
// tslint:disable:max-line-length
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.simpleAttributeOperandToShortString = exports.constructEventFilter = void 0;
|
|
10
7
|
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
11
8
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
12
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
13
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
14
9
|
const imports_1 = require("./imports");
|
|
15
|
-
|
|
16
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
17
|
-
/**
|
|
18
|
-
* helper to construct event filters:
|
|
19
|
-
* construct a simple event filter
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
*
|
|
24
|
-
* constructEventFilter(["SourceName","Message","ReceiveTime"]);
|
|
25
|
-
*
|
|
26
|
-
* constructEventFilter(["SourceName",{namespaceIndex:2 , "MyData"}]);
|
|
27
|
-
* constructEventFilter(["SourceName","2:MyData" ]);
|
|
28
|
-
*
|
|
29
|
-
* constructEventFilter(["SourceName" ,["EnabledState","EffectiveDisplayName"] ]);
|
|
30
|
-
* constructEventFilter(["SourceName" ,"EnabledState.EffectiveDisplayName" ]);
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
function constructEventFilter(arrayOfNames, conditionTypes) {
|
|
10
|
+
function constructSelectClause(arrayOfNames) {
|
|
34
11
|
if (!Array.isArray(arrayOfNames)) {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
if (conditionTypes && !Array.isArray(conditionTypes)) {
|
|
38
|
-
return constructEventFilter(arrayOfNames, [conditionTypes]);
|
|
39
|
-
}
|
|
40
|
-
// istanbul ignore next
|
|
41
|
-
if (!(arrayOfNames instanceof Array)) {
|
|
42
|
-
throw new Error("internal error");
|
|
12
|
+
return constructSelectClause([arrayOfNames]);
|
|
43
13
|
}
|
|
44
14
|
// replace "string" element in the form A.B.C into [ "A","B","C"]
|
|
45
|
-
const arrayOfNames2 = arrayOfNames.map((path) =>
|
|
46
|
-
|
|
47
|
-
return path;
|
|
48
|
-
}
|
|
49
|
-
return path.split(".");
|
|
50
|
-
});
|
|
51
|
-
const arrayOfNames3 = arrayOfNames2.map((path) => {
|
|
52
|
-
if (Array.isArray(path)) {
|
|
53
|
-
return path.map(node_opcua_data_model_1.stringToQualifiedName);
|
|
54
|
-
}
|
|
55
|
-
return path;
|
|
56
|
-
});
|
|
15
|
+
const arrayOfNames2 = arrayOfNames.map((path) => (typeof path !== "string" ? path : path.split(".")));
|
|
16
|
+
const arrayOfNames3 = arrayOfNames2.map((path) => (Array.isArray(path) ? path.map(node_opcua_data_model_1.stringToQualifiedName) : path));
|
|
57
17
|
// replace "string" elements in arrayOfName with QualifiedName in namespace 0
|
|
58
|
-
const arrayOfNames4 = arrayOfNames3.map((s) =>
|
|
59
|
-
return typeof s === "string" ? (0, node_opcua_data_model_1.stringToQualifiedName)(s) : s;
|
|
60
|
-
});
|
|
18
|
+
const arrayOfNames4 = arrayOfNames3.map((s) => (typeof s === "string" ? (0, node_opcua_data_model_1.stringToQualifiedName)(s) : s));
|
|
61
19
|
// construct browse paths array
|
|
62
|
-
const browsePaths = arrayOfNames4.map((s) =>
|
|
63
|
-
return Array.isArray(s) ? s : [s];
|
|
64
|
-
});
|
|
20
|
+
const browsePaths = arrayOfNames4.map((s) => (Array.isArray(s) ? s : [s]));
|
|
65
21
|
// Part 4 page 127:
|
|
66
22
|
// In some cases the same BrowsePath will apply to multiple EventTypes. If the Client specifies the BaseEventType
|
|
67
23
|
// in the SimpleAttributeOperand then the Server shall evaluate the BrowsePath without considering the Type.
|
|
24
|
+
const isBrowsePathForConditionId = (browsePath) => browsePath.length === 1 && browsePath[0].namespaceIndex === 0 && browsePath[0].name === "ConditionId";
|
|
68
25
|
// [..]
|
|
69
26
|
// The SimpleAttributeOperand structure allows the Client to specify any Attribute, however, the Server is only
|
|
70
27
|
// required to support the Value Attribute for Variable Nodes and the NodeId Attribute for Object Nodes.
|
|
71
28
|
// That said, profiles defined in Part 7 may make support for additional Attributes mandatory.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
29
|
+
const selectClauses = browsePaths.map((browsePath) => {
|
|
30
|
+
if (isBrowsePathForConditionId(browsePath)) {
|
|
31
|
+
// special case
|
|
32
|
+
//
|
|
33
|
+
// The NodeId of the Condition instance is used as ConditionId. It is not explicitly modelled as a
|
|
34
|
+
// component of the ConditionType. However, it can be requested with the following
|
|
35
|
+
// SimpleAttributeOperand (see Table 10) in the SelectClause of the EventFilter:
|
|
36
|
+
//
|
|
37
|
+
// SimpleAttributeOperand
|
|
38
|
+
// Name Type Description
|
|
39
|
+
// typeId NodeId NodeId of the ConditionType Node
|
|
40
|
+
// browsePath[] QualifiedName empty
|
|
41
|
+
// attributeId IntegerId Id of the NodeId Attribute
|
|
42
|
+
//
|
|
82
43
|
return new imports_1.SimpleAttributeOperand({
|
|
83
44
|
attributeId: node_opcua_data_model_1.AttributeIds.NodeId,
|
|
84
|
-
browsePath:
|
|
45
|
+
browsePath: null,
|
|
85
46
|
indexRange: undefined,
|
|
86
|
-
typeDefinitionId:
|
|
47
|
+
typeDefinitionId: node_opcua_constants_1.ObjectTypeIds.ConditionType // i=2782
|
|
87
48
|
});
|
|
88
|
-
});
|
|
89
|
-
selectClauses = selectClauses.concat(extraSelectClauses);
|
|
90
|
-
}
|
|
91
|
-
const filter = new imports_1.EventFilter({
|
|
92
|
-
selectClauses,
|
|
93
|
-
whereClause: {
|
|
94
|
-
// ContentFilter
|
|
95
|
-
elements: [
|
|
96
|
-
// ContentFilterElement
|
|
97
|
-
// {
|
|
98
|
-
// filterOperator: FilterOperator.IsNull,
|
|
99
|
-
// filterOperands: [ //
|
|
100
|
-
// new ElementOperand({
|
|
101
|
-
// index: 123
|
|
102
|
-
// }),
|
|
103
|
-
// new AttributeOperand({
|
|
104
|
-
// nodeId: "i=10",
|
|
105
|
-
// alias: "someText",
|
|
106
|
-
// browsePath: { //RelativePath
|
|
107
|
-
//
|
|
108
|
-
// },
|
|
109
|
-
// attributeId: AttributeIds.Value
|
|
110
|
-
// })
|
|
111
|
-
// ]
|
|
112
|
-
// }
|
|
113
|
-
]
|
|
114
49
|
}
|
|
50
|
+
else
|
|
51
|
+
return new imports_1.SimpleAttributeOperand({
|
|
52
|
+
attributeId: node_opcua_data_model_1.AttributeIds.Value,
|
|
53
|
+
browsePath,
|
|
54
|
+
indexRange: undefined,
|
|
55
|
+
typeDefinitionId: node_opcua_constants_1.ObjectTypeIds.BaseEventType // i=2041
|
|
56
|
+
});
|
|
115
57
|
});
|
|
116
|
-
return
|
|
58
|
+
return selectClauses;
|
|
117
59
|
}
|
|
118
|
-
exports.
|
|
60
|
+
exports.constructSelectClause = constructSelectClause;
|
|
119
61
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* @return {String}
|
|
62
|
+
* helper to construct event filters:
|
|
63
|
+
* construct a simple event filter
|
|
123
64
|
*
|
|
124
|
-
*
|
|
65
|
+
* "ConditionId" in the arrayOfNames has a special meaning
|
|
125
66
|
*
|
|
67
|
+
* @example
|
|
126
68
|
*
|
|
127
|
-
|
|
128
|
-
function simpleAttributeOperandToPath(self) {
|
|
129
|
-
if (!self.browsePath) {
|
|
130
|
-
return "";
|
|
131
|
-
}
|
|
132
|
-
return self.browsePath
|
|
133
|
-
.map((a) => {
|
|
134
|
-
return a.name;
|
|
135
|
-
})
|
|
136
|
-
.join("/");
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @class SimpleAttributeOperand
|
|
140
|
-
* @method toShortString
|
|
141
|
-
* @return {String}
|
|
69
|
+
* constructEventFilter(["SourceName","Message","ReceiveTime"]);
|
|
142
70
|
*
|
|
143
|
-
*
|
|
71
|
+
* constructEventFilter(["SourceName",{namespaceIndex:2 , "MyData"}]);
|
|
72
|
+
* constructEventFilter(["SourceName","2:MyData" ]);
|
|
144
73
|
*
|
|
74
|
+
* constructEventFilter(["SourceName" ,["EnabledState","EffectiveDisplayName"] ]);
|
|
75
|
+
* constructEventFilter(["SourceName" ,"EnabledState.EffectiveDisplayName" ]);
|
|
145
76
|
*
|
|
146
77
|
*/
|
|
147
|
-
function
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const n = addressSpace.findNode(self.typeDefinitionId);
|
|
152
|
-
str += n.BrowseName.toString();
|
|
78
|
+
function constructEventFilter(arrayOfNames, whereClause) {
|
|
79
|
+
const selectClauses = constructSelectClause(arrayOfNames);
|
|
80
|
+
if (whereClause instanceof imports_1.ContentFilterElement) {
|
|
81
|
+
whereClause = new imports_1.ContentFilter({ elements: [whereClause] });
|
|
153
82
|
}
|
|
154
|
-
|
|
155
|
-
|
|
83
|
+
const filter = new imports_1.EventFilter({
|
|
84
|
+
selectClauses,
|
|
85
|
+
whereClause
|
|
86
|
+
});
|
|
87
|
+
return filter;
|
|
156
88
|
}
|
|
157
|
-
exports.
|
|
89
|
+
exports.constructEventFilter = constructEventFilter;
|
|
158
90
|
//# sourceMappingURL=tools_event_filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools_event_filter.js","sourceRoot":"","sources":["../source/tools_event_filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tools_event_filter.js","sourceRoot":"","sources":["../source/tools_event_filter.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,+DAAqD;AACrD,iEAA2F;AAG3F,uCAA2I;AAI3I,SAAgB,qBAAqB,CAAC,YAA+B;IACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAC9B,OAAO,qBAAqB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;KAChD;IAED,iEAAiE;IACjE,MAAM,aAAa,GAAG,YAAY,CAA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UAAU,CAAC,EAAE;YACxC,eAAe;YACf,EAAE;YACF,kGAAkG;YAClG,kFAAkF;YAClF,gFAAgF;YAChF,EAAE;YACF,0BAA0B;YAC1B,2CAA2C;YAC3C,gEAAgE;YAChE,qCAAqC;YACrC,0DAA0D;YAC1D,EAAE;YACF,OAAO,IAAI,gCAAsB,CAAC;gBAC9B,WAAW,EAAE,oCAAY,CAAC,MAAM;gBAChC,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,SAAS;gBACrB,gBAAgB,EAAE,oCAAa,CAAC,aAAa,CAAC,SAAS;aAC1D,CAAC,CAAC;SACN;;YACG,OAAO,IAAI,gCAAsB,CAAC;gBAC9B,WAAW,EAAE,oCAAY,CAAC,KAAK;gBAC/B,UAAU;gBACV,UAAU,EAAE,SAAS;gBACrB,gBAAgB,EAAE,oCAAa,CAAC,aAAa,CAAC,SAAS;aAC1D,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACzB,CAAC;AAxDD,sDAwDC;AACD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,oBAAoB,CAChC,YAA+B,EAC/B,WAAyD;IAEzD,MAAM,aAAa,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAE1D,IAAI,WAAW,YAAY,8BAAoB,EAAE;QAC7C,WAAW,GAAG,IAAI,uBAAa,CAAC,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;KAChE;IACD,MAAM,MAAM,GAAG,IAAI,qBAAW,CAAC;QAC3B,aAAa;QACb,WAAW;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC;AAdD,oDAcC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-service-filter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.75.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -service-filter",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -10,22 +10,26 @@
|
|
|
10
10
|
"build": "tsc -b"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"node-opcua-address-space-base": "2.75.0",
|
|
13
14
|
"node-opcua-assert": "2.74.0",
|
|
14
15
|
"node-opcua-basic-types": "2.74.0",
|
|
15
16
|
"node-opcua-binary-stream": "2.74.0",
|
|
16
17
|
"node-opcua-constants": "2.74.0",
|
|
17
|
-
"node-opcua-data-model": "2.
|
|
18
|
+
"node-opcua-data-model": "2.75.0",
|
|
19
|
+
"node-opcua-data-value": "2.75.0",
|
|
18
20
|
"node-opcua-debug": "2.74.0",
|
|
19
|
-
"node-opcua-
|
|
21
|
+
"node-opcua-extension-object": "2.75.0",
|
|
22
|
+
"node-opcua-factory": "2.75.0",
|
|
20
23
|
"node-opcua-nodeid": "2.74.0",
|
|
21
|
-
"node-opcua-numeric-range": "2.
|
|
22
|
-
"node-opcua-
|
|
24
|
+
"node-opcua-numeric-range": "2.75.0",
|
|
25
|
+
"node-opcua-packet-analyzer": "2.75.0",
|
|
26
|
+
"node-opcua-service-translate-browse-path": "2.75.0",
|
|
23
27
|
"node-opcua-status-code": "2.74.0",
|
|
24
|
-
"node-opcua-types": "2.
|
|
25
|
-
"node-opcua-variant": "2.
|
|
28
|
+
"node-opcua-types": "2.75.0",
|
|
29
|
+
"node-opcua-variant": "2.75.0"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
|
-
"node-opcua-service-secure-channel": "2.
|
|
32
|
+
"node-opcua-service-secure-channel": "2.75.0",
|
|
29
33
|
"should": "^13.2.3"
|
|
30
34
|
},
|
|
31
35
|
"author": "Etienne Rossignon",
|
|
@@ -43,5 +47,5 @@
|
|
|
43
47
|
"internet of things"
|
|
44
48
|
],
|
|
45
49
|
"homepage": "http://node-opcua.github.io/",
|
|
46
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "5ccb835ca480c2a8a591ae61b5949a9d8bad4017"
|
|
47
51
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-address-space
|
|
3
|
+
*/
|
|
4
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
5
|
+
import { SimpleAttributeOperand } from "node-opcua-types";
|
|
6
|
+
import { constructBrowsePathFromQualifiedName } from "node-opcua-service-translate-browse-path";
|
|
7
|
+
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
8
|
+
import { BaseNode, UAObjectType } from "node-opcua-address-space-base";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @method checkSelectClause
|
|
12
|
+
* @param parentNode
|
|
13
|
+
* @param selectClause
|
|
14
|
+
* @return {Array<StatusCode>}
|
|
15
|
+
*/
|
|
16
|
+
export function checkSelectClause(parentNode: BaseNode, selectClause: SimpleAttributeOperand): StatusCode {
|
|
17
|
+
//
|
|
18
|
+
const addressSpace = parentNode.addressSpace;
|
|
19
|
+
|
|
20
|
+
// istanbul ignore next
|
|
21
|
+
if (selectClause.typeDefinitionId.isEmpty()) {
|
|
22
|
+
return StatusCodes.Good;
|
|
23
|
+
}
|
|
24
|
+
const eventTypeNode = addressSpace.findEventType(selectClause.typeDefinitionId)!;
|
|
25
|
+
|
|
26
|
+
if (!eventTypeNode || !(eventTypeNode.nodeClass === NodeClass.ObjectType)) {
|
|
27
|
+
// xx console.log("eventTypeNode = ",selectClause.typeDefinitionId.toString());
|
|
28
|
+
// xx console.log("eventTypeNode = ",eventTypeNode);
|
|
29
|
+
// istanbul ignore next
|
|
30
|
+
if (eventTypeNode) {
|
|
31
|
+
console.log(eventTypeNode.toString());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// istanbul ignore next
|
|
36
|
+
if (eventTypeNode.nodeClass !== NodeClass.ObjectType) {
|
|
37
|
+
return StatusCodes.BadTypeMismatch;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// navigate to the innerNode specified by the browsePath [ QualifiedName]
|
|
41
|
+
const browsePath = constructBrowsePathFromQualifiedName(eventTypeNode, selectClause.browsePath);
|
|
42
|
+
const browsePathResult = addressSpace.browsePath(browsePath);
|
|
43
|
+
return browsePathResult.statusCode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @method checkSelectClauses
|
|
48
|
+
* @param eventTypeNode
|
|
49
|
+
* @param selectClauses
|
|
50
|
+
* @return an array of StatusCode
|
|
51
|
+
*/
|
|
52
|
+
export function checkSelectClauses(eventTypeNode: UAObjectType, selectClauses: SimpleAttributeOperand[]): StatusCode[] {
|
|
53
|
+
return selectClauses.map(checkSelectClause.bind(null, eventTypeNode));
|
|
54
|
+
}
|