node-opcua-client 2.132.0 → 2.134.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/client_base.d.ts +6 -20
- package/dist/client_base.js.map +1 -1
- package/dist/client_session.d.ts +11 -76
- package/dist/client_session.js.map +1 -1
- package/dist/client_session_keepalive_manager.d.ts +1 -3
- package/dist/client_session_keepalive_manager.js +1 -3
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.d.ts +0 -9
- package/dist/client_subscription.js.map +1 -1
- package/dist/client_utils.d.ts +1 -4
- package/dist/client_utils.js +1 -4
- package/dist/client_utils.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/dist/private/client_base_impl.d.ts +4 -5
- package/dist/private/client_base_impl.js +11 -11
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_base_impl.d.ts +1 -0
- package/dist/private/client_monitored_item_base_impl.js +1 -0
- package/dist/private/client_monitored_item_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_group_impl.d.ts +2 -4
- package/dist/private/client_monitored_item_group_impl.js +1 -1
- package/dist/private/client_monitored_item_group_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.d.ts +5 -6
- package/dist/private/client_monitored_item_impl.js +4 -4
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.d.ts +12 -6
- package/dist/private/client_publish_engine.js +12 -6
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.d.ts +12 -77
- package/dist/private/client_session_impl.js +7 -32
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.d.ts +1 -1
- package/dist/private/client_subscription_impl.js +1 -1
- package/dist/private/opcua_client_impl.d.ts +2 -8
- package/dist/private/opcua_client_impl.js +8 -14
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.d.ts +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +1 -1
- package/dist/tools/findservers.d.ts +0 -4
- package/dist/tools/findservers.js.map +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +4 -4
- package/dist/verify.js.map +1 -1
- package/package.json +43 -43
- package/source/client_base.ts +8 -20
- package/source/client_session.ts +20 -90
- package/source/client_session_keepalive_manager.ts +1 -3
- package/source/client_subscription.ts +0 -9
- package/source/client_utils.ts +1 -4
- package/source/index.ts +1 -1
- package/source/private/client_base_impl.ts +4 -5
- package/source/private/client_monitored_item_group_impl.ts +2 -4
- package/source/private/client_monitored_item_impl.ts +5 -6
- package/source/private/client_publish_engine.ts +12 -6
- package/source/private/client_session_impl.ts +49 -102
- package/source/private/client_subscription_impl.ts +1 -1
- package/source/private/opcua_client_impl.ts +6 -17
- package/source/private/reconnection/client_subscription_reconnection.ts +1 -1
- package/source/tools/findservers.ts +0 -4
- package/source/verify.ts +1 -1
- package/dist/alarms_and_conditions/client_alarm.d.ts +0 -49
- package/dist/alarms_and_conditions/client_alarm.js +0 -97
- package/dist/alarms_and_conditions/client_alarm.js.map +0 -1
- package/dist/alarms_and_conditions/client_alarm_list.d.ts +0 -25
- package/dist/alarms_and_conditions/client_alarm_list.js +0 -98
- package/dist/alarms_and_conditions/client_alarm_list.js.map +0 -1
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +0 -18
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +0 -175
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +0 -1
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +0 -9
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +0 -60
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +0 -1
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +0 -3
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +0 -15
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js.map +0 -1
- package/dist/reconnection.d.ts +0 -9
- package/dist/reconnection.js +0 -453
- package/dist/reconnection.js.map +0 -1
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
promoteOpaqueStructure,
|
|
16
16
|
PseudoDataValue
|
|
17
17
|
} from "node-opcua-client-dynamic-extension-object";
|
|
18
|
-
import { Certificate, Nonce } from "node-opcua-crypto";
|
|
18
|
+
import { Certificate, Nonce } from "node-opcua-crypto/web";
|
|
19
19
|
import { BrowseDirection, LocalizedTextLike } from "node-opcua-data-model";
|
|
20
20
|
import { DataValue } from "node-opcua-data-value";
|
|
21
21
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
@@ -190,9 +190,6 @@ export interface Reconnectable {
|
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
192
|
* @class ClientSession
|
|
193
|
-
* @param client {OPCUAClientImpl}
|
|
194
|
-
* @constructor
|
|
195
|
-
* @private
|
|
196
193
|
*/
|
|
197
194
|
export class ClientSessionImpl extends EventEmitter implements ClientSession, Reconnectable {
|
|
198
195
|
static reconnectingElement: WeakMap<ClientSessionImpl, Reconnectable> = new WeakMap();
|
|
@@ -305,8 +302,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
305
302
|
});
|
|
306
303
|
}
|
|
307
304
|
/**
|
|
308
|
-
* @method browse
|
|
309
|
-
* @async
|
|
310
305
|
*
|
|
311
306
|
* @example
|
|
312
307
|
*
|
|
@@ -410,8 +405,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
410
405
|
if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
|
|
411
406
|
warningLog(
|
|
412
407
|
chalk.yellow("warning") +
|
|
413
|
-
|
|
414
|
-
|
|
408
|
+
" BrowseResponse : the server didn't take into" +
|
|
409
|
+
" account our requestedMaxReferencesPerNode "
|
|
415
410
|
);
|
|
416
411
|
warningLog(" this.requestedMaxReferencesPerNode= " + this.requestedMaxReferencesPerNode);
|
|
417
412
|
warningLog(" got " + r.references.length + "for " + nodesToBrowse[i].nodeId.toString());
|
|
@@ -420,7 +415,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
420
415
|
}
|
|
421
416
|
}
|
|
422
417
|
for (const r of results) {
|
|
423
|
-
r.references = r.references || /* istanbul ignore next */[];
|
|
418
|
+
r.references = r.references || /* istanbul ignore next */ [];
|
|
424
419
|
}
|
|
425
420
|
assert(results[0] instanceof BrowseResult);
|
|
426
421
|
return callback(null, isArray ? results : results[0]);
|
|
@@ -476,8 +471,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
476
471
|
}
|
|
477
472
|
|
|
478
473
|
/**
|
|
479
|
-
* @method readVariableValue
|
|
480
|
-
* @async
|
|
481
474
|
*
|
|
482
475
|
* @example
|
|
483
476
|
*
|
|
@@ -560,8 +553,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
560
553
|
}
|
|
561
554
|
|
|
562
555
|
/**
|
|
563
|
-
* @method readHistoryValue
|
|
564
|
-
* @async
|
|
565
556
|
*
|
|
566
557
|
* @example
|
|
567
558
|
*
|
|
@@ -719,7 +710,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
719
710
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
720
711
|
}
|
|
721
712
|
|
|
722
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
713
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
723
714
|
callback(null, response);
|
|
724
715
|
});
|
|
725
716
|
}
|
|
@@ -851,7 +842,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
851
842
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
852
843
|
}
|
|
853
844
|
|
|
854
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
845
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
855
846
|
|
|
856
847
|
assert(nodesToRead.length === response.results.length);
|
|
857
848
|
|
|
@@ -861,12 +852,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
861
852
|
|
|
862
853
|
/**
|
|
863
854
|
*
|
|
864
|
-
|
|
855
|
+
|
|
865
856
|
* @param nodesToWrite {WriteValue[]} - the array of value to write. One or more elements.
|
|
866
857
|
* @param {Function} callback - the callback function
|
|
867
858
|
* @param callback.err {object|null} the error if write has failed or null if OK
|
|
868
859
|
* @param callback.statusCodes {StatusCode[]} - an array of status code of each write
|
|
869
|
-
* @async
|
|
870
860
|
*
|
|
871
861
|
* @example
|
|
872
862
|
*
|
|
@@ -899,12 +889,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
899
889
|
* //
|
|
900
890
|
* });
|
|
901
891
|
*
|
|
902
|
-
|
|
892
|
+
|
|
903
893
|
* @param nodeToWrite {WriteValue} - the value to write
|
|
904
894
|
* @param callback - the callback function
|
|
905
895
|
* @param callback.err {object|null} the error if write has failed or null if OK
|
|
906
896
|
* @param callback.statusCode {StatusCodes} - the status code of the write
|
|
907
|
-
* @async
|
|
908
897
|
*
|
|
909
898
|
* @example
|
|
910
899
|
*
|
|
@@ -925,10 +914,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
925
914
|
* });
|
|
926
915
|
*
|
|
927
916
|
*
|
|
928
|
-
|
|
917
|
+
|
|
929
918
|
* @param nodeToWrite {WriteValue} - the value to write
|
|
930
919
|
* @return {Promise<StatusCode>}
|
|
931
|
-
* @async
|
|
932
920
|
*
|
|
933
921
|
* @example
|
|
934
922
|
*
|
|
@@ -942,10 +930,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
942
930
|
* const statusCode = await session.write(nodeToWrite);
|
|
943
931
|
* ```
|
|
944
932
|
*
|
|
945
|
-
|
|
933
|
+
|
|
946
934
|
* @param nodesToWrite {Array<WriteValue>} - the value to write
|
|
947
935
|
* @return {Promise<Array<StatusCode>>}
|
|
948
|
-
* @async
|
|
949
936
|
*
|
|
950
937
|
* @example
|
|
951
938
|
* ```javascript
|
|
@@ -994,29 +981,25 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
994
981
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
995
982
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
996
983
|
}
|
|
997
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
984
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
998
985
|
assert(nodesToWrite.length === response.results.length);
|
|
999
986
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1000
987
|
});
|
|
1001
988
|
}
|
|
1002
989
|
|
|
1003
990
|
/**
|
|
991
|
+
* @deprecated use session.write instead
|
|
1004
992
|
*
|
|
1005
|
-
* @method writeSingleNode
|
|
1006
|
-
* @async
|
|
1007
993
|
* @param nodeId {NodeId} - the node id of the node to write
|
|
1008
994
|
* @param value {Variant} - the value to write
|
|
1009
995
|
* @param callback {Function}
|
|
1010
996
|
* @param callback.err {object|null} the error if write has failed or null if OK
|
|
1011
997
|
* @param callback.statusCode {StatusCode} - the status code of the write
|
|
1012
998
|
*
|
|
1013
|
-
* @method writeSingleNode
|
|
1014
|
-
* @async
|
|
1015
999
|
* @param nodeId {NodeId} - the node id of the node to write
|
|
1016
1000
|
* @param value {Variant} - the value to write
|
|
1017
1001
|
* @return {Promise<StatusCode>} - the status code of the write
|
|
1018
1002
|
*
|
|
1019
|
-
* @deprecated use session.write instead
|
|
1020
1003
|
*
|
|
1021
1004
|
* @example
|
|
1022
1005
|
* // please use session.write instead of session.writeSingleNode
|
|
@@ -1065,7 +1048,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1065
1048
|
}
|
|
1066
1049
|
|
|
1067
1050
|
/**
|
|
1068
|
-
|
|
1051
|
+
|
|
1069
1052
|
*
|
|
1070
1053
|
* @example
|
|
1071
1054
|
*
|
|
@@ -1081,7 +1064,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1081
1064
|
* });
|
|
1082
1065
|
* ```
|
|
1083
1066
|
*
|
|
1084
|
-
* @async
|
|
1085
1067
|
* @param nodes array of nodeId to read
|
|
1086
1068
|
* @param node nodeId to read
|
|
1087
1069
|
* @param callback
|
|
@@ -1099,9 +1081,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1099
1081
|
}
|
|
1100
1082
|
|
|
1101
1083
|
/**
|
|
1102
|
-
* @method read (form1)
|
|
1103
1084
|
*
|
|
1104
|
-
* @async
|
|
1105
1085
|
*
|
|
1106
1086
|
* @example
|
|
1107
1087
|
*
|
|
@@ -1124,13 +1104,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1124
1104
|
* ```
|
|
1125
1105
|
*
|
|
1126
1106
|
*
|
|
1127
|
-
|
|
1107
|
+
|
|
1128
1108
|
* @param nodesToRead {Array<ReadValueId>} - an array of nodeId to read or a ReadValueId
|
|
1129
1109
|
* @param [maxAge] {Number}
|
|
1130
1110
|
* @param callback {Function} - the callback function
|
|
1131
1111
|
* @param callback.err {Error|null} - the error or null if the transaction was OK}
|
|
1132
1112
|
* @param callback.dataValues {Array<DataValue>}
|
|
1133
|
-
* @async
|
|
1134
1113
|
*
|
|
1135
1114
|
* @example
|
|
1136
1115
|
*
|
|
@@ -1197,7 +1176,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1197
1176
|
warningLog(
|
|
1198
1177
|
chalk.yellow(
|
|
1199
1178
|
"please make sure to refactor your code and check that " +
|
|
1200
|
-
|
|
1179
|
+
"the second argument of your callback function is named"
|
|
1201
1180
|
),
|
|
1202
1181
|
chalk.cyan("dataValue" + (isArray ? "s" : ""))
|
|
1203
1182
|
);
|
|
@@ -1230,7 +1209,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1230
1209
|
|
|
1231
1210
|
// perform ExtensionObject resolution
|
|
1232
1211
|
promoteOpaqueStructureWithCallback(this, response.results!, () => {
|
|
1233
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1212
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1234
1213
|
return callback(null, isArray ? response.results : response.results[0]);
|
|
1235
1214
|
});
|
|
1236
1215
|
});
|
|
@@ -1252,7 +1231,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1252
1231
|
}
|
|
1253
1232
|
|
|
1254
1233
|
/**
|
|
1255
|
-
|
|
1234
|
+
|
|
1256
1235
|
* @param createSubscriptionRequest
|
|
1257
1236
|
* @param callback
|
|
1258
1237
|
*
|
|
@@ -1301,8 +1280,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1301
1280
|
}
|
|
1302
1281
|
|
|
1303
1282
|
/**
|
|
1304
|
-
* @method transferSubscriptions
|
|
1305
|
-
* @async
|
|
1306
1283
|
*/
|
|
1307
1284
|
public transferSubscriptions(
|
|
1308
1285
|
options: TransferSubscriptionsRequestLike,
|
|
@@ -1327,12 +1304,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1327
1304
|
|
|
1328
1305
|
/**
|
|
1329
1306
|
*
|
|
1330
|
-
* @method modifySubscription
|
|
1331
|
-
* @async
|
|
1332
|
-
* @param options {ModifySubscriptionRequest}
|
|
1333
|
-
* @param callback {Function}
|
|
1334
|
-
* @param callback.err {Error|null} - the Error if the async method has failed
|
|
1335
|
-
* @param callback.response {ModifySubscriptionResponse} - the response
|
|
1336
1307
|
*/
|
|
1337
1308
|
public modifySubscription(
|
|
1338
1309
|
options: ModifySubscriptionRequestLike,
|
|
@@ -1346,13 +1317,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1346
1317
|
}
|
|
1347
1318
|
|
|
1348
1319
|
/**
|
|
1349
|
-
*
|
|
1350
|
-
* @method publish
|
|
1351
|
-
* @async
|
|
1352
|
-
* @param options {PublishRequest}
|
|
1353
|
-
* @param callback {Function}
|
|
1354
|
-
* @param callback.err {Error|null} - the Error if the async method has failed
|
|
1355
|
-
* @param callback.response {PublishResponse} - the response
|
|
1356
1320
|
*/
|
|
1357
1321
|
public publish(options: PublishRequest, callback: (err: Error | null, response?: PublishResponse) => void): void {
|
|
1358
1322
|
this._defaultRequest(PublishRequest, PublishResponse, options, callback);
|
|
@@ -1360,10 +1324,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1360
1324
|
|
|
1361
1325
|
/**
|
|
1362
1326
|
*
|
|
1363
|
-
* @method republish
|
|
1364
|
-
* @async
|
|
1365
|
-
* @param options {RepublishRequest}
|
|
1366
|
-
* @param callback the callback
|
|
1367
1327
|
*/
|
|
1368
1328
|
public republish(options: RepublishRequest, callback: (err: Error | null, response?: RepublishResponse) => void): void {
|
|
1369
1329
|
this._defaultRequest(RepublishRequest, RepublishResponse, options, callback);
|
|
@@ -1371,11 +1331,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1371
1331
|
|
|
1372
1332
|
/**
|
|
1373
1333
|
*
|
|
1374
|
-
* @method deleteMonitoredItems
|
|
1375
|
-
* @async
|
|
1376
|
-
* @param options {DeleteMonitoredItemsRequest}
|
|
1377
|
-
* @param callback {Function}
|
|
1378
|
-
* @param callback.err {Error|null} - the Error if the async method has failed
|
|
1379
1334
|
*/
|
|
1380
1335
|
public deleteMonitoredItems(
|
|
1381
1336
|
options: DeleteMonitoredItemsRequestLike,
|
|
@@ -1386,8 +1341,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1386
1341
|
|
|
1387
1342
|
/**
|
|
1388
1343
|
*
|
|
1389
|
-
* @method setPublishingMode
|
|
1390
|
-
* @async
|
|
1391
1344
|
*/
|
|
1392
1345
|
public setPublishingMode(publishingEnabled: boolean, subscriptionId: SubscriptionId): Promise<StatusCode>;
|
|
1393
1346
|
public setPublishingMode(publishingEnabled: boolean, subscriptionIds: SubscriptionId[]): Promise<StatusCode[]>;
|
|
@@ -1431,22 +1384,13 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1431
1384
|
if (!response) {
|
|
1432
1385
|
return callback(new Error("Internal Error"));
|
|
1433
1386
|
}
|
|
1434
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1387
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1435
1388
|
callback(err, isArray ? response.results : response.results[0]);
|
|
1436
1389
|
}
|
|
1437
1390
|
);
|
|
1438
1391
|
}
|
|
1439
1392
|
|
|
1440
1393
|
/**
|
|
1441
|
-
*
|
|
1442
|
-
* @method translateBrowsePath
|
|
1443
|
-
* @async
|
|
1444
|
-
* @param browsePath {BrowsePath|Array<BrowsePath>}
|
|
1445
|
-
* @param callback {Function}
|
|
1446
|
-
* @param callback.err {Error|null}
|
|
1447
|
-
* @param callback.response {BrowsePathResult|Array<BrowsePathResult>}
|
|
1448
|
-
*
|
|
1449
|
-
*
|
|
1450
1394
|
*
|
|
1451
1395
|
*/
|
|
1452
1396
|
public translateBrowsePath(browsePath: BrowsePath, callback: ResponseCallback<BrowsePathResult>): void;
|
|
@@ -1476,7 +1420,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1476
1420
|
if (!response || !(response instanceof TranslateBrowsePathsToNodeIdsResponse)) {
|
|
1477
1421
|
return callback(new Error("Internal Error"));
|
|
1478
1422
|
}
|
|
1479
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1423
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1480
1424
|
|
|
1481
1425
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1482
1426
|
});
|
|
@@ -1501,7 +1445,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1501
1445
|
// session may have been closed by user ... but is still in used !!
|
|
1502
1446
|
return callback(new Error("Session has been closed and should not be used to perform a transaction anymore"));
|
|
1503
1447
|
}
|
|
1504
|
-
if (
|
|
1448
|
+
if (
|
|
1449
|
+
request instanceof PublishRequest ||
|
|
1450
|
+
request instanceof ActivateSessionRequest ||
|
|
1451
|
+
request instanceof CloseSessionRequest
|
|
1452
|
+
) {
|
|
1505
1453
|
return this._performMessageTransaction(request, callback);
|
|
1506
1454
|
}
|
|
1507
1455
|
|
|
@@ -1538,17 +1486,29 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1538
1486
|
}
|
|
1539
1487
|
this.#reprocessRequest(0, request, callback);
|
|
1540
1488
|
}
|
|
1541
|
-
#reprocessRequest = (
|
|
1542
|
-
|
|
1543
|
-
|
|
1489
|
+
#reprocessRequest = (
|
|
1490
|
+
attemptCount: number,
|
|
1491
|
+
request: Request,
|
|
1492
|
+
callback: (err: Error | null, response?: Response) => void
|
|
1493
|
+
): void => {
|
|
1494
|
+
attemptCount > 0 &&
|
|
1495
|
+
warningLog("reprocessRequest => ", request.constructor.name, this._reconnecting.pendingTransactions.length);
|
|
1544
1496
|
this._performMessageTransaction(request, (err: null | Error, response?: Response) => {
|
|
1545
1497
|
if (err && err.message.match(/BadSessionIdInvalid/) && request.constructor.name !== "ActivateSessionRequest") {
|
|
1546
|
-
warningLog(
|
|
1498
|
+
warningLog(
|
|
1499
|
+
"Transaction on Invalid Session ",
|
|
1500
|
+
request.constructor.name,
|
|
1501
|
+
err.message,
|
|
1502
|
+
"isReconnecting?=",
|
|
1503
|
+
this.isReconnecting,
|
|
1504
|
+
"q=",
|
|
1505
|
+
this._reconnecting.pendingTransactions.length
|
|
1506
|
+
);
|
|
1547
1507
|
request.requestHeader.requestHandle = requestHandleNotSetValue;
|
|
1548
1508
|
if (this.isReconnecting) {
|
|
1549
1509
|
this.once("session_restored", () => {
|
|
1550
1510
|
warningLog("redoing", request.constructor.name, this.isReconnecting);
|
|
1551
|
-
this.#reprocessRequest(attemptCount+1,request, callback);
|
|
1511
|
+
this.#reprocessRequest(attemptCount + 1, request, callback);
|
|
1552
1512
|
});
|
|
1553
1513
|
} else {
|
|
1554
1514
|
this.#_recreate_session_and_reperform_transaction(request, callback);
|
|
@@ -1613,9 +1573,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1613
1573
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1614
1574
|
err = new Error(
|
|
1615
1575
|
" ServiceResult is " +
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1576
|
+
response.responseHeader.serviceResult.toString() +
|
|
1577
|
+
" request was " +
|
|
1578
|
+
request.constructor.name
|
|
1619
1579
|
);
|
|
1620
1580
|
|
|
1621
1581
|
if (response && response.responseHeader.serviceDiagnostics) {
|
|
@@ -1669,10 +1629,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1669
1629
|
|
|
1670
1630
|
/**
|
|
1671
1631
|
*
|
|
1672
|
-
* @method close
|
|
1673
|
-
* @async
|
|
1674
|
-
* @param [deleteSubscription=true] {Boolean}
|
|
1675
|
-
* @param callback {Function}
|
|
1676
1632
|
*/
|
|
1677
1633
|
public close(callback: ErrorCallback): void;
|
|
1678
1634
|
|
|
@@ -1710,7 +1666,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1710
1666
|
}
|
|
1711
1667
|
|
|
1712
1668
|
/**
|
|
1713
|
-
|
|
1669
|
+
|
|
1714
1670
|
* @return {Boolean}
|
|
1715
1671
|
*/
|
|
1716
1672
|
public hasBeenClosed(): boolean {
|
|
@@ -1759,7 +1715,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1759
1715
|
}
|
|
1760
1716
|
|
|
1761
1717
|
/**
|
|
1762
|
-
|
|
1718
|
+
|
|
1763
1719
|
* @param subscriptionId {UInt32} the subscription Id to return
|
|
1764
1720
|
* @param callback {Function}
|
|
1765
1721
|
* @param callback.err {Error}
|
|
@@ -1821,10 +1777,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1821
1777
|
}
|
|
1822
1778
|
|
|
1823
1779
|
/**
|
|
1824
|
-
* @method getArgumentDefinition
|
|
1825
|
-
* extract the argument definition of a method
|
|
1826
|
-
* @param methodId the method nodeId to get argument definition from
|
|
1827
|
-
* @async
|
|
1828
1780
|
*
|
|
1829
1781
|
*/
|
|
1830
1782
|
public async getArgumentDefinition(methodId: MethodId): Promise<ArgumentDefinition>;
|
|
@@ -1868,7 +1820,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1868
1820
|
return callback(new Error("Internal Error"));
|
|
1869
1821
|
}
|
|
1870
1822
|
|
|
1871
|
-
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */[];
|
|
1823
|
+
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */ [];
|
|
1872
1824
|
|
|
1873
1825
|
callback(null, response.registeredNodeIds);
|
|
1874
1826
|
});
|
|
@@ -2092,10 +2044,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2092
2044
|
return getExtensionObjectConstructor(this, dataTypeNodeId);
|
|
2093
2045
|
}
|
|
2094
2046
|
/**
|
|
2095
|
-
*
|
|
2047
|
+
* construct a Extension object from a DataType and a pojo
|
|
2096
2048
|
* @param dataType
|
|
2097
2049
|
* @param pojo
|
|
2098
|
-
* @async
|
|
2099
2050
|
*/
|
|
2100
2051
|
public async constructExtensionObject(dataType: NodeId, pojo: Record<string, any>): Promise<ExtensionObject> {
|
|
2101
2052
|
const Constructor = await this.getExtensionObjectConstructor(dataType);
|
|
@@ -2173,10 +2124,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2173
2124
|
callback(null, response);
|
|
2174
2125
|
});
|
|
2175
2126
|
}
|
|
2176
|
-
#_recreate_session_and_reperform_transaction(
|
|
2177
|
-
request: Request,
|
|
2178
|
-
callback: (err: Error | null, response?: Response) => void
|
|
2179
|
-
) {
|
|
2127
|
+
#_recreate_session_and_reperform_transaction(request: Request, callback: (err: Error | null, response?: Response) => void) {
|
|
2180
2128
|
warningLog("attempt to recreate session to reperform a transaction ", request.constructor.name);
|
|
2181
2129
|
if (this.recursive_repair_detector >= 1) {
|
|
2182
2130
|
// tslint:disable-next-line: no-console
|
|
@@ -2195,7 +2143,6 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2195
2143
|
this._performMessageTransaction(request, callback);
|
|
2196
2144
|
});
|
|
2197
2145
|
}
|
|
2198
|
-
|
|
2199
2146
|
}
|
|
2200
2147
|
|
|
2201
2148
|
type promoteOpaqueStructure3WithCallbackFunc = (
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
PrivateKey,
|
|
16
16
|
Nonce,
|
|
17
17
|
toPem
|
|
18
|
-
} from "node-opcua-crypto";
|
|
18
|
+
} from "node-opcua-crypto/web";
|
|
19
19
|
|
|
20
20
|
import { LocalizedText } from "node-opcua-data-model";
|
|
21
21
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
@@ -418,8 +418,6 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* create and activate a new session
|
|
421
|
-
* @async
|
|
422
|
-
* @method createSession
|
|
423
421
|
*
|
|
424
422
|
*
|
|
425
423
|
* @example
|
|
@@ -530,17 +528,13 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
530
528
|
}
|
|
531
529
|
|
|
532
530
|
/**
|
|
533
|
-
*
|
|
534
|
-
* @method closeSession
|
|
535
|
-
* @async
|
|
536
|
-
* @param session - the created client session
|
|
537
|
-
* @param deleteSubscriptions - whether to delete subscriptions or not
|
|
531
|
+
* close a session
|
|
538
532
|
*/
|
|
539
533
|
public closeSession(session: ClientSession, deleteSubscriptions: boolean): Promise<void>;
|
|
540
534
|
public closeSession(session: ClientSession, deleteSubscriptions: boolean, callback: (err?: Error) => void): void;
|
|
535
|
+
|
|
541
536
|
/**
|
|
542
|
-
* @
|
|
543
|
-
* @param args
|
|
537
|
+
* @internal
|
|
544
538
|
*/
|
|
545
539
|
public closeSession(...args: any[]): any {
|
|
546
540
|
if (this._retryCreateSessionTimer) {
|
|
@@ -677,7 +671,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
677
671
|
|
|
678
672
|
/**
|
|
679
673
|
* transfer session to this client
|
|
680
|
-
|
|
674
|
+
|
|
681
675
|
* @param session
|
|
682
676
|
* @param callback
|
|
683
677
|
* @return {*}
|
|
@@ -1222,8 +1216,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
1222
1216
|
// tslint:disable:max-line-length
|
|
1223
1217
|
const thenify = require("thenify");
|
|
1224
1218
|
/**
|
|
1225
|
-
|
|
1226
|
-
* @async
|
|
1219
|
+
|
|
1227
1220
|
*
|
|
1228
1221
|
* @example
|
|
1229
1222
|
* // create a anonymous session
|
|
@@ -1242,13 +1235,9 @@ const thenify = require("thenify");
|
|
|
1242
1235
|
OPCUAClientImpl.prototype.createSession = thenify.withCallback(OPCUAClientImpl.prototype.createSession);
|
|
1243
1236
|
OPCUAClientImpl.prototype.createSession2 = thenify.withCallback(OPCUAClientImpl.prototype.createSession2);
|
|
1244
1237
|
/**
|
|
1245
|
-
* @method changeSessionIdentity
|
|
1246
|
-
* @async
|
|
1247
1238
|
*/
|
|
1248
1239
|
OPCUAClientImpl.prototype.changeSessionIdentity = thenify.withCallback(OPCUAClientImpl.prototype.changeSessionIdentity);
|
|
1249
1240
|
/**
|
|
1250
|
-
* @method closeSession
|
|
1251
|
-
* @async
|
|
1252
1241
|
* @example
|
|
1253
1242
|
* const session = await client.createSession();
|
|
1254
1243
|
* await client.closeSession(session);
|
|
@@ -37,7 +37,7 @@ async function adjustMonitoredItemNodeIds(subscription: ClientSubscription, oldM
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* utility function to recreate new subscription
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
*/
|
|
42
42
|
export async function recreateSubscriptionAndMonitoredItem(_subscription: ClientSubscription): Promise<void> {
|
|
43
43
|
debugLog("recreateSubscriptionAndMonitoredItem", _subscription.subscriptionId.toString());
|
|
@@ -14,10 +14,6 @@ export interface FindServerResults {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* extract the server endpoints exposed by a discovery server
|
|
17
|
-
* @method findServers
|
|
18
|
-
* @async
|
|
19
|
-
* @param discoveryServerEndpointUri
|
|
20
|
-
* @param callback
|
|
21
17
|
*/
|
|
22
18
|
export function findServers(
|
|
23
19
|
discoveryServerEndpointUri: string,
|
package/source/verify.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
exploreCertificate,
|
|
7
7
|
explorePrivateKey,
|
|
8
8
|
publicKeyAndPrivateKeyMatches
|
|
9
|
-
} from "node-opcua-crypto";
|
|
9
|
+
} from "node-opcua-crypto/web";
|
|
10
10
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
11
11
|
import { VerifyCertificateOptions } from "node-opcua-pki";
|
|
12
12
|
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
5
|
-
import { StatusCode } from "node-opcua-status-code";
|
|
6
|
-
import { Variant } from "node-opcua-variant";
|
|
7
|
-
import { ClientSession } from "../client_session";
|
|
8
|
-
export interface TVariant<T> extends Variant {
|
|
9
|
-
value: T;
|
|
10
|
-
}
|
|
11
|
-
export interface TTwoStateStatus extends TVariant<string> {
|
|
12
|
-
id: TVariant<boolean>;
|
|
13
|
-
}
|
|
14
|
-
export interface EventStuff {
|
|
15
|
-
conditionId: TVariant<NodeId>;
|
|
16
|
-
eventType: TVariant<NodeId>;
|
|
17
|
-
eventId: TVariant<Buffer>;
|
|
18
|
-
retain: TVariant<boolean>;
|
|
19
|
-
activeState: TTwoStateStatus;
|
|
20
|
-
ackedState: TTwoStateStatus;
|
|
21
|
-
confirmedState: TTwoStateStatus;
|
|
22
|
-
conditionName?: TVariant<string>;
|
|
23
|
-
}
|
|
24
|
-
export interface ClientAlarm {
|
|
25
|
-
conditionId: NodeId;
|
|
26
|
-
eventType: NodeId;
|
|
27
|
-
fields: EventStuff;
|
|
28
|
-
on(eventName: "changed", eventHandler: () => void): this;
|
|
29
|
-
acknowledge(session: ClientSession, comment: string): Promise<StatusCode>;
|
|
30
|
-
getField(fieldName: string): Variant | null;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* describes a OPCUA Alarm as seen in the client side
|
|
34
|
-
*/
|
|
35
|
-
export declare class ClientAlarm extends EventEmitter {
|
|
36
|
-
conditionId: NodeId;
|
|
37
|
-
eventType: NodeId;
|
|
38
|
-
eventId: Buffer;
|
|
39
|
-
fields: EventStuff;
|
|
40
|
-
constructor(eventFields: EventStuff);
|
|
41
|
-
confirm(session: ClientSession, comment: string): Promise<StatusCode>;
|
|
42
|
-
update(eventFields: EventStuff): void;
|
|
43
|
-
getRetain(): boolean;
|
|
44
|
-
toString(): string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @private
|
|
48
|
-
*/
|
|
49
|
-
export declare function fieldsToJson(fields: string[], eventFields: Variant[], flat?: boolean): EventStuff;
|