node-opcua-alarm-condition 2.178.0 → 2.179.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/acknowledge_all_conditions.d.ts +2 -2
- package/dist/acknowledge_all_conditions.js +5 -6
- package/dist/acknowledge_all_conditions.js.map +1 -1
- package/dist/call_condition_refresh.d.ts +2 -2
- package/dist/call_condition_refresh.js +3 -3
- package/dist/call_condition_refresh.js.map +1 -1
- package/dist/call_method_condition.d.ts +4 -4
- package/dist/call_method_condition.js +2 -2
- package/dist/call_method_condition.js.map +1 -1
- package/dist/client_alarm.d.ts +6 -6
- package/dist/client_alarm.js +5 -4
- package/dist/client_alarm.js.map +1 -1
- package/dist/client_alarm_list.d.ts +2 -3
- package/dist/client_alarm_list.js +4 -6
- package/dist/client_alarm_list.js.map +1 -1
- package/dist/client_alarm_tools_dump_event.d.ts +2 -2
- package/dist/client_alarm_tools_dump_event.js +2 -3
- package/dist/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/event_stuff.d.ts +2 -2
- package/dist/event_stuff.js +2 -1
- package/dist/event_stuff.js.map +1 -1
- package/dist/extract_condition_fields.d.ts +2 -2
- package/dist/extract_condition_fields.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
- package/source/acknowledge_all_conditions.ts +14 -19
- package/source/call_condition_refresh.ts +4 -4
- package/source/call_method_condition.ts +13 -19
- package/source/client_alarm.ts +10 -11
- package/source/client_alarm_list.ts +7 -9
- package/source/client_alarm_tools_dump_event.ts +6 -7
- package/source/event_stuff.ts +6 -7
- package/source/extract_condition_fields.ts +2 -2
- package/source/index.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IBasicSessionEx } from "node-opcua-pseudo-session";
|
|
2
|
-
import { EventStuff } from "./event_stuff";
|
|
1
|
+
import type { IBasicSessionEx } from "node-opcua-pseudo-session";
|
|
2
|
+
import { type EventStuff } from "./event_stuff";
|
|
3
3
|
export type FindActiveConditions = () => Promise<EventStuff[]>;
|
|
4
4
|
/**
|
|
5
5
|
* Enumerate all events
|
|
@@ -3,16 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findActiveConditions = findActiveConditions;
|
|
4
4
|
exports.acknowledgeAllConditions = acknowledgeAllConditions;
|
|
5
5
|
exports.confirmAllConditions = confirmAllConditions;
|
|
6
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
6
7
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
7
8
|
const node_opcua_service_filter_1 = require("node-opcua-service-filter");
|
|
8
9
|
const node_opcua_service_read_1 = require("node-opcua-service-read");
|
|
9
10
|
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
10
11
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
11
|
-
const
|
|
12
|
+
const call_condition_refresh_1 = require("./call_condition_refresh");
|
|
13
|
+
const call_method_condition_1 = require("./call_method_condition");
|
|
12
14
|
const event_stuff_1 = require("./event_stuff");
|
|
13
15
|
const extract_condition_fields_1 = require("./extract_condition_fields");
|
|
14
|
-
const call_method_condition_1 = require("./call_method_condition");
|
|
15
|
-
const call_condition_refresh_1 = require("./call_condition_refresh");
|
|
16
16
|
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
|
|
17
17
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
18
18
|
const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
|
|
@@ -80,10 +80,9 @@ async function findActiveConditions(session) {
|
|
|
80
80
|
let RefreshEndEventHasBeenReceived = false;
|
|
81
81
|
const RefreshStartEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshStartEventType").toString();
|
|
82
82
|
const RefreshEndEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshEndEventType").toString();
|
|
83
|
-
await new Promise((resolve,
|
|
83
|
+
await new Promise((resolve, _reject) => {
|
|
84
84
|
// now create a event monitored Item
|
|
85
|
-
event_monitoringItem.on("changed", (
|
|
86
|
-
const eventFields = _eventFields;
|
|
85
|
+
event_monitoringItem.on("changed", (eventFields) => {
|
|
87
86
|
try {
|
|
88
87
|
if (RefreshEndEventHasBeenReceived) {
|
|
89
88
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acknowledge_all_conditions.js","sourceRoot":"","sources":["../source/acknowledge_all_conditions.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"acknowledge_all_conditions.js","sourceRoot":"","sources":["../source/acknowledge_all_conditions.ts"],"names":[],"mappings":";;AAsDA,oDAwFC;AAOD,4DAkBC;AAED,oDAkBC;AA3LD,uDAAgF;AAChF,yDAAkD;AAElD,yEAAiE;AACjE,qEAAoG;AAEpG,mEAAsE;AACtE,2DAA4D;AAC5D,qEAAgE;AAChE,mEAAiF;AACjF,+CAA8D;AAC9D,yEAAoE;AAEpE,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;AAE3C;;;;;GAKG;AAEH,KAAK,UAAU,sBAAsB,CAAC,OAA2B,EAAE,UAAsB,EAAE,OAAe;IACtG,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;IAClD,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC;IAC1C,IAAI,CAAC;QACD,OAAO,MAAM,IAAA,4CAAoB,EAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,QAAQ,CAAC,gBAAgB,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC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C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACjF,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC3B,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
2
|
+
import { type StatusCode } from "node-opcua-status-code";
|
|
3
3
|
export declare function callConditionRefresh(session: IBasicSessionAsync, subscriptionId: number): Promise<StatusCode>;
|
|
@@ -6,17 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.callConditionRefresh = callConditionRefresh;
|
|
7
7
|
const node_opcua_assert_1 = __importDefault(require("node-opcua-assert"));
|
|
8
8
|
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
9
|
-
const
|
|
9
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
10
10
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
11
|
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
12
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
12
13
|
const node_opcua_types_1 = require("node-opcua-types");
|
|
13
14
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
14
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
15
15
|
const doDebug = false;
|
|
16
16
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)("A&E");
|
|
17
17
|
const warningLog = (0, node_opcua_debug_1.make_warningLog)("A&E");
|
|
18
18
|
async function callConditionRefresh(session, subscriptionId) {
|
|
19
|
-
(0, node_opcua_assert_1.default)(isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
19
|
+
(0, node_opcua_assert_1.default)(Number.isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
20
20
|
const conditionTypeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)("ConditionType");
|
|
21
21
|
let conditionRefreshId = (0, node_opcua_nodeid_1.resolveNodeId)("ConditionType_ConditionRefresh");
|
|
22
22
|
// find conditionRefreshId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call_condition_refresh.js","sourceRoot":"","sources":["../source/call_condition_refresh.ts"],"names":[],"mappings":";;;;;AAcA,oDA4BC;AA1CD,0EAAuC;AACvC,mEAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"call_condition_refresh.js","sourceRoot":"","sources":["../source/call_condition_refresh.ts"],"names":[],"mappings":";;;;;AAcA,oDA4BC;AA1CD,0EAAuC;AACvC,mEAAkD;AAClD,uDAAkE;AAClE,yDAAkD;AAElD,uGAA0E;AAC1E,mEAAsE;AACtE,uDAAqD;AACrD,2DAA6C;AAE7C,MAAM,OAAO,GAAG,KAAK,CAAC;AACtB,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,KAAK,CAAC,CAAC;AACtC,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,KAAK,CAAC,CAAC;AAEnC,KAAK,UAAU,oBAAoB,CAAC,OAA2B,EAAE,cAAsB;IAC1F,IAAA,2BAAM,EAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,4CAA4C,CAAC,CAAC;IACtF,MAAM,mBAAmB,GAAG,IAAA,iCAAa,EAAC,eAAe,CAAC,CAAC;IAC3D,IAAI,kBAAkB,GAAG,IAAA,iCAAa,EAAC,gCAAgC,CAAC,CAAC;IACzE,0BAA0B;IAC1B,MAAM,UAAU,GAAG,IAAA,yDAAc,EAAC,mBAAmB,EAAE,mBAAmB,CAAC,CAAC;IAC5E,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAEtE,iBAAiB;IACjB,IAAI,eAAe,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChE,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC7D,CAAC;SAAM,CAAC;QACJ,iCAAiC;QACjC,OAAO,oCAAW,CAAC,gBAAgB,CAAC;IACxC,CAAC;IACD,MAAM,YAAY,GAA0B;QACxC,cAAc,EAAE,CAAC,IAAI,4BAAO,CAAC,EAAE,QAAQ,EAAE,iCAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QACnF,QAAQ,EAAE,kBAAkB;QAC5B,QAAQ,EAAE,mBAAmB;KAChC,CAAC;IAEF,OAAO,IAAI,QAAQ,CAAC,iBAAiB,EAAE,IAAI,oCAAiB,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvF,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpD,iBAAiB;IACjB,IAAI,UAAU,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC;QACpC,UAAU,CAAC,IAAI,oCAAiB,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,UAAU,CAAC,UAAU,CAAC;AACjC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LocalizedTextLike } from "node-opcua-data-model";
|
|
2
|
-
import { NodeIdLike } from "node-opcua-nodeid";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { type LocalizedTextLike } from "node-opcua-data-model";
|
|
2
|
+
import { type NodeIdLike } from "node-opcua-nodeid";
|
|
3
|
+
import { type IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
4
|
+
import { type StatusCode } from "node-opcua-status-code";
|
|
5
5
|
export declare function callMethodCondition(session: IBasicSessionAsync, methodName: string, conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
6
6
|
export declare function acknowledgeCondition(session: IBasicSessionAsync, conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
7
7
|
export declare function confirmCondition(session: IBasicSessionAsync, conditionId: NodeIdLike, eventId: Buffer, comment: LocalizedTextLike): Promise<StatusCode>;
|
|
@@ -7,13 +7,13 @@ exports.callMethodCondition = callMethodCondition;
|
|
|
7
7
|
exports.acknowledgeCondition = acknowledgeCondition;
|
|
8
8
|
exports.confirmCondition = confirmCondition;
|
|
9
9
|
const node_opcua_assert_1 = __importDefault(require("node-opcua-assert"));
|
|
10
|
+
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
10
11
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
11
12
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
13
|
+
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
12
14
|
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
13
15
|
const node_opcua_types_1 = require("node-opcua-types");
|
|
14
16
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
15
|
-
const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
16
|
-
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
17
17
|
async function callMethodCondition(session, methodName, conditionId, eventId, comment) {
|
|
18
18
|
conditionId = (0, node_opcua_nodeid_1.coerceNodeId)(conditionId);
|
|
19
19
|
(0, node_opcua_assert_1.default)(conditionId instanceof node_opcua_nodeid_1.NodeId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call_method_condition.js","sourceRoot":"","sources":["../source/call_method_condition.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"call_method_condition.js","sourceRoot":"","sources":["../source/call_method_condition.ts"],"names":[],"mappings":";;;;;AASA,kDAqDC;AAED,oDAOC;AACD,4CAOC;AA/ED,0EAAuC;AACvC,+DAAiD;AACjD,iEAA8E;AAC9E,yDAAyF;AACzF,yEAAkF;AAClF,mE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AAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;YACrE,aAAa,CAAC,IAAI,4BAAO,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;SAC3E;QACD,QAAQ;QACR,QAAQ,EAAE,WAAW;KACxB,CAAC,CACL,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACzC,OAAO,UAAU,CAAC;AACtB,CAAC;AAEM,KAAK,UAAU,oBAAoB,CACtC,OAA2B,EAC3B,WAAuB,EACvB,OAAe,EACf,OAA0B;IAE1B,OAAO,MAAM,mBAAmB,CAAC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5F,CAAC;AACM,KAAK,UAAU,gBAAgB,CAClC,OAA2B,EAC3B,WAAuB,EACvB,OAAe,EACf,OAA0B;IAE1B,OAAO,MAAM,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC"}
|
package/dist/client_alarm.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { EventStuff } from "./event_stuff";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { type NodeId } from "node-opcua-nodeid";
|
|
3
|
+
import type { IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
4
|
+
import type { StatusCode } from "node-opcua-status-code";
|
|
5
|
+
import { type Variant } from "node-opcua-variant";
|
|
6
|
+
import type { EventStuff } from "./event_stuff";
|
|
7
7
|
export interface ClientAlarm {
|
|
8
8
|
conditionId: NodeId;
|
|
9
9
|
eventType: NodeId;
|
package/dist/client_alarm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClientAlarm = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
5
5
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
6
6
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
7
7
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
@@ -9,7 +9,8 @@ const call_method_condition_1 = require("./call_method_condition");
|
|
|
9
9
|
/**
|
|
10
10
|
* describes a OPCUA Alarm as seen in the client side
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: interface adds typed members/overloads for this class
|
|
13
|
+
class ClientAlarm extends node_events_1.EventEmitter {
|
|
13
14
|
conditionId;
|
|
14
15
|
eventType;
|
|
15
16
|
eventId;
|
|
@@ -45,8 +46,8 @@ class ClientAlarm extends events_1.EventEmitter {
|
|
|
45
46
|
this.eventType.toString() +
|
|
46
47
|
" " +
|
|
47
48
|
Object.entries(this.fields)
|
|
48
|
-
.filter(([
|
|
49
|
-
.map(([key, value]) => key.padEnd(30)
|
|
49
|
+
.filter(([_key, value]) => value.dataType !== node_opcua_variant_1.DataType.Null)
|
|
50
|
+
.map(([key, value]) => `${key.padEnd(30)}=${value.toString()}`)
|
|
50
51
|
.join("\n") +
|
|
51
52
|
"\n\n");
|
|
52
53
|
}
|
package/dist/client_alarm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm.js","sourceRoot":"","sources":["../source/client_alarm.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"client_alarm.js","sourceRoot":"","sources":["../source/client_alarm.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,y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AAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5F,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC;IAC9B,CAAC;IACM,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;IACpC,CAAC;IACM,QAAQ;QACX,OAAO,CACH,IAAI,CAAC,WAAW,CAAC,IAAI;YACrB,IAAI;YACJ,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC3B,GAAG;YACH,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YACzB,GAAG;YACH,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;iBACtB,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,6BAAQ,CAAC,IAAI,CAAC;iBAC3D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;iBAC9D,IAAI,CAAC,IAAI,CAAC;YACf,MAAM,CACT,CAAC;IACN,CAAC;IAEM,QAAQ,CAAC,SAAiB;QAC7B,OAAQ,IAAI,CAAC,MAA6C,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IAClF,CAAC;CACJ;AAhDD,kCAgDC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
2
|
-
import { EventStuff } from "./event_stuff";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
3
2
|
import { ClientAlarm } from "./client_alarm";
|
|
3
|
+
import type { EventStuff } from "./event_stuff";
|
|
4
4
|
export interface ClientAlarmList {
|
|
5
5
|
on(eventName: "alarmChanged", handler: (alarm: ClientAlarm) => void): this;
|
|
6
6
|
on(eventName: "alarmDeleted", handler: (alarm: ClientAlarm) => void): this;
|
|
@@ -11,7 +11,6 @@ export interface ClientAlarmList {
|
|
|
11
11
|
}
|
|
12
12
|
export declare class ClientAlarmList extends EventEmitter implements Iterable<ClientAlarm> {
|
|
13
13
|
private _map;
|
|
14
|
-
constructor();
|
|
15
14
|
[Symbol.iterator](): Iterator<ClientAlarm>;
|
|
16
15
|
alarms(): ClientAlarm[];
|
|
17
16
|
update(eventField: EventStuff): void;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ClientAlarmList = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
5
5
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
6
6
|
const client_alarm_1 = require("./client_alarm");
|
|
7
7
|
// maintain a set of alarm list for a client
|
|
8
|
-
|
|
8
|
+
// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: interface adds typed members/overloads for this class
|
|
9
|
+
class ClientAlarmList extends node_events_1.EventEmitter {
|
|
9
10
|
_map = new Map();
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
11
|
[Symbol.iterator]() {
|
|
14
12
|
let pointer = 0;
|
|
15
13
|
const components = [...this._map.values()];
|
|
@@ -77,7 +75,7 @@ class ClientAlarmList extends events_1.EventEmitter {
|
|
|
77
75
|
this.deleteAlarm(alarm.conditionId, alarm.eventType);
|
|
78
76
|
}
|
|
79
77
|
makeKey(conditionId, eventType) {
|
|
80
|
-
return conditionId.toString()
|
|
78
|
+
return `${conditionId.toString()}|${eventType.toString()}`;
|
|
81
79
|
}
|
|
82
80
|
findAlarm(conditionId, eventType) {
|
|
83
81
|
const key = this.makeKey(conditionId, eventType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm_list.js","sourceRoot":"","sources":["../source/client_alarm_list.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"client_alarm_list.js","sourceRoot":"","sources":["../source/client_alarm_list.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,yDAA2C;AAE3C,iDAA6C;AAY7C,4CAA4C;AAC5C,iHAAiH;AACjH,MAAa,eAAgB,SAAQ,0BAAY;IACrC,IAAI,GAA6B,IAAI,GAAG,EAAE,CAAC;IAE5C,CAAC,MAAM,CAAC,QAAQ,CAAC;QACpB,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,OAAO;YACH,IAAI;gBACA,IAAI,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;oBAC/B,OAAO;wBACH,IAAI,EAAE,IAAI;wBACV,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;qBAC/B,CAAC;gBACN,CAAC;qBAAM,CAAC;oBACJ,OAAO;wBACH,IAAI,EAAE,KAAK;wBACX,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;qBAC/B,CAAC;gBACN,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;IAEM,MAAM;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,UAAsB;QAChC,aAAa;QACb,sFAAsF;QACtF,kFAAkF;QAClF,WAAW;QAEX,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QAC9C,IAAA,0BAAM,EAAC,WAAW,EAAE,6EAA6E,CAAC,CAAC;QACnG,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAEjE,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,GAAG,GA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AE,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAEO,OAAO,CAAC,WAAmB,EAAE,SAAiB;QAClD,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC/D,CAAC;IACO,SAAS,CAAC,WAAmB,EAAE,SAAiB;QACpD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,EAAE,IAAI,IAAI,CAAC;IACtB,CAAC;IACO,WAAW,CAAC,WAAmB,EAAE,SAAiB;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC9B,IAAI,EAAE,EAAE,CAAC;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA3FD,0CA2FC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IBasicSessionReadAsyncSimple } from "node-opcua-pseudo-session";
|
|
2
|
-
import { Variant } from "node-opcua-variant";
|
|
1
|
+
import type { IBasicSessionReadAsyncSimple } from "node-opcua-pseudo-session";
|
|
2
|
+
import { type Variant } from "node-opcua-variant";
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param session
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.dumpEvent = dumpEvent;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
9
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
10
9
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
10
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
11
11
|
const traceLog = (0, node_opcua_debug_1.make_traceLog)("ClientAlarmTool");
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
@@ -23,7 +23,7 @@ async function dumpEvent(session, fields, eventFields) {
|
|
|
23
23
|
});
|
|
24
24
|
if (dataValue.statusCode.isGood()) {
|
|
25
25
|
const browseName = dataValue.value.value.name;
|
|
26
|
-
return browseName;
|
|
26
|
+
return browseName || "???";
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
return "???";
|
|
@@ -41,7 +41,6 @@ async function dumpEvent(session, fields, eventFields) {
|
|
|
41
41
|
traceLog(chalk_1.default.yellow(w(name, 30), w(_fields[index], 25)), chalk_1.default.cyan(w(node_opcua_variant_1.DataType[variant.dataType], 10).toString()), chalk_1.default.cyan.bold(name), "(", w(variant.value, 20), ")");
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
// tslint:disable-next-line: no-console
|
|
45
44
|
traceLog(chalk_1.default.yellow(w("", 30), w(_fields[index], 25)), chalk_1.default.cyan(w(node_opcua_variant_1.DataType[variant.dataType], 10).toString()), variant.value);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client_alarm_tools_dump_event.js","sourceRoot":"","sources":["../source/client_alarm_tools_dump_event.ts"],"names":[],"mappings":";;;;;AAeA,
|
|
1
|
+
{"version":3,"file":"client_alarm_tools_dump_event.js","sourceRoot":"","sources":["../source/client_alarm_tools_dump_event.ts"],"names":[],"mappings":";;;;;AAeA,8BAiDC;AAhED,kDAA0B;AAC1B,iEAAqD;AACrD,uDAAiD;AAGjD,2DAA8E;AAE9E,MAA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fieldsToJson = fieldsToJson;
|
|
4
|
-
const node_opcua_utils_1 = require("node-opcua-utils");
|
|
5
4
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
5
|
+
const node_opcua_utils_1 = require("node-opcua-utils");
|
|
6
6
|
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
7
7
|
/**
|
|
8
8
|
* @private
|
|
@@ -40,6 +40,7 @@ function fieldsToJson(fields, eventFields, flat) {
|
|
|
40
40
|
// use this Object.create(null) to construct an object with no prototype
|
|
41
41
|
// so that we immune from prototype pollution
|
|
42
42
|
const data = Object.create(null);
|
|
43
|
+
// biome-ignore lint/suspicious/noProto: deliberate sanity check that Object.create(null) has no prototype (prototype-pollution defense)
|
|
43
44
|
if (data.__proto__) {
|
|
44
45
|
throw new Error("expecting __proto__ to be undefined");
|
|
45
46
|
}
|
package/dist/event_stuff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_stuff.js","sourceRoot":"","sources":["../source/event_stuff.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"event_stuff.js","sourceRoot":"","sources":["../source/event_stuff.ts"],"names":[],"mappings":";;AA2BA,oCA2CC;AAtED,uDAAmD;AAEnD,uDAAoD;AAGpD,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC,CAAC;AAmB/C;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAgB,EAAE,WAAsB,EAAE,IAAc;IACjF,SAAS,WAAW,CAAC,KAA8B,EAAE,SAAiB,EAAE,KAAc;QAClF,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO;QACX,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAA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sCAAsC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QACnC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,IAA6B,CAAC;AACzC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NodeIdLike } from "node-opcua-nodeid";
|
|
2
|
-
import { ISessionForExtractField } from "node-opcua-pseudo-session";
|
|
1
|
+
import type { NodeIdLike } from "node-opcua-nodeid";
|
|
2
|
+
import { type ISessionForExtractField } from "node-opcua-pseudo-session";
|
|
3
3
|
export declare function extractConditionFields(session: ISessionForExtractField, conditionNodeId: NodeIdLike): Promise<string[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract_condition_fields.js","sourceRoot":"","sources":["../source/extract_condition_fields.ts"],"names":[],"mappings":";;AAGA,wDAQC;AAVD,
|
|
1
|
+
{"version":3,"file":"extract_condition_fields.js","sourceRoot":"","sources":["../source/extract_condition_fields.ts"],"names":[],"mappings":";;AAGA,wDAQC;AAVD,yEAAmH;AAE5G,KAAK,UAAU,sBAAsB,CAAC,OAAgC,EAAE,eAA2B;IACtG,0DAA0D;IAC1D,2EAA2E;IAC3E,MAAM,CAAC,GAAG,MAAM,IAAA,yCAAa,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAA,qDAAyB,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,4CAA4C;IAC5C,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5B,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./acknowledge_all_conditions";
|
|
2
2
|
export * from "./call_condition_refresh";
|
|
3
3
|
export * from "./call_method_condition";
|
|
4
|
+
export * from "./client_alarm";
|
|
4
5
|
export * from "./client_alarm_list";
|
|
5
6
|
export * from "./client_alarm_tools_dump_event";
|
|
6
|
-
export * from "./client_alarm";
|
|
7
7
|
export * from "./event_stuff";
|
|
8
8
|
export * from "./extract_condition_fields";
|
package/dist/index.js
CHANGED
|
@@ -17,9 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./acknowledge_all_conditions"), exports);
|
|
18
18
|
__exportStar(require("./call_condition_refresh"), exports);
|
|
19
19
|
__exportStar(require("./call_method_condition"), exports);
|
|
20
|
+
__exportStar(require("./client_alarm"), exports);
|
|
20
21
|
__exportStar(require("./client_alarm_list"), exports);
|
|
21
22
|
__exportStar(require("./client_alarm_tools_dump_event"), exports);
|
|
22
|
-
__exportStar(require("./client_alarm"), exports);
|
|
23
23
|
__exportStar(require("./event_stuff"), exports);
|
|
24
24
|
__exportStar(require("./extract_condition_fields"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,2DAAyC;AACzC,0DAAwC;AACxC,sDAAoC;AACpC,kEAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C;AAC7C,2DAAyC;AACzC,0DAAwC;AACxC,iDAA+B;AAC/B,sDAAoC;AACpC,kEAAgD;AAChD,gDAA8B;AAC9B,6DAA2C"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-alarm-condition",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.179.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module pseudo-session",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo",
|
|
7
7
|
"build": "tsc -b",
|
|
8
|
-
"lint": "
|
|
8
|
+
"lint": "biome check --no-errors-on-unmatched .",
|
|
9
9
|
"test": "mocha test",
|
|
10
10
|
"test:check": "tsc --noEmit -p test/tsconfig.json"
|
|
11
11
|
},
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"chalk": "4.1.2",
|
|
16
|
-
"node-opcua-assert": "2.
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-constants": "2.
|
|
19
|
-
"node-opcua-data-model": "2.
|
|
20
|
-
"node-opcua-debug": "2.
|
|
21
|
-
"node-opcua-nodeid": "2.
|
|
22
|
-
"node-opcua-pseudo-session": "2.
|
|
23
|
-
"node-opcua-service-filter": "2.
|
|
24
|
-
"node-opcua-service-read": "2.
|
|
25
|
-
"node-opcua-service-subscription": "2.
|
|
26
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
27
|
-
"node-opcua-status-code": "2.
|
|
28
|
-
"node-opcua-types": "2.
|
|
29
|
-
"node-opcua-utils": "2.
|
|
30
|
-
"node-opcua-variant": "2.
|
|
16
|
+
"node-opcua-assert": "2.179.0",
|
|
17
|
+
"node-opcua-basic-types": "2.179.0",
|
|
18
|
+
"node-opcua-constants": "2.179.0",
|
|
19
|
+
"node-opcua-data-model": "2.179.0",
|
|
20
|
+
"node-opcua-debug": "2.179.0",
|
|
21
|
+
"node-opcua-nodeid": "2.179.0",
|
|
22
|
+
"node-opcua-pseudo-session": "2.179.0",
|
|
23
|
+
"node-opcua-service-filter": "2.179.0",
|
|
24
|
+
"node-opcua-service-read": "2.179.0",
|
|
25
|
+
"node-opcua-service-subscription": "2.179.0",
|
|
26
|
+
"node-opcua-service-translate-browse-path": "2.179.0",
|
|
27
|
+
"node-opcua-status-code": "2.179.0",
|
|
28
|
+
"node-opcua-types": "2.179.0",
|
|
29
|
+
"node-opcua-utils": "2.179.0",
|
|
30
|
+
"node-opcua-variant": "2.179.0"
|
|
31
31
|
},
|
|
32
32
|
"author": "Etienne Rossignon",
|
|
33
33
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"internet of things"
|
|
45
45
|
],
|
|
46
46
|
"homepage": "http://node-opcua.github.io/",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "c78c6ee424bae3c6e851fabd8e144390e2941f8a",
|
|
48
48
|
"files": [
|
|
49
49
|
"dist",
|
|
50
50
|
"source"
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
|
|
1
2
|
import { resolveNodeId } from "node-opcua-nodeid";
|
|
3
|
+
import type { IBasicSessionAsync, IBasicSessionEx } from "node-opcua-pseudo-session";
|
|
2
4
|
import { constructEventFilter } from "node-opcua-service-filter";
|
|
3
|
-
import { AttributeIds, ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read";
|
|
4
|
-
import { CreateSubscriptionRequestOptions, MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
5
|
-
import { StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
6
|
-
import { DataType, Variant } from "node-opcua-variant";
|
|
7
|
-
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug";
|
|
8
|
-
|
|
9
|
-
import { IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
10
|
-
import { IBasicSessionEx } from "node-opcua-pseudo-session";
|
|
11
|
-
|
|
12
|
-
import { EventStuff, fieldsToJson } from "./event_stuff";
|
|
13
|
-
import { extractConditionFields } from "./extract_condition_fields";
|
|
14
|
-
import { acknowledgeCondition, confirmCondition } from "./call_method_condition";
|
|
5
|
+
import { AttributeIds, type ReadValueIdOptions, TimestampsToReturn } from "node-opcua-service-read";
|
|
6
|
+
import type { CreateSubscriptionRequestOptions, MonitoringParametersOptions } from "node-opcua-service-subscription";
|
|
7
|
+
import { type StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
8
|
+
import { DataType, type Variant } from "node-opcua-variant";
|
|
15
9
|
import { callConditionRefresh } from "./call_condition_refresh";
|
|
10
|
+
import { acknowledgeCondition, confirmCondition } from "./call_method_condition";
|
|
11
|
+
import { type EventStuff, fieldsToJson } from "./event_stuff";
|
|
12
|
+
import { extractConditionFields } from "./extract_condition_fields";
|
|
16
13
|
|
|
17
14
|
const doDebug = checkDebugFlag(__filename);
|
|
18
15
|
const debugLog = make_debugLog(__filename);
|
|
@@ -95,18 +92,16 @@ export async function findActiveConditions(session: IBasicSessionEx): Promise<Ev
|
|
|
95
92
|
const RefreshStartEventType = resolveNodeId("RefreshStartEventType").toString();
|
|
96
93
|
const RefreshEndEventType = resolveNodeId("RefreshEndEventType").toString();
|
|
97
94
|
|
|
98
|
-
await new Promise<void>((resolve,
|
|
95
|
+
await new Promise<void>((resolve, _reject) => {
|
|
99
96
|
// now create a event monitored Item
|
|
100
|
-
event_monitoringItem.on("changed", (
|
|
101
|
-
const eventFields = _eventFields as Variant[];
|
|
102
|
-
|
|
97
|
+
event_monitoringItem.on("changed", (eventFields: Variant[]) => {
|
|
103
98
|
try {
|
|
104
99
|
if (RefreshEndEventHasBeenReceived) {
|
|
105
100
|
return;
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
// dumpEvent(session, fields, eventFields);
|
|
109
|
-
const pojo = fieldsToJson(fields, eventFields)
|
|
104
|
+
const pojo = fieldsToJson(fields, eventFields);
|
|
110
105
|
|
|
111
106
|
// make sure we only start recording event after the RefreshStartEvent has been received
|
|
112
107
|
if (!refreshStartEventHasBeenReceived) {
|
|
@@ -126,7 +121,7 @@ export async function findActiveConditions(session: IBasicSessionEx): Promise<Ev
|
|
|
126
121
|
}
|
|
127
122
|
|
|
128
123
|
if (pojo.ackedState.id.dataType === DataType.Boolean) {
|
|
129
|
-
acknowledgeableConditions.push(pojo
|
|
124
|
+
acknowledgeableConditions.push(pojo);
|
|
130
125
|
}
|
|
131
126
|
} catch (err) {
|
|
132
127
|
errorLog("Error !!", err);
|
|
@@ -178,7 +173,7 @@ export async function confirmAllConditions(session: IBasicSessionEx, message: st
|
|
|
178
173
|
// filter acknowledgeable conditions (no acked yet)
|
|
179
174
|
conditions = conditions.filter((pojo) => pojo.confirmedState.id.value === false);
|
|
180
175
|
|
|
181
|
-
const promises: Array<Promise<
|
|
176
|
+
const promises: Array<Promise<StatusCode>> = [];
|
|
182
177
|
for (const eventStuff of conditions) {
|
|
183
178
|
promises.push(confirmConditionEV(session, eventStuff, message));
|
|
184
179
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import assert from "node-opcua-assert";
|
|
2
2
|
import { DataType } from "node-opcua-basic-types";
|
|
3
|
-
import {
|
|
3
|
+
import { make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
4
4
|
import { resolveNodeId } from "node-opcua-nodeid";
|
|
5
|
+
import type { CallMethodRequestLike, IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
5
6
|
import { makeBrowsePath } from "node-opcua-service-translate-browse-path";
|
|
7
|
+
import { type StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
6
8
|
import { CallMethodRequest } from "node-opcua-types";
|
|
7
9
|
import { Variant } from "node-opcua-variant";
|
|
8
|
-
import { make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
9
|
-
import { IBasicSessionAsync, CallMethodRequestLike } from "node-opcua-pseudo-session";
|
|
10
10
|
|
|
11
11
|
const doDebug = false;
|
|
12
12
|
const debugLog = make_debugLog("A&E");
|
|
13
13
|
const warningLog = make_warningLog("A&E");
|
|
14
14
|
|
|
15
15
|
export async function callConditionRefresh(session: IBasicSessionAsync, subscriptionId: number): Promise<StatusCode> {
|
|
16
|
-
assert(isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
16
|
+
assert(Number.isFinite(subscriptionId), "May be subscription is not yet initialized");
|
|
17
17
|
const conditionTypeNodeId = resolveNodeId("ConditionType");
|
|
18
18
|
let conditionRefreshId = resolveNodeId("ConditionType_ConditionRefresh");
|
|
19
19
|
// find conditionRefreshId
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
import assert from "node-opcua-assert";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { MethodIds } from "node-opcua-constants";
|
|
3
|
+
import { LocalizedText, type LocalizedTextLike } from "node-opcua-data-model";
|
|
4
|
+
import { coerceNodeId, NodeId, type NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
5
|
+
import { findMethodId, type IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
6
|
+
import { type StatusCode, StatusCodes } from "node-opcua-status-code";
|
|
5
7
|
import { CallMethodRequest } from "node-opcua-types";
|
|
6
8
|
import { Variant } from "node-opcua-variant";
|
|
7
|
-
import { IBasicSessionAsync, findMethodId } from "node-opcua-pseudo-session";
|
|
8
|
-
import { MethodIds } from "node-opcua-constants";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
9
|
|
|
13
10
|
export async function callMethodCondition(
|
|
14
11
|
session: IBasicSessionAsync,
|
|
15
12
|
methodName: string,
|
|
16
13
|
conditionId: NodeIdLike,
|
|
17
14
|
eventId: Buffer,
|
|
18
|
-
comment: LocalizedTextLike
|
|
19
|
-
|
|
20
|
-
): Promise<StatusCode>
|
|
21
|
-
{
|
|
15
|
+
comment: LocalizedTextLike
|
|
16
|
+
): Promise<StatusCode> {
|
|
22
17
|
conditionId = coerceNodeId(conditionId);
|
|
23
18
|
assert(conditionId instanceof NodeId);
|
|
24
19
|
assert(eventId instanceof Buffer);
|
|
25
20
|
assert(typeof comment === "string" || comment instanceof LocalizedText);
|
|
26
21
|
|
|
27
|
-
comment = LocalizedText.coerce(comment) || new LocalizedText();
|
|
22
|
+
comment = LocalizedText.coerce(comment) || new LocalizedText();
|
|
28
23
|
const r = await findMethodId(session, conditionId, methodName);
|
|
29
24
|
|
|
30
25
|
let methodId = r.methodId;
|
|
@@ -62,13 +57,12 @@ export async function callMethodCondition(
|
|
|
62
57
|
})
|
|
63
58
|
);
|
|
64
59
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
const results = await session.call(methodToCalls);
|
|
61
|
+
const statusCode = results[0].statusCode;
|
|
62
|
+
return statusCode;
|
|
63
|
+
}
|
|
70
64
|
|
|
71
|
-
|
|
65
|
+
export async function acknowledgeCondition(
|
|
72
66
|
session: IBasicSessionAsync,
|
|
73
67
|
conditionId: NodeIdLike,
|
|
74
68
|
eventId: Buffer,
|
package/source/client_alarm.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import { assert } from "node-opcua-assert";
|
|
3
|
-
import { NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { EventStuff} from "./event_stuff";
|
|
3
|
+
import { type NodeId, resolveNodeId } from "node-opcua-nodeid";
|
|
4
|
+
import type { IBasicSessionAsync } from "node-opcua-pseudo-session";
|
|
5
|
+
import type { StatusCode } from "node-opcua-status-code";
|
|
6
|
+
import { DataType, type Variant } from "node-opcua-variant";
|
|
8
7
|
import { acknowledgeCondition, confirmCondition } from "./call_method_condition";
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import type { EventStuff } from "./event_stuff";
|
|
11
9
|
|
|
12
10
|
export interface ClientAlarm {
|
|
13
11
|
conditionId: NodeId;
|
|
@@ -22,6 +20,7 @@ export interface ClientAlarm {
|
|
|
22
20
|
/**
|
|
23
21
|
* describes a OPCUA Alarm as seen in the client side
|
|
24
22
|
*/
|
|
23
|
+
// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: interface adds typed members/overloads for this class
|
|
25
24
|
export class ClientAlarm extends EventEmitter {
|
|
26
25
|
public conditionId: NodeId;
|
|
27
26
|
public eventType: NodeId;
|
|
@@ -60,14 +59,14 @@ export class ClientAlarm extends EventEmitter {
|
|
|
60
59
|
this.eventType.toString() +
|
|
61
60
|
" " +
|
|
62
61
|
Object.entries(this.fields)
|
|
63
|
-
.filter(([
|
|
64
|
-
.map(([key, value]) => key.padEnd(30)
|
|
62
|
+
.filter(([_key, value]) => value.dataType !== DataType.Null)
|
|
63
|
+
.map(([key, value]) => `${key.padEnd(30)}=${value.toString()}`)
|
|
65
64
|
.join("\n") +
|
|
66
65
|
"\n\n"
|
|
67
66
|
);
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
public getField(fieldName: string): Variant | null {
|
|
71
|
-
return (this.fields as
|
|
70
|
+
return (this.fields as unknown as Record<string, Variant>)[fieldName] || null;
|
|
72
71
|
}
|
|
73
72
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EventEmitter } from "events";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
2
|
import { assert } from "node-opcua-assert";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { EventStuff } from "./event_stuff";
|
|
3
|
+
import type { NodeId } from "node-opcua-nodeid";
|
|
5
4
|
import { ClientAlarm } from "./client_alarm";
|
|
5
|
+
import type { EventStuff } from "./event_stuff";
|
|
6
6
|
|
|
7
7
|
export interface ClientAlarmList {
|
|
8
8
|
on(eventName: "alarmChanged", handler: (alarm: ClientAlarm) => void): this;
|
|
@@ -14,11 +14,9 @@ export interface ClientAlarmList {
|
|
|
14
14
|
emit(eventName: "alarmDeleted", alarm: ClientAlarm): boolean;
|
|
15
15
|
}
|
|
16
16
|
// maintain a set of alarm list for a client
|
|
17
|
+
// biome-ignore lint/suspicious/noUnsafeDeclarationMerging: interface adds typed members/overloads for this class
|
|
17
18
|
export class ClientAlarmList extends EventEmitter implements Iterable<ClientAlarm> {
|
|
18
|
-
private _map: Map<string,ClientAlarm> = new Map();
|
|
19
|
-
public constructor() {
|
|
20
|
-
super();
|
|
21
|
-
}
|
|
19
|
+
private _map: Map<string, ClientAlarm> = new Map();
|
|
22
20
|
|
|
23
21
|
public [Symbol.iterator](): Iterator<ClientAlarm> {
|
|
24
22
|
let pointer = 0;
|
|
@@ -57,7 +55,7 @@ export class ClientAlarmList extends EventEmitter implements Iterable<ClientAlar
|
|
|
57
55
|
if (!alarm) {
|
|
58
56
|
const key = this.makeKey(conditionId.value, eventType.value);
|
|
59
57
|
const newAlarm = new ClientAlarm(eventField);
|
|
60
|
-
this._map.set(key,newAlarm);
|
|
58
|
+
this._map.set(key, newAlarm);
|
|
61
59
|
this.emit("newAlarm", newAlarm);
|
|
62
60
|
this.emit("alarmChanged", newAlarm);
|
|
63
61
|
} else {
|
|
@@ -92,7 +90,7 @@ export class ClientAlarmList extends EventEmitter implements Iterable<ClientAlar
|
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
private makeKey(conditionId: NodeId, eventType: NodeId) {
|
|
95
|
-
return conditionId.toString()
|
|
93
|
+
return `${conditionId.toString()}|${eventType.toString()}`;
|
|
96
94
|
}
|
|
97
95
|
private findAlarm(conditionId: NodeId, eventType: NodeId): ClientAlarm | null {
|
|
98
96
|
const key = this.makeKey(conditionId, eventType);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { AttributeIds } from "node-opcua-data-model";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { IBasicSessionReadAsyncSimple } from "node-opcua-pseudo-session";
|
|
5
|
-
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
6
3
|
import { make_traceLog } from "node-opcua-debug";
|
|
4
|
+
import type { NodeId } from "node-opcua-nodeid";
|
|
5
|
+
import type { IBasicSessionReadAsyncSimple } from "node-opcua-pseudo-session";
|
|
6
|
+
import { DataType, type Variant, type VariantLike } from "node-opcua-variant";
|
|
7
7
|
|
|
8
8
|
const traceLog = make_traceLog("ClientAlarmTool");
|
|
9
9
|
|
|
@@ -20,8 +20,8 @@ export async function dumpEvent(session: IBasicSessionReadAsyncSimple, fields: s
|
|
|
20
20
|
nodeId
|
|
21
21
|
});
|
|
22
22
|
if (dataValue.statusCode.isGood()) {
|
|
23
|
-
const browseName = dataValue.value.value.name
|
|
24
|
-
return browseName;
|
|
23
|
+
const browseName = dataValue.value.value.name;
|
|
24
|
+
return browseName || "???";
|
|
25
25
|
} else {
|
|
26
26
|
return "???";
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ export async function dumpEvent(session: IBasicSessionReadAsyncSimple, fields: s
|
|
|
29
29
|
function w(str: string, l: number): string {
|
|
30
30
|
return (str || "").toString().padEnd(l, " ").substring(0, l);
|
|
31
31
|
}
|
|
32
|
-
async function __dumpEvent1(_session: IBasicSessionReadAsyncSimple, _fields:
|
|
32
|
+
async function __dumpEvent1(_session: IBasicSessionReadAsyncSimple, _fields: string[], variant: VariantLike, index: number) {
|
|
33
33
|
if (variant.dataType === DataType.Null) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -44,7 +44,6 @@ export async function dumpEvent(session: IBasicSessionReadAsyncSimple, fields: s
|
|
|
44
44
|
")"
|
|
45
45
|
);
|
|
46
46
|
} else {
|
|
47
|
-
// tslint:disable-next-line: no-console
|
|
48
47
|
traceLog(
|
|
49
48
|
chalk.yellow(w("", 30), w(_fields[index], 25)),
|
|
50
49
|
chalk.cyan(w(DataType[variant.dataType as number], 10).toString()),
|
package/source/event_stuff.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
2
|
+
import type { NodeId } from "node-opcua-nodeid";
|
|
2
3
|
import { lowerFirstLetter } from "node-opcua-utils";
|
|
3
|
-
import { Variant } from "node-opcua-variant";
|
|
4
|
+
import type { Variant } from "node-opcua-variant";
|
|
4
5
|
|
|
5
|
-
import { make_warningLog } from "node-opcua-debug";
|
|
6
6
|
const warningLog = make_warningLog(__filename);
|
|
7
7
|
|
|
8
8
|
export interface TVariant<T> extends Variant {
|
|
@@ -22,12 +22,10 @@ export interface EventStuff {
|
|
|
22
22
|
conditionName?: TVariant<string>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
/**
|
|
27
26
|
* @private
|
|
28
27
|
*/
|
|
29
28
|
export function fieldsToJson(fields: string[], eventFields: Variant[], flat?: boolean): EventStuff {
|
|
30
|
-
|
|
31
29
|
function setProperty(_data: Record<string, unknown>, fieldName: string, value: Variant) {
|
|
32
30
|
let name: string;
|
|
33
31
|
if (!fieldName || value === null) {
|
|
@@ -58,7 +56,8 @@ export function fieldsToJson(fields: string[], eventFields: Variant[], flat?: bo
|
|
|
58
56
|
|
|
59
57
|
// use this Object.create(null) to construct an object with no prototype
|
|
60
58
|
// so that we immune from prototype pollution
|
|
61
|
-
const data:
|
|
59
|
+
const data: Record<string, unknown> = Object.create(null);
|
|
60
|
+
// biome-ignore lint/suspicious/noProto: deliberate sanity check that Object.create(null) has no prototype (prototype-pollution defense)
|
|
62
61
|
if (data.__proto__) {
|
|
63
62
|
throw new Error("expecting __proto__ to be undefined");
|
|
64
63
|
}
|
|
@@ -68,5 +67,5 @@ export function fieldsToJson(fields: string[], eventFields: Variant[], flat?: bo
|
|
|
68
67
|
setProperty(data, fields[index], variant);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
return data;
|
|
70
|
+
return data as unknown as EventStuff;
|
|
72
71
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NodeIdLike } from "node-opcua-nodeid";
|
|
2
|
-
import {
|
|
1
|
+
import type { NodeIdLike } from "node-opcua-nodeid";
|
|
2
|
+
import { extractFields, type ISessionForExtractField, simpleBrowsePathsToString } from "node-opcua-pseudo-session";
|
|
3
3
|
|
|
4
4
|
export async function extractConditionFields(session: ISessionForExtractField, conditionNodeId: NodeIdLike): Promise<string[]> {
|
|
5
5
|
// conditionNodeId could be a Object of type ConditionType
|
package/source/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from "./acknowledge_all_conditions";
|
|
2
2
|
export * from "./call_condition_refresh";
|
|
3
3
|
export * from "./call_method_condition";
|
|
4
|
+
export * from "./client_alarm";
|
|
4
5
|
export * from "./client_alarm_list";
|
|
5
6
|
export * from "./client_alarm_tools_dump_event";
|
|
6
|
-
export * from "./client_alarm";
|
|
7
7
|
export * from "./event_stuff";
|
|
8
8
|
export * from "./extract_condition_fields";
|