node-opcua-client 2.64.0 → 2.64.1

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.
Files changed (65) hide show
  1. package/dist/alarms_and_conditions/client_alarm.d.ts +42 -42
  2. package/dist/alarms_and_conditions/client_alarm.js +84 -84
  3. package/dist/alarms_and_conditions/client_alarm_list.d.ts +21 -21
  4. package/dist/alarms_and_conditions/client_alarm_list.js +97 -97
  5. package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -4
  6. package/dist/alarms_and_conditions/client_alarm_tools.js +139 -139
  7. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -18
  8. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +190 -190
  9. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -9
  10. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +73 -73
  11. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +8 -8
  12. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +120 -120
  13. package/dist/alarms_and_conditions/client_tools.d.ts +7 -7
  14. package/dist/alarms_and_conditions/client_tools.js +179 -179
  15. package/dist/client_base.d.ts +270 -270
  16. package/dist/client_base.js +13 -13
  17. package/dist/client_monitored_item.d.ts +21 -21
  18. package/dist/client_monitored_item.js +11 -11
  19. package/dist/client_monitored_item_base.d.ts +39 -39
  20. package/dist/client_monitored_item_base.js +2 -2
  21. package/dist/client_monitored_item_group.d.ts +18 -18
  22. package/dist/client_monitored_item_group.js +13 -13
  23. package/dist/client_monitored_item_toolbox.d.ts +15 -15
  24. package/dist/client_monitored_item_toolbox.js +117 -117
  25. package/dist/client_session.d.ts +483 -483
  26. package/dist/client_session.js +10 -10
  27. package/dist/client_session_keepalive_manager.d.ts +34 -34
  28. package/dist/client_session_keepalive_manager.js +150 -150
  29. package/dist/client_subscription.d.ts +241 -241
  30. package/dist/client_subscription.js +14 -14
  31. package/dist/client_utils.d.ts +22 -22
  32. package/dist/client_utils.js +88 -88
  33. package/dist/common.d.ts +17 -17
  34. package/dist/common.js +5 -5
  35. package/dist/index.d.ts +55 -55
  36. package/dist/index.js +89 -89
  37. package/dist/opcua_client.d.ts +132 -132
  38. package/dist/opcua_client.js +33 -33
  39. package/dist/private/client_base_impl.d.ts +169 -169
  40. package/dist/private/client_base_impl.js +1315 -1315
  41. package/dist/private/client_monitored_item_base_impl.d.ts +3 -3
  42. package/dist/private/client_monitored_item_base_impl.js +4 -4
  43. package/dist/private/client_monitored_item_group_impl.d.ts +53 -53
  44. package/dist/private/client_monitored_item_group_impl.js +159 -159
  45. package/dist/private/client_monitored_item_impl.d.ts +93 -93
  46. package/dist/private/client_monitored_item_impl.js +304 -304
  47. package/dist/private/client_publish_engine.d.ts +62 -62
  48. package/dist/private/client_publish_engine.js +408 -408
  49. package/dist/private/client_session_impl.d.ts +620 -620
  50. package/dist/private/client_session_impl.js +1298 -1298
  51. package/dist/private/client_subscription_impl.d.ts +93 -93
  52. package/dist/private/client_subscription_impl.js +779 -779
  53. package/dist/private/i_private_client.d.ts +18 -18
  54. package/dist/private/i_private_client.js +2 -2
  55. package/dist/private/opcua_client_impl.d.ts +169 -169
  56. package/dist/private/opcua_client_impl.js +978 -978
  57. package/dist/reconnection.d.ts +9 -9
  58. package/dist/reconnection.js +362 -362
  59. package/dist/tools/findservers.d.ts +20 -20
  60. package/dist/tools/findservers.js +61 -61
  61. package/dist/tools/read_history_server_capabilities.d.ts +6 -6
  62. package/dist/tools/read_history_server_capabilities.js +99 -99
  63. package/dist/verify.d.ts +5 -5
  64. package/dist/verify.js +134 -134
  65. package/package.json +96 -97
