node-opcua-client 2.118.0 → 2.119.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/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_session.d.ts +9 -0
- package/dist/client_subscription.d.ts +2 -1
- package/dist/client_subscription.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_session_impl.d.ts +4 -0
- package/dist/private/client_session_impl.js +4 -0
- package/dist/private/client_session_impl.js.map +1 -1
- package/package.json +33 -32
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { ClientAlarmList } from "node-opcua-alarm-condition";
|
|
1
2
|
import { ClientSession } from "../client_session";
|
|
2
|
-
import { ClientAlarmList } from "./client_alarm_list";
|
|
3
3
|
export declare function uninstallAlarmMonitoring(session: ClientSession): Promise<void>;
|
|
4
4
|
export declare function installAlarmMonitoring(session: ClientSession): Promise<ClientAlarmList>;
|
|
@@ -7,10 +7,7 @@ const node_opcua_service_filter_1 = require("node-opcua-service-filter");
|
|
|
7
7
|
const node_opcua_service_read_1 = require("node-opcua-service-read");
|
|
8
8
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
9
9
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
10
|
-
const
|
|
11
|
-
const client_alarm_list_1 = require("./client_alarm_list");
|
|
12
|
-
const client_alarm_tools_extractConditionFields_1 = require("./client_alarm_tools_extractConditionFields");
|
|
13
|
-
const client_tools_1 = require("./client_tools");
|
|
10
|
+
const node_opcua_alarm_condition_1 = require("node-opcua-alarm-condition");
|
|
14
11
|
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("A&E");
|
|
15
12
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)("A&E");
|
|
16
13
|
const warningLog = (0, node_opcua_debug_1.make_warningLog)("A&E");
|
|
@@ -52,7 +49,7 @@ async function installAlarmMonitoring(session) {
|
|
|
52
49
|
if (_sessionPriv.$clientAlarmList) {
|
|
53
50
|
return _sessionPriv.$clientAlarmList;
|
|
54
51
|
}
|
|
55
|
-
const clientAlarmList = new
|
|
52
|
+
const clientAlarmList = new node_opcua_alarm_condition_1.ClientAlarmList();
|
|
56
53
|
_sessionPriv.$clientAlarmList = clientAlarmList;
|
|
57
54
|
const request = {
|
|
58
55
|
maxNotificationsPerPublish: 100,
|
|
@@ -68,7 +65,7 @@ async function installAlarmMonitoring(session) {
|
|
|
68
65
|
attributeId: node_opcua_data_model_1.AttributeIds.EventNotifier,
|
|
69
66
|
nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server") // i=2253
|
|
70
67
|
};
|
|
71
|
-
const fields = await (0,
|
|
68
|
+
const fields = await (0, node_opcua_alarm_condition_1.extractConditionFields)(session, "AlarmConditionType");
|
|
72
69
|
const AcknowledgeableConditionType = (0, node_opcua_nodeid_1.resolveNodeId)("AcknowledgeableConditionType");
|
|
73
70
|
const eventFilter = (0, node_opcua_service_filter_1.constructEventFilter)(fields, (0, node_opcua_service_filter_1.ofType)(AcknowledgeableConditionType));
|
|
74
71
|
const monitoringParameters = {
|
|
@@ -89,7 +86,7 @@ async function installAlarmMonitoring(session) {
|
|
|
89
86
|
}
|
|
90
87
|
let inInit = true;
|
|
91
88
|
eventMonitoringItem.on("changed", (eventFields) => {
|
|
92
|
-
const pojo = (0,
|
|
89
|
+
const pojo = (0, node_opcua_alarm_condition_1.fieldsToJson)(fields, eventFields);
|
|
93
90
|
const { eventType, eventId, conditionId, conditionName } = pojo;
|
|
94
91
|
debugLog("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED " +
|
|
95
92
|
eventType.value.toString() +
|
|
@@ -123,7 +120,7 @@ async function installAlarmMonitoring(session) {
|
|
|
123
120
|
// TODO
|
|
124
121
|
});
|
|
125
122
|
try {
|
|
126
|
-
await (0,
|
|
123
|
+
await (0, node_opcua_alarm_condition_1.callConditionRefresh)(session, subscription.subscriptionId);
|
|
127
124
|
}
|
|
128
125
|
catch (err) {
|
|
129
126
|
if (err.message.match(/BadNothingToDo/)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_alarm_tools.ts"],"names":[],"mappings":";;;AAAA,iEAAqD;AACrD,yDAAkD;AAClD,yEAAyE;AACzE,qEAAiF;AAEjF,2DAAuD;AACvD,uDAAkF;
|
|
1
|
+
{"version":3,"file":"client_alarm_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_alarm_tools.ts"],"names":[],"mappings":";;;AAAA,iEAAqD;AACrD,yDAAkD;AAClD,yEAAyE;AACzE,qEAAiF;AAEjF,2DAAuD;AACvD,uDAAkF;AAClF,2EAAqI;AAMrI,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,KAAK,CAAC,CAAC;AACtC,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,KAAK,CAAC,CAAC;A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EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;KACpE;IAAC,OAAO,GAAG,EAAE;QACV,IAAK,GAAa,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;YAChD,0BAA0B;SAC7B;aAAM;YACH,UAAU,CAAC,4CAA4C,EAAU,GAAI,CAAC,OAAO,CAAC,CAAC;SAClF;KACJ;IACD,YAAY,CAAC,0BAA0B,GAAG,mBAAmB,CAAC;IAE9D,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,GAAG,KAAK,CAAC;IAEf,uBAAuB;IACvB,OAAO,eAAe,CAAC;AAC3B,CAAC;AA9GD,wDA8GC"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* @module node-opcua-client
|
|
3
|
-
*/
|
|
4
|
-
import { ErrorCallback } from "node-opcua-status-code";
|
|
5
|
-
import { ClientSubscription } from "../client_subscription";
|
|
6
|
-
export declare function callConditionRefresh(subscription: ClientSubscription): Promise<void>;
|
|
7
|
-
export declare function callConditionRefresh(subscription: ClientSubscription, callback: ErrorCallback): void;
|
|
1
|
+
export {};
|
|
@@ -1,79 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
/**
|
|
3
4
|
* @module node-opcua-client
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.callConditionRefresh = void 0;
|
|
12
|
-
const async_1 = __importDefault(require("async"));
|
|
13
|
-
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
14
|
-
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
15
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
16
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
17
|
-
const node_opcua_service_call_1 = require("node-opcua-service-call");
|
|
18
|
-
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
19
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
6
|
+
const util_1 = require("util");
|
|
7
|
+
const node_opcua_alarm_condition_1 = require("node-opcua-alarm-condition");
|
|
8
|
+
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
20
9
|
const client_session_impl_1 = require("../private/client_session_impl");
|
|
21
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)("A&E");
|
|
22
|
-
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("A&E");
|
|
23
|
-
const warningLog = (0, node_opcua_debug_1.make_warningLog)("A&E");
|
|
24
|
-
function callConditionRefresh(subscription, callback) {
|
|
25
|
-
const subscriptionI = subscription;
|
|
26
|
-
const theSession = subscriptionI.publishEngine.session;
|
|
27
|
-
const subscriptionId = subscription.subscriptionId;
|
|
28
|
-
(0, node_opcua_assert_1.assert)(isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
29
|
-
(0, node_opcua_assert_1.assert)(typeof callback === "function");
|
|
30
|
-
const conditionTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("ConditionType");
|
|
31
|
-
let conditionRefreshId = (0, node_opcua_nodeid_1.resolveNodeId)("ConditionType_ConditionRefresh");
|
|
32
|
-
async_1.default.series([
|
|
33
|
-
// find conditionRefreshId
|
|
34
|
-
(innerCallback) => {
|
|
35
|
-
const browsePath = (0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(conditionTypeNodeId, ".ConditionRefresh");
|
|
36
|
-
theSession.translateBrowsePath(browsePath, (err, result) => {
|
|
37
|
-
if (!err) {
|
|
38
|
-
result = result;
|
|
39
|
-
// istanbul ignore else
|
|
40
|
-
if (result.targets && result.targets.length > 0) {
|
|
41
|
-
conditionRefreshId = result.targets[0].targetId;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// cannot find conditionRefreshId
|
|
45
|
-
debugLog("cannot find conditionRefreshId", result.toString());
|
|
46
|
-
err = new Error(" cannot find conditionRefreshId");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
innerCallback(err ? err : undefined);
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
(innerCallback) => {
|
|
53
|
-
const methodToCall = {
|
|
54
|
-
inputArguments: [new node_opcua_variant_1.Variant({ dataType: node_opcua_variant_1.DataType.UInt32, value: subscriptionId })],
|
|
55
|
-
methodId: conditionRefreshId,
|
|
56
|
-
objectId: conditionTypeNodeId
|
|
57
|
-
};
|
|
58
|
-
doDebug && debugLog("Calling method ", new node_opcua_service_call_1.CallMethodRequest(methodToCall).toString());
|
|
59
|
-
theSession.call(methodToCall, (err, result) => {
|
|
60
|
-
if (err) {
|
|
61
|
-
return innerCallback(err);
|
|
62
|
-
}
|
|
63
|
-
result = result;
|
|
64
|
-
// istanbul ignore next
|
|
65
|
-
if (result.statusCode.isNotGood()) {
|
|
66
|
-
warningLog(new node_opcua_service_call_1.CallMethodRequest(methodToCall).toString());
|
|
67
|
-
return innerCallback(new Error("Error " + result.statusCode.toString()));
|
|
68
|
-
}
|
|
69
|
-
innerCallback();
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
], (err) => {
|
|
73
|
-
callback(err || undefined);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
exports.callConditionRefresh = callConditionRefresh;
|
|
77
10
|
client_session_impl_1.ClientSessionImpl.prototype.disableCondition = () => {
|
|
78
11
|
/** */
|
|
79
12
|
};
|
|
@@ -81,95 +14,31 @@ client_session_impl_1.ClientSessionImpl.prototype.enableCondition = () => {
|
|
|
81
14
|
/** */
|
|
82
15
|
};
|
|
83
16
|
client_session_impl_1.ClientSessionImpl.prototype.addCommentCondition = function (conditionId, eventId, comment, callback) {
|
|
84
|
-
|
|
17
|
+
(0, util_1.callbackify)(node_opcua_alarm_condition_1.callMethodCondition)(this, "AddComment", conditionId, eventId, comment, callback);
|
|
85
18
|
};
|
|
19
|
+
/** @deprecated */
|
|
86
20
|
client_session_impl_1.ClientSessionImpl.prototype.findMethodId = function (nodeId, methodName, callback) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return callback(err);
|
|
92
|
-
}
|
|
93
|
-
/* istanbul ignore next */
|
|
94
|
-
if (!result) {
|
|
95
|
-
return callback(new Error("Internal Error"));
|
|
96
|
-
}
|
|
97
|
-
result.targets = result.targets || [];
|
|
98
|
-
// istanbul ignore else
|
|
99
|
-
if (result.targets.length > 0) {
|
|
100
|
-
methodId = result.targets[0].targetId;
|
|
101
|
-
return callback(null, methodId);
|
|
21
|
+
(0, node_opcua_pseudo_session_1.findMethodId)(this, nodeId, methodName)
|
|
22
|
+
.then((data) => {
|
|
23
|
+
if (data.methodId) {
|
|
24
|
+
callback(null, data.methodId);
|
|
102
25
|
}
|
|
103
26
|
else {
|
|
104
|
-
|
|
105
|
-
debugLog("cannot find " + methodName + " Method", result.toString());
|
|
106
|
-
err = new Error(" cannot find " + methodName + " Method");
|
|
27
|
+
callback(data.err);
|
|
107
28
|
}
|
|
29
|
+
})
|
|
30
|
+
.catch((err) => {
|
|
108
31
|
callback(err);
|
|
109
32
|
});
|
|
110
33
|
};
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
* @param methodName
|
|
114
|
-
* @param conditionId
|
|
115
|
-
* @param eventId
|
|
116
|
-
* @param comment
|
|
117
|
-
* @param callback
|
|
118
|
-
* @private
|
|
119
|
-
*/
|
|
120
|
-
client_session_impl_1.ClientSessionImpl.prototype._callMethodCondition = function (methodName, conditionId, eventId, comment, callback) {
|
|
121
|
-
conditionId = (0, node_opcua_nodeid_1.coerceNodeId)(conditionId);
|
|
122
|
-
(0, node_opcua_assert_1.assert)(conditionId instanceof node_opcua_nodeid_1.NodeId);
|
|
123
|
-
(0, node_opcua_assert_1.assert)(eventId instanceof Buffer);
|
|
124
|
-
(0, node_opcua_assert_1.assert)(typeof comment === "string" || comment instanceof node_opcua_data_model_1.LocalizedText);
|
|
125
|
-
comment = node_opcua_data_model_1.LocalizedText.coerce(comment) || new node_opcua_data_model_1.LocalizedText();
|
|
126
|
-
let methodId;
|
|
127
|
-
let statusCode;
|
|
128
|
-
async_1.default.series([
|
|
129
|
-
(innerCallback) => {
|
|
130
|
-
this.findMethodId(conditionId, methodName, (err, _methodId) => {
|
|
131
|
-
if (err) {
|
|
132
|
-
return innerCallback(err);
|
|
133
|
-
}
|
|
134
|
-
if (_methodId) {
|
|
135
|
-
methodId = _methodId;
|
|
136
|
-
}
|
|
137
|
-
innerCallback();
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
(innerCallback) => {
|
|
141
|
-
const methodToCalls = [];
|
|
142
|
-
methodToCalls.push(new node_opcua_service_call_1.CallMethodRequest({
|
|
143
|
-
inputArguments: [
|
|
144
|
-
/* eventId */ new node_opcua_variant_1.Variant({ dataType: "ByteString", value: eventId }),
|
|
145
|
-
/* comment */ new node_opcua_variant_1.Variant({ dataType: "LocalizedText", value: comment })
|
|
146
|
-
],
|
|
147
|
-
methodId,
|
|
148
|
-
objectId: conditionId
|
|
149
|
-
}));
|
|
150
|
-
this.call(methodToCalls, (err, results) => {
|
|
151
|
-
if (err) {
|
|
152
|
-
return innerCallback(err);
|
|
153
|
-
}
|
|
154
|
-
statusCode = results[0].statusCode;
|
|
155
|
-
innerCallback();
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
], (err) => {
|
|
159
|
-
if (err) {
|
|
160
|
-
return callback(err);
|
|
161
|
-
}
|
|
162
|
-
callback(null, statusCode);
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
34
|
client_session_impl_1.ClientSessionImpl.prototype.confirmCondition = function (conditionId, eventId, comment, callback) {
|
|
166
35
|
// ns=0;i=9113 AcknowledgeableConditionType#Confirm
|
|
167
36
|
// note that confirm method is Optionals on condition
|
|
168
|
-
|
|
37
|
+
(0, util_1.callbackify)(node_opcua_alarm_condition_1.confirmCondition)(this, conditionId, eventId, comment, callback);
|
|
169
38
|
};
|
|
170
39
|
client_session_impl_1.ClientSessionImpl.prototype.acknowledgeCondition = function (conditionId, eventId, comment, callback) {
|
|
171
40
|
// ns=0;i=9111 AcknowledgeableConditionType#Acknowledge
|
|
172
|
-
|
|
41
|
+
(0, util_1.callbackify)(node_opcua_alarm_condition_1.acknowledgeCondition)(this, conditionId, eventId, comment, callback);
|
|
173
42
|
};
|
|
174
43
|
// tslint:disable:no-var-requires
|
|
175
44
|
// tslint:disable:max-line-length
|
|
@@ -179,5 +48,4 @@ client_session_impl_1.ClientSessionImpl.prototype.addCommentCondition = thenify.
|
|
|
179
48
|
client_session_impl_1.ClientSessionImpl.prototype.findMethodId = thenify.withCallback(client_session_impl_1.ClientSessionImpl.prototype.findMethodId, opts);
|
|
180
49
|
client_session_impl_1.ClientSessionImpl.prototype.confirmCondition = thenify.withCallback(client_session_impl_1.ClientSessionImpl.prototype.confirmCondition, opts);
|
|
181
50
|
client_session_impl_1.ClientSessionImpl.prototype.acknowledgeCondition = thenify.withCallback(client_session_impl_1.ClientSessionImpl.prototype.acknowledgeCondition, opts);
|
|
182
|
-
module.exports.callConditionRefresh = thenify.withCallback(module.exports.callConditionRefresh, opts);
|
|
183
51
|
//# sourceMappingURL=client_tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_tools.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client_tools.js","sourceRoot":"","sources":["../../source/alarms_and_conditions/client_tools.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,+BAAmC;AAKnC,2EAAyG;AACzG,yEAA2E;AAE3E,wEAAmE;AAEnE,uCAAiB,CAAC,SAAS,CAAC,gBAAgB,GAAG,GAAG,EAAE;IAChD,MAAM;AACV,CAAC,CAAC;AA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iDAAoB,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,iCAAiC;AACjC,iCAAiC;AACjC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAClC,uCAAiB,CAAC,SAAS,CAAC,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,uCAAiB,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;AAC9H,uCAAiB,CAAC,SAAS,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,uCAAiB,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AAChH,uCAAiB,CAAC,SAAS,CAAC,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,uCAAiB,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACxH,uCAAiB,CAAC,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,uCAAiB,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC"}
|
package/dist/client_session.d.ts
CHANGED
|
@@ -479,6 +479,15 @@ export interface ClientSessionConditionService {
|
|
|
479
479
|
* @param nodeId the nodeId of the parent Object
|
|
480
480
|
* @param methodName the method name
|
|
481
481
|
* @param callback
|
|
482
|
+
*
|
|
483
|
+
* note:
|
|
484
|
+
* - methodName is a browse name and may therefore be prefixed with a namespace index.
|
|
485
|
+
* - if method is not found on the object specified by nodeId, then the findMethodId will
|
|
486
|
+
* recursively browse up the hierarchy of object typeDefinition Node
|
|
487
|
+
* until it reaches the root type. and try to find the first method that matches the
|
|
488
|
+
* provided name.
|
|
489
|
+
*
|
|
490
|
+
* @deprecated use global findMethodId(session, nodeId, methoName): Promise<NodeId> instead
|
|
482
491
|
*/
|
|
483
492
|
findMethodId(nodeId: NodeIdLike, methodName: string, callback: ResponseCallback<NodeId>): void;
|
|
484
493
|
findMethodId(nodeId: NodeIdLike, methodName: string): Promise<NodeId>;
|
|
@@ -6,6 +6,7 @@ import { EventEmitter } from "events";
|
|
|
6
6
|
import { Byte, Double, UInt32 } from "node-opcua-basic-types";
|
|
7
7
|
import { DiagnosticInfo } from "node-opcua-data-model";
|
|
8
8
|
import { ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read";
|
|
9
|
+
import { IBasicSubscription } from "node-opcua-pseudo-session";
|
|
9
10
|
import { MonitoringMode, MonitoringParametersOptions, NotificationMessage, SetTriggeringResponse } from "node-opcua-service-subscription";
|
|
10
11
|
import { Callback, StatusCode } from "node-opcua-status-code";
|
|
11
12
|
import { ErrorCallback } from "node-opcua-status-code";
|
|
@@ -235,7 +236,7 @@ export declare interface ClientSubscription {
|
|
|
235
236
|
export declare interface ClientSubscription {
|
|
236
237
|
_createMonitoredItem(itemToMonitor: ReadValueIdOptions, monitoringParameters: MonitoringParametersOptions, timestampsToReturn: TimestampsToReturn): ClientMonitoredItem;
|
|
237
238
|
}
|
|
238
|
-
export declare class ClientSubscription {
|
|
239
|
+
export declare class ClientSubscription implements IBasicSubscription {
|
|
239
240
|
static create(clientSession: ClientSession, options: ClientSubscriptionOptions): ClientSubscription;
|
|
240
241
|
static ignoreNextWarning: boolean;
|
|
241
242
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_subscription.js","sourceRoot":"","sources":["../source/client_subscription.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"client_subscription.js","sourceRoot":"","sources":["../source/client_subscription.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAiTH,MAAa,kBAAkB;IACpB,MAAM,CAAC,MAAM,CAAC,aAA4B,EAAE,OAAkC;QACjF,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;;AAJL,gDAMC;AADiB,oCAAiB,GAAG,KAAK,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,17 +9,14 @@ export * from "./client_monitored_item_base";
|
|
|
9
9
|
export * from "./client_monitored_item";
|
|
10
10
|
export * from "./client_monitored_item_group";
|
|
11
11
|
export * from "./alarms_and_conditions/client_tools";
|
|
12
|
-
export * from "./alarms_and_conditions/client_alarm";
|
|
13
|
-
export * from "./alarms_and_conditions/client_alarm_list";
|
|
14
|
-
export * from "./alarms_and_conditions/client_alarm_tools";
|
|
15
|
-
export * from "./alarms_and_conditions/client_alarm_tools_extractConditionFields";
|
|
16
|
-
export * from "./alarms_and_conditions/client_alarm_tools_dump_event";
|
|
17
|
-
export * from "./alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions";
|
|
18
12
|
export * from "./tools/findservers";
|
|
19
13
|
export * from "./tools/read_history_server_capabilities";
|
|
20
14
|
export * from "./client_utils";
|
|
21
15
|
export * from "./verify";
|
|
22
16
|
export * from "./user_identity_info";
|
|
17
|
+
export * from "./alarms_and_conditions/client_alarm_tools";
|
|
18
|
+
export * from "./alarms_and_conditions/client_tools";
|
|
19
|
+
export * from "node-opcua-alarm-condition";
|
|
23
20
|
export { assert } from "node-opcua-assert";
|
|
24
21
|
export * from "node-opcua-utils";
|
|
25
22
|
export { ClientSidePublishEngine } from "./private/client_publish_engine";
|
package/dist/index.js
CHANGED
|
@@ -38,17 +38,14 @@ __exportStar(require("./client_monitored_item_base"), exports);
|
|
|
38
38
|
__exportStar(require("./client_monitored_item"), exports);
|
|
39
39
|
__exportStar(require("./client_monitored_item_group"), exports);
|
|
40
40
|
__exportStar(require("./alarms_and_conditions/client_tools"), exports);
|
|
41
|
-
__exportStar(require("./alarms_and_conditions/client_alarm"), exports);
|
|
42
|
-
__exportStar(require("./alarms_and_conditions/client_alarm_list"), exports);
|
|
43
|
-
__exportStar(require("./alarms_and_conditions/client_alarm_tools"), exports);
|
|
44
|
-
__exportStar(require("./alarms_and_conditions/client_alarm_tools_extractConditionFields"), exports);
|
|
45
|
-
__exportStar(require("./alarms_and_conditions/client_alarm_tools_dump_event"), exports);
|
|
46
|
-
__exportStar(require("./alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions"), exports);
|
|
47
41
|
__exportStar(require("./tools/findservers"), exports);
|
|
48
42
|
__exportStar(require("./tools/read_history_server_capabilities"), exports);
|
|
49
43
|
__exportStar(require("./client_utils"), exports);
|
|
50
44
|
__exportStar(require("./verify"), exports);
|
|
51
45
|
__exportStar(require("./user_identity_info"), exports);
|
|
46
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_tools"), exports);
|
|
47
|
+
__exportStar(require("./alarms_and_conditions/client_tools"), exports);
|
|
48
|
+
__exportStar(require("node-opcua-alarm-condition"), exports);
|
|
52
49
|
var node_opcua_assert_1 = require("node-opcua-assert");
|
|
53
50
|
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return node_opcua_assert_1.assert; } });
|
|
54
51
|
__exportStar(require("node-opcua-utils"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,wDAAsC;AACtC,+DAA6C;AAC7C,0DAAwC;AACxC,gEAA8C;AAC9C,uEAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,wDAAsC;AACtC,+DAA6C;AAC7C,0DAAwC;AACxC,gEAA8C;AAC9C,uEAAqD;AACrD,sDAAoC;AACpC,2EAAyD;AACzD,iDAA+B;AAC/B,2CAAyB;AACzB,uDAAqC;AACrC,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 export declare class ClientSessionImpl extends EventEmitter implements ClientSes
|
|
|
616
616
|
addCommentCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
|
|
617
617
|
confirmCondition(_conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
|
|
618
618
|
acknowledgeCondition(_conditionId: NodeId, _eventId: Buffer, _comment: LocalizedTextLike, _callback?: Callback<StatusCode>): any;
|
|
619
|
+
/**
|
|
620
|
+
* @deprecated
|
|
621
|
+
* @private
|
|
622
|
+
*/
|
|
619
623
|
findMethodId(_nodeId: NodeIdLike, _methodName: string, _callback?: ResponseCallback<NodeId>): any;
|
|
620
624
|
_callMethodCondition(_methodName: string, _conditionId: NodeIdLike, _eventId: Buffer, _comment: LocalizedTextLike, _callback: Callback<StatusCode>): void;
|
|
621
625
|
extractNamespaceDataType(): Promise<ExtraDataTypeManager>;
|
|
@@ -1117,6 +1117,10 @@ class ClientSessionImpl extends events_1.EventEmitter {
|
|
|
1117
1117
|
acknowledgeCondition(_conditionId, _eventId, _comment, _callback) {
|
|
1118
1118
|
/** empty */
|
|
1119
1119
|
}
|
|
1120
|
+
/**
|
|
1121
|
+
* @deprecated
|
|
1122
|
+
* @private
|
|
1123
|
+
*/
|
|
1120
1124
|
findMethodId(_nodeId, _methodName, _callback) {
|
|
1121
1125
|
/** empty */
|
|
1122
1126
|
}
|