node-opcua-service-filter 2.76.0 → 2.76.2
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 -17
- package/dist/check_event_clause.js +51 -51
- package/dist/check_where_clause.d.ts +3 -3
- package/dist/check_where_clause.js +249 -249
- package/dist/extract_event_field.d.ts +9 -9
- package/dist/extract_event_field.js +52 -52
- package/dist/filter_context.d.ts +11 -11
- package/dist/filter_context.js +2 -2
- package/dist/imports.d.ts +4 -4
- package/dist/imports.js +18 -18
- package/dist/index.d.ts +13 -13
- package/dist/index.js +61 -61
- package/dist/make_content_filter.d.ts +22 -22
- package/dist/make_content_filter.js +120 -120
- package/dist/on_address_space/extract_event_fields.d.ts +10 -10
- package/dist/on_address_space/extract_event_fields.js +17 -17
- package/dist/on_address_space/filter_context_on_address_space.d.ts +19 -19
- package/dist/on_address_space/filter_context_on_address_space.js +108 -108
- package/dist/on_address_space/index.d.ts +2 -2
- package/dist/on_address_space/index.js +18 -18
- package/dist/resolve_operand.d.ts +4 -4
- package/dist/resolve_operand.js +44 -44
- package/dist/tools_event_filter.d.ts +20 -20
- package/dist/tools_event_filter.js +89 -89
- package/package.json +15 -15
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeContentFilter = exports.makeContentFilterElements = exports.inList = exports.greaterThan = exports.greaterThanOrEqual = exports.LessThanOrEqual = exports.lessThan = exports.and = exports.or = exports.s = exports.n = exports.l = exports.ofType = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-service-filter
|
|
6
|
-
*/
|
|
7
|
-
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
9
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
10
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
11
|
-
const imports_1 = require("./imports");
|
|
12
|
-
function ofType(nodeId) {
|
|
13
|
-
const element = new imports_1.ContentFilterElement({
|
|
14
|
-
filterOperator: imports_1.FilterOperator.OfType,
|
|
15
|
-
filterOperands: [
|
|
16
|
-
new imports_1.LiteralOperand({
|
|
17
|
-
value: {
|
|
18
|
-
dataType: node_opcua_basic_types_1.DataType.NodeId,
|
|
19
|
-
value: (0, node_opcua_nodeid_1.resolveNodeId)(nodeId)
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
return element;
|
|
25
|
-
}
|
|
26
|
-
exports.ofType = ofType;
|
|
27
|
-
function l(dataType, value) {
|
|
28
|
-
switch (dataType) {
|
|
29
|
-
case node_opcua_basic_types_1.DataType.NodeId:
|
|
30
|
-
value = (0, node_opcua_nodeid_1.resolveNodeId)(value);
|
|
31
|
-
}
|
|
32
|
-
return new imports_1.LiteralOperand({ value: new node_opcua_variant_1.Variant({ dataType, value }) });
|
|
33
|
-
}
|
|
34
|
-
exports.l = l;
|
|
35
|
-
function n(n) {
|
|
36
|
-
return l(node_opcua_basic_types_1.DataType.NodeId, n);
|
|
37
|
-
}
|
|
38
|
-
exports.n = n;
|
|
39
|
-
function s(attributeId, path) {
|
|
40
|
-
return new imports_1.SimpleAttributeOperand({
|
|
41
|
-
attributeId: attributeId,
|
|
42
|
-
browsePath: path.split(".").map(node_opcua_data_model_1.coerceQualifiedName)
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
exports.s = s;
|
|
46
|
-
function or(a, b) {
|
|
47
|
-
return new imports_1.ContentFilterElement({
|
|
48
|
-
filterOperands: [a, b],
|
|
49
|
-
filterOperator: imports_1.FilterOperator.Or
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.or = or;
|
|
53
|
-
function and(a, b) {
|
|
54
|
-
return new imports_1.ContentFilterElement({
|
|
55
|
-
filterOperands: [a, b],
|
|
56
|
-
filterOperator: imports_1.FilterOperator.And
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
exports.and = and;
|
|
60
|
-
function lessThan(a, b) {
|
|
61
|
-
return new imports_1.ContentFilterElement({
|
|
62
|
-
filterOperands: [a, b],
|
|
63
|
-
filterOperator: imports_1.FilterOperator.LessThan
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
exports.lessThan = lessThan;
|
|
67
|
-
function LessThanOrEqual(a, b) {
|
|
68
|
-
return new imports_1.ContentFilterElement({
|
|
69
|
-
filterOperands: [a, b],
|
|
70
|
-
filterOperator: imports_1.FilterOperator.LessThanOrEqual
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
exports.LessThanOrEqual = LessThanOrEqual;
|
|
74
|
-
function greaterThanOrEqual(a, b) {
|
|
75
|
-
return new imports_1.ContentFilterElement({
|
|
76
|
-
filterOperands: [a, b],
|
|
77
|
-
filterOperator: imports_1.FilterOperator.GreaterThanOrEqual
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
exports.greaterThanOrEqual = greaterThanOrEqual;
|
|
81
|
-
function greaterThan(a, b) {
|
|
82
|
-
return new imports_1.ContentFilterElement({
|
|
83
|
-
filterOperands: [a, b],
|
|
84
|
-
filterOperator: imports_1.FilterOperator.GreaterThan
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
exports.greaterThan = greaterThan;
|
|
88
|
-
function inList(a, l) {
|
|
89
|
-
return new imports_1.ContentFilterElement({
|
|
90
|
-
filterOperands: [a, ...l],
|
|
91
|
-
filterOperator: imports_1.FilterOperator.InList
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
exports.inList = inList;
|
|
95
|
-
function makeContentFilterElements(o) {
|
|
96
|
-
const elements = [];
|
|
97
|
-
function pushElement(element) {
|
|
98
|
-
elements.push(element);
|
|
99
|
-
const thisIndex = elements.length - 1;
|
|
100
|
-
if (element.filterOperands) {
|
|
101
|
-
for (let i = 0; i < element.filterOperands.length; i++) {
|
|
102
|
-
const op = element.filterOperands[i];
|
|
103
|
-
if (op instanceof imports_1.ContentFilterElement) {
|
|
104
|
-
const index = pushElement(op);
|
|
105
|
-
element.filterOperands[i] = new imports_1.ElementOperand({ index });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return thisIndex;
|
|
110
|
-
}
|
|
111
|
-
pushElement(o);
|
|
112
|
-
return elements;
|
|
113
|
-
}
|
|
114
|
-
exports.makeContentFilterElements = makeContentFilterElements;
|
|
115
|
-
function makeContentFilter(o) {
|
|
116
|
-
return new imports_1.ContentFilter({
|
|
117
|
-
elements: makeContentFilterElements(o instanceof imports_1.ContentFilterElement ? o : new imports_1.ContentFilterElement(o))
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
exports.makeContentFilter = makeContentFilter;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeContentFilter = exports.makeContentFilterElements = exports.inList = exports.greaterThan = exports.greaterThanOrEqual = exports.LessThanOrEqual = exports.lessThan = exports.and = exports.or = exports.s = exports.n = exports.l = exports.ofType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-service-filter
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
9
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
10
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
11
|
+
const imports_1 = require("./imports");
|
|
12
|
+
function ofType(nodeId) {
|
|
13
|
+
const element = new imports_1.ContentFilterElement({
|
|
14
|
+
filterOperator: imports_1.FilterOperator.OfType,
|
|
15
|
+
filterOperands: [
|
|
16
|
+
new imports_1.LiteralOperand({
|
|
17
|
+
value: {
|
|
18
|
+
dataType: node_opcua_basic_types_1.DataType.NodeId,
|
|
19
|
+
value: (0, node_opcua_nodeid_1.resolveNodeId)(nodeId)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
return element;
|
|
25
|
+
}
|
|
26
|
+
exports.ofType = ofType;
|
|
27
|
+
function l(dataType, value) {
|
|
28
|
+
switch (dataType) {
|
|
29
|
+
case node_opcua_basic_types_1.DataType.NodeId:
|
|
30
|
+
value = (0, node_opcua_nodeid_1.resolveNodeId)(value);
|
|
31
|
+
}
|
|
32
|
+
return new imports_1.LiteralOperand({ value: new node_opcua_variant_1.Variant({ dataType, value }) });
|
|
33
|
+
}
|
|
34
|
+
exports.l = l;
|
|
35
|
+
function n(n) {
|
|
36
|
+
return l(node_opcua_basic_types_1.DataType.NodeId, n);
|
|
37
|
+
}
|
|
38
|
+
exports.n = n;
|
|
39
|
+
function s(attributeId, path) {
|
|
40
|
+
return new imports_1.SimpleAttributeOperand({
|
|
41
|
+
attributeId: attributeId,
|
|
42
|
+
browsePath: path.split(".").map(node_opcua_data_model_1.coerceQualifiedName)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.s = s;
|
|
46
|
+
function or(a, b) {
|
|
47
|
+
return new imports_1.ContentFilterElement({
|
|
48
|
+
filterOperands: [a, b],
|
|
49
|
+
filterOperator: imports_1.FilterOperator.Or
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.or = or;
|
|
53
|
+
function and(a, b) {
|
|
54
|
+
return new imports_1.ContentFilterElement({
|
|
55
|
+
filterOperands: [a, b],
|
|
56
|
+
filterOperator: imports_1.FilterOperator.And
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.and = and;
|
|
60
|
+
function lessThan(a, b) {
|
|
61
|
+
return new imports_1.ContentFilterElement({
|
|
62
|
+
filterOperands: [a, b],
|
|
63
|
+
filterOperator: imports_1.FilterOperator.LessThan
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.lessThan = lessThan;
|
|
67
|
+
function LessThanOrEqual(a, b) {
|
|
68
|
+
return new imports_1.ContentFilterElement({
|
|
69
|
+
filterOperands: [a, b],
|
|
70
|
+
filterOperator: imports_1.FilterOperator.LessThanOrEqual
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.LessThanOrEqual = LessThanOrEqual;
|
|
74
|
+
function greaterThanOrEqual(a, b) {
|
|
75
|
+
return new imports_1.ContentFilterElement({
|
|
76
|
+
filterOperands: [a, b],
|
|
77
|
+
filterOperator: imports_1.FilterOperator.GreaterThanOrEqual
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
exports.greaterThanOrEqual = greaterThanOrEqual;
|
|
81
|
+
function greaterThan(a, b) {
|
|
82
|
+
return new imports_1.ContentFilterElement({
|
|
83
|
+
filterOperands: [a, b],
|
|
84
|
+
filterOperator: imports_1.FilterOperator.GreaterThan
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.greaterThan = greaterThan;
|
|
88
|
+
function inList(a, l) {
|
|
89
|
+
return new imports_1.ContentFilterElement({
|
|
90
|
+
filterOperands: [a, ...l],
|
|
91
|
+
filterOperator: imports_1.FilterOperator.InList
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.inList = inList;
|
|
95
|
+
function makeContentFilterElements(o) {
|
|
96
|
+
const elements = [];
|
|
97
|
+
function pushElement(element) {
|
|
98
|
+
elements.push(element);
|
|
99
|
+
const thisIndex = elements.length - 1;
|
|
100
|
+
if (element.filterOperands) {
|
|
101
|
+
for (let i = 0; i < element.filterOperands.length; i++) {
|
|
102
|
+
const op = element.filterOperands[i];
|
|
103
|
+
if (op instanceof imports_1.ContentFilterElement) {
|
|
104
|
+
const index = pushElement(op);
|
|
105
|
+
element.filterOperands[i] = new imports_1.ElementOperand({ index });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return thisIndex;
|
|
110
|
+
}
|
|
111
|
+
pushElement(o);
|
|
112
|
+
return elements;
|
|
113
|
+
}
|
|
114
|
+
exports.makeContentFilterElements = makeContentFilterElements;
|
|
115
|
+
function makeContentFilter(o) {
|
|
116
|
+
return new imports_1.ContentFilter({
|
|
117
|
+
elements: makeContentFilterElements(o instanceof imports_1.ContentFilterElement ? o : new imports_1.ContentFilterElement(o))
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
exports.makeContentFilter = makeContentFilter;
|
|
121
121
|
//# sourceMappingURL=make_content_filter.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IEventData, ISessionContext } from "node-opcua-address-space-base";
|
|
2
|
-
import { SimpleAttributeOperand } from "node-opcua-types";
|
|
3
|
-
import { Variant } from "node-opcua-variant";
|
|
4
|
-
/**
|
|
5
|
-
* @method extractEventFields
|
|
6
|
-
* extract a array of eventFields from a event node, matching the selectClauses
|
|
7
|
-
* @param selectClauses
|
|
8
|
-
* @param eventData : a pseudo Node that provides a browse Method and a readValue(nodeId)
|
|
9
|
-
*/
|
|
10
|
-
export declare function extractEventFields(sessionContext: ISessionContext, selectClauses: SimpleAttributeOperand[], eventData: IEventData): Variant[];
|
|
1
|
+
import { IEventData, ISessionContext } from "node-opcua-address-space-base";
|
|
2
|
+
import { SimpleAttributeOperand } from "node-opcua-types";
|
|
3
|
+
import { Variant } from "node-opcua-variant";
|
|
4
|
+
/**
|
|
5
|
+
* @method extractEventFields
|
|
6
|
+
* extract a array of eventFields from a event node, matching the selectClauses
|
|
7
|
+
* @param selectClauses
|
|
8
|
+
* @param eventData : a pseudo Node that provides a browse Method and a readValue(nodeId)
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractEventFields(sessionContext: ISessionContext, selectClauses: SimpleAttributeOperand[], eventData: IEventData): Variant[];
|
|
@@ -1,18 +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;
|
|
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
18
|
//# sourceMappingURL=extract_event_fields.js.map
|
|
@@ -1,19 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,109 +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
|
-
}
|
|
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
109
|
//# sourceMappingURL=filter_context_on_address_space.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./filter_context_on_address_space";
|
|
2
|
-
export * from "./extract_event_fields";
|
|
1
|
+
export * from "./filter_context_on_address_space";
|
|
2
|
+
export * from "./extract_event_fields";
|
|
@@ -1,19 +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);
|
|
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
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +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;
|
|
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;
|