node-opcua-client 2.163.1 → 2.165.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.js +1 -1
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item.js +1 -1
- package/dist/client_monitored_item.js.map +1 -1
- package/dist/client_monitored_item_group.js +1 -1
- package/dist/client_monitored_item_group.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +4 -4
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session_keepalive_manager.js +3 -3
- package/dist/client_session_keepalive_manager.js.map +1 -1
- package/dist/client_subscription.js +1 -1
- package/dist/client_subscription.js.map +1 -1
- package/dist/private/client_base_impl.js +33 -28
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_monitored_item_impl.js +1 -2
- package/dist/private/client_monitored_item_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +14 -3
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.js +58 -58
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +11 -11
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +15 -15
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/private/reconnection/client_publish_engine_reconnection.js +2 -2
- package/dist/private/reconnection/client_publish_engine_reconnection.js.map +1 -1
- package/dist/private/reconnection/client_subscription_reconnection.js +9 -9
- package/dist/private/reconnection/client_subscription_reconnection.js.map +1 -1
- package/dist/private/reconnection/reconnection.js +8 -8
- package/dist/private/reconnection/reconnection.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.js +3 -3
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/verify.d.ts +3 -3
- package/dist/verify.js +11 -9
- package/dist/verify.js.map +1 -1
- package/package.json +46 -46
- package/source/client_base.ts +1 -1
- package/source/client_monitored_item.ts +1 -1
- package/source/client_monitored_item_group.ts +1 -1
- package/source/client_monitored_item_toolbox.ts +4 -4
- package/source/client_session_keepalive_manager.ts +3 -3
- package/source/client_subscription.ts +1 -1
- package/source/private/client_base_impl.ts +35 -29
- package/source/private/client_monitored_item_impl.ts +1 -2
- package/source/private/client_publish_engine.ts +18 -3
- package/source/private/client_session_impl.ts +58 -58
- package/source/private/client_subscription_impl.ts +11 -11
- package/source/private/opcua_client_impl.ts +15 -15
- package/source/private/reconnection/client_publish_engine_reconnection.ts +2 -2
- package/source/private/reconnection/client_subscription_reconnection.ts +6 -6
- package/source/private/reconnection/reconnection.ts +8 -8
- package/source/tools/read_history_server_capabilities.ts +3 -3
- package/source/verify.ts +40 -43
|
@@ -390,7 +390,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
390
390
|
return callback(err);
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
/*
|
|
393
|
+
/* c8 ignore next */
|
|
394
394
|
if (!response || !(response instanceof BrowseResponse)) {
|
|
395
395
|
return callback(new Error("Internal Error"));
|
|
396
396
|
}
|
|
@@ -401,7 +401,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
401
401
|
for (let i = 0; i < results.length; i++) {
|
|
402
402
|
const r = results[i];
|
|
403
403
|
|
|
404
|
-
/*
|
|
404
|
+
/* c8 ignore next */
|
|
405
405
|
if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
|
|
406
406
|
warningLog(
|
|
407
407
|
chalk.yellow("warning") +
|
|
@@ -415,7 +415,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
for (const r of results) {
|
|
418
|
-
r.references = r.references || /*
|
|
418
|
+
r.references = r.references || /* c8 ignore next */[];
|
|
419
419
|
}
|
|
420
420
|
assert(results[0] instanceof BrowseResult);
|
|
421
421
|
return callback(null, isArray ? results : results[0]);
|
|
@@ -451,12 +451,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
451
451
|
});
|
|
452
452
|
|
|
453
453
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
454
|
-
/*
|
|
454
|
+
/* c8 ignore next */
|
|
455
455
|
if (err) {
|
|
456
456
|
return callback(err);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
/*
|
|
459
|
+
/* c8 ignore next */
|
|
460
460
|
if (!response || !(response instanceof BrowseNextResponse)) {
|
|
461
461
|
return callback(new Error("Internal Error"));
|
|
462
462
|
}
|
|
@@ -526,22 +526,22 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
526
526
|
});
|
|
527
527
|
|
|
528
528
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
529
|
-
/*
|
|
529
|
+
/* c8 ignore next */
|
|
530
530
|
if (err) {
|
|
531
531
|
return callback(err);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
|
-
/*
|
|
534
|
+
/* c8 ignore next */
|
|
535
535
|
if (!(response instanceof ReadResponse)) {
|
|
536
536
|
return callback(new Error("Internal Error"));
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
-
/*
|
|
539
|
+
/* c8 ignore next */
|
|
540
540
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
541
541
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
/*
|
|
544
|
+
/* c8 ignore next */
|
|
545
545
|
if (!response.results) {
|
|
546
546
|
response.results = [];
|
|
547
547
|
}
|
|
@@ -673,11 +673,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
673
673
|
|
|
674
674
|
assert(nodes.length === request.nodesToRead.length);
|
|
675
675
|
this.historyRead(request, (err: Error | null, response?: HistoryReadResponse) => {
|
|
676
|
-
/*
|
|
676
|
+
/* c8 ignore next */
|
|
677
677
|
if (err) {
|
|
678
678
|
return callback(err);
|
|
679
679
|
}
|
|
680
|
-
/*
|
|
680
|
+
/* c8 ignore next */
|
|
681
681
|
if (!response || !(response instanceof HistoryReadResponse)) {
|
|
682
682
|
return callback(new Error("Internal Error"));
|
|
683
683
|
}
|
|
@@ -690,18 +690,18 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
690
690
|
public historyRead(request: HistoryReadRequest, callback: Callback<HistoryReadResponse>): void;
|
|
691
691
|
public historyRead(request: HistoryReadRequest): Promise<HistoryReadResponse>;
|
|
692
692
|
public historyRead(request: HistoryReadRequest, callback?: CallbackT<HistoryReadResponse>): any {
|
|
693
|
-
/*
|
|
693
|
+
/* c8 ignore next */
|
|
694
694
|
if (!callback) {
|
|
695
695
|
throw new Error("expecting a callback");
|
|
696
696
|
}
|
|
697
697
|
|
|
698
698
|
this.performMessageTransaction(request, (err: Error | null, response) => {
|
|
699
|
-
/*
|
|
699
|
+
/* c8 ignore next */
|
|
700
700
|
if (err) {
|
|
701
701
|
return callback(err);
|
|
702
702
|
}
|
|
703
703
|
|
|
704
|
-
/*
|
|
704
|
+
/* c8 ignore next */
|
|
705
705
|
if (!response || !(response instanceof HistoryReadResponse)) {
|
|
706
706
|
return callback(new Error("Internal Error"));
|
|
707
707
|
}
|
|
@@ -710,7 +710,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
710
710
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
-
response.results = response.results || /*
|
|
713
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
714
714
|
|
|
715
715
|
// perform ExtensionObject resolution
|
|
716
716
|
const promises = response.results.map(async (result) => {
|
|
@@ -841,12 +841,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
841
841
|
|
|
842
842
|
assert(nodesToRead.length === request.nodesToRead!.length);
|
|
843
843
|
this.performMessageTransaction(request, (err: Error | null, response) => {
|
|
844
|
-
/*
|
|
844
|
+
/* c8 ignore next */
|
|
845
845
|
if (err) {
|
|
846
846
|
return callback(err);
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
/*
|
|
849
|
+
/* c8 ignore next */
|
|
850
850
|
if (!response || !(response instanceof HistoryReadResponse)) {
|
|
851
851
|
return callback(new Error("Internal Error"));
|
|
852
852
|
}
|
|
@@ -855,7 +855,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
855
855
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
response.results = response.results || /*
|
|
858
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
859
859
|
|
|
860
860
|
assert(nodesToRead.length === response.results.length);
|
|
861
861
|
|
|
@@ -980,21 +980,21 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
980
980
|
const request = new WriteRequest({ nodesToWrite });
|
|
981
981
|
|
|
982
982
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
983
|
-
/*
|
|
983
|
+
/* c8 ignore next */
|
|
984
984
|
if (err) {
|
|
985
985
|
return callback(err, response);
|
|
986
986
|
}
|
|
987
987
|
|
|
988
|
-
/*
|
|
988
|
+
/* c8 ignore next */
|
|
989
989
|
if (!response || !(response instanceof WriteResponse)) {
|
|
990
990
|
return callback(new Error("Internal Error"));
|
|
991
991
|
}
|
|
992
992
|
|
|
993
|
-
/*
|
|
993
|
+
/* c8 ignore next */
|
|
994
994
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
995
995
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
996
996
|
}
|
|
997
|
-
response.results = response.results || /*
|
|
997
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
998
998
|
assert(nodesToWrite.length === response.results.length);
|
|
999
999
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1000
1000
|
});
|
|
@@ -1051,7 +1051,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1051
1051
|
});
|
|
1052
1052
|
|
|
1053
1053
|
this.write(nodeToWrite, (err, statusCode) => {
|
|
1054
|
-
/*
|
|
1054
|
+
/* c8 ignore next */
|
|
1055
1055
|
if (err) {
|
|
1056
1056
|
return callback(err);
|
|
1057
1057
|
}
|
|
@@ -1174,7 +1174,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1174
1174
|
const callback = args[2];
|
|
1175
1175
|
assert(typeof callback === "function");
|
|
1176
1176
|
|
|
1177
|
-
/*
|
|
1177
|
+
/* c8 ignore next */
|
|
1178
1178
|
if (helpAPIChange) {
|
|
1179
1179
|
// the read method deprecation detection and warning
|
|
1180
1180
|
if (
|
|
@@ -1210,19 +1210,19 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1210
1210
|
});
|
|
1211
1211
|
|
|
1212
1212
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1213
|
-
/*
|
|
1213
|
+
/* c8 ignore next */
|
|
1214
1214
|
if (err) {
|
|
1215
1215
|
return callback(err, response);
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
1218
|
-
/*
|
|
1218
|
+
/* c8 ignore next */
|
|
1219
1219
|
if (!response || !(response instanceof ReadResponse)) {
|
|
1220
1220
|
return callback(new Error("Internal Error"));
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
1223
|
// perform ExtensionObject resolution
|
|
1224
1224
|
promoteOpaqueStructure(this, response.results!).then(() => {
|
|
1225
|
-
response.results = response.results || /*
|
|
1225
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
1226
1226
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1227
1227
|
}).catch((err) => {
|
|
1228
1228
|
callback(err);
|
|
@@ -1391,15 +1391,15 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1391
1391
|
SetPublishingModeResponse,
|
|
1392
1392
|
options,
|
|
1393
1393
|
(err: Error | null, response?: SetPublishingModeResponse) => {
|
|
1394
|
-
/*
|
|
1394
|
+
/* c8 ignore next */
|
|
1395
1395
|
if (err) {
|
|
1396
1396
|
return callback(err);
|
|
1397
1397
|
}
|
|
1398
|
-
/*
|
|
1398
|
+
/* c8 ignore next */
|
|
1399
1399
|
if (!response) {
|
|
1400
1400
|
return callback(new Error("Internal Error"));
|
|
1401
1401
|
}
|
|
1402
|
-
response.results = response.results || /*
|
|
1402
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
1403
1403
|
callback(err, isArray ? response.results : response.results[0]);
|
|
1404
1404
|
}
|
|
1405
1405
|
);
|
|
@@ -1427,15 +1427,15 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1427
1427
|
const request = new TranslateBrowsePathsToNodeIdsRequest({ browsePaths });
|
|
1428
1428
|
|
|
1429
1429
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1430
|
-
/*
|
|
1430
|
+
/* c8 ignore next */
|
|
1431
1431
|
if (err) {
|
|
1432
1432
|
return callback(err, response);
|
|
1433
1433
|
}
|
|
1434
|
-
/*
|
|
1434
|
+
/* c8 ignore next */
|
|
1435
1435
|
if (!response || !(response instanceof TranslateBrowsePathsToNodeIdsResponse)) {
|
|
1436
1436
|
return callback(new Error("Internal Error"));
|
|
1437
1437
|
}
|
|
1438
|
-
response.results = response.results || /*
|
|
1438
|
+
response.results = response.results || /* c8 ignore next */[];
|
|
1439
1439
|
|
|
1440
1440
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1441
1441
|
});
|
|
@@ -1447,7 +1447,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1447
1447
|
: -1;
|
|
1448
1448
|
}
|
|
1449
1449
|
public isChannelValid(): boolean {
|
|
1450
|
-
/*
|
|
1450
|
+
/* c8 ignore next */
|
|
1451
1451
|
if (!this._client) {
|
|
1452
1452
|
debugLog(chalk.red("Warning SessionClient is null ?"));
|
|
1453
1453
|
}
|
|
@@ -1469,7 +1469,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1469
1469
|
}
|
|
1470
1470
|
|
|
1471
1471
|
if (this._reconnecting.pendingTransactions.length > 0) {
|
|
1472
|
-
/*
|
|
1472
|
+
/* c8 ignore next */
|
|
1473
1473
|
if (this._reconnecting.pendingTransactions.length > 10) {
|
|
1474
1474
|
if (!pendingTransactionMessageDisplayed) {
|
|
1475
1475
|
pendingTransactionMessageDisplayed = true;
|
|
@@ -1544,7 +1544,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1544
1544
|
public _performMessageTransaction(request: Request, callback: (err: Error | null, response?: Response) => void): void {
|
|
1545
1545
|
assert(typeof callback === "function");
|
|
1546
1546
|
|
|
1547
|
-
/*
|
|
1547
|
+
/* c8 ignore next */
|
|
1548
1548
|
if (!this._client) {
|
|
1549
1549
|
// session may have been closed by user ... but is still in used !!
|
|
1550
1550
|
return callback(new Error("Session has been closed and should not be used to perform a transaction anymore"));
|
|
@@ -1568,7 +1568,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1568
1568
|
this._client.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1569
1569
|
this.lastResponseReceivedTime = new Date();
|
|
1570
1570
|
|
|
1571
|
-
/*
|
|
1571
|
+
/* c8 ignore next */
|
|
1572
1572
|
if (err) {
|
|
1573
1573
|
if (response && response.responseHeader.serviceDiagnostics) {
|
|
1574
1574
|
(err as any).serviceDiagnostics = response.responseHeader.serviceDiagnostics;
|
|
@@ -1579,12 +1579,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1579
1579
|
return callback(err);
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
|
-
/*
|
|
1582
|
+
/* c8 ignore next */
|
|
1583
1583
|
if (!response) {
|
|
1584
1584
|
return callback(new Error("internal Error"));
|
|
1585
1585
|
}
|
|
1586
1586
|
|
|
1587
|
-
/*
|
|
1587
|
+
/* c8 ignore next */
|
|
1588
1588
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1589
1589
|
err = new Error(
|
|
1590
1590
|
" ServiceResult is " +
|
|
@@ -1666,7 +1666,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1666
1666
|
assert(typeof callback === "function");
|
|
1667
1667
|
assert(typeof deleteSubscription === "boolean");
|
|
1668
1668
|
|
|
1669
|
-
/*
|
|
1669
|
+
/* c8 ignore next */
|
|
1670
1670
|
if (!this._client) {
|
|
1671
1671
|
debugLog("ClientSession#close : warning, client is already closed");
|
|
1672
1672
|
return callback(); // already close ?
|
|
@@ -1712,12 +1712,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1712
1712
|
const request = new CallRequest({ methodsToCall });
|
|
1713
1713
|
|
|
1714
1714
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1715
|
-
/*
|
|
1715
|
+
/* c8 ignore next */
|
|
1716
1716
|
if (err) {
|
|
1717
1717
|
return callback(err);
|
|
1718
1718
|
}
|
|
1719
1719
|
|
|
1720
|
-
/*
|
|
1720
|
+
/* c8 ignore next */
|
|
1721
1721
|
if (!response || !(response instanceof CallResponse)) {
|
|
1722
1722
|
return callback(new Error("internal error"));
|
|
1723
1723
|
}
|
|
@@ -1759,17 +1759,17 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1759
1759
|
});
|
|
1760
1760
|
|
|
1761
1761
|
this.call(methodsToCall, (err?: Error | null, result?: CallMethodResult) => {
|
|
1762
|
-
/*
|
|
1762
|
+
/* c8 ignore next */
|
|
1763
1763
|
if (err) {
|
|
1764
1764
|
return callback(err);
|
|
1765
1765
|
}
|
|
1766
1766
|
|
|
1767
|
-
/*
|
|
1767
|
+
/* c8 ignore next */
|
|
1768
1768
|
if (!result) {
|
|
1769
1769
|
return callback(new Error("internal error"));
|
|
1770
1770
|
}
|
|
1771
1771
|
|
|
1772
|
-
/*
|
|
1772
|
+
/* c8 ignore next */
|
|
1773
1773
|
if (result.statusCode.isNot(StatusCodes.Good)) {
|
|
1774
1774
|
callback(new Error(result.statusCode.toString()));
|
|
1775
1775
|
} else {
|
|
@@ -1783,8 +1783,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1783
1783
|
|
|
1784
1784
|
// Note some server might return null array
|
|
1785
1785
|
// let make sure we have Uint32Array and not a null pointer
|
|
1786
|
-
data.serverHandles = data.serverHandles || /*
|
|
1787
|
-
data.clientHandles = data.clientHandles || /*
|
|
1786
|
+
data.serverHandles = data.serverHandles || /* c8 ignore next */ emptyUint32Array;
|
|
1787
|
+
data.clientHandles = data.clientHandles || /* c8 ignore next */ emptyUint32Array;
|
|
1788
1788
|
|
|
1789
1789
|
assert(data.serverHandles instanceof Uint32Array);
|
|
1790
1790
|
assert(data.clientHandles instanceof Uint32Array);
|
|
@@ -1828,16 +1828,16 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1828
1828
|
});
|
|
1829
1829
|
|
|
1830
1830
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1831
|
-
/*
|
|
1831
|
+
/* c8 ignore next */
|
|
1832
1832
|
if (err) {
|
|
1833
1833
|
return callback(err);
|
|
1834
1834
|
}
|
|
1835
|
-
/*
|
|
1835
|
+
/* c8 ignore next */
|
|
1836
1836
|
if (!response || !(response instanceof RegisterNodesResponse)) {
|
|
1837
1837
|
return callback(new Error("Internal Error"));
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
|
-
response.registeredNodeIds = response.registeredNodeIds || /*
|
|
1840
|
+
response.registeredNodeIds = response.registeredNodeIds || /* c8 ignore next */[];
|
|
1841
1841
|
|
|
1842
1842
|
callback(null, response.registeredNodeIds);
|
|
1843
1843
|
});
|
|
@@ -1857,11 +1857,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1857
1857
|
});
|
|
1858
1858
|
|
|
1859
1859
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1860
|
-
/*
|
|
1860
|
+
/* c8 ignore next */
|
|
1861
1861
|
if (err) {
|
|
1862
1862
|
return callback(err);
|
|
1863
1863
|
}
|
|
1864
|
-
/*
|
|
1864
|
+
/* c8 ignore next */
|
|
1865
1865
|
if (!response || !(response instanceof UnregisterNodesResponse)) {
|
|
1866
1866
|
return callback(new Error("Internal Error"));
|
|
1867
1867
|
}
|
|
@@ -1880,11 +1880,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
1880
1880
|
const request = new QueryFirstRequest(queryFirstRequest);
|
|
1881
1881
|
|
|
1882
1882
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
1883
|
-
/*
|
|
1883
|
+
/* c8 ignore next */
|
|
1884
1884
|
if (err) {
|
|
1885
1885
|
return callback(err);
|
|
1886
1886
|
}
|
|
1887
|
-
/*
|
|
1887
|
+
/* c8 ignore next */
|
|
1888
1888
|
if (!response || !(response instanceof QueryFirstResponse)) {
|
|
1889
1889
|
return callback(new Error("internal error"));
|
|
1890
1890
|
}
|
|
@@ -2076,12 +2076,12 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2076
2076
|
|
|
2077
2077
|
const request = options instanceof requestClass ? options : new requestClass(options);
|
|
2078
2078
|
|
|
2079
|
-
/*
|
|
2079
|
+
/* c8 ignore next */
|
|
2080
2080
|
if (doDebug) {
|
|
2081
2081
|
request.trace = new Error("").stack;
|
|
2082
2082
|
}
|
|
2083
2083
|
|
|
2084
|
-
/*
|
|
2084
|
+
/* c8 ignore next */
|
|
2085
2085
|
if (this._closeEventHasBeenEmitted) {
|
|
2086
2086
|
debugLog("ClientSession#_defaultRequest => session has been closed !!", request.toString());
|
|
2087
2087
|
setImmediate(() => {
|
|
@@ -2098,7 +2098,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2098
2098
|
response ? response.toString() : " null"
|
|
2099
2099
|
);
|
|
2100
2100
|
}
|
|
2101
|
-
/*
|
|
2101
|
+
/* c8 ignore next */
|
|
2102
2102
|
if (err) {
|
|
2103
2103
|
debugLog("Client session : performMessageTransaction error = ", err.message);
|
|
2104
2104
|
// let intercept interesting error message
|
|
@@ -2108,7 +2108,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession, Re
|
|
|
2108
2108
|
// let's print some statistics
|
|
2109
2109
|
const now = Date.now();
|
|
2110
2110
|
|
|
2111
|
-
/*
|
|
2111
|
+
/* c8 ignore next */
|
|
2112
2112
|
if (doDebug) {
|
|
2113
2113
|
debugLog(chalk.bgWhite.red(" server send BadSessionClosed !"));
|
|
2114
2114
|
debugLog(chalk.bgWhite.red(" request was "), request.toString());
|
|
@@ -66,7 +66,7 @@ const minimumMaxKeepAliveCount = 3;
|
|
|
66
66
|
function displayKeepAliveWarning(sessionTimeout: number, maxKeepAliveCount: number, publishingInterval: number): boolean {
|
|
67
67
|
const keepAliveInterval = maxKeepAliveCount * publishingInterval;
|
|
68
68
|
|
|
69
|
-
//
|
|
69
|
+
// c8 ignore next
|
|
70
70
|
if (sessionTimeout < keepAliveInterval) {
|
|
71
71
|
warningLog(
|
|
72
72
|
chalk.yellowBright(
|
|
@@ -181,7 +181,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
181
181
|
options.requestedMaxKeepAliveCount,
|
|
182
182
|
options.requestedPublishingInterval
|
|
183
183
|
);
|
|
184
|
-
//
|
|
184
|
+
// c8 ignore next
|
|
185
185
|
if (warningEmitted) {
|
|
186
186
|
warningLog(
|
|
187
187
|
JSON.stringify(
|
|
@@ -409,7 +409,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
409
409
|
if (err) {
|
|
410
410
|
return callback(err);
|
|
411
411
|
}
|
|
412
|
-
/*
|
|
412
|
+
/* c8 ignore next */
|
|
413
413
|
if (!statusCode) {
|
|
414
414
|
return callback(new Error("Internal Error"));
|
|
415
415
|
}
|
|
@@ -463,7 +463,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
463
463
|
return callback(err);
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
//
|
|
466
|
+
// c8 ignore next
|
|
467
467
|
if (!response) {
|
|
468
468
|
return callback(new Error("Internal Error"));
|
|
469
469
|
}
|
|
@@ -634,7 +634,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
//
|
|
637
|
+
// c8 ignore next
|
|
638
638
|
if (repeated > 1) {
|
|
639
639
|
warningLog("previous message repeated", repeated, "times");
|
|
640
640
|
}
|
|
@@ -725,7 +725,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
725
725
|
() => {
|
|
726
726
|
// now process all notifications
|
|
727
727
|
for (const notification of notificationData) {
|
|
728
|
-
//
|
|
728
|
+
// c8 ignore next
|
|
729
729
|
if (!notification) {
|
|
730
730
|
continue;
|
|
731
731
|
}
|
|
@@ -820,7 +820,7 @@ export class ClientSubscriptionImpl extends EventEmitter implements ClientSubscr
|
|
|
820
820
|
timestampsToReturn: TimestampsToReturn,
|
|
821
821
|
monitoringMode: MonitoringMode = MonitoringMode.Reporting
|
|
822
822
|
): ClientMonitoredItem {
|
|
823
|
-
/*
|
|
823
|
+
/* c8 ignore next*/
|
|
824
824
|
const monitoredItem = new ClientMonitoredItemImpl(
|
|
825
825
|
this,
|
|
826
826
|
itemToMonitor,
|
|
@@ -893,7 +893,7 @@ ClientSubscription.create = (clientSession: ClientSession, options: ClientSubscr
|
|
|
893
893
|
};
|
|
894
894
|
|
|
895
895
|
export function __create_subscription(subscription: ClientSubscriptionImpl, callback: ErrorCallback) {
|
|
896
|
-
//
|
|
896
|
+
// c8 ignore next
|
|
897
897
|
if (!subscription.hasSession) {
|
|
898
898
|
return callback(new Error("__create_subscription: subscription has no Session"));
|
|
899
899
|
}
|
|
@@ -912,7 +912,7 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
912
912
|
|
|
913
913
|
session.createSubscription(request, (err: Error | null, response?: CreateSubscriptionResponse) => {
|
|
914
914
|
if (err) {
|
|
915
|
-
/*
|
|
915
|
+
/* c8 ignore next */
|
|
916
916
|
subscription.emit("internal_error", err);
|
|
917
917
|
if (callback) {
|
|
918
918
|
return callback(err);
|
|
@@ -920,7 +920,7 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
920
920
|
return;
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
/*
|
|
923
|
+
/* c8 ignore next */
|
|
924
924
|
if (!response) {
|
|
925
925
|
return callback(new Error("internal error"));
|
|
926
926
|
}
|
|
@@ -940,7 +940,7 @@ export function __create_subscription(subscription: ClientSubscriptionImpl, call
|
|
|
940
940
|
displayKeepAliveWarning(subscription.session.timeout, subscription.maxKeepAliveCount, subscription.publishingInterval);
|
|
941
941
|
ClientSubscription.ignoreNextWarning = false;
|
|
942
942
|
|
|
943
|
-
//
|
|
943
|
+
// c8 ignore next
|
|
944
944
|
if (doDebug) {
|
|
945
945
|
debugLog(chalk.yellow.bold("registering callback"));
|
|
946
946
|
debugLog(chalk.yellow.bold("publishingInterval "), subscription.publishingInterval);
|
|
@@ -194,7 +194,7 @@ function createX509IdentityToken(
|
|
|
194
194
|
const endpoint = context.endpoint;
|
|
195
195
|
assert(endpoint instanceof EndpointDescription);
|
|
196
196
|
const userTokenPolicy = findUserTokenPolicy(endpoint, UserTokenType.Certificate);
|
|
197
|
-
//
|
|
197
|
+
// c8 ignore next
|
|
198
198
|
if (!userTokenPolicy) {
|
|
199
199
|
throw new Error("Cannot find Certificate (X509) user token policy in end point description");
|
|
200
200
|
}
|
|
@@ -218,7 +218,7 @@ function createX509IdentityToken(
|
|
|
218
218
|
// see Release 1.02 155 OPC Unified Architecture, Part 4
|
|
219
219
|
const cryptoFactory = getCryptoFactory(securityPolicy);
|
|
220
220
|
|
|
221
|
-
//
|
|
221
|
+
// c8 ignore next
|
|
222
222
|
if (!cryptoFactory) {
|
|
223
223
|
throw new Error(" Unsupported security Policy");
|
|
224
224
|
}
|
|
@@ -280,7 +280,7 @@ function createUserNameIdentityToken(
|
|
|
280
280
|
*/
|
|
281
281
|
const userTokenPolicy = findUserTokenPolicy(endpoint, UserTokenType.UserName);
|
|
282
282
|
|
|
283
|
-
//
|
|
283
|
+
// c8 ignore next
|
|
284
284
|
if (!userTokenPolicy) {
|
|
285
285
|
throw new Error("Cannot find USERNAME user token policy in end point description");
|
|
286
286
|
}
|
|
@@ -331,7 +331,7 @@ function createUserNameIdentityToken(
|
|
|
331
331
|
// see Release 1.02 155 OPC Unified Architecture, Part 4
|
|
332
332
|
const cryptoFactory = getCryptoFactory(securityPolicy);
|
|
333
333
|
|
|
334
|
-
//
|
|
334
|
+
// c8 ignore next
|
|
335
335
|
if (!cryptoFactory) {
|
|
336
336
|
throw new Error(" Unsupported security Policy " + securityPolicy.toString());
|
|
337
337
|
}
|
|
@@ -454,7 +454,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
454
454
|
if (err) {
|
|
455
455
|
callback(err);
|
|
456
456
|
} else {
|
|
457
|
-
/*
|
|
457
|
+
/* c8 ignore next */
|
|
458
458
|
if (!session) {
|
|
459
459
|
return callback(new Error("Internal Error"));
|
|
460
460
|
}
|
|
@@ -695,7 +695,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
695
695
|
if (!this._secureChannel) {
|
|
696
696
|
return callback!(new Error(" client must be connected first"));
|
|
697
697
|
}
|
|
698
|
-
//
|
|
698
|
+
// c8 ignore next
|
|
699
699
|
if (!this.__resolveEndPoint() || !this.endpoint) {
|
|
700
700
|
return callback!(
|
|
701
701
|
new Error(
|
|
@@ -737,7 +737,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
737
737
|
}
|
|
738
738
|
callback!();
|
|
739
739
|
} else {
|
|
740
|
-
//
|
|
740
|
+
// c8 ignore next
|
|
741
741
|
if (doDebug) {
|
|
742
742
|
debugLog(chalk.red.bgWhite("reactivateSession has failed !"), err.message);
|
|
743
743
|
}
|
|
@@ -771,7 +771,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
771
771
|
assert(this.endpointUrl !== undefined, " must have a valid server endpointUrl");
|
|
772
772
|
assert(this.endpoint);
|
|
773
773
|
|
|
774
|
-
//
|
|
774
|
+
// c8 ignore next
|
|
775
775
|
if (!this._secureChannel) {
|
|
776
776
|
return callback(new Error("Invalid channel"));
|
|
777
777
|
}
|
|
@@ -810,7 +810,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
810
810
|
assert(this._secureChannel.securityMode === MessageSecurityMode.None || request.clientNonce !== null);
|
|
811
811
|
|
|
812
812
|
this.performMessageTransaction(request, (err: Error | null, response?: Response) => {
|
|
813
|
-
/*
|
|
813
|
+
/* c8 ignore next */
|
|
814
814
|
if (err) {
|
|
815
815
|
debugLog("__createSession_step3 has failed", err.message);
|
|
816
816
|
return callback(err);
|
|
@@ -823,7 +823,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
823
823
|
// return;
|
|
824
824
|
}
|
|
825
825
|
|
|
826
|
-
/*
|
|
826
|
+
/* c8 ignore next */
|
|
827
827
|
if (!response || !(response instanceof CreateSessionResponse)) {
|
|
828
828
|
return callback(new Error("internal error"));
|
|
829
829
|
}
|
|
@@ -839,7 +839,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
839
839
|
return callback(err);
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
//
|
|
842
|
+
// c8 ignore next
|
|
843
843
|
if (!validateServerNonce(response.serverNonce)) {
|
|
844
844
|
return callback(new Error("Invalid server Nonce"));
|
|
845
845
|
}
|
|
@@ -895,7 +895,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
895
895
|
// see OPCUA Part 4 - $7.35
|
|
896
896
|
assert(typeof callback === "function");
|
|
897
897
|
|
|
898
|
-
//
|
|
898
|
+
// c8 ignore next
|
|
899
899
|
if (!this._secureChannel) {
|
|
900
900
|
return callback(new Error(" No secure channel"));
|
|
901
901
|
}
|
|
@@ -982,7 +982,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
982
982
|
|
|
983
983
|
this.performMessageTransaction(request, (err1: Error | null, response?: Response) => {
|
|
984
984
|
if (!err1 && response && response.responseHeader.serviceResult === StatusCodes.Good) {
|
|
985
|
-
/*
|
|
985
|
+
/* c8 ignore next */
|
|
986
986
|
if (!(response instanceof ActivateSessionResponse)) {
|
|
987
987
|
return callback(new Error("Internal Error"));
|
|
988
988
|
}
|
|
@@ -1002,7 +1002,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
1002
1002
|
// restore client
|
|
1003
1003
|
session._client = _old_client;
|
|
1004
1004
|
|
|
1005
|
-
/*
|
|
1005
|
+
/* c8 ignore next */
|
|
1006
1006
|
if (!err1 && response) {
|
|
1007
1007
|
err1 = new Error(response.responseHeader.serviceResult.toString());
|
|
1008
1008
|
}
|
|
@@ -1099,7 +1099,7 @@ export class OPCUAClientImpl extends ClientBaseImpl implements OPCUAClient {
|
|
|
1099
1099
|
assert(typeof callback === "function");
|
|
1100
1100
|
assert(this._secureChannel);
|
|
1101
1101
|
if (!this.__resolveEndPoint() || !this.endpoint) {
|
|
1102
|
-
/*
|
|
1102
|
+
/* c8 ignore next */
|
|
1103
1103
|
if (this._serverEndpoints) {
|
|
1104
1104
|
warningLog(
|
|
1105
1105
|
"server endpoints =",
|
|
@@ -32,9 +32,9 @@ function _republish(
|
|
|
32
32
|
subscriptionId: subscription.subscriptionId
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// c8 ignore next
|
|
36
36
|
if (doDebug) {
|
|
37
|
-
//
|
|
37
|
+
// c8 ignore next
|
|
38
38
|
debugLog(
|
|
39
39
|
chalk.bgCyan.yellow.bold(" republish Request for subscription"),
|
|
40
40
|
request.subscriptionId,
|