node-opcua-server 2.97.0 → 2.98.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.
Files changed (91) hide show
  1. package/package.json +43 -43
  2. package/dist/base_server.d.ts +0 -110
  3. package/dist/base_server.js +0 -491
  4. package/dist/base_server.js.map +0 -1
  5. package/dist/factory.d.ts +0 -12
  6. package/dist/factory.js +0 -24
  7. package/dist/factory.js.map +0 -1
  8. package/dist/filter/check_where_clause_on_address_space.d.ts +0 -3
  9. package/dist/filter/check_where_clause_on_address_space.js +0 -23
  10. package/dist/filter/check_where_clause_on_address_space.js.map +0 -1
  11. package/dist/filter/extract_event_fields.d.ts +0 -10
  12. package/dist/filter/extract_event_fields.js +0 -18
  13. package/dist/filter/extract_event_fields.js.map +0 -1
  14. package/dist/helper.d.ts +0 -10
  15. package/dist/helper.js +0 -76
  16. package/dist/helper.js.map +0 -1
  17. package/dist/history_server_capabilities.d.ts +0 -35
  18. package/dist/history_server_capabilities.js +0 -44
  19. package/dist/history_server_capabilities.js.map +0 -1
  20. package/dist/i_channel_data.d.ts +0 -13
  21. package/dist/i_channel_data.js +0 -3
  22. package/dist/i_channel_data.js.map +0 -1
  23. package/dist/i_register_server_manager.d.ts +0 -16
  24. package/dist/i_register_server_manager.js +0 -3
  25. package/dist/i_register_server_manager.js.map +0 -1
  26. package/dist/i_server_side_publish_engine.d.ts +0 -36
  27. package/dist/i_server_side_publish_engine.js +0 -50
  28. package/dist/i_server_side_publish_engine.js.map +0 -1
  29. package/dist/i_socket_data.d.ts +0 -11
  30. package/dist/i_socket_data.js +0 -3
  31. package/dist/i_socket_data.js.map +0 -1
  32. package/dist/index.d.ts +0 -16
  33. package/dist/index.js +0 -33
  34. package/dist/index.js.map +0 -1
  35. package/dist/monitored_item.d.ts +0 -188
  36. package/dist/monitored_item.js +0 -1113
  37. package/dist/monitored_item.js.map +0 -1
  38. package/dist/node_sampler.d.ts +0 -3
  39. package/dist/node_sampler.js +0 -80
  40. package/dist/node_sampler.js.map +0 -1
  41. package/dist/opcua_server.d.ts +0 -747
  42. package/dist/opcua_server.js +0 -2429
  43. package/dist/opcua_server.js.map +0 -1
  44. package/dist/queue.d.ts +0 -11
  45. package/dist/queue.js +0 -72
  46. package/dist/queue.js.map +0 -1
  47. package/dist/register_server_manager.d.ts +0 -96
  48. package/dist/register_server_manager.js +0 -585
  49. package/dist/register_server_manager.js.map +0 -1
  50. package/dist/register_server_manager_hidden.d.ts +0 -17
  51. package/dist/register_server_manager_hidden.js +0 -28
  52. package/dist/register_server_manager_hidden.js.map +0 -1
  53. package/dist/register_server_manager_mdns_only.d.ts +0 -22
  54. package/dist/register_server_manager_mdns_only.js +0 -56
  55. package/dist/register_server_manager_mdns_only.js.map +0 -1
  56. package/dist/sampling_func.d.ts +0 -3
  57. package/dist/sampling_func.js +0 -3
  58. package/dist/sampling_func.js.map +0 -1
  59. package/dist/server_capabilities.d.ts +0 -148
  60. package/dist/server_capabilities.js +0 -102
  61. package/dist/server_capabilities.js.map +0 -1
  62. package/dist/server_end_point.d.ts +0 -185
  63. package/dist/server_end_point.js +0 -841
  64. package/dist/server_end_point.js.map +0 -1
  65. package/dist/server_engine.d.ts +0 -318
  66. package/dist/server_engine.js +0 -1775
  67. package/dist/server_engine.js.map +0 -1
  68. package/dist/server_publish_engine.d.ts +0 -113
  69. package/dist/server_publish_engine.js +0 -542
  70. package/dist/server_publish_engine.js.map +0 -1
  71. package/dist/server_publish_engine_for_orphan_subscriptions.d.ts +0 -16
  72. package/dist/server_publish_engine_for_orphan_subscriptions.js +0 -52
  73. package/dist/server_publish_engine_for_orphan_subscriptions.js.map +0 -1
  74. package/dist/server_session.d.ts +0 -185
  75. package/dist/server_session.js +0 -758
  76. package/dist/server_session.js.map +0 -1
  77. package/dist/server_subscription.d.ts +0 -421
  78. package/dist/server_subscription.js +0 -1348
  79. package/dist/server_subscription.js.map +0 -1
  80. package/dist/sessions_compatible_for_transfer.d.ts +0 -2
  81. package/dist/sessions_compatible_for_transfer.js +0 -40
  82. package/dist/sessions_compatible_for_transfer.js.map +0 -1
  83. package/dist/user_manager.d.ts +0 -32
  84. package/dist/user_manager.js +0 -99
  85. package/dist/user_manager.js.map +0 -1
  86. package/dist/user_manager_ua.d.ts +0 -3
  87. package/dist/user_manager_ua.js +0 -40
  88. package/dist/user_manager_ua.js.map +0 -1
  89. package/dist/validate_filter.d.ts +0 -5
  90. package/dist/validate_filter.js +0 -82
  91. package/dist/validate_filter.js.map +0 -1