@@ -1,140 +1,140 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.installAlarmMonitoring = exports.uninstallAlarmMonitoring = void 0;
13
- const node_opcua_data_model_1 = require("node-opcua-data-model");
14
- const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
- const node_opcua_service_filter_1 = require("node-opcua-service-filter");
16
- const node_opcua_service_read_1 = require("node-opcua-service-read");
17
- const node_opcua_debug_1 = require("node-opcua-debug");
18
- const client_monitored_item_1 = require("../client_monitored_item");
19
- const client_alarm_1 = require("./client_alarm");
20
- const client_alarm_list_1 = require("./client_alarm_list");
21
- const client_alarm_tools_extractConditionFields_1 = require("./client_alarm_tools_extractConditionFields");
22
- const client_tools_1 = require("./client_tools");
23
- const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
24
- const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
25
- function r(_key, o) {
26
- if (o && o.dataType === "Null") {
27
- return undefined;
28
- }
29
- return o;
30
- }
31
- // ------------------------------------------------------------------------------------------------------------------------------
32
- function uninstallAlarmMonitoring(session) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const _sessionPriv = session;
35
- if (!_sessionPriv.$clientAlarmList) {
36
- return;
37
- }
38
- const mi = _sessionPriv.$monitoredItemForAlarmList;
39
- mi.removeAllListeners();
40
- _sessionPriv.$monitoredItemForAlarmList = null;
41
- yield _sessionPriv.$subscriptionforAlarmList.terminate();
42
- _sessionPriv.$clientAlarmList = null;
43
- return;
44
- });
45
- }
46
- exports.uninstallAlarmMonitoring = uninstallAlarmMonitoring;
47
- // Release 1.04 8 OPC Unified Architecture, Part 9
48
- // 4.5 Condition state synchronization
49
- //
50
- // A Client that wishes to display the current status of Alarms and Conditions (known as a
51
- // “current Alarm display”) would use the following logic to process Refresh Event Notifications.
52
- // The Client flags all Retained Conditions as suspect on reception of the Event of the
53
- // RefreshStartEventType. The Client adds any new Events that are received during the Refresh
54
- // without flagging them as suspect. The Client also removes the suspect flag from any Retained
55
- // Conditions that are returned as part of the Refresh. When the Client receives a
56
- // RefreshEndEvent, the Client removes any remaining suspect Events, since they no longer
57
- // apply.
58
- // ------------------------------------------------------------------------------------------------------------------------------
59
- function installAlarmMonitoring(session) {
60
- return __awaiter(this, void 0, void 0, function* () {
61
- const _sessionPriv = session;
62
- // create
63
- if (_sessionPriv.$clientAlarmList) {
64
- return _sessionPriv.$clientAlarmList;
65
- }
66
- const clientAlarmList = new client_alarm_list_1.ClientAlarmList();
67
- _sessionPriv.$clientAlarmList = clientAlarmList;
68
- const request = {
69
- maxNotificationsPerPublish: 10000,
70
- priority: 6,
71
- publishingEnabled: true,
72
- requestedLifetimeCount: 10000,
73
- requestedMaxKeepAliveCount: 10,
74
- requestedPublishingInterval: 500
75
- };
76
- const subscription = yield session.createSubscription2(request);
77
- _sessionPriv.$subscriptionforAlarmList = subscription;
78
- const itemToMonitor = {
79
- attributeId: node_opcua_data_model_1.AttributeIds.EventNotifier,
80
- nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server") // i=2253
81
- };
82
- const fields = yield (0, client_alarm_tools_extractConditionFields_1.extractConditionFields)(session, "AlarmConditionType");
83
- const eventFilter = (0, node_opcua_service_filter_1.constructEventFilter)(fields, [(0, node_opcua_nodeid_1.resolveNodeId)("AcknowledgeableConditionType")]);
84
- const monitoringParameters = {
85
- discardOldest: false,
86
- filter: eventFilter,
87
- queueSize: 10000,
88
- samplingInterval: 0
89
- };
90
- // now create a event monitored Item
91
- const event_monitoringItem = client_monitored_item_1.ClientMonitoredItem.create(subscription, itemToMonitor, monitoringParameters, node_opcua_service_read_1.TimestampsToReturn.Both);
92
- const RefreshStartEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshStartEventType").toString();
93
- const RefreshEndEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshEndEventType").toString();
94
- event_monitoringItem.on("changed", (eventFields) => {
95
- debugLog("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED");
96
- const pojo = (0, client_alarm_1.fieldsToJson)(fields, eventFields);
97
- try {
98
- if (pojo.eventType.value.toString() === RefreshStartEventType) {
99
- return;
100
- }
101
- if (pojo.eventType.value.toString() === RefreshEndEventType) {
102
- return;
103
- }
104
- if (!pojo.conditionId || !pojo.conditionId.value || pojo.conditionId.dataType === 0) {
105
- // not a acknowledgeable condition
106
- return;
107
- }
108
- clientAlarmList.update(pojo);
109
- }
110
- catch (err) {
111
- // tslint:disable-next-line: no-console
112
- console.log(JSON.stringify(pojo, r, " "));
113
- // tslint:disable-next-line: no-console
114
- console.log("Error !!", err);
115
- }
116
- // Release 1.04 8 OPC Unified Architecture, Part 9
117
- // 4.5 Condition state synchronization
118
- // RefreshRequiredEventType
119
- // Under some circumstances a Server may not be capable of ensuring the Client is fully
120
- // in sync with the current state of Condition instances. For example, if the underlying
121
- // system represented by the Server is reset or communications are lost for some period
122
- // of time the Server may need to resynchronize itself with the underlying system. In
123
- // these cases, the Server shall send an Event of the RefreshRequiredEventType to
124
- // advise the Client that a Refresh may be necessary. A Client receiving this special
125
- // Event should initiate a ConditionRefresh as noted in this clause.
126
- // TODO
127
- });
128
- try {
129
- yield (0, client_tools_1.callConditionRefresh)(subscription);
130
- }
131
- catch (err) {
132
- console.log("Server may not implement condition refresh", err.message);
133
- }
134
- _sessionPriv.$monitoredItemForAlarmList = event_monitoringItem;
135
- // also request updates
136
- return clientAlarmList;
137
- });
138
- }
139
- exports.installAlarmMonitoring = installAlarmMonitoring;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.installAlarmMonitoring = exports.uninstallAlarmMonitoring = void 0;
13
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
14
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
15
+ const node_opcua_service_filter_1 = require("node-opcua-service-filter");
16
+ const node_opcua_service_read_1 = require("node-opcua-service-read");
17
+ const node_opcua_debug_1 = require("node-opcua-debug");
18
+ const client_monitored_item_1 = require("../client_monitored_item");
19
+ const client_alarm_1 = require("./client_alarm");
20
+ const client_alarm_list_1 = require("./client_alarm_list");
21
+ const client_alarm_tools_extractConditionFields_1 = require("./client_alarm_tools_extractConditionFields");
22
+ const client_tools_1 = require("./client_tools");
23
+ const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
24
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
25
+ function r(_key, o) {
26
+ if (o && o.dataType === "Null") {
27
+ return undefined;
28
+ }
29
+ return o;
30
+ }
31
+ // ------------------------------------------------------------------------------------------------------------------------------
32
+ function uninstallAlarmMonitoring(session) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const _sessionPriv = session;
35
+ if (!_sessionPriv.$clientAlarmList) {
36
+ return;
37
+ }
38
+ const mi = _sessionPriv.$monitoredItemForAlarmList;
39
+ mi.removeAllListeners();
40
+ _sessionPriv.$monitoredItemForAlarmList = null;
41
+ yield _sessionPriv.$subscriptionforAlarmList.terminate();
42
+ _sessionPriv.$clientAlarmList = null;
43
+ return;
44
+ });
45
+ }
46
+ exports.uninstallAlarmMonitoring = uninstallAlarmMonitoring;
47
+ // Release 1.04 8 OPC Unified Architecture, Part 9
48
+ // 4.5 Condition state synchronization
49
+ //
50
+ // A Client that wishes to display the current status of Alarms and Conditions (known as a
51
+ // “current Alarm display”) would use the following logic to process Refresh Event Notifications.
52
+ // The Client flags all Retained Conditions as suspect on reception of the Event of the
53
+ // RefreshStartEventType. The Client adds any new Events that are received during the Refresh
54
+ // without flagging them as suspect. The Client also removes the suspect flag from any Retained
55
+ // Conditions that are returned as part of the Refresh. When the Client receives a
56
+ // RefreshEndEvent, the Client removes any remaining suspect Events, since they no longer
57
+ // apply.
58
+ // ------------------------------------------------------------------------------------------------------------------------------
59
+ function installAlarmMonitoring(session) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const _sessionPriv = session;
62
+ // create
63
+ if (_sessionPriv.$clientAlarmList) {
64
+ return _sessionPriv.$clientAlarmList;
65
+ }
66
+ const clientAlarmList = new client_alarm_list_1.ClientAlarmList();
67
+ _sessionPriv.$clientAlarmList = clientAlarmList;
68
+ const request = {
69
+ maxNotificationsPerPublish: 10000,
70
+ priority: 6,
71
+ publishingEnabled: true,
72
+ requestedLifetimeCount: 10000,
73
+ requestedMaxKeepAliveCount: 10,
74
+ requestedPublishingInterval: 500
75
+ };
76
+ const subscription = yield session.createSubscription2(request);
77
+ _sessionPriv.$subscriptionforAlarmList = subscription;
78
+ const itemToMonitor = {
79
+ attributeId: node_opcua_data_model_1.AttributeIds.EventNotifier,
80
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server") // i=2253
81
+ };
82
+ const fields = yield (0, client_alarm_tools_extractConditionFields_1.extractConditionFields)(session, "AlarmConditionType");
83
+ const eventFilter = (0, node_opcua_service_filter_1.constructEventFilter)(fields, [(0, node_opcua_nodeid_1.resolveNodeId)("AcknowledgeableConditionType")]);
84
+ const monitoringParameters = {
85
+ discardOldest: false,
86
+ filter: eventFilter,
87
+ queueSize: 10000,
88
+ samplingInterval: 0
89
+ };
90
+ // now create a event monitored Item
91
+ const event_monitoringItem = client_monitored_item_1.ClientMonitoredItem.create(subscription, itemToMonitor, monitoringParameters, node_opcua_service_read_1.TimestampsToReturn.Both);
92
+ const RefreshStartEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshStartEventType").toString();
93
+ const RefreshEndEventType = (0, node_opcua_nodeid_1.resolveNodeId)("RefreshEndEventType").toString();
94
+ event_monitoringItem.on("changed", (eventFields) => {
95
+ debugLog("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---- ALARM RECEIVED");
96
+ const pojo = (0, client_alarm_1.fieldsToJson)(fields, eventFields);
97
+ try {
98
+ if (pojo.eventType.value.toString() === RefreshStartEventType) {
99
+ return;
100
+ }
101
+ if (pojo.eventType.value.toString() === RefreshEndEventType) {
102
+ return;
103
+ }
104
+ if (!pojo.conditionId || !pojo.conditionId.value || pojo.conditionId.dataType === 0) {
105
+ // not a acknowledgeable condition
106
+ return;
107
+ }
108
+ clientAlarmList.update(pojo);
109
+ }
110
+ catch (err) {
111
+ // tslint:disable-next-line: no-console
112
+ console.log(JSON.stringify(pojo, r, " "));
113
+ // tslint:disable-next-line: no-console
114
+ console.log("Error !!", err);
115
+ }
116
+ // Release 1.04 8 OPC Unified Architecture, Part 9
117
+ // 4.5 Condition state synchronization
118
+ // RefreshRequiredEventType
119
+ // Under some circumstances a Server may not be capable of ensuring the Client is fully
120
+ // in sync with the current state of Condition instances. For example, if the underlying
121
+ // system represented by the Server is reset or communications are lost for some period
122
+ // of time the Server may need to resynchronize itself with the underlying system. In
123
+ // these cases, the Server shall send an Event of the RefreshRequiredEventType to
124
+ // advise the Client that a Refresh may be necessary. A Client receiving this special
125
+ // Event should initiate a ConditionRefresh as noted in this clause.
126
+ // TODO
127
+ });
128
+ try {
129
+ yield (0, client_tools_1.callConditionRefresh)(subscription);
130
+ }
131
+ catch (err) {
132
+ console.log("Server may not implement condition refresh", err.message);
133
+ }
134
+ _sessionPriv.$monitoredItemForAlarmList = event_monitoringItem;
135
+ // also request updates
136
+ return clientAlarmList;
137
+ });
138
+ }
139
+ exports.installAlarmMonitoring = installAlarmMonitoring;
140
140
  //# sourceMappingURL=client_alarm_tools.js.map
