node-opcua-client 2.98.0 → 2.98.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 (106) hide show
  1. package/dist/alarms_and_conditions/client_alarm.d.ts +49 -0
  2. package/dist/alarms_and_conditions/client_alarm.js +110 -0
  3. package/dist/alarms_and_conditions/client_alarm.js.map +1 -0
  4. package/dist/alarms_and_conditions/client_alarm_list.d.ts +25 -0
  5. package/dist/alarms_and_conditions/client_alarm_list.js +98 -0
  6. package/dist/alarms_and_conditions/client_alarm_list.js.map +1 -0
  7. package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -0
  8. package/dist/alarms_and_conditions/client_alarm_tools.js +157 -0
  9. package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -0
  10. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -0
  11. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +193 -0
  12. package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -0
  13. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -0
  14. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +73 -0
  15. package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -0
  16. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +3 -0
  17. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +119 -0
  18. package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js.map +1 -0
  19. package/dist/alarms_and_conditions/client_tools.d.ts +7 -0
  20. package/dist/alarms_and_conditions/client_tools.js +180 -0
  21. package/dist/alarms_and_conditions/client_tools.js.map +1 -0
  22. package/dist/client_base.d.ts +277 -0
  23. package/dist/client_base.js +15 -0
  24. package/dist/client_base.js.map +1 -0
  25. package/dist/client_monitored_item.d.ts +21 -0
  26. package/dist/client_monitored_item.js +12 -0
  27. package/dist/client_monitored_item.js.map +1 -0
  28. package/dist/client_monitored_item_base.d.ts +39 -0
  29. package/dist/client_monitored_item_base.js +3 -0
  30. package/dist/client_monitored_item_base.js.map +1 -0
  31. package/dist/client_monitored_item_group.d.ts +21 -0
  32. package/dist/client_monitored_item_group.js +14 -0
  33. package/dist/client_monitored_item_group.js.map +1 -0
  34. package/dist/client_monitored_item_toolbox.d.ts +15 -0
  35. package/dist/client_monitored_item_toolbox.js +117 -0
  36. package/dist/client_monitored_item_toolbox.js.map +1 -0
  37. package/dist/client_session.d.ts +529 -0
  38. package/dist/client_session.js +11 -0
  39. package/dist/client_session.js.map +1 -0
  40. package/dist/client_session_keepalive_manager.d.ts +34 -0
  41. package/dist/client_session_keepalive_manager.js +150 -0
  42. package/dist/client_session_keepalive_manager.js.map +1 -0
  43. package/dist/client_subscription.d.ts +241 -0
  44. package/dist/client_subscription.js +15 -0
  45. package/dist/client_subscription.js.map +1 -0
  46. package/dist/client_utils.d.ts +22 -0
  47. package/dist/client_utils.js +88 -0
  48. package/dist/client_utils.js.map +1 -0
  49. package/dist/common.d.ts +17 -0
  50. package/dist/common.js +6 -0
  51. package/dist/common.js.map +1 -0
  52. package/dist/index.d.ts +56 -0
  53. package/dist/index.js +95 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/opcua_client.d.ts +118 -0
  56. package/dist/opcua_client.js +34 -0
  57. package/dist/opcua_client.js.map +1 -0
  58. package/dist/private/client_base_impl.d.ts +160 -0
  59. package/dist/private/client_base_impl.js +1349 -0
  60. package/dist/private/client_base_impl.js.map +1 -0
  61. package/dist/private/client_monitored_item_base_impl.d.ts +3 -0
  62. package/dist/private/client_monitored_item_base_impl.js +5 -0
  63. package/dist/private/client_monitored_item_base_impl.js.map +1 -0
  64. package/dist/private/client_monitored_item_group_impl.d.ts +53 -0
  65. package/dist/private/client_monitored_item_group_impl.js +162 -0
  66. package/dist/private/client_monitored_item_group_impl.js.map +1 -0
  67. package/dist/private/client_monitored_item_impl.d.ts +93 -0
  68. package/dist/private/client_monitored_item_impl.js +305 -0
  69. package/dist/private/client_monitored_item_impl.js.map +1 -0
  70. package/dist/private/client_publish_engine.d.ts +62 -0
  71. package/dist/private/client_publish_engine.js +409 -0
  72. package/dist/private/client_publish_engine.js.map +1 -0
  73. package/dist/private/client_session_impl.d.ts +631 -0
  74. package/dist/private/client_session_impl.js +1349 -0
  75. package/dist/private/client_session_impl.js.map +1 -0
  76. package/dist/private/client_subscription_impl.d.ts +93 -0
  77. package/dist/private/client_subscription_impl.js +780 -0
  78. package/dist/private/client_subscription_impl.js.map +1 -0
  79. package/dist/private/i_private_client.d.ts +21 -0
  80. package/dist/private/i_private_client.js +3 -0
  81. package/dist/private/i_private_client.js.map +1 -0
  82. package/dist/private/opcua_client_impl.d.ts +166 -0
  83. package/dist/private/opcua_client_impl.js +1001 -0
  84. package/dist/private/opcua_client_impl.js.map +1 -0
  85. package/dist/private/performance.d.ts +1 -0
  86. package/dist/private/performance.js +19 -0
  87. package/dist/private/performance.js.map +1 -0
  88. package/dist/reconnection.d.ts +9 -0
  89. package/dist/reconnection.js +382 -0
  90. package/dist/reconnection.js.map +1 -0
  91. package/dist/tools/findservers.d.ts +20 -0
  92. package/dist/tools/findservers.js +62 -0
  93. package/dist/tools/findservers.js.map +1 -0
  94. package/dist/tools/read_history_server_capabilities.d.ts +6 -0
  95. package/dist/tools/read_history_server_capabilities.js +99 -0
  96. package/dist/tools/read_history_server_capabilities.js.map +1 -0
  97. package/dist/user_identity_info.d.ts +1 -0
  98. package/dist/user_identity_info.js +3 -0
  99. package/dist/user_identity_info.js.map +1 -0
  100. package/dist/verify.d.ts +5 -0
  101. package/dist/verify.js +135 -0
  102. package/dist/verify.js.map +1 -0
  103. package/package.json +48 -44
  104. package/.nycrc.json +0 -14
  105. package/test_helpers/create_certificates.js +0 -1
  106. package/typedoc.js +0 -20
