node-opcua-client 2.118.0 → 2.119.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/alarms_and_conditions/client_alarm_tools.d.ts +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools.js +5 -8
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.d.ts +1 -7
- package/dist/alarms_and_conditions/client_tools.js +15 -147
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session.d.ts +9 -0
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.d.ts +2 -1
- package/dist/client_subscription.js.map +1 -1
- package/dist/client_utils.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/private/client_base_impl.js +2 -2
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +1 -1
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +4 -0
- package/dist/private/client_session_impl.js +7 -3
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/performance.js.map +1 -1
- package/dist/reconnection.js.map +1 -1
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/verify.js.map +1 -1
- package/package.json +32 -31
- package/source/alarms_and_conditions/client_alarm_tools.ts +2 -6
- package/source/alarms_and_conditions/client_tools.ts +21 -185
- package/source/client_session.ts +10 -1
- package/source/client_subscription.ts +3 -2
- package/source/index.ts +3 -6
- package/source/private/client_session_impl.ts +4 -0
- package/source/alarms_and_conditions/client_alarm.ts +0 -130
- package/source/alarms_and_conditions/client_alarm_list.ts +0 -112
- package/source/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.ts +0 -187
- package/source/alarms_and_conditions/client_alarm_tools_dump_event.ts +0 -67
- package/source/alarms_and_conditions/client_alarm_tools_extractConditionFields.ts +0 -12
package/dist/verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../source/verify.ts"],"names":[],"mappings":";;;AAGA,yDAK2B;AAC3B,uDAAiG;AAGjG,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC,CAAC;AAE/C,SAAgB,6BAA6B,CACzC,WAAwB,EACxB,eAAuB,EACvB,IAAyB,EACzB,cAAsB;IAEtB,MAAM,eAAe,GAAG,IAAA,sCAAkB,EAAC,WAAW,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IAEvB,IAAI,eAAe,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../source/verify.ts"],"names":[],"mappings":";;;AAGA,yDAK2B;AAC3B,uDAAiG;AAGjG,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC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AC,CAAC;QAC5E,QAAQ,CAAC,kCAAkC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;QAC3E,MAAM,IAAI,KAAK,CACX,yHAAyH,CAC5H,CAAC;IACN,CAAC;IACD,iFAAiF;IACjF,MAAM,cAAc,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1D,IAAI,eAAe,IAAI,IAAI,EAAE,CAAC;QAC1B,UAAU,CACN,2HAA2H,eAAe,MAAM;YAC5I,2FAA2F;YAC3F,OAAO,cAAc,qEAAqE,CACjG,CAAC;IACN,CAAC;IACD,sGAAsG;IACtG,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAEvE,MAAM,OAAO,GAA6B;QACtC,yBAAyB,EAAE,KAAK;QAChC,+BAA+B,EAAE,KAAK;QACtC,wBAAwB,EAAE,KAAK;KAClC,CAAC;IAEF,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEhF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACpB,UAAU,CAAC,wDAAwD,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;IAC3H,CAAC;IAED,6BAA6B,CAAC,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;AAC7G,CAAC;AA9CD,sEA8CC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.119.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf node_modules dist *.tsbuildinfo certificates",
|
|
@@ -14,56 +14,57 @@
|
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@ster5/global-mutex": "^2.0.0",
|
|
17
|
-
"@types/async": "^3.2.
|
|
17
|
+
"@types/async": "^3.2.24",
|
|
18
18
|
"async": "^3.2.5",
|
|
19
19
|
"chalk": "4.1.2",
|
|
20
|
+
"node-opcua-alarm-condition": "2.119.0",
|
|
20
21
|
"node-opcua-assert": "2.105.0",
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
+
"node-opcua-basic-types": "2.119.0",
|
|
22
23
|
"node-opcua-buffer-utils": "2.117.0",
|
|
23
24
|
"node-opcua-certificate-manager": "2.118.0",
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
25
|
+
"node-opcua-client-dynamic-extension-object": "2.119.0",
|
|
26
|
+
"node-opcua-common": "2.119.0",
|
|
26
27
|
"node-opcua-constants": "2.114.0",
|
|
27
28
|
"node-opcua-crypto": "4.6.2",
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
29
|
+
"node-opcua-data-model": "2.119.0",
|
|
30
|
+
"node-opcua-data-value": "2.119.0",
|
|
30
31
|
"node-opcua-date-time": "2.118.0",
|
|
31
32
|
"node-opcua-debug": "2.118.0",
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
33
|
+
"node-opcua-extension-object": "2.119.0",
|
|
33
34
|
"node-opcua-hostname": "2.118.0",
|
|
34
35
|
"node-opcua-nodeid": "2.118.0",
|
|
35
36
|
"node-opcua-object-registry": "2.118.0",
|
|
36
37
|
"node-opcua-pki": "4.8.1",
|
|
37
|
-
"node-opcua-pseudo-session": "2.
|
|
38
|
-
"node-opcua-schemas": "2.
|
|
39
|
-
"node-opcua-secure-channel": "2.
|
|
40
|
-
"node-opcua-service-browse": "2.
|
|
41
|
-
"node-opcua-service-call": "2.
|
|
42
|
-
"node-opcua-service-discovery": "2.
|
|
43
|
-
"node-opcua-service-endpoints": "2.
|
|
44
|
-
"node-opcua-service-filter": "2.
|
|
45
|
-
"node-opcua-service-history": "2.
|
|
46
|
-
"node-opcua-service-query": "2.
|
|
47
|
-
"node-opcua-service-read": "2.
|
|
48
|
-
"node-opcua-service-register-node": "2.
|
|
49
|
-
"node-opcua-service-secure-channel": "2.
|
|
50
|
-
"node-opcua-service-session": "2.
|
|
51
|
-
"node-opcua-service-subscription": "2.
|
|
52
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
53
|
-
"node-opcua-service-write": "2.
|
|
38
|
+
"node-opcua-pseudo-session": "2.119.0",
|
|
39
|
+
"node-opcua-schemas": "2.119.0",
|
|
40
|
+
"node-opcua-secure-channel": "2.119.0",
|
|
41
|
+
"node-opcua-service-browse": "2.119.0",
|
|
42
|
+
"node-opcua-service-call": "2.119.0",
|
|
43
|
+
"node-opcua-service-discovery": "2.119.0",
|
|
44
|
+
"node-opcua-service-endpoints": "2.119.0",
|
|
45
|
+
"node-opcua-service-filter": "2.119.0",
|
|
46
|
+
"node-opcua-service-history": "2.119.0",
|
|
47
|
+
"node-opcua-service-query": "2.119.0",
|
|
48
|
+
"node-opcua-service-read": "2.119.0",
|
|
49
|
+
"node-opcua-service-register-node": "2.119.0",
|
|
50
|
+
"node-opcua-service-secure-channel": "2.119.0",
|
|
51
|
+
"node-opcua-service-session": "2.119.0",
|
|
52
|
+
"node-opcua-service-subscription": "2.119.0",
|
|
53
|
+
"node-opcua-service-translate-browse-path": "2.119.0",
|
|
54
|
+
"node-opcua-service-write": "2.119.0",
|
|
54
55
|
"node-opcua-status-code": "2.117.0",
|
|
55
|
-
"node-opcua-types": "2.
|
|
56
|
+
"node-opcua-types": "2.119.0",
|
|
56
57
|
"node-opcua-utils": "2.117.0",
|
|
57
|
-
"node-opcua-variant": "2.
|
|
58
|
+
"node-opcua-variant": "2.119.0",
|
|
58
59
|
"thenify": "^3.3.1"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@types/underscore": "^1.11.
|
|
62
|
+
"@types/underscore": "^1.11.15",
|
|
62
63
|
"dequeue": "^1.0.5",
|
|
63
64
|
"mocha": "^10.2.0",
|
|
64
|
-
"node-opcua-address-space": "2.
|
|
65
|
+
"node-opcua-address-space": "2.119.0",
|
|
65
66
|
"node-opcua-binary-stream": "2.117.0",
|
|
66
|
-
"node-opcua-factory": "2.
|
|
67
|
+
"node-opcua-factory": "2.119.0",
|
|
67
68
|
"node-opcua-leak-detector": "2.118.0",
|
|
68
69
|
"node-opcua-nodesets": "2.118.0",
|
|
69
70
|
"should": "^13.2.3",
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
"internet of things"
|
|
91
92
|
],
|
|
92
93
|
"homepage": "http://node-opcua.github.io/",
|
|
93
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "f985d1ada89600c33696c541e6ba3c78a1a7f340",
|
|
94
95
|
"files": [
|
|
95
96
|
"dist",
|
|
96
97
|
"source"
|
|
@@ -5,14 +5,11 @@ import { ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read"
|
|
|
5
5
|
import { CreateSubscriptionRequestOptions, MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
6
6
|
import { DataType, Variant } from "node-opcua-variant";
|
|
7
7
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
8
|
+
import { ClientAlarmList, EventStuff, callConditionRefresh, extractConditionFields, fieldsToJson } from "node-opcua-alarm-condition";
|
|
8
9
|
|
|
9
10
|
import { ClientMonitoredItem } from "../client_monitored_item";
|
|
10
11
|
import { ClientSubscription } from "../client_subscription";
|
|
11
12
|
import { ClientSession } from "../client_session";
|
|
12
|
-
import { EventStuff, fieldsToJson } from "./client_alarm";
|
|
13
|
-
import { ClientAlarmList } from "./client_alarm_list";
|
|
14
|
-
import { extractConditionFields } from "./client_alarm_tools_extractConditionFields";
|
|
15
|
-
import { callConditionRefresh } from "./client_tools";
|
|
16
13
|
|
|
17
14
|
const doDebug = checkDebugFlag("A&E");
|
|
18
15
|
const debugLog = make_debugLog("A&E");
|
|
@@ -110,7 +107,6 @@ export async function installAlarmMonitoring(session: ClientSession): Promise<Cl
|
|
|
110
107
|
|
|
111
108
|
let inInit = true;
|
|
112
109
|
eventMonitoringItem.on("changed", (eventFields: Variant[]) => {
|
|
113
|
-
|
|
114
110
|
const pojo = fieldsToJson(fields, eventFields);
|
|
115
111
|
const { eventType, eventId, conditionId, conditionName } = pojo;
|
|
116
112
|
|
|
@@ -154,7 +150,7 @@ export async function installAlarmMonitoring(session: ClientSession): Promise<Cl
|
|
|
154
150
|
});
|
|
155
151
|
|
|
156
152
|
try {
|
|
157
|
-
await callConditionRefresh(subscription);
|
|
153
|
+
await callConditionRefresh(session, subscription.subscriptionId);
|
|
158
154
|
} catch (err) {
|
|
159
155
|
if ((err as Error).message.match(/BadNothingToDo/)) {
|
|
160
156
|
/** fine! nothing to do */
|
|
@@ -1,95 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { callbackify } from "util";
|
|
5
|
+
import { LocalizedTextLike } from "node-opcua-data-model";
|
|
6
|
+
import { NodeId, NodeIdLike } from "node-opcua-nodeid";
|
|
7
|
+
import { StatusCode } from "node-opcua-status-code";
|
|
8
|
+
import { Callback } from "node-opcua-status-code";
|
|
9
|
+
import { acknowledgeCondition, callMethodCondition, confirmCondition } from "node-opcua-alarm-condition";
|
|
10
|
+
import { ResponseCallback, findMethodId } from "node-opcua-pseudo-session";
|
|
6
11
|
|
|
7
|
-
import async from "async";
|
|
8
|
-
import { assert } from "node-opcua-assert";
|
|
9
|
-
import { LocalizedText, LocalizedTextLike } from "node-opcua-data-model";
|
|
10
|
-
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
11
|
-
import { coerceNodeId, NodeId, NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
12
|
-
import { CallMethodRequest, CallMethodResult } from "node-opcua-service-call";
|
|
13
|
-
import { BrowsePathResult, makeBrowsePath } from "node-opcua-service-translate-browse-path";
|
|
14
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
15
|
-
import { DataType, Variant } from "node-opcua-variant";
|
|
16
|
-
import { Callback, ErrorCallback } from "node-opcua-status-code";
|
|
17
|
-
import { ResponseCallback } from "node-opcua-pseudo-session";
|
|
18
|
-
|
|
19
|
-
import { CallMethodRequestLike } from "../client_session";
|
|
20
|
-
import { ClientSubscription } from "../client_subscription";
|
|
21
12
|
import { ClientSessionImpl } from "../private/client_session_impl";
|
|
22
|
-
import { ClientSubscriptionImpl } from "../private/client_subscription_impl";
|
|
23
|
-
|
|
24
|
-
const debugLog = make_debugLog("A&E");
|
|
25
|
-
const doDebug = checkDebugFlag("A&E");
|
|
26
|
-
const warningLog = make_warningLog("A&E");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export async function callConditionRefresh(subscription: ClientSubscription): Promise<void>;
|
|
30
|
-
export function callConditionRefresh(subscription: ClientSubscription, callback: ErrorCallback): void;
|
|
31
|
-
export function callConditionRefresh(subscription: ClientSubscription, callback?: ErrorCallback): any {
|
|
32
|
-
const subscriptionI = subscription as ClientSubscriptionImpl;
|
|
33
|
-
const theSession = subscriptionI.publishEngine.session!;
|
|
34
|
-
|
|
35
|
-
const subscriptionId = subscription.subscriptionId;
|
|
36
|
-
|
|
37
|
-
assert(isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
38
|
-
assert(typeof callback === "function");
|
|
39
|
-
|
|
40
|
-
const conditionTypeNodeId = resolveNodeId("ConditionType");
|
|
41
|
-
|
|
42
|
-
let conditionRefreshId = resolveNodeId("ConditionType_ConditionRefresh");
|
|
43
|
-
|
|
44
|
-
async.series(
|
|
45
|
-
[
|
|
46
|
-
// find conditionRefreshId
|
|
47
|
-
(innerCallback: ErrorCallback) => {
|
|
48
|
-
const browsePath = makeBrowsePath(conditionTypeNodeId, ".ConditionRefresh");
|
|
49
|
-
theSession.translateBrowsePath(browsePath, (err: Error | null, result?: BrowsePathResult) => {
|
|
50
|
-
if (!err) {
|
|
51
|
-
result = result!;
|
|
52
|
-
// istanbul ignore else
|
|
53
|
-
if (result.targets && result.targets.length > 0) {
|
|
54
|
-
conditionRefreshId = result.targets[0].targetId;
|
|
55
|
-
} else {
|
|
56
|
-
// cannot find conditionRefreshId
|
|
57
|
-
debugLog("cannot find conditionRefreshId", result.toString());
|
|
58
|
-
err = new Error(" cannot find conditionRefreshId");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
innerCallback(err ? err : undefined);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
(innerCallback: ErrorCallback) => {
|
|
66
|
-
const methodToCall: CallMethodRequestLike = {
|
|
67
|
-
inputArguments: [new Variant({ dataType: DataType.UInt32, value: subscriptionId })],
|
|
68
|
-
methodId: conditionRefreshId,
|
|
69
|
-
objectId: conditionTypeNodeId
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
doDebug && debugLog("Calling method ", new CallMethodRequest(methodToCall).toString());
|
|
73
|
-
theSession.call(methodToCall, (err: Error | null, result?: CallMethodResult) => {
|
|
74
|
-
if (err) {
|
|
75
|
-
return innerCallback(err);
|
|
76
|
-
}
|
|
77
|
-
result = result!;
|
|
78
|
-
|
|
79
|
-
// istanbul ignore next
|
|
80
|
-
if (result.statusCode.isNotGood()) {
|
|
81
|
-
warningLog(new CallMethodRequest(methodToCall).toString());
|
|
82
|
-
return innerCallback(new Error("Error " + result.statusCode.toString()));
|
|
83
|
-
}
|
|
84
|
-
innerCallback();
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
(err) => {
|
|
89
|
-
callback!(err || undefined);
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
13
|
|
|
94
14
|
ClientSessionImpl.prototype.disableCondition = () => {
|
|
95
15
|
/** */
|
|
@@ -105,105 +25,22 @@ ClientSessionImpl.prototype.addCommentCondition = function (
|
|
|
105
25
|
comment: LocalizedTextLike,
|
|
106
26
|
callback: Callback<StatusCode>
|
|
107
27
|
) {
|
|
108
|
-
this
|
|
28
|
+
callbackify(callMethodCondition)(this, "AddComment", conditionId, eventId, comment, callback);
|
|
109
29
|
};
|
|
110
30
|
|
|
31
|
+
/** @deprecated */
|
|
111
32
|
ClientSessionImpl.prototype.findMethodId = function (nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/* istanbul ignore next */
|
|
119
|
-
if (!result) {
|
|
120
|
-
return callback(new Error("Internal Error"));
|
|
121
|
-
}
|
|
122
|
-
result.targets = result.targets || [];
|
|
123
|
-
|
|
124
|
-
// istanbul ignore else
|
|
125
|
-
if (result.targets.length > 0) {
|
|
126
|
-
methodId = result.targets[0].targetId;
|
|
127
|
-
return callback(null, methodId);
|
|
128
|
-
} else {
|
|
129
|
-
// cannot find objectWithMethodNodeId
|
|
130
|
-
debugLog("cannot find " + methodName + " Method", result.toString());
|
|
131
|
-
err = new Error(" cannot find " + methodName + " Method");
|
|
132
|
-
}
|
|
133
|
-
callback(err);
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
* @param methodName
|
|
140
|
-
* @param conditionId
|
|
141
|
-
* @param eventId
|
|
142
|
-
* @param comment
|
|
143
|
-
* @param callback
|
|
144
|
-
* @private
|
|
145
|
-
*/
|
|
146
|
-
ClientSessionImpl.prototype._callMethodCondition = function (
|
|
147
|
-
methodName: string,
|
|
148
|
-
conditionId: NodeIdLike,
|
|
149
|
-
eventId: Buffer,
|
|
150
|
-
comment: LocalizedTextLike,
|
|
151
|
-
callback: Callback<StatusCode>
|
|
152
|
-
) {
|
|
153
|
-
conditionId = coerceNodeId(conditionId);
|
|
154
|
-
assert(conditionId instanceof NodeId);
|
|
155
|
-
assert(eventId instanceof Buffer);
|
|
156
|
-
assert(typeof comment === "string" || comment instanceof LocalizedText);
|
|
157
|
-
|
|
158
|
-
comment = LocalizedText.coerce(comment) || new LocalizedText();
|
|
159
|
-
|
|
160
|
-
let methodId: NodeId;
|
|
161
|
-
|
|
162
|
-
let statusCode: StatusCode;
|
|
163
|
-
async.series(
|
|
164
|
-
[
|
|
165
|
-
(innerCallback: ErrorCallback) => {
|
|
166
|
-
this.findMethodId(conditionId, methodName, (err: Error | null, _methodId?: NodeId) => {
|
|
167
|
-
if (err) {
|
|
168
|
-
return innerCallback(err);
|
|
169
|
-
}
|
|
170
|
-
if (_methodId) {
|
|
171
|
-
methodId = _methodId;
|
|
172
|
-
}
|
|
173
|
-
innerCallback();
|
|
174
|
-
});
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
(innerCallback: ErrorCallback) => {
|
|
178
|
-
const methodToCalls = [];
|
|
179
|
-
|
|
180
|
-
methodToCalls.push(
|
|
181
|
-
new CallMethodRequest({
|
|
182
|
-
inputArguments: [
|
|
183
|
-
/* eventId */ new Variant({ dataType: "ByteString", value: eventId }),
|
|
184
|
-
/* comment */ new Variant({ dataType: "LocalizedText", value: comment })
|
|
185
|
-
],
|
|
186
|
-
methodId,
|
|
187
|
-
objectId: conditionId
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
this.call(methodToCalls, (err: Error | null, results?: CallMethodResult[]) => {
|
|
192
|
-
if (err) {
|
|
193
|
-
return innerCallback(err);
|
|
194
|
-
}
|
|
195
|
-
statusCode = results![0].statusCode;
|
|
196
|
-
innerCallback();
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
(err) => {
|
|
201
|
-
if (err) {
|
|
202
|
-
return callback(err);
|
|
33
|
+
findMethodId(this, nodeId, methodName)
|
|
34
|
+
.then((data) => {
|
|
35
|
+
if (data.methodId) {
|
|
36
|
+
callback(null, data.methodId);
|
|
37
|
+
} else {
|
|
38
|
+
callback(data.err);
|
|
203
39
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
40
|
+
})
|
|
41
|
+
.catch((err) => {
|
|
42
|
+
callback(err);
|
|
43
|
+
});
|
|
207
44
|
};
|
|
208
45
|
|
|
209
46
|
ClientSessionImpl.prototype.confirmCondition = function (
|
|
@@ -214,7 +51,7 @@ ClientSessionImpl.prototype.confirmCondition = function (
|
|
|
214
51
|
) {
|
|
215
52
|
// ns=0;i=9113 AcknowledgeableConditionType#Confirm
|
|
216
53
|
// note that confirm method is Optionals on condition
|
|
217
|
-
this
|
|
54
|
+
callbackify(confirmCondition)(this, conditionId, eventId, comment, callback);
|
|
218
55
|
};
|
|
219
56
|
|
|
220
57
|
ClientSessionImpl.prototype.acknowledgeCondition = function (
|
|
@@ -224,7 +61,7 @@ ClientSessionImpl.prototype.acknowledgeCondition = function (
|
|
|
224
61
|
callback: Callback<StatusCode>
|
|
225
62
|
) {
|
|
226
63
|
// ns=0;i=9111 AcknowledgeableConditionType#Acknowledge
|
|
227
|
-
this
|
|
64
|
+
callbackify(acknowledgeCondition)(this, conditionId, eventId, comment, callback);
|
|
228
65
|
};
|
|
229
66
|
|
|
230
67
|
// tslint:disable:no-var-requires
|
|
@@ -235,4 +72,3 @@ ClientSessionImpl.prototype.addCommentCondition = thenify.withCallback(ClientSes
|
|
|
235
72
|
ClientSessionImpl.prototype.findMethodId = thenify.withCallback(ClientSessionImpl.prototype.findMethodId, opts);
|
|
236
73
|
ClientSessionImpl.prototype.confirmCondition = thenify.withCallback(ClientSessionImpl.prototype.confirmCondition, opts);
|
|
237
74
|
ClientSessionImpl.prototype.acknowledgeCondition = thenify.withCallback(ClientSessionImpl.prototype.acknowledgeCondition, opts);
|
|
238
|
-
(module as any).exports.callConditionRefresh = thenify.withCallback((module as any).exports.callConditionRefresh, opts);
|
package/source/client_session.ts
CHANGED
|
@@ -720,8 +720,17 @@ export interface ClientSessionConditionService {
|
|
|
720
720
|
* @method findMethodId
|
|
721
721
|
*
|
|
722
722
|
* @param nodeId the nodeId of the parent Object
|
|
723
|
-
* @param methodName the method name
|
|
723
|
+
* @param methodName the method name
|
|
724
724
|
* @param callback
|
|
725
|
+
*
|
|
726
|
+
* note:
|
|
727
|
+
* - methodName is a browse name and may therefore be prefixed with a namespace index.
|
|
728
|
+
* - if method is not found on the object specified by nodeId, then the findMethodId will
|
|
729
|
+
* recursively browse up the hierarchy of object typeDefinition Node
|
|
730
|
+
* until it reaches the root type. and try to find the first method that matches the
|
|
731
|
+
* provided name.
|
|
732
|
+
*
|
|
733
|
+
* @deprecated use global findMethodId(session, nodeId, methoName): Promise<NodeId> instead
|
|
725
734
|
*/
|
|
726
735
|
findMethodId(nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>): void;
|
|
727
736
|
|
|
@@ -8,6 +8,7 @@ import { Byte, Double, UInt32 } from "node-opcua-basic-types";
|
|
|
8
8
|
|
|
9
9
|
import { DiagnosticInfo } from "node-opcua-data-model";
|
|
10
10
|
import { ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read";
|
|
11
|
+
import { IBasicSubscription } from "node-opcua-pseudo-session";
|
|
11
12
|
import {
|
|
12
13
|
MonitoringMode,
|
|
13
14
|
MonitoringParametersOptions,
|
|
@@ -51,7 +52,7 @@ export interface ModifySubscriptionResult {
|
|
|
51
52
|
revisedMaxKeepAliveCount: UInt32;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
export interface ClientSubscription extends EventEmitter
|
|
55
|
+
export interface ClientSubscription extends EventEmitter {
|
|
55
56
|
subscriptionId: SubscriptionId;
|
|
56
57
|
publishingInterval: number;
|
|
57
58
|
lifetimeCount: number;
|
|
@@ -304,7 +305,7 @@ export declare interface ClientSubscription {
|
|
|
304
305
|
): ClientMonitoredItem;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
|
-
export class ClientSubscription {
|
|
308
|
+
export class ClientSubscription implements IBasicSubscription {
|
|
308
309
|
public static create(clientSession: ClientSession, options: ClientSubscriptionOptions): ClientSubscription {
|
|
309
310
|
/* istanbul ignore next*/
|
|
310
311
|
throw new Error("Not Implemented");
|
package/source/index.ts
CHANGED
|
@@ -10,17 +10,14 @@ export * from "./client_monitored_item_base";
|
|
|
10
10
|
export * from "./client_monitored_item";
|
|
11
11
|
export * from "./client_monitored_item_group";
|
|
12
12
|
export * from "./alarms_and_conditions/client_tools";
|
|
13
|
-
export * from "./alarms_and_conditions/client_alarm";
|
|
14
|
-
export * from "./alarms_and_conditions/client_alarm_list";
|
|
15
|
-
export * from "./alarms_and_conditions/client_alarm_tools";
|
|
16
|
-
export * from "./alarms_and_conditions/client_alarm_tools_extractConditionFields";
|
|
17
|
-
export * from "./alarms_and_conditions/client_alarm_tools_dump_event";
|
|
18
|
-
export * from "./alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions";
|
|
19
13
|
export * from "./tools/findservers";
|
|
20
14
|
export * from "./tools/read_history_server_capabilities";
|
|
21
15
|
export * from "./client_utils";
|
|
22
16
|
export * from "./verify";
|
|
23
17
|
export * from "./user_identity_info";
|
|
18
|
+
export * from "./alarms_and_conditions/client_alarm_tools";
|
|
19
|
+
export * from "./alarms_and_conditions/client_tools";
|
|
20
|
+
export * from "node-opcua-alarm-condition";
|
|
24
21
|
|
|
25
22
|
export { assert } from "node-opcua-assert";
|
|
26
23
|
export * from "node-opcua-utils";
|
|
@@ -2094,6 +2094,10 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2094
2094
|
/** empty */
|
|
2095
2095
|
}
|
|
2096
2096
|
|
|
2097
|
+
/**
|
|
2098
|
+
* @deprecated
|
|
2099
|
+
* @private
|
|
2100
|
+
*/
|
|
2097
2101
|
public findMethodId(_nodeId: NodeIdLike, _methodName: string, _callback?: ResponseCallback<NodeId>): any {
|
|
2098
2102
|
/** empty */
|
|
2099
2103
|
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { assert } from "node-opcua-assert";
|
|
3
|
-
import { make_warningLog } from "node-opcua-debug";
|
|
4
|
-
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
5
|
-
import { StatusCode } from "node-opcua-status-code";
|
|
6
|
-
import { lowerFirstLetter } from "node-opcua-utils";
|
|
7
|
-
import { DataType, Variant } from "node-opcua-variant";
|
|
8
|
-
import { ClientSession } from "../client_session";
|
|
9
|
-
|
|
10
|
-
const warningLog = make_warningLog(__filename);
|
|
11
|
-
|
|
12
|
-
export interface TVariant<T> extends Variant {
|
|
13
|
-
value: T;
|
|
14
|
-
}
|
|
15
|
-
export interface TTwoStateStatus extends TVariant<string> {
|
|
16
|
-
id: TVariant<boolean>;
|
|
17
|
-
}
|
|
18
|
-
export interface EventStuff {
|
|
19
|
-
conditionId: TVariant<NodeId>;
|
|
20
|
-
eventType: TVariant<NodeId>;
|
|
21
|
-
eventId: TVariant<Buffer>;
|
|
22
|
-
retain: TVariant<boolean>;
|
|
23
|
-
activeState: TTwoStateStatus;
|
|
24
|
-
ackedState: TTwoStateStatus;
|
|
25
|
-
confirmedState: TTwoStateStatus;
|
|
26
|
-
conditionName?: TVariant<string>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ClientAlarm {
|
|
30
|
-
conditionId: NodeId;
|
|
31
|
-
eventType: NodeId;
|
|
32
|
-
fields: EventStuff;
|
|
33
|
-
on(eventName: "changed", eventHandler: () => void): this;
|
|
34
|
-
acknowledge(session: ClientSession, comment: string): Promise<StatusCode>;
|
|
35
|
-
getField(fieldName: string): Variant | null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* describes a OPCUA Alarm as seen in the client side
|
|
40
|
-
*/
|
|
41
|
-
export class ClientAlarm extends EventEmitter {
|
|
42
|
-
public conditionId: NodeId;
|
|
43
|
-
public eventType: NodeId;
|
|
44
|
-
public eventId: Buffer;
|
|
45
|
-
public fields: EventStuff;
|
|
46
|
-
|
|
47
|
-
public constructor(eventFields: EventStuff) {
|
|
48
|
-
super();
|
|
49
|
-
this.conditionId = resolveNodeId(eventFields.conditionId.value);
|
|
50
|
-
this.eventType = resolveNodeId(eventFields.eventType.value);
|
|
51
|
-
this.eventId = eventFields.eventId.value;
|
|
52
|
-
this.fields = eventFields;
|
|
53
|
-
this.update(eventFields);
|
|
54
|
-
}
|
|
55
|
-
public async acknowledge(session: ClientSession, comment: string): Promise<StatusCode> {
|
|
56
|
-
return await session.acknowledgeCondition(this.conditionId, this.eventId, comment);
|
|
57
|
-
}
|
|
58
|
-
public async confirm(session: ClientSession, comment: string): Promise<StatusCode> {
|
|
59
|
-
return await session.confirmCondition(this.conditionId, this.eventId, comment);
|
|
60
|
-
}
|
|
61
|
-
public update(eventFields: EventStuff): void {
|
|
62
|
-
assert(this.conditionId.toString() === resolveNodeId(eventFields.conditionId.value).toString());
|
|
63
|
-
assert(this.eventType.toString() === resolveNodeId(eventFields.eventType.value).toString());
|
|
64
|
-
this.eventId = eventFields.eventId.value;
|
|
65
|
-
this.fields = eventFields;
|
|
66
|
-
}
|
|
67
|
-
public getRetain(): boolean {
|
|
68
|
-
return this.fields.retain.value;
|
|
69
|
-
}
|
|
70
|
-
public toString(): string {
|
|
71
|
-
return (
|
|
72
|
-
this.constructor.name +
|
|
73
|
-
": " +
|
|
74
|
-
this.conditionId.toString() +
|
|
75
|
-
" " +
|
|
76
|
-
this.eventType.toString() +
|
|
77
|
-
" " +
|
|
78
|
-
Object.entries(this.fields)
|
|
79
|
-
.filter(([key, value]) => value.dataType !== DataType.Null)
|
|
80
|
-
.map(([key, value]) => key.padEnd(30) + "=" + value.toString())
|
|
81
|
-
.join("\n") +
|
|
82
|
-
"\n\n"
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public getField(fieldName: string): Variant | null {
|
|
87
|
-
return (this.fields as any)[fieldName] || null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @private
|
|
93
|
-
*/
|
|
94
|
-
export function fieldsToJson(fields: string[], eventFields: Variant[], flat?: boolean): EventStuff {
|
|
95
|
-
|
|
96
|
-
function setProperty(_data: Record<string, unknown>, fieldName: string, value: Variant) {
|
|
97
|
-
let name: string;
|
|
98
|
-
if (!fieldName || value === null) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (!flat) {
|
|
102
|
-
const f = fieldName.split(".");
|
|
103
|
-
if (f.length === 1) {
|
|
104
|
-
fieldName = lowerFirstLetter(fieldName);
|
|
105
|
-
_data[fieldName] = value;
|
|
106
|
-
} else {
|
|
107
|
-
for (let i = 0; i < f.length - 1; i++) {
|
|
108
|
-
name = lowerFirstLetter(f[i]);
|
|
109
|
-
_data[name] = _data[name] || {};
|
|
110
|
-
_data = _data[name] as Record<string, unknown>;
|
|
111
|
-
}
|
|
112
|
-
name = lowerFirstLetter(f[f.length - 1]);
|
|
113
|
-
_data[name] = value;
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
const name = fieldName.split(".").map(lowerFirstLetter).join(".");
|
|
117
|
-
_data[name] = value;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (fields.length > eventFields.length) {
|
|
121
|
-
warningLog("warning fields.length !== eventFields.length", fields.length, eventFields.length);
|
|
122
|
-
}
|
|
123
|
-
const data: any = {};
|
|
124
|
-
for (let index = 0; index < fields.length; index++) {
|
|
125
|
-
const variant = eventFields[index];
|
|
126
|
-
setProperty(data, fields[index], variant);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return data;
|
|
130
|
-
}
|