node-opcua-client 2.103.0 → 2.105.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/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +0 -1
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -1
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +8 -4
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -1
- package/dist/alarms_and_conditions/client_tools.js +24 -1
- package/dist/alarms_and_conditions/client_tools.js.map +1 -1
- package/dist/client_base.js +1 -1
- package/dist/client_base.js.map +1 -1
- package/dist/client_monitored_item_toolbox.js +5 -2
- package/dist/client_monitored_item_toolbox.js.map +1 -1
- package/dist/client_session_keepalive_manager.js +5 -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/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/private/client_base_impl.js +70 -31
- package/dist/private/client_base_impl.js.map +1 -1
- package/dist/private/client_publish_engine.js +39 -13
- package/dist/private/client_publish_engine.js.map +1 -1
- package/dist/private/client_session_impl.js +27 -24
- package/dist/private/client_session_impl.js.map +1 -1
- package/dist/private/client_subscription_impl.js +45 -19
- package/dist/private/client_subscription_impl.js.map +1 -1
- package/dist/private/opcua_client_impl.js +60 -24
- package/dist/private/opcua_client_impl.js.map +1 -1
- package/dist/reconnection.js +53 -28
- package/dist/reconnection.js.map +1 -1
- package/dist/tools/findservers.js +24 -1
- package/dist/tools/findservers.js.map +1 -1
- package/dist/tools/read_history_server_capabilities.js.map +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +9 -8
- package/dist/verify.js.map +1 -1
- package/package.json +47 -47
- package/source/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.ts +1 -5
- package/source/alarms_and_conditions/client_alarm_tools_dump_event.ts +7 -4
- package/source/client_monitored_item_toolbox.ts +1 -1
- package/source/client_session_keepalive_manager.ts +1 -2
- package/source/private/client_base_impl.ts +37 -24
- package/source/private/client_publish_engine.ts +1 -1
- package/source/private/client_session_impl.ts +22 -23
- package/source/private/client_subscription_impl.ts +1 -1
- package/source/private/opcua_client_impl.ts +40 -33
- package/source/reconnection.ts +2 -4
- package/source/tools/read_history_server_capabilities.ts +6 -0
- package/source/verify.ts +9 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findservers.js","sourceRoot":"","sources":["../../source/tools/findservers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"findservers.js","sourceRoot":"","sources":["../../source/tools/findservers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,6CAA+B;AAK/B,kEAA6D;AAkB7D,SAAgB,WAAW,CACvB,0BAAkC,EAClC,QAAkE;IAElE,MAAM,MAAM,GAAG,IAAI,iCAAc,CAAC,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAE3E,IAAI,OAAO,GAA6B,EAAE,CAAC;IAC3C,IAAI,SAAS,GAA0B,EAAE,CAAC;IAE1C,KAAK,CAAC,MAAM,CACR;QACI,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,aAAa,CAAC,CAAC;QAC9D,CAAC;QAED,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,CAAC,WAAW,CAAC,CAAC,GAAiB,EAAE,QAAmC,EAAE,EAAE;gBAC1E,IAAI,QAAQ,EAAE;oBACV,OAAO,GAAG,QAAQ,CAAC;iBACtB;gBACD,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACzC,CAAC,CAAC,CAAC;QACP,CAAC;QAED,CAAC,aAA4B,EAAE,EAAE;YAC7B,MAAM,CAAC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,SAAS,CAAC,CAAC;AAClC,MAAM,CAAC,OAAe,CAAC,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAE,MAAM,CAAC,OAAe,CAAC,oBAAoB,CAAC,CAAC;AACjH,MAAM,CAAC,OAAe,CAAC,WAAW,GAAG,OAAO,CAAC,YAAY,CAAE,MAAM,CAAC,OAAe,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read_history_server_capabilities.js","sourceRoot":"","sources":["../../source/tools/read_history_server_capabilities.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,+DAAiD;AACjD,iEAAqD;AAErD,yDAA2C;AAE3C,uGAAwG;AAExG,uDAAoD;AAcpD,SAAgB,6BAA6B,CACzC,OAAsB,EACtB,QAAgF;IAEhF,IAAI,CAAC,QAAQ,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACrC;IACD,wCAAwC;IACxC,MAAM,UAAU,GAAe,IAAA,yDAAc,EAAC,gCAAS,CAAC,aAAa,EAAE,sDAAsD,CAAC,CAAC;IAE/H,OAAO,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,GAAiB,EAAE,MAAyB,EAAE,EAAE;QACrF,IAAI,GAAG,EAAE;YACL,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACxB;QACD,0BAA0B;QAC1B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAChD;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE;YAC/B,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC9E;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,MAAM,+BAA+B,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACnE,2BAA2B;QAC3B,IAAA,0BAAM,EAAC,+BAA+B,CAAC,QAAQ,EAAE,KAAK,cAAc,CAAC,CAAC;QAEtE,4BAA4B;QAC5B,MAAM,UAAU,GAAG;YACf,6BAA6B;YAC7B,+BAA+B;
|
|
1
|
+
{"version":3,"file":"read_history_server_capabilities.js","sourceRoot":"","sources":["../../source/tools/read_history_server_capabilities.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,+DAAiD;AACjD,iEAAqD;AAErD,yDAA2C;AAE3C,uGAAwG;AAExG,uDAAoD;AAcpD,SAAgB,6BAA6B,CACzC,OAAsB,EACtB,QAAgF;IAEhF,IAAI,CAAC,QAAQ,EAAE;QACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;KACrC;IACD,wCAAwC;IACxC,MAAM,UAAU,GAAe,IAAA,yDAAc,EAAC,gCAAS,CAAC,aAAa,EAAE,sDAAsD,CAAC,CAAC;IAE/H,OAAO,CAAC,mBAAmB,CAAC,UAAU,EAAE,CAAC,GAAiB,EAAE,MAAyB,EAAE,EAAE;QACrF,IAAI,GAAG,EAAE;YACL,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACxB;QACD,0BAA0B;QAC1B,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAChD;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE;YAC/B,OAAO,QAAQ,CAAC,IAAI,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SAC9E;QAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,MAAM,+BAA+B,GAAG,MAAM,CAAC,OAAO,CAAC,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{ OPCUASecureObject } from "node-opcua-common";
|
|
3
3
|
import { Certificate } from "node-opcua-crypto";
|
|
4
4
|
export declare function verifyIsOPCUAValidCertificate(certificate: Certificate, certificateFile: string, type: "client" | "server", applicationUri: string): void;
|
|
5
|
-
export declare function performCertificateSanityCheck(
|
|
5
|
+
export declare function performCertificateSanityCheck(secureObject: OPCUASecureObject, serverOrClient: "server" | "client", certificateManager: OPCUACertificateManager, applicationUri: string): Promise<void>;
|
package/dist/verify.js
CHANGED
|
@@ -72,6 +72,7 @@ function verifyIsOPCUAValidCertificate(certificate, certificateFile, type, appli
|
|
|
72
72
|
warningLog(`[NODE-OPCUA-W16] The certificate keyUsage must include digitalSignature, nonRepudiation, keyEncipherment and dataEncipherment.\n` +
|
|
73
73
|
`see https://reference.opcfoundation.org/v104/Core/docs/Part6/6.2.2/\n` +
|
|
74
74
|
`certificateFile = ${certificateFile}`);
|
|
75
|
+
warningLog(`keyUsage = ${JSON.stringify(keyUsage, null, " ")}`);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
const extKeyUsage = (_e = certificateInfo.tbsCertificate.extensions) === null || _e === void 0 ? void 0 : _e.extKeyUsage;
|
|
@@ -100,18 +101,18 @@ function verifyIsOPCUAValidCertificate(certificate, certificateFile, type, appli
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
exports.verifyIsOPCUAValidCertificate = verifyIsOPCUAValidCertificate;
|
|
103
|
-
function performCertificateSanityCheck(serverOrClient, certificateManager, applicationUri) {
|
|
104
|
+
function performCertificateSanityCheck(secureObject, serverOrClient, certificateManager, applicationUri) {
|
|
104
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
// verify that certificate is matching private key, and inform the
|
|
106
|
-
const certificate =
|
|
107
|
-
const privateKey =
|
|
106
|
+
// verify that certificate is matching private key, and inform the developer if not
|
|
107
|
+
const certificate = secureObject.getCertificate();
|
|
108
|
+
const privateKey = secureObject.getPrivateKey();
|
|
108
109
|
//
|
|
109
110
|
if (!(0, node_opcua_crypto_1.publicKeyAndPrivateKeyMatches)(certificate, privateKey)) {
|
|
110
111
|
errorLog("[NODE-OPCUA-E01] Configuration error : the certificate and the private key do not match !");
|
|
111
112
|
errorLog(" please check the configuration of the OPCUA Server");
|
|
112
|
-
errorLog(" privateKey= ",
|
|
113
|
+
errorLog(" privateKey= ", secureObject.privateKeyFile);
|
|
113
114
|
errorLog(" certificateManager.privateKey= ", certificateManager.privateKey);
|
|
114
|
-
errorLog(" certificateFile= ",
|
|
115
|
+
errorLog(" certificateFile= ", secureObject.certificateFile);
|
|
115
116
|
throw new Error("[NODE-OPCUA-E01] Configuration error : the certificate and the private key do not match ! please fix your configuration");
|
|
116
117
|
}
|
|
117
118
|
// verify that the certificate provided has the right key length ( at least 2048)
|
|
@@ -126,9 +127,9 @@ function performCertificateSanityCheck(serverOrClient, certificateManager, appli
|
|
|
126
127
|
const status1 = yield certificateManager.trustCertificate(certificate);
|
|
127
128
|
const status = yield certificateManager.verifyCertificateAsync(certificate);
|
|
128
129
|
if (status !== "Good") {
|
|
129
|
-
warningLog("[NODE-OPCUA-W04] Warning: the certificate status is = ", status, " file = ",
|
|
130
|
+
warningLog("[NODE-OPCUA-W04] Warning: the certificate status is = ", status, " file = ", secureObject.certificateFile);
|
|
130
131
|
}
|
|
131
|
-
verifyIsOPCUAValidCertificate(certificate,
|
|
132
|
+
verifyIsOPCUAValidCertificate(certificate, secureObject.certificateFile, serverOrClient, applicationUri);
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
exports.performCertificateSanityCheck = performCertificateSanityCheck;
|
package/dist/verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../source/verify.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,yDAM2B;AAC3B,uDAAiG;AAEjG,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,I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AAQ,CAAC,sEAAsE,CAAC,CAAC;YACjF,QAAQ,CAAC,kCAAkC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;YAC1E,QAAQ,CAAC,kCAAkC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;YAC5E,QAAQ,CAAC,kCAAkC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;YAC3E,MAAM,IAAI,KAAK,CACX,yHAAyH,CAC5H,CAAC;SACL;QACD,iFAAiF;QACjF,MAAM,cAAc,GAAG,IAAA,qCAAiB,EAAC,UAAU,CAAC,CAAC;QACrD,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1D,IAAI,eAAe,IAAI,IAAI,EAAE;YACzB,UAAU,CACN,2HAA2H,eAAe,MAAM;gBAC5I,2FAA2F;gBAC3F,OAAO,cAAc,qEAAqE,CACjG,CAAC;SACL;QACD,sGAAsG;QACtG,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACvE,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAE5E,IAAI,MAAM,KAAK,MAAM,EAAE;YACnB,UAAU,CAAC,wDAAwD,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;SAC1H;QAED,6BAA6B,CAAC,WAAW,EAAE,YAAY,CAAC,eAAe,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAC7G,CAAC;CAAA;AAvCD,sEAuCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.105.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module client",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "npx rimraf node_modules dist *.tsbuildinfo certificates",
|
|
@@ -13,61 +13,61 @@
|
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ster5/global-mutex": "^
|
|
17
|
-
"@types/async": "^3.2.
|
|
16
|
+
"@ster5/global-mutex": "^2.0.0",
|
|
17
|
+
"@types/async": "^3.2.20",
|
|
18
18
|
"async": "^3.2.4",
|
|
19
19
|
"chalk": "4.1.2",
|
|
20
|
-
"node-opcua-assert": "2.
|
|
21
|
-
"node-opcua-basic-types": "2.
|
|
22
|
-
"node-opcua-buffer-utils": "2.
|
|
23
|
-
"node-opcua-certificate-manager": "2.
|
|
24
|
-
"node-opcua-client-dynamic-extension-object": "2.
|
|
25
|
-
"node-opcua-common": "2.
|
|
20
|
+
"node-opcua-assert": "2.105.0",
|
|
21
|
+
"node-opcua-basic-types": "2.105.0",
|
|
22
|
+
"node-opcua-buffer-utils": "2.105.0",
|
|
23
|
+
"node-opcua-certificate-manager": "2.105.0",
|
|
24
|
+
"node-opcua-client-dynamic-extension-object": "2.105.0",
|
|
25
|
+
"node-opcua-common": "2.105.0",
|
|
26
26
|
"node-opcua-constants": "2.98.1",
|
|
27
|
-
"node-opcua-crypto": "
|
|
28
|
-
"node-opcua-data-model": "2.
|
|
29
|
-
"node-opcua-data-value": "2.
|
|
30
|
-
"node-opcua-date-time": "2.
|
|
31
|
-
"node-opcua-debug": "2.
|
|
32
|
-
"node-opcua-extension-object": "2.
|
|
33
|
-
"node-opcua-hostname": "2.
|
|
34
|
-
"node-opcua-nodeid": "2.
|
|
35
|
-
"node-opcua-object-registry": "2.
|
|
36
|
-
"node-opcua-pki": "
|
|
37
|
-
"node-opcua-pseudo-session": "2.
|
|
38
|
-
"node-opcua-schemas": "2.
|
|
39
|
-
"node-opcua-secure-channel": "2.
|
|
40
|
-
"node-opcua-service-browse": "2.
|
|
41
|
-
"node-opcua-service-call": "2.
|
|
42
|
-
"node-opcua-service-discovery": "2.
|
|
43
|
-
"node-opcua-service-endpoints": "2.
|
|
44
|
-
"node-opcua-service-filter": "2.
|
|
45
|
-
"node-opcua-service-history": "2.
|
|
46
|
-
"node-opcua-service-query": "2.
|
|
47
|
-
"node-opcua-service-read": "2.
|
|
48
|
-
"node-opcua-service-register-node": "2.
|
|
49
|
-
"node-opcua-service-secure-channel": "2.
|
|
50
|
-
"node-opcua-service-session": "2.
|
|
51
|
-
"node-opcua-service-subscription": "2.
|
|
52
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
53
|
-
"node-opcua-service-write": "2.
|
|
54
|
-
"node-opcua-status-code": "2.
|
|
55
|
-
"node-opcua-types": "2.
|
|
56
|
-
"node-opcua-utils": "2.
|
|
57
|
-
"node-opcua-variant": "2.
|
|
27
|
+
"node-opcua-crypto": "3.0.6",
|
|
28
|
+
"node-opcua-data-model": "2.105.0",
|
|
29
|
+
"node-opcua-data-value": "2.105.0",
|
|
30
|
+
"node-opcua-date-time": "2.105.0",
|
|
31
|
+
"node-opcua-debug": "2.105.0",
|
|
32
|
+
"node-opcua-extension-object": "2.105.0",
|
|
33
|
+
"node-opcua-hostname": "2.105.0",
|
|
34
|
+
"node-opcua-nodeid": "2.105.0",
|
|
35
|
+
"node-opcua-object-registry": "2.105.0",
|
|
36
|
+
"node-opcua-pki": "4.2.1",
|
|
37
|
+
"node-opcua-pseudo-session": "2.105.0",
|
|
38
|
+
"node-opcua-schemas": "2.105.0",
|
|
39
|
+
"node-opcua-secure-channel": "2.105.0",
|
|
40
|
+
"node-opcua-service-browse": "2.105.0",
|
|
41
|
+
"node-opcua-service-call": "2.105.0",
|
|
42
|
+
"node-opcua-service-discovery": "2.105.0",
|
|
43
|
+
"node-opcua-service-endpoints": "2.105.0",
|
|
44
|
+
"node-opcua-service-filter": "2.105.0",
|
|
45
|
+
"node-opcua-service-history": "2.105.0",
|
|
46
|
+
"node-opcua-service-query": "2.105.0",
|
|
47
|
+
"node-opcua-service-read": "2.105.0",
|
|
48
|
+
"node-opcua-service-register-node": "2.105.0",
|
|
49
|
+
"node-opcua-service-secure-channel": "2.105.0",
|
|
50
|
+
"node-opcua-service-session": "2.105.0",
|
|
51
|
+
"node-opcua-service-subscription": "2.105.0",
|
|
52
|
+
"node-opcua-service-translate-browse-path": "2.105.0",
|
|
53
|
+
"node-opcua-service-write": "2.105.0",
|
|
54
|
+
"node-opcua-status-code": "2.105.0",
|
|
55
|
+
"node-opcua-types": "2.105.0",
|
|
56
|
+
"node-opcua-utils": "2.105.0",
|
|
57
|
+
"node-opcua-variant": "2.105.0",
|
|
58
58
|
"thenify": "^3.3.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/underscore": "^1.11.
|
|
61
|
+
"@types/underscore": "^1.11.5",
|
|
62
62
|
"dequeue": "^1.0.5",
|
|
63
63
|
"mocha": "^10.2.0",
|
|
64
|
-
"node-opcua-address-space": "2.
|
|
65
|
-
"node-opcua-binary-stream": "2.
|
|
66
|
-
"node-opcua-factory": "2.
|
|
67
|
-
"node-opcua-leak-detector": "2.
|
|
64
|
+
"node-opcua-address-space": "2.105.0",
|
|
65
|
+
"node-opcua-binary-stream": "2.105.0",
|
|
66
|
+
"node-opcua-factory": "2.105.0",
|
|
67
|
+
"node-opcua-leak-detector": "2.105.0",
|
|
68
68
|
"node-opcua-nodesets": "2.103.0",
|
|
69
69
|
"should": "^13.2.3",
|
|
70
|
-
"sinon": "^15.0
|
|
70
|
+
"sinon": "^15.1.0",
|
|
71
71
|
"underscore": "^1.13.6"
|
|
72
72
|
},
|
|
73
73
|
"eslintConfig": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"internet of things"
|
|
91
91
|
],
|
|
92
92
|
"homepage": "http://node-opcua.github.io/",
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "41c30f321debfe92128905d97a52426b9d7f9b9e",
|
|
94
94
|
"files": [
|
|
95
95
|
"dist",
|
|
96
96
|
"source"
|
|
@@ -21,7 +21,6 @@ const errorLog = make_errorLog(__filename);
|
|
|
21
21
|
* @param comment
|
|
22
22
|
*/
|
|
23
23
|
export async function acknowledgeCondition(session: ClientSession, eventStuff: EventStuff, comment: string): Promise<StatusCode> {
|
|
24
|
-
|
|
25
24
|
try {
|
|
26
25
|
const conditionId = eventStuff.conditionId.value;
|
|
27
26
|
const eventId = eventStuff.eventId.value;
|
|
@@ -95,12 +94,9 @@ export async function findActiveConditions(session: ClientSession): Promise<Even
|
|
|
95
94
|
if (RefreshEndEventHasBeenReceived) {
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
|
|
100
98
|
// dumpEvent(session, fields, eventFields);
|
|
101
99
|
const pojo = fieldsToJson(fields, eventFields) as any;
|
|
102
|
-
|
|
103
|
-
// console.log(pojo.eventType.value.toString({ addressSpace}), RefreshEndEventType, RefreshStartEventType);
|
|
104
100
|
|
|
105
101
|
// make sure we only start recording event after the RefreshStartEvent has been received
|
|
106
102
|
if (!refreshStartEventHasBeenReceived) {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from "chalk";
|
|
2
2
|
import { AttributeIds } from "node-opcua-data-model";
|
|
3
3
|
import { NodeId } from "node-opcua-nodeid";
|
|
4
4
|
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
5
5
|
import { DataType, Variant, VariantLike } from "node-opcua-variant";
|
|
6
6
|
|
|
7
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
8
|
+
|
|
9
|
+
const warningLog = make_warningLog("ClientAlarmTool");
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
*
|
|
9
13
|
* @param session
|
|
@@ -32,8 +36,7 @@ export async function dumpEvent(session: IBasicSession, fields: string[], eventF
|
|
|
32
36
|
}
|
|
33
37
|
if (variant.dataType === DataType.NodeId) {
|
|
34
38
|
const name = await getBrowseName(_session, variant.value);
|
|
35
|
-
|
|
36
|
-
console.log(
|
|
39
|
+
warningLog(
|
|
37
40
|
chalk.yellow(w(name, 30), w(_fields[index], 25)),
|
|
38
41
|
chalk.cyan(w(DataType[variant.dataType], 10).toString()),
|
|
39
42
|
chalk.cyan.bold(name),
|
|
@@ -43,7 +46,7 @@ export async function dumpEvent(session: IBasicSession, fields: string[], eventF
|
|
|
43
46
|
);
|
|
44
47
|
} else {
|
|
45
48
|
// tslint:disable-next-line: no-console
|
|
46
|
-
|
|
49
|
+
warningLog(
|
|
47
50
|
chalk.yellow(w("", 30), w(_fields[index], 25)),
|
|
48
51
|
chalk.cyan(w(DataType[variant.dataType as number], 10).toString()),
|
|
49
52
|
variant.value
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module node-opcua-client
|
|
3
3
|
*/
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
|
-
import
|
|
5
|
+
import chalk from "chalk";
|
|
6
6
|
import { assert } from "node-opcua-assert";
|
|
7
7
|
import { ServerState } from "node-opcua-common";
|
|
8
8
|
import { VariableIds } from "node-opcua-constants";
|
|
@@ -120,7 +120,6 @@ export class ClientSessionKeepAliveManager extends EventEmitter implements Clien
|
|
|
120
120
|
timeSinceLastServerContact
|
|
121
121
|
);
|
|
122
122
|
// no need to send a ping yet
|
|
123
|
-
// console.log("Skipping ",timeSinceLastServerContact,this.session.timeout);
|
|
124
123
|
return timeSinceLastServerContact - this.pingTimeout;
|
|
125
124
|
}
|
|
126
125
|
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as async from "async";
|
|
8
|
-
import
|
|
9
|
-
|
|
8
|
+
import chalk from "chalk";
|
|
10
9
|
import { withLock } from "@ster5/global-mutex";
|
|
11
10
|
import { assert } from "node-opcua-assert";
|
|
12
11
|
import { IOPCUASecureObjectOptions, OPCUASecureObject } from "node-opcua-common";
|
|
13
|
-
import { Certificate, makeSHA1Thumbprint, Nonce } from "node-opcua-crypto";
|
|
12
|
+
import { Certificate, makeSHA1Thumbprint, Nonce, split_der } from "node-opcua-crypto";
|
|
14
13
|
import { installPeriodicClockAdjustment, periodicClockAdjustment, uninstallPeriodicClockAdjustment } from "node-opcua-date-time";
|
|
15
14
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
16
15
|
|
|
@@ -750,11 +749,14 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
750
749
|
if ((this as any)._inCreateDefaultCertificate) {
|
|
751
750
|
errorLog("Internal error : re-entrancy in createDefaultCertificate!");
|
|
752
751
|
}
|
|
753
|
-
|
|
754
752
|
(this as any)._inCreateDefaultCertificate = true;
|
|
755
753
|
if (!fs.existsSync(this.certificateFile)) {
|
|
756
|
-
|
|
757
|
-
|
|
754
|
+
await withLock({ fileToLock: this.certificateFile + ".mutex" }, async () => {
|
|
755
|
+
if (fs.existsSync(this.certificateFile)) {
|
|
756
|
+
// the file may have been created in between
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
warningLog("Creating default certificate ... please wait");
|
|
758
760
|
if (this.disconnecting) return;
|
|
759
761
|
|
|
760
762
|
await ClientBaseImpl.createCertificate(
|
|
@@ -797,13 +799,10 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
797
799
|
if (!fs.existsSync(this.privateKeyFile)) {
|
|
798
800
|
throw new Error(" cannot locate private key file " + this.privateKeyFile);
|
|
799
801
|
}
|
|
800
|
-
|
|
801
802
|
if (this.disconnecting) return;
|
|
802
803
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
if (this.disconnecting) return;
|
|
806
|
-
await performCertificateSanityCheck.call(this, "client", this.clientCertificateManager, this._getBuiltApplicationUri());
|
|
804
|
+
await this.clientCertificateManager.withLock2(async () => {
|
|
805
|
+
await performCertificateSanityCheck(this, "client", this.clientCertificateManager, this._getBuiltApplicationUri());
|
|
807
806
|
});
|
|
808
807
|
}
|
|
809
808
|
|
|
@@ -811,13 +810,13 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
811
810
|
|
|
812
811
|
protected _handleUnrecoverableConnectionFailure(err: Error, callback: ErrorCallback): void {
|
|
813
812
|
debugLog(err.message);
|
|
814
|
-
this.emit("connection_failed");
|
|
813
|
+
this.emit("connection_failed", err);
|
|
815
814
|
this._setInternalState("disconnected");
|
|
816
815
|
return callback(err);
|
|
817
816
|
}
|
|
818
817
|
private _handleDisconnectionWhileConnecting(err: Error, callback: ErrorCallback) {
|
|
819
818
|
debugLog(err.message);
|
|
820
|
-
this.emit("connection_failed");
|
|
819
|
+
this.emit("connection_failed", err);
|
|
821
820
|
this._setInternalState("disconnected");
|
|
822
821
|
return callback(err);
|
|
823
822
|
}
|
|
@@ -1289,12 +1288,12 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
1289
1288
|
tmpChannel = null;
|
|
1290
1289
|
this._destroy_secure_channel();
|
|
1291
1290
|
this._setInternalState("disconnected");
|
|
1292
|
-
|
|
1291
|
+
callback();
|
|
1293
1292
|
});
|
|
1294
1293
|
} else {
|
|
1295
1294
|
this._setInternalState("disconnected");
|
|
1296
|
-
|
|
1297
|
-
|
|
1295
|
+
// this.emit("close", null);
|
|
1296
|
+
callback();
|
|
1298
1297
|
}
|
|
1299
1298
|
}
|
|
1300
1299
|
|
|
@@ -1416,14 +1415,28 @@ export class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase
|
|
|
1416
1415
|
_verify_serverCertificate(this.clientCertificateManager, endpoint.serverCertificate, (err1?: Error) => {
|
|
1417
1416
|
if (err1) {
|
|
1418
1417
|
warningLog("[NODE-OPCUA-W25] client's server certificate verification has failed ", err1.message);
|
|
1419
|
-
warningLog(" ", this.clientCertificateManager.rootDir);
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
)
|
|
1418
|
+
warningLog(" clientCertificateManager.rootDir = ", this.clientCertificateManager.rootDir);
|
|
1419
|
+
|
|
1420
|
+
const f = (b: Buffer) =>
|
|
1421
|
+
" " + b.toString("base64").replace(/(.{80})/g, "$1\n ");
|
|
1422
|
+
|
|
1423
|
+
const chain = split_der(endpoint.serverCertificate);
|
|
1424
|
+
warningLog(` server certificate contains ${chain.length} elements`);
|
|
1425
|
+
for (let i = 0; i < chain.length; i++) {
|
|
1426
|
+
const c = chain[i];
|
|
1427
|
+
warningLog("certificate", i, "\n" + f(c));
|
|
1428
|
+
}
|
|
1429
|
+
if (chain.length > 1) {
|
|
1430
|
+
warningLog(
|
|
1431
|
+
" verify also that the issuer certificate is trusted and the issuer's certificate is present in the issuer.cert folder\n" +
|
|
1432
|
+
" of the client certificate manager located in ",
|
|
1433
|
+
this.clientCertificateManager.rootDir
|
|
1434
|
+
);
|
|
1435
|
+
} else {
|
|
1436
|
+
warningLog(
|
|
1437
|
+
" verify that the server certificate is trusted or that server certificate issuer's certificate is present in the issuer folder"
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1427
1440
|
return callback(err1);
|
|
1428
1441
|
}
|
|
1429
1442
|
this.serverCertificate = endpoint.serverCertificate;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { types } from "util";
|
|
5
5
|
import * as async from "async";
|
|
6
|
-
import
|
|
6
|
+
import chalk from "chalk";
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
9
9
|
import { PublishRequest, PublishResponse, RepublishRequest, RepublishResponse } from "node-opcua-service-subscription";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { EventEmitter } from "events";
|
|
5
5
|
import { callbackify } from "util";
|
|
6
|
-
import
|
|
6
|
+
import chalk from "chalk";
|
|
7
7
|
import { assert } from "node-opcua-assert";
|
|
8
8
|
import { AggregateFunction } from "node-opcua-constants";
|
|
9
9
|
import { DateTime } from "node-opcua-basic-types";
|
|
@@ -309,7 +309,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
309
309
|
get subscriptionCount(): number {
|
|
310
310
|
return this._publishEngine ? this._publishEngine.subscriptionCount : 0;
|
|
311
311
|
}
|
|
312
|
-
|
|
312
|
+
|
|
313
313
|
get isReconnecting(): boolean {
|
|
314
314
|
return this._client ? this._client.isReconnecting || this._reconnecting?.reconnecting : false;
|
|
315
315
|
}
|
|
@@ -337,7 +337,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
337
337
|
this._client._activateSession(this, userIdentityInfo, (err1: Error | null, session2?: ClientSessionImpl) => {
|
|
338
338
|
if (err1) {
|
|
339
339
|
this.userIdentityInfo = old_userIdentity;
|
|
340
|
-
|
|
340
|
+
warningLog("activate session error = ", err1.message);
|
|
341
341
|
return callback!(null, StatusCodes.BadUserAccessDenied);
|
|
342
342
|
}
|
|
343
343
|
this.userIdentityInfo = userIdentityInfo;
|
|
@@ -450,8 +450,8 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
450
450
|
if (r.references && r.references.length > this.requestedMaxReferencesPerNode) {
|
|
451
451
|
warningLog(
|
|
452
452
|
chalk.yellow("warning") +
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
" BrowseResponse : the server didn't take into" +
|
|
454
|
+
" account our requestedMaxReferencesPerNode "
|
|
455
455
|
);
|
|
456
456
|
warningLog(" this.requestedMaxReferencesPerNode= " + this.requestedMaxReferencesPerNode);
|
|
457
457
|
warningLog(" got " + r.references.length + "for " + nodesToBrowse[i].nodeId.toString());
|
|
@@ -460,7 +460,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
for (const r of results) {
|
|
463
|
-
r.references = r.references || /* istanbul ignore next */[];
|
|
463
|
+
r.references = r.references || /* istanbul ignore next */ [];
|
|
464
464
|
}
|
|
465
465
|
assert(results[0] instanceof BrowseResult);
|
|
466
466
|
return callback(null, isArray ? results : results[0]);
|
|
@@ -546,7 +546,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
546
546
|
* ```javascript
|
|
547
547
|
* const dataValues = await session.readVariableValue(["ns=1;s=Temperature","ns=1;s=Pressure"]);
|
|
548
548
|
* ```
|
|
549
|
-
*
|
|
549
|
+
*
|
|
550
550
|
* @deprecated
|
|
551
551
|
*/
|
|
552
552
|
public readVariableValue(nodeId: NodeIdLike, callback: ResponseCallback<DataValue>): void;
|
|
@@ -759,7 +759,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
759
759
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
762
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
763
763
|
callback(null, response);
|
|
764
764
|
});
|
|
765
765
|
}
|
|
@@ -891,7 +891,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
891
891
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
892
892
|
}
|
|
893
893
|
|
|
894
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
894
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
895
895
|
|
|
896
896
|
assert(nodesToRead.length === response.results.length);
|
|
897
897
|
|
|
@@ -1034,7 +1034,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1034
1034
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1035
1035
|
return callback(new Error(response.responseHeader.serviceResult.toString()));
|
|
1036
1036
|
}
|
|
1037
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1037
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1038
1038
|
assert(nodesToWrite.length === response.results.length);
|
|
1039
1039
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1040
1040
|
});
|
|
@@ -1256,7 +1256,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1256
1256
|
warningLog(
|
|
1257
1257
|
chalk.yellow(
|
|
1258
1258
|
"please make sure to refactor your code and check that " +
|
|
1259
|
-
|
|
1259
|
+
"the second argument of your callback function is named"
|
|
1260
1260
|
),
|
|
1261
1261
|
chalk.cyan("dataValue" + (isArray ? "s" : ""))
|
|
1262
1262
|
);
|
|
@@ -1289,7 +1289,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1289
1289
|
|
|
1290
1290
|
// perform ExtensionObject resolution
|
|
1291
1291
|
promoteOpaqueStructureWithCallback(this, response.results!, () => {
|
|
1292
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1292
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1293
1293
|
return callback(null, isArray ? response.results : response.results[0]);
|
|
1294
1294
|
});
|
|
1295
1295
|
});
|
|
@@ -1490,7 +1490,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1490
1490
|
if (!response) {
|
|
1491
1491
|
return callback(new Error("Internal Error"));
|
|
1492
1492
|
}
|
|
1493
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1493
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1494
1494
|
callback(err, isArray ? response.results : response.results[0]);
|
|
1495
1495
|
}
|
|
1496
1496
|
);
|
|
@@ -1535,7 +1535,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1535
1535
|
if (!response || !(response instanceof TranslateBrowsePathsToNodeIdsResponse)) {
|
|
1536
1536
|
return callback(new Error("Internal Error"));
|
|
1537
1537
|
}
|
|
1538
|
-
response.results = response.results || /* istanbul ignore next */[];
|
|
1538
|
+
response.results = response.results || /* istanbul ignore next */ [];
|
|
1539
1539
|
|
|
1540
1540
|
callback(null, isArray ? response.results : response.results[0]);
|
|
1541
1541
|
});
|
|
@@ -1694,9 +1694,9 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1694
1694
|
if (response.responseHeader.serviceResult.isNot(StatusCodes.Good)) {
|
|
1695
1695
|
err = new Error(
|
|
1696
1696
|
" ServiceResult is " +
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1697
|
+
response.responseHeader.serviceResult.toString() +
|
|
1698
|
+
" request was " +
|
|
1699
|
+
request.constructor.name
|
|
1700
1700
|
);
|
|
1701
1701
|
|
|
1702
1702
|
if (response && response.responseHeader.serviceDiagnostics) {
|
|
@@ -1943,7 +1943,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
1943
1943
|
return callback(new Error("Internal Error"));
|
|
1944
1944
|
}
|
|
1945
1945
|
|
|
1946
|
-
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */[];
|
|
1946
|
+
response.registeredNodeIds = response.registeredNodeIds || /* istanbul ignore next */ [];
|
|
1947
1947
|
|
|
1948
1948
|
callback(null, response.registeredNodeIds);
|
|
1949
1949
|
});
|
|
@@ -2038,7 +2038,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2038
2038
|
const privateThis = this as any;
|
|
2039
2039
|
if (!(!privateThis.pendingTransactions || privateThis.pendingTransactions.length === 0)) {
|
|
2040
2040
|
// tslint:disable-next-line: no-console
|
|
2041
|
-
|
|
2041
|
+
warningLog("dispose when pendingTransactions is not empty ");
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
2044
|
|
|
@@ -2073,12 +2073,11 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2073
2073
|
str += "\n reviseTokenLifetime...... " + this._client._secureChannel.securityToken.revisedLifetime;
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
str += "\n keepAlive ................ " + this._keepAliveManager ? true:
|
|
2076
|
+
str += "\n keepAlive ................ " + this._keepAliveManager ? true : false;
|
|
2077
2077
|
if (this._keepAliveManager) {
|
|
2078
2078
|
str += "\n keepAlive checkInterval.. " + this._keepAliveManager.checkInterval;
|
|
2079
2079
|
str += "\n defaultTransportTimeout.. " + ClientSecureChannelLayer.defaultTransportTimeout;
|
|
2080
|
-
|
|
2081
|
-
}
|
|
2080
|
+
}
|
|
2082
2081
|
return str;
|
|
2083
2082
|
}
|
|
2084
2083
|
|
|
@@ -2277,7 +2276,7 @@ export class ClientSessionImpl extends EventEmitter implements ClientSession {
|
|
|
2277
2276
|
) {
|
|
2278
2277
|
if (this.recursive_repair_detector >= 1) {
|
|
2279
2278
|
// tslint:disable-next-line: no-console
|
|
2280
|
-
|
|
2279
|
+
warningLog("recreate_session_and_reperform_transaction => Already in Progress");
|
|
2281
2280
|
return callback(new Error("Cannot recreate session"));
|
|
2282
2281
|
}
|
|
2283
2282
|
this.recursive_repair_detector += 1;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// tslint:disable:unified-signatures
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
import * as async from "async";
|
|
7
|
-
import
|
|
7
|
+
import chalk from "chalk";
|
|
8
8
|
|
|
9
9
|
import { assert } from "node-opcua-assert";
|
|
10
10
|
import { AttributeIds } from "node-opcua-data-model";
|