@@ -0,0 +1,1349 @@
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.ClientSessionImpl = void 0;
13
+ /**
14
+ * @module node-opcua-client-private
15
+ */
16
+ const events_1 = require("events");
17
+ const chalk = require("chalk");
18
+ const node_opcua_assert_1 = require("node-opcua-assert");
19
+ const node_opcua_client_dynamic_extension_object_1 = require("node-opcua-client-dynamic-extension-object");
20
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
21
+ const node_opcua_data_value_1 = require("node-opcua-data-value");
22
+ const node_opcua_debug_1 = require("node-opcua-debug");
23
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
24
+ const node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
25
+ const node_opcua_secure_channel_1 = require("node-opcua-secure-channel");
26
+ const node_opcua_service_browse_1 = require("node-opcua-service-browse");
27
+ const node_opcua_service_call_1 = require("node-opcua-service-call");
28
+ const node_opcua_service_history_1 = require("node-opcua-service-history");
29
+ const node_opcua_service_query_1 = require("node-opcua-service-query");
30
+ const node_opcua_service_read_1 = require("node-opcua-service-read");
31
+ const node_opcua_service_register_node_1 = require("node-opcua-service-register-node");
32
+ const node_opcua_service_subscription_1 = require("node-opcua-service-subscription");
33
+ const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
34
+ const node_opcua_service_write_1 = require("node-opcua-service-write");
35
+ const node_opcua_status_code_1 = require("node-opcua-status-code");
36
+ const node_opcua_types_1 = require("node-opcua-types");
37
+ const node_opcua_utils_1 = require("node-opcua-utils");
38
+ const node_opcua_variant_1 = require("node-opcua-variant");
39
+ const client_session_keepalive_manager_1 = require("../client_session_keepalive_manager");
40
+ const reconnection_1 = require("../reconnection");
41
+ const client_publish_engine_1 = require("./client_publish_engine");
42
+ const client_subscription_impl_1 = require("./client_subscription_impl");
43
+ const helpAPIChange = process.env.DEBUG && process.env.DEBUG.match(/API/);
44
+ const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
45
+ const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
46
+ const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
47
+ const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
48
+ let pendingTransactionMessageDisplayed = false;
49
+ function coerceBrowseDescription(data) {
50
+ if (typeof data === "string" || data instanceof node_opcua_nodeid_1.NodeId) {
51
+ return coerceBrowseDescription({
52
+ browseDirection: node_opcua_data_model_1.BrowseDirection.Forward,
53
+ includeSubtypes: true,
54
+ nodeClassMask: 0,
55
+ nodeId: data,
56
+ referenceTypeId: "HierarchicalReferences",
57
+ resultMask: 63
58
+ });
59
+ }
60
+ else {
61
+ data.nodeId = (0, node_opcua_nodeid_1.resolveNodeId)(data.nodeId);
62
+ data.referenceTypeId = data.referenceTypeId ? (0, node_opcua_nodeid_1.resolveNodeId)(data.referenceTypeId) : null;
63
+ return new node_opcua_service_browse_1.BrowseDescription(data);
64
+ }
65
+ }
66
+ function coerceReadValueId(node) {
67
+ if (typeof node === "string" || node instanceof node_opcua_nodeid_1.NodeId) {
68
+ return new node_opcua_service_read_1.ReadValueId({
69
+ attributeId: node_opcua_service_read_1.AttributeIds.Value,
70
+ dataEncoding: undefined,
71
+ indexRange: undefined,
72
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)(node)
73
+ });
74
+ }
75
+ else {
76
+ (0, node_opcua_assert_1.assert)(node instanceof Object);
77
+ return new node_opcua_service_read_1.ReadValueId(node);
78
+ }
79
+ }
80
+ const keys = Object.keys(node_opcua_service_read_1.AttributeIds).filter((k) => node_opcua_service_read_1.AttributeIds[k] !== node_opcua_service_read_1.AttributeIds.INVALID);
81
+ const attributeNames = (() => {
82
+ const r = [];
83
+ for (let i = 1; i <= 22; i++) {
84
+ r.push(node_opcua_data_model_1.attributeNameById[i].toString());
85
+ }
86
+ return r;
87
+ })();
88
+ function composeResult(nodes, nodesToRead, dataValues) {
89
+ (0, node_opcua_assert_1.assert)(nodesToRead.length === dataValues.length);
90
+ let c = 0;
91
+ const results = [];
92
+ let dataValue;
93
+ let k;
94
+ let nodeToRead;
95
+ for (const node of nodes) {
96
+ const data = {
97
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)(node),
98
+ statusCode: node_opcua_status_code_1.StatusCodes.BadNodeIdUnknown
99
+ };
100
+ let addedProperty = 0;
101
+ for (const key of attributeNames) {
102
+ dataValue = dataValues[c];
103
+ nodeToRead = nodesToRead[c];
104
+ c++;
105
+ if (dataValue.statusCode.equals(node_opcua_status_code_1.StatusCodes.Good)) {
106
+ k = (0, node_opcua_utils_1.lowerFirstLetter)(key);
107
+ data[k] = dataValue.value ? dataValue.value.value : null;
108
+ addedProperty += 1;
109
+ }
110
+ }
111
+ /* istanbul ignore if */
112
+ if (addedProperty > 0) {
113
+ data.statusCode = node_opcua_status_code_1.StatusCodes.Good;
114
+ }
115
+ else {
116
+ data.statusCode = node_opcua_status_code_1.StatusCodes.BadNodeIdUnknown;
117
+ }
118
+ results.push(data);
119
+ }
120
+ return results;
121
+ }
122
+ const emptyUint32Array = new Uint32Array(0);
123
+ /**
124
+ * @class ClientSession
125
+ * @param client {OPCUAClientImpl}
126
+ * @constructor
127
+ * @private
128
+ */
129
+ class ClientSessionImpl extends events_1.EventEmitter {
130
+ constructor(client) {
131
+ super();
132
+ this.name = "";
133
+ this.serverEndpoints = [];
134
+ this.recursive_repair_detector = 0;
135
+ this.processTransactionQueue = (request, callback) => {
136
+ this._reconnecting.pendingTransactionsCount = this._reconnecting.pendingTransactionsCount || 0;
137
+ this._reconnecting.pendingTransactionsCount++;
138
+ this._performMessageTransaction(request, (err, response) => {
139
+ this._reconnecting.pendingTransactionsCount--;
140
+ if (err && err.message.match(/BadSessionIdInvalid/) && request.constructor.name !== "ActivateSessionRequest") {
141
+ debugLog("Transaction on Invalid Session ", request.constructor.name);
142
+ request.requestHeader.requestHandle = node_opcua_secure_channel_1.requestHandleNotSetValue;
143
+ warningLog("client is now attempting to recreate a session");
144
+ this.recreate_session_and_reperform_transaction(request, callback);
145
+ return;
146
+ }
147
+ callback(err, response);
148
+ const length = this._reconnecting.pendingTransactions.length; // record length before callback is called !
149
+ if (length > 0) {
150
+ debugLog("processTransactionQueue => ", this._reconnecting.pendingTransactions.length, " transaction(s) left in queue");
151
+ // tslint:disable-next-line: no-shadowed-variable
152
+ const { request, callback } = this._reconnecting.pendingTransactions.shift();
153
+ this.processTransactionQueue(request, callback);
154
+ }
155
+ });
156
+ };
157
+ this.serverCertificate = Buffer.alloc(0);
158
+ this.sessionId = new node_opcua_nodeid_1.NodeId();
159
+ this._closeEventHasBeenEmitted = false;
160
+ this._client = client;
161
+ this._publishEngine = null;
162
+ this._closed = false;
163
+ this._reconnecting = {
164
+ reconnecting: false,
165
+ pendingCallbacks: [],
166
+ pendingTransactions: [],
167
+ pendingTransactionsCount: 0
168
+ };
169
+ this.requestedMaxReferencesPerNode = 10000;
170
+ this.lastRequestSentTime = new Date(1, 1, 1970);
171
+ this.lastResponseReceivedTime = new Date(1, 1, 1970);
172
+ this.timeout = 0;
173
+ }
174
+ getTransportSettings() {
175
+ return this._client.getTransportSettings();
176
+ }
177
+ /**
178
+ * the endpoint on which this session is operating
179
+ * @property endpoint
180
+ * @type {EndpointDescription}
181
+ */
182
+ get endpoint() {
183
+ return this._client.endpoint;
184
+ }
185
+ get subscriptionCount() {
186
+ return this._publishEngine ? this._publishEngine.subscriptionCount : 0;
187
+ }
188
+ get isReconnecting() {
189
+ var _a;
190
+ return this._client ? this._client.isReconnecting || ((_a = this._reconnecting) === null || _a === void 0 ? void 0 : _a.reconnecting) : false;
191
+ }
192
+ getPublishEngine() {
193
+ if (!this._publishEngine) {
194
+ this._publishEngine = new client_publish_engine_1.ClientSidePublishEngine(this);
195
+ }
196
+ return this._publishEngine;
197
+ }
198
+ changeUser(userIdentityInfo, callback) {
199
+ userIdentityInfo = userIdentityInfo || {
200
+ type: node_opcua_types_1.UserTokenType.Anonymous
201
+ };
202
+ if (!this._client || !this.userIdentityInfo) {
203
+ warningLog("changeUser: invalid session");
204
+ return callback(null, node_opcua_status_code_1.StatusCodes.BadInternalError);
205
+ }
206
+ const old_userIdentity = this.userIdentityInfo;
207
+ this._client._activateSession(this, userIdentityInfo, (err1, session2) => {
208
+ if (err1) {
209
+ this.userIdentityInfo = old_userIdentity;
210
+ console.log("err1 = ", err1.message);
211
+ return callback(null, node_opcua_status_code_1.StatusCodes.BadUserAccessDenied);
212
+ }
213
+ this.userIdentityInfo = userIdentityInfo;
214
+ callback(null, node_opcua_status_code_1.StatusCodes.Good);
215
+ });
216
+ }
217
+ /**
218
+ * @internal
219
+ * @param args
220
+ */
221
+ browse(...args) {
222
+ const arg0 = args[0];
223
+ const isArray = Array.isArray(arg0);
224
+ const callback = args[1];
225
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
226
+ (0, node_opcua_assert_1.assert)(isFinite(this.requestedMaxReferencesPerNode));
227
+ const nodesToBrowse = (isArray ? arg0 : [arg0]).map(coerceBrowseDescription);
228
+ const request = new node_opcua_service_browse_1.BrowseRequest({
229
+ nodesToBrowse,
230
+ requestedMaxReferencesPerNode: this.requestedMaxReferencesPerNode
231
+ });
232
+ this.performMessageTransaction(request, (err, response) => {
233
+ if (err) {
234
+ return callback(err);
235
+ }
236
+ /* istanbul ignore next */
237
+ if (!response || !(response instanceof node_opcua_service_browse_1.BrowseResponse)) {
238
+ return callback(new Error("Internal Error"));
239
+ }
240
+ const results = response.results ? response.results : [];
241
+ if (this.requestedMaxReferencesPerNode > 0) {
242
+ for (let i = 0; i < results.length; i++) {
243
+ const r = results[i];
244
+ /* istanbul ignore next */
245
+ if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
246
+ warningLog(chalk.yellow("warning") +
247
+ " BrowseResponse : the server didn't take into" +
248
+ " account our requestedMaxReferencesPerNode ");
249
+ warningLog(" this.requestedMaxReferencesPerNode= " + this.requestedMaxReferencesPerNode);
250
+ warningLog(" got " + r.references.length + "for " + nodesToBrowse[i].nodeId.toString());
251
+ warningLog(" continuationPoint ", r.continuationPoint);
252
+ }
253
+ }
254
+ }
255
+ for (const r of results) {
256
+ r.references = r.references || /* istanbul ignore next */ [];
257
+ }
258
+ (0, node_opcua_assert_1.assert)(results[0] instanceof node_opcua_service_browse_1.BrowseResult);
259
+ return callback(null, isArray ? results : results[0]);
260
+ });
261
+ }
262
+ browseNext(...args) {
263
+ const arg0 = args[0];
264
+ const isArray = Array.isArray(arg0);
265
+ const releaseContinuationPoints = args[1];
266
+ const callback = args[2];
267
+ (0, node_opcua_assert_1.assert)(typeof callback === "function", "expecting a callback function here");
268
+ const continuationPoints = isArray ? arg0 : [arg0];
269
+ const request = new node_opcua_types_1.BrowseNextRequest({
270
+ continuationPoints,
271
+ releaseContinuationPoints
272
+ });
273
+ this.performMessageTransaction(request, (err, response) => {
274
+ /* istanbul ignore next */
275
+ if (err) {
276
+ return callback(err);
277
+ }
278
+ /* istanbul ignore next */
279
+ if (!response || !(response instanceof node_opcua_types_1.BrowseNextResponse)) {
280
+ return callback(new Error("Internal Error"));
281
+ }
282
+ const results = response.results ? response.results : [];
283
+ for (const r of results) {
284
+ r.references = r.references || [];
285
+ }
286
+ (0, node_opcua_assert_1.assert)(results[0] instanceof node_opcua_service_browse_1.BrowseResult);
287
+ return callback(null, isArray ? results : results[0]);
288
+ });
289
+ }
290
+ /**
291
+ * @internal
292
+ * @param args
293
+ */
294
+ readVariableValue(...args) {
295
+ const callback = args[1];
296
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
297
+ const isArray = Array.isArray(args[0]);
298
+ const nodes = isArray ? args[0] : [args[0]];
299
+ const nodesToRead = nodes.map(coerceReadValueId);
300
+ const request = new node_opcua_service_read_1.ReadRequest({
301
+ nodesToRead,
302
+ timestampsToReturn: node_opcua_service_read_1.TimestampsToReturn.Neither
303
+ });
304
+ this.performMessageTransaction(request, (err, response) => {
305
+ /* istanbul ignore next */
306
+ if (err) {
307
+ return callback(err);
308
+ }
309
+ /* istanbul ignore next */
310
+ if (!(response instanceof node_opcua_service_read_1.ReadResponse)) {
311
+ return callback(new Error("Internal Error"));
312
+ }
313
+ /* istanbul ignore next */
314
+ if (response.responseHeader.serviceResult.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
315
+ return callback(new Error(response.responseHeader.serviceResult.toString()));
316
+ }
317
+ /* istanbul ignore next */
318
+ if (!response.results) {
319
+ response.results = [];
320
+ }
321
+ (0, node_opcua_assert_1.assert)(nodes.length === response.results.length);
322
+ callback(null, isArray ? response.results : response.results[0]);
323
+ });
324
+ }
325
+ readHistoryValue(...args) {
326
+ const startTime = args[1];
327
+ const endTime = args[2];
328
+ let options = {};
329
+ let callback = args[3];
330
+ if (typeof callback !== "function") {
331
+ options = args[3];
332
+ callback = args[4];
333
+ }
334
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
335
+ // adjust parameters
336
+ options.numValuesPerNode = options.numValuesPerNode || 0;
337
+ options.returnBounds = options.returnBounds || options.returnBounds === undefined ? true : false;
338
+ options.isReadModified = options.isReadModified || false;
339
+ options.timestampsToReturn = options.timestampsToReturn || node_opcua_service_read_1.TimestampsToReturn.Both;
340
+ const arg0 = args[0];
341
+ const isArray = Array.isArray(arg0);
342
+ const nodes = isArray ? arg0 : [arg0];
343
+ const nodesToRead = [];
344
+ for (const node of nodes) {
345
+ if (!node.nodeId) {
346
+ nodesToRead.push({
347
+ continuationPoint: undefined,
348
+ dataEncoding: undefined,
349
+ indexRange: undefined,
350
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)(node)
351
+ });
352
+ }
353
+ else {
354
+ nodesToRead.push(node);
355
+ }
356
+ }
357
+ const readRawModifiedDetails = new node_opcua_service_history_1.ReadRawModifiedDetails({
358
+ endTime,
359
+ isReadModified: false,
360
+ numValuesPerNode: options.numValuesPerNode,
361
+ returnBounds: options.returnBounds,
362
+ startTime
363
+ });
364
+ const request = new node_opcua_service_history_1.HistoryReadRequest({
365
+ historyReadDetails: readRawModifiedDetails,
366
+ nodesToRead,
367
+ releaseContinuationPoints: false,
368
+ timestampsToReturn: options.timestampsToReturn
369
+ });
370
+ request.nodesToRead = request.nodesToRead || [];
371
+ (0, node_opcua_assert_1.assert)(nodes.length === request.nodesToRead.length);
372
+ this.historyRead(request, (err, response) => {
373
+ /* istanbul ignore next */
374
+ if (err) {
375
+ return callback(err);
376
+ }
377
+ /* istanbul ignore next */
378
+ if (!response || !(response instanceof node_opcua_service_history_1.HistoryReadResponse)) {
379
+ return callback(new Error("Internal Error"));
380
+ }
381
+ response.results = response.results || [];
382
+ (0, node_opcua_assert_1.assert)(nodes.length === response.results.length);
383
+ callback(null, isArray ? response.results : response.results[0]);
384
+ });
385
+ }
386
+ historyRead(request, callback) {
387
+ /* istanbul ignore next */
388
+ if (!callback) {
389
+ throw new Error("expecting a callback");
390
+ }
391
+ this.performMessageTransaction(request, (err, response) => {
392
+ /* istanbul ignore next */
393
+ if (err) {
394
+ return callback(err);
395
+ }
396
+ /* istanbul ignore next */
397
+ if (!response || !(response instanceof node_opcua_service_history_1.HistoryReadResponse)) {
398
+ return callback(new Error("Internal Error"));
399
+ }
400
+ if (response.responseHeader.serviceResult.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
401
+ return callback(new Error(response.responseHeader.serviceResult.toString()));
402
+ }
403
+ response.results = response.results || /* istanbul ignore next */ [];
404
+ callback(null, response);
405
+ });
406
+ }
407
+ readAggregateValue(arg0, startTime, endTime, aggregateFn, processingInterval, ...args) {
408
+ const callback = typeof args[0] === "function" ? args[0] : args[1];
409
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
410
+ const defaultAggregateFunction = {
411
+ percentDataBad: 100,
412
+ percentDataGood: 100,
413
+ treatUncertainAsBad: true,
414
+ useServerCapabilitiesDefaults: true,
415
+ useSlopedExtrapolation: false
416
+ };
417
+ const aggregateConfiguration = typeof args[0] === "function" ? defaultAggregateFunction : args[0];
418
+ const isArray = Array.isArray(arg0);
419
+ const nodesToRead = isArray
420
+ ? arg0
421
+ : [arg0];
422
+ const aggregateFns = Array.isArray(aggregateFn)
423
+ ? aggregateFn
424
+ : [aggregateFn];
425
+ (0, node_opcua_assert_1.assert)(aggregateFns.length === nodesToRead.length);
426
+ const readProcessedDetails = new node_opcua_service_history_1.ReadProcessedDetails({
427
+ aggregateType: aggregateFns,
428
+ endTime,
429
+ processingInterval,
430
+ startTime,
431
+ aggregateConfiguration
432
+ });
433
+ const request = new node_opcua_service_history_1.HistoryReadRequest({
434
+ historyReadDetails: readProcessedDetails,
435
+ nodesToRead,
436
+ releaseContinuationPoints: false,
437
+ timestampsToReturn: node_opcua_service_read_1.TimestampsToReturn.Both
438
+ });
439
+ (0, node_opcua_assert_1.assert)(nodesToRead.length === request.nodesToRead.length);
440
+ this.performMessageTransaction(request, (err, response) => {
441
+ /* istanbul ignore next */
442
+ if (err) {
443
+ return callback(err);
444
+ }
445
+ /* istanbul ignore next */
446
+ if (!response || !(response instanceof node_opcua_service_history_1.HistoryReadResponse)) {
447
+ return callback(new Error("Internal Error"));
448
+ }
449
+ if (response.responseHeader.serviceResult.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
450
+ return callback(new Error(response.responseHeader.serviceResult.toString()));
451
+ }
452
+ response.results = response.results || /* istanbul ignore next */ [];
453
+ (0, node_opcua_assert_1.assert)(nodesToRead.length === response.results.length);
454
+ callback(null, isArray ? response.results : response.results[0]);
455
+ });
456
+ }
457
+ /**
458
+ * @internal
459
+ * @param args
460
+ */
461
+ write(...args) {
462
+ const arg0 = args[0];
463
+ const isArray = Array.isArray(arg0);
464
+ const nodesToWrite = isArray ? arg0 : [arg0];
465
+ const callback = args[1];
466
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
467
+ const request = new node_opcua_service_write_1.WriteRequest({ nodesToWrite });
468
+ this.performMessageTransaction(request, (err, response) => {
469
+ /* istanbul ignore next */
470
+ if (err) {
471
+ return callback(err, response);
472
+ }
473
+ /* istanbul ignore next */
474
+ if (!response || !(response instanceof node_opcua_service_write_1.WriteResponse)) {
475
+ return callback(new Error("Internal Error"));
476
+ }
477
+ /* istanbul ignore next */
478
+ if (response.responseHeader.serviceResult.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
479
+ return callback(new Error(response.responseHeader.serviceResult.toString()));
480
+ }
481
+ response.results = response.results || /* istanbul ignore next */ [];
482
+ (0, node_opcua_assert_1.assert)(nodesToWrite.length === response.results.length);
483
+ callback(null, isArray ? response.results : response.results[0]);
484
+ });
485
+ }
486
+ writeSingleNode(...args) {
487
+ const nodeId = args[0];
488
+ const value = args[1];
489
+ const callback = args[2];
490
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
491
+ const nodeToWrite = new node_opcua_service_write_1.WriteValue({
492
+ attributeId: node_opcua_service_read_1.AttributeIds.Value,
493
+ indexRange: undefined,
494
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)(nodeId),
495
+ value: new node_opcua_data_value_1.DataValue({ value })
496
+ });
497
+ this.write(nodeToWrite, (err, statusCode) => {
498
+ /* istanbul ignore next */
499
+ if (err) {
500
+ return callback(err);
501
+ }
502
+ (0, node_opcua_assert_1.assert)(statusCode);
503
+ callback(null, statusCode);
504
+ });
505
+ }
506
+ readAllAttributes(...args) {
507
+ const arg0 = args[0];
508
+ const callback = args[1];
509
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
510
+ const isArray = Array.isArray(arg0);
511
+ const nodes = isArray ? arg0 : [arg0];
512
+ const nodesToRead = [];
513
+ for (const node of nodes) {
514
+ const nodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node);
515
+ /* istanbul ignore next */
516
+ if (!nodeId) {
517
+ throw new Error("cannot coerce " + node + " to a valid NodeId");
518
+ }
519
+ for (let attributeId = 1; attributeId <= 22; attributeId++) {
520
+ nodesToRead.push({
521
+ attributeId,
522
+ dataEncoding: undefined,
523
+ indexRange: undefined,
524
+ nodeId
525
+ });
526
+ }
527
+ }
528
+ this.read(nodesToRead, (err, dataValues) => {
529
+ /* istanbul ignore next */
530
+ if (err) {
531
+ return callback(err);
532
+ }
533
+ /* istanbul ignore next */
534
+ if (!dataValues) {
535
+ return callback(new Error("Internal Error"));
536
+ }
537
+ const results = composeResult(nodes, nodesToRead, dataValues);
538
+ callback(err, isArray ? results : results[0]);
539
+ });
540
+ }
541
+ /**
542
+ * @internal
543
+ * @param args
544
+ */
545
+ read(...args) {
546
+ if (args.length === 2) {
547
+ return this.read(args[0], 0, args[1]);
548
+ }
549
+ (0, node_opcua_assert_1.assert)(args.length === 3);
550
+ const isArray = Array.isArray(args[0]);
551
+ const nodesToRead = isArray ? args[0] : [args[0]];
552
+ (0, node_opcua_assert_1.assert)(Array.isArray(nodesToRead));
553
+ const maxAge = args[1];
554
+ const callback = args[2];
555
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
556
+ /* istanbul ignore next */
557
+ if (helpAPIChange) {
558
+ // the read method deprecation detection and warning
559
+ if (!((0, node_opcua_utils_1.getFunctionParameterNames)(callback)[1] === "dataValues" || (0, node_opcua_utils_1.getFunctionParameterNames)(callback)[1] === "dataValue")) {
560
+ warningLog(chalk.red("[NODE-OPCUA-E04] the ClientSession#read API has changed !!, please fix the client code"));
561
+ warningLog(chalk.red(" replace ..:"));
562
+ warningLog(chalk.cyan(" session.read(nodesToRead,function(err,nodesToRead,results) {}"));
563
+ warningLog(chalk.red(" with .... :"));
564
+ warningLog(chalk.cyan(" session.read(nodesToRead,function(err,dataValues) {}"));
565
+ warningLog("");
566
+ warningLog(chalk.yellow("please make sure to refactor your code and check that " +
567
+ "the second argument of your callback function is named"), chalk.cyan("dataValue" + (isArray ? "s" : "")));
568
+ warningLog(chalk.cyan("to make this exception disappear"));
569
+ throw new Error("ERROR ClientSession#read API has changed !!, please fix the client code");
570
+ }
571
+ }
572
+ // coerce nodeIds
573
+ for (const node of nodesToRead) {
574
+ node.nodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node.nodeId);
575
+ }
576
+ const request = new node_opcua_service_read_1.ReadRequest({
577
+ maxAge,
578
+ nodesToRead,
579
+ timestampsToReturn: node_opcua_service_read_1.TimestampsToReturn.Both
580
+ });
581
+ this.performMessageTransaction(request, (err, response) => {
582
+ /* istanbul ignore next */
583
+ if (err) {
584
+ return callback(err, response);
585
+ }
586
+ /* istanbul ignore next */
587
+ if (!response || !(response instanceof node_opcua_service_read_1.ReadResponse)) {
588
+ return callback(new Error("Internal Error"));
589
+ }
590
+ // perform ExtensionObject resolution
591
+ promoteOpaqueStructureWithCallback(this, response.results, () => {
592
+ response.results = response.results || /* istanbul ignore next */ [];
593
+ return callback(null, isArray ? response.results : response.results[0]);
594
+ });
595
+ });
596
+ }
597
+ emitCloseEvent(statusCode) {
598
+ if (!this._closeEventHasBeenEmitted) {
599
+ debugLog("ClientSession#emitCloseEvent");
600
+ this._closeEventHasBeenEmitted = true;
601
+ this.emit("session_closed", statusCode);
602
+ }
603
+ }
604
+ createSubscription(options, callback) {
605
+ this._defaultRequest(node_opcua_service_subscription_1.CreateSubscriptionRequest, node_opcua_service_subscription_1.CreateSubscriptionResponse, options, callback);
606
+ }
607
+ createSubscription2(...args) {
608
+ const createSubscriptionRequest = args[0];
609
+ let callback = args[1];
610
+ const subscription = new client_subscription_impl_1.ClientSubscriptionImpl(this, createSubscriptionRequest);
611
+ // tslint:disable-next-line:no-empty
612
+ subscription.on("error", (err) => {
613
+ if (callback) {
614
+ callback(err);
615
+ callback = null;
616
+ }
617
+ });
618
+ subscription.on("started", () => {
619
+ (0, node_opcua_assert_1.assert)(subscription.session === this, "expecting a session here");
620
+ if (callback) {
621
+ callback(null, subscription);
622
+ callback = null;
623
+ }
624
+ });
625
+ }
626
+ deleteSubscriptions(options, callback) {
627
+ this._defaultRequest(node_opcua_service_subscription_1.DeleteSubscriptionsRequest, node_opcua_service_subscription_1.DeleteSubscriptionsResponse, options, callback);
628
+ }
629
+ setTriggering(request, callback) {
630
+ this._defaultRequest(node_opcua_service_subscription_1.SetTriggeringRequest, node_opcua_service_subscription_1.SetTriggeringResponse, request, callback);
631
+ }
632
+ /**
633
+ * @method transferSubscriptions
634
+ * @async
635
+ */
636
+ transferSubscriptions(options, callback) {
637
+ this._defaultRequest(node_opcua_service_subscription_1.TransferSubscriptionsRequest, node_opcua_service_subscription_1.TransferSubscriptionsResponse, options, callback);
638
+ }
639
+ createMonitoredItems(options, callback) {
640
+ this._defaultRequest(node_opcua_service_subscription_1.CreateMonitoredItemsRequest, node_opcua_service_subscription_1.CreateMonitoredItemsResponse, options, callback);
641
+ }
642
+ modifyMonitoredItems(options, callback) {
643
+ this._defaultRequest(node_opcua_service_subscription_1.ModifyMonitoredItemsRequest, node_opcua_service_subscription_1.ModifyMonitoredItemsResponse, options, callback);
644
+ }
645
+ /**
646
+ *
647
+ * @method modifySubscription
648
+ * @async
649
+ * @param options {ModifySubscriptionRequest}
650
+ * @param callback {Function}
651
+ * @param callback.err {Error|null} - the Error if the async method has failed
652
+ * @param callback.response {ModifySubscriptionResponse} - the response
653
+ */
654
+ modifySubscription(options, callback) {
655
+ this._defaultRequest(node_opcua_service_subscription_1.ModifySubscriptionRequest, node_opcua_service_subscription_1.ModifySubscriptionResponse, options, callback);
656
+ }
657
+ setMonitoringMode(options, callback) {
658
+ this._defaultRequest(node_opcua_service_subscription_1.SetMonitoringModeRequest, node_opcua_service_subscription_1.SetMonitoringModeResponse, options, callback);
659
+ }
660
+ /**
661
+ *
662
+ * @method publish
663
+ * @async
664
+ * @param options {PublishRequest}
665
+ * @param callback {Function}
666
+ * @param callback.err {Error|null} - the Error if the async method has failed
667
+ * @param callback.response {PublishResponse} - the response
668
+ */
669
+ publish(options, callback) {
670
+ this._defaultRequest(node_opcua_service_subscription_1.PublishRequest, node_opcua_service_subscription_1.PublishResponse, options, callback);
671
+ }
672
+ /**
673
+ *
674
+ * @method republish
675
+ * @async
676
+ * @param options {RepublishRequest}
677
+ * @param callback the callback
678
+ */
679
+ republish(options, callback) {
680
+ this._defaultRequest(node_opcua_service_subscription_1.RepublishRequest, node_opcua_service_subscription_1.RepublishResponse, options, callback);
681
+ }
682
+ /**
683
+ *
684
+ * @method deleteMonitoredItems
685
+ * @async
686
+ * @param options {DeleteMonitoredItemsRequest}
687
+ * @param callback {Function}
688
+ * @param callback.err {Error|null} - the Error if the async method has failed
689
+ */
690
+ deleteMonitoredItems(options, callback) {
691
+ this._defaultRequest(node_opcua_service_subscription_1.DeleteMonitoredItemsRequest, node_opcua_service_subscription_1.DeleteMonitoredItemsResponse, options, callback);
692
+ }
693
+ /**
694
+ * @internal
695
+ */
696
+ setPublishingMode(...args) {
697
+ const publishingEnabled = args[0];
698
+ const isArray = Array.isArray(args[1]);
699
+ const subscriptionIds = isArray ? args[1] : [args[1]];
700
+ const callback = args[2];
701
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
702
+ (0, node_opcua_assert_1.assert)(publishingEnabled === true || publishingEnabled === false);
703
+ const options = new node_opcua_service_subscription_1.SetPublishingModeRequest({
704
+ publishingEnabled,
705
+ subscriptionIds
706
+ });
707
+ this._defaultRequest(node_opcua_service_subscription_1.SetPublishingModeRequest, node_opcua_service_subscription_1.SetPublishingModeResponse, options, (err, response) => {
708
+ /* istanbul ignore next */
709
+ if (err) {
710
+ return callback(err);
711
+ }
712
+ /* istanbul ignore next */
713
+ if (!response) {
714
+ return callback(new Error("Internal Error"));
715
+ }
716
+ response.results = response.results || /* istanbul ignore next */ [];
717
+ callback(err, isArray ? response.results : response.results[0]);
718
+ });
719
+ }
720
+ /**
721
+ * @internal
722
+ * @param args
723
+ */
724
+ translateBrowsePath(...args) {
725
+ const isArray = Array.isArray(args[0]);
726
+ const browsePaths = isArray ? args[0] : [args[0]];
727
+ const callback = args[1];
728
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
729
+ const request = new node_opcua_service_translate_browse_path_1.TranslateBrowsePathsToNodeIdsRequest({ browsePaths });
730
+ this.performMessageTransaction(request, (err, response) => {
731
+ /* istanbul ignore next */
732
+ if (err) {
733
+ return callback(err, response);
734
+ }
735
+ /* istanbul ignore next */
736
+ if (!response || !(response instanceof node_opcua_service_translate_browse_path_1.TranslateBrowsePathsToNodeIdsResponse)) {
737
+ return callback(new Error("Internal Error"));
738
+ }
739
+ response.results = response.results || /* istanbul ignore next */ [];
740
+ callback(null, isArray ? response.results : response.results[0]);
741
+ });
742
+ }
743
+ channelId() {
744
+ return this._client !== null && this._client._secureChannel !== null && this._client._secureChannel.isOpened()
745
+ ? this._client._secureChannel.channelId
746
+ : -1;
747
+ }
748
+ isChannelValid() {
749
+ /* istanbul ignore next */
750
+ if (!this._client) {
751
+ debugLog(chalk.red("Warning SessionClient is null ?"));
752
+ }
753
+ return this._client !== null && this._client._secureChannel !== null && this._client._secureChannel.isOpened();
754
+ }
755
+ performMessageTransaction(request, callback) {
756
+ if (!this._client) {
757
+ // session may have been closed by user ... but is still in used !!
758
+ return callback(new Error("Session has been closed and should not be used to perform a transaction anymore"));
759
+ }
760
+ if (!this.isChannelValid()) {
761
+ // the secure channel is broken, may be the server has crashed or the network cable has been disconnected
762
+ // for a long time
763
+ // we may need to queue this transaction, as a secure token may be being reprocessed
764
+ debugLog(chalk.bgWhite.red("!!! Performing transaction on invalid channel !!! ", request.constructor.name));
765
+ return callback(new Error("Invalid Channel after performing transaction on " + request.constructor.name));
766
+ }
767
+ this._reconnecting.pendingTransactions = this._reconnecting.pendingTransactions || [];
768
+ this._reconnecting.pendingTransactionsCount = this._reconnecting.pendingTransactionsCount || 0;
769
+ const isPublishRequest = request instanceof node_opcua_service_subscription_1.PublishRequest;
770
+ if (isPublishRequest) {
771
+ return this._performMessageTransaction(request, callback);
772
+ }
773
+ if (this._reconnecting.pendingTransactionsCount > 0) {
774
+ /* istanbul ignore next */
775
+ if (this._reconnecting.pendingTransactions.length > 10) {
776
+ if (!pendingTransactionMessageDisplayed) {
777
+ pendingTransactionMessageDisplayed = true;
778
+ warningLog("[NODE-OPCUA-W21]", "Pending transactions: ", this._reconnecting.pendingTransactions.map((a) => a.request.constructor.name).join(" "));
779
+ warningLog("[NODE-OPCUA-W22]", chalk.yellow("Warning : your opcua client is sending multiple requests simultaneously to the server", request.constructor.name), "\n", chalk.yellow(" please fix your application code"));
780
+ }
781
+ }
782
+ else if (this._reconnecting.pendingTransactions.length > 3) {
783
+ debugLog(chalk.yellow("Warning : your client is sending multiple requests simultaneously to the server", request.constructor.name));
784
+ }
785
+ this._reconnecting.pendingTransactions.push({ request, callback });
786
+ return;
787
+ }
788
+ this.processTransactionQueue(request, callback);
789
+ }
790
+ _performMessageTransaction(request, callback) {
791
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
792
+ /* istanbul ignore next */
793
+ if (!this._client) {
794
+ // session may have been closed by user ... but is still in used !!
795
+ return callback(new Error("Session has been closed and should not be used to perform a transaction anymore"));
796
+ }
797
+ if (!this.isChannelValid()) {
798
+ // the secure channel is broken, may be the server has crashed or the network cable has been disconnected
799
+ // for a long time
800
+ // we may need to queue this transaction, as a secure token may be being reprocessed
801
+ debugLog(chalk.bgWhite.red("!!! Performing transaction on invalid channel !!! ", request.constructor.name));
802
+ return callback(new Error("Invalid Channel BadConnectionClosed"));
803
+ }
804
+ // is this stuff useful?
805
+ if (request.requestHeader) {
806
+ request.requestHeader.authenticationToken = this.authenticationToken;
807
+ }
808
+ this.lastRequestSentTime = new Date();
809
+ this._client.performMessageTransaction(request, (err, response) => {
810
+ this.lastResponseReceivedTime = new Date();
811
+ /* istanbul ignore next */
812
+ if (err) {
813
+ if (response && response.responseHeader.serviceDiagnostics) {
814
+ err.serviceDiagnostics = response.responseHeader.serviceDiagnostics;
815
+ }
816
+ if (response && response.diagnosticInfos) {
817
+ err.diagnosticsInfo = response.diagnosticInfos;
818
+ }
819
+ return callback(err);
820
+ }
821
+ /* istanbul ignore next */
822
+ if (!response) {
823
+ return callback(new Error("internal Error"));
824
+ }
825
+ /* istanbul ignore next */
826
+ if (response.responseHeader.serviceResult.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
827
+ err = new Error(" ServiceResult is " +
828
+ response.responseHeader.serviceResult.toString() +
829
+ " request was " +
830
+ request.constructor.name);
831
+ if (response && response.responseHeader.serviceDiagnostics) {
832
+ err.serviceDiagnostics = response.responseHeader.serviceDiagnostics;
833
+ }
834
+ if (response && response.diagnosticInfos) {
835
+ err.diagnosticsInfo = response.diagnosticInfos;
836
+ }
837
+ return callback(err, response);
838
+ }
839
+ return callback(null, response);
840
+ });
841
+ }
842
+ /**
843
+ * evaluate the remaining time for the session
844
+ *
845
+ *
846
+ * evaluate the time in milliseconds that the session will live
847
+ * on the server end from now.
848
+ * The remaining live time is calculated based on when the last message was sent to the server
849
+ * and the session timeout.
850
+ *
851
+ * * In normal operation , when server and client communicates on a regular
852
+ * basis, evaluateRemainingLifetime will return a number slightly below
853
+ * session.timeout
854
+ *
855
+ * * when the client and server cannot communicate due to a network issue
856
+ * (or a server crash), evaluateRemainingLifetime returns the estimated number
857
+ * of milliseconds before the server (if not crash) will keep the session alive
858
+ * on its end to allow a automatic reconnection with session.
859
+ *
860
+ * * When evaluateRemainingLifetime returns zero , this mean that
861
+ * the session has probably ended on the server side and will have to be recreated
862
+ * from scratch in case of a reconnection.
863
+ *
864
+ * @return the number of milliseconds before session expires
865
+ */
866
+ evaluateRemainingLifetime() {
867
+ const now = Date.now();
868
+ const expiryTime = this.lastRequestSentTime.getTime() + this.timeout;
869
+ return Math.max(0, expiryTime - now);
870
+ }
871
+ _terminatePublishEngine() {
872
+ if (this._publishEngine) {
873
+ this._publishEngine.terminate();
874
+ this._publishEngine = null;
875
+ }
876
+ }
877
+ /**
878
+ * @internal
879
+ * @param args
880
+ */
881
+ close(...args) {
882
+ if (arguments.length === 1) {
883
+ return this.close(true, args[0]);
884
+ }
885
+ const deleteSubscription = args[0];
886
+ const callback = args[1];
887
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
888
+ (0, node_opcua_assert_1.assert)(typeof deleteSubscription === "boolean");
889
+ /* istanbul ignore next */
890
+ if (!this._client) {
891
+ debugLog("ClientSession#close : warning, client is already closed");
892
+ return callback(); // already close ?
893
+ }
894
+ (0, node_opcua_assert_1.assert)(this._client);
895
+ this._terminatePublishEngine();
896
+ this._client.closeSession(this, deleteSubscription, (err) => {
897
+ debugLog("session Close err ", err ? err.message : "null");
898
+ callback();
899
+ });
900
+ }
901
+ /**
902
+ * @method hasBeenClosed
903
+ * @return {Boolean}
904
+ */
905
+ hasBeenClosed() {
906
+ return (0, node_opcua_utils_1.isNullOrUndefined)(this._client) || this._closed || this._closeEventHasBeenEmitted;
907
+ }
908
+ /**
909
+ * @internal
910
+ * @param args
911
+ */
912
+ call(...args) {
913
+ const isArray = Array.isArray(args[0]);
914
+ const methodsToCall = isArray ? args[0] : [args[0]];
915
+ (0, node_opcua_assert_1.assert)(Array.isArray(methodsToCall));
916
+ const callback = args[1];
917
+ // Note : The client has no explicit address space and therefore will struggle to
918
+ // access the method arguments signature.
919
+ // There are two methods that can be considered:
920
+ // - get the object definition by querying the server
921
+ // - load a fake address space to have some thing to query on our end
922
+ // const request = this._client.factory.constructObjectId("CallRequest",{ methodsToCall: methodsToCall});
923
+ const request = new node_opcua_service_call_1.CallRequest({ methodsToCall });
924
+ this.performMessageTransaction(request, (err, response) => {
925
+ /* istanbul ignore next */
926
+ if (err) {
927
+ return callback(err);
928
+ }
929
+ /* istanbul ignore next */
930
+ if (!response || !(response instanceof node_opcua_service_call_1.CallResponse)) {
931
+ return callback(new Error("internal error"));
932
+ }
933
+ response.results = response.results || [];
934
+ promoteOpaqueStructure3WithCallback(this, response.results, () => {
935
+ callback(null, isArray ? response.results : response.results[0]);
936
+ });
937
+ });
938
+ }
939
+ getMonitoredItems(...args) {
940
+ const subscriptionId = args[0];
941
+ const callback = args[1];
942
+ // <UAObject NodeId="i=2253" BrowseName="Server">
943
+ // <UAMethod NodeId="i=11492" BrowseName="GetMonitoredItems"
944
+ // ParentNodeId="i=2253" MethodDeclarationId="i=11489">
945
+ // <UAMethod NodeId="i=11489" BrowseName="GetMonitoredItems" ParentNodeId="i=2004">
946
+ const methodsToCall = new node_opcua_service_call_1.CallMethodRequest({
947
+ inputArguments: [
948
+ // BaseDataType
949
+ { dataType: node_opcua_variant_1.DataType.UInt32, value: subscriptionId }
950
+ ],
951
+ methodId: (0, node_opcua_nodeid_1.coerceNodeId)("ns=0;i=11492"),
952
+ objectId: (0, node_opcua_nodeid_1.coerceNodeId)("ns=0;i=2253") // ObjectId.Server
953
+ });
954
+ this.call(methodsToCall, (err, result) => {
955
+ /* istanbul ignore next */
956
+ if (err) {
957
+ return callback(err);
958
+ }
959
+ /* istanbul ignore next */
960
+ if (!result) {
961
+ return callback(new Error("internal error"));
962
+ }
963
+ /* istanbul ignore next */
964
+ if (result.statusCode.isNot(node_opcua_status_code_1.StatusCodes.Good)) {
965
+ callback(new Error(result.statusCode.toString()));
966
+ }
967
+ else {
968
+ result.outputArguments = result.outputArguments || [];
969
+ (0, node_opcua_assert_1.assert)(result.outputArguments.length === 2);
970
+ const data = {
971
+ clientHandles: result.outputArguments[1].value,
972
+ serverHandles: result.outputArguments[0].value //
973
+ };
974
+ // Note some server might return null array
975
+ // let make sure we have Uint32Array and not a null pointer
976
+ data.serverHandles = data.serverHandles || /* istanbul ignore next */ emptyUint32Array;
977
+ data.clientHandles = data.clientHandles || /* istanbul ignore next */ emptyUint32Array;
978
+ (0, node_opcua_assert_1.assert)(data.serverHandles instanceof Uint32Array);
979
+ (0, node_opcua_assert_1.assert)(data.clientHandles instanceof Uint32Array);
980
+ callback(null, data);
981
+ }
982
+ });
983
+ }
984
+ /**
985
+ * @internal
986
+ */
987
+ getArgumentDefinition(...args) {
988
+ const methodId = args[0];
989
+ const callback = args[1];
990
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
991
+ return (0, node_opcua_pseudo_session_1.getArgumentDefinitionHelper)(this, methodId, callback);
992
+ }
993
+ registerNodes(...args) {
994
+ const nodesToRegister = args[0];
995
+ const callback = args[1];
996
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
997
+ (0, node_opcua_assert_1.assert)(Array.isArray(nodesToRegister));
998
+ const request = new node_opcua_service_register_node_1.RegisterNodesRequest({
999
+ nodesToRegister: nodesToRegister.map(node_opcua_nodeid_1.resolveNodeId)
1000
+ });
1001
+ this.performMessageTransaction(request, (err, response) => {
1002
+ /* istanbul ignore next */
1003
+ if (err) {
1004
+ return callback(err);
1005
+ }
1006
+ /* istanbul ignore next */
1007
+ if (!response || !(response instanceof node_opcua_service_register_node_1.RegisterNodesResponse)) {
1008
+ return callback(new Error("Internal Error"));
1009
+ }
1010
+ response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */ [];
1011
+ callback(null, response.registeredNodeIds);
1012
+ });
1013
+ }
1014
+ unregisterNodes(...args) {
1015
+ const nodesToUnregister = args[0];
1016
+ const callback = args[1];
1017
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
1018
+ (0, node_opcua_assert_1.assert)(Array.isArray(nodesToUnregister));
1019
+ const request = new node_opcua_service_register_node_1.UnregisterNodesRequest({
1020
+ nodesToUnregister: nodesToUnregister.map(node_opcua_nodeid_1.resolveNodeId)
1021
+ });
1022
+ this.performMessageTransaction(request, (err, response) => {
1023
+ /* istanbul ignore next */
1024
+ if (err) {
1025
+ return callback(err);
1026
+ }
1027
+ /* istanbul ignore next */
1028
+ if (!response || !(response instanceof node_opcua_service_register_node_1.UnregisterNodesResponse)) {
1029
+ return callback(new Error("Internal Error"));
1030
+ }
1031
+ callback();
1032
+ });
1033
+ }
1034
+ queryFirst(...args) {
1035
+ const queryFirstRequest = args[0];
1036
+ const callback = args[1];
1037
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
1038
+ const request = new node_opcua_service_query_1.QueryFirstRequest(queryFirstRequest);
1039
+ this.performMessageTransaction(request, (err, response) => {
1040
+ /* istanbul ignore next */
1041
+ if (err) {
1042
+ return callback(err);
1043
+ }
1044
+ /* istanbul ignore next */
1045
+ if (!response || !(response instanceof node_opcua_service_query_1.QueryFirstResponse)) {
1046
+ return callback(new Error("internal error"));
1047
+ }
1048
+ callback(null, response);
1049
+ });
1050
+ }
1051
+ startKeepAliveManager() {
1052
+ if (this._keepAliveManager) {
1053
+ // "keepAliveManger already started"
1054
+ return;
1055
+ }
1056
+ this._keepAliveManager = new client_session_keepalive_manager_1.ClientSessionKeepAliveManager(this);
1057
+ this._keepAliveManager.on("failure", () => {
1058
+ /**
1059
+ * raised when a keep-alive request has failed on the session, may be the session has timeout
1060
+ * unexpectedly on the server side, may be the connection is broken.
1061
+ * @event keepalive_failure
1062
+ */
1063
+ this.emit("keepalive_failure");
1064
+ });
1065
+ this._keepAliveManager.on("keepalive", (state, count) => {
1066
+ /**
1067
+ * @event keepalive
1068
+ */
1069
+ this.emit("keepalive", state, count);
1070
+ });
1071
+ this._keepAliveManager.start();
1072
+ }
1073
+ stopKeepAliveManager() {
1074
+ if (this._keepAliveManager) {
1075
+ this._keepAliveManager.stop();
1076
+ this._keepAliveManager = undefined;
1077
+ }
1078
+ }
1079
+ dispose() {
1080
+ (0, node_opcua_assert_1.assert)(this._closeEventHasBeenEmitted);
1081
+ this._terminatePublishEngine();
1082
+ this.stopKeepAliveManager();
1083
+ this.removeAllListeners();
1084
+ //
1085
+ const privateThis = this;
1086
+ if (!(!privateThis.pendingTransactions || privateThis.pendingTransactions.length === 0)) {
1087
+ // tslint:disable-next-line: no-console
1088
+ console.log("dispose when pendingTransactions is not empty ");
1089
+ }
1090
+ }
1091
+ toString() {
1092
+ const now = Date.now();
1093
+ const lap1 = now - this.lastRequestSentTime.getTime();
1094
+ const lap2 = now - this.lastResponseReceivedTime.getTime();
1095
+ const timeoutDelay = this.timeout - lap1;
1096
+ const timeoutInfo = timeoutDelay < 0
1097
+ ? chalk.red(" expired since " + -timeoutDelay / 1000 + " seconds")
1098
+ : chalk.green(" timeout in " + timeoutDelay / 1000 + " seconds");
1099
+ let str = "";
1100
+ str += " name..................... " + this.name;
1101
+ str += "\n sessionId................ " + this.sessionId.toString();
1102
+ str += "\n authenticationToken...... " + (this.authenticationToken ? this.authenticationToken.toString() : "");
1103
+ str += "\n timeout.................. " + this.timeout + "ms" + timeoutInfo;
1104
+ str += "\n serverNonce.............. " + (this.serverNonce ? this.serverNonce.toString("hex") : "");
1105
+ str += "\n serverCertificate........ " + (0, node_opcua_utils_1.buffer_ellipsis)(this.serverCertificate);
1106
+ // xx console.log(" serverSignature.......... ", this.serverSignature);
1107
+ str += "\n lastRequestSentTime...... " + new Date(this.lastRequestSentTime).toISOString() + " (" + lap1 + ")";
1108
+ str += "\n lastResponseReceivedTime. " + new Date(this.lastResponseReceivedTime).toISOString() + " (" + lap2 + ")";
1109
+ str += "\n isReconnecting........... " + this.isReconnecting;
1110
+ str += "\n isValidChannel........... " + this.isChannelValid() + " has been closed " + this.hasBeenClosed();
1111
+ str += "\n channelId................ " + this.channelId();
1112
+ str += "\n remaining life time...... " + this.evaluateRemainingLifetime();
1113
+ str += "\n subscription count....... " + this.subscriptionCount;
1114
+ if (this._client && this._client._secureChannel) {
1115
+ if (this._client._secureChannel.securityToken) {
1116
+ str += "\n reviseTokenLifetime...... " + this._client._secureChannel.securityToken.revisedLifetime;
1117
+ }
1118
+ }
1119
+ return str;
1120
+ }
1121
+ getBuiltInDataType(...args) {
1122
+ const nodeId = args[0];
1123
+ const callback = args[1];
1124
+ return (0, node_opcua_pseudo_session_1.getBuiltInDataType)(this, nodeId, callback);
1125
+ }
1126
+ resumePublishEngine() {
1127
+ (0, node_opcua_assert_1.assert)(this._publishEngine);
1128
+ if (this._publishEngine && this._publishEngine.subscriptionCount > 0) {
1129
+ this._publishEngine.replenish_publish_request_queue();
1130
+ }
1131
+ }
1132
+ readNamespaceArray(...args) {
1133
+ const callback = args[0];
1134
+ this.read({
1135
+ attributeId: node_opcua_service_read_1.AttributeIds.Value,
1136
+ nodeId: (0, node_opcua_nodeid_1.resolveNodeId)("Server_NamespaceArray")
1137
+ }, (err, dataValue) => {
1138
+ /* istanbul ignore next */
1139
+ if (err) {
1140
+ return callback(err);
1141
+ }
1142
+ /* istanbul ignore next */
1143
+ if (!dataValue) {
1144
+ return callback(new Error("Internal Error"));
1145
+ }
1146
+ /* istanbul ignore next */
1147
+ if (dataValue.statusCode.isNotGood()) {
1148
+ return callback(new Error("readNamespaceArray : " + dataValue.statusCode.toString()));
1149
+ }
1150
+ (0, node_opcua_assert_1.assert)(dataValue.value.value instanceof Array);
1151
+ this._namespaceArray = dataValue.value.value; // keep a cache
1152
+ callback(null, this._namespaceArray);
1153
+ });
1154
+ }
1155
+ getNamespaceIndex(namespaceUri) {
1156
+ (0, node_opcua_assert_1.assert)(this._namespaceArray, "please make sure that readNamespaceArray has been called");
1157
+ return this._namespaceArray.indexOf(namespaceUri);
1158
+ }
1159
+ // tslint:disable:no-empty
1160
+ // ---------------------------------------- Alarm & condition stub
1161
+ disableCondition() {
1162
+ /** empty */
1163
+ }
1164
+ enableCondition() {
1165
+ /** empty */
1166
+ }
1167
+ addCommentCondition(_conditionId, _eventId, _comment, _callback) {
1168
+ /** empty */
1169
+ }
1170
+ confirmCondition(_conditionId, _eventId, _comment, _callback) {
1171
+ /** empty */
1172
+ }
1173
+ acknowledgeCondition(_conditionId, _eventId, _comment, _callback) {
1174
+ /** empty */
1175
+ }
1176
+ findMethodId(_nodeId, _methodName, _callback) {
1177
+ /** empty */
1178
+ }
1179
+ _callMethodCondition(_methodName, _conditionId, _eventId, _comment, _callback) {
1180
+ /** empty */
1181
+ }
1182
+ extractNamespaceDataType() {
1183
+ return __awaiter(this, void 0, void 0, function* () {
1184
+ return (0, node_opcua_client_dynamic_extension_object_1.getExtraDataTypeManager)(this);
1185
+ });
1186
+ }
1187
+ getExtensionObjectConstructor(dataTypeNodeId) {
1188
+ return __awaiter(this, void 0, void 0, function* () {
1189
+ return (0, node_opcua_client_dynamic_extension_object_1.getExtensionObjectConstructor)(this, dataTypeNodeId);
1190
+ });
1191
+ }
1192
+ /**
1193
+ *
1194
+ * @param dataType
1195
+ * @param pojo
1196
+ * @async
1197
+ */
1198
+ constructExtensionObject(dataType, pojo) {
1199
+ return __awaiter(this, void 0, void 0, function* () {
1200
+ const Constructor = yield this.getExtensionObjectConstructor(dataType);
1201
+ return new Constructor(pojo);
1202
+ });
1203
+ }
1204
+ _defaultRequest(requestClass, _responseClass, options, callback) {
1205
+ (0, node_opcua_assert_1.assert)(typeof callback === "function");
1206
+ const request = options instanceof requestClass ? options : new requestClass(options);
1207
+ /* istanbul ignore next */
1208
+ if (doDebug) {
1209
+ request.trace = new Error("").stack;
1210
+ }
1211
+ /* istanbul ignore next */
1212
+ if (this._closeEventHasBeenEmitted) {
1213
+ debugLog("ClientSession#_defaultRequest => session has been closed !!", request.toString());
1214
+ setImmediate(() => {
1215
+ callback(new Error("ClientSession is closed !"));
1216
+ });
1217
+ return;
1218
+ }
1219
+ this.performMessageTransaction(request, (err, response) => {
1220
+ if (this._closeEventHasBeenEmitted) {
1221
+ debugLog("ClientSession#_defaultRequest ... err =", err ? err.message : "null", response ? response.toString() : " null");
1222
+ }
1223
+ /* istanbul ignore next */
1224
+ if (err) {
1225
+ debugLog("Client session : performMessageTransaction error = ", err.message);
1226
+ // let intercept interesting error message
1227
+ if (err.message.match(/BadSessionClosed/)) {
1228
+ // the session has been closed by Server
1229
+ // probably due to timeout issue
1230
+ // let's print some statistics
1231
+ const now = Date.now();
1232
+ /* istanbul ignore next */
1233
+ if (doDebug) {
1234
+ debugLog(chalk.bgWhite.red(" server send BadSessionClosed !"));
1235
+ debugLog(chalk.bgWhite.red(" request was "), request.toString());
1236
+ debugLog(" timeout.................. ", this.timeout);
1237
+ debugLog(" lastRequestSentTime...... ", new Date(this.lastRequestSentTime).toISOString(), now - this.lastRequestSentTime.getTime());
1238
+ debugLog(" lastResponseReceivedTime. ", new Date(this.lastResponseReceivedTime).toISOString(), now - this.lastResponseReceivedTime.getTime());
1239
+ }
1240
+ // DO NOT TERMINATE SESSION, as we will need a publishEngine when we
1241
+ // reconnect this._terminatePublishEngine();
1242
+ if (false) {
1243
+ // ER 10.2019
1244
+ /**
1245
+ * send when the session has been closed by the server ( probably due to inactivity and timeout)
1246
+ * @event session_closed
1247
+ */
1248
+ this.emitCloseEvent(node_opcua_status_code_1.StatusCodes.BadSessionClosed);
1249
+ }
1250
+ }
1251
+ return callback(err, response);
1252
+ }
1253
+ callback(null, response);
1254
+ });
1255
+ }
1256
+ recreate_session_and_reperform_transaction(request, callback) {
1257
+ if (this.recursive_repair_detector >= 1) {
1258
+ // tslint:disable-next-line: no-console
1259
+ console.log("recreate_session_and_reperform_transaction => Already in Progress");
1260
+ return callback(new Error("Cannot recreate session"));
1261
+ }
1262
+ this.recursive_repair_detector += 1;
1263
+ debugLog(chalk.red("----------------> Repairing Client Session as Server believes it is invalid now "));
1264
+ (0, reconnection_1.repair_client_session)(this._client, this, (err) => {
1265
+ this.recursive_repair_detector -= 1;
1266
+ if (err) {
1267
+ debugLog(chalk.red("----------------> session Repaired has failed with error", err.message));
1268
+ return callback(err);
1269
+ }
1270
+ debugLog(chalk.red("----------------> session Repaired, now redoing original transaction "));
1271
+ this._performMessageTransaction(request, callback);
1272
+ });
1273
+ }
1274
+ }
1275
+ exports.ClientSessionImpl = ClientSessionImpl;
1276
+ function promoteOpaqueStructure2(session, callMethodResult) {
1277
+ return __awaiter(this, void 0, void 0, function* () {
1278
+ if (!callMethodResult || !callMethodResult.outputArguments || callMethodResult.outputArguments.length === 0) {
1279
+ return;
1280
+ }
1281
+ yield (0, node_opcua_client_dynamic_extension_object_1.promoteOpaqueStructure)(session, callMethodResult.outputArguments.map((a) => ({ value: a })));
1282
+ });
1283
+ }
1284
+ function countOpaqueStructures(callMethodResults) {
1285
+ const x = (a) => {
1286
+ if (a === null)
1287
+ return [];
1288
+ return a.map((value) => { return { value: value }; });
1289
+ };
1290
+ const opaqueStructureCount = callMethodResults.reduce((prev, callMethodResult) => {
1291
+ return prev + (0, node_opcua_client_dynamic_extension_object_1.extractDataValueToPromote)(x(callMethodResult.outputArguments)).length;
1292
+ }, 0);
1293
+ return opaqueStructureCount;
1294
+ }
1295
+ function promoteOpaqueStructure3(session, callMethodResults) {
1296
+ return __awaiter(this, void 0, void 0, function* () {
1297
+ const opaqueStructureCount = countOpaqueStructures(callMethodResults);
1298
+ if (0 === opaqueStructureCount)
1299
+ return;
1300
+ // construct dataTypeManager if not already present
1301
+ yield (0, node_opcua_client_dynamic_extension_object_1.getExtraDataTypeManager)(session);
1302
+ const promises = callMethodResults.map((x) => __awaiter(this, void 0, void 0, function* () { return promoteOpaqueStructure2(session, x); }));
1303
+ yield Promise.all(promises);
1304
+ });
1305
+ }
1306
+ // tslint:disable:no-var-requires
1307
+ // tslint:disable:max-line-length
1308
+ const thenify = require("thenify");
1309
+ const callbackify = require("callbackify");
1310
+ const opts = { multiArgs: false };
1311
+ const promoteOpaqueStructureWithCallback = callbackify(node_opcua_client_dynamic_extension_object_1.promoteOpaqueStructure);
1312
+ const promoteOpaqueStructure3WithCallback = callbackify(promoteOpaqueStructure3);
1313
+ ClientSessionImpl.prototype.browse = thenify.withCallback(ClientSessionImpl.prototype.browse, opts);
1314
+ ClientSessionImpl.prototype.browseNext = thenify.withCallback(ClientSessionImpl.prototype.browseNext, opts);
1315
+ ClientSessionImpl.prototype.readVariableValue = thenify.withCallback(ClientSessionImpl.prototype.readVariableValue, opts);
1316
+ ClientSessionImpl.prototype.readHistoryValue = thenify.withCallback(ClientSessionImpl.prototype.readHistoryValue, opts);
1317
+ ClientSessionImpl.prototype.readAggregateValue = thenify.withCallback(ClientSessionImpl.prototype.readAggregateValue, opts);
1318
+ ClientSessionImpl.prototype.historyRead = thenify.withCallback(ClientSessionImpl.prototype.historyRead, opts);
1319
+ ClientSessionImpl.prototype.write = thenify.withCallback(ClientSessionImpl.prototype.write, opts);
1320
+ ClientSessionImpl.prototype.writeSingleNode = thenify.withCallback(ClientSessionImpl.prototype.writeSingleNode, opts);
1321
+ ClientSessionImpl.prototype.readAllAttributes = thenify.withCallback(ClientSessionImpl.prototype.readAllAttributes, opts);
1322
+ ClientSessionImpl.prototype.read = thenify.withCallback(ClientSessionImpl.prototype.read, opts);
1323
+ ClientSessionImpl.prototype.createSubscription = thenify.withCallback(ClientSessionImpl.prototype.createSubscription, opts);
1324
+ ClientSessionImpl.prototype.createSubscription2 = thenify.withCallback(ClientSessionImpl.prototype.createSubscription2, opts);
1325
+ ClientSessionImpl.prototype.deleteSubscriptions = thenify.withCallback(ClientSessionImpl.prototype.deleteSubscriptions, opts);
1326
+ ClientSessionImpl.prototype.transferSubscriptions = thenify.withCallback(ClientSessionImpl.prototype.transferSubscriptions, opts);
1327
+ ClientSessionImpl.prototype.createMonitoredItems = thenify.withCallback(ClientSessionImpl.prototype.createMonitoredItems, opts);
1328
+ ClientSessionImpl.prototype.modifyMonitoredItems = thenify.withCallback(ClientSessionImpl.prototype.modifyMonitoredItems, opts);
1329
+ ClientSessionImpl.prototype.modifySubscription = thenify.withCallback(ClientSessionImpl.prototype.modifySubscription, opts);
1330
+ ClientSessionImpl.prototype.setTriggering = thenify.withCallback(ClientSessionImpl.prototype.setTriggering, opts);
1331
+ ClientSessionImpl.prototype.setMonitoringMode = thenify.withCallback(ClientSessionImpl.prototype.setMonitoringMode, opts);
1332
+ ClientSessionImpl.prototype.publish = thenify.withCallback(ClientSessionImpl.prototype.publish, opts);
1333
+ ClientSessionImpl.prototype.republish = thenify.withCallback(ClientSessionImpl.prototype.republish, opts);
1334
+ ClientSessionImpl.prototype.deleteMonitoredItems = thenify.withCallback(ClientSessionImpl.prototype.deleteMonitoredItems, opts);
1335
+ ClientSessionImpl.prototype.setPublishingMode = thenify.withCallback(ClientSessionImpl.prototype.setPublishingMode, opts);
1336
+ ClientSessionImpl.prototype.translateBrowsePath = thenify.withCallback(ClientSessionImpl.prototype.translateBrowsePath, opts);
1337
+ ClientSessionImpl.prototype.performMessageTransaction = thenify.withCallback(ClientSessionImpl.prototype.performMessageTransaction, opts);
1338
+ ClientSessionImpl.prototype.close = thenify.withCallback(ClientSessionImpl.prototype.close, opts);
1339
+ ClientSessionImpl.prototype.call = thenify.withCallback(ClientSessionImpl.prototype.call, opts);
1340
+ ClientSessionImpl.prototype.getMonitoredItems = thenify.withCallback(ClientSessionImpl.prototype.getMonitoredItems, opts);
1341
+ ClientSessionImpl.prototype.getArgumentDefinition = thenify.withCallback(ClientSessionImpl.prototype.getArgumentDefinition, opts);
1342
+ ClientSessionImpl.prototype.queryFirst = thenify.withCallback(ClientSessionImpl.prototype.queryFirst, opts);
1343
+ ClientSessionImpl.prototype.registerNodes = thenify.withCallback(ClientSessionImpl.prototype.registerNodes, opts);
1344
+ ClientSessionImpl.prototype.unregisterNodes = thenify.withCallback(ClientSessionImpl.prototype.unregisterNodes, opts);
1345
+ ClientSessionImpl.prototype.readNamespaceArray = thenify.withCallback(ClientSessionImpl.prototype.readNamespaceArray, opts);
1346
+ ClientSessionImpl.prototype.getBuiltInDataType = thenify.withCallback(ClientSessionImpl.prototype.getBuiltInDataType, opts);
1347
+ ClientSessionImpl.prototype.constructExtensionObject = callbackify(ClientSessionImpl.prototype.constructExtensionObject);
1348
+ ClientSessionImpl.prototype.changeUser = thenify.withCallback(ClientSessionImpl.prototype.changeUser, opts);
1349
+ //# sourceMappingURL=client_session_impl.js.map