@@ -1,491 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.OPCUABaseServer = void 0;
13
- /**
14
- * @module node-opcua-server
15
- */
16
- // tslint:disable:no-console
17
- const fs = require("fs");
18
- const path = require("path");
19
- const os = require("os");
20
- const async = require("async");
21
- const chalk = require("chalk");
22
- const global_mutex_1 = require("@ster5/global-mutex");
23
- const node_opcua_assert_1 = require("node-opcua-assert");
24
- const node_opcua_certificate_manager_1 = require("node-opcua-certificate-manager");
25
- const node_opcua_common_1 = require("node-opcua-common");
26
- const node_opcua_data_model_1 = require("node-opcua-data-model");
27
- const node_opcua_date_time_1 = require("node-opcua-date-time");
28
- const node_opcua_debug_1 = require("node-opcua-debug");
29
- const node_opcua_debug_2 = require("node-opcua-debug");
30
- const node_opcua_hostname_1 = require("node-opcua-hostname");
31
- const node_opcua_service_discovery_1 = require("node-opcua-service-discovery");
32
- const node_opcua_service_endpoints_1 = require("node-opcua-service-endpoints");
33
- const node_opcua_service_endpoints_2 = require("node-opcua-service-endpoints");
34
- const node_opcua_service_secure_channel_1 = require("node-opcua-service-secure-channel");
35
- const node_opcua_status_code_1 = require("node-opcua-status-code");
36
- const node_opcua_utils_1 = require("node-opcua-utils");
37
- const node_opcua_client_1 = require("node-opcua-client");
38
- const doDebug = (0, node_opcua_debug_1.checkDebugFlag)(__filename);
39
- const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
40
- const errorLog = (0, node_opcua_debug_1.make_errorLog)(__filename);
41
- const warningLog = errorLog;
42
- const default_server_info = {
43
- // The globally unique identifier for the application instance. This URI is used as
44
- // ServerUri in Services if the application is a Server.
45
- applicationUri: (0, node_opcua_common_1.makeApplicationUrn)(os.hostname(), "NodeOPCUA-Server"),
46
- // The globally unique identifier for the product.
47
- productUri: "NodeOPCUA-Server",
48
- // A localized descriptive name for the application.
49
- applicationName: { text: "NodeOPCUA", locale: "en" },
50
- applicationType: node_opcua_service_endpoints_1.ApplicationType.Server,
51
- gatewayServerUri: "",
52
- discoveryProfileUri: "",
53
- discoveryUrls: []
54
- };
55
- function cleanupEndpoint(endpoint) {
56
- if (endpoint._on_new_channel) {
57
- (0, node_opcua_assert_1.assert)(typeof endpoint._on_new_channel === "function");
58
- endpoint.removeListener("newChannel", endpoint._on_new_channel);
59
- endpoint._on_new_channel = undefined;
60
- }
61
- if (endpoint._on_close_channel) {
62
- (0, node_opcua_assert_1.assert)(typeof endpoint._on_close_channel === "function");
63
- endpoint.removeListener("closeChannel", endpoint._on_close_channel);
64
- endpoint._on_close_channel = undefined;
65
- }
66
- if (endpoint._on_connectionRefused) {
67
- (0, node_opcua_assert_1.assert)(typeof endpoint._on_connectionRefused === "function");
68
- endpoint.removeListener("connectionRefused", endpoint._on_connectionRefused);
69
- endpoint._on_connectionRefused = undefined;
70
- }
71
- if (endpoint._on_openSecureChannelFailure) {
72
- (0, node_opcua_assert_1.assert)(typeof endpoint._on_openSecureChannelFailure === "function");
73
- endpoint.removeListener("openSecureChannelFailure", endpoint._on_openSecureChannelFailure);
74
- endpoint._on_openSecureChannelFailure = undefined;
75
- }
76
- }
77
- const emptyCallback = () => {
78
- /* empty */
79
- };
80
- /**
81
- * @class OPCUABaseServer
82
- * @constructor
83
- */
84
- class OPCUABaseServer extends node_opcua_common_1.OPCUASecureObject {
85
- /**
86
- * The type of server
87
- */
88
- get serverType() {
89
- return this.serverInfo.applicationType;
90
- }
91
- constructor(options) {
92
- var _a, _b;
93
- options = options || {};
94
- if (!options.serverCertificateManager) {
95
- options.serverCertificateManager = (0, node_opcua_certificate_manager_1.getDefaultCertificateManager)("PKI");
96
- }
97
- options.privateKeyFile = options.privateKeyFile || options.serverCertificateManager.privateKey;
98
- options.certificateFile =
99
- options.certificateFile || path.join(options.serverCertificateManager.rootDir, "own/certs/certificate.pem");
100
- super(options);
101
- this.serverCertificateManager = options.serverCertificateManager;
102
- this.capabilitiesForMDNS = [];
103
- this.endpoints = [];
104
- this.options = options;
105
- this._preInitTask = [];
106
- const serverInfo = Object.assign(Object.assign({}, default_server_info), options.serverInfo);
107
- serverInfo.applicationName = (0, node_opcua_data_model_1.coerceLocalizedText)(serverInfo.applicationName);
108
- this.serverInfo = new node_opcua_service_endpoints_2.ApplicationDescription(serverInfo);
109
- if (this.serverInfo.applicationName.toString().match(/urn:/)) {
110
- errorLog("[NODE-OPCUA-E06] application name cannot be a urn", this.serverInfo.applicationName.toString());
111
- }
112
- this.serverInfo.applicationName.locale = ((_a = this.serverInfo.applicationName) === null || _a === void 0 ? void 0 : _a.locale) || "en";
113
- if (!((_b = this.serverInfo.applicationName) === null || _b === void 0 ? void 0 : _b.locale)) {
114
- warningLog("[NODE-OPCUA-W24] the server applicationName must have a valid locale : ", this.serverInfo.applicationName.toString());
115
- }
116
- const __applicationUri = serverInfo.applicationUri || "";
117
- this.serverInfo.__defineGetter__("applicationUri", () => (0, node_opcua_hostname_1.resolveFullyQualifiedDomainName)(__applicationUri));
118
- this._preInitTask.push(() => __awaiter(this, void 0, void 0, function* () {
119
- const fqdn = yield (0, node_opcua_hostname_1.extractFullyQualifiedDomainName)();
120
- }));
121
- this._preInitTask.push(() => __awaiter(this, void 0, void 0, function* () {
122
- yield this.initializeCM();
123
- }));
124
- }
125
- createDefaultCertificate() {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- if (fs.existsSync(this.certificateFile)) {
128
- return;
129
- }
130
- // collect all hostnames
131
- const hostnames = [];
132
- for (const e of this.endpoints) {
133
- for (const ee of e.endpointDescriptions()) {
134
- /* to do */
135
- }
136
- }
137
- const lockfile = path.join(this.certificateFile + ".lock");
138
- yield (0, global_mutex_1.withLock)({ lockfile }, () => __awaiter(this, void 0, void 0, function* () {
139
- if (!fs.existsSync(this.certificateFile)) {
140
- const applicationUri = this.serverInfo.applicationUri;
141
- const fqdn = (0, node_opcua_hostname_1.getFullyQualifiedDomainName)();
142
- const hostname = (0, node_opcua_hostname_1.getHostname)();
143
- const dns = [...new Set([fqdn, hostname])];
144
- yield this.serverCertificateManager.createSelfSignedCertificate({
145
- applicationUri,
146
- dns,
147
- // ip: await getIpAddresses(),
148
- outputFile: this.certificateFile,
149
- subject: (0, node_opcua_certificate_manager_1.makeSubject)(this.serverInfo.applicationName.text, hostname),
150
- startDate: new Date(),
151
- validity: 365 * 10 // 10 years
152
- });
153
- }
154
- }));
155
- });
156
- }
157
- initializeCM() {
158
- return __awaiter(this, void 0, void 0, function* () {
159
- yield this.serverCertificateManager.initialize();
160
- yield this.createDefaultCertificate();
161
- debugLog("privateKey = ", this.privateKeyFile, this.serverCertificateManager.privateKey);
162
- debugLog("certificateFile = ", this.certificateFile);
163
- yield node_opcua_client_1.performCertificateSanityCheck.call(this, "server", this.serverCertificateManager, this.serverInfo.applicationUri);
164
- });
165
- }
166
- /**
167
- * start all registered endPoint, in parallel, and call done when all endPoints are listening.
168
- * @method start
169
- * @async
170
- * @param {callback} done
171
- */
172
- start(done) {
173
- (0, node_opcua_assert_1.assert)(typeof done === "function");
174
- this.startAsync()
175
- .then(() => done(null))
176
- .catch((err) => done(err));
177
- }
178
- performPreInitialization() {
179
- return __awaiter(this, void 0, void 0, function* () {
180
- const tasks = this._preInitTask;
181
- this._preInitTask = [];
182
- for (const task of tasks) {
183
- yield task();
184
- }
185
- });
186
- }
187
- startAsync() {
188
- return __awaiter(this, void 0, void 0, function* () {
189
- yield this.performPreInitialization();
190
- (0, node_opcua_assert_1.assert)(Array.isArray(this.endpoints));
191
- (0, node_opcua_assert_1.assert)(this.endpoints.length > 0, "We need at least one end point");
192
- (0, node_opcua_date_time_1.installPeriodicClockAdjustment)();
193
- // eslint-disable-next-line @typescript-eslint/no-this-alias
194
- const server = this;
195
- const _on_new_channel = function (channel) {
196
- server.emit("newChannel", channel, this);
197
- };
198
- const _on_close_channel = function (channel) {
199
- server.emit("closeChannel", channel, this);
200
- };
201
- const _on_connectionRefused = function (socketData) {
202
- server.emit("connectionRefused", socketData, this);
203
- };
204
- const _on_openSecureChannelFailure = function (socketData, channelData) {
205
- server.emit("openSecureChannelFailure", socketData, channelData, this);
206
- };
207
- const promises = [];
208
- for (const endpoint of this.endpoints) {
209
- (0, node_opcua_assert_1.assert)(!endpoint._on_close_channel);
210
- endpoint._on_new_channel = _on_new_channel;
211
- endpoint.on("newChannel", endpoint._on_new_channel);
212
- endpoint._on_close_channel = _on_close_channel;
213
- endpoint.on("closeChannel", endpoint._on_close_channel);
214
- endpoint._on_connectionRefused = _on_connectionRefused;
215
- endpoint.on("connectionRefused", endpoint._on_connectionRefused);
216
- endpoint._on_openSecureChannelFailure = _on_openSecureChannelFailure;
217
- endpoint.on("openSecureChannelFailure", endpoint._on_openSecureChannelFailure);
218
- promises.push(new Promise((resolve, reject) => endpoint.start((err) => (err ? reject(err) : resolve()))));
219
- }
220
- yield Promise.all(promises);
221
- });
222
- }
223
- /**
224
- * shutdown all server endPoints
225
- * @async
226
- */
227
- shutdown(done) {
228
- (0, node_opcua_assert_1.assert)(typeof done === "function");
229
- (0, node_opcua_date_time_1.uninstallPeriodicClockAdjustment)();
230
- this.serverCertificateManager.dispose().then(() => {
231
- debugLog("OPCUABaseServer#shutdown starting");
232
- async.forEach(this.endpoints, (endpoint, callback) => {
233
- cleanupEndpoint(endpoint);
234
- endpoint.shutdown(callback);
235
- }, (err) => {
236
- debugLog("shutdown completed");
237
- done(err);
238
- });
239
- });
240
- }
241
- shutdownChannels(callback) {
242
- (0, node_opcua_assert_1.assert)(typeof callback === "function");
243
- debugLog("OPCUABaseServer#shutdownChannels");
244
- async.forEach(this.endpoints, (endpoint, inner_callback) => {
245
- debugLog(" shutting down endpoint ", endpoint.endpointDescriptions()[0].endpointUrl);
246
- async.series([
247
- // xx (callback2: (err?: Error| null) => void) => {
248
- // xx endpoint.suspendConnection(callback2);
249
- // xx },
250
- (callback2) => {
251
- endpoint.abruptlyInterruptChannels();
252
- endpoint.shutdown(callback2);
253
- }
254
- // xx (callback2: (err?: Error| null) => void) => {
255
- // xx endpoint.restoreConnection(callback2);
256
- // xx }
257
- ], inner_callback);
258
- }, callback);
259
- }
260
- /**
261
- * @private
262
- */
263
- on_request(message, channel) {
264
- (0, node_opcua_assert_1.assert)(message.request);
265
- (0, node_opcua_assert_1.assert)(message.requestId !== 0);
266
- const request = message.request;
267
- // install channel._on_response so we can intercept its call and emit the "response" event.
268
- if (!channel._on_response) {
269
- channel._on_response = (msg, response1 /*, inner_message: Message*/) => {
270
- this.emit("response", response1, channel);
271
- };
272
- }
273
- // prepare request
274
- this.prepare(message, channel);
275
- if (doDebug) {
276
- debugLog(chalk.green.bold("--------------------------------------------------------"), channel.channelId, request.schema.name);
277
- }
278
- let errMessage;
279
- let response;
280
- this.emit("request", request, channel);
281
- try {
282
- // handler must be named _on_ActionRequest()
283
- const handler = this["_on_" + request.schema.name];
284
- if (typeof handler === "function") {
285
- // eslint-disable-next-line prefer-rest-params
286
- handler.apply(this, arguments);
287
- }
288
- else {
289
- errMessage = "[NODE-OPCUA-W07] Unsupported Service : " + request.schema.name;
290
- warningLog(errMessage);
291
- debugLog(chalk.red.bold(errMessage));
292
- response = makeServiceFault(node_opcua_status_code_1.StatusCodes.BadServiceUnsupported, [errMessage]);
293
- channel.send_response("MSG", response, message, emptyCallback);
294
- }
295
- }
296
- catch (err) {
297
- /* istanbul ignore if */
298
- const errMessage1 = "[NODE-OPCUA-W08] EXCEPTION CAUGHT WHILE PROCESSING REQUEST !! " + request.schema.name;
299
- warningLog(chalk.red.bold(errMessage1));
300
- warningLog(request.toString());
301
- (0, node_opcua_debug_2.displayTraceFromThisProjectOnly)(err);
302
- let additional_messages = [];
303
- additional_messages.push("EXCEPTION CAUGHT WHILE PROCESSING REQUEST !!! " + request.schema.name);
304
- if (err instanceof Error) {
305
- additional_messages.push(err.message);
306
- if (err.stack) {
307
- additional_messages = additional_messages.concat(err.stack.split("\n"));
308
- }
309
- }
310
- response = makeServiceFault(node_opcua_status_code_1.StatusCodes.BadInternalError, additional_messages);
311
- channel.send_response("MSG", response, message, emptyCallback);
312
- }
313
- }
314
- /**
315
- * @private
316
- */
317
- _get_endpoints(endpointUrl) {
318
- let endpoints = [];
319
- for (const endPoint of this.endpoints) {
320
- const ep = endPoint.endpointDescriptions();
321
- const epFiltered = endpointUrl ? ep.filter((e) => (0, node_opcua_utils_1.matchUri)(e.endpointUrl, endpointUrl)) : ep;
322
- endpoints = endpoints.concat(epFiltered);
323
- }
324
- return endpoints;
325
- }
326
- /**
327
- * get one of the possible endpointUrl
328
- */
329
- getEndpointUrl() {
330
- return this._get_endpoints()[0].endpointUrl;
331
- }
332
- getDiscoveryUrls() {
333
- const discoveryUrls = this.endpoints.map((e) => {
334
- return e.endpointDescriptions()[0].endpointUrl;
335
- });
336
- return discoveryUrls;
337
- }
338
- getServers(channel) {
339
- this.serverInfo.discoveryUrls = this.getDiscoveryUrls();
340
- const servers = [this.serverInfo];
341
- return servers;
342
- }
343
- suspendEndPoints(callback) {
344
- /* istanbul ignore next */
345
- if (!callback) {
346
- throw new Error("Internal Error");
347
- }
348
- async.forEach(this.endpoints, (ep, _inner_callback) => {
349
- /* istanbul ignore next */
350
- if (doDebug) {
351
- debugLog("Suspending ", ep.endpointDescriptions()[0].endpointUrl);
352
- }
353
- ep.suspendConnection((err) => {
354
- /* istanbul ignore next */
355
- if (doDebug) {
356
- debugLog("Suspended ", ep.endpointDescriptions()[0].endpointUrl);
357
- }
358
- _inner_callback(err);
359
- });
360
- }, (err) => callback(err));
361
- }
362
- resumeEndPoints(callback) {
363
- async.forEach(this.endpoints, (ep, _inner_callback) => {
364
- ep.restoreConnection(_inner_callback);
365
- }, (err) => callback(err));
366
- }
367
- prepare(message, channel) {
368
- /* empty */
369
- }
370
- /**
371
- * @private
372
- */
373
- _on_GetEndpointsRequest(message, channel) {
374
- const request = message.request;
375
- (0, node_opcua_assert_1.assert)(request.schema.name === "GetEndpointsRequest");
376
- const response = new node_opcua_service_endpoints_1.GetEndpointsResponse({});
377
- /**
378
- * endpointUrl String The network address that the Client used to access the DiscoveryEndpoint.
379
- * The Server uses this information for diagnostics and to determine what URLs to return in the response.
380
- * The Server should return a suitable default URL if it does not recognize the HostName in the URL
381
- * localeIds []LocaleId List of locales to use.
382
- * Specifies the locale to use when returning human readable strings.
383
- * profileUris [] String List of Transport Profile that the returned Endpoints shall support.
384
- * OPC 10000-7 defines URIs for the Transport Profiles.
385
- * All Endpoints are returned if the list is empty.
386
- * If the URI is a URL, this URL may have a query string appended.
387
- * The Transport Profiles that support query strings are defined in OPC 10000-7.
388
- */
389
- response.endpoints = this._get_endpoints(null);
390
- const e = response.endpoints.map((e) => e.endpointUrl);
391
- if (request.endpointUrl) {
392
- const filtered = response.endpoints.filter((endpoint) => endpoint.endpointUrl === request.endpointUrl);
393
- if (filtered.length > 0) {
394
- response.endpoints = filtered;
395
- }
396
- }
397
- response.endpoints = response.endpoints.filter((endpoint) => !endpoint.restricted);
398
- // apply filters
399
- if (request.profileUris && request.profileUris.length > 0) {
400
- response.endpoints = response.endpoints.filter((endpoint) => {
401
- return request.profileUris.indexOf(endpoint.transportProfileUri) >= 0;
402
- });
403
- }
404
- // adjust locale on ApplicationName to match requested local or provide
405
- // a string with neutral locale (locale === null)
406
- // TODO: find a better way to handle this
407
- response.endpoints.forEach((endpoint) => {
408
- endpoint.server.applicationName.locale = "en-US";
409
- });
410
- channel.send_response("MSG", response, message, emptyCallback);
411
- }
412
- /**
413
- * @private
414
- */
415
- _on_FindServersRequest(message, channel) {
416
- // Release 1.02 13 OPC Unified Architecture, Part 4 :
417
- // This Service can be used without security and it is therefore vulnerable to Denial Of Service (DOS)
418
- // attacks. A Server should minimize the amount of processing required to send the response for this
419
- // Service. This can be achieved by preparing the result in advance. The Server should also add a
420
- // short delay before starting processing of a request during high traffic conditions.
421
- const shortDelay = 100; // milliseconds
422
- setTimeout(() => {
423
- const request = message.request;
424
- (0, node_opcua_assert_1.assert)(request.schema.name === "FindServersRequest");
425
- if (!(request instanceof node_opcua_service_discovery_1.FindServersRequest)) {
426
- throw new Error("Invalid request type");
427
- }
428
- let servers = this.getServers(channel);
429
- // apply filters
430
- // TODO /
431
- if (request.serverUris && request.serverUris.length > 0) {
432
- // A serverUri matches the applicationUri from the ApplicationDescription define
433
- servers = servers.filter((inner_Server) => {
434
- return request.serverUris.indexOf(inner_Server.applicationUri) >= 0;
435
- });
436
- }
437
- function adapt(applicationDescription) {
438
- return new node_opcua_service_endpoints_2.ApplicationDescription({
439
- applicationName: applicationDescription.applicationName,
440
- applicationType: applicationDescription.applicationType,
441
- applicationUri: applicationDescription.applicationUri,
442
- discoveryProfileUri: applicationDescription.discoveryProfileUri,
443
- discoveryUrls: applicationDescription.discoveryUrls,
444
- gatewayServerUri: applicationDescription.gatewayServerUri,
445
- productUri: applicationDescription.productUri
446
- });
447
- }
448
- const response = new node_opcua_service_discovery_1.FindServersResponse({
449
- servers: servers.map(adapt)
450
- });
451
- channel.send_response("MSG", response, message, emptyCallback);
452
- }, shortDelay);
453
- }
454
- /**
455
- * returns a array of currently active channels
456
- */
457
- getChannels() {
458
- let channels = [];
459
- for (const endpoint of this.endpoints) {
460
- const c = endpoint.getChannels();
461
- channels = channels.concat(c);
462
- }
463
- return channels;
464
- }
465
- }
466
- exports.OPCUABaseServer = OPCUABaseServer;
467
- OPCUABaseServer.makeServiceFault = makeServiceFault;
468
- /**
469
- * construct a service Fault response
470
- * @method makeServiceFault
471
- * @param statusCode
472
- * @param messages
473
- */
474
- function makeServiceFault(statusCode, messages) {
475
- const response = new node_opcua_service_secure_channel_1.ServiceFault();
476
- response.responseHeader.serviceResult = statusCode;
477
- // xx response.serviceDiagnostics.push( new DiagnosticInfo({ additionalInfo: messages.join("\n")}));
478
- (0, node_opcua_assert_1.assert)(Array.isArray(messages));
479
- (0, node_opcua_assert_1.assert)(typeof messages[0] === "string");
480
- response.responseHeader.stringTable = messages;
481
- // tslint:disable:no-console
482
- warningLog(chalk.cyan(" messages "), messages.join("\n"));
483
- return response;
484
- }
485
- // tslint:disable:no-var-requires
486
- const thenify = require("thenify");
487
- const opts = { multiArgs: false };
488
- OPCUABaseServer.prototype.resumeEndPoints = thenify.withCallback(OPCUABaseServer.prototype.resumeEndPoints, opts);
489
- OPCUABaseServer.prototype.suspendEndPoints = thenify.withCallback(OPCUABaseServer.prototype.suspendEndPoints, opts);
490
- OPCUABaseServer.prototype.shutdownChannels = thenify.withCallback(OPCUABaseServer.prototype.shutdownChannels, opts);
491
- //# sourceMappingURL=base_server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base_server.js","sourceRoot":"","sources":["../source/base_server.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,4BAA4B;AAC5B,yBAAyB;AACzB,6BAA6B;AAC7B,yBAAyB;AACzB,+BAA+B;AAC/B,+BAA+B;AAC/B,sDAA+C;AAC/C,yDAA2C;AAC3C,mFAKwC;AACxC,yDAAqG;AACrG,iEAA2E;AAC3E,+DAAwG;AACxG,uDAAgF;AAChF,uDAAmE;AACnE,6DAK6B;AAE7B,+EAAuF;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/C,4BAA4B;IAC5B,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,iCAAiC;AACjC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACnC,MAAM,IAAI,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAClC,eAAe,CAAC,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AAClH,eAAe,CAAC,SAAS,CAAC,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACpH,eAAe,CAAC,SAAS,CAAC,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC"}
package/dist/factory.d.ts DELETED
@@ -1,12 +0,0 @@
1
- /**
2
- * @module node-opcua-server
3
- */
4
- import { ExtensionObject } from "node-opcua-extension-object";
5
- import { ExpandedNodeId } from "node-opcua-nodeid";
6
- export interface EngineForFactory {
7
- }
8
- export declare class Factory {
9
- engine: EngineForFactory;
10
- constructor(engine: EngineForFactory);
11
- constructObject(id: ExpandedNodeId): ExtensionObject;
12
- }
package/dist/factory.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module node-opcua-server
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Factory = void 0;
7
- const node_opcua_assert_1 = require("node-opcua-assert");
8
- const node_opcua_extension_object_1 = require("node-opcua-extension-object");
9
- const node_opcua_factory_1 = require("node-opcua-factory");
10
- class Factory {
11
- constructor(engine) {
12
- (0, node_opcua_assert_1.assert)(engine !== null && typeof engine === "object");
13
- this.engine = engine;
14
- }
15
- constructObject(id) {
16
- const obj = (0, node_opcua_factory_1.getStandardDataTypeFactory)().constructObject(id);
17
- if (!(obj instanceof node_opcua_extension_object_1.ExtensionObject)) {
18
- throw new Error("Internal Error constructObject");
19
- }
20
- return obj;
21
- }
22
- }
23
- exports.Factory = Factory;
24
- //# sourceMappingURL=factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../source/factory.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,yDAA2C;AAC3C,6EAA8D;AAC9D,2DAAgE;AAMhE,MAAa,OAAO;IAGhB,YAAY,MAAwB;QAChC,IAAA,0BAAM,EAAC,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,eAAe,CAAC,EAAkB;QACrC,MAAM,GAAG,GAAG,IAAA,+CAA0B,GAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,CAAC,GAAG,YAAY,6CAAe,CAAC,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACrD;QACD,OAAO,GAAsB,CAAC;IAClC,CAAC;CACJ;AAfD,0BAeC"}
@@ -1,3 +0,0 @@
1
- import { IAddressSpace, ISessionContext, IEventData } from "node-opcua-address-space-base";
2
- import { ContentFilter } from "node-opcua-types";
3
- export declare function checkWhereClauseOnAdressSpace(addressSpace: IAddressSpace, sessionContext: ISessionContext, whereClause: ContentFilter, eventData: IEventData): boolean;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkWhereClauseOnAdressSpace = void 0;
4
- const node_opcua_service_filter_1 = require("node-opcua-service-filter");
5
- const node_opcua_service_filter_2 = require("node-opcua-service-filter");
6
- function checkWhereClauseOnAdressSpace(addressSpace, sessionContext, whereClause, eventData) {
7
- // const filterContext: FilterContext = {
8
- // addressSpace,
9
- // sessionContext,
10
- // rootNode: eventData.$eventDataSource!,
11
- // extractValue(operand: FilterOperand) {
12
- // if (operand instanceof SimpleAttributeOperand) {
13
- // return extractEventFields(filterContext.sessionContext, [operand], eventData)[0];
14
- // } else {
15
- // return new Variant({ dataType: DataType.Null });
16
- // }
17
- // }
18
- // };
19
- const filterContext = new node_opcua_service_filter_2.FilterContextOnAddressSpace(sessionContext, eventData);
20
- return (0, node_opcua_service_filter_1.checkFilter)(filterContext, whereClause);
21
- }
22
- exports.checkWhereClauseOnAdressSpace = checkWhereClauseOnAdressSpace;
23
- //# sourceMappingURL=check_where_clause_on_address_space.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check_where_clause_on_address_space.js","sourceRoot":"","sources":["../../source/filter/check_where_clause_on_address_space.ts"],"names":[],"mappings":";;;AACA,yEAAwD;AACxD,yEAAwE;AAGxE,SAAgB,6BAA6B,CACzC,YAA2B,EAC3B,cAA+B,EAC/B,WAA0B,EAC1B,SAAqB;IAIrB,yCAAyC;IACzC,oBAAoB;IACpB,sBAAsB;IACtB,6CAA6C;IAC7C,6CAA6C;IAC7C,2DAA2D;IAC3D,gGAAgG;IAChG,mBAAmB;IACnB,+DAA+D;IAC/D,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,MAAM,aAAa,GAAG,IAAI,uDAA2B,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAEjF,OAAO,IAAA,uCAAW,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC;AAvBD,sEAuBC"}
@@ -1,10 +0,0 @@
1
- import { IEventData, ISessionContext } from "node-opcua-address-space-base";
2
- import { SimpleAttributeOperand } from "node-opcua-types";
3
- import { Variant } from "node-opcua-variant";
4
- /**
5
- * @method extractEventFields
6
- * extract a array of eventFields from a event node, matching the selectClauses
7
- * @param selectClauses
8
- * @param eventData : a pseudo Node that provides a browse Method and a readValue(nodeId)
9
- */
10
- export declare function extractEventFields(sessionContext: ISessionContext, selectClauses: SimpleAttributeOperand[], eventData: IEventData): Variant[];
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractEventFields = void 0;
4
- const node_opcua_service_filter_1 = require("node-opcua-service-filter");
5
- const node_opcua_service_filter_2 = require("node-opcua-service-filter");
6
- //
7
- /**
8
- * @method extractEventFields
9
- * extract a array of eventFields from a event node, matching the selectClauses
10
- * @param selectClauses
11
- * @param eventData : a pseudo Node that provides a browse Method and a readValue(nodeId)
12
- */
13
- function extractEventFields(sessionContext, selectClauses, eventData) {
14
- const context = new node_opcua_service_filter_2.FilterContextOnAddressSpace(sessionContext, eventData);
15
- return (0, node_opcua_service_filter_1.extractEventFieldsBase)(context, selectClauses);
16
- }
17
- exports.extractEventFields = extractEventFields;
18
- //# sourceMappingURL=extract_event_fields.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extract_event_fields.js","sourceRoot":"","sources":["../../source/filter/extract_event_fields.ts"],"names":[],"mappings":";;;AACA,yEAAmE;AACnE,yEAAwE;AAGxE,EAAE;AAEF;;;;;GAKG;AACH,SAAgB,kBAAkB,CAC9B,cAA+B,EAC/B,aAAuC,EACvC,SAAqB;IAErB,MAAM,OAAO,GAAG,IAAI,uDAA2B,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAC3E,OAAO,IAAA,kDAAsB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAC1D,CAAC;AAPD,gDAOC"}
package/dist/helper.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { OPCUAServer } from "./opcua_server";
2
- import { ServerEngine } from "./server_engine";
3
- import { Subscription } from "./server_subscription";
4
- /**
5
- *
6
- * @private
7
- */
8
- export declare function installSessionLogging(server: OPCUAServer): void;
9
- export declare function installSubscriptionMonitoring(subscription: Subscription): void;
10
- export declare function installSessionLoggingOnEngine(serverEngine: ServerEngine): void;