node-opcua-client 2.98.0 → 2.98.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alarms_and_conditions/client_alarm.d.ts +49 -0
- package/dist/alarms_and_conditions/client_alarm.js +110 -0
- package/dist/alarms_and_conditions/client_alarm.js.map +1 -0
- package/dist/alarms_and_conditions/client_alarm_list.d.ts +25 -0
- package/dist/alarms_and_conditions/client_alarm_list.js +98 -0
- package/dist/alarms_and_conditions/client_alarm_list.js.map +1 -0
- package/dist/alarms_and_conditions/client_alarm_tools.d.ts +4 -0
- package/dist/alarms_and_conditions/client_alarm_tools.js +157 -0
- package/dist/alarms_and_conditions/client_alarm_tools.js.map +1 -0
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.d.ts +18 -0
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js +193 -0
- package/dist/alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions.js.map +1 -0
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.d.ts +9 -0
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js +73 -0
- package/dist/alarms_and_conditions/client_alarm_tools_dump_event.js.map +1 -0
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.d.ts +3 -0
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js +119 -0
- package/dist/alarms_and_conditions/client_alarm_tools_extractConditionFields.js.map +1 -0
- package/dist/alarms_and_conditions/client_tools.d.ts +7 -0
- package/dist/alarms_and_conditions/client_tools.js +180 -0
- package/dist/alarms_and_conditions/client_tools.js.map +1 -0
- package/dist/client_base.d.ts +277 -0
- package/dist/client_base.js +15 -0
- package/dist/client_base.js.map +1 -0
- package/dist/client_monitored_item.d.ts +21 -0
- package/dist/client_monitored_item.js +12 -0
- package/dist/client_monitored_item.js.map +1 -0
- package/dist/client_monitored_item_base.d.ts +39 -0
- package/dist/client_monitored_item_base.js +3 -0
- package/dist/client_monitored_item_base.js.map +1 -0
- package/dist/client_monitored_item_group.d.ts +21 -0
- package/dist/client_monitored_item_group.js +14 -0
- package/dist/client_monitored_item_group.js.map +1 -0
- package/dist/client_monitored_item_toolbox.d.ts +15 -0
- package/dist/client_monitored_item_toolbox.js +117 -0
- package/dist/client_monitored_item_toolbox.js.map +1 -0
- package/dist/client_session.d.ts +529 -0
- package/dist/client_session.js +11 -0
- package/dist/client_session.js.map +1 -0
- package/dist/client_session_keepalive_manager.d.ts +34 -0
- package/dist/client_session_keepalive_manager.js +150 -0
- package/dist/client_session_keepalive_manager.js.map +1 -0
- package/dist/client_subscription.d.ts +241 -0
- package/dist/client_subscription.js +15 -0
- package/dist/client_subscription.js.map +1 -0
- package/dist/client_utils.d.ts +22 -0
- package/dist/client_utils.js +88 -0
- package/dist/client_utils.js.map +1 -0
- package/dist/common.d.ts +17 -0
- package/dist/common.js +6 -0
- package/dist/common.js.map +1 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/opcua_client.d.ts +118 -0
- package/dist/opcua_client.js +34 -0
- package/dist/opcua_client.js.map +1 -0
- package/dist/private/client_base_impl.d.ts +160 -0
- package/dist/private/client_base_impl.js +1349 -0
- package/dist/private/client_base_impl.js.map +1 -0
- package/dist/private/client_monitored_item_base_impl.d.ts +3 -0
- package/dist/private/client_monitored_item_base_impl.js +5 -0
- package/dist/private/client_monitored_item_base_impl.js.map +1 -0
- package/dist/private/client_monitored_item_group_impl.d.ts +53 -0
- package/dist/private/client_monitored_item_group_impl.js +162 -0
- package/dist/private/client_monitored_item_group_impl.js.map +1 -0
- package/dist/private/client_monitored_item_impl.d.ts +93 -0
- package/dist/private/client_monitored_item_impl.js +305 -0
- package/dist/private/client_monitored_item_impl.js.map +1 -0
- package/dist/private/client_publish_engine.d.ts +62 -0
- package/dist/private/client_publish_engine.js +409 -0
- package/dist/private/client_publish_engine.js.map +1 -0
- package/dist/private/client_session_impl.d.ts +631 -0
- package/dist/private/client_session_impl.js +1349 -0
- package/dist/private/client_session_impl.js.map +1 -0
- package/dist/private/client_subscription_impl.d.ts +93 -0
- package/dist/private/client_subscription_impl.js +780 -0
- package/dist/private/client_subscription_impl.js.map +1 -0
- package/dist/private/i_private_client.d.ts +21 -0
- package/dist/private/i_private_client.js +3 -0
- package/dist/private/i_private_client.js.map +1 -0
- package/dist/private/opcua_client_impl.d.ts +166 -0
- package/dist/private/opcua_client_impl.js +1001 -0
- package/dist/private/opcua_client_impl.js.map +1 -0
- package/dist/private/performance.d.ts +1 -0
- package/dist/private/performance.js +19 -0
- package/dist/private/performance.js.map +1 -0
- package/dist/reconnection.d.ts +9 -0
- package/dist/reconnection.js +382 -0
- package/dist/reconnection.js.map +1 -0
- package/dist/tools/findservers.d.ts +20 -0
- package/dist/tools/findservers.js +62 -0
- package/dist/tools/findservers.js.map +1 -0
- package/dist/tools/read_history_server_capabilities.d.ts +6 -0
- package/dist/tools/read_history_server_capabilities.js +99 -0
- package/dist/tools/read_history_server_capabilities.js.map +1 -0
- package/dist/user_identity_info.d.ts +1 -0
- package/dist/user_identity_info.js +3 -0
- package/dist/user_identity_info.js.map +1 -0
- package/dist/verify.d.ts +5 -0
- package/dist/verify.js +135 -0
- package/dist/verify.js.map +1 -0
- package/package.json +48 -44
- package/.nycrc.json +0 -14
- package/test_helpers/create_certificates.js +0 -1
- package/typedoc.js +0 -20
package/dist/index.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module node-opcua-client
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.readNamespaceArray = exports.browseAll = exports.makeApplicationUrn = exports.StatusCodes = exports.StatusCode = exports.coerceExpandedNodeId = exports.makeExpandedNodeId = exports.ExpandedNodeId = exports.sameNodeId = exports.coerceNodeId = exports.makeNodeId = exports.resolveNodeId = exports.NodeId = exports.hexDump = exports.crypto_utils = exports.utils = exports.ClientSecureChannelLayer = exports.SecurityPolicy = exports.ServiceCounterDataType = exports.ServerState = exports.ClientSidePublishEngine = exports.assert = void 0;
|
|
21
|
+
__exportStar(require("./client_base"), exports);
|
|
22
|
+
__exportStar(require("./opcua_client"), exports);
|
|
23
|
+
__exportStar(require("./client_session"), exports);
|
|
24
|
+
__exportStar(require("./client_subscription"), exports);
|
|
25
|
+
__exportStar(require("./client_monitored_item_base"), exports);
|
|
26
|
+
__exportStar(require("./client_monitored_item"), exports);
|
|
27
|
+
__exportStar(require("./client_monitored_item_group"), exports);
|
|
28
|
+
__exportStar(require("./alarms_and_conditions/client_tools"), exports);
|
|
29
|
+
__exportStar(require("./alarms_and_conditions/client_alarm"), exports);
|
|
30
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_list"), exports);
|
|
31
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_tools"), exports);
|
|
32
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_tools_extractConditionFields"), exports);
|
|
33
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_tools_dump_event"), exports);
|
|
34
|
+
__exportStar(require("./alarms_and_conditions/client_alarm_tools_acknowledge_all_conditions"), exports);
|
|
35
|
+
__exportStar(require("./tools/findservers"), exports);
|
|
36
|
+
__exportStar(require("./tools/read_history_server_capabilities"), exports);
|
|
37
|
+
__exportStar(require("./client_utils"), exports);
|
|
38
|
+
__exportStar(require("./verify"), exports);
|
|
39
|
+
__exportStar(require("./user_identity_info"), exports);
|
|
40
|
+
var node_opcua_assert_1 = require("node-opcua-assert");
|
|
41
|
+
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return node_opcua_assert_1.assert; } });
|
|
42
|
+
__exportStar(require("node-opcua-utils"), exports);
|
|
43
|
+
var client_publish_engine_1 = require("./private/client_publish_engine");
|
|
44
|
+
Object.defineProperty(exports, "ClientSidePublishEngine", { enumerable: true, get: function () { return client_publish_engine_1.ClientSidePublishEngine; } });
|
|
45
|
+
var node_opcua_common_1 = require("node-opcua-common");
|
|
46
|
+
Object.defineProperty(exports, "ServerState", { enumerable: true, get: function () { return node_opcua_common_1.ServerState; } });
|
|
47
|
+
Object.defineProperty(exports, "ServiceCounterDataType", { enumerable: true, get: function () { return node_opcua_common_1.ServiceCounterDataType; } });
|
|
48
|
+
var node_opcua_secure_channel_1 = require("node-opcua-secure-channel");
|
|
49
|
+
Object.defineProperty(exports, "SecurityPolicy", { enumerable: true, get: function () { return node_opcua_secure_channel_1.SecurityPolicy; } });
|
|
50
|
+
Object.defineProperty(exports, "ClientSecureChannelLayer", { enumerable: true, get: function () { return node_opcua_secure_channel_1.ClientSecureChannelLayer; } });
|
|
51
|
+
const utils1 = require("node-opcua-utils");
|
|
52
|
+
exports.utils = utils1;
|
|
53
|
+
const crypto_util1 = require("node-opcua-crypto");
|
|
54
|
+
exports.crypto_utils = crypto_util1;
|
|
55
|
+
var node_opcua_debug_1 = require("node-opcua-debug");
|
|
56
|
+
Object.defineProperty(exports, "hexDump", { enumerable: true, get: function () { return node_opcua_debug_1.hexDump; } });
|
|
57
|
+
///
|
|
58
|
+
var node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
59
|
+
Object.defineProperty(exports, "NodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.NodeId; } });
|
|
60
|
+
Object.defineProperty(exports, "resolveNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.resolveNodeId; } });
|
|
61
|
+
Object.defineProperty(exports, "makeNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.makeNodeId; } });
|
|
62
|
+
Object.defineProperty(exports, "coerceNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.coerceNodeId; } });
|
|
63
|
+
Object.defineProperty(exports, "sameNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.sameNodeId; } });
|
|
64
|
+
Object.defineProperty(exports, "ExpandedNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.ExpandedNodeId; } });
|
|
65
|
+
Object.defineProperty(exports, "makeExpandedNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.makeExpandedNodeId; } });
|
|
66
|
+
Object.defineProperty(exports, "coerceExpandedNodeId", { enumerable: true, get: function () { return node_opcua_nodeid_1.coerceExpandedNodeId; } });
|
|
67
|
+
var node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
68
|
+
Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return node_opcua_status_code_1.StatusCode; } });
|
|
69
|
+
Object.defineProperty(exports, "StatusCodes", { enumerable: true, get: function () { return node_opcua_status_code_1.StatusCodes; } });
|
|
70
|
+
__exportStar(require("node-opcua-variant"), exports);
|
|
71
|
+
__exportStar(require("node-opcua-data-value"), exports);
|
|
72
|
+
__exportStar(require("node-opcua-data-model"), exports);
|
|
73
|
+
__exportStar(require("node-opcua-constants"), exports);
|
|
74
|
+
__exportStar(require("node-opcua-secure-channel"), exports);
|
|
75
|
+
var node_opcua_common_2 = require("node-opcua-common");
|
|
76
|
+
Object.defineProperty(exports, "makeApplicationUrn", { enumerable: true, get: function () { return node_opcua_common_2.makeApplicationUrn; } });
|
|
77
|
+
__exportStar(require("node-opcua-service-endpoints"), exports);
|
|
78
|
+
__exportStar(require("node-opcua-service-browse"), exports);
|
|
79
|
+
__exportStar(require("node-opcua-service-call"), exports);
|
|
80
|
+
__exportStar(require("node-opcua-service-discovery"), exports);
|
|
81
|
+
__exportStar(require("node-opcua-service-endpoints"), exports);
|
|
82
|
+
__exportStar(require("node-opcua-service-history"), exports);
|
|
83
|
+
__exportStar(require("node-opcua-service-query"), exports);
|
|
84
|
+
__exportStar(require("node-opcua-service-read"), exports);
|
|
85
|
+
__exportStar(require("node-opcua-service-secure-channel"), exports);
|
|
86
|
+
__exportStar(require("node-opcua-service-session"), exports);
|
|
87
|
+
__exportStar(require("node-opcua-service-subscription"), exports);
|
|
88
|
+
__exportStar(require("node-opcua-service-translate-browse-path"), exports);
|
|
89
|
+
__exportStar(require("node-opcua-service-write"), exports);
|
|
90
|
+
__exportStar(require("node-opcua-service-filter"), exports);
|
|
91
|
+
var node_opcua_pseudo_session_1 = require("node-opcua-pseudo-session");
|
|
92
|
+
Object.defineProperty(exports, "browseAll", { enumerable: true, get: function () { return node_opcua_pseudo_session_1.browseAll; } });
|
|
93
|
+
Object.defineProperty(exports, "readNamespaceArray", { enumerable: true, get: function () { return node_opcua_pseudo_session_1.readNamespaceArray; } });
|
|
94
|
+
__exportStar(require("node-opcua-client-dynamic-extension-object"), exports);
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,wDAAsC;AACtC,+DAA6C;AAC7C,0DAAwC;AACxC,gEAA8C;AAC9C,uEAAqD;AACrD,uEAAqD;AACrD,4EAA0D;AAC1D,6EAA2D;AAC3D,oGAAkF;AAClF,wFAAsE;AACtE,wGAAsF;AACtF,sDAAoC;AACpC,2EAAyD;AACzD,iDAA+B;AAC/B,2CAAyB;AACzB,uDAAqC;AAErC,uDAA2C;AAAlC,2GAAA,MAAM,OAAA;AACf,mDAAiC;AAEjC,yEAA0E;AAAjE,gIAAA,uBAAuB,OAAA;AAEhC,uDAAwE;AAA/D,gHAAA,WAAW,OAAA;AAAE,2HAAA,sBAAsB,OAAA;AAE5C,uEAAgH;AAAvG,2HAAA,cAAc,OAAA;AAAE,qIAAA,wBAAwB,OAAA;AAEjD,2CAA2C;AAC9B,QAAA,KAAK,GAAG,MAAM,CAAC;AAE5B,kDAAkD;AACrC,QAAA,YAAY,GAAG,YAAY,CAAC;AAEzC,qDAA2C;AAAlC,2GAAA,OAAO,OAAA;AAEhB,GAAG;AACH,uDAS2B;AARvB,2GAAA,MAAM,OAAA;AACN,kHAAA,aAAa,OAAA;AACb,+GAAA,UAAU,OAAA;AACV,iHAAA,YAAY,OAAA;AACZ,+GAAA,UAAU,OAAA;AACV,mHAAA,cAAc,OAAA;AACd,uHAAA,kBAAkB,OAAA;AAClB,yHAAA,oBAAoB,OAAA;AAExB,iEAAiE;AAAxD,oHAAA,UAAU,OAAA;AAAE,qHAAA,WAAW,OAAA;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,uDAAuD;AAA9C,uHAAA,kBAAkB,OAAA;AAE3B,+DAA6C;AAC7C,4DAA0C;AAC1C,0DAAwC;AACxC,+DAA6C;AAC7C,+DAA6C;AAC7C,6DAA2C;AAC3C,2DAAyC;AACzC,0DAAwC;AACxC,oEAAkD;AAClD,6DAA2C;AAC3C,kEAAgD;AAChD,2EAAyD;AACzD,2DAAyC;AACzC,4DAA0C;AAC1C,uEAAyF;AAAjE,sHAAA,SAAS,OAAA;AAAE,+HAAA,kBAAkB,OAAA;AACrD,6EAA2D"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-client
|
|
3
|
+
*/
|
|
4
|
+
import { Certificate } from "node-opcua-crypto";
|
|
5
|
+
import { ConnectionStrategyOptions, SecurityPolicy } from "node-opcua-secure-channel";
|
|
6
|
+
import { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
|
|
7
|
+
import { MessageSecurityMode } from "node-opcua-service-secure-channel";
|
|
8
|
+
import { CallbackT, ErrorCallback, StatusCode } from "node-opcua-status-code";
|
|
9
|
+
import { FindServersRequestLike, GetEndpointsOptions, OPCUAClientBase, OPCUAClientBaseOptions } from "./client_base";
|
|
10
|
+
import { ClientSession, ResponseCallback } from "./client_session";
|
|
11
|
+
import { ClientSubscription, ClientSubscriptionOptions } from "./client_subscription";
|
|
12
|
+
import { UserIdentityInfo } from "./user_identity_info";
|
|
13
|
+
export interface OPCUAClientOptions extends OPCUAClientBaseOptions {
|
|
14
|
+
/**
|
|
15
|
+
* the requested session timeout in CreateSession (ms)
|
|
16
|
+
*
|
|
17
|
+
* Note:
|
|
18
|
+
* - make sure that this value is large enough, especially larger than the
|
|
19
|
+
* time between two transactions to the server.
|
|
20
|
+
*
|
|
21
|
+
* - If your client establishes a subscription with the server, make sure that
|
|
22
|
+
* (maxKeepAliveCount * publishingInterval) calculated with negotiated values
|
|
23
|
+
* from the server stay by large below the session time out, as you make
|
|
24
|
+
* encountered unexpected behavior.
|
|
25
|
+
*
|
|
26
|
+
* @default 60000 - default value is 60 secondes
|
|
27
|
+
*/
|
|
28
|
+
requestedSessionTimeout?: number;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated(use endpointMustExist instead)
|
|
31
|
+
*/
|
|
32
|
+
endpoint_must_exist?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* set to false if the client should accept server endpoint mismatch
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
endpointMustExist?: boolean;
|
|
38
|
+
connectionStrategy?: ConnectionStrategyOptions;
|
|
39
|
+
/** the server certificate. */
|
|
40
|
+
serverCertificate?: Certificate;
|
|
41
|
+
/***
|
|
42
|
+
* default secure token lifetime in ms
|
|
43
|
+
*/
|
|
44
|
+
defaultSecureTokenLifetime?: number;
|
|
45
|
+
/**
|
|
46
|
+
* the security mode
|
|
47
|
+
* @default MessageSecurityMode.None
|
|
48
|
+
*/
|
|
49
|
+
securityMode?: MessageSecurityMode | string;
|
|
50
|
+
/**
|
|
51
|
+
* the security policy
|
|
52
|
+
* @default SecurityPolicy.None
|
|
53
|
+
*/
|
|
54
|
+
securityPolicy?: SecurityPolicy | string;
|
|
55
|
+
/**
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
keepSessionAlive?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* client certificate pem file.
|
|
61
|
+
* @default "certificates/client_self-signed_cert_2048.pem"
|
|
62
|
+
*/
|
|
63
|
+
certificateFile?: string;
|
|
64
|
+
/**
|
|
65
|
+
* client private key pem file.
|
|
66
|
+
* @default "certificates/client_key_2048.pem"
|
|
67
|
+
*/
|
|
68
|
+
privateKeyFile?: string;
|
|
69
|
+
/**
|
|
70
|
+
* a client name string that will be used to generate session names.
|
|
71
|
+
*/
|
|
72
|
+
clientName?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface OPCUAClient extends OPCUAClientBase {
|
|
75
|
+
connect(endpointUrl: string): Promise<void>;
|
|
76
|
+
connect(endpointUrl: string, callback: ErrorCallback): void;
|
|
77
|
+
disconnect(): Promise<void>;
|
|
78
|
+
disconnect(callback: ErrorCallback): void;
|
|
79
|
+
getEndpoints(options?: GetEndpointsOptions): Promise<EndpointDescription[]>;
|
|
80
|
+
getEndpoints(options: GetEndpointsOptions, callback: ResponseCallback<EndpointDescription[]>): void;
|
|
81
|
+
getEndpoints(callback: ResponseCallback<EndpointDescription[]>): void;
|
|
82
|
+
findServers(options?: FindServersRequestLike): Promise<ApplicationDescription[]>;
|
|
83
|
+
findServers(options: FindServersRequestLike, callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
84
|
+
findServers(callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
85
|
+
createSession(userIdentityInfo?: UserIdentityInfo): Promise<ClientSession>;
|
|
86
|
+
createSession(userIdentityInfo: UserIdentityInfo, callback: (err: Error | null, session?: ClientSession) => void): void;
|
|
87
|
+
createSession(callback: (err: Error | null, session?: ClientSession) => void): void;
|
|
88
|
+
createSession2(userIdentityInfo?: UserIdentityInfo): Promise<ClientSession>;
|
|
89
|
+
createSession2(userIdentityInfo: UserIdentityInfo, callback: (err: Error | null, session?: ClientSession) => void): void;
|
|
90
|
+
createSession2(callback: (err: Error | null, session?: ClientSession) => void): void;
|
|
91
|
+
/** @deprecated */
|
|
92
|
+
changeSessionIdentity(session: ClientSession, userIdentityInfo: UserIdentityInfo): Promise<StatusCode>;
|
|
93
|
+
changeSessionIdentity(session: ClientSession, userIdentityInfo: UserIdentityInfo, callback: CallbackT<StatusCode>): void;
|
|
94
|
+
closeSession(session: ClientSession, deleteSubscriptions: boolean): Promise<void>;
|
|
95
|
+
closeSession(session: ClientSession, deleteSubscriptions: boolean, callback: (err?: Error) => void): void;
|
|
96
|
+
reactivateSession(session: ClientSession): Promise<void>;
|
|
97
|
+
reactivateSession(session: ClientSession, callback: (err?: Error) => void): void;
|
|
98
|
+
createDefaultCertificate(): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
export interface EndpointWithUserIdentity {
|
|
101
|
+
endpointUrl: string;
|
|
102
|
+
userIdentity: UserIdentityInfo;
|
|
103
|
+
}
|
|
104
|
+
export type WithSessionFunc = (session: ClientSession) => Promise<void>;
|
|
105
|
+
export type WithSessionFuncP<T> = (session: ClientSession) => Promise<T>;
|
|
106
|
+
export type WithSubscriptionFunc = (session: ClientSession, subscription: ClientSubscription) => Promise<void>;
|
|
107
|
+
export type WithSubscriptionFuncP<T> = (session: ClientSession, subscription: ClientSubscription) => Promise<T>;
|
|
108
|
+
export interface OPCUAClient {
|
|
109
|
+
withSessionAsync<T>(endpointUrl: string | EndpointWithUserIdentity, inner_func: WithSessionFuncP<T>): Promise<T>;
|
|
110
|
+
withSession(endpointUrl: string | EndpointWithUserIdentity, inner_func: (session: ClientSession, done: (err?: Error) => void) => void, callback: (err?: Error) => void): void;
|
|
111
|
+
withSubscriptionAsync<T>(endpointUrl: string | EndpointWithUserIdentity, parameters: ClientSubscriptionOptions, inner_func: WithSubscriptionFuncP<T>): Promise<T>;
|
|
112
|
+
}
|
|
113
|
+
export declare class OPCUAClient {
|
|
114
|
+
static create(options: OPCUAClientOptions): OPCUAClient;
|
|
115
|
+
static createSession(endpointUrl: string, userIdentity?: UserIdentityInfo, clientOptions?: OPCUAClientOptions): Promise<ClientSession>;
|
|
116
|
+
static set minimumRevisedSessionTimeout(minimumRevisedSessionTimeout: number);
|
|
117
|
+
static get minimumRevisedSessionTimeout(): number;
|
|
118
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module node-opcua-client
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.OPCUAClient = void 0;
|
|
16
|
+
const opcua_client_impl_1 = require("./private/opcua_client_impl");
|
|
17
|
+
class OPCUAClient {
|
|
18
|
+
static create(options) {
|
|
19
|
+
return new opcua_client_impl_1.OPCUAClientImpl(options);
|
|
20
|
+
}
|
|
21
|
+
static createSession(endpointUrl, userIdentity, clientOptions) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return opcua_client_impl_1.OPCUAClientImpl.createSession(endpointUrl, userIdentity, clientOptions);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
static set minimumRevisedSessionTimeout(minimumRevisedSessionTimeout) {
|
|
27
|
+
opcua_client_impl_1.OPCUAClientImpl.minimumRevisedSessionTimeout = minimumRevisedSessionTimeout;
|
|
28
|
+
}
|
|
29
|
+
static get minimumRevisedSessionTimeout() {
|
|
30
|
+
return opcua_client_impl_1.OPCUAClientImpl.minimumRevisedSessionTimeout;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.OPCUAClient = OPCUAClient;
|
|
34
|
+
//# sourceMappingURL=opcua_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opcua_client.js","sourceRoot":"","sources":["../source/opcua_client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAaH,mEAA8D;AAqJ9D,MAAa,WAAW;IACb,MAAM,CAAC,MAAM,CAAC,OAA2B;QAC5C,OAAO,IAAI,mCAAe,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IACM,MAAM,CAAO,aAAa,CAC7B,WAAmB,EACnB,YAA+B,EAC/B,aAAkC;;YAElC,OAAO,mCAAe,CAAC,aAAa,CAAC,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;QACnF,CAAC;KAAA;IACM,MAAM,KAAK,4BAA4B,CAAC,4BAAoC;QAC/E,mCAAe,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IAChF,CAAC;IACM,MAAM,KAAK,4BAA4B;QAC1C,OAAO,mCAAe,CAAC,4BAA4B,CAAC;IACxD,CAAC;CACJ;AAjBD,kCAiBC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { OPCUASecureObject } from "node-opcua-common";
|
|
2
|
+
import { Certificate, Nonce } from "node-opcua-crypto";
|
|
3
|
+
import { IBasicTransportSettings } from "node-opcua-pseudo-session";
|
|
4
|
+
import { ClientSecureChannelLayer, ConnectionStrategy, ConnectionStrategyOptions, SecurityPolicy } from "node-opcua-secure-channel";
|
|
5
|
+
import { ServerOnNetwork } from "node-opcua-service-discovery";
|
|
6
|
+
import { ApplicationDescription, EndpointDescription } from "node-opcua-service-endpoints";
|
|
7
|
+
import { MessageSecurityMode } from "node-opcua-service-secure-channel";
|
|
8
|
+
import { ErrorCallback } from "node-opcua-status-code";
|
|
9
|
+
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
10
|
+
import { ResponseCallback } from "../client_session";
|
|
11
|
+
import { Request, Response } from "../common";
|
|
12
|
+
import { CreateSecureChannelCallbackFunc, FindServersOnNetworkRequestLike, FindServersRequestLike, GetEndpointsOptions, OPCUAClientBase, OPCUAClientBaseOptions } from "../client_base";
|
|
13
|
+
import { UserIdentityInfo } from "../user_identity_info";
|
|
14
|
+
import { ClientSessionImpl } from "./client_session_impl";
|
|
15
|
+
import { IClientBase } from "./i_private_client";
|
|
16
|
+
type InternalClientState = "uninitialized" | "disconnected" | "connecting" | "connected" | "reconnecting" | "reconnecting_newchannel_connected" | "disconnecting";
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare class ClientBaseImpl extends OPCUASecureObject implements OPCUAClientBase, IClientBase {
|
|
21
|
+
/**
|
|
22
|
+
* total number of requests that been canceled due to timeout
|
|
23
|
+
*/
|
|
24
|
+
get timedOutRequestCount(): number;
|
|
25
|
+
/**
|
|
26
|
+
* total number of transactions performed by the client
|
|
27
|
+
x */
|
|
28
|
+
get transactionsPerformed(): number;
|
|
29
|
+
/**
|
|
30
|
+
* is true when the client has already requested the server end points.
|
|
31
|
+
*/
|
|
32
|
+
get knowsServerEndpoint(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* true if the client is trying to reconnect to the server after a connection break.
|
|
35
|
+
*/
|
|
36
|
+
get isReconnecting(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* true if the connection strategy is set to automatically try to reconnect in case of failure
|
|
39
|
+
*/
|
|
40
|
+
get reconnectOnFailure(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* total number of bytes read by the client
|
|
43
|
+
*/
|
|
44
|
+
get bytesRead(): number;
|
|
45
|
+
/**
|
|
46
|
+
* total number of bytes written by the client
|
|
47
|
+
*/
|
|
48
|
+
get bytesWritten(): number;
|
|
49
|
+
securityMode: MessageSecurityMode;
|
|
50
|
+
securityPolicy: SecurityPolicy;
|
|
51
|
+
serverCertificate?: Certificate;
|
|
52
|
+
clientName: string;
|
|
53
|
+
protocolVersion: 0;
|
|
54
|
+
defaultSecureTokenLifetime: number;
|
|
55
|
+
tokenRenewalInterval: number;
|
|
56
|
+
connectionStrategy: ConnectionStrategy;
|
|
57
|
+
keepPendingSessionsOnDisconnect: boolean;
|
|
58
|
+
endpointUrl: string;
|
|
59
|
+
discoveryUrl: string;
|
|
60
|
+
readonly applicationName: string;
|
|
61
|
+
private _applicationUri;
|
|
62
|
+
/**
|
|
63
|
+
* true if session shall periodically probe the server to keep the session alive and prevent timeout
|
|
64
|
+
*/
|
|
65
|
+
keepSessionAlive: boolean;
|
|
66
|
+
_sessions: ClientSessionImpl[];
|
|
67
|
+
protected _serverEndpoints: EndpointDescription[];
|
|
68
|
+
_secureChannel: ClientSecureChannelLayer | null;
|
|
69
|
+
protected disconnecting: boolean;
|
|
70
|
+
private _byteRead;
|
|
71
|
+
private _byteWritten;
|
|
72
|
+
private _timedOutRequestCount;
|
|
73
|
+
private _transactionsPerformed;
|
|
74
|
+
private _reconnectionIsCanceled;
|
|
75
|
+
private _clockAdjuster?;
|
|
76
|
+
private _tmpClient?;
|
|
77
|
+
private _instanceNumber;
|
|
78
|
+
private _transportSettings;
|
|
79
|
+
clientCertificateManager: OPCUACertificateManager;
|
|
80
|
+
protected _setInternalState(internalState: InternalClientState): void;
|
|
81
|
+
emit(eventName: string | symbol, ...others: any[]): boolean;
|
|
82
|
+
constructor(options?: OPCUAClientBaseOptions);
|
|
83
|
+
private _cancel_reconnection;
|
|
84
|
+
_recreate_secure_channel(callback: ErrorCallback): void;
|
|
85
|
+
_internal_create_secure_channel(connectionStrategy: ConnectionStrategyOptions, callback: CreateSecureChannelCallbackFunc): void;
|
|
86
|
+
static createCertificate(clientCertificateManager: OPCUACertificateManager, certificateFile: string, applicationName: string, applicationUri: string): Promise<void>;
|
|
87
|
+
createDefaultCertificate(): Promise<void>;
|
|
88
|
+
protected _getBuiltApplicationUri(): string;
|
|
89
|
+
protected initializeCM(): Promise<void>;
|
|
90
|
+
protected _internalState: InternalClientState;
|
|
91
|
+
protected _handleUnrecoverableConnectionFailure(err: Error, callback: ErrorCallback): void;
|
|
92
|
+
private _handleDisconnectionWhileConnecting;
|
|
93
|
+
private _handleSuccessfulConnection;
|
|
94
|
+
/**
|
|
95
|
+
* connect the OPC-UA client to a server end point.
|
|
96
|
+
* @async
|
|
97
|
+
*/
|
|
98
|
+
connect(endpointUrl: string): Promise<void>;
|
|
99
|
+
connect(endpointUrl: string, callback: ErrorCallback): void;
|
|
100
|
+
/**
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
_connectStep2(endpointUrl: string, callback: ErrorCallback): void;
|
|
104
|
+
getClientNonce(): Nonce | null;
|
|
105
|
+
performMessageTransaction(request: Request, callback: ResponseCallback<Response>): void;
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* return the endpoint information matching security mode and security policy.
|
|
109
|
+
* @method findEndpoint
|
|
110
|
+
*/
|
|
111
|
+
findEndpointForSecurity(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy): EndpointDescription | undefined;
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* return the endpoint information matching the specified url , security mode and security policy.
|
|
115
|
+
* @method findEndpoint
|
|
116
|
+
*/
|
|
117
|
+
findEndpoint(endpointUrl: string, securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy): EndpointDescription | undefined;
|
|
118
|
+
getEndpoints(options?: GetEndpointsOptions): Promise<EndpointDescription[]>;
|
|
119
|
+
getEndpoints(options: GetEndpointsOptions, callback: ResponseCallback<EndpointDescription[]>): void;
|
|
120
|
+
getEndpoints(callback: ResponseCallback<EndpointDescription[]>): void;
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated
|
|
123
|
+
*/
|
|
124
|
+
getEndpointsRequest(options: GetEndpointsOptions, callback: ResponseCallback<EndpointDescription[]>): void;
|
|
125
|
+
/**
|
|
126
|
+
* @method findServers
|
|
127
|
+
*/
|
|
128
|
+
findServers(options?: FindServersRequestLike): Promise<ApplicationDescription[]>;
|
|
129
|
+
findServers(options: FindServersRequestLike, callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
130
|
+
findServers(callback: ResponseCallback<ApplicationDescription[]>): void;
|
|
131
|
+
findServersOnNetwork(options?: FindServersOnNetworkRequestLike): Promise<ServerOnNetwork[]>;
|
|
132
|
+
findServersOnNetwork(callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
133
|
+
findServersOnNetwork(options: FindServersOnNetworkRequestLike, callback: ResponseCallback<ServerOnNetwork[]>): void;
|
|
134
|
+
_removeSession(session: ClientSessionImpl): void;
|
|
135
|
+
private _closeSession;
|
|
136
|
+
closeSession(...args: any[]): any;
|
|
137
|
+
disconnect(): Promise<void>;
|
|
138
|
+
disconnect(callback: ErrorCallback): void;
|
|
139
|
+
_on_connection_reestablished(callback: ErrorCallback): void;
|
|
140
|
+
toString(): string;
|
|
141
|
+
getSessions(): ClientSessionImpl[];
|
|
142
|
+
getTransportSettings(): IBasicTransportSettings;
|
|
143
|
+
protected _addSession(session: ClientSessionImpl): void;
|
|
144
|
+
private fetchServerCertificate;
|
|
145
|
+
private _accumulate_statistics;
|
|
146
|
+
private _destroy_secure_channel;
|
|
147
|
+
private _close_pending_sessions;
|
|
148
|
+
private _install_secure_channel_event_handlers;
|
|
149
|
+
_inside_repairConnection: boolean;
|
|
150
|
+
private _repairConnection;
|
|
151
|
+
private _finalReconnectionStep;
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @internal
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
__createSession_step2(session: ClientSessionImpl, callback: (err: Error | null, session?: ClientSessionImpl) => void): void;
|
|
158
|
+
_activateSession(session: ClientSessionImpl, userIdentity: UserIdentityInfo, callback: (err: Error | null, session?: ClientSessionImpl) => void): void;
|
|
159
|
+
}
|
|
160
|
+
export {};
|