@@ -1,18 +1,18 @@
1
- import { StatusCode } from "node-opcua-status-code";
2
- import { ClientSession } from "../client_session";
3
- import { EventStuff } from "./client_alarm";
4
- /**
5
- *
6
- * @param session
7
- * @param eventStuff
8
- * @param comment
9
- */
10
- export declare function acknowledgeCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode>;
11
- export declare function confirmCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode>;
12
- /**
13
- * Enumerate all events
14
- * @param session
15
- */
16
- export declare function findActiveConditions(session: ClientSession): Promise<EventStuff[]>;
17
- export declare function acknwoledgeAllConditions(session: ClientSession, message: string): Promise<void>;
18
- export declare function confirmAllConditions(session: ClientSession, message: string): Promise<void>;
1
+ import { StatusCode } from "node-opcua-status-code";
2
+ import { ClientSession } from "../client_session";
3
+ import { EventStuff } from "./client_alarm";
4
+ /**
5
+ *
6
+ * @param session
7
+ * @param eventStuff
8
+ * @param comment
9
+ */
10
+ export declare function acknowledgeCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode>;
11
+ export declare function confirmCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode>;
12
+ /**
13
+ * Enumerate all events
14
+ * @param session
15
+ */
16
+ export declare function findActiveConditions(session: ClientSession): Promise<EventStuff[]>;
17
+ export declare function acknwoledgeAllConditions(session: ClientSession, message: string): Promise<void>;
18
+ export declare function confirmAllConditions(session: ClientSession, message: string): Promise<void>;